Koha/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt
Bernardo Gonzalez Kriegel 2d9f5fc69e Bug 9457: [ENH] Ordering branches should be case independent (2)
This patch replace use of CGI::scroll_list() to show list of branches.

In two files, marc21_linking_section.pl and unimarc_field_4XX.pl,
the scrolling list is created but not used in the template file,
so the code is removed.

Also minor renaming/normalizing of variables.

To test:
1) Install with some branches, records and patrons

2.1) Select a record, click 'Place hold', select user,
     there is a library pull-down next to 'Pickup at:',
     list is ordered case sensitive
2.2) Go to Reports > Average loan time,
     next to Library is a pull-down,
     list without order
2.3) Go to Reports > Catalog by item type,
     next to 'Select a library' is a pull-down,
     list is ordered case sensitive
2.4) This is tricky, go to Reports home,
     change last part of URL 'reports-home.pl' with
     'manager.pl?report_name=issues_by_borrower_category'
     (can't find a direct link), next to 'Select a library'
     is a library pull-down,
     list without order
2.5) Edit/Add a patron, on section 'Library management'
     there is a library pull-down, case sensitive
2.6) OPAC, as logged user, make a suggestion or hold,
     there is library pull-down, correct order

3) Apply the patch

4.1) Repeat 2.1), correctly ordered list
4.2) Repeat 2.2), correctly ordered list
4.3) Repeat 2.3), correctly ordered list
4.4) Repeat 2.4), correctly ordered list
4.5) This is a bit more work
     There are 3 possible situations to test:
     A) No branches, must show a message that are no
        libraries defined
     B) New patron, must show a correctly ordered
        list of branches, current branch selected
     C) Edit patron, must show a correctly ordered
        list of branches, patron branch selected
4.6) Small changes on variable names, so retest 2.6)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-03-20 15:35:58 -04:00

248 lines
12 KiB
Text

