From: hickert Date: Thu, 9 Mar 2006 13:14:27 +0000 (+0000) Subject: Allow additional keyboard layouts per external file X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d4647004d89f016d23f4a54b988ef768a5350966;p=gosa.git Allow additional keyboard layouts per external file git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2833 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_terminalService.inc b/plugins/admin/systems/class_terminalService.inc index 7c47cb0b1..e4eb153d7 100644 --- a/plugins/admin/systems/class_terminalService.inc +++ b/plugins/admin/systems/class_terminalService.inc @@ -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']); diff --git a/plugins/admin/systems/class_workstationService.inc b/plugins/admin/systems/class_workstationService.inc index 6572c3fdb..2359b8566 100644 --- a/plugins/admin/systems/class_workstationService.inc +++ b/plugins/admin/systems/class_workstationService.inc @@ -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']); diff --git a/plugins/admin/systems/terminalService.tpl b/plugins/admin/systems/terminalService.tpl index fc856c888..c75780394 100644 --- a/plugins/admin/systems/terminalService.tpl +++ b/plugins/admin/systems/terminalService.tpl @@ -15,7 +15,7 @@ diff --git a/plugins/admin/systems/workstationService.tpl b/plugins/admin/systems/workstationService.tpl index 3346fca5f..08d598125 100644 --- a/plugins/admin/systems/workstationService.tpl +++ b/plugins/admin/systems/workstationService.tpl @@ -15,7 +15,7 @@