[% BLOCK list_permissions %]
<li>
<label for="allow_changes_from">Allow changes to contents from: </label>
- <select name="allow_changes_from" id="allow_changes_from">
+ <select name="allow_changes_from" id="allow_changes_from" onchange="AdjustRemark()">
[% IF shelf.allow_change_from_owner %]<option value="0">Nobody</option>[% ELSE %]<option value="0" selected="selected">Nobody</option>[% END %]
[% IF shelf.allow_change_from_others %]<option value="2" selected="selected">Anyone seeing this list</option>[% ELSE %]<option value="2">Anyone seeing this list</option>[% END %]
</select>
-   <span id="anyone_remark" style="color:red;">The Anyone permission has no actual effect while this list is strictly private.</span>
+   <span id="anyone_remark" style="display:none;color:red;">The Anyone permission has no actual effect while this list is strictly private.</span>
</li>
[% END %]
}
});
});
+[% END %]
+
+[% IF shelf AND op == 'edit_form' %]
+$(document).ready(function(){
+ AdjustRemark();
+});
[% END %]
/**
return false;
}
}
+
+function AdjustRemark() {
+ var category = $("#category").val();
+ var perms = $("#allow_changes_from").val();
+
+ if( perms < 2 ) {
+ $("#anyone_remark").hide();
+ } else if( category==1 ) {
+ // If we move to Private (without shares), show Anyone remark
+ // Note: the number of shares is not tested real-time
+ [% IF !shelf.is_shared %]
+ $("#anyone_remark").show();
+ [% ELSE %]
+ $("#anyone_remark").hide();
+ [% END %]
+ } else { // category==2
+ $("#anyone_remark").hide();
+ }
+}
//]]>
</script>
</head>
[% IF shelf.sortfield == "itemcallnumber" %]<option value="itemcallnumber" selected="selected">Call number</option>[% ELSE %]<option value="itemcallnumber">Call number</option>[% END %]
</select></li>
<li><label for="category">Category: </label>
- <select id="category" name="category">
+ <select id="category" name="category" onchange="AdjustRemark()">
[% IF shelf.is_private %]
<option value="1" selected="selected">Private</option>
[% ELSE %]
[% BLOCK list_permissions %]
<li>
<label for="allow_changes_from">Allow changes to contents from: </label>
- <select name="allow_changes_from" id="allow_changes_from">
+ <select name="allow_changes_from" id="allow_changes_from" onchange="AdjustRemark()">
[% IF shelf.allow_change_from_owner %]<option value="0">Nobody</option>[% ELSE %]<option value="0" selected="selected">Nobody</option>[% END %]
[% IF shelf.allow_change_from_others %]<option value="2" selected="selected">Anyone seeing this list</option>[% ELSE %]<option value="2">Anyone seeing this list</option>[% END %]
</select>
-   <span id="anyone_remark" style="color:red;">The Anyone permission has no actual effect while this list is strictly private.</span>
+   <span id="anyone_remark" style="display:none;color:red;">The Anyone permission has no actual effect while this list is strictly private.</span>
</li>
[% END %]
[% IF Koha.Preference('OpacAllowPublicListCreation') OR category == PUBLIC %]
<li>
<label for="category">Category:</label>
- <select name="category" id="category">
+ <select name="category" id="category" onchange="AdjustRemark()">
[% IF shelf.is_private %]
<option value="1" selected="selected">Private</option>
[% ELSE %]
window.print();
setTimeout('window.close()', 1);
[% END %]
+
+ AdjustRemark();
}); // document.ready
function Check(f) {
alert(alertString2);
}
}
+
+function AdjustRemark() {
+ var category;
+ if( $("#category").length > 0 ) {
+ category = $("#category").val();
+ } else {
+ category = [% category %];
+ }
+ var perms = $("#allow_changes_from").val();
+
+ if( perms < 2 ) {
+ $("#anyone_remark").hide();
+ } else if( category==1 ) {
+ // If we move to Private (without shares), show Anyone remark
+ // Note: the number of shares is not tested real-time
+ [% IF !shelf.is_shared %]
+ $("#anyone_remark").show();
+ [% ELSE %]
+ $("#anyone_remark").hide();
+ [% END %]
+ } else { // category==2
+ $("#anyone_remark").hide();
+ }
+}
//]]>
</script>
[% END %]