bug 3263: Staff Search Results Interface Changes
authorGalen Charlton <galen.charlton@liblime.com>
Wed, 27 May 2009 18:10:42 +0000 (13:10 -0500)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Wed, 16 Sep 2009 21:19:37 +0000 (23:19 +0200)
Coding by Rick Welykochy <rick@praxis.com.au>

[1] Three new system preferences to enable particular
bib record views in the staff interface:

viewMARC
viewLabeledMARC
viewISBD

Implements enhancement 2642.

[2] New button in the regular and cataloging search results
   pages in the staff interface to allow the operator to redo
   the search against Z39.50 targets instead of the Koha database.

[3] Added copyright date and edition to cataloging and Z39.50 search results.
    Implements enhancement 2640.

Feature sponsored by MassCat.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
19 files changed:
C4/Search.pm
catalogue/ISBDdetail.pl
catalogue/MARCdetail.pl
catalogue/detail.pl
catalogue/issuehistory.pl
catalogue/moredetail.pl
catalogue/search.pl
cataloguing/addbooks.pl
cataloguing/z3950_search.pl
koha-tmpl/intranet-tmpl/prog/en/css/addbiblio.css
koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc
koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/includes/cataloging-toolbar.inc
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tmpl
reserve/request.pl
tools/viewlog.pl

index d78f407..0191ac7 100644 (file)
@@ -19,7 +19,7 @@ use strict;
 # use warnings; # FIXME
 require Exporter;
 use C4::Context;
-use C4::Biblio;    # GetMarcFromKohaField
+use C4::Biblio;    # GetMarcFromKohaField, GetBiblioData
 use C4::Koha;      # getFacets
 use Lingua::Stem;
 use C4::Search::PazPar2;
@@ -27,6 +27,7 @@ use XML::Simple;
 use C4::Dates qw(format_date);
 use C4::XSLT;
 use C4::Branch;
+use URI::Escape;
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG);
 
