Code

Allow additional keyboard layouts per external file
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 9 Mar 2006 13:14:27 +0000 (13:14 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 9 Mar 2006 13:14:27 +0000 (13:14 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2833 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_terminalService.inc
plugins/admin/systems/class_workstationService.inc
plugins/admin/systems/terminalService.tpl
plugins/admin/systems/workstationService.tpl

index 7c47cb0b1b3b6fc334b2b15ca925e488081b16fd..e4eb153d7fb7b22e5bae64a7f568ae197637a29f 100644 (file)
@@ -48,7 +48,7 @@ class termservice extends plugin
       "logiinetnav", "logiinternet", "macintosh", "microsoft",
       "microsoftpro", "omnikey101", "pc101", "pc102", "pc104",
       "pc105", "rapidaccess", "rapidaccess2", "winbook");
-  var $XKbLayouts= array ("default", "de", "intl", "us");
+  var $XKbLayouts= array ("default"=>"default","de"=> "de","intl" =>"intl","us" =>"us");
   var $XKbVariants= array ("default", "nodeadkeys", "basic");
   var $MouseTypes= array("AUTO", "ImPS/2", "PS/2", "Microsoft", "Logitech");
   var $MousePorts= array("AUTO", "/dev/ttyS0", "/dev/ttyS1", "/dev/psaux", "/dev/input/mice");
@@ -71,6 +71,25 @@ class termservice extends plugin
   {
     plugin::plugin ($config, $dn);
 
+    
+    /* try to read additional keyboard layouts
+     */
+    if(file_exists(CONFIG_DIR."/keyboardLayouts")){
+      if(is_readable(CONFIG_DIR."/keyboardLayouts")){
+        $str = file_get_contents(CONFIG_DIR."/keyboardLayouts");
+        $tmp = split("\n",$str);
+        foreach($tmp as $entry){
+          if((!empty($entry)) && (!preg_match("/^#/",$entry))){
+            $entry = trim($entry);
+            $tmp2 = split ("\:",$entry);
+            $la =   trim($tmp2[0]);   // What would be saved to ldap
+            $da =   trim($tmp2[1]);   // This wis displayed in the listbox
+            $this->XKbLayouts [ $la] = $da;
+          }
+        }
+      }
+    }
+
     /* Load scanner models */
     $fcontents = file ($this->config->basedir."/include/scanner.inc");
     while (list ($line_num, $line) = each ($fcontents)) {
@@ -145,10 +164,13 @@ class termservice extends plugin
 
     /* Arrays */ 
     foreach(array("XMethods", "XDrivers", "XResolutions", "XColordepths",
-          "gotoScannerModels", "XKbModels", "XKbLayouts", "XKbVariants",
+          "gotoScannerModels", "XKbModels","XKbVariants",
           "MouseTypes", "MousePorts") as $val){
       $smarty->assign("$val", $this->$val);
     }
+    $smarty->assign("XKbLayouts",   $this->XKbLayouts);
+    $smarty->assign("XKbLayoutKeys",array_flip($this->XKbLayouts));
+  
     $smarty->assign("xdmcpservers", $this->config->data['SERVERS']['TERMINAL']);
     $smarty->assign("fontservers", $this->config->data['SERVERS']['FONT']);
     $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
index 6572c3fdbe8f8bec9eb3de34301409d215f83f97..2359b8566cb8eaebaf6738b4d9e7bc1e154c9dce 100644 (file)
@@ -43,7 +43,9 @@ class workservice extends plugin
       "logiinetnav", "logiinternet", "macintosh", "microsoft",
       "microsoftpro", "omnikey101", "pc101", "pc102", "pc104",
       "pc105", "rapidaccess", "rapidaccess2", "winbook");
-  var $XKbLayouts= array ("default", "de", "intl", "us");
+
+                    /* Additional values will be extracted from /etc/gosa/keyboardLayouts */
+  var $XKbLayouts= array ("default"=>"default","de"=> "de","intl" =>"intl","us" =>"us");
   var $XKbVariants= array ("default", "nodeadkeys", "basic");
   var $MouseTypes= array("AUTO", "ImPS/2", "PS/2", "Microsoft", "Logitech");
   var $MousePorts= array("AUTO", "/dev/ttyS0", "/dev/ttyS1", "/dev/psaux", "/dev/input/mice");
@@ -65,6 +67,24 @@ class workservice extends plugin
   {
     plugin::plugin ($config, $dn);
 
+    /* try to read additional keyboard layouts 
+     */
+    if(file_exists(CONFIG_DIR."/keyboardLayouts")){
+      if(is_readable(CONFIG_DIR."/keyboardLayouts")){
+        $str = file_get_contents(CONFIG_DIR."/keyboardLayouts");
+        $tmp = split("\n",$str);
+        foreach($tmp as $entry){
+          if((!empty($entry)) && (!preg_match("/^#/",$entry))){
+            $entry = trim($entry);
+            $tmp2 = split ("\:",$entry);
+            $la =   trim($tmp2[0]);   // What would be saved to ldap
+            $da =   trim($tmp2[1]);   // This wis displayed in the listbox
+            $this->XKbLayouts [ $la] = $da;  
+          } 
+        }
+      }
+    }
+    
     /* Initialize methods */
     $this->XMethods["default"]= _("default");
     $this->XMethods["indirect"]= _("show chooser");
@@ -137,10 +157,13 @@ class workservice extends plugin
 
     /* Arrays */ 
     foreach(array("XMethods", "XDrivers", "XResolutions", "XColordepths",
-          "XKbModels", "XKbLayouts", "XKbVariants",
+          "XKbModels", "XKbVariants",
           "MouseTypes", "MousePorts") as $val){
       $smarty->assign("$val", $this->$val);
     }
+    $smarty->assign("XKbLayouts"    ,$this->XKbLayouts);
+    $smarty->assign("XKbLayoutKeys" ,array_flip($this->XKbLayouts));
+
     $smarty->assign("xdmcpservers", $this->config->data['SERVERS']['TERMINAL']);
     $smarty->assign("fontservers", $this->config->data['SERVERS']['FONT']);
     $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
index fc856c88853456b17c18795e722867802111ddee..c757803949141646bfa0763ab1d929c837987211 100644 (file)
@@ -15,7 +15,7 @@
      <td><LABEL for="gotoXKbLayout">{t}Layout{/t}</LABEL></td>
      <td>
       <select id="gotoXKbLayout" name="gotoXKbLayout" title="{t}Choose keyboard layout{/t}" {$gotoXKbLayoutACL}>
-       {html_options values=$XKbLayouts output=$XKbLayouts selected=$gotoXKbLayout_select}
+       {html_options values=$XKbLayoutKeys output=$XKbLayouts selected=$gotoXKbLayout_select}
       </select>
      </td>
     </tr>
index 3346fca5ff807cf3110d448a1bf40a30cbe4e906..08d598125fbdea20dbb3ce415bd361d9fbb484d5 100644 (file)
@@ -15,7 +15,7 @@
      <td><LABEL for="gotoXKbLayout">{t}Layout{/t}</LABEL></td>
      <td>
       <select id="gotoXKbLayout" name="gotoXKbLayout" title="{t}Choose keyboard layout{/t}" {$gotoXKbLayoutACL}>
-       {html_options values=$XKbLayouts output=$XKbLayouts selected=$gotoXKbLayout_select}
+       {html_options values=$XKbLayoutKeys output=$XKbLayouts selected=$gotoXKbLayout_select}
       </select>
      </td>
     </tr>