Bugzilla – Attachment 64522 Details for
Bug 18834
Show "Anyone seeing this list" permission only for shared and public lists
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18834: Add js to dynamically alter the permission options
Bug-18834-Add-js-to-dynamically-alter-the-permissi.patch (text/plain), 4.55 KB, created by
Marcel de Rooy
on 2017-06-22 08:18:17 UTC
(
hide
)
Description:
Bug 18834: Add js to dynamically alter the permission options
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-06-22 08:18:17 UTC
Size:
4.55 KB
patch
obsolete
>From 7882eeaaa80109f1daf2363e597c75593c418374 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 18834: Add js to dynamically alter the permission options >Content-Type: text/plain; charset=utf-8 > >If we we move from Private to Public or vice versa, this actually has an >impact on the permissions combo. If we go back to a private list without >shares, we could remove Anyone. If we switch to public and the list had >no shares, we could add Anyone. > >Handled in a js sub AdjustPerms, triggered by onchange of the category >combo. > >Test plan: >[1] Edit a private list without shares in OPAC. Toggle category. Check > if the permissions combo changes accordingly. >[2] Edit a public list in staff. Toggle category and check. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > .../prog/en/modules/virtualshelves/shelves.tt | 22 +++++++++++++++++++++- > .../opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 22 +++++++++++++++++++++- > 2 files changed, 42 insertions(+), 2 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 179a6da..612449b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >@@ -306,6 +306,26 @@ function placeHold () { > return false; > } > } >+ >+function AdjustPerms() { >+ var category = $("#category").val(); >+ var count_perms = $("#allow_changes_from option").length; >+ >+ // If we move to Private, remove Anyone if we did not have shares >+ // Note: the number of shares is not tested real-time (just template var) >+ if( category == 1 ) { >+ [% IF !shelf.is_shared %] >+ $("#allow_changes_from option[value='2']").remove(); >+ [% END %] >+ } >+ // But if we move to Public, we may need to add it (again) >+ else if( category == 2 && count_perms == 2 ) { >+ $("#allow_changes_from").append( $('<option>', { >+ value: 2, >+ text: _("Anyone seeing this list"), >+ })); >+ } >+} > //]]> > </script> > </head> >@@ -557,7 +577,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="AdjustPerms()"> > [% 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 afe350c..c267248 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -579,7 +579,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="AdjustPerms()"> > [% IF shelf.is_private %] > <option value="1" selected="selected">Private</option> > [% ELSE %] >@@ -954,6 +954,26 @@ function Check(f) { > alert(alertString2); > } > } >+ >+function AdjustPerms() { >+ var category = $("#category").val(); >+ var count_perms = $("#allow_changes_from option").length; >+ >+ // If we move to Private, remove Anyone if we did not have shares >+ // Note: the number of shares is not tested real-time (just template var) >+ if( category == 1 ) { >+ [% IF !shelf.is_shared %] >+ $("#allow_changes_from option[value='2']").remove(); >+ [% END %] >+ } >+ // But if we move to Public, we may need to add it (again) >+ else if( category == 2 && count_perms == 2 ) { >+ $("#allow_changes_from").append( $('<option>', { >+ value: 2, >+ text: _("Anyone seeing this list"), >+ })); >+ } >+} > //]]> > </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 18834
:
64491
|
64492
|
64493
|
64510
|
64511
|
64512
|
64520
|
64521
|
64522
|
64523
|
64524
|
64525
|
64545
|
64546
|
64547
|
64548