Bugzilla – Attachment 7440 Details for
Bug 7264
Display information about library on OPAC detail
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
bug_7264: Added opac_info field to branches table.
bug7264-Added-opacinfo-field-to-branches-table.patch (text/plain), 17.17 KB, created by
Magnus Enger
on 2012-02-03 11:42:36 UTC
(
hide
)
Description:
bug_7264: Added opac_info field to branches table.
Filename:
MIME Type:
Creator:
Magnus Enger
Created:
2012-02-03 11:42:36 UTC
Size:
17.17 KB
patch
obsolete
>From cde1287b8a4474f8a4cddbcac4d046fb3c4e2e4f Mon Sep 17 00:00:00 2001 >From: Srdjan Jankovic <srdjan@catalyst.net.nz> >Date: Thu, 2 Feb 2012 15:52:02 +1300 >Subject: [PATCH] bug_7264: Added opac_info field to branches table. >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Rhe contents are displayed on the opac detail screen as a branch popup > >Signed-off-by: Magnus Enger <magnus@enger.priv.no> >Applied the patch and then could enter information for each library >in Administration ΓΆΒΊ Libraries and Groups, with a nice MCE interface. >In the OPAC the entered information is displayed in a popup, but >only for those libraries that have the info, if a library lacks >info it looks exactly as it used to. It's possible to mouse over the >popup, so providing links in the popup will work. > >I think the popup needs a border to stand out more, I have created a >separate, followup patch for that. >--- > C4/Branch.pm | 10 ++++---- > C4/Items.pm | 13 ++-------- > admin/branches.pl | 4 ++- > installer/data/mysql/kohastructure.sql | 1 + > installer/data/mysql/updatedatabase.pl | 8 +++++++ > .../prog/en/modules/admin/branches.tt | 22 +++++++++++++++++++ > .../prog/en/lib/jquery/plugins/jquery.tools.min.js | 11 +++++++++ > koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 23 +++++++++++++++++++- > 8 files changed, 75 insertions(+), 17 deletions(-) > create mode 100644 koha-tmpl/opac-tmpl/prog/en/lib/jquery/plugins/jquery.tools.min.js > >diff --git a/C4/Branch.pm b/C4/Branch.pm >index 7bd0326..2153028 100644 >--- a/C4/Branch.pm >+++ b/C4/Branch.pm >@@ -204,8 +204,8 @@ sub ModBranch { > (branchcode,branchname,branchaddress1, > branchaddress2,branchaddress3,branchzip,branchcity,branchstate, > branchcountry,branchphone,branchfax,branchemail, >- branchurl,branchip,branchprinter,branchnotes) >- VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) >+ branchurl,branchip,branchprinter,branchnotes,opac_info) >+ VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) > "; > my $sth = $dbh->prepare($query); > $sth->execute( >@@ -217,7 +217,7 @@ sub ModBranch { > $data->{'branchphone'}, $data->{'branchfax'}, > $data->{'branchemail'}, $data->{'branchurl'}, > $data->{'branchip'}, $data->{'branchprinter'}, >- $data->{'branchnotes'}, >+ $data->{'branchnotes'}, $data->{opac_info}, > ); > return 1 if $dbh->err; > } else { >@@ -227,7 +227,7 @@ sub ModBranch { > branchaddress2=?,branchaddress3=?,branchzip=?, > branchcity=?,branchstate=?,branchcountry=?,branchphone=?, > branchfax=?,branchemail=?,branchurl=?,branchip=?, >- branchprinter=?,branchnotes=? >+ branchprinter=?,branchnotes=?,opac_info=? > WHERE branchcode=? > "; > my $sth = $dbh->prepare($query); >@@ -240,7 +240,7 @@ sub ModBranch { > $data->{'branchphone'}, $data->{'branchfax'}, > $data->{'branchemail'}, $data->{'branchurl'}, > $data->{'branchip'}, $data->{'branchprinter'}, >- $data->{'branchnotes'}, >+ $data->{'branchnotes'}, $data->{opac_info}, > $data->{'branchcode'}, > ); > } >diff --git a/C4/Items.pm b/C4/Items.pm >index 04cb417..786f7a8 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -1184,7 +1184,9 @@ sub GetItemsInfo { > items.notforloan as itemnotforloan, > itemtypes.description, > itemtypes.notforloan as notforloan_per_itemtype, >- branchurl >+ branchurl, >+ branchname, >+ branches.opac_info as branch_opac_info > FROM items > LEFT JOIN branches ON items.holdingbranch = branches.branchcode > LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber >@@ -1235,15 +1237,6 @@ sub GetItemsInfo { > # value. > $count_reserves = $restype; > } >- #get branch information..... >- my $bsth = $dbh->prepare( >- "SELECT * FROM branches WHERE branchcode = ? >- " >- ); >- $bsth->execute( $data->{'holdingbranch'} ); >- if ( my $bdata = $bsth->fetchrow_hashref ) { >- $data->{'branchname'} = $bdata->{'branchname'}; >- } > $data->{'datedue'} = $datedue; > $data->{'count_reserves'} = $count_reserves; > >diff --git a/admin/branches.pl b/admin/branches.pl >index 12c49e2..c12762d 100755 >--- a/admin/branches.pl >+++ b/admin/branches.pl >@@ -328,6 +328,7 @@ sub branchinfotable { > # - branchfax | > # - branchemail / > # - branchurl / >+ # - opac_info (can contain HTML) > # - address-empty-p (1 if no address information, 0 otherwise) > # - categories (containing a static error message) > # - category_list (loop containing "categoryname") >@@ -343,7 +344,7 @@ sub branchinfotable { > 'branchaddress3', 'branchzip', > 'branchcity', 'branchstate', 'branchcountry', > 'branchphone', 'branchfax', >- 'branchemail', 'branchurl', >+ 'branchemail', 'branchurl', 'opac_info', > 'branchip', 'branchprinter', 'branchnotes' > ) > { >@@ -406,6 +407,7 @@ sub _branch_to_template { > branchfax => $data->{'branchfax'}, > branchemail => $data->{'branchemail'}, > branchurl => $data->{'branchurl'}, >+ opac_info => $data->{'opac_info'}, > branchip => $data->{'branchip'}, > branchnotes => $data->{'branchnotes'}, > ); >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 37113c2..da19647 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -361,6 +361,7 @@ CREATE TABLE `branches` ( -- information about your libraries or branches are st > `branchip` varchar(15) default NULL, -- the IP address for your library or branch > `branchprinter` varchar(100) default NULL, -- unused in Koha > `branchnotes` mediumtext, -- notes related to your library or branch >+ opac_info text, -- HTML that displays in OPAC > UNIQUE KEY `branchcode` (`branchcode`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 099dfb9..26faadd 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -4663,6 +4663,14 @@ ENDOFRENEWAL > print "Upgrade to $DBversion done (Added a system preference to allow renewal of Patron account either from todays date or from existing expiry date in the patrons account.)\n"; > SetVersion($DBversion); > } >+ >+$DBversion = "3.07.00.XXX"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do("ALTER TABLE branches ADD opac_info text;"); >+ print "Upgrade to $DBversion done add opac_info to branches \n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt >index df5e56c..b819e01 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt >@@ -13,6 +13,25 @@ > [% INCLUDE 'doc-head-close.inc' %] > <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script> > <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.pager.js"></script> >+<script type="text/javascript" src="[% themelang %]/js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script> >+<script language="javascript" type="text/javascript"> >+tinyMCE.init({ >+ mode : "textareas", >+ theme : "advanced", >+ content_css : "[% themelang %]/css/tinymce.css", >+ plugins : "table,save,advhr,advlink,iespell,contextmenu", >+ theme_advanced_buttons1 : "save,|,bold,italic,|,cut,copy,paste,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,link,unlink,anchor,cleanup,help,code,advhr,", >+ theme_advanced_buttons2 : "tablecontrols,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,removeformat,|,visualaid,|,sub,sup,|,charmap", >+ theme_advanced_buttons3 : "", >+ theme_advanced_toolbar_location : "top", >+ theme_advanced_toolbar_align : "left", >+ theme_advanced_path_location : "bottom", >+ theme_advanced_resizing : true, >+ apply_source_formatting : true, >+ height : "300", >+ width : "700" >+}); >+</script> > </head> > <body> > [% INCLUDE 'header.inc' %] >@@ -122,6 +141,7 @@ > <li><label for="branchfax">Fax</label><input type="text" name="branchfax" id="branchfax" value="[% branchfax |html %]" /></li> > <li><label for="branchemail">Email</label><input type="text" name="branchemail" id="branchemail" value="[% branchemail |html %]" /></li> > <li><label for="branchurl">url</label><input type="text" name="branchurl" id="branchurl" value="[% branchurl |html %]" /></li> >+ <li><label for="opac_info">OPAC Info</label><textarea name="opac_info" id="opac_info">[% opac_info |html %]</textarea></li> > <li><label for="branchip">IP</label><input type="text" name="branchip" id="branchip" value="[% branchip |html %]" /> <span class="hint">Can be entered as a single IP, or a subnet such as 192.168.1.*</span></li> > <!-- > <li><label for="branchprinter">Library Printer</label> >@@ -214,6 +234,8 @@ > <br /><a href="mailto:[% branche.branchemail %]">[% branche.branchemail |html %]</a>[% END %] > [% IF ( branche.branchurl ) %] > <br /><a href="[% branche.branchurl %]">[% branche.branchurl |html %]</a>[% END %] >+ [% IF ( branche.opac_info ) %] >+ <br />OPAC Info: <div>[% branche.opac_info %]</div>[% END %] > [% IF ( branche.branchnotes ) %] > <br />Notes: [% branche.branchnotes |html %][% END %] > [% END %] >diff --git a/koha-tmpl/opac-tmpl/prog/en/lib/jquery/plugins/jquery.tools.min.js b/koha-tmpl/opac-tmpl/prog/en/lib/jquery/plugins/jquery.tools.min.js >new file mode 100644 >index 0000000..9f28bef >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/prog/en/lib/jquery/plugins/jquery.tools.min.js >@@ -0,0 +1,11 @@ >+/*! >+ * jQuery Tools v1.2.6 - The missing UI library for the Web >+ * >+ * tooltip/tooltip.js >+ * >+ * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE. >+ * >+ * http://flowplayer.org/tools/ >+ * >+ */ >+(function(a){a.tools=a.tools||{version:"v1.2.6"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,fadeIE:!1,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeTo(c.fadeInSpeed,c.opacity,b):(this.getTip().show(),b())},function(b){var c=this.getConf();!a.browser.msie||c.fadeIE?this.getTip().fadeOut(c.fadeOutSpeed,b):(this.getTip().hide(),b())}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1],/iPad/i.test(navigator.userAgent)&&(e-=a(window).scrollTop());var h=c.outerHeight()+b.outerHeight();g=="center"&&(e+=h/2),g=="bottom"&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();g=="center"&&(f-=i/2),g=="left"&&(f-=i);return{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw"Nonexistent effect \""+e.effect+"\"";r=r.split(/,\s*/);if(r.length!=2)throw"Tooltip: bad events configuration for "+q;d.bind(r[0],function(a){clearTimeout(i),e.predelay?j=setTimeout(function(){f.show(a)},e.predelay):f.show(a)}).bind(r[1],function(a){clearTimeout(j),e.delay?i=setTimeout(function(){f.hide(a)},e.delay):f.hide(a)}),k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h){l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.next(),h.length||(h=d.parent().next()));if(!h.length)throw"Cannot find tooltip for "+d}if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);e.tip&&h.html(d.data("title")),b=a.Event(),b.type="onBeforeShow",g.trigger(b,[o]);if(b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,function(){b.type="onShow",n="full",g.trigger(b)});var p=e.events.tooltip.split(/,\s*/);h.data("__set")||(h.unbind(p[0]).bind(p[0],function(){clearTimeout(i),clearTimeout(j)}),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.unbind(p[1]).bind(p[1],function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])}),e.tip||h.data("__set",!0));return f},hide:function(c){if(!h||!f.isShown())return f;c=a.Event(),c.type="onBeforeHide",g.trigger(c);if(!c.isDefaultPrevented()){n=!1,b[e.effect][1].call(f,function(){c.type="onHide",g.trigger(c)});return f}},isShown:function(a){return a?n=="full":n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(b,c){a.isFunction(e[c])&&a(f).bind(c,e[c]),f[c]=function(b){b&&a(f).bind(c,b);return f}})}a.fn.tooltip=function(b){var c=this.data("tooltip");if(c)return c;b=a.extend(!0,{},a.tools.tooltip.conf,b),typeof b.position=="string"&&(b.position=b.position.split(/,?\s/)),this.each(function(){c=new d(a(this),b),a(this).data("tooltip",c)});return b.api?c:this}})(jQuery); >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >index dd1c33f..97a2c57 100755 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >@@ -1,6 +1,7 @@ > [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha Online[% END %] Catalog › Details for: [% title |html %][% FOREACH subtitl IN subtitle %], [% subtitl.subfield |html %][% END %] > [% INCLUDE 'doc-head-close.inc' %] > <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script> >+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tools.min.js"></script> > <script type="text/JavaScript" language="JavaScript"> > //<![CDATA[ > [% IF ( busc ) %] >@@ -74,6 +75,7 @@ > }); > [% END %] > >+ $(".branch-info-tooltip-trigger").tooltip({delay: 100, position: "top right"}); > }); > > >@@ -212,6 +214,13 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > [% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %]<style type="text/css"> > #addtagl { display: none; } > </style>[% END %][% END %][% END %] >+<style type="text/css"> >+.branch-info-tooltip { >+ display: none; >+ padding: 20px; >+ background: #fff; >+} >+</style> > > </head> > <body id="opac-detail"> >@@ -592,7 +601,19 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > </tr></thead> > <tbody>[% FOREACH ITEM_RESULT IN ITEM_RESULTS %] > <tr>[% IF ( item_level_itypes ) %]<td>[% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %]<img src="[% ITEM_RESULT.imageurl %]" title="[% ITEM_RESULT.description %]" alt="[% ITEM_RESULT.description %]" />[% END %][% END %] [% ITEM_RESULT.description %]</td>[% END %] >- <td>[% UNLESS ( singleBranchMode ) %][% IF ( ITEM_RESULT.branchurl ) %]<a href="[% ITEM_RESULT.branchurl %]">[% ITEM_RESULT.branchname %]</a>[% ELSE %][% ITEM_RESULT.branchname %][% END %][% END %] <span class="shelvingloc">[% ITEM_RESULT.location_description %]</span> </td> >+ <td> >+ [% UNLESS ( singleBranchMode ) %] >+ <span class="[% ITEM_RESULT.branch_opac_info ? 'branch-info-tooltip-trigger' : '' %]"> >+ [% IF ( ITEM_RESULT.branchurl ) %] >+ <a href="[% ITEM_RESULT.branchurl %]">[% ITEM_RESULT.branchname %]</a> >+ [% ELSE %] >+ [% ITEM_RESULT.branchname %] >+ [% END %] >+ </span> >+ <div class="branch-info-tooltip">[% ITEM_RESULT.branch_opac_info %]</div> >+ [% END %] >+ <span class="shelvingloc">[% ITEM_RESULT.location_description %]</span> >+ </td> > [% IF ( itemdata_ccode ) %]<td>[% ITEM_RESULT.ccode %]</td>[% END %] > <td>[% IF ( ITEM_RESULT.itemcallnumber ) %] [% ITEM_RESULT.itemcallnumber %][% IF ( OPACShelfBrowser ) %] (<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ITEM_RESULT.biblionumber %]&shelfbrowse_itemnumber=[% ITEM_RESULT.itemnumber %]#shelfbrowser">Browse Shelf</a>)[% END %][% END %]</td> > [% IF ( itemdata_enumchron ) %]<td>[% ITEM_RESULT.enumchron %]</td>[% END %] >-- >1.7.5.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7264
:
7058
|
7059
|
7417
|
7439
|
7440
|
7441
|
7518
|
7912
|
8073
|
8107
|
8111
|
8112
|
8113