[Koha-patches] [PATCH] followup to Mason's labels patch

Galen Charlton galen.charlton at liblime.com
Wed Dec 31 22:35:44 CET 2008


* fix XHTML errors
* fix problems with paging through results list
---
 .../prog/en/modules/labels/result.tmpl             |   12 ++--
 .../prog/en/modules/labels/search.tmpl             |   70 +------------------
 labels/label-item-search.pl                        |   36 +++++-----
 3 files changed, 30 insertions(+), 88 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tmpl
index 3380992..5b7ce37 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tmpl
@@ -73,18 +73,17 @@ function add_item3(i_itemnumber){
 			<!-- TMPL_ELSE -->
 			No results found
 			<!-- /TMPL_IF -->
-		</p>
 	</div>
 
 
 <div id="breadcrumbs"><a href="/cgi-bin/koha/labels/label-item-search.pl?batch_id=<!-- TMPL_VAR NAME="batch_id" -->">Search for Items for Batch <!-- TMPL_VAR NAME="batch_id" --></a> &rsaquo; Search results</div>
-<form name="resultform" class="checkboxed"><div style="float: right; margin-top: .5em;"><input type="submit" class="icon addchecked" value="Add checked" onclick="add_item('checked',<!-- TMPL_VAR NAME="batch_id" -->,'<!-- TMPL_VAR NAME="type" -->'); return false" /> <input type="button" class="close" value="Done" /></div><div style="line-height: 2em; margin-left: .7em;"><a id="CheckAll" href="/cgi-bin/koha/labels/label-item-search.pl">Select All</a></span><span class="clearall"><a id="CheckNone" href="/cgi-bin/koha/labels/label-item-search.pl">Clear All</a></div>
+<form name="resultform" class="checkboxed" action=""><div style="float: right; margin-top: .5em;"><input type="submit" class="icon addchecked" value="Add checked" onclick="add_item('checked',<!-- TMPL_VAR NAME="batch_id" -->,'<!-- TMPL_VAR NAME="type" -->'); return false" /> <input type="button" class="close" value="Done" /></div><div style="line-height: 2em; margin-left: .7em;"><a id="CheckAll" href="/cgi-bin/koha/labels/label-item-search.pl">Select All</a><span class="clearall"><a id="CheckNone" href="/cgi-bin/koha/labels/label-item-search.pl">Clear All</a></span></div>
 
 <input type="hidden" name="ccl_query" value="<!-- TMPL_VAR name="ccl_query" -->" />
 
 
 	<!-- TMPL_LOOP name="result" -->
-	<table width="610 pixels" frame="border" border="2" style="float: left; margin: .5em 0;">
+	<table frame="border" border="2" style="float: left; margin: .5em 0;">
 		<!-- TMPL_IF name="highlight" -->
 			<tr class="highlight">
 		<!-- TMPL_ELSE -->
@@ -103,8 +102,10 @@ function add_item3(i_itemnumber){
                                     <th>Barcode</th>
                                     <th></th>
                                 </tr>
+        <!-- TMPL_IF name="item" -->
+                <tr>
         <!-- TMPL_LOOP name="item" -->
-					<!-- TMPL_IF name="i_itemnumber1" --><tr><td align="center"><label for="itm<!-- TMPL_VAR NAME="i_itemnumber1" -->" ><input type="checkbox" name="i_itemnumber" id="itm<!-- TMPL_VAR NAME="i_itemnumber1" -->" value="<!-- TMPL_VAR NAME="i_itemnumber1" -->" /></label></td><!-- /TMPL_IF -->
+					<!-- TMPL_IF name="i_itemnumber1" --><td align="center"><label for="itm<!-- TMPL_VAR NAME="i_itemnumber1" -->" ><input type="checkbox" name="i_itemnumber" id="itm<!-- TMPL_VAR NAME="i_itemnumber1" -->" value="<!-- TMPL_VAR NAME="i_itemnumber1" -->" /></label></td><!-- /TMPL_IF -->
 					<!-- TMPL_IF name="i_itemcallnumber" --><td align="center"><!-- TMPL_VAR name="i_itemcallnumber" --><br /></td><!-- /TMPL_IF -->
 					<!-- TMPL_IF name="i_dateaccessioned" --><td align="center"><!-- TMPL_VAR name="i_dateaccessioned" --><br /></td><!-- /TMPL_IF -->
 					<!-- TMPL_IF name="i_barcode" --><td align="center"><!-- TMPL_VAR name="i_barcode" --></td><!-- /TMPL_IF -->
@@ -114,9 +115,11 @@ function add_item3(i_itemnumber){
 <!-- /NEW -->
         <!-- /TMPL_LOOP --><!-- item -->
                                         </tr>
+        <!-- /TMPL_IF -->
 	 </table>
 	<!-- /TMPL_LOOP -->
 </form>
+</div>
 
 	<div class="results">
 		<!-- TMPL_IF EXPR="displayprev || displaynext" --><p>
@@ -139,5 +142,4 @@ function add_item3(i_itemnumber){
 	</div>
 
 
-
 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/search.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/search.tmpl
index 9abc5ad..4cf7888 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/search.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/search.tmpl
@@ -67,52 +67,7 @@ to add to Batch <!-- TMPL_VAR NAME="batch_id" -->
 
    <input type="text" size="30" id="ccl_textbox" name="ccl_textbox" class="focus" title="Enter search terms" value=""/>
 
-</li><!-- FIXME: script does keyword search regardless<li>
-<select name="idx" disabled="disabled">
-
-<!-- TMPL_IF NAME="selected" --><option value="kw" selected="selected">Keyword</option>
-<!-- TMPL_ELSE --><option value="kw">Keyword</option><!-- /TMPL_IF -->
-
-<!-- TMPL_IF NAME="selected" --><option value="au" selected="selected">Author</option>
-<!-- TMPL_ELSE --><option value="au">Author</option><!-- /TMPL_IF -->
-
-<!-- TMPL_IF NAME="selected" --><option value="yr" selected="selected">Publication Date</option>
-<!-- TMPL_ELSE --><option value="yr">Publication Date</option><!-- /TMPL_IF -->
-
-<!-- TMPL_IF NAME="selected" --><option value="sn" selected="selected">Standard Number</option>
-<!-- TMPL_ELSE --><option value="sn">Standard Number</option><!-- /TMPL_IF -->
-
-<!-- TMPL_IF NAME="selected" --><option value="nb" selected="selected">ISBN</option>
-<!-- TMPL_ELSE --><option value="nb">ISBN</option><!-- /TMPL_IF -->
-
-<!-- TMPL_IF NAME="selected" --><option value="ns" selected="selected">ISSN</option>
-<!-- TMPL_ELSE --><option value="ns">ISSN</option><!-- /TMPL_IF -->
-
-<!-- TMPL_IF NAME="selected" --><option value="lcn,phr" selected="selected">Call Number</option>
-<!-- TMPL_ELSE --><option value="lcn,phr">Call Number</option><!-- /TMPL_IF -->
-
-<!-- TMPL_IF NAME="selected" --><option value="su" selected="selected">Subject</option>
-<!-- TMPL_ELSE --><option value="su">Subject</option><!-- /TMPL_IF -->
-
-<!-- TMPL_IF NAME="selected" -->
-   <option value="ti" selected="selected">Title</option>
-<!-- TMPL_ELSE -->
-   <option value="ti" selected="selected">Title</option><!-- /TMPL_IF -->
-
-<!-- TMPL_IF NAME="selected" --><option value="ti,phr" selected="selected">Title Phrase</option>
-<!-- TMPL_ELSE --><option value="ti,phr">Title Phrase</option><!-- /TMPL_IF -->
-
-<!-- TMPL_IF NAME="selected" --><option value="se" selected="selected">Series Title</option>
-<!-- TMPL_ELSE --><option value="se">Series Title</option><!-- /TMPL_IF -->
-
-<!-- TMPL_IF NAME="selected" --><option value="bc" selected="selected">Barcode</option>
-<!-- TMPL_ELSE --><option value="bc">Barcode</option><!-- /TMPL_IF -->
-
-<!-- TMPL_IF NAME="selected" --><option value="acqdate" selected="selected">Acquisition Date</option>
-<!-- TMPL_ELSE --><option value="acqdate">Acquisition Date</option><!-- /TMPL_IF -->
-</select>
-   <input type="text" size="30" name="q" title="Enter search terms" value="" disabled="disabled" />  FIXME: script doesn't "catch" q param
-</li> -->
+</li>
 </ol>
 </fieldset>
 
@@ -120,12 +75,10 @@ to add to Batch <!-- TMPL_VAR NAME="batch_id" -->
 <fieldset><legend>Sort by: </legend>
     <p><select id="sort_by" name="sort_by">
         <option value="">Field-weighted, Relevance Ranked</option>
-<!-- TMPL_ELSE --><!-- /TMPL_IF -->
         <!-- TMPL_LOOP NAME="sort_by_loop" -->
 
 <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="label" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="label" --></option><!-- /TMPL_IF -->
 
-<!-- TMPL_ELSE --><!-- /TMPL_IF -->
         <!-- /TMPL_LOOP -->
     </select>
         </p>
@@ -140,7 +93,7 @@ to add to Batch <!-- TMPL_VAR NAME="batch_id" -->
 	    </th>
 	    <td>
   <input type="text" size="10" id="datefrom" name="datefrom" value="" />
-  <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" border="0" id="openCalendarFrom" style="cursor: pointer;" valign="top" />
+  <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" border="0" id="openCalendarFrom" alt="Show Calendar" />
 
 <script type="text/javascript">
     Calendar.setup({
@@ -164,7 +117,7 @@ to add to Batch <!-- TMPL_VAR NAME="batch_id" -->
 	    </th>
 	    <td>
   <input type="text" size="10" id="dateto" name="dateto" value="" />
-  <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" border="0" id="openCalendarTo" style="cursor: pointer;" valign="top" />
+  <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" border="0" id="openCalendarTo" alt="Show Calendar" />
 
 <script type="text/javascript">
     Calendar.setup({
@@ -175,23 +128,8 @@ to add to Batch <!-- TMPL_VAR NAME="batch_id" -->
     });
 </script>
 
-<!-- FIXME: script returns ALL type regardless
-    <tr><th scope="row">Document Type</th>
-                <td colspan="2">
-                    <select name="Filter" disabled="disabled">
-                        <option value="">All Item Types</option>
-<!-- TMPL_ELSE --><!-- /TMPL_IF -->
-                        <!-- TMPL_LOOP name="itemtypeloop" -->
-                            <!-- TMPL_IF name="selected" -->
-                                <option value="<!-- TMPL_VAR name="value" -->"  selected="selected" >
-                            <!-- TMPL_ELSE -->
-                                <option value="<!-- TMPL_VAR name="value" -->">
-                            <!-- /TMPL_IF --><!-- TMPL_VAR name="description" --></option>
-<!-- TMPL_ELSE --><!-- /TMPL_IF -->
-                        <!-- /TMPL_LOOP -->
-                    </select>
                 </td>
-            </tr></table></fieldset>-->
+            </tr></table>
 
 
 
diff --git a/labels/label-item-search.pl b/labels/label-item-search.pl
index 31b1d22..7dc1ccd 100755
--- a/labels/label-item-search.pl
+++ b/labels/label-item-search.pl
@@ -203,26 +203,28 @@ if ($show_results) {
 		  : $startfrom + $resultsperpage - 1;
 
 		# multi page display
-		my $displaynext = 0;
-		my $displayprev = $startfrom;
+		$displaynext = 0;
+		$displayprev = $startfrom > 1 ? $startfrom : 0;
 
-		$displaynext = 1 if (scalar @results == $resultsperpage);
+		$displaynext = 1 if $to < $total_hits;
 
-		$template->param(
-
-			total          => $total_hits,
-			from           => $from,
-			to             => $to,
-			startfromnext  => $startfromnext,
-			startfromprev  => $startfromprev,
-			startfrom      => $startfrom,
-			displaynext    => $displaynext,
-			displayprev    => $displayprev,
-			resultsperpage => $resultsperpage,
-			numbers        => \@numbers,
+	} else {
+        $displayprev = 0;
+        $displaynext = 0;
+    }
 
-		);
-	}
+	$template->param(
+		total          => $total_hits,
+		from           => $from,
+		to             => $to,
+		startfromnext  => $startfromnext,
+		startfromprev  => $startfromprev,
+		startfrom      => $startfrom,
+		displaynext    => $displaynext,
+		displayprev    => $displayprev,
+		resultsperpage => $resultsperpage,
+		numbers        => \@numbers,
+	);
 
 	$template->param(
 		result    => \@results,
-- 
1.5.5.GIT



More information about the Koha-patches mailing list