[Koha-patches] [PATCH] Add embedded Z39.50 search to cataloguing homepage

Jesse pianohacker at gmail.com
Thu Aug 11 08:55:07 CEST 2011


This was an accidental send without a bug, due to my derp moment with
git-send-email. Feel free to ignore.

2011/8/11 Jesse Weaver <pianohacker at gmail.com>

> Also, make some minor changes to search interface to improve usability in
> cramped space.
> ---
>  cataloguing/z3950_search.pl                        |   12 +++++++++-
>  .../prog/en/modules/cataloguing/addbooks.tt        |    2 +
>  .../prog/en/modules/cataloguing/z3950_search.tt    |   23
> +++++++++++--------
>  3 files changed, 26 insertions(+), 11 deletions(-)
>
> diff --git a/cataloguing/z3950_search.pl b/cataloguing/z3950_search.pl
> index b12a9c9..cf444f1 100755
> --- a/cataloguing/z3950_search.pl
> +++ b/cataloguing/z3950_search.pl
> @@ -215,6 +215,9 @@ warn "query ".$query  if $DEBUG;
>         last if $event == ZOOM::Event::ZEND;
>     }
>
> +    my $edition_empty = 1;
> +    my $lccn_empty = 1;
> +
>     if ( $k != 0 ) {
>         $k--;
>         warn $serverhost[$k] if $DEBUG;
> @@ -259,9 +262,13 @@ warn "query ".$query  if $DEBUG;
>                             $imported,      $breedingid
>                           )
>                           = ImportBreeding( $marcdata, 2, $serverhost[$k],
> $encoding[$k], $random, 'z3950' );
> +
> +                        $lccn_empty = 0 if ( $oldbiblio->{lccn} );
> +                        $edition_empty = 0 if (
> $oldbiblio->{editionstatement} );
> +
>                         my %row_data;
>                         $row_data{server}       = $servername[$k];
> -                        $row_data{isbn}         = $oldbiblio->{isbn};
> +                        $row_data{isbn}         = [ map( +{ value => $_ },
> split( /\|/, $oldbiblio->{isbn} ) ) ];
>                         $row_data{lccn}         = $oldbiblio->{lccn};
>                         $row_data{title}        = $oldbiblio->{title};
>                         $row_data{author}       = $oldbiblio->{author};
> @@ -281,6 +288,9 @@ warn "query ".$query  if $DEBUG;
>     $numberpending = $nremaining - 1;
>     $template->param(
>         breeding_loop => \@breeding_loop,
> +        lccn_empty    => $lccn_empty,
> +        edition_empty => $edition_empty,
> +        column_backshift => ($lccn_empty ? 1 : 0) + ($edition_empty ? 1 :
> 0) + 0,
>         server        => $servername[$k],
>         numberpending => $numberpending,
>         biblionumber  => $biblionumber,
> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/
> addbooks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/
> addbooks.tt
> index a5e2a96..1e933b5 100644
> --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt
> +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt
> @@ -111,6 +111,8 @@
>             Error: <span class="error">[% error %]</span></div>
>         [% END %]
>     [% END %]
> +    <iframe src="/cgi-bin/koha/cataloguing/z3950_search.pl"
> id="embedded_z3950">
> +    </iframe>
>  [% END %]
>
>  [% IF ( query ) %]
> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/
> z3950_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/
> z3950_search.tt
> index 5adc074..010df7e 100644
> --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt
> +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt
> @@ -7,7 +7,7 @@
>  <script type="text/javascript">
>  //<![CDATA[
>  function Import(GetThisOne,biblionumber) {
> -    opener.document.location="../cataloguing/addbiblio.pl?biblionumber="+biblionumber+"&z3950=1&frameworkcode=[%
> frameworkcode %]&breedingid="+GetThisOne;
> +    (opener||parent).document.location="../cataloguing/
> addbiblio.pl?biblionumber="+biblionumber+"&z3950=1&frameworkcode=[%
> frameworkcode %]&breedingid="+GetThisOne;
>     window.close();
>     return false;
>  }
> @@ -32,9 +32,12 @@ $(document).ready(function(){
>         $(".checkboxed").unCheckCheckboxes();
>         return false;
>     });
> +
> +    var headers = { 1: { sorter: 'articles' } }
> +    headers[7 - [% column_backshift %]] = headers[8 - [% column_backshift
> %]] = { 'sorter': false };
>     $("#resultst").tablesorter({
>         sortList: [[1,0]],
> -        headers: { 1: { sorter: 'articles' },7: { sorter: false },8: {
> sorter: false } },
> +        headers: headers,
>         widgets: ['zebra']
>     });
>         /* Inline edit/delete links */
> @@ -43,7 +46,7 @@ $(document).ready(function(){
>             var row = $(this).parent();
>             $(".linktools").hide();
>             $("tr").removeClass("selected");
> -            if($tgt.is("a")||$tgt.is(":nth-child(7)")||$tgt.is
> (":nth-child(8)")||$tgt.is(":nth-child(9)")||$tgt.is(":nth-child(10)")){
> +            if($tgt.is("a")||$tgt.is(".tool")){
>                 return true;
>             } else {
>                 var position = $(this).offset();
> @@ -136,9 +139,9 @@ tr.selected { background-color : #FFFFCC; } tr.selected
> td { background-color :
>         <th>Title</th>
>         <th>Author</th>
>         <th>Date</th>
> -        <th>Edition</th>
> +        [% UNLESS ( edition_empty ) %]<th>Edition</th>[% END %]
>         <th>ISBN</th>
> -        <th>LCCN</th>
> +        [% UNLESS ( lccn_empty ) %]<th>LCCN</th>[% END %]
>         <th colspan="2">Preview</th>
>                <th>&nbsp;</th>
>     </tr></thead>
> @@ -150,12 +153,12 @@ tr.selected { background-color : #FFFFCC; }
> tr.selected td { background-color :
>             <td>[% breeding_loo.title |html %]</td>
>             <td>[% breeding_loo.author %]</td>
>             <td>[% breeding_loo.date %]</td>
> -            <td>[% breeding_loo.edition %]</td>
> -            <td>[% breeding_loo.isbn %]</td>
> +            [% UNLESS ( edition_empty ) %]<td>[% breeding_loo.edition
> %]</td>[% END %]
> +            [% UNLESS ( isbn_empty ) %]<td>[% breeding_loo.isbn %]</td>[%
> END %]
>             <td>[% breeding_loo.lccn %]</td>
> -            <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[%breeding_loo.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=[% breeding_loo.breedingid %]"
> title="MARC" rel="gb_page_center[600,500]">Card</a></td>
> -            <td><a href="#" onclick="Import([% breeding_loo.breedingid
> %],[% breeding_loo.biblionumber %]); return false">Import</a></td>
> +            <td class="tool"><a href="/cgi-bin/koha/catalogue/
> showmarc.pl?importid=[% breeding_loo.breedingid %]" title="MARC"
> rel="gb_page_center[600,500]">MARC</a></td>
> +            <td class="tool"><a href="/cgi-bin/koha/catalogue/
> showmarc.pl?viewas=card&amp;importid=[% breeding_loo.breedingid %]"
> title="MARC" rel="gb_page_center[600,500]">Card</a></td>
> +            <td class="tool"><a href="#" onclick="Import([%
> breeding_loo.breedingid %],[% breeding_loo.biblionumber %]); return
> false">Import</a></td>
>         </tr>
>         [% END %]
>     [% END %]</tbody>
> --
> 1.7.6
>
>


-- 
Jesse Weaver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-patches/attachments/20110811/644ca53f/attachment.htm>


More information about the Koha-patches mailing list