[Koha-patches] [PATCH] Bug 10865 - Don't show list permissions when adding public lists/sharing lists is not allowed

Owen Leonard oleonard at myacpl.org
Wed Feb 5 16:22:46 CET 2014


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.
---
 .../opac-tmpl/bootstrap/en/modules/opac-shelves.tt |   38 +++++++++++---------
 .../opac-tmpl/prog/en/modules/opac-shelves.tt      |   16 ++++++---
 2 files changed, 33 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 cfce27b..2a172b5 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 %]
@@ -519,8 +519,8 @@
                                             [% END %]
                                         </select>
                                     </li>
-                                    <li>
-                                        [% IF (OpacAllowPublicListCreation) %]
+                                    [% IF (OpacAllowPublicListCreation) %]
+                                        <li>
                                             <label for="category">Category:</label>
                                             <select name="category" id="category">
                                                 [% IF ( category1 ) %]
@@ -534,14 +534,17 @@
                                                     <option value="2">Public</option>
                                                 [% END %]
                                             </select>
-                                        [% END %]
-                                    </li>
-                                    [% INCLUDE list_permissions %]
+                                        </li>
+                                        [% INCLUDE list_permissions %]
+                                    [% END %]
                                 </ol>
+                                [% UNLESS ( OpacAllowPublicListCreation ) %]
+                                   <input type="hidden" name="category" value="1" />
+                                [% 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 %]
@@ -726,16 +729,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..b8f201f 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,20 @@ $(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 ) %]
+                        <input type="hidden" name="category" value="1" />
+                    [% 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 +757,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.9.5


More information about the Koha-patches mailing list