Bugzilla – Attachment 65274 Details for
Bug 18980
Add an explanation when Anyone permission has no actual effect
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18980: Add js to dynamically show/hide the Anyone remark
Bug-18980-Add-js-to-dynamically-showhide-the-Anyon.patch (text/plain), 7.04 KB, created by
Marc Véron
on 2017-07-26 12:48:03 UTC
(
hide
)
Description:
Bug 18980: Add js to dynamically show/hide the Anyone remark
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2017-07-26 12:48:03 UTC
Size:
7.04 KB
patch
obsolete
>From 94f52dfc4e6e6ef1b62355cc0371837954f91923 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 21 Jun 2017 16:24:57 +0200 >Subject: [PATCH] Bug 18980: Add js to dynamically show/hide the Anyone remark >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >If we we move from Private to Public or vice versa, this should reflect >on the Anyone remark from the first patch. >If we go back to a private list without shares, we should show it. > >Handled in a js sub AdjustRemark, triggered by onchange of the category >combo or the permission combo. > >Test plan: >[1] Edit a private list without shares in OPAC. Toggle category and/or > permissions. Is the remark shown or hidden accordingly? > Note: Include a test with OpacAllowPublicListCreation enabled. >[2] Edit a shared list or public list in staff. Toggle category/permissions. > You should never see the remark. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Marc Véron <veron@veron.ch> >--- > .../prog/en/modules/virtualshelves/shelves.tt | 31 +++++++++++++++++++-- > .../opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 32 ++++++++++++++++++++-- > 2 files changed, 57 insertions(+), 6 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >index 2b32ca0..f26acd4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >@@ -12,7 +12,7 @@ > [% 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 %] > >@@ -25,7 +25,7 @@ > [% 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 %] > >@@ -217,6 +217,12 @@ $(document).ready(function(){ > }); > [% END %] > >+[% IF shelf AND op == 'edit_form' %] >+$(document).ready(function(){ >+ AdjustRemark(); >+}); >+[% END %] >+ > /** > * This function checks if the adequate number of records are checked for merging > */ >@@ -305,6 +311,25 @@ function placeHold () { > 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> >@@ -556,7 +581,7 @@ function placeHold () { > [% 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 %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >index f6922f1..0417531 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -13,7 +13,7 @@ > [% 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 %] > >@@ -26,7 +26,7 @@ > [% 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 %] > >@@ -578,7 +578,7 @@ > [% 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 %] >@@ -934,6 +934,8 @@ $(function() { > window.print(); > setTimeout('window.close()', 1); > [% END %] >+ >+ AdjustRemark(); > }); // document.ready > > function Check(f) { >@@ -953,6 +955,30 @@ 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 %] >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18980
:
65229
|
65230
|
65231
|
65232
|
65273
|
65274
|
65275
|
65276
|
65347
|
65348
|
65349
|
65350