From 02c4edadf42e57ef95b93732d2a6a4dee47075b3 Mon Sep 17 00:00:00 2001
From: Owen Leonard <oleonard@myacpl.org>
Date: Fri, 27 Jun 2014 09:11:21 -0400
Subject: [PATCH] [PASSED QA] Bug 12494 - Remove yuipath system preference

With the OPAC prog template going away, the only remaining use of the
yuipath preference is on the basketgroups template. The yuipath
preference should be removed and the local path hard-coded.

This patch:
  - removes yuipath handling from C4/Templates.pm
  - removes the preference from sysprefs.sql
  - deletes the preference via updatedatabase.pl
  - removes the preference from the staff client preferences file
  - removes unused references to the YUI assets from the help file
    header include
  - adds the local YUI asset path to acqui/basketgroup.tt

To test, apply the patch and run the database update. View some online
help pages and confirm that they function correctly. View the
basketgroups page (Acquisition -> Vendor -> Basket groups), edit a
basket group, and confirm that basket drag and drop operations work
correctly.

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Online help and basket group drag&drop functionality still work correctly.
---
 C4/Templates.pm                                          |  7 -------
 installer/data/mysql/sysprefs.sql                        |  1 -
 installer/data/mysql/updatedatabase.pl                   |  7 +++++++
 koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc    |  7 +------
 .../intranet-tmpl/prog/en/modules/acqui/basketgroup.tt   | 16 ++++++++--------
 .../prog/en/modules/admin/preferences/staff_client.pref  |  6 ------
 6 files changed, 16 insertions(+), 28 deletions(-)

diff --git a/C4/Templates.pm b/C4/Templates.pm
index b326f53..a214b68 100644
--- a/C4/Templates.pm
+++ b/C4/Templates.pm
@@ -100,10 +100,6 @@ sub output {
     }
     $vars->{lang} = $self->lang;
     $vars->{themelang} .= '/' . $self->preferredtheme . '/' . $self->lang;
-    $vars->{yuipath} =
-      ( C4::Context->preference("yuipath") eq "local"
-        ? ( $self->interface eq 'intranet' ? $vars->{themelang} . "/lib/yui" : "/opac-tmpl/lib/yui" )
-        : C4::Context->preference("yuipath") );
     $vars->{interface} =
       ( $self->{interface} ne 'intranet' ? '/opac-tmpl' : '/intranet-tmpl' );
     $vars->{theme} = $self->theme;
@@ -231,9 +227,6 @@ sub gettemplate {
 #        "/$theme/$lang";
 #    $template->param(
 #        themelang => $themelang,
-#        yuipath   => C4::Context->preference("yuipath") eq "local"
-#                     ? "$themelang/lib/yui"
-#                     : C4::Context->preference("yuipath"),
 #        interface => $is_intranet ? '/intranet-tmpl' : '/opac-tmpl',
 #        theme     => $theme,
 #        lang      => $lang
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index ed427ea..95afacf 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -441,7 +441,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('XISBNDailyLimit','999','','The xISBN Web service is free for non-commercial use when usage does not exceed 1000 requests per day','Integer'),
 ('XSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on intranet','Free'),
 ('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
-('yuipath','local','local|http://yui.yahooapis.com/2.5.1/build','Insert the path to YUI libraries, choose local if you use koha offline','Choice'),
 ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
 ('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
 ;
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 1030454..547522c 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -8570,6 +8570,13 @@ if ( CheckVersion($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = "3.17.00.XXX";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("DELETE FROM systempreferences WHERE variable='yuipath'");
+    print "Upgrade to $DBversion done ( Bug 12494 - Remove yuipath system preference )\n";
+    SetVersion ($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc
index 5dcbe27..ef87e1e 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/help-top.inc
@@ -1,5 +1,5 @@
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Online Help</title>
+<title>Online help</title>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% interface %]/[% theme %]/img/favicon.ico[% END %]" type="image/x-icon" />
 <link rel="stylesheet" type="text/css" href="[% interface %]/lib/jquery/jquery-ui.css" />
@@ -11,11 +11,6 @@
 <script type="text/javascript" src="[% interface %]/lib/jquery/jquery.js"></script>
 <script type="text/javascript" src="[% interface %]/lib/jquery/jquery-ui.js"></script>
 <script type="text/javascript" src="[% interface %]/lib/shortcut/shortcut.js"></script>
-<!-- yui js --> 
-<script type="text/javascript" src="[% yuipath %]/utilities/utilities.js"></script> 
-<script type="text/javascript" src="[% yuipath %]/button/button-min.js"></script> 
-<script type="text/javascript" src="[% yuipath %]/container/container_core-min.js"></script> 
-<script type="text/javascript" src="[% yuipath %]/menu/menu-min.js"></script> 
 <!-- koha core js -->
 <script type="text/javascript" src="[% themelang %]/js/staff-global.js"></script>
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt
index 8f5e1a2..703a063 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt
@@ -4,16 +4,16 @@
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
 [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'datatables.inc' %]
-<script type="text/javascript" src="[% yuipath %]/utilities/utilities.js"></script>
-<script type="text/javascript" src="[% yuipath %]/button/button-min.js"></script>
-<script type="text/javascript" src="[% yuipath %]/container/container_core-min.js"></script>
-<script type="text/javascript" src="[% yuipath %]/menu/menu-min.js"></script>
+<script type="text/javascript" src="[% themelang %]/lib/yui/utilities/utilities.js"></script>
+<script type="text/javascript" src="[% themelang %]/lib/yui/button/button-min.js"></script>
+<script type="text/javascript" src="[% themelang %]/lib/yui/container/container_core-min.js"></script>
+<script type="text/javascript" src="[% themelang %]/lib/yui/menu/menu-min.js"></script>
 <script type="text/javascript" src="[% themelang %]/js/basketgroup.js"></script>
 [% IF ( grouping ) %]
-<script type="text/javascript" src="[% yuipath %]/yahoo-dom-event/yahoo-dom-event.js"></script>
-<script type="text/javascript" src="[% yuipath %]/animation/animation-min.js"></script>
-<script type="text/javascript" src="[% yuipath %]/dragdrop/dragdrop-min.js"></script>
-<script type="text/javascript" src="[% yuipath %]/element/element-min.js"></script>
+<script type="text/javascript" src="[% themelang %]/lib/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
+<script type="text/javascript" src="[% themelang %]/lib/yui/animation/animation-min.js"></script>
+<script type="text/javascript" src="[% themelang %]/lib/yui/dragdrop/dragdrop-min.js"></script>
+<script type="text/javascript" src="[% themelang %]/lib/yui/element/element-min.js"></script>
 <style type="text/css">
 /*margin and padding on body element
   can introduce errors in determining
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref
index 53cd72f..bbadc70 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref
@@ -72,12 +72,6 @@ Staff Client:
                   no: "Don't show"
             - the format, audience, and material type icons in XSLT MARC21 results and detail pages in the staff client.
         -
-            - Use the Yahoo UI libraries
-            - pref: yuipath
-              choices:
-                  local: "included with Koha (faster, will work if internet goes down)."
-                  "http://yui.yahooapis.com/2.5.1/build": "from Yahoo's own servers (less demand on your servers)."
-        -
             - pref: StaffAuthorisedValueImages
               choices:
                   yes: Show
-- 
1.9.1