Skip to content
Snippets Groups Projects
Commit d68c5bac authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

WIP bootstrap 3 => 4

parent 2ca70d49
No related branches found
No related tags found
No related merge requests found
Showing
with 63 additions and 57 deletions
...@@ -52,7 +52,7 @@ class UserCurrent extends UserAbstract ...@@ -52,7 +52,7 @@ class UserCurrent extends UserAbstract
$selectableRoles = $this->getUserContext()->getSelectableIdentityRoles(); $selectableRoles = $this->getUserContext()->getSelectableIdentityRoles();
$role = current($selectableRoles) ?: $this->getUserContext()->getIdentityRole('user'); $role = current($selectableRoles) ?: $this->getUserContext()->getIdentityRole('user');
} }
$status .= sprintf(", <small class='role-libelle'>%s</small>", !method_exists($role, '__toString') ? $role->getRoleId() : $role); $status .= sprintf("<br/><small class='role-libelle'>%s</small>", !method_exists($role, '__toString') ? $role->getRoleId() : $role);
} }
$userProfileHelper = $this->getView()->plugin('userProfile'); /* @var $userProfileHelper UserProfile */ $userProfileHelper = $this->getView()->plugin('userProfile'); /* @var $userProfileHelper UserProfile */
...@@ -77,13 +77,13 @@ class UserCurrent extends UserAbstract ...@@ -77,13 +77,13 @@ class UserCurrent extends UserAbstract
} }
$out = <<<EOS $out = <<<EOS
<a class="navbar-link" <a class="navbar-link dropdown-toggle"
id="$id" id="$id"
title="$title" title="$title"
data-placement="bottom" data-bs-placement="bottom"
data-toggle="popover" data-bs-toggle="popover"
data-html="true" data-bs-html="true"
data-content="$content" data-bs-content="$content"
href="#">$status<span class="caret"></span></a> href="#">$status<span class="caret"></span></a>
EOS; EOS;
$out .= PHP_EOL; $out .= PHP_EOL;
......
...@@ -36,7 +36,7 @@ class UserProfile extends UserAbstract ...@@ -36,7 +36,7 @@ class UserProfile extends UserAbstract
*/ */
public function render() public function render()
{ {
$title = _("Profil utilisateur"); $title = _("Rôle utilisateur");
$unknown = _("Inconnu"); $unknown = _("Inconnu");
$none = _("Aucun"); $none = _("Aucun");
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace UnicaenAuth\View\Helper; namespace UnicaenAuth\View\Helper;
use Zend\Permissions\Acl\Role\RoleInterface; use Zend\Permissions\Acl\Role\RoleInterface;
use Zend\View\Helper\HeadScript;
/** /**
* Aide de vue permettant à l'utilisateur de sélectionner son profil courant parmi * Aide de vue permettant à l'utilisateur de sélectionner son profil courant parmi
...@@ -79,18 +80,15 @@ class UserProfileSelect extends UserAbstract ...@@ -79,18 +80,15 @@ class UserProfileSelect extends UserAbstract
$url = $this->getView()->url('utilisateur/default', ['action' => 'selectionner-profil']); $url = $this->getView()->url('utilisateur/default', ['action' => 'selectionner-profil']);
$redirectUrl = $this->getView()->url($this->redirectRoute ?: 'home'); $redirectUrl = $this->getView()->url($this->redirectRoute ?: 'home');
$html .= <<<EOS $js = <<<EOS
<script>
$(function() { $(function() {
$("input.$inputClass").change(function() { submitProfile(); }).tooltip({ delay: 500, placement: 'left' }); $("body").on("change", "input.$inputClass", function() {
});
function submitProfile()
{
$("body *").css('cursor', 'wait'); $("body *").css('cursor', 'wait');
$.post("$url", $(".$formClass").serializeArray(), function() { $(location).attr('href', "$redirectUrl"); }); $.post("$url", $(".$formClass").serializeArray(), function() { $(location).attr('href', "$redirectUrl"); });
} });
</script> });
EOS; EOS;
$this->view->inlineScript(HeadScript::SCRIPT, $js);
return $html; return $html;
} }
......
...@@ -11,6 +11,7 @@ use Zend\Form\Element\Text; ...@@ -11,6 +11,7 @@ use Zend\Form\Element\Text;
use Zend\Form\Form; use Zend\Form\Form;
use Zend\Form\View\Helper\Form as FormHelper; use Zend\Form\View\Helper\Form as FormHelper;
use Zend\Form\View\Helper\FormElement; use Zend\Form\View\Helper\FormElement;
use Zend\View\Helper\HeadScript;
use Zend\View\Renderer\PhpRenderer; use Zend\View\Renderer\PhpRenderer;
/** /**
...@@ -145,26 +146,30 @@ class UserUsurpationHelper extends UserAbstract ...@@ -145,26 +146,30 @@ class UserUsurpationHelper extends UserAbstract
$html = ''; $html = '';
$html .= $formHelper->openTag($form); $html .= $formHelper->openTag($form);
$html .= "<div><strong>Usurpation d'identité :</strong></div>"; $html .= "<div><strong>Usurpation d'identité :</strong></div>";
$html .= $formControlGroupHelper->__invoke($identity); $html .= '<div class="row">' . PHP_EOL;
$html .= $formControlGroupHelper->__invoke($submit); $html .= '<div class="col-sm-9">' . $formControlGroupHelper->__invoke($identity) . '</div>' . PHP_EOL;
$html .= '<div class="col-sm-3">' . $formControlGroupHelper->__invoke($submit) . '</div>' . PHP_EOL;
$html .= '</div>' . PHP_EOL;
$html .= $formHelper->closeTag(); $html .= $formHelper->closeTag();
$formId = $form->getAttribute('id'); $formId = $form->getAttribute('id');
$html .= <<<EOS $js = <<<EOS
<script> $(function() {
var form = $("#$formId").submit(function() { $("body")
.on("input", ".user-usurpation-input", function() {
const input = $(this);
const submit = $(".user-usurpation-submit");
input.val().length > 0 ?
submit.prop("disabled", false) :
submit.prop("disabled", true);
})
.on("submit", "#$formId", function() {
$("body *").css('cursor', 'wait'); $("body *").css('cursor', 'wait');
}); });
var input = form.find(".user-usurpation-input").on('input', function() {
updateUsurpationSubmit();
}); });
function updateUsurpationSubmit() {
form.find(".user-usurpation-submit").prop("disabled", input.val().length === 0);
}
updateUsurpationSubmit();
</script>
EOS; EOS;
$this->view->inlineScript(HeadScript::SCRIPT, $js);
return $html; return $html;
} }
...@@ -209,6 +214,7 @@ EOS; ...@@ -209,6 +214,7 @@ EOS;
$submit = new Submit('submit'); $submit = new Submit('submit');
$submit->setValue("Usurper"); $submit->setValue("Usurper");
$submit->setAttributes([ $submit->setAttributes([
'disabled' => true,
'class' => 'user-usurpation-submit btn btn-danger', 'class' => 'user-usurpation-submit btn btn-danger',
]); ]);
......
...@@ -28,10 +28,10 @@ use Zend\Form\Form; ...@@ -28,10 +28,10 @@ use Zend\Form\Form;
<?php if ($messages = $this->flashMessenger('zfcuser-login-form')): ?> <?php if ($messages = $this->flashMessenger('zfcuser-login-form')): ?>
<?php foreach ($messages as $message): ?> <?php foreach ($messages as $message): ?>
<div class="messenger alert alert-danger "> <div class="messenger alert alert-danger alert-dismissible ">
<button type="button" class="close" title="Fermer cette alerte" data-dismiss="alert">×</button> <span class="icon icon-avertissement"></span>
<span class="glyphicon glyphicon-warning-sign"></span>
<?php echo $message ?> <br> <?php echo $message ?> <br>
<button type="button" class="btn-close" title="Fermer cette alerte" data-bs-dismiss="alert"></button>
</div> </div>
<?php endforeach ?> <?php endforeach ?>
<?php endif ?> <?php endif ?>
......
<a class="navbar-link" <a class="navbar-link"
id="user-current-info" id="user-current-info"
title="Auth user" title="Auth user"
data-placement="bottom" data-bs-placement="bottom"
data-toggle="popover" data-bs-toggle="popover"
data-content="User Profile Helper MarkupUser Info Helper Markup" data-bs-content="User Profile Helper MarkupUser Info Helper Markup"
href="#">User Status Helper Markup</a> href="#">User Status Helper Markup</a>
<a class="navbar-link" <a class="navbar-link"
id="user-current-info" id="user-current-info"
title="Utilisateur connecté à l'application" title="Utilisateur connecté à l'application"
data-placement="bottom" data-bs-placement="bottom"
data-toggle="popover" data-bs-toggle="popover"
data-content="User Profile Helper MarkupUser Info Helper Markup" data-bs-content="User Profile Helper MarkupUser Info Helper Markup"
href="#">User Status Helper Markup</a> href="#">User Status Helper Markup</a>
<a class="navbar-link" <a class="navbar-link"
id="user-current-info" id="user-current-info"
title="Auth user" title="Auth user"
data-placement="bottom" data-bs-placement="bottom"
data-toggle="popover" data-bs-toggle="popover"
data-content="None" data-bs-content="None"
href="#">User Status Helper Markup</a> href="#">User Status Helper Markup</a>
<a class="navbar-link" <a class="navbar-link"
id="user-current-info" id="user-current-info"
title="Utilisateur connecté à l'application" title="Utilisateur connecté à l'application"
data-placement="bottom" data-bs-placement="bottom"
data-toggle="popover" data-bs-toggle="popover"
data-content="Aucun" data-bs-content="Aucun"
href="#">User Status Helper Markup</a> href="#">User Status Helper Markup</a>
...@@ -19,7 +19,7 @@ use Zend\Form\Form; ...@@ -19,7 +19,7 @@ use Zend\Form\Form;
$form->prepare(); $form->prepare();
$form->setAttributes([ $form->setAttributes([
'class' => 'form-horizontal', //'class' => 'form-horizontal', // .form-horizontal n'existe plus dans boostrap 4
'role' => 'form', 'role' => 'form',
]); ]);
...@@ -45,9 +45,9 @@ $activeHelper = null; ...@@ -45,9 +45,9 @@ $activeHelper = null;
$activeClass = ''; $activeClass = '';
} }
?> ?>
<li role="presentation" class="<?php echo $activeClass ?>"> <li role="presentation" class="nav-item">
<?php $query = $redirect ? ['redirect' => $redirect] : [] ?> <?php $query = $redirect ? ['redirect' => $redirect] : [] ?>
<a href="<?php echo $this->url('zfcuser/login', ['type' => $key], ['query' => $query]) ?>"><?php echo $helper->getTitle() ?></a> <a class="nav-link <?php echo $activeClass ?>" href="<?php echo $this->url('zfcuser/login', ['type' => $key], ['query' => $query]) ?>"><?php echo $helper->getTitle() ?></a>
</li> </li>
<?php endforeach ?> <?php endforeach ?>
</ul> </ul>
......
...@@ -31,9 +31,11 @@ $this->headTitle("Connexion") ?> ...@@ -31,9 +31,11 @@ $this->headTitle("Connexion") ?>
<!-- Création d'un compte local (si autorisée) --> <!-- Création d'un compte local (si autorisée) -->
<?php if ($enableRegistration) : ?> <?php if ($enableRegistration) : ?>
<div id="div-connexion" class="panel panel-primary"> <div id="div-connexion" class="card">
<div class="card-body">
<?php echo $this->translate("Not registered?"); ?> <a href="<?php echo $this->url('zfcuser/register') . ($this->redirect ? '?redirect=' . $this->redirect : '') ?>"><?php echo $this->translate("Sign up!"); ?></a> <?php echo $this->translate("Not registered?"); ?> <a href="<?php echo $this->url('zfcuser/register') . ($this->redirect ? '?redirect=' . $this->redirect : '') ?>"><?php echo $this->translate("Sign up!"); ?></a>
</div> </div>
</div>
<?php endif; ?> <?php endif; ?>
......
...@@ -30,7 +30,7 @@ use Zend\Form\Form; ...@@ -30,7 +30,7 @@ use Zend\Form\Form;
echo $this->formInput($email); echo $this->formInput($email);
echo $this->formElementErrors($email, ['class' => 'text-danger']); echo $this->formElementErrors($email, ['class' => 'text-danger']);
?> ?>
<span class="help-block">Un lien à cliquer vous sera envoyé à cette adresse électronique.</span> <span class="form-text">Un lien à cliquer vous sera envoyé à cette adresse électronique.</span>
</p> </p>
<?php echo $this->formInput($form->get('csrf')); ?> <?php echo $this->formInput($form->get('csrf')); ?>
......
...@@ -14,7 +14,7 @@ $canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::DROIT_PRIVILEG ...@@ -14,7 +14,7 @@ $canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::DROIT_PRIVILEG
<a href="javascript:void(0)" data-action="refuser" <a href="javascript:void(0)" data-action="refuser"
title="Privilège '<?php echo $privilege->getCategorie() ?> > '<?php echo $privilege ?>' accordé au rôle '<?php echo $role ?>'. Cliquez pour le retirer."> title="Privilège '<?php echo $privilege->getCategorie() ?> > '<?php echo $privilege ?>' accordé au rôle '<?php echo $role ?>'. Cliquez pour le retirer.">
<?php endif; ?> <?php endif; ?>
<span class="glyphicon glyphicon-ok text-success"></span> <span class="icon iconly icon-oui text-success"></span>
<?php if ($canEdit): ?> <?php if ($canEdit): ?>
</a> </a>
<?php endif; ?> <?php endif; ?>
...@@ -25,7 +25,7 @@ $canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::DROIT_PRIVILEG ...@@ -25,7 +25,7 @@ $canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::DROIT_PRIVILEG
<a href="javascript:void(0)" data-action="accorder" <a href="javascript:void(0)" data-action="accorder"
title="Privilège '<?php echo $privilege->getCategorie() ?> > <?php echo $privilege ?>' refusé au rôle '<?php echo $role ?>'. Cliquez pour l'accorder."> title="Privilège '<?php echo $privilege->getCategorie() ?> > <?php echo $privilege ?>' refusé au rôle '<?php echo $role ?>'. Cliquez pour l'accorder.">
<?php endif; ?> <?php endif; ?>
<span class="glyphicon glyphicon-remove text-danger refuse"></span> <span class="icon iconly icon-non text-danger refuse"></span>
<?php if ($canEdit): ?> <?php if ($canEdit): ?>
</a> </a>
<?php endif; ?> <?php endif; ?>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
?> ?>
<h1 class="page-header">Gestion des privilèges</h1> <h1 class="page-header">Gestion des privilèges</h1>
<table class="droits-tbl table table-hover table-bordered table-condensed table-extra-condensed table-header-rotated" data-modifier-url="<?php echo $this->url('droits/privileges/modifier'); ?>"> <table class="droits-tbl table table-hover table-bordered table-sm table-extra-condensed table-header-rotated" data-modifier-url="<?php echo $this->url('droits/privileges/modifier'); ?>">
<thead> <thead>
<tr> <tr>
<th class="separator"></th> <th class="separator"></th>
......
...@@ -9,7 +9,7 @@ $canEdit = $this->isAllowed('privilege/'.Privileges::DROIT_ROLE_EDITION); ...@@ -9,7 +9,7 @@ $canEdit = $this->isAllowed('privilege/'.Privileges::DROIT_ROLE_EDITION);
$ajoutUrl = $this->url( 'droits/roles/edition' ); $ajoutUrl = $this->url( 'droits/roles/edition' );
?> ?>
<table class="table table-condensed table-bordered"> <table class="table table-sm table-bordered">
<tr> <tr>
<th>Nom</th> <th>Nom</th>
<th>Parent</th> <th>Parent</th>
...@@ -28,8 +28,8 @@ $ajoutUrl = $this->url( 'droits/roles/edition' ); ...@@ -28,8 +28,8 @@ $ajoutUrl = $this->url( 'droits/roles/edition' );
<td><?php echo $role->getAccessibleExterieur() ? 'Oui' : 'Non'; ?></td> <td><?php echo $role->getAccessibleExterieur() ? 'Oui' : 'Non'; ?></td>
<?php if ($canEdit): ?> <?php if ($canEdit): ?>
<td style="width:1%;white-space: nowrap;text-align: center"> <td style="width:1%;white-space: nowrap;text-align: center">
<a href="<?php echo $editionUrl; ?>" class="ajax-modal" data-event="role-edition"><span class="glyphicon glyphicon-edit"></span></a> <a href="<?php echo $editionUrl; ?>" class="ajax-modal" data-event="role-edition"><span class="icon iconly icon-modifier"></span></a>
<a href="<?php echo $suppressionUrl; ?>" class="ajax-modal" data-event="role-suppression"><span class="glyphicon glyphicon-remove"></span></a> <a href="<?php echo $suppressionUrl; ?>" class="ajax-modal" data-event="role-suppression"><span class="icon iconly icon-supprimer"></span></a>
</td> </td>
<?php endif; ?> <?php endif; ?>
</tr> </tr>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment