[Koha-patches] [PATCH 5/5] Bug 12815 [ENH] Patch #5 of 5 - Adding browser based multi-lingual jquery.ime input method support to Koha

Indranil Das Gupta indradg at gmail.com
Wed Aug 27 11:03:20 CEST 2014


The original patch http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=31152
is being split up into a 5-part patchset as per discussion on #koha

This 5/5 adds the jQuery.IME support hooks for the Koha staff client. It introduces a
new syspref 'UsejQueryIMEonStaff' and inserts into sysprefs.sql and updatedatabase.pl.
The entry for UsejQueryIMEonStaff is also added in the i18n_l10n.pref YAML file under
'Multi-lingual keyboard' sub-section.

Test Plan:

1) Apply patch

2) Update the database (so that the new system preference is inserted)

3) Go to Administration -> System Preferences -> I18N/L10N in the staff
   client.

4) Under "Multi-Lingual keyboard", "Enable" the UsejQueryIMEonStaff
   system preference. Open the refresh the staff client window and
   click inside any input text or textarea field after the page loads.
   You should see small keyboard graphics attached to the bottom right
   edge of the text field.

5) Click on the keyboard graphics to expand the drop-down. Select your
   language. The drop-down will close.

6) Click again on the keyboard icon, it should now offer the list of
   input methods available for the language selected in step 5.

7) You should be able to type in your chosen input method. To switch
   back to English while on that page press CTRL+M. This toggles
   between input methods while on the page.

8) Repeating step #4 about to select "Do not enable", should disable
   jQuery.IME support for the staff client.

NOTE 1: For a language to work, the operating system should have UTF-8
        support and in the case of Indic and other asian languages
        Complex layout rendering support and the necessary fonts.
---
 installer/data/mysql/sysprefs.sql                        |  1 +
 installer/data/mysql/updatedatabase.pl                   |  7 +++++++
 .../intranet-tmpl/prog/en/includes/doc-head-close.inc    | 16 ++++++++++++++++
 .../prog/en/modules/admin/preferences/i18n_l10n.pref     |  8 ++++++++
 4 files changed, 32 insertions(+)

diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index 0244f45..b9eb808 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -426,6 +426,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('useDaysMode','Calendar','Calendar|Days|Datedue','Choose the method for calculating due date: select Calendar to use the holidays module, and Days to ignore the holidays module','Choice'),
 ('UseICU','0','1','Tell Koha if ICU indexing is in use for Zebra or not.','YesNo'),
 ('UsejQueryIMEonOPAC','0','','If ON, enables browser based, multi-lingual jQuery.ime based input methods on the OPAC','YesNo'),
+('UsejQueryIMEonStaff','0','','If ON, enables browser based, multi-lingual jQuery.ime based input methods on the staff client','YesNo'),
 ('UseKohaPlugins','0','','Enable or disable the ability to use Koha Plugins.','YesNo'),
 ('UseQueryParser','0',NULL,'If enabled, try to use QueryParser for queries.','YesNo'),
 ('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'),
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 9e479c5..b336fc7 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -8676,6 +8676,13 @@ if ( CheckVersion($DBversion) ) {
     SetVersion ($DBversion);
 }
 
+$DBversion = "3.17.00.XXX";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('UsejQueryIMEonStaff','0','','If ON, enables browser based, multi-lingual jQuery.ime based input methods on the staff client','YesNo')");
+    print "Upgrade to $DBversion done (Bug 12815 - Adding support of jquery.ime to Koha staff client)\n";
+    SetVersion ($DBversion);
+}
+
 
 =head1 FUNCTIONS
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc
index f6269de..4313475 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc
@@ -3,6 +3,11 @@
 <link rel="stylesheet" type="text/css" href="[% interface %]/lib/jquery/jquery-ui.css" />
 <link rel="stylesheet" type="text/css" href="[% interface %]/lib/bootstrap/bootstrap.min.css" />
 <link rel="stylesheet" type="text/css" media="print" href="[% themelang %]/css/print.css" />
+
+[% IF ( Koha.Preference('UsejQueryIMEonStaff') ) %]
+<link rel="stylesheet" type="text/css" href="[% interface %]/lib/jquery.ime/css/jquery.ime.css" />
+[% END %]
+
 [% INCLUDE intranetstylesheet.inc %]
 [% IF ( bidi ) %]
    <link rel="stylesheet" type="text/css" href="[% themelang %]/css/right-to-left.css" />
@@ -16,6 +21,17 @@
 <script type="text/javascript" src="[% interface %]/lib/bootstrap/bootstrap.min.js"></script>
 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.validate.min.js"></script>
 
+[% IF ( Koha.Preference('UsejQueryIMEonStaff') ) %]
+<script type="text/javascript" src="[% interface %]/lib/jquery.ime/jquery.ime.min.js"></script>
+<script type="text/javascript">
+//<![CDATA[
+    $( document ).ready( function () {
+        $( "input:text, textarea" ).ime();
+    } );
+//]]>
+</script>
+[% END %]
+
 [% IF ( login ) %]
     <link rel="stylesheet" type="text/css" href="[% themelang %]/css/login.css" />
 [% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref
index 411bca8..95227a7 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref
@@ -58,3 +58,11 @@ I18N/L10N:
                   yes: Enable
                   no: "Do no enable"
             - on the OPAC.
+        -
+            - "Enable jQuery.IME "
+            - pref: UsejQueryIMEonStaff
+              default: 0
+              choices:
+                  yes: Enable
+                  no: "Do no enable"
+            - on the staff client.
-- 
1.8.1.2



More information about the Koha-patches mailing list