From 641a1c3a37c762d23b10bd39c0178c1041dcdf09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9rick?= Date: Mon, 13 Aug 2012 12:29:35 -0400 Subject: [PATCH] Bug 8597: Add system preferences to configure the mobile view. Content-Type: text/plain; charset="UTF-8" This patch adds the following system preferences: * OpacMainUserBlockMobile - alternate content for the MainUserBlock for mobile * OPACMobileUserCSS - custom CSS for mobile views only * OpacShowFiltersPulldownMobile - whether or not to show the index dropdown on the mobile view * OpacShowLibrariesPulldownMobile - whether or not to show the library dropdown on the mobile view Signed-off-by: Jared Camins-Esakov Signed-off-by: Chris Cormack Signed-off-by: Jared Camins-Esakov --- C4/Auth.pm | 4 ++ installer/data/mysql/sysprefs.sql | 4 ++ installer/data/mysql/updatedatabase.pl | 10 ++++ .../prog/en/modules/admin/preferences/opac.pref | 22 +++++++++ koha-tmpl/opac-tmpl/ccsr/en/css/mobile.css | 30 +++++++------ koha-tmpl/opac-tmpl/ccsr/en/css/opac.css | 4 ++ .../opac-tmpl/ccsr/en/includes/doc-head-close.inc | 1 + koha-tmpl/opac-tmpl/ccsr/en/includes/masthead.inc | 47 ++++++++++++++++--- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 4 ++ .../opac-tmpl/prog/en/includes/doc-head-close.inc | 1 + koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt | 1 + 11 files changed, 106 insertions(+), 22 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 59c9955..d4ad292 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -402,6 +402,7 @@ sub get_template_and_user { OpacShowRecentComments => C4::Context->preference("OpacShowRecentComments"), OPACURLOpenInNewWindow => "" . C4::Context->preference("OPACURLOpenInNewWindow"), OPACUserCSS => "". C4::Context->preference("OPACUserCSS"), + OPACMobileUserCSS => "". C4::Context->preference("OPACMobileUserCSS"), OPACViewOthersSuggestions => "" . C4::Context->preference("OPACViewOthersSuggestions"), OpacAuthorities => C4::Context->preference("OpacAuthorities"), OPACBaseURL => ($in->{'query'}->https() ? "https://" : "http://") . $ENV{'SERVER_NAME'} . @@ -413,6 +414,9 @@ sub get_template_and_user { OpacCloud => C4::Context->preference("OpacCloud"), OpacKohaUrl => C4::Context->preference("OpacKohaUrl"), OpacMainUserBlock => "" . C4::Context->preference("OpacMainUserBlock"), + OpacMainUserBlockMobile => "" . C4::Context->preference("OpacMainUserBlockMobile"), + OpacShowFiltersPulldownMobile => C4::Context->preference("OpacShowFiltersPulldownMobile"), + OpacShowLibrariesPulldownMobile => C4::Context->preference("OpacShowLibrariesPulldownMobile"), OpacNav => "" . C4::Context->preference("OpacNav"), OpacNavRight => "" . C4::Context->preference("OpacNavRight"), OpacNavBottom => "" . C4::Context->preference("OpacNavBottom"), diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 430585a..6f42f19 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -369,3 +369,7 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSuppressionByIPRange','','Restrict the suppression to IP adresses outside of the IP range','','free'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('PrefillItem','0','When a new item is added, should it be prefilled with last created item values?','','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SubfieldsToUseWhenPrefill','','Define a list of subfields to use when prefilling items (separated by space)','','Free'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OPACMobileUserCSS','','Include the following CSS for the mobile view on all pages in the OPAC:',NULL,'free'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacMainUserBlockMobile','','Show the following HTML in its own column on the main page of the OPAC (mobile version):',NULL,'free'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowLibrariesPulldownMobile','1','Show the libraries pulldown on the mobile version of the OPAC.',NULL,'YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowFiltersPulldownMobile','1','Show the search filters pulldown on the mobile version of the OPAC.',NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index c6b6063..ba7c715 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5681,6 +5681,16 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { "INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SubfieldsToUseWhenPrefill','','Define a list of subfields to use when prefilling items (separated by space)','','Free'); "); print "Upgrade to $DBversion done (Adding PrefillItem and SubfieldsToUseWhenPrefill sysprefs)\n"; + SetVersion ($DBversion); +} + +$DBversion ="XXX"; +if(C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OPACMobileUserCSS','','Include the following CSS for the mobile view on all pages in the OPAC:',NULL,'free');"); + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacMainUserBlockMobile','','Show the following HTML in its own column on the main page of the OPAC (mobile version):',NULL,'free');"); + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowLibrariesPulldownMobile','1','Show the libraries pulldown on the mobile version of the OPAC.',NULL,'YesNo');"); + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowFiltersPulldownMobile','1','Show the search filters pulldown on the mobile version of the OPAC.',NULL,'YesNo');"); + print "Upgrade to $DBversion done (Add OPACMobileUserCSS, OpacMainUserBlockMobile, OpacShowLibrariesPulldownMobile and OpacShowFiltersPulldownMobile sysprefs)\n"; SetVersion($DBversion); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 4df81b4..e645785 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -163,11 +163,33 @@ OPAC: type: textarea class: code - + - "Include the following CSS for the mobile view on all pages in the OPAC:" + - pref: OPACMobileUserCSS + type: textarea + class: code + - - "Show the following HTML in its own column on the main page of the OPAC:" - pref: OpacMainUserBlock type: textarea class: code - + - "Show the following HTML in its own column on the main page of the OPAC (mobile version):" + - pref: OpacMainUserBlockMobile + type: textarea + class: code + - + - pref: OpacShowLibrariesPulldownMobile + choices: + yes: Show + no: "Don't show" + - the libraries pulldown on the mobile version of the OPAC. + - + - pref: OpacShowFiltersPulldownMobile + choices: + yes: Show + no: "Don't show" + - the search filters pulldown on the mobile version of the OPAC. + - - "Show the following HTML on the left hand column of the main page and patron account on the OPAC (generally navigation links):" - pref: OpacNav type: textarea diff --git a/koha-tmpl/opac-tmpl/ccsr/en/css/mobile.css b/koha-tmpl/opac-tmpl/ccsr/en/css/mobile.css index 7917e77..58da8bd 100644 --- a/koha-tmpl/opac-tmpl/ccsr/en/css/mobile.css +++ b/koha-tmpl/opac-tmpl/ccsr/en/css/mobile.css @@ -5,9 +5,11 @@ /* Hidden elements */ +.mobile-hidden, body#opac-main #login, body#opac-main #login~div, body#opac-main #opacnav, +body#opac-main #opacmainuserblock, body#opac-main #news, body#results #facetcontainer, body#opac-detail #ulactioncontainer>:not(#action), @@ -99,14 +101,15 @@ body#results #breadcrumbs>*{ /* Main */ -body#opac-main #opacmainuserblock { - padding: 0 -} - body#opac-main #container #ctn_lt{ padding: 15px; } +body#opac-main #opacmainuserblockmobile { + display: block; +} + + /* Results */ @@ -257,30 +260,29 @@ form#searchform { padding-top: 50px; } -form.single-library #filters .jqTransformSelectWrapper { +form#searchform #filters .jqTransformSelectWrapper, +form#searchform #libraries .jqTransformSelectWrapper { position: relative; - width: 100% !important; left: 0; top: 0; border-radius: 3px; } form.multi-libraries #filters .jqTransformSelectWrapper{ - position: relative; width: 49% !important; float: left; - top: 0px; - left: 0px; - border-radius: 3px; } form.multi-libraries #libraries .jqTransformSelectWrapper{ - position: relative; width: 49% !important; float: right; - top: 0px; - left: 0px; - border-radius: 3px; +} + +form.single-library #filters .jqTransformSelectWrapper, +form.multi-libraries.single-field-mobile #filters .jqTransformSelectWrapper, +form.multi-libraries.single-field-mobile #libraries .jqTransformSelectWrapper{ + width: 100% !important; + float:left; } form.multi-libraries .input-wrapper{ diff --git a/koha-tmpl/opac-tmpl/ccsr/en/css/opac.css b/koha-tmpl/opac-tmpl/ccsr/en/css/opac.css index 413d547..d235584 100644 --- a/koha-tmpl/opac-tmpl/ccsr/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/ccsr/en/css/opac.css @@ -2620,6 +2620,10 @@ ul.ui-tabs-nav li { box-shadow: 1px 1px 3px 0 #666; } +body#opac-main #opacmainuserblockmobile { + display: none; +} + .mobile_only { display : none; } diff --git a/koha-tmpl/opac-tmpl/ccsr/en/includes/doc-head-close.inc b/koha-tmpl/opac-tmpl/ccsr/en/includes/doc-head-close.inc index e733dbd..5b6981d 100644 --- a/koha-tmpl/opac-tmpl/ccsr/en/includes/doc-head-close.inc +++ b/koha-tmpl/opac-tmpl/ccsr/en/includes/doc-head-close.inc @@ -22,6 +22,7 @@ +[% IF ( OPACMobileUserCSS ) %][% END %] [% IF ( OPACUserCSS ) %][% END %] diff --git a/koha-tmpl/opac-tmpl/ccsr/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/ccsr/en/includes/masthead.inc index 6eec70c..79a1219 100644 --- a/koha-tmpl/opac-tmpl/ccsr/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/ccsr/en/includes/masthead.inc @@ -84,14 +84,26 @@ [% IF ( OpacPublic ) %]
-[% UNLESS ( advsearch ) %]
+[% UNLESS ( advsearch ) %] +[% IF ( OpacAddMastheadLibraryPulldown ) %] + [% IF ( OpacShowFiltersPulldownMobile and not OpacShowLibrariesPulldownMobile ) or ( not OpacShowFiltersPulldownMobile and OpacShowLibrariesPulldownMobile ) %] + + [% ELSE %] + + [% END %] +[% ELSE %] + +[% END %] - -
+ [% IF ( OpacShowFiltersPulldownMobile ) %] +
+ [% ELSE %] +
+ [% END %] [% FOREACH BranchesLoo IN BranchesLoop %] @@ -168,14 +184,25 @@ [% ELSE %] -
+ [% IF ( OpacAddMastheadLibraryPulldown ) %] + [% IF ( OpacShowFiltersPulldownMobile and not OpacShowLibrariesPulldownMobile ) or ( not OpacShowFiltersPulldownMobile and OpacShowLibrariesPulldownMobile ) %] + + [% ELSE %] + + [% END %] + [% ELSE %] + + [% END %] - -
+ [% IF ( OpacShowFiltersPulldownMobile ) %] +
+ [% ELSE %] +
+ [% END %] @@ -186,7 +213,11 @@
[% IF ( OpacAddMastheadLibraryPulldown ) %] -
+ [% IF ( OpacShowLibrariesPulldownMobile ) %] +
+ [% ELSE %] +
+ [% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index 73eea25..e03a13f 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -2614,6 +2614,10 @@ ul.ui-tabs-nav li { box-shadow: 1px 1px 3px 0 #666; } +body#opac-main #opacmainuserblockmobile { + display: none; +} + .mobile_only { display : none; } diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc index 1ea41be..f032b20 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc @@ -22,6 +22,7 @@ [% END %] +[% IF ( OPACMobileUserCSS ) %][% END %] [% IF ( OPACUserCSS ) %][% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt index d291b2a..cc67ff2 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt @@ -37,6 +37,7 @@ [% END %] [% IF ( OpacMainUserBlock ) %]
[% OpacMainUserBlock %]
[% END %] + [% IF ( OpacMainUserBlockMobile ) %]
[% OpacMainUserBlockMobile %]
[% END %]
-- 1.7.2.5