[Patches] [PATCH] Bug 1633 - Interface revisions for the staff client

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Wed Dec 21 03:11:53 NZDT 2011


From: Owen Leonard <oleonard at myacpl.org>
Date: Tue, 13 Dec 2011 14:19:29 -0500
Subject: [PATCH] Bug 1633 - Interface revisions for the staff client
Content-Type: text/plain; charset="UTF-8"

This patch revises the image viewer page to match other
biblio detail pages: a toolbar, a sidebar menu, etc.

Additional data is now pulled by imageviewer.pl in order
to provide information necessary for the proper functioning
of the toolbar and menus: item counts, hold availability,
biblio view options.

Other changes have been made to match the changes in the
OPAC interface like styling of the images and no-javascript
compatibility

Signed-off-by: Jared Camins-Esakov <jcamins at cpbibliography.com>
---
 catalogue/image.pl                                 |    2 +-
 catalogue/imageviewer.pl                           |   30 ++++++-
 .../intranet-tmpl/prog/en/css/staff-global.css     |    9 +-
 .../prog/en/includes/biblio-view-menu.inc          |    2 +-
 .../prog/en/modules/catalogue/detail.tt            |    8 +-
 .../prog/en/modules/catalogue/imageviewer.tt       |  102 ++++++++++++++++----
 6 files changed, 121 insertions(+), 32 deletions(-)

diff --git a/catalogue/image.pl b/catalogue/image.pl
index 17621d7..13b2b4e 100755
--- a/catalogue/image.pl
+++ b/catalogue/image.pl
@@ -29,7 +29,7 @@ use C4::Images;
 
 $|=1;
 
-my $DEBUG = 1;
+my $DEBUG = 0;
 my $data = new CGI;
 my $imagenumber;
 
diff --git a/catalogue/imageviewer.pl b/catalogue/imageviewer.pl
index 395e4b7..caa793e 100755
--- a/catalogue/imageviewer.pl
+++ b/catalogue/imageviewer.pl
@@ -23,8 +23,10 @@ use warnings;
 use CGI;
 use C4::Auth;
 use C4::Biblio;
+use C4::Items;
 use C4::Output;
 use C4::Images;
+use C4::Search;
 
 my $query = new CGI;
 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
@@ -38,14 +40,38 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
 );
 
 my $biblionumber = $query->param('biblionumber') || $query->param('bib');
+my $imagenumber = $query ->param('imagenumber');
 my ($count, $biblio) = GetBiblio($biblionumber);
+my $itemcount = GetItemsCount($biblionumber);
+
+my @items = GetItemsInfo( $biblionumber );
+
+my $norequests = 1;
+foreach my $item (@items) {
+    # can place holds defaults to yes
+    $norequests = 0 unless ( ( $item->{'notforloan_per_itemtype'} > 0 ) || ( $item->{'itemnotforloan'} > 0 ) );
+}
+
+if($query->cookie("holdfor")){
+    my $holdfor_patron = GetMember('borrowernumber' => $query->cookie("holdfor"));
+    $template->param(
+        holdfor => $query->cookie("holdfor"),
+        holdfor_surname => $holdfor_patron->{'surname'},
+        holdfor_firstname => $holdfor_patron->{'firstname'},
+        holdfor_cardnumber => $holdfor_patron->{'cardnumber'},
+    );
+}
 
 if (C4::Context->preference("LocalCoverImages")) {
     my @images = ListImagesForBiblio($biblionumber);
     $template->{VARS}->{'LocalCoverImages'} = 1;
     $template->{VARS}->{'images'} = \@images;
+    $template->{VARS}->{'imagenumber'} = $imagenumber || $images[0] || '';
 }
-
-$template->{VARS}->{'biblio'} = $biblio;
+    $template->{VARS}->{'count'} = $itemcount;
+    $template->{VARS}->{'biblionumber'} = $biblionumber;
+    $template->{VARS}->{'norequests'} = $norequests;
+    $template->param( C4::Search::enabled_staff_search_views );
+    $template->{VARS}->{'biblio'} = $biblio;
 
 output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
