[Koha-patches] [PATCH] Made changes to add sorting on the catalouging screen in the intranet section.

Satyanarayana H S satyanarayana.holenarsipur at osslabs.biz
Wed Jul 1 11:48:52 CEST 2009


From: root <root at satya.biz>

Comments:
Adds a drop down to help sort the results on addbooks.pl screen without affecting it's existing funcanality.

The drop down is general and does not require a system preference.

Have Made changes addbooks.pl to show the dropdown on the cataloging screen, and few more details obout location of the items while cataloguing in the admin section.

Added a new file page-numbers-addbooks.inc to show pagination on the cataloging results.

Made changes in cataloging-search.inc to show the dropdown on the cataloging screen.

Made changes in addbooks.tmpl to incorporate a dropdown for sorting the results as in the main search screen.

---
 cataloguing/addbooks.pl                            |  385 ++++++++++++++++++--
 .../prog/en/includes/cataloging-search.inc         |   79 ++++-
 .../prog/en/includes/page-numbers-addbooks.inc     |    7 +
 .../prog/en/modules/cataloguing/addbooks.tmpl      |   87 ++++-
 4 files changed, 508 insertions(+), 50 deletions(-)
 create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers-addbooks.inc

diff --git a/cataloguing/addbooks.pl b/cataloguing/addbooks.pl
index 045a4ee..33a8f8a 100755
--- a/cataloguing/addbooks.pl
+++ b/cataloguing/addbooks.pl
@@ -1,6 +1,4 @@
 #!/usr/bin/perl
-
-
 # Copyright 2000-2002 Katipo Communications
 #
 # This file is part of Koha.
@@ -32,7 +30,12 @@ use C4::Breeding;
 use C4::Output;
 use C4::Koha;
 use C4::Search;
-
+#/*****************************************************************/
+use C4::Context;
+use C4::Languages qw(getAllLanguages);
+use POSIX qw(ceil floor);
+use C4::Branch;
+#/*****************************************************************/
 my $input = new CGI;
 
 my $success = $input->param('biblioitem');
@@ -64,43 +67,376 @@ foreach my $thisframeworkcode ( keys %$frameworks ) {
     push @frameworkcodeloop, \%row;
 }
 
