Bug 20100: (QA follow-up) Use template logic instead of js to disable superlib box
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
ccf62d46d7
commit
d31b0bfdfc
|
|
@ -36,9 +36,18 @@
|
|||
<li>
|
||||
[% END %]
|
||||
[% IF ( loo.checked ) %]
|
||||
<input type="checkbox" class="flag parent" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" checked="checked" />
|
||||
[% IF disable_superlibrarian_privs && loo.bit == 0 %]
|
||||
<input type="checkbox" disabled="disabled" class="flag parent superlib" id="flag-[% loo.bit %]_disabled" name="flag" value="[% loo.flag %]" checked="checked" />
|
||||
<input type="hidden" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" >
|
||||
[% ELSE %]
|
||||
<input type="checkbox" class="flag parent" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" checked="checked" />
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
<input type="checkbox" class="flag parent" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" />
|
||||
[% IF disable_superlibrarian_privs && loo.bit == 0 %]
|
||||
<input type="checkbox" disabled="disabled" class="flag parent" id="flag-[% loo.bit %]_disabled" name="flag" value="[% loo.flag %]" />
|
||||
[% ELSE %]
|
||||
<input type="checkbox" class="flag parent" id="flag-[% loo.bit %]" name="flag" value="[% loo.flag %]" />
|
||||
[% END %]
|
||||
[% END %]
|
||||
<label class="permissioncode" for="flag-[% loo.bit %]">[% loo.flag %]</label>
|
||||
<span class="permissiondesc">[% PROCESS main_permissions name=loo.flag %]</span>
|
||||
|
|
@ -85,13 +94,13 @@
|
|||
$("#permissionstree").treeview({animated: "fast", collapsed: true});
|
||||
|
||||
// Enforce Superlibrarian Privilege Mutual Exclusivity
|
||||
if($('input[id="flag-0"]:checked').length){
|
||||
if( $('input[id="flag-0"]:checked').length || $(".superlib:checked").length ){
|
||||
if ($('input[name="flag"]:checked').length > 1){
|
||||
alert(_("Inconsistency detected! The superlibrarian privilege is mutually exclusive of other privileges, as it includes them all. This patron's privileges will now be reset to include only superlibrarian."));
|
||||
}
|
||||
|
||||
$('input[name="flag"]').each(function() {
|
||||
if($(this).attr('id') != "flag-0"){
|
||||
if($(this).attr('id') != "flag-0" && !$(this).hasClass('superlib') ){
|
||||
$(this).prop('disabled', true);
|
||||
$(this).prop('checked', false);
|
||||
}
|
||||
|
|
@ -99,9 +108,9 @@
|
|||
}
|
||||
|
||||
$('input#flag-0').click(function() {
|
||||
if($('input[id="flag-0"]:checked').length){
|
||||
if( $('input[id="flag-0"]:checked').length || $(".superlib:checked").length ){
|
||||
$('input[name="flag"]').each(function() {
|
||||
if($(this).attr('id') != "flag-0"){
|
||||
if($(this).attr('id') != "flag-0" && !$(this).hasClass('superlib') ){
|
||||
$(this).prop('disabled', true);
|
||||
$(this).prop('checked', false);
|
||||
}
|
||||
|
|
@ -122,12 +131,6 @@
|
|||
}
|
||||
});
|
||||
|
||||
[% IF disable_superlibrarian_privs %]
|
||||
$("input#flag-0").attr("disabled", true);
|
||||
$("form").submit(function(e) {
|
||||
$("input#flag-0").removeAttr("disabled");
|
||||
});
|
||||
[% END %]
|
||||
});
|
||||
|
||||
// manage checking/unchecking parent permissions
|
||||
|
|
|
|||
Loading…
Reference in New Issue