Bugzilla – Attachment 19770 Details for
Bug 10565
Add a "Patron List" feature for storing and manipulating collections of patrons
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10565 [Follow-up] Add a "Patron List" feature for storing and manipulating collections of patrons
Bug-10565-Follow-up-Add-a-Patron-List-feature-for-.patch (text/plain), 22.51 KB, created by
Owen Leonard
on 2013-07-18 14:36:32 UTC
(
hide
)
Description:
Bug 10565 [Follow-up] Add a "Patron List" feature for storing and manipulating collections of patrons
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2013-07-18 14:36:32 UTC
Size:
22.51 KB
patch
obsolete
>From 100a1220c0e0549501c399da2d8f2ef9b58e3f0e Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 17 Jul 2013 15:51:01 -0400 >Subject: [PATCH] Bug 10565 [Follow-up] Add a "Patron List" feature for > storing and manipulating collections of patrons >Content-Type: text/plain; charset="utf-8" > >This patch makes the following changes: > >On the list add/edit page: > >- Improvements to breadcrumbs and titles on the add/edit page. >- Removal of custom validation JavaScript in favor of built-in > validation plugin. > >On the list view page: > >- Corrected title on list page: Showing list name instead of "New list" >- Added "select all" and "clear all" to a toolbar like on the biblio > list page. Moved the "remove selected" button to this toolbar like it > is on the biblio list page. >- Added more standard DataTables configuration with default sort, > correctly ignored columns, and pager count options. >- Display patron names as "surname, firstname." >- Improve JavaScript for removing entries from the list of patrons to > add (to avoid "javascript:" pseudo-protocol). >- Move "add patrons" controls so that they are only shown after patrons > have been added. >- Add toolbar to patron list view page with button for "Edit list" and > "Batch modify." The "Batch modify" button takes you directly to a > batch modification operation on your list. >- Added zipcode to displayed information. >- Added message to be displayed when there are no items on the list > (instead of showing empty table). > >On the list of lists page: > >- Added more standard DataTables configuration with default sort, > correctly ignored columns, and pager count options. >- Wrapped "new list" button in standard toolbar div. >- Show message instead of empty table if there are no lists. >- Style in-table buttons with "btn-mini" for more compact look. > >On scripts: > >- Changed "authnotrequired" from 1 to 0, added 'borrowers' permission > requirement. >--- > .../prog/en/modules/patron_lists/add-modify.tt | 38 ++--- > .../prog/en/modules/patron_lists/list.tt | 168 ++++++++++++-------- > .../prog/en/modules/patron_lists/lists.tt | 89 ++++++----- > patron_lists/add-modify.pl | 3 +- > patron_lists/delete.pl | 3 +- > patron_lists/list.pl | 3 +- > patron_lists/lists.pl | 3 +- > 7 files changed, 173 insertions(+), 134 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/add-modify.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/add-modify.tt >index 5ec0cd1..acad328 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/add-modify.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/add-modify.tt >@@ -1,43 +1,27 @@ > [% INCLUDE 'doc-head-open.inc' %] >-<title>Koha › Patron lists › New list</title> >+<title>Koha › Patron lists › [% IF ( list.name ) %] Edit patron list [% ELSE %] New patron list [% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] > >-<script type="text/javascript"> >-//<![CDATA[ > >-function CheckForm() { >- if ( !$("#list-name").val() ) { >- alert( _("Name is a required field!") ); >- return false; >- } >- >- return true; >-} >- >-//]]> >-</script> > > </head> > > <body> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'cat-search.inc' %] >-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="lists.pl">Patron lists</a> › Add / modify list</div> >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="lists.pl">Patron lists</a> › [% IF ( list.name ) %] Edit patron list [% ELSE %] New patron list [% END %]</div> > > > <div class="yui-t7"> > <div class="yui-main"> >- <h1>New patron list</h1> > >- <form method="post" onsubmit="return CheckForm()"> >+ <form method="post" action="/cgi-bin/koha/patron_lists/add-modify.pl"> > <fieldset class="rows"> >- >- <legend>Create a new patron list</legend> >- >+ <legend>[% IF ( list.name ) %] Edit patron list [% ELSE %] New patron list [% END %]</legend> > <ol> > <li> >- <label class="required" for="name">Name:</label> >- <input id="list-name" name="name" type="text" value="[% list.name %]" /> >+ <label class="required" for="list-name">Name:</label> >+ <input id="list-name" required="required" class="required" name="name" type="text" value="[% list.name %]" /> <span class="required">Required</span> > </li> > > <li> >@@ -47,10 +31,12 @@ function CheckForm() { > > </fieldset> > >- <input type="hidden" name="patron_list_id" value="[% list.patron_list_id %]" /> >- <input type="submit" class="btn" value="Save" /> >- <a href="lists.pl" class="cancel">Cancel</a> >+ <fieldset class="action"> >+ <input type="hidden" name="patron_list_id" value="[% list.patron_list_id %]" /> >+ <input type="submit" value="Save" /> >+ <a href="lists.pl" class="cancel">Cancel</a> >+ </fieldset> > </form> > </div> >-</div> >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt >index ebcd71f..f008cc1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt >@@ -1,25 +1,31 @@ > [% USE KohaDates %] > [% INCLUDE 'doc-head-open.inc' %] >-<title>Koha › Patron lists › New list</title> >+<title>Koha › Patron lists › [% list.name %]</title> > [% INCLUDE 'doc-head-close.inc' %] > > <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> > <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script> > [% INCLUDE 'datatables-strings.inc' %] > <script type="text/javascript" src="[% themelang %]/js/datatables.js"></script> >+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script> > > <script type="text/javascript"> > //<![CDATA[ > $(document).ready(function() { > $('#patrons_to_add_fieldset').hide(); > >- $('#patron-list-table').dataTable($.extend(true, {}, dataTablesDefaults)); >- >+ $('#patron-list-table').dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aaSorting": [[ 1, "asc" ]], >+ "aoColumnDefs": [ >+ { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, >+ ], >+ "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]] >+ })); > $( "#find_patron" ).autocomplete({ > source: "/cgi-bin/koha/circ/ysearch.pl", > minLength: 3, > select: function( event, ui ) { >- AddPatron( ui.item.firstname + " " + ui.item.surname, ui.item.cardnumber ); >+ AddPatron( ui.item.surname + ", " + ui.item.firstname, ui.item.cardnumber ); > return false; > } > }) >@@ -29,23 +35,32 @@ $(document).ready(function() { > .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) > .appendTo( ul ); > }; >+ $("span.clearall").html("<a id=\"CheckNone\" href=\"#\">"+_("Clear all")+"<\/a>"); >+ $("span.checkall").html("<a id=\"CheckAll\" href=\"#\">"+_("Select all")+"<\/a>"); >+ $("#CheckAll").click(function(){ >+ $(".checkboxed").checkCheckboxes(); >+ return false; >+ }); >+ $("#CheckNone").click(function(){ >+ $(".checkboxed").unCheckCheckboxes(); >+ return false; >+ }); >+ $("#patrons_to_add_fieldset").on("click", ".remove_patron", function(event) { >+ console.log(event.target.nodeName); >+ $(event.target).parent().remove(); >+ if ( ! $('#patrons_to_add').html() ) { >+ $('#patrons_to_add_fieldset').hide( ); >+ } >+ }); > }); > > function AddPatron( name, cardnumber ) { >- div = "<div id='borrower_" + cardnumber + "'>" + name + " ( <a href='javascript:void()' onclick='RemovePatron(" + cardnumber + ");'> Remove </a> ) <input type='hidden' name='patrons_to_add' value='" + cardnumber + "' /></div>"; >+ div = "<p>" + name + " ( <a href=\"#\" class=\"remove_patron\"> " + _("Remove") + " </a> ) <input type='hidden' name='patrons_to_add' value='" + cardnumber + "' /></p>"; > $('#patrons_to_add').append( div ); > > $('#find_patron').val('').focus(); > >- $('#patrons_to_add_fieldset').show( 800 ); >-} >- >-function RemovePatron( cardnumber ) { >- $( '#borrower_' + cardnumber ).remove(); >- >- if ( ! $('#patrons_to_add').html() ) { >- $('#patrons_to_add_fieldset').hide( 800 ); >- } >+ $('#patrons_to_add_fieldset').show( ); > } > //]]> > </script> >@@ -55,13 +70,23 @@ function RemovePatron( cardnumber ) { > <body> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'cat-search.inc' %] >-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="lists.pl">Patron lists</a> › Add patrons</div> >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="lists.pl">Patron lists</a> › [% list.name %]</div> > > <div class="yui-t7"> > <div class="yui-main"> > <h1>[% list.name %]</h1> > >- <form action="list.pl" method="post"> >+ <div id="toolbar" class="btn-toolbar"> >+ <div class="btn-group"> >+ <a class="btn btn-small" href="/cgi-bin/koha/patron_lists/add-modify.pl?patron_list_id=[% list.id %]"><i class="icon-pencil"></i> Edit list</a> >+ </div> >+ <div class="btn-group"> >+ <a href="/cgi-bin/koha/tools/modborrowers.pl?patron_list_id=[% list.id %]&op=show" class="btn btn-small">Batch modify</a> >+ </div> >+ </div> >+ >+ <form action="list.pl" method="post" class="checkboxed"> >+ <input type="hidden" name="patron_list_id" value="[% list.patron_list_id %]" /> > <fieldset> > <legend>Add patrons</legend> > >@@ -72,61 +97,72 @@ function RemovePatron( cardnumber ) { > <fieldset id="patrons_to_add_fieldset"> > <legend>Patrons to be added</legend> > <div id="patrons_to_add"></div> >+ <fieldset class="action"> >+ <input type="submit" value="Add patrons" /> >+ <a href="lists.pl" class="cancel">Cancel</a> >+ </fieldset> > </fieldset> >- > </fieldset> > >- <p> >- <input type="submit" class="btn" value="Update" /> >- <a href="lists.pl" class="cancel">Cancel</a> >- </p> >- >- <table id="patron-list-table"> >- <thead> >- <tr> >- <th><i title="Remove patron from list" class="icon-trash"></i></th> >- <th>Card</th> >- <th>Firstname</th> >- <th>Surname</th> >- <th>Address</th> >- <th>Category</th> >- <th>Library</th> >- <th>Expires on</th> >- <th>Circ notes</th> >- </tr> >- </thead> >- >- <tbody> >- [% FOREACH p IN list.patron_list_patrons %] >+ [% UNLESS ( list.patron_list_patrons ) %] >+ <div class="dialog message"> >+ <p>There are no patrons on this list.</p> >+ </div> >+ [% ELSE %] >+ <div id="searchheader"> >+ <div id="selection_ops"> >+ <span class="checkall"></span> | >+ <span class="clearall"></span> >+ <div class="btn-group"> >+ <button type="submit" class="btn btn-mini list-remove"><i class="icon-remove-sign"></i> Remove selected</button> >+ </div> >+ </div> >+ </div> >+ >+ <table id="patron-list-table"> >+ <thead> > <tr> >- <td><input type="checkbox" name="patrons_to_remove" value="[% p.patron_list_patron_id %]" /></td> >- <td> >- <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% p.borrowernumber.borrowernumber %]"> >- [% p.borrowernumber.cardnumber %] >- </a> >- </td> >- <td>[% p.borrowernumber.firstname %]</td> >- <td>[% p.borrowernumber.surname %]</td> >- <td> >- [% p.borrowernumber.address %] >- [% p.borrowernumber.address2 %] >- [% p.borrowernumber.city %] >- [% p.borrowernumber.state %] >- [% p.borrowernumber.country %] >- </td> >- <td>[% p.borrowernumber.categorycode.description %] ([% p.borrowernumber.categorycode.categorycode %])</td> >- <td>[% p.borrowernumber.branchcode.branchname %]</td> >- <td>[% p.borrowernumber.dateexpiry | $KohaDates %]</td> >- <td>[% p.borrowernumber.borrowernotes %]</td> >+ <th> </th> >+ <th>Card</th> >+ <th>Last name</th> >+ <th>First name</th> >+ <th>Address</th> >+ <th>Category</th> >+ <th>Library</th> >+ <th>Expires on</th> >+ <th>Circ notes</th> > </tr> >- [% END %] >- </tbody> >- </table> >- >- <input type="hidden" name="patron_list_id" value="[% list.patron_list_id %]" /> >- <input type="submit" class="btn" value="Update" /> >- <a href="lists.pl" class="cancel">Cancel</a> >+ </thead> >+ >+ <tbody> >+ [% FOREACH p IN list.patron_list_patrons %] >+ <tr> >+ <td><input type="checkbox" name="patrons_to_remove" value="[% p.patron_list_patron_id %]" /></td> >+ <td> >+ <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% p.borrowernumber.borrowernumber %]"> >+ [% p.borrowernumber.cardnumber %] >+ </a> >+ </td> >+ <td>[% p.borrowernumber.surname %]</td> >+ <td>[% p.borrowernumber.firstname %]</td> >+ <td> >+ [% p.borrowernumber.address %] >+ [% p.borrowernumber.address2 %] >+ [% p.borrowernumber.city %] >+ [% p.borrowernumber.state %] >+ [% p.borrowernumber.zipcode %] >+ [% p.borrowernumber.country %] >+ </td> >+ <td>[% p.borrowernumber.categorycode.description %] ([% p.borrowernumber.categorycode.categorycode %])</td> >+ <td>[% p.borrowernumber.branchcode.branchname %]</td> >+ <td>[% p.borrowernumber.dateexpiry | $KohaDates %]</td> >+ <td>[% p.borrowernumber.borrowernotes %]</td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% END %] > </form> > </div> >-</div> >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt >index 972f36d..2a55ffc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt >@@ -10,7 +10,13 @@ > <script type="text/javascript"> > //<![CDATA[ > $(document).ready(function() { >- $('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults)); >+ $('#patron-lists-table').dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ -1, -2, -3 ], "bSortable": false, "bSearchable": false }, >+ ], >+ >+ "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]] >+ })); > }); > > function ConfirmDelete( list ) { >@@ -29,46 +35,53 @@ > <div class="yui-t7"> > <div class="yui-main"> > <h1>Your patron lists</h1> >- >- <div class="btn-group"> >- <a class="btn btn-small" href="add-modify.pl"><i class="icon-plus"></i> New patron list</a> >+ <div id="toolbar" class="btn-toolbar"> >+ <div class="btn-group"> >+ <a class="btn btn-small" href="add-modify.pl"><i class="icon-plus"></i> New patron list</a> >+ </div> > </div> > >- <table id="patron-lists-table"> >- <thead> >- <tr> >- <th>Name</th> >- <th>Patrons in list</th> >- <th> </th> >- <th> </th> >- <th> </th> >- </tr> >- </thead> >- >- <tbody> >- [% FOREACH l IN lists %] >+ [% UNLESS ( lists ) %] >+ <div class="dialog message"> >+ <p>There are no patron lists.</p> >+ </div> >+ [% ELSE %] >+ <table id="patron-lists-table"> >+ <thead> > <tr> >- <td>[% l.name %]</td> >- <td>[% l.patron_list_patrons.size || 0 %]</td> >- <td> >- <a class="btn" href="list.pl?patron_list_id=[% l.patron_list_id %]"> >- <i class="icon-plus-sign"></i> Add patrons <i class="icon-user"></i> >- </a> >- </td> >- <td> >- <a class="btn" href="add-modify.pl?patron_list_id=[% l.patron_list_id %]"> >- <i class="icon-edit"></i> Edit >- </a> >- </td> >- <td> >- <a class="btn" href="delete.pl?patron_list_id=[% l.patron_list_id %]" onclick='return ConfirmDelete("[% l.name | html %]")'> >- <i class="icon-trash"></i> Delete >- </a> >- </td> >+ <th>Name</th> >+ <th>Patrons in list</th> >+ <th> </th> >+ <th> </th> >+ <th> </th> > </tr> >- [% END %] >- </tbody> >- </table> >+ </thead> >+ >+ <tbody> >+ [% FOREACH l IN lists %] >+ <tr> >+ <td><a href="list.pl?patron_list_id=[% l.patron_list_id %]">[% l.name %]</a></td> >+ <td>[% l.patron_list_patrons.size || 0 %]</td> >+ <td> >+ <a class="btn btn-mini" href="list.pl?patron_list_id=[% l.patron_list_id %]"> >+ <i class="icon-plus-sign"></i> Add patrons >+ </a> >+ </td> >+ <td> >+ <a class="btn btn-mini" href="add-modify.pl?patron_list_id=[% l.patron_list_id %]"> >+ <i class="icon-edit"></i> Edit >+ </a> >+ </td> >+ <td> >+ <a class="btn btn-mini" href="delete.pl?patron_list_id=[% l.patron_list_id %]" onclick='return ConfirmDelete("[% l.name | html %]")'> >+ <i class="icon-trash"></i> Delete >+ </a> >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% END %] > </div> >-</div> >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/patron_lists/add-modify.pl b/patron_lists/add-modify.pl >index ed67932..18f0365 100755 >--- a/patron_lists/add-modify.pl >+++ b/patron_lists/add-modify.pl >@@ -32,7 +32,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > template_name => "patron_lists/add-modify.tt", > query => $cgi, > type => "intranet", >- authnotrequired => 1, >+ authnotrequired => 0, >+ flagsrequired => {borrowers => 1}, > } > ); > >diff --git a/patron_lists/delete.pl b/patron_lists/delete.pl >index dfa698b..cd60e5f 100755 >--- a/patron_lists/delete.pl >+++ b/patron_lists/delete.pl >@@ -32,7 +32,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > template_name => "patron_lists/lists.tt", > query => $cgi, > type => "intranet", >- authnotrequired => 1, >+ authnotrequired => 0, >+ flagsrequired => {borrowers => 1}, > } > ); > >diff --git a/patron_lists/list.pl b/patron_lists/list.pl >index 2723e71..bae9e46 100755 >--- a/patron_lists/list.pl >+++ b/patron_lists/list.pl >@@ -32,7 +32,8 @@ my ( $template, $logged_in_user, $cookie ) = get_template_and_user( > template_name => "patron_lists/list.tt", > query => $cgi, > type => "intranet", >- authnotrequired => 1, >+ authnotrequired => 0, >+ flagsrequired => {borrowers => 1}, > } > ); > >diff --git a/patron_lists/lists.pl b/patron_lists/lists.pl >index 0244511..6c746f0 100755 >--- a/patron_lists/lists.pl >+++ b/patron_lists/lists.pl >@@ -32,7 +32,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > template_name => "patron_lists/lists.tt", > query => $cgi, > type => "intranet", >- authnotrequired => 1, >+ authnotrequired => 0, >+ flagsrequired => {borrowers => 1}, > } > ); > >-- >1.7.9.5
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 10565
:
19726
|
19727
|
19728
|
19732
|
19733
|
19734
|
19757
|
19759
|
19761
|
19762
|
19770
|
20511
|
20721
|
20768
|
21084
|
21086
|
21087
|
21088
|
21089