From c40ba60755405ba40f107d945f988bd7168a3cc7 Mon Sep 17 00:00:00 2001 From: Owen Leonard <oleonard@myacpl.org> Date: Fri, 13 Sep 2013 10:50:27 -0400 Subject: [PATCH] Bug 10865 [Revised] Don't show list permissions when adding public lists/sharing lists is not allowed If patron creation of public lists is disallowed by the OpacAllowPublicListCreation system preference the "category" option should be hidden altogether instead of showing a <select> with "private" as the only option. This patch hides category and permissions controls when OpacAllowPublicListCreation is set to "don't allow." To test you must have the virtualshelves system preference enabled. Apply the patch and log into the OPAC. Test: - With OpacAllowPublicListCreation enabled, create a new list. You should see options for setting category and permissions. Saving the new list should complete correctly and save the right settings. - With OpacAllowPublicListCreation enabled, edit an existing list. You should see the same options and saving your changes should work correctly. - With OpacAllowPublicListCreation disabled, create a new list. You should only see fields for title and sort. Saving this list should complete correctly and save the right settings. - With OpacAllowPublicListCreation disabled, edit an existing list. You should be able to edit only title and sort settings. Saving your changes should work correctly. Repeat your tests for both prog and bootstrap themes. Revision: Existing public lists can be edited and retain their public status even if OpacAllowPublicListCreation has since been disabled. This preserves the behavior previous to this patch. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> This patch fixes a big ergonomic issue. Note: to me, the "New list" action should be outside the tabs. It is confusing to have a "new list" into the public lists tab when it is not possible to create new public lists. Signed-off-by: Broust <jean-manuel.broust@univ-lyon2.fr> --- .../opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 42 ++++++++++++------- .../opac-tmpl/prog/en/modules/opac-shelves.tt | 20 +++++++-- 2 files changed, 41 insertions(+), 21 deletions(-) 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 eb9f65b..2f0fe36 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt @@ -9,7 +9,7 @@ [% BLOCK list_permissions %] <li> - <label for="permissions">Permissions: </label> + <label for="allow_add">Permissions: </label> <select name="allow_add" id="allow_add"> [% IF allow_add %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %] [% IF allow_add %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %] @@ -543,8 +543,8 @@ [% END %] </select> </li> - <li> - [% IF (OpacAllowPublicListCreation) %] + [% IF (OpacAllowPublicListCreation) %] + <li> <label for="category">Category:</label> <select name="category" id="category"> [% IF ( category1 ) %] @@ -558,14 +558,21 @@ <option value="2">Public</option> [% END %] </select> - [% END %] - </li> - [% INCLUDE list_permissions %] + </li> + [% INCLUDE list_permissions %] + [% END %] </ol> + [% UNLESS ( OpacAllowPublicListCreation ) %] + [% IF ( category2 ) %] + <input type="hidden" name="category" value="2" /> + [% ELSE %] + <input type="hidden" name="category" value="1" /> + [% END %] + [% END %] </fieldset> <fieldset class="action"> - <input type="submit" value="Save" class="submit" /> + <input type="submit" value="Save" class="btn" /> [% IF ( showprivateshelves ) %] <a class="cancel" href="/cgi-bin/koha/opac-shelves.pl?shelfnumber=[% shelfnumber %]&display=privateshelves">Cancel</a> [% ELSE %] @@ -750,16 +757,19 @@ </select> </li> <li> - <label for="category">Category:</label> - <select name="category" id="category"> - <option value="1">Private</option> - [% IF (OpacAllowPublicListCreation) %] - <option value="2">Public</option> - [% END %] - </select> - </li> - [% INCLUDE list_permissions %] + [% IF (OpacAllowPublicListCreation) %] + <label for="category">Category:</label> + <select name="category" id="category"> + <option value="1">Private</option> + <option value="2">Public</option> + </select> + </li> + [% INCLUDE list_permissions %] + [% END %] </ol> + [% UNLESS (OpacAllowPublicListCreation) %] + <input type="hidden" name="category" value="1" /> + [% END %] </fieldset> <fieldset class="action"> <input type="submit" onclick="Check(this.form); return false;" value="Save" class="btn" /> diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt index 0ccd7b6..a961d5d 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt @@ -214,7 +214,7 @@ $(document).ready(function() { [% BLOCK list_permissions %] <li> - <label for="permissions">Permissions: </label> + <label for="allow_add">Permissions: </label> <select name="allow_add" id="allow_add"> [% IF allow_add %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %] [% IF allow_add %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %] @@ -564,17 +564,24 @@ $(document).ready(function() { [% IF ( sortfield == "itemcallnumber" ) %]<option value="itemcallnumber" selected="selected">Call number</option>[% ELSE %]<option value="itemcallnumber">Call number</option>[% END %] </select> </li> + [% IF (OpacAllowPublicListCreation) %] <li> - [% IF (OpacAllowPublicListCreation) %] <label for="category">Category:</label> <select name="category" id="category"> [% IF ( category1 ) %]<option value="1" selected="selected">Private</option>[% ELSE %]<option value="1">Private</option>[% END %] [% IF ( category2 ) %]<option value="2" selected="selected">Public</option>[% ELSE %]<option value="2">Public</option>[% END %] </select> - [% END %] </li> [% INCLUDE list_permissions %] + [% END %] </ol> + [% UNLESS ( OpacAllowPublicListCreation ) %] + [% IF ( category2 ) %] + <input type="hidden" name="category" value="2" /> + [% ELSE %] + <input type="hidden" name="category" value="1" /> + [% END %] + [% END %] </fieldset> <fieldset class="action"><input type="submit" value="Save" class="submit" /> [% IF ( showprivateshelves ) %]<a class="cancel" href="/cgi-bin/koha/opac-shelves.pl?shelfnumber=[% shelfnumber %]&display=privateshelves">Cancel</a>[% ELSE %]<a class="cancel" href="/cgi-bin/koha/opac-shelves.pl?shelfnumber=[% shelfnumber %]">Cancel</a>[% END %]</fieldset> </form> @@ -754,17 +761,20 @@ $(document).ready(function() { <option value="itemcallnumber">Call number</option> </select> </li> + [% IF (OpacAllowPublicListCreation) %] <li> <label for="category">Category:</label> <select name="category" id="category"> <option value="1">Private</option> - [% IF (OpacAllowPublicListCreation) %] <option value="2">Public</option> - [% END %] </select> </li> [% INCLUDE list_permissions %] + [% END %] </ol> + [% UNLESS (OpacAllowPublicListCreation) %] + <input type="hidden" name="category" value="1" /> + [% END %] </fieldset> <fieldset class="action"> <input type="submit" onclick="Check(this.form); return false;" value="Save" class="submit" /> -- 1.7.2.5