index 30334ef..4d18ac6 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
+++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
@@ -2133,6 +2133,9 @@ div.pager input.pagedisplay {
 	font-weight: bold;
 	text-align : center;
 }
-.localimage {
-    padding: .3em;
-}
+
+a.localimage img {
+	border : 1px solid #0000CC;
+	margin : 0 .5em;
+	padding : .3em;
+}
\ No newline at end of file
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc
index a944dc5..903cf3a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc
@@ -23,7 +23,7 @@
     [% IF ( CAN_user_reserveforothers ) %]
     [% IF ( holdsview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% IF ( object ) %][% object %][% ELSE %][% biblionumber %][% END %]">Holds</a></li>
     [% END %]
-    [% IF ( EasyAnalyticalRecords ) %][% IF ( analyze ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% IF ( object ) %][% object %]&analyze=1[% ELSE %][% biblionumber %]&analyze=1[% END %]">Analytics</a></li>[% END %]
+    [% IF ( EasyAnalyticalRecords ) %][% IF ( analyze ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% IF ( object ) %][% object %]&analyze=1[% ELSE %][% biblionumber %]&analyze=1[% END %]">Analytics</a></li>[% END %]
 
     [% IF ( subscriptionsnumber ) %]<li><a href="/cgi-bin/koha/serials/serials-home.pl?searched=1&biblionumber=[% biblionumber %]">Subscription(s)</a></li>[% END %]
 </ul>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
index f9aff7f..4e9cd7c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
@@ -510,7 +510,7 @@ function verify_images() {
 <ul>
 [% FOREACH AMAZON_SIMILAR_PRODUCT IN AMAZON_SIMILAR_PRODUCTS %]
 [% FOREACH similar_biblionumber IN AMAZON_SIMILAR_PRODUCT.similar_biblionumbers %]
-<li><img alt="img" src="http://images.amazon.com/images/P/[% similar_biblionumber.ASIN %].01._SS50_.jpg" /> <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% similar_biblionumber.biblionumber %]">[% similar_biblionumber.title |html %]</a> </li>
+<li><img alt="" src="http://images.amazon.com/images/P/[% similar_biblionumber.ASIN %].01._SS50_.jpg" /> <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% similar_biblionumber.biblionumber %]">[% similar_biblionumber.title |html %]</a> </li>
 [% END %]
 [% END %]
 </ul>
@@ -520,15 +520,15 @@ function verify_images() {
 [% IF ( LocalCoverImages ) %]
 <div id="images">
 [% IF ( localimages ) %]
-<div>Click on an image to view it in the image viewer</div>
+<p>Click on an image to view it in the image viewer</p>
 [% FOREACH image IN localimages %]
 [% IF image %]
-<span class="localimage"><a href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber %]&imagenumber=[% image %]"><img alt="img" src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&imagenumber=[% image %]" /></a></span>
+<a class="localimage" href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber %]&imagenumber=[% image %]"><img alt="" src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&imagenumber=[% image %]" /></a>
 [% END %]
 [% END %]
 [% ELSE %]
 [% IF ( CAN_user_tools_upload_local_cover_images ) %]
-<p>No images have been uploaded for this bibliographic record yet. Please <a href='/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=[% biblionumber %]&filetype=image'>upload</a> one.</p>
+<p>No images have been uploaded for this bibliographic record yet. Please <a href='/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=[% biblionumber %]&filetype=image'>upload</a> one.</p>
 [% END %]
 [% END %]
 </div>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt
index c5ab657..4c389b9 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt
@@ -1,11 +1,12 @@
 [% INCLUDE 'doc-head-open.inc' %]
-[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha Online[% END %] Catalog › Images for: [% biblio.title |html %]
+<title>Koha › Catalog › Details for [% biblio.title |html %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield %][% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
-<script type="text/JavaScript" language="JavaScript">
+[% IF ( LocalCoverImages == 1 ) %]
+<script type="text/JavaScript">
 //<![CDATA[
 
 $(document).ready(function(){
-    showCover($('.thumbnail').attr('id'));
+    showCover([% imagenumber %]);
 });
 
 function showCover(img) {
@@ -16,28 +17,87 @@ function showCover(img) {
 //]]>
 </script>
 <style type="text/css">
+#largeCoverImg {
+	border : 1px solid #CCCCCC;
+	display : block;
+	margin : auto;
+	padding : 1em;
+}
+#thumbnails {
+	text-align : center;
+}
+#thumbnails a img {
+	border : 1px solid #0000CC;
+}
 img.thumbnail {
-    border-style: solid;
-    border-width: 3px;
-    border-color: white;
+	display : block;
+    float : none;
+    margin: 0 5px 5px 0;
+    padding : .5em;
 }
 
-img.selected {
+#thumbnails a img.selected {
     border-color: black;
+    cursor : default;
+    opacity:0.4;
+	filter:alpha(opacity=40); /* For IE8 and earlier */
 }
-</style>
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
-<body id="imageviewer">
-<div id="largeCover"><img id="largeCoverImg" alt="Large view" /></div>
-[% IF LocalCoverImages == 1 %]
-[% FOREACH img IN images %]
-[% IF img %]
-<a href='#' onclick='showCover([% img %])'><img class='thumbnail' id='[% img %]' src='/cgi-bin/koha/catalogue/image.pl?imagenumber=[% img %]&thumbnail=1' alt='Image'/></a>
-[% END %]
-[% END %]
-[% biblio.title %] [% biblio.author %]
+</style>[% END %]
+</head>
+
+<body>
+
+[% INCLUDE 'header.inc' %]
+[% INCLUDE 'cat-search.inc' %]
+
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>  › Images for <i>[% biblio.title |html %]  [% FOREACH subtitl IN subtitle %] [% subtitl.subfield %][% END %]</i></div>
+
+<div id="doc3" class="yui-t1">
+
+<div id="bd">
+	<div id="yui-main">
+	<div class="yui-b">
+	<div class="yui-ge">
+
+[% INCLUDE 'cat-toolbar.inc' %]
+
+<h3>Images for <i>[% biblio.title |html %]</i></h3>
+<h4>[% biblio.author %]</h4>
+
+[% IF ( LocalCoverImages == 1 ) %]
+	[% IF ( images.size > 1 ) %]
+		<div class="yui-u first">
+		<div id="largeCover">
+			<img id="largeCoverImg" alt="" src="/cgi-bin/koha/catalogue/image.pl?imagenumber=[% imagenumber %]" />
+		</div></div>
+
+		<div class="yui-u"><div id="thumbnails">
+
+			[% FOREACH img IN images %]
+				[% IF img %]
+				<a href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber %]&imagenumber=[% img %]" onclick="showCover([% img %]); return false;">
+					[% IF ( imagenumber == img ) %]
+						<img class="thumbnail selected" id="[% img %]" src="/cgi-bin/koha/catalogue/image.pl?imagenumber=[% img %]&thumbnail=1" alt="" />
+					[% ELSE %]
+						<img class="thumbnail" id="[% img %]" src="/cgi-bin/koha/catalogue/image.pl?imagenumber=[% img %]&thumbnail=1" alt="" />
+					[% END %]
+				</a>
+				[% END %]
+			[% END %]
+		</div></div>
+
+	[% ELSE %]
+		<div class="dialog message">There are no images for this record.</div>
+	[% END %]
 [% ELSE %]
-Unfortunately, images are not enabled for this catalog at this time.
+	<div class="dialog message">Local images have not been enabled by your system administrator.</div>
 [% END %]
-</body>
-</html>
+
+</div>
+</div>
+</div>
+<div class="yui-b">
+[% INCLUDE 'biblio-view-menu.inc' %]
+</div>
+</div>
+[% INCLUDE 'intranet-bottom.inc' %]
-- 
1.7.2.5


More information about the Patches mailing list