[Koha-patches] [PATCH] Bug 8893 - show more information on printout

Owen Leonard oleonard at myacpl.org
Thu Oct 25 17:53:14 CEST 2012


My proposed solution eliminates the special print view
page altogether and has the Print button trigger the
browser's print function. I've tweaked the print stylesheet
to improve the output.

Normally I don't think print buttons in the interface
are necessary, since a user could be expected to be able
to print the page using browser controls. But I think it's
best not to remove the button when people are used to seeing
it.

The behavior people will find now is different when clicking
the button from different catalogue pages. A user on the MARC
detail page, instead of getting the generic print view will
get a print of the page they're on. Overall I think this
is more in line with what a user would expect.
---
 catalogue/detailprint.pl                           |   96 --------------------
 koha-tmpl/intranet-tmpl/prog/en/css/print.css      |   25 +++--
 .../intranet-tmpl/prog/en/includes/cat-toolbar.inc |    3 +-
 .../prog/en/modules/catalogue/detailprint.tt       |   54 -----------
 4 files changed, 16 insertions(+), 162 deletions(-)
 delete mode 100755 catalogue/detailprint.pl
 delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detailprint.tt

diff --git a/catalogue/detailprint.pl b/catalogue/detailprint.pl
deleted file mode 100755
index fe92fe5..0000000
--- a/catalogue/detailprint.pl
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/perl
-
-# 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.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-use strict;
-#use warnings; FIXME - Bug 2505
-
-use C4::Context;
-use CGI;
-use C4::Auth;
-use C4::Biblio;
-use C4::Items;
-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->{'additional'} = "";
-foreach (@$addauthor) {
-    $dat->{'additional'} .= "|" . $_->{'a'};
-}    # for
-
-$dat->{'count'}      = @items;
-$dat->{'norequests'} = $norequests;
-
-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   => ('catalogue/detailprint.tmpl'),
-        query           => $query,
-        type            => "intranet",
-        authnotrequired => ( $type eq 'opac' ),
-        flagsrequired   => { catalogue => 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;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/print.css b/koha-tmpl/intranet-tmpl/prog/en/css/print.css
index 955b68b..239059c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/css/print.css
+++ b/koha-tmpl/intranet-tmpl/prog/en/css/print.css
@@ -286,25 +286,30 @@ td.debit {
 	text-align : left;
 	}
 
-div#breadcrumbs,
-div#toplevelnav,
-div#login,
-div#header_search,
-div#toolbar,
-div#changelanguage,
-div#menu,
+#breadcrumbs,
+#toplevelnav,
+#login,
+#header,
+#header_search,
+#toolbar,
+#changelanguage,
+#menu,
+.gradient,
 div.yui-b,
 .noprint,
 form#sortbyform,
 #cartDetails,
 fieldset.action,
 .list-actions,
-.print {
+.print,
+.ui-tabs-nav {
     display: none;
 }
 
-div#yui-main div.yui-b {
-	display : block;
+div#yui-main div.yui-b,
+.ui-tabs .ui-tabs-panel,
+.ui-tabs .ui-tabs-hide {
+    display : block !important;
 }
 
 .yui-t1 #yui-main div.yui-b,
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc
index 740a3b5..413527a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc
@@ -23,8 +23,7 @@
 	function addToCart() { addRecord('[% biblionumber %]'); }
 	function addToShelf() {	window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=[% biblionumber %]','Add_to_virtualshelf','width=500,height=400,toolbar=false,scrollbars=yes');
 	}
-	function printBiblio() {window.open('/cgi-bin/koha/catalogue/detailprint.pl?biblionumber=[% biblionumber %]','Print_Biblio','width=700,height=500,toolbar=false,scrollbars=yes');
-	}
+    function printBiblio() {window.print(); }
 [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
 function confirm_deletion() {
 		var count = [% count %];
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detailprint.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detailprint.tt
deleted file mode 100644
index 3f4312a..0000000
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detailprint.tt
+++ /dev/null
@@ -1,54 +0,0 @@
-[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Catalog &rsaquo; Details for [% title |html %]</title>
-[% INCLUDE 'doc-head-close.inc' %]
-<link rel="stylesheet" href="[% themelang %]/css/print.css" type="text/css" />
-</head>
-
-<body id="catalog_detailprint" class="catalog">
-
-<!-- main site -->
-<div id="main">
-[% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]
-	<table class="list">
-	<caption>[% BIBLIO_RESULT.title |html %] [% BIBLIO_RESULT.subtitle %]</caption>
-    <tr><th>Biblio record number: </th><td> [% BIBLIO_RESULT.biblionumber %]	</td></tr>
-[% IF ( BIBLIO_RESULT.author ) %]<tr><th>Author: </th><td>[% BIBLIO_RESULT.author %]</td></tr>[% END %]
-[% IF ( BIBLIO_RESULT.additional ) %]<tr><th>Additional author: </th><td>[% BIBLIO_RESULT.additional %]</td></tr>[% END %]
-[% IF ( BIBLIO_RESULT.publishercode ) %]<tr><th>Publisher: </th><td>[% BIBLIO_RESULT.publishercode %]</td></tr>[% END %]
-<tr><th>Publication details: </th><td>			[% IF ( BIBLIO_RESULT.publicationyear ) %][% BIBLIO_RESULT.publicationyear %][% END %]
-			[% IF ( BIBLIO_RESULT.pages ) %], [% END %][% BIBLIO_RESULT.pages %]
-			[% IF ( BIBLIO_RESULT.size ) %], [% END %][% BIBLIO_RESULT.size %]</td></tr>
-			[% IF ( BIBLIO_RESULT.collection ) %]<tr><th>Collection:</th><td> [% BIBLIO_RESULT.seriestitle %]</td></tr>[% END %]
-			[% IF ( BIBLIO_RESULT.subject ) %]<tr><th>Subject: </th><td>[% BIBLIO_RESULT.subject %]</td></tr>[% END %]
-            [% IF ( BIBLIO_RESULT.copyrightdate ) %]<tr><th>Copyright date: </th><td> [% BIBLIO_RESULT.copyrightdate %]</td></tr>[% END %]
-			[% IF ( BIBLIO_RESULT.notes ) %]<tr><th>Notes: </th><td>[% BIBLIO_RESULT.notes %]</td></tr>[% END %]
-			[% IF ( BIBLIO_RESULT.unititle ) %]<tr><th>Unititle: </th><td>[% BIBLIO_RESULT.unititle %]</td></tr>[% END %]
-			[% IF ( BIBLIO_RESULT.dewey ) %]<tr><th>Dewey: </th><td>[% BIBLIO_RESULT.dewey %]</td></tr>[% END %]
-			[% IF ( BIBLIO_RESULT.classification ) %]<tr><th>Classification: </th><td> [% BIBLIO_RESULT.classification %]</td></tr>[% END %]
-			[% IF ( BIBLIO_RESULT.lccn ) %]<tr><th>LCCN: </th><td>[% BIBLIO_RESULT.lccn %]</td></tr>[% END %]
-            [% IF ( BIBLIO_RESULT.url ) %]<tr><th>URL: </th><td><a href="[% BIBLIO_RESULT.url %]">[% BIBLIO_RESULT.url %]</a></td></tr>[% END %]
-			[% IF ( BIBLIO_RESULT.ISBN ) %]<tr><th>ISBN: </th><td>[% BIBLIO_RESULT.ISBN %]</td></tr>[% END %]
-	</table>
-[% END %]
-
-<table>
-    <tr><th>Item type</th><th>Call number</th><th>Location</th><th>Date due</th><th>Last seen</th><th>Barcode</th></tr>
-	[% FOREACH ITEM_RESULT IN ITEM_RESULTS %]
-		<tr>
-			<td>[% ITEM_RESULT.description %]</td>
-			<td>[% ITEM_RESULT.itemcallnumber %]</td>
-			<td>[% ITEM_RESULT.branchname %][% IF ( ITEM_RESULT.bulk ) %], [% ITEM_RESULT.bulk %][% ELSE %]&nbsp;[% END %]</td>
-			<td>[% ITEM_RESULT.datedue %]</td>
-			<td>[% ITEM_RESULT.datelastseen %]</td>
-			<td>[% ITEM_RESULT.barcode %]</td>
-		</tr>
-	[% END %]
-</table>
-<script type="text/javascript">
-//<![CDATA[
-    $(document).ready(function() {
-    	window.print();
-    });
-//]]>
-</script>
-[% INCLUDE 'intranet-bottom.inc' %]
-- 
1.7.9.5


More information about the Koha-patches mailing list