[Koha-patches] [PATCH 3/4] Bug 12815 [ENH] Patch 3 of 4 - Add jQuery.IME support to OPAC

Indranil Das Gupta indradg at gmail.com
Thu Aug 28 02:45:46 CEST 2014


Third patch in the set and should be applied in that sequence.
Adds UsejQueryIMEonOPAC syspref and updates sysprefs.sql and
updatedatabase.pl accordingly. Also updates i18n_l10n.pref, by
introducing sub-sections - Date and Time, Language Support and
Multi-lingual keyboard; with UsejQueryIMEonOPAC syspref being
added under Multi-lingual keyboard sub-section.

Test plan

1) Apply patches

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 UsejQueryIMEonOPAC
   system preference. Open the OPAC, and click inside the search box
   after page load. You should see small keyboard graphics attached
   to the bottom right edge of the search box.

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.

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.

NOTE 2: A set of screenshot showing steps 5, 6 and 7 using the OPAC.

        (a) Default view with IM active     - http://imgur.com/a/2gB7H#3
        (b) Selecting the language          - http://imgur.com/a/2gB7H#1
        (c) Search box showing input method - http://imgur.com/a/2gB7H#0
        (d) Typing using Hindi Inscript im  - http://imgur.com/a/2gB7H#2
---
 installer/data/mysql/sysprefs.sql                  |   1 +
 installer/data/mysql/updatedatabase.pl             |   7 ++
 .../en/modules/admin/preferences/i18n_l10n.pref    | 104 ++++++++++++---------
 .../bootstrap/en/includes/doc-head-close.inc       |   5 +
 .../bootstrap/en/includes/opac-bottom.inc          |  12 +++
 5 files changed, 84 insertions(+), 45 deletions(-)

diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index 7eb08a8..0244f45 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -425,6 +425,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('UseCourseReserves','0',NULL,'Enable the course reserves feature.','YesNo'),
 ('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'),
 ('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 ad2f409..9e479c5 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -8669,6 +8669,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 ('UsejQueryIMEonOPAC','0','','If ON, enables browser based, multi-lingual jQuery.ime based input methods on the OPAC','YesNo')");
+    print "Upgrade to $DBversion done (Bug 12815 - Adding support of jquery.ime to Koha OPAC)\n";
+    SetVersion ($DBversion);
+}
+
 
 =head1 FUNCTIONS
 
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 02985d3..411bca8 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
@@ -1,46 +1,60 @@
 I18N/L10N:
-    -
-        - Format dates like
-        - pref: dateformat
-          default: us
-          choices:
-              us: mm/dd/yyyy
-              metric: dd/mm/yyyy
-              iso: yyyy-mm-dd
-        - .
-    -
-        - Format times in
-        - pref: TimeFormat
-          default: 24hr
-          choices:
-              24hr: 24 hour format ( e.g. "14:18" )
-              12hr: 12 hour format ( e.g. "02:18 PM" )
-        - .
-    -
-        - Use
-        - pref: CalendarFirstDayOfWeek
-          default: Sunday
-          choices:
-              Sunday: Sunday
-              Monday: Monday
-        - as the first day of week in the calendar.
-    -
-        - "Enable the following languages on the staff interface:"
-        - pref: language
-          type: staff-languages
-    -
-        - pref: opaclanguagesdisplay
-          default: 0
-          choices:
-              yes: Allow
-              no: "Don't allow"
-        - patrons to change the language they see on the OPAC.
-    -
-        - "Enable the following languages on the OPAC:"
-        - pref: opaclanguages
-          type: opac-languages
-    -
-        - "Use the alphabet"
-        - pref: alphabet
-          class: long
-        - for lists of browsable letters. This should be a space separated list of uppercase letters.
+    Date and Time:
+        -
+            - Format dates like
+            - pref: dateformat
+              default: us
+              choices:
+                  us: mm/dd/yyyy
+                  metric: dd/mm/yyyy
+                  iso: yyyy-mm-dd
+            - .
+        -
+            - Format times in
+            - pref: TimeFormat
+              default: 24hr
+              choices:
+                  24hr: 24 hour format ( e.g. "14:18" )
+                  12hr: 12 hour format ( e.g. "02:18 PM" )
+            - .
+        -
+            - Use
+            - pref: CalendarFirstDayOfWeek
+              default: Sunday
+              choices:
+                  Sunday: Sunday
+                  Monday: Monday
+            - as the first day of week in the calendar.
+        -
+    Language Support:
+        -
+            - "Enable the following languages on the staff interface:"
+            - pref: language
+              type: staff-languages
+        -
+            - pref: opaclanguagesdisplay
+              default: 0
+              choices:
+                  yes: Allow
+                  no: "Don't allow"
+            - patrons to change the language they see on the OPAC.
+        -
+            - "Enable the following languages on the OPAC:"
+            - pref: opaclanguages
+              type: opac-languages
+        -
+            - "Use the alphabet"
+            - pref: alphabet
+              class: long
+            - for lists of browsable letters. This should be a space separated list of uppercase letters.
+    Multi-lingual keyboard:
+        -
+            - <strong>NOTE:</strong> <a href="https://github.com/wikimedia/jquery.ime" target="_blank">jQuery.IME</a> is a jQuery based input method editor supporting over 135 input methods across more than 62 languages.
+        -
+            - "Enable jQuery.IME "
+            - pref: UsejQueryIMEonOPAC
+              default: 0
+              choices:
+                  yes: Enable
+                  no: "Do no enable"
+            - on the OPAC.
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc
index c3e2d83..82becd5 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc
@@ -41,6 +41,11 @@
 [% IF ( OPACUserCSS ) %]<style type="text/css">[% OPACUserCSS %]</style>[% END %]
 <link rel="unapi-server" type="application/xml" title="unAPI" href="[% OPACBaseURL %]/cgi-bin/koha/unapi" />
 [% PROCESS cssinclude %]
+
+[% IF ( Koha.Preference('UsejQueryIMEonOPAC') ) %]
+<link rel="stylesheet" type="text/css" href="[% interface %]/lib/jquery.ime/css/jquery.ime.css" />
+[% END %]
+
 <!-- Respond.js brings responsive layout behavior to IE < v.9 -->
 <!--[if lt IE 9]>
     <script src="[% interface %]/[% theme %]/lib/respond.min.js"></script>
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
index 4128061..37820e6 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
@@ -202,6 +202,18 @@ $.widget.bridge('uitooltip', $.ui.tooltip);
     <script type="text/javascript" src="http://www.google.com/jsapi"></script>
     <script type="text/javascript" src="[% interface %]/[% theme %]/js/googleindictransliteration.js"></script>
 [% END %]
+
+[% IF ( Koha.Preference('UsejQueryIMEonOPAC') ) %]
+    <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 persona %]
     <script src="https://login.persona.org/include.js"></script>
     <script type="text/javascript">
-- 
1.8.1.2



More information about the Koha-patches mailing list