Commit d68c5bac authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

WIP bootstrap 3 => 4

parent 2ca70d49
......@@ -52,7 +52,7 @@ class UserCurrent extends UserAbstract
$selectableRoles = $this->getUserContext()->getSelectableIdentityRoles();
$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 */
......@@ -77,13 +77,13 @@ class UserCurrent extends UserAbstract
}
$out = <<<EOS
<a class="navbar-link"
<a class="navbar-link dropdown-toggle"
id="$id"
title="$title"
data-placement="bottom"
data-toggle="popover"
data-html="true"
data-content="$content"
data-bs-placement="bottom"
data-bs-toggle="popover"
data-bs-html="true"
data-bs-content="$content"
href="#">$status<span class="caret"></span></a>
EOS;
$out .= PHP_EOL;
......
......@@ -36,7 +36,7 @@ class UserProfile extends UserAbstract
*/
public function render()
{
$title = _("Profil utilisateur");
$title = _("Rôle utilisateur");
$unknown = _("Inconnu");
$none = _("Aucun");
......
......@@ -2,6 +2,7 @@
namespace UnicaenAuth\View\Helper;
use Zend\Permissions\Acl\Role\RoleInterface;
use Zend\View\Helper\HeadScript;
/**
* Aide de vue permettant à l'utilisateur de sélectionner son profil courant parmi
......@@ -79,18 +80,15 @@ class UserProfileSelect extends UserAbstract
$url = $this->getView()->url('utilisateur/default', ['action' => 'selectionner-profil']);
$redirectUrl = $this->getView()->url($this->redirectRoute ?: 'home');
$html .= <<<EOS
<script>
$(function() {
$("input.$inputClass").change(function() { submitProfile(); }).tooltip({ delay: 500, placement: 'left' });
});
function submitProfile()
{
$js = <<<EOS
$(function() {
$("body").on("change", "input.$inputClass", function() {
$("body *").css('cursor', 'wait');
$.post("$url", $(".$formClass").serializeArray(), function() { $(location).attr('href', "$redirectUrl"); });
}
</script>
});
});
EOS;
$this->view->inlineScript(HeadScript::SCRIPT, $js);
return $html;
}
......
......@@ -11,6 +11,7 @@ use Zend\Form\Element\Text;
use Zend\Form\Form;
use Zend\Form\View\Helper\Form as FormHelper;
use Zend\Form\View\Helper\FormElement;
use Zend\View\Helper\HeadScript;
use Zend\View\Renderer\PhpRenderer;
/**
......@@ -145,26 +146,30 @@ class UserUsurpationHelper extends UserAbstract
$html = '';
$html .= $formHelper->openTag($form);
$html .= "<div><strong>Usurpation d'identité :</strong></div>";
$html .= $formControlGroupHelper->__invoke($identity);
$html .= $formControlGroupHelper->__invoke($submit);
$html .= '<div class="row">' . PHP_EOL;
$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();
$formId = $form->getAttribute('id');
$html .= <<<EOS
<script>
var form = $("#$formId").submit(function() {
$("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>
$js = <<<EOS
$(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');
});
});
EOS;
$this->view->inlineScript(HeadScript::SCRIPT, $js);
return $html;
}
......@@ -209,6 +214,7 @@ EOS;
$submit = new Submit('submit');
$submit->setValue("Usurper");
$submit->setAttributes([
'disabled' => true,
'class' => 'user-usurpation-submit btn btn-danger',
]);
......
......@@ -28,10 +28,10 @@ use Zend\Form\Form;
<?php if ($messages = $this->flashMessenger('zfcuser-login-form')): ?>
<?php foreach ($messages as $message): ?>
<div class="messenger alert alert-danger ">
<button type="button" class="close" title="Fermer cette alerte" data-dismiss="alert">×</button>
<span class="glyphicon glyphicon-warning-sign"></span>
<div class="messenger alert alert-danger alert-dismissible ">
<span class="icon icon-avertissement"></span>
<?php echo $message ?> <br>
<button type="button" class="btn-close" title="Fermer cette alerte" data-bs-dismiss="alert"></button>
</div>
<?php endforeach ?>
<?php endif ?>
......
<a class="navbar-link"
id="user-current-info"
title="Auth user"
data-placement="bottom"
data-toggle="popover"
data-content="User Profile Helper MarkupUser Info Helper Markup"
data-bs-placement="bottom"
data-bs-toggle="popover"
data-bs-content="User Profile Helper MarkupUser Info Helper Markup"
href="#">User Status Helper Markup</a>
<a class="navbar-link"
id="user-current-info"
title="Utilisateur connecté à l'application"
data-placement="bottom"
data-toggle="popover"
data-content="User Profile Helper MarkupUser Info Helper Markup"
data-bs-placement="bottom"
data-bs-toggle="popover"
data-bs-content="User Profile Helper MarkupUser Info Helper Markup"
href="#">User Status Helper Markup</a>
<a class="navbar-link"
id="user-current-info"
title="Auth user"
data-placement="bottom"
data-toggle="popover"
data-content="None"
data-bs-placement="bottom"
data-bs-toggle="popover"
data-bs-content="None"
href="#">User Status Helper Markup</a>
<a class="navbar-link"
id="user-current-info"
title="Utilisateur connecté à l'application"
data-placement="bottom"
data-toggle="popover"
data-content="Aucun"
data-bs-placement="bottom"
data-bs-toggle="popover"
data-bs-content="Aucun"
href="#">User Status Helper Markup</a>
......@@ -19,7 +19,7 @@ use Zend\Form\Form;
$form->prepare();
$form->setAttributes([
'class' => 'form-horizontal',
//'class' => 'form-horizontal', // .form-horizontal n'existe plus dans boostrap 4
'role' => 'form',
]);
......@@ -45,9 +45,9 @@ $activeHelper = null;
$activeClass = '';
}
?>
<li role="presentation" class="<?php echo $activeClass ?>">
<li role="presentation" class="nav-item">
<?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>
<?php endforeach ?>
</ul>
......
......@@ -31,8 +31,10 @@ $this->headTitle("Connexion") ?>
<!-- Création d'un compte local (si autorisée) -->
<?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>
</div>
</div>
<?php endif; ?>
......
......@@ -30,7 +30,7 @@ use Zend\Form\Form;
echo $this->formInput($email);
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>
<?php echo $this->formInput($form->get('csrf')); ?>
......
......@@ -14,7 +14,7 @@ $canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::DROIT_PRIVILEG
<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.">
<?php endif; ?>
<span class="glyphicon glyphicon-ok text-success"></span>
<span class="icon iconly icon-oui text-success"></span>
<?php if ($canEdit): ?>
</a>
<?php endif; ?>
......@@ -25,7 +25,7 @@ $canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::DROIT_PRIVILEG
<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.">
<?php endif; ?>
<span class="glyphicon glyphicon-remove text-danger refuse"></span>
<span class="icon iconly icon-non text-danger refuse"></span>
<?php if ($canEdit): ?>
</a>
<?php endif; ?>
......
......@@ -6,7 +6,7 @@
?>
<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>
<tr>
<th class="separator"></th>
......
......@@ -9,7 +9,7 @@ $canEdit = $this->isAllowed('privilege/'.Privileges::DROIT_ROLE_EDITION);
$ajoutUrl = $this->url( 'droits/roles/edition' );
?>
<table class="table table-condensed table-bordered">
<table class="table table-sm table-bordered">
<tr>
<th>Nom</th>
<th>Parent</th>
......@@ -28,8 +28,8 @@ $ajoutUrl = $this->url( 'droits/roles/edition' );
<td><?php echo $role->getAccessibleExterieur() ? 'Oui' : 'Non'; ?></td>
<?php if ($canEdit): ?>
<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 $suppressionUrl; ?>" class="ajax-modal" data-event="role-suppression"><span class="glyphicon glyphicon-remove"></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="icon iconly icon-supprimer"></span></a>
</td>
<?php endif; ?>
</tr>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment