[Koha-patches] [PATCH] OpacAddMastheadLibraryPulldown
Kyle M Hall
kyle.m.hall at gmail.com
Wed Jan 20 15:04:27 CET 2010
In the current OPAC, there is no easy way to search a particular library.
By default, a user searches all libraries, or with SearcMyLibraryFirst turn on,
the user's home library. In dev_week, a library pulldown menu existed in the search masthead.
This commit adds the option to bring that pulldown menu back
by turning on the system preference OpacAddMastheadLibraryPulldown
---
C4/Auth.pm | 10 +++--
installer/data/mysql/en/mandatory/sysprefs.sql | 1 +
.../1-Obligatoire/unimarc_standard_systemprefs.sql | 1 +
installer/data/mysql/updatedatabase.pl | 7 ++++
koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc | 34 ++++++++++++++-----
5 files changed, 40 insertions(+), 13 deletions(-)
diff --git a/C4/Auth.pm b/C4/Auth.pm
index 608fd9b..53c9cef 100755
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -337,9 +337,10 @@ sub get_template_and_user {
'item-level_itypes' => C4::Context->preference('item-level_itypes'),
patronimages => C4::Context->preference("patronimages"),
singleBranchMode => C4::Context->preference("singleBranchMode"),
- XSLTDetailsDisplay => C4::Context->preference("XSLTDetailsDisplay"),
- XSLTResultsDisplay => C4::Context->preference("XSLTResultsDisplay"),
- );
+ XSLTDetailsDisplay => C4::Context->preference("XSLTDetailsDisplay"),
+ XSLTResultsDisplay => C4::Context->preference("XSLTResultsDisplay"),
+ BranchesLoop => GetBranchesLoop(),
+ );
if ( $in->{'type'} eq "intranet" ) {
$template->param(
@@ -433,7 +434,8 @@ sub get_template_and_user {
reviewson => C4::Context->preference("reviewson"),
suggestion => "" . C4::Context->preference("suggestion"),
virtualshelves => "" . C4::Context->preference("virtualshelves"),
- OPACSerialIssueDisplayCount => C4::Context->preference("OPACSerialIssueDisplayCount"),
+ OPACSerialIssueDisplayCount => C4::Context->preference("OPACSerialIssueDisplayCount"),
+ OpacAddMastheadLibraryPulldown => C4::Context->preference("OpacAddMastheadLibraryPulldown"),
);
}
$template->param(listloop=>[{shelfname=>"Freelist", shelfnumber=>110}]);
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index e9df35e..e7f1497 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -274,3 +274,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACPatronDetails','1','If OFF the patron details tab in the OPAC is disabled.','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACFinesTab','1','If OFF the patron fines tab in the OPAC is disabled.','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('RoutingListAddReserves','1','If ON the patrons on routing lists are automatically added to holds on the issue.','','YesNo');
+INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ( 'OpacAddMastheadLibraryPulldown', '0', '', 'Adds a pulldown menu to select the library to search on the opac masthead.', 'YesNo' );
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
index 528cea1..18ffee5 100644
--- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
@@ -273,3 +273,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacSerialDefaultTab', 'serialcollection', 'Ce paramètre définit l''onglet par défaut pour l''affichage des périodiques dans l''OPAC.', 'holdings|serialcollection|subscriptions', 'Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('RoutingListAddReserves','1','Si activé, des reservations sont automatiquement créées pour chaque lecteur de la liste de circulation d''un numéro de périodique','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SpecifyDueDate',1,'Autorise ou non le bibliothécaire à spécifier la date de retour dans le module circulation','','YesNo');
+INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ( 'OpacAddMastheadLibraryPulldown', '0', '', 'Adds a pulldown menu to select the library to search on the opac masthead.', 'YesNo' );
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 4e1d1cf..fe91f5c 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3291,6 +3291,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
+$DBversion = "3.01.00.XXX";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ( 'OpacAddMastheadLibraryPulldown', '0', '', 'Adds a pulldown menu to select the library to search on the opac masthead.', 'YesNo' )");
+ print "Upgrade done (added OpacAddMastheadLibraryPulldown system preferences)\n";
+ SetVersion ($DBversion);
+}
+
=item DropAllForeignKeys($table)
Drop all foreign keys of the table $table
diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
index 0112166..071cdef 100644
--- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
+++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
@@ -17,7 +17,12 @@
<div id="fluid">
<div id="fluid-offset">
<!-- TMPL_UNLESS NAME="advsearch" --><form name="searchform" method="get" action="/cgi-bin/koha/opac-search.pl" id="searchform">
- <label for="masthead_search" class="left"> Search <!-- TMPL_IF name="mylibraryfirst" --> (in <!-- TMPL_VAR name="mylibraryfirst" --> only)<!-- /TMPL_IF --></label>
+ <label for="masthead_search" class="left"> Search
+ <!-- TMPL_UNLESS NAME="OpacAddMastheadLibraryPulldown" -->
+ <!-- TMPL_IF name="mylibraryfirst" --> (in <!-- TMPL_VAR name="mylibraryfirst" --> only)<!-- /TMPL_IF -->
+ <!-- /TMPL_UNLESS -->
+ </label>
+
<select name="idx" id="masthead_search" class="left" style="max-width:10em;width:10em;">
<!-- TMPL_IF NAME="ms_kw" -->
<option selected="selected" value="">Library Catalog</option>
@@ -59,14 +64,25 @@
<!-- TMPL_ELSE -->
<input type="text" id = "transl1" name="q" class="left" style="width: 35%; font-size: 111%;"/><div id="translControl"></div>
<!-- /TMPL_IF -->
- <!-- TMPL_UNLESS NAME="opac_limit_override" -->
- <!-- TMPL_IF name="mylibraryfirst" -->
- <input name="limit" value="branch:<!-- TMPL_VAR name="mylibraryfirst" -->" type="hidden" />
- <!-- /TMPL_IF -->
- <!-- /TMPL_UNLESS -->
- <!-- TMPL_IF NAME="opac_search_limit" -->
- <input name="limit" value="<!-- TMPL_VAR name="opac_search_limit" -->" type="hidden" />
- <!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="OpacAddMastheadLibraryPulldown" -->
+ <select name="limit" id="masthead_search" class="left" style="max-width:10em;width:10em;">
+ <option value="">All Libraries</option>
+ <!-- TMPL_LOOP NAME="BranchesLoop" -->
+ <option <!-- TMPL_IF NAME="selected" -->SELECTED<!-- /TMPL_IF --> value="branch:<!-- TMPL_VAR NAME='value' -->"><!-- TMPL_VAR NAME='branchname' --></option>
+ <!-- /TMPL_LOOP -->
+ </select>
+ <!-- TMPL_ELSE -->
+ <!-- TMPL_UNLESS NAME="opac_limit_override" -->
+ <!-- TMPL_IF name="mylibraryfirst" -->
+ <input name="limit" value="branch:<!-- TMPL_VAR name="mylibraryfirst" -->" type="hidden" />
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_UNLESS -->
+ <!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="opac_search_limit" -->
+ <input name="limit" value="<!-- TMPL_VAR name="opac_search_limit" -->" type="hidden" />
+ <!-- /TMPL_IF -->
+
+
<input type="submit" value="Go" id="searchsubmit" class="left" />
<!-- TMPL_IF NAME="opacbookbag" --><span id="cmspan"></span><!-- /TMPL_IF -->
--
1.5.6.5
More information about the Koha-patches
mailing list