1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4
5<?php
6/**
7 * vkeyboard plugin initializer and unloader
8 * @author Myron Turner <turnermm02@shaw.ca>
9*/
10if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../../../').'/');
11define ('DOKU_CONF', DOKU_INC . 'conf/');
12
13if(file_exists(DOKU_CONF . 'dokuwiki.php')) {
14   include(DOKU_CONF . 'dokuwiki.php');
15}
16
17if(file_exists(DOKU_CONF . 'local.php')) {
18   include(DOKU_CONF . 'local.php');
19}
20
21@include('../lang/en/lang.php');
22if($conf['lang'] != 'en') {
23    $local_file = '../lang/' . $conf['lang'] . '/lang.php';
24    if(file_exists($local_file)) {
25       include($local_file);
26    }
27}
28function button_text($default, $item) {
29  global $lang;
30  if(isset($lang[$item])) {
31      echo $lang[$item];
32  }
33  else echo $default;
34}
35?>
36
37<HTML>
38<HEAD>
39<Title></Title>
40<script type="text/javascript">
41
42var vki_languages = new Array(
43    "Arabic",
44    "Assamese",
45    "Azerbaijani Cyrillic",
46    "Azerbaijani Latin",
47    "Belarusian",
48    "Belgian",
49    "Bulgarian Phonetic",
50    "Bulgarian BDS",
51    "Bengali",
52    "Bosnian",
53    "Canadian French",
54    "Czech",
55    "Danish",
56    "German",
57    "Dingbats",
58    "Divehi",
59    "Dvorak",
60    "Greek",
61    "Estonian",
62    "Spanish",
63    "Dari",
64    "Farsi",
65    "Faeroese",
66    "French",
67    "Irish / Gaelic",
68    "Gujarati",
69    "Hebrew",
70    "Devanagari",
71    "Hindi",
72    "Croatian",
73    "Western Armenian",
74    "Eastern Armenian",
75    "Icelandic",
76    "Italian",
77    "Japanese Hiragana/Katakana",
78    "Georgian",
79    "Kazakh",
80    "Khmer",
81    "Kannada",
82    "Korean",
83    "Kurdish",
84    "Kyrgyz",
85    "Latvian",
86    "Lithuanian",
87    "Hungarian",
88    "Maltese 48",
89    "Macedonian Cyrillic",
90    "Malayalam",
91    "Misc. Symbols",
92    "Mongolian Cyrillic",
93    "Marathi",
94    "Burmese",
95    "Dutch",
96    "Norwegian",
97    "Pashto",
98    "Punjabi (Gurmukhi)",
99    "Pinyin",
100    "Polish (214)",
101    "Polish Programmers",
102    "Portuguese (Brazil)",
103    "Portuguese",
104    "Romanian",
105    "Russian",
106    "Swiss German",
107    "Albanian",
108    "Slovak",
109    "Slovenian",
110    "Serbian Cyrillic",
111    "Serbian Latin",
112    "Finnish",
113    "Swedish",
114    "Swiss French",
115    "Syriac",
116    "Tamil",
117    "Telugu",
118    "Vietnamese",
119    "Thai Kedmanee",
120    "Thai Pattachote",
121    "Tatar",
122    "Turkish F",
123    "Turkish Q",
124    "Ukrainian",
125    "United Kingdom",
126    "Urdu",
127    "US Standard",
128    "US International",
129    "Uzbek Cyrillic",
130    "Chinese Bopomofo IME",
131    "Chinese Cangjie IME"
132);
133
134function getCookieValue() {
135
136var value;
137    var allcookies = document.cookie;
138    var pos = allcookies.indexOf('VKB');
139
140    if(pos != -1) {
141       var start = pos+3;
142       var end = allcookies.indexOf(';', start);
143       if(end == -1) end = allcookies.length;
144       value = allcookies.substring(start,end);
145    }
146    if(value) {
147         return('off' + '-' + value);
148    }
149    else return('off' + '-' + 'Greek');
150}
151
152function setKeyboard(setkb) {
153    var lang;
154    if(setkb) {
155        var oSelect = document.getElementById("vki_names");
156        var index = oSelect.selectedIndex;
157        if(index == 0  || !index) {
158               if(!confirm(
159                 "You haven\'t selected a language for the keyboard. The virtual keyboard will not load."
160                 + "\nClick OK to Exit, Click Cancel to Return to the Selection menu."
161                 ))
162                 return;
163             // else window.close();
164        }
165        lang =  oSelect.options[index].value;
166    }
167    else {
168      lang = getCookieValue();
169    }
170    var form = opener.document.getElementById('dw__editform');
171    var inputEl = opener.document.createElement('input');
172    inputEl.type = 'hidden';
173    inputEl.id = 'vkb';
174    inputEl.name = 'vkb';
175    inputEl.value = lang;
176    form.appendChild(inputEl);
177    window.close();
178}
179
180window.onload = function() {
181  var options = document.getElementById("vki_names").options;
182
183  options[0] = new Option('<?php button_text("Select initial keyboard language", "sel_none")?>', 'none',true);
184
185  for(var i=1; i<vki_languages.length;i++) {
186    options[i] =  new Option(vki_languages[i-1], vki_languages[i-1], false);
187  }
188
189}
190</script>
191<style type="text/css">
192p, .nine_pt, option, button { font-size: 9pt; }
193body { padding-left: 8px; padding-right:8px; }
194</style>
195
196</HEAD>
197<BODY>
198<h3><?php button_text("Virtual Keyboard",'header') ?></h3>
199<p id="about">
200<?php button_text( 'To initialize the virtual keyboard, select the intial language
201which the keyboard will display, then click the "Initialize Keyboad" button.
202Once the keyboard is in  place, you can select any other
203available language from its menu. You
204may also unload the virtual keyboard by clicking the "Unload Keyboard" button.
205Clicking "Exit" closes this window without any action.',"about"); ?>
206</p>
207
208<p id="warn">
209<?php button_text('After this window closes you must click either "Save" or "Cancel" in the editing window. If you click "Preview" your changes will be lost.', "warn"); ?>
210</p>
211
212
213<form name="vki_getnames">
214<table cellspacing='4'>
215<tr><td>
216<select id = "vki_names"></select><br />
217<tr><td>
218<input type='submit'class='nine_pt' value = "<?php button_text('Initialize Keyboad', 'button_ini') ?>" onclick="setKeyboard(true)">
219&nbsp;&nbsp;
220<input type='button' class='nine_pt' value="<?php button_text('Unload Keyboard', 'button_unload') ?>" onclick="setKeyboard(false)">
221&nbsp;&nbsp;
222<input type='button' class='nine_pt' value="<?php button_text('Exit', 'button_exit') ?>" onclick="window.close()">&nbsp;&nbsp;
223
224</table>
225</form>
226</BODY>
227</HTML>
228