[Koha-patches] [biblibre-integration 13/19] (bug #3554) use javascript to print records

Henri-Damien LAURENT henridamien.laurent at biblibre.com
Fri Aug 28 23:47:48 CEST 2009


From: Nahuel ANGELINETTI <nahuel.angelinetti at biblibre.com>

This patch, delete opac-detailprint.pl to print records, it only use CSS and javascript print() function.
---
 .../opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl |    4 +-
 .../opac-tmpl/prog/en/modules/opac-detail.tmpl     |    4 +-
 .../prog/en/modules/opac-detailprint.tmpl          |   91 ------------------
 opac/opac-detailprint.pl                           |   99 --------------------
 4 files changed, 2 insertions(+), 196 deletions(-)
 delete mode 100644 koha-tmpl/opac-tmpl/prog/en/modules/opac-detailprint.tmpl
 delete mode 100755 opac/opac-detailprint.pl

diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl
index 755c864..d9a4838 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl
@@ -175,9 +175,7 @@
 	<!-- /TMPL_IF -->
     <!-- /TMPL_UNLESS -->
 <!-- /TMPL_UNLESS -->
-        <li><a class="print" href="/cgi-bin/koha/opac-detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" onclick="Dopop('opac-detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">
-            Print
-        </a></li>
+        <li><a class="print" href="javascript:window.print();">Print</a></li>
 <!-- TMPL_IF name="virtualshelves" -->
    <!-- TMPL_IF NAME="opacuserlogin" --> <!-- TMPL_IF NAME="loggedinusername" -->
         <li><a class="addtoshelf" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
index 574d099..e85e3dc 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
@@ -749,9 +749,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
 	<!-- /TMPL_IF -->
     <!-- /TMPL_UNLESS -->
 <!-- /TMPL_UNLESS -->
-        <li><a class="print" href="/cgi-bin/koha/opac-detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" onclick="Dopop('opac-detailprint.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">
-            Print
-        </a></li>
+        <li><a class="print" href="javascript:window.print();">Print</a></li>
 <!-- TMPL_IF name="virtualshelves" -->
     <!-- TMPL_IF NAME="opacuserlogin" --><!-- TMPL_IF NAME="loggedinusername" -->
         <li><a class="addtoshelf" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detailprint.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detailprint.tmpl
deleted file mode 100644
index e7aa179..0000000
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detailprint.tmpl
+++ /dev/null
@@ -1,91 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><!-- TMPL_IF NAME="LibraryNameTitle" --><!-- TMPL_VAR NAME="LibraryNameTitle" --><!-- TMPL_ELSE -->Koha Online<!-- /TMPL_IF --> Catalog &rsaquo;  Details for: <!-- TMPL_LOOP NAME="BIBLIO_RESULTS" --><!-- TMPL_VAR NAME="title" escape="html" --><!-- /TMPL_LOOP -->
-</title>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<link rel="shortcut icon" href="<!-- TMPL_VAR NAME="themelang" -->/includes/favicon.ico" type="image/x-icon" />
-<meta http-equiv="Content-Language" content="en-us" />
-<style type="text/css"> 
-    @import url(<!-- TMPL_VAR NAME="themelang" -->/css/print.css);
-</style>
-</head>
-<body>
-<div id="window">
-<!-- TMPL_LOOP NAME="BIBLIO_RESULTS" -->
-<h2><!-- TMPL_VAR NAME="title" escape="html" --> <!-- TMPL_IF NAME="subtitle" -->: <!-- TMPL_VAR NAME="subtitle" --><!-- /TMPL_IF -->
-<!-- TMPL_IF NAME="author" -->; By <!-- TMPL_VAR NAME="author" --></h2><!-- /TMPL_IF --> 
-
-<table>
-
-<!-- TMPL_IF NAME="abstract" --><tr><th scope="row">Format:</th><td><!-- TMPL_VAR NAME="abstract" --></td></tr><!-- /TMPL_IF -->
-<!-- TMPL_IF NAME="copyrightdate" -->
-    <tr><th scope="row">Copyright:</th><td><!-- TMPL_VAR NAME="copyrightdate" --></td></tr>
-<!-- /TMPL_IF -->
-<!-- TMPL_IF NAME="isbn" -->
-	    <tr><th scope="row">ISBN:</th><td><!-- TMPL_VAR NAME="isbn" --></td></tr>
-<!-- /TMPL_IF -->
-<!-- TMPL_IF NAME="lccn" -->
-	    <tr><th scope="row">LCCN:</th><td><!-- TMPL_VAR NAME="lccn" --></td></tr>
-<!-- /TMPL_IF -->
-<!-- TMPL_IF NAME="publishercode" -->
-	    <tr><th scope="row">Publisher:</th><td><!-- TMPL_VAR NAME="place" --> <!-- TMPL_VAR NAME="publishercode" --> <!-- TMPL_VAR NAME="publicationyear" --></td></tr>
-<!-- /TMPL_IF -->
-<!-- TMPL_IF NAME="pages" -->
-	<tr><th scope="row">Physical Details: </th><td><!-- TMPL_VAR NAME="pages" --> <!-- TMPL_VAR NAME="illus" --> <!-- TMPL_VAR NAME="size" --></td></tr>
-<!-- /TMPL_IF -->
-<!-- TMPL_IF NAME="notes" -->
-<tr><th scope="row">Notes:</th><td><!-- TMPL_VAR NAME="notes" --></td></tr>
-	<!-- /TMPL_IF -->
-	<!-- /TMPL_LOOP -->
-	
-<!-- TMPL_UNLESS NAME="MARCSUBJCTS" -->
-<!-- TMPL_LOOP NAME="BIBLIO_RESULTS" -->
-<!-- TMPL_IF name="subjects" --><tr><th scope="row">Subject(s):</th><td><!-- TMPL_LOOP name="subjects" --><a href="/cgi-bin/koha/opac-search.pl?op=do_search&amp;marclist=bibliosubject.subject&amp;and_or=and&amp;operator=contains&amp;value=<!-- TMPL_VAR NAME="subject" escape="HTML"-->"><!-- TMPL_VAR NAME="subject" --></a>, <!-- /TMPL_LOOP --></td></tr><!-- /TMPL_IF -->
-<!-- /TMPL_LOOP -->
-<!-- /TMPL_UNLESS -->
-
-<!-- TMPL_LOOP NAME="BIBLIO_RESULTS" -->
- <tr><th scope="row">Record No.:</th><td><!-- TMPL_VAR NAME="biblionumber" --></td></tr> <!-- /TMPL_LOOP -->
-
-<!-- TMPL_IF NAME="MARCNOTES" -->
-		<tr>
-			<th scope="row">Detailed notes:</th>
-			<td><ul><!-- TMPL_LOOP NAME="MARCNOTES" --><li><!-- TMPL_VAR NAME="marcnote" --></li><!-- /TMPL_LOOP --></ul></td></tr>
-	<!-- /TMPL_IF -->
-		<!-- TMPL_IF NAME="MARCSUBJCTS" -->
-		<tr>
-			<th scope="row">Related links:</th>
-			<td><ul><!-- TMPL_LOOP NAME="MARCSUBJCTS" --><li><a href="/cgi-bin/koha/opac-search.pl?op=do_search&marclist=bibliosubject.subject&and_or=and&operator=contains&value=<!-- TMPL_VAR NAME="marcsubjct" escape="HTML"-->"><!-- TMPL_VAR NAME="marcsubjct" --></a></li><!-- /TMPL_LOOP --></ul></td></tr>
-	<!-- /TMPL_IF -->
-</table>
-
-<!-- TMPL_IF NAME="ITEM_RESULTS" -->
-<table>
-<!--HOLDINGS INFORMATION HEADER TABLE ROWS-->
-<tr>
-<th>Type/Format</th>
-<th>Call Number</th>
-<th>Location</th>
-<th>Due Date</th>
-<th>Last Seen</th>
-<th>Barcode</th></tr>
-<!--INFORMATION ROWS-->
-<!-- TMPL_LOOP NAME="ITEM_RESULTS" -->
-<tr><td><img src="<!-- TMPL_VAR NAME="themelang" -->/images/<!-- TMPL_VAR NAME="description" -->.gif" align="left" title="<!-- TMPL_VAR NAME="barcode" -->" alt="" /><!-- TMPL_VAR NAME="description" --></td>
-<td><!-- TMPL_VAR NAME="itemcallnumber" --></td>
-<td><!-- TMPL_VAR NAME="branchname" --></td>
-<td><!-- TMPL_VAR NAME="datedue" --></td>
-<td><!-- TMPL_VAR NAME="datelastseen" --></td>
-<td><!-- TMPL_VAR NAME="barcode" --></td></tr>
-<!-- /TMPL_LOOP -->
-</table>
-<!-- TMPL_ELSE -->
-<table><tr><td>No copies available.</td></tr></table>
-<!-- /TMPL_IF -->
-</div>
-<script language="javascript" type="text/javascript">
-function docprint() {
-	window.print();
-	window.close();
-}
-</script>
-</body>
-</html>
diff --git a/opac/opac-detailprint.pl b/opac/opac-detailprint.pl
deleted file mode 100755
index 8d11cfc..0000000
--- a/opac/opac-detailprint.pl
+++ /dev/null
@@ -1,99 +0,0 @@
-#!/usr/bin/perl
-# NOTE: Use standard 8-space tabs for this file (indents are 4 spaces)
-
-# Copyright 2000-2002 Katipo Communications
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-use strict;
-use C4::Context;
-use CGI;
-use C4::Biblio;
-use C4::Items;
-use C4::Auth;
-use C4::Output;
-use C4::Dates;
-
-my $query = new CGI;
-my $type  = $query->param('type');
-($type) || ( $type = 'intra' );
-
-my $biblionumber = $query->param('biblionumber');
-
-# change back when ive fixed request.pl
-my @items      = GetItemsInfo($biblionumber);
-my $norequests = 1;
-foreach my $itm (@items) {
-    $norequests = 0 unless $itm->{'notforloan'};
-}
-
-my $dat       = GetBiblioData($biblionumber);
-my $record    = GetMarcBiblio($biblionumber);
-my $addauthor =
-  GetMarcAuthors( $record, C4::Context->preference("marcflavour") );
-my $authorcount = scalar @$addauthor;
-
-$dat->{'count'}      = @items;
-$dat->{'norequests'} = $norequests;
-
-$dat->{'additional'} = "";
-foreach (@$addauthor) {
-    $dat->{'additional'} .= "|" . $_->{'value'};
-}    # for
-
-my @results;
-
-$results[0] = $dat;
-
-my $resultsarray = \@results;
-my $itemsarray   = \@items;
-
-my $startfrom = $query->param('startfrom');
-($startfrom) || ( $startfrom = 0 );
-
-my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
-    {
-        template_name   => ('opac-detailprint.tmpl'),
-        query           => $query,
-        type            => "opac",
-        authnotrequired => 1,
-    }
-);
-
-my $count = 1;
-
-# now to get the items into a hash we can use and whack that thru
-
-my $nextstartfrom =
-  ( $startfrom + 20 < $count - 20 ) ? ( $startfrom + 20 ) : ( $count - 20 );
-my $prevstartfrom = ( $startfrom - 20 > 0 ) ? ( $startfrom - 20 ) : (0);
-$template->param(
-    startfrom      => $startfrom + 1,
-    endat          => $startfrom + 20,
-    numrecords     => $count,
-    nextstartfrom  => $nextstartfrom,
-    prevstartfrom  => $prevstartfrom,
-    BIBLIO_RESULTS => $resultsarray,
-    ITEM_RESULTS   => $itemsarray,
-    loggedinuser   => $loggedinuser,
-    biblionumber   => $biblionumber,
-);
-
-output_html_with_http_headers $query, $cookie, $template->output;
-
-# Local Variables:
-# tab-width: 8
-# End:
-- 
1.6.0.4




More information about the Koha-patches mailing list