bug 2799: followup

Various fixes to meet coding standards, template
design, and basic functionality:

* (bug 2505) turned on warnings
* use correct loop names when populating
  $template
* put all TMPL_FOO in HTML comments
* assign UseBranchTransferLimits to circulation tab
* change template to use "library" instead of "branch"
* use standard YUI scripting for toolbar buttons
* add new script to admin menu

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
Galen Charlton 2008-12-17 14:09:27 -06:00
parent 3886be26ff
commit 0f47a7db16
5 changed files with 69 additions and 44 deletions

View file

@ -18,12 +18,15 @@
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use warnings;
use CGI;
use C4::Auth;
use C4::Context;
use C4::Output;
use C4::Koha;
use C4::Branch;
use C4::Circulation qw{ IsBranchTransferAllowed DeleteBranchTransferLimits CreateBranchTransferLimit };
my $input = new CGI;
@ -77,18 +80,18 @@ foreach my $branchcode ( @branchcodes ) {
}
## Build the default data
my @loop0;
my @itemtypes_loop;
foreach my $itemtype ( @itemtypes ) {
my @loop1;
my @to_branch_loop;
my %row_data;
$row_data{ itemtype } = $itemtype;
$row_data{ loop1 } = \@loop1;
$row_data{ to_branch_loop } = \@to_branch_loop;
foreach my $toBranch ( @branchcodes ) {
my @loop2;
my @from_branch_loop;
my %row_data;
$row_data{ itemtype } = $itemtype;
$row_data{ toBranch } = $toBranch;
$row_data{ loop2 } = \@loop2;
$row_data{ from_branch_loop } = \@from_branch_loop;
foreach my $fromBranch ( @branchcodes ) {
my %row_data;
@ -98,22 +101,19 @@ foreach my $itemtype ( @itemtypes ) {
$row_data{ fromBranch } = $fromBranch;
$row_data{ isChecked } = $isChecked;
push( @loop2, \%row_data );
push( @from_branch_loop, \%row_data );
}
push( @loop1, \%row_data );
push( @to_branch_loop, \%row_data );
}
push( @loop0, \%row_data );
push( @itemtypes_loop, \%row_data );
}
$template->param(
loop0 => \@loop0,
itemtypes_loop => \@itemtypes_loop,
branchcode_loop => \@branchcode_loop,
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
intranetstylesheet => C4::Context->preference("intranetstylesheet"),
IntranetNav => C4::Context->preference("IntranetNav"),
);
output_html_with_http_headers $input, $cookie, $template->output;

View file

@ -155,6 +155,7 @@ $tabsysprefs{RandomizeHoldsQueueWeight} = "Circulation";
$tabsysprefs{StaticHoldsQueueWeight} = "Circulation";
$tabsysprefs{AllowOnShelfHolds} = "Circulation";
$tabsysprefs{AllowHoldsOnDamagedItems} = "Circulation";
$tabsysprefs{UseBranchTransferLimits} = "Circulation";
# Staff Client
$tabsysprefs{TemplateEncoding} = "StaffClient";

View file

@ -18,6 +18,7 @@
<li><a href="/cgi-bin/koha/admin/roadtype.pl">Road types</a></li>
<li><a href="/cgi-bin/koha/admin/patron-attr-types.pl">Patron attribute types</a></li>
<li><a href="/cgi-bin/koha/admin/smart-rules.pl">Circulation and fines rules</a></li>
<li><a href="/cgi-bin/koha/admin/branch_transfer_limits.pl">Library transfer limits</a></li>
</ul>
<h5>Catalog</h5>

View file

@ -48,8 +48,8 @@
<dd>Define extended attributes (identifiers and statistical categories) for patron records</dd>
<dt><a href="/cgi-bin/koha/admin/smart-rules.pl">Circulation and fines rules</a></dt>
<dd>Define circulation and fines rules for combinations of libraries, patron categories, and item types</dd>
<dt><a href="/cgi-bin/koha/admin/branch_transfer_limits.pl">Branch Transfer Limits</a></dt>
<dd>Limit the ability to transfer items between libraries based on the branch sending, the brand recieving, and the itemtype involved. These rules only go into effect if the preference UseBranchTransferLimits is set to ON.</dd>
<dt><a href="/cgi-bin/koha/admin/branch_transfer_limits.pl">Library Transfer Limits</a></dt>
<dd>Limit the ability to transfer items between libraries based on the library sending, the library receiving, and the item type involved. These rules only go into effect if the preference UseBranchTransferLimits is set to ON.</dd>
</dl>
</div>

View file

@ -1,5 +1,5 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title>Koha &rsaquo; Administration &rsaquo; Set Branch Transfer Limits</title>
<title>Koha &rsaquo; Administration &rsaquo; Library Transfer Limits</title>
<script language="JavaScript" type="text/javascript">
function SwitchAll() {
count = document.mainform.elements.length;
@ -33,57 +33,80 @@
<!-- TMPL_INCLUDE NAME="header.inc" -->
<!-- TMPL_INCLUDE NAME="cat-search.inc" -->
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; Set Branch Transfer Limits</div>
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; Set Library Transfer Limits</div>
<div id="main">
<div id="doc3" class="yui-t1">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<div id="toolbar">
<script type="text/javascript">
//<![CDATA[
// prepare DOM for YUI Toolbar
$(document).ready(function() {
yuiToolbar();
});
// YUI Toolbar Functions
function yuiToolbar() {
new YAHOO.widget.Button("CheckAll").addListener('click', CheckAll);
new YAHOO.widget.Button("UncheckAll").addListener('click', UncheckAll);
new YAHOO.widget.Button("SwapAll").addListener('click',SwitchAll);
} //]]>
</script>
<ul class="toolbar">
<li><a id="CheckAll" href="#">Check All</a></li>
<li><a id="UncheckAll" href="#">Uncheck All</a></li>
<li><a id="SwapAll" href="#">Swap All</a></li>
</ul></div>
<h1 class="parameters">Library Transfer Limits</h1>
<div class="help">Check the boxes for the items that should <em>not</em> be transferable.</div>
<p>Check the boxes for the items that should <i>not</i> be transferable.</p>
<p>
<input type=button name="CheckAll" value="Check All" onClick="CheckAll()">
<input type=button name="UncheckAll" value="Uncheck All" onClick="UncheckAll()"
<input type=button name="SwapAll" value="Swap All" onClick="SwitchAll()">
</p>
<div class="table">
<form name="mainform" method="post" action="branch_transfer_limits.pl">
<table>
<thead>
<tr>
<th>To/From</th>
<TMPL_LOOP NAME="branchcode_loop">
<!-- TMPL_LOOP NAME="branchcode_loop" -->
<th><TMPL_VAR NAME="branchcode"></th>
</TMPL_LOOP>
<!-- /TMPL_LOOP -->
</tr>
</thead>
<tbody>
<TMPL_LOOP NAME="itemtypes_loop">
<tr><th>Limits for Item Type: <TMPL_VAR NAME="itemtype"></th></tr>
<!-- TMPL_LOOP NAME="itemtypes_loop" -->
<tr><th>Limits for Item Type: <!-- TMPL_VAR NAME="itemtype" --></th></tr>
<TMPL_LOOP NAME="to_branch_loop">
<!-- TMPL_LOOP NAME="to_branch_loop" -->
<tr>
<td><TMPL_VAR NAME="toBranch"></td>
<TMPL_LOOP NAME="from_branc_loop">
<td><!-- TMPL_VAR NAME="toBranch" --></td>
<!-- TMPL_LOOP NAME="from_branch_loop" -->
<td>
<input
name="<TMPL_VAR NAME="itemtype">_<TMPL_VAR NAME="toBranch">_<TMPL_VAR NAME="fromBranch">"
name="<!-- TMPL_VAR NAME="itemtype" -->_<!-- TMPL_VAR NAME="toBranch" -->_<!-- TMPL_VAR NAME="fromBranch" -->"
type="checkbox"
value="1"
<TMPL_IF NAME="isChecked">checked</TMPL_IF>
>
<!-- TMPL_IF NAME="isChecked" -->checked="checked"<!-- /TMPL_IF -->
/>
</td>
</TMPL_LOOP>
<tr>
</TMPL_LOOP>
</TMPL_LOOP>
<!-- /TMPL_LOOP -->
</tr>
<!-- /TMPL_LOOP -->
<!-- /TMPL_LOOP -->
</tbody>
</table>
<input type="hidden" name="updateLimits" value="1">
<input type="submit" value="Save Data">
<input type="hidden" name="updateLimits" value="1" />
<input type="submit" value="Save Data" />
</form>
</div>
</div>
</dd>
</dl>
</body>
</html>
</div>
</div>
<div class="yui-b">
<!-- TMPL_INCLUDE NAME="admin-menu.inc" -->
</div>
</div>
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->