-# Searching the catalog.
-if ($query) {
+#/*****************************************************************/
+
+if (C4::Context->preference("marcflavour") eq "UNIMARC" ) {
+    $template->param('UNIMARC' => 1);
+}
+
+# load the branches
+my $branches = GetBranches();
+my @branch_loop;
+
+for my $branch_hash (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
+    push @branch_loop, {value => "$branch_hash" , branchname => $branches->{$branch_hash}->{'branchname'}, };
+}
+
+my $categories = GetBranchCategories(undef,'searchdomain');
+
+$template->param(branchloop => \@branch_loop, searchdomainloop => $categories);
+
+# Fetch the paramater list as a hash in scalar context:
+#  * returns paramater list as tied hash ref
+#  * we can edit the values by changing the key
+#  * multivalued CGI paramaters are returned as a packaged string separated by "\0" (null)
+my $params = $input->Vars;
+
+# Params that can have more than one value
+# sort by is used to sort the query
+# in theory can have more than one but generally there's just one
+my @sort_by;
+my $default_sort_by = C4::Context->preference('defaultSortField')."_".C4::Context->preference('defaultSortOrder') 
+    if (C4::Context->preference('defaultSortField') && C4::Context->preference('defaultSortOrder'));
+
+ at sort_by = split("\0",$params->{'sort_by'}) if $params->{'sort_by'};
+$sort_by[0] = $default_sort_by unless $sort_by[0];
+foreach my $sort (@sort_by) {
+    $template->param($sort => 1);
+}
+$template->param('sort_by' => $sort_by[0]);
+
+# Use the servers defined, or just search our local catalog(default)
+my @servers;
+ at servers = split("\0",$params->{'server'}) if $params->{'server'};
+unless (@servers) {
+    #FIXME: this should be handled using Context.pm
+    @servers = ("biblioserver");
+    # @servers = C4::Context->config("biblioserver");
+}
+# operators include boolean and proximity operators and are used
+# to evaluate multiple operands
+my @operators;
+ at operators = split("\0",$params->{'op'}) if $params->{'op'};
 
-    # find results
-    my ( $error, $marcresults, $total_hits ) = SimpleSearch($query, $results_per_page * ($page - 1), $results_per_page);
+# indexes are query qualifiers, like 'title', 'author', etc. They
+# can be single or multiple parameters separated by comma: kw,right-Truncation 
+my @indexes;
+ at indexes = split("\0",$params->{'idx'});
 
-    if ( defined $error ) {
-        $template->param( error => $error );
-        warn "error: " . $error;
-        output_html_with_http_headers $input, $cookie, $template->output;
-        exit;
+# if a simple index (only one)  display the index used in the top search box
+if ($indexes[0] && !$indexes[1]) {
+    $template->param("ms_".$indexes[0] => 1);}
+
+
+# an operand can be a single term, a phrase, or a complete ccl query
+my @operands;
+ at operands = split("\0",$params->{'q'}) if $params->{'q'};
+
+# limits are use to limit to results to a pre-defined category such as branch or language
+my @limits;
+ at limits = split("\0",$params->{'limit'}) if $params->{'limit'};
+
+if($params->{'multibranchlimit'}) {
+push @limits, join(" or ", map { "branch: $_ "}  @{GetBranchesInCategory($params->{'multibranchlimit'})}) ;
+}
+
+my $available;
+foreach my $limit(@limits) {
+    if ($limit =~/available/) {
+        $available = 1;
+    }
+}
+$template->param(available => $available);
+
+# append year limits if they exist
+my $limit_yr;
+my $limit_yr_value;
+if ($params->{'limit-yr'}) {
+    if ($params->{'limit-yr'} =~ /\d{4}-\d{4}/) {
+        my ($yr1,$yr2) = split(/-/, $params->{'limit-yr'});
+        $limit_yr = "yr,st-numeric,ge=$yr1 and yr,st-numeric,le=$yr2";
+        $limit_yr_value = "$yr1-$yr2";
     }
-    
+    elsif ($params->{'limit-yr'} =~ /\d{4}/) {
+        $limit_yr = "yr,st-numeric=$params->{'limit-yr'}";
+        $limit_yr_value = $params->{'limit-yr'};
+    }
+    push @limits,$limit_yr;
+    #FIXME: Should return a error to the user, incorect date format specified
+}
+
+# Params that can only have one value
+my $scan = $params->{'scan'};
+my $count = C4::Context->preference('numSearchResults') || 20;
+my $results_per_page = $params->{'count'} || $count;
+my $offset = $params->{'offset'} || 0;
+my $page = $input->param('page') || 1;
+#my $offset = ($page-1)*$results_per_page;
+my $hits;
+my $expanded_facet = $params->{'expand'};
+
+# Define some global variables
+my ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type);
+
+my @results;
+
+## I. BUILD THE QUERY
+( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by,$scan);
+
+## parse the query_cgi string and put it into a form suitable for <input>s
+my @query_inputs;
+my $scan_index_to_use;
+
+for my $this_cgi ( split('&',$query_cgi) ) {
+    next unless $this_cgi;
+    $this_cgi =~ m/(.*=)(.*)/;
+    my $input_name = $1;
+    my $input_value = $2;
+    $input_name =~ s/=$//;
+    push @query_inputs, { input_name => $input_name, input_value => $input_value };
+	if ($input_name eq 'idx') {
+    	$scan_index_to_use = $input_value; # unless $scan_index_to_use;
+	}
+}
+$template->param ( QUERY_INPUTS => \@query_inputs,
+                   scan_index_to_use => $scan_index_to_use );
+
+## parse the limit_cgi string and put it into a form suitable for <input>s
+my @limit_inputs;
+for my $this_cgi ( split('&',$limit_cgi) ) {
+    next unless $this_cgi;
+    # handle special case limit-yr
+    if ($this_cgi =~ /yr,st-numeric/) {
+        push @limit_inputs, { input_name => 'limit-yr', input_value => $limit_yr_value };   
+        next;
+    }
+    $this_cgi =~ m/(.*=)(.*)/;
+    my $input_name = $1;
+    my $input_value = $2;
+    $input_name =~ s/=$//;
+    push @limit_inputs, { input_name => $input_name, input_value => $input_value };
+}
+$template->param ( LIMIT_INPUTS => \@limit_inputs );
+
+## II. DO THE SEARCH AND GET THE RESULTS
+my $total; # the total results for the whole set
+my $facets; # this object stores the faceted results that display on the left-hand of the results page
+my @results_array;
+my $results_hashref;
+
+if (C4::Context->preference('NoZebra')) {
+    $query=~s/yr(:|=)\s*([\d]{1,4})-([\d]{1,4})/(yr>=$2 and yr<=$3)/g;
+    $simple_query=~s/yr\s*(:|=)([\d]{1,4})-([\d]{1,4})/(yr>=$2 and yr<=$3)/g;
+    warn $query; 
+    eval {
+        ($error, $results_hashref, $facets) = NZgetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
+    };
+} else {
+    eval {
+        ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
+    };
+}
+if ($@ || $error) {
+    $template->param(query_error => $error.$@);
+
+    output_html_with_http_headers $input, $cookie, $template->output;
+    exit;
+}
+
+# FIXME: This belongs in tools/ not in the primary search results page
+my $op=$input->param("operation");
+if ($op eq "bulkedit"){
+    my ($countchanged,$listunchanged)=
+    ModBiblios($results_hashref->{'biblioserver'}->{"RECORDS"},
+                      $params->{"tagsubfield"},
+                      $params->{"inputvalue"},
+                      $params->{"targetvalue"},
+                      $params->{"test"}
+                      );
+    $template->param(bulkeditresults=>1,
+                      tagsubfield=>$params->{"tagsubfield"},
+                      inputvalue=>$params->{"inputvalue"},
+                      targetvalue=>$params->{"targetvalue"},
+                      countchanged=>$countchanged,
+                      countunchanged=>scalar(@$listunchanged),
+                      listunchanged=>$listunchanged);
+
+    if (C4::Context->userenv->{'flags'}==1 ||(C4::Context->userenv->{'flags'} & ( 2**9 ) )){
+    #Edit Catalogue Permissions
+        my $editable_subfields = GetManagedTagSubfields();
+        # change '--' to '&mdash;' to avoid escaping issues
+        for (my $i = 0; $i <= $#{$editable_subfields}; $i++) {
+            $editable_subfields->[$i]->{subfielddesc} =~ s/--/&mdash;/g;
+            $editable_subfields->[$i]->{tagdesc} =~ s/--/&mdash;/g;
+        }
+        $template->param(bulkedit => 1);
+        $template->param(tagsubfields=>$editable_subfields);
+    }
+}
+
+# At this point, each server has given us a result set
+# now we build that set for template display
+my @sup_results_array;
+for (my $i=0;$i<@servers;$i++) {
+    my $server = $servers[$i];
+    if ($server =~/biblioserver/) { # this is the local bibliographic server
+        $hits = $results_hashref->{$server}->{"hits"};
+        my $page = $input->param('page') || 0;
+        my @newresults = searchResults( $query_desc,$hits,$results_per_page,$offset,$scan,@{$results_hashref->{$server}->{"RECORDS"}});
+        $total = $total + $results_hashref->{$server}->{"hits"};
+        ## If there's just one result, redirect to the detail page
+        if ($total == 1) {         
+            my $biblionumber=@newresults[0]->{biblionumber};
+            if (C4::Context->preference('IntranetBiblioDefaultView') eq 'isbd') {
+                print $input->redirect("/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=$biblionumber");
+            } elsif  (C4::Context->preference('IntranetBiblioDefaultView') eq 'marc') {
+                print $input->redirect("/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=$biblionumber");
+            } else {
+                print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber");
+            } 
+            exit;
+        }
+        if ($hits) {
+            $template->param(total => $hits);
+            my $limit_cgi_not_availablity = $limit_cgi;
+            $limit_cgi_not_availablity =~ s/&limit=available//g;
+            $template->param(limit_cgi_not_availablity => $limit_cgi_not_availablity);
+            $template->param(limit_cgi => $limit_cgi);
+            $template->param(query_cgi => $query_cgi);
+            $template->param(query_desc => $query_desc);
+            $template->param(limit_desc => $limit_desc);
+            if ($query_desc || $limit_desc) {
+                $template->param(searchdesc => 1);
+            }
+            $template->param(stopwords_removed => "@$stopwords_removed") if $stopwords_removed;
+            $template->param(results_per_page =>  $results_per_page);
+            $template->param(SEARCH_RESULTS => \@newresults);
+
+            ## FIXME: add a global function for this, it's better than the current global one
+            ## Build the page numbers on the bottom of the page
+            my @page_numbers;
+            # total number of pages there will be
+            my $pages = ceil($hits / $results_per_page);
+            # default page number
+            my $current_page_number = 1;
+            $current_page_number = ($offset / $results_per_page + 1) if $offset;
+            my $previous_page_offset = $offset - $results_per_page unless ($offset - $results_per_page <0);
+            my $next_page_offset = $offset + $results_per_page;
+            # If we're within the first 10 pages, keep it simple
+            #warn "current page:".$current_page_number;
+            if ($current_page_number < 10) {
+                # just show the first 10 pages
+                # Loop through the pages
+                my $pages_to_show = 10;
+                $pages_to_show = $pages if $pages<10;
+                for (my $i=1; $i<=$pages_to_show;$i++) {
+                    # the offset for this page
+                    my $this_offset = (($i*$results_per_page)-$results_per_page);
+                    # the page number for this page
+                    my $this_page_number = $i;
+                    # it should only be highlighted if it's the current page
+                    my $highlight = 1 if ($this_page_number == $current_page_number);
+                    # put it in the array
+                    push @page_numbers, { offset => $this_offset, pg => $this_page_number, highlight => $highlight, sort_by => join " ", at sort_by };
+                                
+                }
+                        
+            }
+            # now, show twenty pages, with the current one smack in the middle
+            else {
+                for (my $i=$current_page_number; $i<=($current_page_number + 20 );$i++) {
+                    my $this_offset = ((($i-9)*$results_per_page)-$results_per_page);
+                    my $this_page_number = $i-9;
+                    my $highlight = 1 if ($this_page_number == $current_page_number);
+                    if ($this_page_number <= $pages) {
+                        push @page_numbers, { offset => $this_offset, pg => $this_page_number, highlight => $highlight, sort_by => join " ", at sort_by };
+                    }
+                }
+                        
+            }
+            # FIXME: no previous_page_offset when pages < 2
+            $template->param(   PAGE_NUMBERS => \@page_numbers,
+                                previous_page_offset => $previous_page_offset) unless $pages < 2;
+            $template->param(   next_page_offset => $next_page_offset) unless $pages eq $current_page_number;
+        }
+        # no hits
+        else {
+            $template->param(searchdesc => 1,query_desc => $query_desc,limit_desc => $limit_desc);
+        }
+    } # end of the if local
+
+    # asynchronously search the authority server
+    elsif ($server =~/authorityserver/) { # this is the local authority server
+        my @inner_sup_results_array;
+        for my $sup_record ( @{$results_hashref->{$server}->{"RECORDS"}} ) {
+            my $marc_record_object = MARC::Record->new_from_usmarc($sup_record);
+            # warn "Authority Found: ".$marc_record_object->as_formatted();
+            push @inner_sup_results_array, {
+                'title' => $marc_record_object->field(100)->subfield('a'),
+                'link' => "&amp;idx=an&amp;q=".$marc_record_object->field('001')->as_string(),
+            };
+        }
+        my $servername = $server;
+        push @sup_results_array, {  servername => $servername, 
+                                    inner_sup_results_loop => \@inner_sup_results_array} if @inner_sup_results_array;
+    }
+    # FIXME: can add support for other targets as needed here
+    $template->param(           outer_sup_results_loop => \@sup_results_array);
+   
+# Searching the catalog.
+#if ($query) {
+
     # format output
-    my $total = scalar @$marcresults;
-    my @newresults = searchResults( $query, $total, $results_per_page, $page-1, 0, @$marcresults );
+    my @newresults = searchResults( $query_desc,$hits,$results_per_page,$offset,$scan,@{$results_hashref->{$server}->{"RECORDS"}});
+    $total = $results_hashref->{$server}->{"hits"};
     $template->param(
-        total          => $total_hits,
-        query          => $query,
+        total          => $total,
+        query          => $query_desc,
         resultsloop    => \@newresults,
-        pagination_bar => pagination_bar( "/cgi-bin/koha/cataloguing/addbooks.pl?q=$query&", getnbpages( $total_hits, $results_per_page ), $page, 'page' ),
+#        pagination_bar => pagination_bar( "/cgi-bin/koha/cataloguing/addbooks.pl?q=$query_desc&", getnbpages( $total, $results_per_page ), $page, 'page' ),
     );
+#}
+
+} #/end of the for loop
+#$template->param(FEDERATED_RESULTS => \@results_array);
+
+
+$template->param(
+            #classlist => $classlist,
+            total => $total,
+            opacfacets => 1,
+            facets_loop => $facets,
+            scan => $scan,
+            search_error => $error,
+);
+
+if ($query_desc || $limit_desc) {
+    $template->param(searchdesc => 1);
 }
 
+
+
+
+
+
+
+#/*****************************************************************/
+
 # fill with books in breeding farm
 my $toggle = 0;
 my ( $title, $isbn );
 
+my $query_b   = $input->param('q');
+
 # fill isbn or title, depending on what has been entered
 #u must do check on isbn because u can find number in beginning of title
 #check is on isbn legnth 13 for new isbn and 10 for old isbn
-my $querylength = length($query);
-if ( $query =~ /\d/ and ( $querylength eq 13 or $querylength eq 10 ) ) {
-    $isbn = $query;
+my $querylength = length($query_b);
+if ( $query_b =~ /\d/ and ( $querylength eq 13 or $querylength eq 10 ) ) {
+    $isbn = $query_b;
 }
-$title = $query unless $isbn;
-my ( $countbr, @resultsbr ) = BreedingSearch( $title, $isbn ) if $query;
+$title = $query_b unless $isbn;
+my ( $countbr, @resultsbr ) = BreedingSearch( $title, $isbn ) if $query_b;
 my @breeding_loop = ();
 for ( my $i = 0 ; $i <= $#resultsbr ; $i++ ) {
     my %row_data;
@@ -113,8 +449,6 @@ for ( my $i = 0 ; $i <= $#resultsbr ; $i++ ) {
     $row_data{toggle} = $toggle;
     $row_data{id}     = $resultsbr[$i]->{'id'};
     $row_data{isbn}   = $resultsbr[$i]->{'isbn'};
-    $row_data{copyrightdate}   = $resultsbr[$i]->{'copyrightdate'};
-    $row_data{editionstatement}   = $resultsbr[$i]->{'editionstatement'};
     $row_data{file}   = $resultsbr[$i]->{'file'};
     $row_data{title}  = $resultsbr[$i]->{'title'};
     $row_data{author} = $resultsbr[$i]->{'author'};
@@ -125,7 +459,6 @@ $template->param(
     frameworkcodeloop => \@frameworkcodeloop,
     breeding_count    => $countbr,
     breeding_loop     => \@breeding_loop,
-    z3950_search_params => C4::Search::z3950_search_args($query),
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cataloging-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cataloging-search.inc
index a05bf6a..496b6a7 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cataloging-search.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cataloging-search.inc
@@ -1,17 +1,86 @@
 
 <h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl"><!-- TMPL_VAR NAME="LibraryName" --></a></h1><!-- Begin Cataloging Resident Search Box -->
+<!-- TMPL_IF NAME="CAN_user_circulate" --><!-- TMPL_IF NAME="CircAutocompl" --><script type="text/javascript">
+//<![CDATA[
+YAHOO.util.Event.onContentReady("header_search", function() {
+    new function() {
+        // Define a custom formatter function
+        this.fnCustomFormatter = function(oResultItem, sQuery) {
+            var name        = oResultItem[0];
+            var cardnumber  = oResultItem[1];
+            var address     = oResultItem[2];
+            var city        = oResultItem[3];
+            var zip         = oResultItem[4];
+            var aMarkup = [
+                "<div class=\"sample-result\">",
+                name,
+                " (",
+                cardnumber,
+                ")<small> -- ",
+                address,
+                ", ",
+                city,
+                "</small>",
+                "</div>"];
+            return (aMarkup.join(""));
+        };
+
+        // Instantiate one XHR DataSource and define schema as an array:
+        //     ["Record Delimiter",
+        //     "Field Delimiter"]
+        this.oACDS = new YAHOO.widget.DS_XHR("/cgi-bin/koha/circ/ysearch.pl", ["\n", "\t"]);
+        this.oACDS.responseType = YAHOO.widget.DS_XHR.TYPE_FLAT;
+        this.oACDS.maxCacheEntries = 60;
+        this.oACDS.queryMatchSubset = true;
+    
+        // Instantiate first AutoComplete
+        var myInput = document.getElementById('findborrower');
+        var myContainer = document.getElementById('yborrowercontainer');
+        this.oAutoComp = new YAHOO.widget.AutoComplete(myInput,myContainer,this.oACDS);
+        //this.oAutoComp.delimChar = ";";
+        //this.oAutoComp.queryDelay = 1;
+        this.oAutoComp.formatResult = this.fnCustomFormatter;
+}
+});
+//]]>
+</script><!-- /TMPL_IF --><!-- /TMPL_IF -->
 <div id="header_search">
 <div id="addbooks_search" class="residentsearch">
 	<p class="tip">Search the catalog and the reservoir:</p>
 	<form name="search" action="addbooks.pl">
-        <input type="text" name="q"  size="40" class="focus" />
-        <input type="submit" class="submit" value="Submit" />
+        <input type="text" name="q"  size="40" class="focus" />		
+	<select id="sort_by" name="sort_by" style="font-size:1.2em;">
+                    <!-- TMPL_INCLUDE NAME="resort_form.inc" -->
+        </select>        
+	<input type="submit" class="submit" value="Submit" />
 	</form>
 </div>
-    <!-- TMPL_INCLUDE NAME="patron-search-box.inc" -->
+<!-- TMPL_IF NAME="CAN_user_circulate" -->
+	<div id="circ_search" class="residentsearch" style="display:none;">
+	<p class="tip">Enter patron card number or partial name:</p>
+    <form action="/cgi-bin/koha/circ/circulation.pl" method="post">
+    <!-- TMPL_IF NAME="CircAutocompl" -->
+    <div class="autocomplete">
+            <div id="borrowerautocomplete" class="autocomplete">
+                <input autocomplete="off" id="findborrower" name="findborrower" class="focus" type="text" />
+                <div id="yborrowercontainer"></div>
+                <input id="ysearchsubmit" type="submit" class="submit" value="Submit" />
+                <input name="branch" value="<!-- TMPL_VAR name="branch" -->" type="hidden" />
+                <input name="printer" value="" type="hidden" />
+            </div>
+        </div>
+	<!-- TMPL_ELSE -->
+            <input id="findborrower" name="findborrower" size="40" class="focus" type="text" />
+            <input name="branch" value="<!-- TMPL_VAR name="branch" -->" type="hidden" />
+            <input name="printer" value="" type="hidden" />
+            <input value="Submit" class="submit" type="submit" />
+	<!-- /TMPL_IF -->
+    </form>
+	</div>
+<!-- /TMPL_IF -->
 			<ul>
-			<li><a href="/cgi-bin/koha/catalogue/search.pl#addbooks_search">Cataloging Search</a></li>
+			<li><a href="/cgi-bin/koha/catalogue/search.pl#addbooks_search">Cataloguing Search</a></li>
 			<!-- TMPL_IF NAME="CAN_user_circulate" --><li><a href="/cgi-bin/koha/circ/circulation.pl#circ_search">Check Out</a></li><!-- /TMPL_IF -->
 			</ul>	
 </div>
-<!-- End Cataloging Resident Search Box -->
+<!-- End Cataloging Resident Search Box -->
\ No newline at end of file
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers-addbooks.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers-addbooks.inc
new file mode 100644
index 0000000..d32c950
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers-addbooks.inc
@@ -0,0 +1,7 @@
+<!-- TMPL_IF NAME="PAGE_NUMBERS" --><div class="pages">
+    <!-- Row of numbers corresponding to search result pages -->
+        <!-- TMPL_IF NAME="previous_page_offset" --><a class="nav" href="/cgi-bin/koha/cataloguing/addbooks.pl?<!-- TMPL_VAR NAME="query_cgi" --><!-- TMPL_VAR NAME="limit_cgi" -->&amp;offset=<!-- TMPL_VAR NAME="previous_page_offset" --><!-- TMPL_IF NAME="sort_by" -->&amp;sort_by=<!-- TMPL_VAR NAME="sort_by" --><!-- /TMPL_IF -->">&lt;&lt; Previous</a><!-- /TMPL_IF -->
+    <!-- TMPL_LOOP NAME="PAGE_NUMBERS" --><!-- TMPL_IF NAME="highlight" --><span class="current"><!-- TMPL_VAR NAME="pg" --></span><!-- TMPL_ELSE -->        <a class="nav" href="/cgi-bin/koha/cataloguing/addbooks.pl?<!-- TMPL_VAR NAME="query_cgi" --><!-- TMPL_VAR NAME="limit_cgi" -->&amp;offset=<!-- TMPL_VAR NAME="offset" --><!-- TMPL_IF NAME="sort_by" -->&amp;sort_by=<!-- TMPL_VAR NAME="sort_by" --><!-- /TMPL_IF -->"><!-- TMPL_VAR NAME="pg" --></a><!-- /TMPL_IF -->
+    <!-- /TMPL_LOOP -->
+        <!-- TMPL_IF NAME="next_page_offset" --><a class="nav" href="/cgi-bin/koha/cataloguing/addbooks.pl?<!-- TMPL_VAR NAME="query_cgi" --><!-- TMPL_VAR NAME="limit_cgi" -->&amp;offset=<!-- TMPL_VAR NAME="next_page_offset" --><!-- TMPL_IF NAME="sort_by" -->&amp;sort_by=<!-- TMPL_VAR NAME="sort_by" --><!-- /TMPL_IF -->">Next &gt;&gt;</a><!-- /TMPL_IF -->
+</div><!-- /TMPL_IF -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tmpl
index ed5bd42..e1b28e1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tmpl
@@ -1,5 +1,5 @@
 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
-<title>Koha &rsaquo; Cataloging</title>
+<title>Koha &rsaquo; Cataloguing</title>
 <!-- TMPL_INCLUDE NAME="greybox.inc" -->
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 <script type="text/javascript">
@@ -12,9 +12,9 @@
 <!-- TMPL_INCLUDE NAME="header.inc" -->
 <!-- TMPL_INCLUDE NAME="cataloging-search.inc" -->
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; Cataloging</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; Cataloguing</div>
 
-<div id="doc" class="yui-t7">
+<div id="doc" class="yui-t7" width="900px">
    
    <div id="bd">
 	<div id="yui-main">
@@ -31,6 +31,7 @@
 <!-- TMPL_VAR NAME="total"--> result(s) found in catalog,
 <a href="#searchresult-breeding"><!-- TMPL_VAR NAME="breeding_count" --> result(s) found in reservoir</a>
 <!-- TMPL_VAR name='pagination_bar'-->
+<!-- TMPL_INCLUDE NAME="page-numbers.inc" -->
 <div class="searchresults">
     <table>
         <tr>
@@ -59,11 +60,8 @@
                         <!-- TMPL_ELSE -->
                             &nbsp;
                         <!-- /TMPL_IF -->
-			<!-- TMPL_IF NAME="isbn" --> - <!-- TMPL_VAR NAME="isbn" --> <!-- /TMPL_IF -->
                         <!-- TMPL_IF name="publicationyear" --> - <!-- TMPL_VAR name="publicationyear" --><!-- /TMPL_IF -->
                         <!-- TMPL_IF name="publishercode" -->- <!-- TMPL_VAR name="publishercode" --><!-- /TMPL_IF -->
-                        <!-- TMPL_IF name="copyrightdate" --> - <!-- TMPL_VAR name="copyrightdate" --><!-- /TMPL_IF -->
-                        <!-- TMPL_IF NAME="edition" -->Edition: <!-- TMPL_VAR NAME="edition" --><!-- /TMPL_IF -->
                         <!-- TMPL_IF name="place" --> ; <!-- TMPL_VAR name="place" --><!-- /TMPL_IF -->
                         <!-- TMPL_IF name="pages" --> - <!-- TMPL_VAR name="pages" --><!-- /TMPL_IF -->
                         <!-- TMPL_IF name="size" --> ; <!-- TMPL_VAR name="size" --><!-- /TMPL_IF -->
@@ -89,12 +87,67 @@
                         <!-- /TMPL_LOOP -->
                         </span>
                     <!-- /TMPL_IF -->
-                    <span class="unavailable">
-                        <!-- TMPL_IF NAME="onloancount" --> Checked out (<!-- TMPL_VAR NAME="onloancount" -->),<br /> <!-- /TMPL_IF -->
-                        <!-- TMPL_IF NAME="wthdrawncount" --> Withdrawn (<!-- TMPL_VAR NAME="wthdrawncount" -->),<br /> <!-- /TMPL_IF -->
-                        <!-- TMPL_IF NAME="itemlostcount" --> Lost (<!-- TMPL_VAR NAME="itemlostcount" -->)<br /><!-- /TMPL_IF -->
-                        <!-- TMPL_IF NAME="orderedcount" --> On order (<!-- TMPL_VAR NAME="orderedcount" -->)<!-- /TMPL_IF -->
-                    </span>
+                    <div class="availability">
+                                    <!-- TMPL_IF NAME="items_count" --><div><!-- TMPL_VAR NAME="items_count" -->
+                                    <!-- TMPL_IF NAME="itemsplural" -->items<!-- TMPL_ELSE -->item<!-- /TMPL_IF --></div>
+
+                                    <!-- TMPL_IF NAME="available_items_loop" -->
+                                    <!-- TMPL_IF NAME="availablecount" --><!-- TMPL_VAR NAME="availablecount" --><!-- /TMPL_IF --> available:
+                                    <ul>
+                                    <!-- TMPL_LOOP NAME="available_items_loop" -->
+                                        
+                                        <!-- TMPL_IF NAME="noItemTypeImages" --><li><!-- TMPL_ELSE --><!-- TMPL_IF NAME="item-level_itypes" --><!-- TMPL_IF name="imageurl" --><li style=" list-style: none; list-style-type: none;  background-image: url(<!-- TMPL_VAR name="imageurl" -->); background-repeat: no-repeat; background-position: 0 50%; padding: 3px 0 3px 30px; margin: .4em 0; " title="<!-- TMPL_VAR name="description" -->"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><!-- /TMPL_IF -->
+                                        <!-- TMPL_IF NAME="branchname" --><!-- TMPL_VAR NAME="branchname" --><!-- /TMPL_IF -->
+                                        <!-- TMPL_IF NAME="location" --><!-- TMPL_VAR NAME="location" --><!-- /TMPL_IF -->
+                                        <!-- TMPL_IF NAME="itemcallnumber" -->[<a href="/cgi-bin/koha/catalogue/search.pl?q=callnum:<!-- TMPL_VAR NAME="itemcallnumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="itemcallnumber" --></a>]<!-- /TMPL_IF -->
+                                        (<!-- TMPL_VAR NAME="count" -->)</li>
+                                    <!-- /TMPL_LOOP --></ul>
+                                    <!-- TMPL_ELSE -->
+                                    <span class="unavailable">No items available</span>
+                                    <!-- /TMPL_IF -->
+
+                                   <!-- TMPL_IF NAME="onloan_items_loop" -->
+                                   <!-- TMPL_IF NAME="onloancount" --><!-- TMPL_VAR NAME="onloancount" --><!-- /TMPL_IF --> on loan:
+                                    <ul>
+                                    <!-- TMPL_LOOP NAME="onloan_items_loop" -->
+                                       <!-- TMPL_IF NAME="noItemTypeImages" --><li><!-- TMPL_ELSE --><!-- TMPL_IF NAME="item-level_itypes" -->
+                                        <!-- TMPL_IF name="imageurl" -->
+                                        <li style=" list-style: none; list-style-type: none;  background-image: url(<!-- TMPL_VAR name=imageurl -->); background-repeat: no-repeat; background-position: 0 50%; padding: 3px 0 3px 30px; margin: .4em 0;" title="<!-- TMPL_VAR name="description" -->">
+                                        <!-- TMPL_ELSE --><li><!-- /TMPL_IF -->
+                                        <!-- TMPL_ELSE --><li><!-- /TMPL_IF --><!-- /TMPL_IF -->                                        
+
+                                        <!-- TMPL_IF NAME="branchname" --><!-- TMPL_VAR NAME="branchname" --><!-- /TMPL_IF -->
+                                        <!-- TMPL_IF NAME="location" --><!-- TMPL_VAR NAME="location" --><!-- /TMPL_IF -->
+                                        <!-- TMPL_IF NAME="itemcallnumber" -->[<a href="/cgi-bin/koha/catalogue/search.pl?q=callnum:<!-- TMPL_VAR NAME="itemcallnumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="itemcallnumber" --></a>]<!-- /TMPL_IF -->
+                                        (<!-- TMPL_VAR NAME="count" --><!-- TMPL_IF NAME="longoverdue" -->, <!-- TMPL_VAR NAME="longoverdue" --> long overdue<!-- /TMPL_IF -->) date due: <!-- TMPL_VAR NAME="due_date" --></li>
+                                    <!-- /TMPL_LOOP --></ul>
+                                    <!-- /TMPL_IF -->
+
+                                    <!-- TMPL_IF NAME="other_items_loop" -->
+                                    <!-- TMPL_IF NAME="othercount" --><!-- TMPL_VAR NAME="othercount" --><!-- /TMPL_IF --> unavailable:
+                                    <ul>
+                                    <!-- TMPL_LOOP NAME="other_items_loop" -->
+                                        <!-- TMPL_IF NAME="noItemTypeImages" --><li><!-- TMPL_ELSE --><!-- TMPL_IF NAME="item-level_itypes" -->
+                                        <!-- TMPL_IF name="imageurl" -->
+                                        <li style="list-style: none; list-style-type: none; background-image: url(<!-- TMPL_VAR name="imageurl" -->); background-repeat: no-repeat; background-position: 0 50%; padding: 3px 0 3px 30px; margin: .4em 0;" title="<!-- TMPL_VAR name="description" -->">
+                                        <!-- TMPL_ELSE --><li><!-- /TMPL_IF -->
+                                        <!-- TMPL_ELSE --><li><!-- /TMPL_IF --><!-- /TMPL_IF -->
+
+                                        <!-- TMPL_IF NAME="branchname" --><!-- TMPL_VAR NAME="branchname" --><!-- /TMPL_IF -->
+                                        <!-- TMPL_IF NAME="location" --><!-- TMPL_VAR NAME="location" --><!-- /TMPL_IF -->
+                                        <!-- TMPL_IF NAME="itemcallnumber" -->[<a href="/cgi-bin/koha/catalogue/search.pl?q=callnum:<!-- TMPL_VAR NAME="itemcallnumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="itemcallnumber" --></a>]<!-- /TMPL_IF -->
+                                        <!-- TMPL_IF NAME="wthdrawn" -->(Withdrawn)<!-- /TMPL_IF -->
+                                        <!-- TMPL_IF NAME="itemlost" -->(Lost)<!-- /TMPL_IF -->
+                                        <!-- TMPL_IF NAME="damaged" -->(Damaged)<!-- /TMPL_IF -->
+                                        <!-- TMPL_IF NAME="intransit" -->(In transit)<!-- /TMPL_IF -->
+                                        <!-- TMPL_IF NAME="notforloan" --><!-- TMPL_VAR name="notforloan" --><!-- /TMPL_IF -->
+                                        (<!-- TMPL_VAR NAME="count" -->)</li>
+                                    <!-- /TMPL_LOOP --></ul>
+                                    <!-- /TMPL_IF -->
+                                    <!-- TMPL_ELSE -->
+                                    <span class="unavailable">No items</span>
+                                    <!-- /TMPL_IF --> <!-- /items count -->
+                                    </div>
                 </td>
 				<td> <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=<!-- TMPL_VAR NAME="biblionumber" -->" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=<!-- TMPL_VAR NAME="biblionumber" -->" title="MARC" rel="gb_page_center[600,500]">Card</a>
                 </td>
@@ -112,9 +165,9 @@
 </div>
 <!-- TMPL_ELSE -->
     <!-- TMPL_IF name='query'-->
-        <!-- TMPL_IF NAME="error" --><div class="dialog alert"><!-- /TMPL_IF --><b>No results found</b>
+        <b>No results found</b>
         <!-- TMPL_IF NAME="error" -->
-            Error: <span class="error"><!-- TMPL_VAR NAME="error" --></span></div>
+            Error: <span class="error"><!-- TMPL_VAR NAME="error" --></span>
         <!-- /TMPL_IF -->
     <!-- /TMPL_IF -->
 <!-- /TMPL_IF -->
@@ -127,19 +180,15 @@
             <tr>
                 <th>Title</th>
                 <th>ISBN</th>
-                <th>Date</th>
-                <th>Edition</th>
                 <th>coming from</th>
                 <th>preview</th>
                 <th>&nbsp;</th>
             </tr>
             <!-- TMPL_LOOP NAME="breeding_loop" -->
             <!-- TMPL_IF NAME="toggle" --><tr><!-- TMPL_ELSE --><tr class="hilighted"><!-- /TMPL_IF -->
-                <td><!-- TMPL_VAR NAME="title" escape="html" -->
+                <td><!-- TMPL_VAR NAME="title" -->
                 <!-- TMPL_VAR NAME="author" --></td>
                 <td><!-- TMPL_VAR NAME="isbn" --></td>
-                <td><!-- TMPL_VAR NAME="copyrightdate" --></td>
-                <td><!-- TMPL_VAR NAME="edition" --></td>
                 <td><!-- TMPL_VAR NAME="file" --></td>
                 <td> <a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=<!-- TMPL_VAR NAME="id" -->" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=<!-- TMPL_VAR NAME="id" -->" title="MARC" rel="gb_page_center[600,500]">Card</a>
 				</td>
-- 
1.5.6




More information about the Koha-patches mailing list