[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo;
[% IF ( op_add ) %]Enter a new purchase suggestion[% END %]
[% IF ( op_else ) %]Purchase Suggestions[% END %]
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
<script type="text/javascript">
//<![CDATA[
$.tablesorter.addParser({
id: 'articles',
is: function(s) {return false; },
format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); },
type: 'text'
});
[% IF ( loggedinusername ) %]function enableCheckboxActions(){
// Enable/disable controls if checkboxes are checked
var checkedBoxes = $(".checkboxed input:checkbox:checked");
if ($(checkedBoxes).size()) {
$("#selections").html(_("With selected suggestions: "));
$("#selections-toolbar .links a").removeClass("disabled");
} else {
$("#selections").html(_("Select suggestions to: "));
$("#selections-toolbar .links a").addClass("disabled");
}
}[% END %]
$(function() {
$("#suggestt").tablesorter({
widgets : ['zebra'],
[% IF ( loggedinusername ) %]sortList: [[1,0]],[% ELSE %]sortList: [[0,0]],[% END %]
headers: {
[% IF ( loggedinusername ) %]
[% IF ( OPACViewOthersSuggestions ) %]
0: { sorter: false },2: { sorter: 'articles' },2: {sorter: false },4: {sorter: false},5:{sorter:false}
[% ELSE %]
0: { sorter: false },2: { sorter: 'articles' },2: {sorter: false },3: {sorter: false},4:{sorter:false}
[% END %]
[% ELSE %]
[% IF ( OPACViewOthersSuggestions ) %]
0: { sorter: 'articles' },1: {sorter: false },3: {sorter: false},4:{sorter:false}
[% ELSE %]
0: { sorter: 'articles' },1: {sorter: false },2: {sorter: false},3:{sorter:false}
[% END %]
[% END %]
}
});
[% IF ( loggedinusername ) %]$("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();
enableCheckboxActions();
return false;
});
$("#CheckNone").click(function(){
$(".checkboxed").unCheckCheckboxes();
enableCheckboxActions();
return false;
});
$(".cb").click(function(){
enableCheckboxActions();
});
$("#removeitems").html("<a href=\"#\" class=\"removeitems tag_hides disabled\">"+_("Delete")+"</a>")
.click(function(){
$("#myform").submit();
return false;
});
enableCheckboxActions();
[% END %]
});
function Check(f) {
var _alertString="";
var alertString2;
if(f.title.value.length ==0){
_alertString += _("- You must enter a Title") + "\n";
}
if (_alertString.length==0) {
f.submit();
} else {
alertString2 = _("Form not submitted because of the following problem(s)");
alertString2 += "\n------------------------------------------------------------------------------------\n\n";
alertString2 += _alertString;
alert(alertString2);
}
}
//]]>
</script>
</head>
[% IF ( loggedinusername ) %]<body id="opac-usersuggestions">[% ELSE %]<body id="opac-suggestions">[% END %]
<div id="doc3" class="yui-t1">
<div id="bd">
[% INCLUDE 'masthead.inc' %]
<div id="yui-main">
<div class="yui-b"><div class="yui-g">
<div id="usersuggestions" class="container">
[% IF ( op_add ) %]
<h1>Enter a new purchase suggestion</h1>
<p>Please fill out this form to make a purchase suggestion. You will receive an email when the library processes your suggestion</p>
<p>Only the title is required, but the more information you enter the easier it will be for the librarians to find the title you're requesting. The "Notes" field can be used to provide any additional information.</p>
<form action="/cgi-bin/koha/opac-suggestions.pl" method="post">
<fieldset class="rows"> <ol>
<li><label class="required" for="title">Title:</label><input type="text" id="title" name="title" size="50" maxlength="80" /></li>
<li><label for="author">Author:</label><input type="text" id="author" name="author" size="50" maxlength="80" /></li>
<li><label for="copyrightdate">Copyright Date:</label><input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" /></li>
<li><label for="isbn">Standard Number (ISBN, ISSN or Other):</label><input type="text" id="isbn" name="isbn" size="50" maxlength="80" /></li>
<li><label for="publishercode">Publisher:</label><input type="text" id="publishercode" name="publishercode" size="50" maxlength="80" /></li>
<li><label for="collectiontitle">Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" size="50" maxlength="80" /></li>
<li><label for="place">Publication place:</label><input type="text" id="place" name="place" size="50" maxlength="80" /></li>
<li><label for="itemtype">Item type:</label><select name="itemtype" id="itemtype">
<option value="">Default</option>
[% FOREACH itemtypeloo IN itemtypeloop %]
[% IF ( itemtypeloo.selected ) %]<option value="[% itemtypeloo.itemtype %]" selected="selected"> [% ELSE %]<option value="[% itemtypeloo.itemtype %]"> [% END %] [% itemtypeloo.description %]</option>
[% END %]
</select> </li>
[% IF ( branchloop ) %]
<li><label for="branch">Library:</label>
<select name="branch" id="branch">
[% FOREACH branchloo IN branchloop %]
[% IF ( branchloo.selected ) %]
<option value="[% branchloo.branchcode %]" selected="selected">[% branchloo.branchname %]</option>
[% ELSE %]
<option value="[% branchloo.branchcode %]">[% branchloo.branchname %]</option>
[% END %]
[% END %]
</select>
</li>
[% END %]
[% IF ( patron_reason_loop ) %]<li><label for="patronreason">Reason for suggestion: </label><select name="patronreason" id="patronreason"><option value="">-- Choose --</option>[% FOREACH patron_reason_loo IN patron_reason_loop %]
<option value="[% patron_reason_loo.authorised_value %]">[% patron_reason_loo.lib %]</option>
[% END %]</select></li>[% END %]
<li><label for="note">Notes:</label><textarea name="note" id="note" rows="5" cols="40"></textarea></li>
</ol></fieldset>
<fieldset class="action"><input type="hidden" name="suggestedby" value="[% suggestedbyme %]" /><input type="hidden" name="op" value="add_confirm" /><input type="submit" onclick="Check(this.form); return false;" value="Submit Your Suggestion" /> <a class="action" href="/cgi-bin/koha/opac-suggestions.pl">Cancel</a></fieldset>
</form>
[% END %]
[% IF ( op_else ) %]
<h1>[% IF ( OPACViewOthersSuggestions ) %]Purchase suggestions[% ELSE %][% IF ( loggedinusername ) %]My purchase suggestions[% ELSE %]Purchase suggestions[% END %][% END %]</h1>
[% IF ( deleted ) %]<div class="dialog message">The selected suggestions have been deleted.</div>[% END %]
[% IF ( submitted ) %]<div class="dialog message">Your suggestion has been submitted.</div>[% END %]
[% IF ( suggestions_loop ) %]
[% IF ( OPACViewOthersSuggestions ) %]
<form action="/cgi-bin/koha/opac-suggestions.pl" method="get">
<table>
<tr>
<th>
Search for:
</th>
<td>
<input type="text" name="title" value="[% title |html %]" />
</td>
<th>
Suggested by:
</th>
<td>
<select name="suggestedby">
<option value="0">Anyone</option>
<option value="1">Me</option>
</select>
</td>
<th>
<input type="submit" value="Search" />
</th>
</tr>
</table>
</form>[% END %]
<form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="myform">
<input type="hidden" name="op" value="delete_confirm" />
<div id="toolbar" class="list-actions">[% IF ( loggedinusername ) %]<a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a>[% ELSE %][% IF ( AnonSuggestions ) %]<a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a>[% END %][% END %]
</div>
[% IF ( loggedinusername ) %]<div id="selections-toolbar" class="list-actions">
<span class="checkall"></span> <span class="clearall"></span> <span class="sep">|</span>
<span class="links"><span id="selections">Select suggestions to: </span>
<span id="removeitems"></span>
</div>[% END %]
<table id="suggestt" class="checkboxed">
<thead><tr>
[% IF ( loggedinusername ) %]<th>&nbsp;</th>[% END %]
<th>Summary</th>
<th>Note</th>
[% IF ( OPACViewOthersSuggestions ) %]<th>Suggested for</th>[% END %]
<th>Managed by</th>
<th>Status</th>
</tr></thead>
<tbody>[% FOREACH suggestions_loo IN suggestions_loop %]
[% IF ( suggestions_loo.even ) %]<tr>[% ELSE %]<tr class="highlight">[% END %]
[% IF ( loggedinusername ) %]<td>
[% IF ( suggestions_loo.showcheckbox ) %]
<input type="checkbox" class="cb" name="delete_field" value="[% suggestions_loo.suggestionid %]" />
[% END %]
</td>[% END %]
<td>
<p><strong>[% suggestions_loo.title |html %]</strong></p>
<p>[% IF ( suggestions_loo.author ) %][% suggestions_loo.author %],[% END %]
[% IF ( suggestions_loo.copyrightdate ) %] - [% suggestions_loo.copyrightdate %],[% END %]
[% IF ( suggestions_loo.publishercode ) %] - [% suggestions_loo.publishercode %][% END %]
[% IF ( suggestions_loo.place ) %]([% suggestions_loo.place %])[% END %]
[% IF ( suggestions_loo.collectiontitle ) %] , [% suggestions_loo.collectiontitle %][% END %]
[% IF ( suggestions_loo.itemtype ) %] - [% suggestions_loo.itemtype %][% END %]
</p>
</td>
<td>
[% suggestions_loo.note %]
</td>
[% IF ( OPACViewOthersSuggestions ) %]<td>
[% IF ( suggestions_loo.branchcodesuggestedby ) %][% suggestions_loo.branchcodesuggestedby %][% ELSE %]&nbsp;[% END %]
</td>[% END %]
<td>
[% IF ( suggestions_loo.surnamemanagedby ) %][% suggestions_loo.surnamemanagedby %][% IF ( suggestions_loo.firstnamemanagedby ) %],[% END %] [% suggestions_loo.firstnamemanagedby %][% ELSE %]&nbsp;[% END %]
</td>
<td>
[% IF ( suggestions_loo.ASKED ) %]Requested[% END %]
[% IF ( suggestions_loo.CHECKED ) %]Checked by the library[% END %]
[% IF ( suggestions_loo.ACCEPTED ) %]Accepted by the library[% END %]
[% IF ( suggestions_loo.ORDERED ) %]Ordered by the library[% END %]
[% IF ( suggestions_loo.REJECTED ) %]Suggestion declined [% END %]
[% IF ( suggestions_loo.AVAILABLE ) %]Available in the library[% END %]
[% IF ( suggestions_loo.reason ) %]([% suggestions_loo.reason %])[% END %]
</td>
</tr>
[% END %]
</tbody>
</table> [% IF ( loggedinusername ) %]<fieldset class="action">
<input type="submit" value="Delete selected" />
</fieldset>
[% END %]
</form>
[% ELSE %]<p>There are no pending purchase suggestions.</p> [% IF ( loggedinusername ) %]<p><a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a></p>[% ELSE %][% IF ( AnonSuggestions ) %]<p><a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a></p>[% END %][% END %][% END %]
[% END %]
</div>
</div>
</div>
</div>
<div class="yui-b">
<div id="leftmenus" class="container">
[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
</div>
</div>
</div>
[% INCLUDE 'opac-bottom.inc' %]