@@ -1210,6 +1211,15 @@ sub searchResults {
         $aisbn =~ s/-//g;
         $oldbiblio->{amazonisbn} = $aisbn;
        $oldbiblio->{description} = $itemtypes{ $oldbiblio->{itemtype} }->{description};
+       $oldbiblio->{normalized_upc} = GetNormalizedUPC($marcrecord,$marcflavour);
+       $oldbiblio->{normalized_ean} = GetNormalizedEAN($marcrecord,$marcflavour);
+       $oldbiblio->{normalized_oclc} = GetNormalizedOCLCNumber($marcrecord,$marcflavour);
+       $oldbiblio->{normalized_isbn} = GetNormalizedISBN(undef,$marcrecord,$marcflavour);
+       $oldbiblio->{content_identifier_exists} = 1 if ($oldbiblio->{normalized_isbn} or $oldbiblio->{normalized_oclc} or $oldbiblio->{normalized_ean} or $oldbiblio->{normalized_upc});
+
+       # edition information, if any
+        $oldbiblio->{edition} = $oldbiblio->{editionstatement};
+       $oldbiblio->{description} = $itemtypes{ $oldbiblio->{itemtype} }->{description};
  # Build summary if there is one (the summary is defined in the itemtypes table)
  # FIXME: is this used anywhere, I think it can be commented out? -- JF
         if ( $itemtypes{ $oldbiblio->{itemtype} }->{summary} ) {
@@ -2105,6 +2115,96 @@ sub NZorder {
     }
 }
 
+=head2 enabled_staff_search_views
+
+%hash = enabled_staff_search_views()
+
+This function returns a hash that contains three flags obtained from the system
+preferences, used to determine whether a particular staff search results view
+is enabled.
+
+=over 2
+
+=item C<Output arg:>
+
+    * $hash{can_view_MARC} is true only if the MARC view is enabled
+    * $hash{can_view_ISBD} is true only if the ISBD view is enabled
+    * $hash{can_view_labeledMARC} is true only if the Labeled MARC view is enabled
+
+=item C<usage in the script:>
+
+=back
+
+$template->param ( C4::Search::enabled_staff_search_views );
+
+=cut
+
+sub enabled_staff_search_views
+{
+       return (
+               can_view_MARC                   => C4::Context->preference('viewMARC'),                 # 1 if the staff search allows the MARC view
+               can_view_ISBD                   => C4::Context->preference('viewISBD'),                 # 1 if the staff search allows the ISBD view
+               can_view_labeledMARC    => C4::Context->preference('viewLabeledMARC'),  # 1 if the staff search allows the Labeled MARC view
+       );
+}
+
+
+=head2 z3950_search_args
+
+$arrayref = z3950_search_args($matchpoints)
+
+This function returns an array reference that contains the search parameters to be
+passed to the Z39.50 search script (z3950_search.pl). The array elements
+are hash refs whose keys are name, value and encvalue, and whose values are the
+name of a search parameter, the value of that search parameter and the URL encoded
+value of that parameter.
+
+The search parameter names are lccn, isbn, issn, title, author, dewey and subject.
+
+The search parameter values are obtained from the bibliographic record whose
+data is in a hash reference in $matchpoints, as returned by Biblio::GetBiblioData().
+
+If $matchpoints is a scalar, it is assumed to be an unnamed query descriptor, e.g.
+a general purpose search argument. In this case, the returned array contains only
+entry: the key is 'title' and the value and encvalue are derived from $matchpoints.
+
+If a search parameter value is undefined or empty, it is not included in the returned
+array.
+
+The returned array reference may be passed directly to the template parameters.
+
+=over 2
+
+=item C<Output arg:>
+
+    * $array containing hash refs as described above
+
+=item C<usage in the script:>
+
+=back
+
+$data = Biblio::GetBiblioData($bibno);
+$template->param ( MYLOOP => C4::Search::z3950_search_args($data) )
+
+*OR*
+
+$template->param ( MYLOOP => C4::Search::z3950_search_args($searchscalar) )
+
+=cut
+
+sub z3950_search_args {
+    my $bibrec = shift;
+    $bibrec = { title => $bibrec } if !ref $bibrec;
+    my $array = [];
+    for my $field (qw/ lccn isbn issn title author dewey subject /)
+    {
+        my $encvalue = URI::Escape::uri_escape_utf8($bibrec->{$field});
+        push @$array, { name=>$field, value=>$bibrec->{$field}, encvalue=>$encvalue } if defined $bibrec->{$field};
+    }
+    return $array;
+}
+
+
 END { }    # module clean-up code here (global destructor)
 
 1;
index d9eea6d..b2dea40 100755 (executable)
@@ -45,7 +45,7 @@ use C4::Biblio;
 use C4::Items;
 use C4::Branch;     # GetBranchDetail
 use C4::Serials;    # CountSubscriptionFromBiblionumber
-
+use C4::Search;                # enabled_staff_search_views
 
 #---- Internal function
 
@@ -88,6 +88,8 @@ $template->param (
     ISBD                => $res,
     biblionumber        => $biblionumber,
        isbdview => 1,
+       z3950_search_params     => C4::Search::z3950_search_args(GetBiblioData($biblionumber)),
+       C4::Search::enabled_staff_search_views,
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;
index f569763..5b209a6 100755 (executable)
@@ -55,6 +55,7 @@ use C4::Biblio;
 use C4::Items;
 use C4::Acquisition;
 use C4::Serials;    #uses getsubscriptionsfrombiblionumber GetSubscriptionsFromBiblionumber
+use C4::Search;                # enabled_staff_search_views
 
 
 my $query        = new CGI;
@@ -316,6 +317,8 @@ $template->param (
     popup                   => $popup,
     hide_marc               => C4::Context->preference('hide_marc'),
        marcview => 1,
+       z3950_search_params             => C4::Search::z3950_search_args($biblio),
+       C4::Search::enabled_staff_search_views,
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;
index a8a0cfa..5f46eca 100755 (executable)
@@ -34,6 +34,7 @@ use C4::Members;
 use C4::Serials;
 use C4::XISBN qw(get_xisbns get_biblionumber_from_isbn get_biblio_from_xisbn);
 use C4::External::Amazon;
+use C4::Search;                # enabled_staff_search_views
 
 # use Smart::Comments;
 
@@ -177,6 +178,8 @@ $template->param(
        itemdata_uri        => $itemfields{uri},
        itemdata_copynumber => $itemfields{copynumber},
        volinfo                         => $itemfields{enumchron} || $dat->{'serial'} ,
+       z3950_search_params     => C4::Search::z3950_search_args($dat),
+       C4::Search::enabled_staff_search_views,
 );
 
 my @results = ( $dat, );
@@ -184,6 +187,9 @@ foreach ( keys %{$dat} ) {
     $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' );
 }
 
+# does not work: my %views_enabled = map { $_ => 1 } $template->query(loop => 'EnableViews');
+# method query not found?!?!
+
 $template->param(
     itemloop        => \@itemloop,
     biblionumber        => $biblionumber,
index 0a5db95..8790bb5 100755 (executable)
@@ -25,6 +25,7 @@ use C4::Output;
 use C4::Circulation;    # GetBiblioIssues
 use C4::Biblio;    # GetBiblio GetBiblioFromItemNumber
 use C4::Dates qw/format_date/;
+use C4::Search;                # enabled_staff_search_views
 
 my $query = new CGI;
 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
@@ -70,6 +71,7 @@ $template->param(
     total        => scalar @$issues,
     issues       => $issues,
        issuehistoryview => 1,
+       C4::Search::enabled_staff_search_views,
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;
index 6f62661..0b339dc 100755 (executable)
@@ -30,6 +30,7 @@ use C4::Auth;
 use C4::Serials;
 use C4::Dates qw/format_date/;
 use C4::Circulation;  # to use itemissues
+use C4::Search;                # enabled_staff_search_views
 
 my $query=new CGI;
 
@@ -119,6 +120,7 @@ foreach my $item (@items){
 $template->param(count => $data->{'count'},
        subscriptionsnumber => $subscriptionsnumber,
     subscriptiontitle   => $data->{title},
+       C4::Search::enabled_staff_search_views,
 );
 $template->param(BIBITEM_DATA => \@results);
 $template->param(ITEM_DATA => \@items);
@@ -128,6 +130,7 @@ $template->param(biblionumber => $biblionumber);
 $template->param(biblioitemnumber => $bi);
 $template->param(itemnumber => $itemnumber);
 $template->param(ONLY_ONE => 1) if ( $itemnumber && $count != @items );
+$template->param(z3950_search_params => C4::Search::z3950_search_args(GetBiblioData($biblionumber)));
 
 output_html_with_http_headers $query, $cookie, $template->output;
 
index 0fff659..1123a86 100755 (executable)
@@ -408,6 +408,25 @@ if ($params->{'limit-yr'}) {
     #FIXME: Should return a error to the user, incorect date format specified
 }
 
+# convert indexes and operands to corresponding parameter names for the z3950 search
+# $ %z3950p will be a hash ref if the indexes are present (advacned search), otherwise undef
+my $z3950par;
+my $indexes2z3950 = {
+       kw=>'title', au=>'author', 'au,phr'=>'author', nb=>'isbn', ns=>'issn',
+       'lcn,phr'=>'dewey', su=>'subject', 'su,phr'=>'subject', 
+       ti=>'title', 'ti,phr'=>'title', se=>'title'
+};
+for (my $ii = 0; $ii < @operands; ++$ii)
+{
+       my $name = $indexes2z3950->{$indexes[$ii]};
+       if (defined $name && defined $operands[$ii])
+       {
+               $z3950par ||= {};
+               $z3950par->{$name} = $operands[$ii] if !exists $z3950par->{$name};
+       }
+}
+
+
 # Params that can only have one value
 my $scan = $params->{'scan'};
 my $count = C4::Context->preference('numSearchResults') || 20;
@@ -499,10 +518,14 @@ for (my $i=0;$i<@servers;$i++) {
         ## 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') {
+                       my $defaultview = C4::Context->preference('IntranetBiblioDefaultView');
+                       my $views = { C4::Search::enabled_staff_search_views }; 
+            if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) {
                 print $cgi->redirect("/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=$biblionumber");
-            } elsif  (C4::Context->preference('IntranetBiblioDefaultView') eq 'marc') {
+            } elsif  ($defaultview eq 'marc' && $views->{can_view_MARC}) {
                 print $cgi->redirect("/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=$biblionumber");
+            } elsif  ($defaultview eq 'labeled_marc' && $views->{can_view_labeledMARC}) {
+                print $cgi->redirect("/cgi-bin/koha/catalogue/labeledMARCdetail.pl?biblionumber=$biblionumber");
             } else {
                 print $cgi->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber");
             } 
@@ -520,6 +543,7 @@ for (my $i=0;$i<@servers;$i++) {
             $template->param(query_cgi => $query_cgi);
             $template->param(query_desc => $query_desc);
             $template->param(limit_desc => $limit_desc);
+                       $template->param (z3950_search_params => C4::Search::z3950_search_args($query_desc));
             if ($query_desc || $limit_desc) {
                 $template->param(searchdesc => 1);
             }
@@ -585,6 +609,7 @@ for (my $i=0;$i<@servers;$i++) {
         # no hits
         else {
             $template->param(searchdesc => 1,query_desc => $query_desc,limit_desc => $limit_desc);
+                       $template->param (z3950_search_params => C4::Search::z3950_search_args($z3950par || $query_desc));
         }
 
 
index 8d02664..d4083d9 100755 (executable)
@@ -113,6 +113,8 @@ 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'};
@@ -123,6 +125,7 @@ $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;
index e3973c9..be18019 100755 (executable)
@@ -243,6 +243,8 @@ warn "query ".$query  if $DEBUG;
                         $row_data{lccn}         = $oldbiblio->{lccn};
                         $row_data{title}        = $oldbiblio->{title};
                         $row_data{author}       = $oldbiblio->{author};
+                        $row_data{date}         = $oldbiblio->{copyrightdate};
+                        $row_data{edition}      = $oldbiblio->{editionstatement};
                         $row_data{breedingid}   = $breedingid;
                         $row_data{biblionumber} = $biblionumber;
                         push( @breeding_loop, \%row_data );
index c895b74..75c052c 100644 (file)
@@ -124,7 +124,7 @@ a.tagnum {
 #cataloguing_additem_newitem .input_marceditor {
        width : auto;
 }
-
 .mandatory_marker {
        color: red;
 }
+
index 9c50b15..858e1d1 100644 (file)
@@ -844,6 +844,11 @@ fieldset.rows .inputnote {
        background-position : center left;
        background-repeat : no-repeat;
 }
+#z3950searcht table {
+       /* doesn't have desired effect in catalogue/results.tmpl - I'll leave this here for now but there do seem to be casscading CSS errors in this and other CSS fiels - RICKW 20081118 */
+       padding: 20px;
+       border: none;
+}
 #printbiblio button, #printbiblio a, #printmenuc .first-child {
        padding-left : 34px;
        background-image: url("../../img/toolbar-print.gif");
@@ -1320,6 +1325,18 @@ overflow :  hidden;
        float : right;
 }
 
+#searchheader form.fz3950 {
+       float : right;
+       font-size : 125%;
+       padding : 0 0 0 5em;
+}
+
+#searchheader form.fz3950bigrpad {
+       float : right;
+       font-size : 125%;
+       padding : 5px 25em 0 0;
+}
+
 #search-facets ul {
        margin : 0;
        padding : .3em;
@@ -1633,3 +1650,22 @@ span.permissiondesc {
        margin-top : .5em;
        padding : .5em;
 }
+
+.labeledmarc-table {
+       border: 0;
+}
+
+.labeledmarc-label {
+       border: 0;
+       padding: 5;
+       font-size: 11pt;
+       color: darkblue;
+}
+
+.labeledmarc-value {
+       border: 0;
+       padding: 5;
+       font-size: 10pt;
+       color: black;
+}
+
index 3f021f9..e3ccc8b 100644 (file)
@@ -2,10 +2,22 @@
 <ul>
     <!-- TMPL_IF NAME="detailview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF -->
     <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_IF NAME="object" --><!-- TMPL_VAR NAME="object" --><!-- TMPL_ELSE --><!-- TMPL_VAR NAME="biblionumber" --><!-- /TMPL_IF -->">Normal</a></li>
+
+<!-- TMPL_IF NAME="can_view_MARC" -->
 <!-- TMPL_IF NAME="marcview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF -->
 <a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_IF NAME="object" --><!-- TMPL_VAR NAME="object" --><!-- TMPL_ELSE --><!-- TMPL_VAR NAME="biblionumber" --><!-- /TMPL_IF -->">MARC</a></li>
+<!-- /TMPL_IF -->
+
+<!-- TMPL_IF NAME="can_view_labeledMARC" -->
+    <!-- TMPL_IF NAME="labeledmarcview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF -->
+       <a href="/cgi-bin/koha/catalogue/labeledMARCdetail.pl?biblionumber=<!-- TMPL_IF NAME="object" --><!-- TMPL_VAR NAME="object" --><!-- TMPL_ELSE --><!-- TMPL_VAR NAME="biblionumber" --><!-- /TMPL_IF -->">Labeled MARC</a></li>
+<!-- /TMPL_IF -->
+
+<!-- TMPL_IF NAME="can_view_ISBD" -->
     <!-- TMPL_IF NAME="isbdview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF -->
     <a href="/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=<!-- TMPL_IF NAME="object" --><!-- TMPL_VAR NAME="object" --><!-- TMPL_ELSE --><!-- TMPL_VAR NAME="biblionumber" --><!-- /TMPL_IF -->">ISBD</a></li>
+<!-- /TMPL_IF -->
+
     <!-- TMPL_IF NAME="moredetailview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF -->
     <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=<!-- TMPL_IF NAME="object" --><!-- TMPL_VAR NAME="object" --><!-- TMPL_ELSE --><!-- TMPL_VAR NAME="biblionumber" --><!-- /TMPL_IF -->">Items</a></li>
     <!-- TMPL_IF NAME="CAN_user_reserveforothers" -->
index cb1f45f..f81f6dc 100644 (file)
@@ -3,6 +3,23 @@
        <script type="text/javascript">
        //<![CDATA[
        
+       /* this function open a popup to search on z3950 server.  */
+       function PopupZ3950() {
+               var strQuery = GetZ3950Terms();
+               if(strQuery){
+                       window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
+               } 
+       }
+
+       /* provide Z3950 search points */
+       function GetZ3950Terms(){
+               var strQuery="&frameworkcode=";
+               <!-- TMPL_LOOP NAME='z3950_search_params' -->
+                       strQuery += "&" + "<!-- TMPL_VAR NAME="name" -->" + "=" + "<!-- TMPL_VAR NAME="encvalue" -->";
+               <!-- /TMPL_LOOP -->
+               return strQuery;
+       }
+
        function addToShelf() { window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->','Add_to_virtualshelf','width=500,height=400,toolbar=false,scrollbars=yes');
        }
        function printBiblio() {window.open('/cgi-bin/koha/catalogue/detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->','Print_Biblio','width=700,height=500,toolbar=false,scrollbars=yes');
@@ -51,6 +68,7 @@ function confirm_items_deletion() {
                $("#printbiblioc").empty();
                $("#export").remove();
                $("#addtoshelfc").before("<li id=\"savemenuc\"><\/li>");
+               $("#z3950searchc").empty();
            yuiToolbar();
         });
 
@@ -103,6 +121,14 @@ function confirm_items_deletion() {
                container: "newmenuc"
            });
                
+               new YAHOO.widget.Button({
+                       id: "z3950search", 
+                       type: "button", 
+                       label: _("z39.50 Search"), 
+                       container: "z3950searchc",
+                       onclick: {fn:function(){PopupZ3950()}}
+               });
+
                var addtoshelfButton = new YAHOO.widget.Button({
                                             id: "addtoshelf", 
                                             type: "button", 
@@ -127,6 +153,8 @@ function confirm_items_deletion() {
        //]]>
        </script>
        
+<form method="post" name="f" id="f" action="/cgi-bin/koha/cataloguing/addbiblio.pl" onsubmit="return Check();">
+
 <ul class="toolbar">
        <!-- TMPL_IF NAME="CAN_user_editcatalogue" -->
        <li id="newmenuc"><a id="newbiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl">New Record</a></li>
@@ -143,4 +171,7 @@ function confirm_items_deletion() {
         <!-- TMPL_UNLESS name="bi_notforloan" -->
        <!-- TMPL_UNLESS NAME="norequests" --><li><a id="placehold" href="/cgi-bin/koha/reserve/request.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold</a></li><!-- /TMPL_UNLESS --><!-- /TMPL_UNLESS -->
        <!-- /TMPL_IF -->
+       <li id="z3950searchc"><input type="button" id="z3950search" value="z39.50 Search" onclick="PopupZ3950(); return false;" /></li>
+</form>
 </ul></div>
+
index f1dae2d..d20789e 100644 (file)
@@ -9,11 +9,12 @@
         $(document).ready(function() {
            $("#newmenuc").empty();
            yuiToolbar();
+        yuiZ3950button();
         });
 
        // YUI Toolbar Functions
 
-       function yuiToolbar() {   
+       function yuiToolbar() {
        
     <!-- TMPL_IF NAME="NOTMARC" -->
            new YAHOO.widget.Button("newrecord");
            });  
        }
 
-                       <!-- /TMPL_IF -->
+    /* this function open a popup to search on z3950 server.  */
+    function PopupZ3950() {
+        var strQuery = GetZ3950Terms();
+        if(strQuery){
+            window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
+        }
+    }
+    /* provide Z3950 search points */
+    function GetZ3950Terms(){
+        var strQuery="&frameworkcode=";
+        <!-- TMPL_LOOP NAME='z3950_search_params' -->
+            strQuery += "&" + "<!-- TMPL_VAR NAME="name" -->" + "=" + "<!-- TMPL_VAR NAME="encvalue" -->";
+        <!-- /TMPL_LOOP -->
+        return strQuery;
+    }
+    /* prepare DOM for Z39.50 Search Button */
+    function yuiZ3950button() {
+        new YAHOO.widget.Button({
+                id: "z3950search",
+                type: "button",
+                label: _("z39.50 Search"),
+                container: "newmenuc",
+                onclick: {fn:function(){PopupZ3950()}}
+        });
+    }
        //]]>
        </script>
        
@@ -54,6 +79,8 @@
                        </select>
                        <input type="submit" value="Add Record Without Search" />
                </form>
+        <a id="z3950search" onclick="PopupZ3950(); return false;">z39.50 Search</a>
     <!-- /TMPL_IF -->  
+
   </div>
 </div>
index 8efa358..510226b 100644 (file)
@@ -17,17 +17,101 @@ function verify_images() {
         }
         });
         }
+<!-- /TMPL_IF -->
+
 $(document).ready(function() {
+<!-- TMPL_IF NAME="AmazonContent" -->
     $('#sortbyform').find("input:submit").hide();
     $('#sort_by').change(function() {
         $('#sortbyform').submit();
     });
+<!-- /TMPL_IF -->
+       $("#z3950searchc").empty();
+       yuiZ3950button();
 });
+
+<!-- TMPL_IF NAME="AmazonContent" -->
 $(window).load(function() {
         verify_images();
      });
-     //]]>
-     </script><!-- /TMPL_IF -->
+<!-- /TMPL_IF -->
+$(document).ready(function() {
+    $("#selection_ops").show();
+    $(".selection").show();
+});
+function selectAll () {
+    $(".selection").attr("checked", "checked");
+}
+function clearAll () {
+    $(".selection").removeAttr("checked");
+}
+function placeHold () {
+    var checkedItems = $(".selection:checked");
+    if ($(checkedItems).size() == 0) {
+        alert(MSG_NO_ITEM_SELECTED);
+        return false;
+    }
+    var bibs = "";
+    var badBibs = false;
+    $(checkedItems).each(function() {
+        var bib = $(this).val();
+        if ($("#reserve_" + bib).size() == 0) {
+            alert(MSG_NON_RESERVES_SELECTED);
+            badBibs = true;
+            return false;
+        }
+        bibs += bib + "/";
+    });
+    if (badBibs) {
+        return false;
+    }
+    $("#hold_form_biblios").val(bibs);
+    $("#hold_form").submit();
+    return false;
+}
+function addToList () {
+    var checkedItems = $(".selection:checked");
+    if ($(checkedItems).size() == 0) {
+        alert(MSG_NO_ITEM_SELECTED);
+        return false;
+    }
+    var bibs = "";
+    $(checkedItems).each(function() {
+        bibs += $(this).val() + "/";
+    });
+
+    var url = "/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumbers=" + bibs;
+       window.open(url, 'Add_to_virtualshelf', 'width=500, height=400, toolbar=false, scrollbars=yes');
+    return false;
+}
+
+/* this function open a popup to search on z3950 server.  */
+function PopupZ3950() {
+    var strQuery = GetZ3950Terms();
+    if(strQuery){
+        window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
+    }
+}
+/* provide Z3950 search points */
+function GetZ3950Terms(){
+       var strQuery="&frameworkcode=";
+       <!-- TMPL_LOOP NAME='z3950_search_params' -->
+               strQuery += "&" + "<!-- TMPL_VAR NAME="name" -->" + "=" + "<!-- TMPL_VAR NAME="encvalue" -->";
+       <!-- /TMPL_LOOP -->
+       return strQuery;
+}
+/* prepare DOM for Z39.50 Search Button */
+function yuiZ3950button() {
+       new YAHOO.widget.Button({
+                       id: "z3950search",
+                       type: "button",
+                       label: _("z39.50 Search"),
+                       container: "z3950searchc",
+                       onclick: {fn:function(){PopupZ3950()}}
+       });
+}
+//]]>
+</script>
 </head>
 <body>
 <!-- TMPL_INCLUDE NAME="header.inc" -->
@@ -59,6 +143,9 @@ $(window).load(function() {
 
     <!-- TMPL_IF NAME="total" -->
         <div id="searchheader">
+                       <form method="post" name="fz3950" class="fz3950">
+                                       <span id="z3950searchc"><input type="button" id="z3950search" value="z39.50 Search" onclick="PopupZ3950(); return false;" /></span>
+                       </form>
             <form action="/cgi-bin/koha/catalogue/search.pl" method="get" id="sortbyform">
                 <!-- TMPL_IF NAME="searchdesc" -->
                     <!-- TMPL_LOOP NAME="QUERY_INPUTS"-->
@@ -82,6 +169,10 @@ $(window).load(function() {
         </div>
     <!-- TMPL_IF NAME="stopwords_removed" --><div><p class="tip">Ignored the following common words: "<!-- TMPL_VAR NAME="stopwords_removed" -->"<p></div><!-- /TMPL_IF -->
     <!-- TMPL_ELSE -->
+        <div id="searchheader">
+                       <form method="post" name="fz3950" class="fz3950bigrpad">
+                               <span id="z3950searchc"><input type="button" id="z3950search" value="z39.50 Search" onclick="PopupZ3950(); return false;" /></span>
+                       </form>
         <!-- TMPL_IF NAME="searchdesc" -->
             <h3>No results found</h3>
             <p>
@@ -93,6 +184,7 @@ $(window).load(function() {
             You did not specify any search criteria.
             </p>
         <!-- /TMPL_IF -->
+               </div>
     <!-- /TMPL_IF -->
     
     <!-- TMPL_IF NAME="query_error" -->
@@ -224,6 +316,10 @@ $(window).load(function() {
                                             <b><!-- TMPL_IF NAME="title" --><!-- TMPL_VAR NAME="title" --><!-- TMPL_ELSE -->No title<!-- /TMPL_IF --></b>
                                         </a> <!-- TMPL_VAR NAME="subtitle" -->
 <!-- TMPL_IF name="volume" -->,<!-- TMPL_VAR name="volume" --><!-- /TMPL_IF --> <!-- TMPL_IF name="volumeddesc" -->, <!-- TMPL_VAR name="volumeddesc" --><!-- /TMPL_IF -->
+                                    <!-- TMPL_ELSIF NAME="BiblioDefaultViewlabeled_marc" -->
+                                            <a class="title" href="/cgi-bin/koha/catalogue/labeledMARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
+                                                <!-- TMPL_VAR NAME="title" --> 
+                                            </a> <!-- TMPL_VAR NAME="subtitle" --><!-- TMPL_IF name="volume" -->,<!-- TMPL_VAR name="volume" --><!-- /TMPL_IF --> <!-- TMPL_IF name="volumeddesc" -->, <!-- TMPL_VAR name="volumeddesc" --><!-- /TMPL_IF -->
                                     <!-- TMPL_ELSIF NAME="BiblioDefaultViewisbd" -->
                                             <a class="title" href="/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->">
                                                 <!-- TMPL_IF NAME="title" --><!-- TMPL_VAR NAME="title" --><!-- TMPL_ELSE -->No title<!-- /TMPL_IF -->
@@ -262,6 +358,7 @@ $(window).load(function() {
                                         <!-- /TMPL_IF -->
                                         
                                         <!-- TMPL_IF name="publishercode" --><!-- TMPL_VAR name="publishercode" --><!-- /TMPL_IF -->
+                                                                               <!-- TMPL_IF NAME="edition" -->Edition: <!-- TMPL_VAR NAME="edition" --><!-- /TMPL_IF -->
                                         Description: 
                                         <!-- TMPL_IF name="place" --> ; <!-- TMPL_VAR name="place" --><!-- /TMPL_IF -->
                                                                                <!-- TMPL_IF name="publicationyear" -->, <!-- TMPL_VAR name="publicationyear" -->
index e5d7af8..ed5bd42 100644 (file)
@@ -62,6 +62,8 @@
                        <!-- 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 -->
             <tr>
                 <th>Title</th>
                 <th>ISBN</th>
+                <th>Date</th>
+                <th>Edition</th>
                 <th>coming from</th>
                 <th>preview</th>
                 <th>&nbsp;</th>
                 <td><!-- TMPL_VAR NAME="title" escape="html" -->
                 <!-- 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>
index 0f65e5f..bd68d41 100644 (file)
@@ -94,6 +94,8 @@ $(document).ready(function(){
         <th>Server</th>
         <th>Title</th>
         <th>Author</th>
+        <th>Date</th>
+        <th>Edition</th>
         <th>ISBN</th>
         <th>LCCN</th>
         <th colspan="2">Preview</th>
@@ -110,6 +112,8 @@ $(document).ready(function(){
             <td><!-- TMPL_VAR name="server" --></td>
             <td><!-- TMPL_VAR NAME="title" escape="html" --></td>
             <td><!-- TMPL_VAR NAME="author" --></td>
+            <td><!-- TMPL_VAR NAME="date" --></td>
+            <td><!-- TMPL_VAR NAME="edition" --></td>
             <td><!-- TMPL_VAR NAME="isbn" --></td>
             <td><!-- TMPL_VAR NAME="lccn" --></td>
             <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=<!-- TMPL_VAR NAME="breedingid" -->" title="MARC" rel="gb_page_center[600,500]">MARC</a></td><td><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=<!-- TMPL_VAR NAME="breedingid" -->" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
index f14df3f..8c86f77 100755 (executable)
@@ -40,6 +40,7 @@ use C4::Koha;
 use C4::Circulation;
 use C4::Dates qw/format_date/;
 use C4::Members;
+use C4::Search;                # enabled_staff_search_views
 
 my $dbh = C4::Context->dbh;
 my $sth;
index e3bdc73..a08c73f 100755 (executable)
@@ -30,6 +30,7 @@ use C4::Items;
 use C4::Branch;
 use C4::Debug;
 # use Data::Dumper;
+use C4::Search;                # enabled_staff_search_views
 
 use vars qw($debug $cgi_debug);
 
@@ -98,6 +99,7 @@ $template->param(
        DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
                      dateformat => C4::Dates->new()->format(),
                                       debug => $debug,
+       C4::Search::enabled_staff_search_views,
 );
 #
 #### This code was never really used - maybe some day some will fix it ###