X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_terminalService.inc;h=5a24d156a0a42366af1fc8367e8aab8e0ba5e6c1;hb=ea192ab4f2ec780c4e2f21820ba653c67da84bb3;hp=fc9f54b063f6f5475b8081f7533013aecd733dec;hpb=3082209baacc737659b444a6de4ed6ef5588faaf;p=gosa.git diff --git a/plugins/admin/systems/class_terminalService.inc b/plugins/admin/systems/class_terminalService.inc index fc9f54b06..5a24d156a 100644 --- a/plugins/admin/systems/class_terminalService.inc +++ b/plugins/admin/systems/class_terminalService.inc @@ -30,28 +30,25 @@ class termservice extends plugin var $gotoScannerBackend= ""; var $goFonHardware= "automatic"; + var $AutoSync = false; + /* Needed values and lists */ var $ignore_account= TRUE; var $base= ""; var $cn= ""; var $orig_dn= ""; var $XMethods= array(); - var $XDrivers= array("unknown", "ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", + var $XDrivers= array("ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "i128", "i740", "i810", "imstt", "mga", "neomagic", "newport", "nsc", "nv", "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion", - "sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga"); - var $XResolutions= array("default", "640x480", "800x600", "1024x768", "1152x864", "1280x1024", - "1400x1050", "1600x1200"); - var $XColordepths= array("default", "8", "15", "16", "24"); - var $XKbModels= array ("default", "btc9000", "chicony", "compaq", "dell", "dell101", "everex", - "flexpro", "geniuscomfy", "hp", "itouch", "jp106", "logicordless", - "logiinetnav", "logiinternet", "macintosh", "microsoft", - "microsoftpro", "omnikey101", "pc101", "pc102", "pc104", - "pc105", "rapidaccess", "rapidaccess2", "winbook"); - var $XKbLayouts= array ("default", "de", "intl", "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"); + "sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga", "vmware"); + var $XResolutions= array(); + var $XColordepths= array(); + var $XKbModels= array (); + var $XKbLayouts= array (); + var $XKbVariants= array (); + var $MouseTypes= array(); + var $MousePorts= array(); var $gotoScannerModels= array(); var $hardware_list= array(); var $used_hardware= array(); @@ -67,9 +64,86 @@ class termservice extends plugin var $objectclasses= array("GOhard"); - function termservice ($config, $dn= NULL) + function termservice ($config, $dn= NULL, $parent= NULL) { - plugin::plugin ($config, $dn); + plugin::plugin ($config, $dn, $parent); + + array_unshift($this->XDrivers, "["._("unknown")."]"); + + $this->XResolutions= array( + "default" => "["._("inherited")."]" , + "640x480" => "640x480", + "800x600" => "800x600", + "1024x768" => "1024x768", + "1152x864" => "1152x864", + "1280x1024" => "1280x1024", + "1400x1050" => "1400x1050", + "1600x1200" => "1600x1200"); + + if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){ + $file = $this->config->data['MAIN']['RESOLUTION_HOOK']; + + if(is_readable($file)){ + $str = file_get_contents($file); + $lines = split("\n",$str); + foreach($lines as $line){ + $line = trim($line); + if(!empty($line)){ + $this->XResolutions[$line]=$line; + } + } + //natcasesort($this->gotoXResolutions); + }else{ + print_red(sprintf(_("You have specified an external resolution hook which can't be read, please check the permission of the file '%s'."),$file)); + } + } + + $this->XColordepths= array( + "default" => "["._("inherited")."]", + "8" => "8 " ._("bit"), + "15" => "15 "._("bit"), + "16" => "16 "._("bit"), + "24" => "24 "._("bit")); + + $this->XKbModels['default']= "["._("inherited")."]"; + foreach(array ("btc9000", "chicony", "compaq", "dell", "dell101", "everex", + "flexpro", "geniuscomfy", "hp", "itouch", "jp106", "logicordless", + "logiinetnav", "logiinternet", "macintosh", "microsoft", + "microsoftpro", "omnikey101", "pc101", "pc102", "pc104", + "pc105", "rapidaccess", "rapidaccess2", "winbook") as $type){ + $this->XKbModels[$type] = $type; + } + + /* Additional values will be extracted from CONFIG_DIR.keyboardLayouts */ + $this->XKbLayouts= array ("default"=>"["._("inherited")."]","de"=> "de","intl" =>"intl","us" =>"us"); + $this->XKbVariants= array ("default"=>"["._("inherited")."]", "nodeadkeys"=>"nodeadkeys", "basic"=>"basic"); + + $this->MouseTypes= array( "AUTO" => "["._("inherited")."]" , "ImPS/2" => "ImPS/2", + "PS/2" => "PS/2" , "Microsoft" => "Microsoft", + "Logitech" => "Logitech"); + + $this->MousePorts= array("AUTO" =>"["._("inherited")."]" , "/dev/ttyS0" => "/dev/ttyS0", + "/dev/ttyS1" => "/dev/ttyS1" , "/dev/psaux" => "/dev/psaux", + "/dev/input/mice" =>"/dev/input/mice"); + + + /* 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"); @@ -121,12 +195,61 @@ class termservice extends plugin $this->hardware_list["automatic"]= _("automatic"); ksort($this->hardware_list); + + /* Convert gotoLpdEnable */ + $this->gotoLpdEnable= preg_match("/yes/i",$this->gotoLpdEnable); + + /* Load hardware list */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))"); + if ($ldap->count() == 1){ + $map= array("gotoXResolution", "gotoXColordepth", "gotoXKbModel", "gotoXKbLayout", + "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport"); + $attrs= $ldap->fetch(); + + foreach ($map as $name){ + if (!isset($attrs[$name][0])){ + continue; + } + + switch ($name){ + case 'gotoXResolution': + $this->XResolutions['default'] = _("inherited").' ['.$attrs[$name][0].']' ; + break; + case 'gotoXColordepth': + $this->XColordepths['default'] = _("inherited").' ['.$attrs[$name][0].' '._('Bit').']'; + break; + case 'gotoXKbModel': + $this->XKbModels['default'] = _("inherited").' ['.$attrs[$name][0].']'; + break; + case 'gotoXKbLayout': + $this->XKbLayouts['default'] = _("inherited").' ['.$attrs[$name][0].']'; + break; + case 'gotoXKbVariant': + $this->XKbVariants['default'] = _("inherited").' ['.$attrs[$name][0].']' ; + break; + case 'gotoXMouseType': + $this->MouseTypes['AUTO'] = _("inherited").' ['.$attrs[$name][0].']' ; + break; + case 'gotoXMouseport': + $this->MousePorts['AUTO'] = _("inherited").' ['.$attrs[$name][0].']' ; + break; + } + } + } + if(preg_match("/\+/",$this->gotoXHsync)){ + $this->AutoSync = true; + $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync); + $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync); + } } function execute() { /* Call parent execute */ plugin::execute(); + /* Do we need to flip is_account state? */ if (isset($_POST['modify_state'])){ $this->is_account= !$this->is_account; @@ -142,12 +265,22 @@ class termservice extends plugin /* Show main page */ $smarty= get_smarty(); + /* Assign acls */ + $tmp= $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation){ + $smarty->assign($name."ACL",$this->getacl($name)); + } + + /* 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']); @@ -160,13 +293,11 @@ class termservice extends plugin "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){ $smarty->assign($val."_select", $this->$val); - $smarty->assign($val."ACL", chkacl($this->acl, $val)); } /* Variables */ foreach(array("gotoXHsync", "gotoXVsync") as $val){ $smarty->assign($val, $this->$val); - $smarty->assign($val."ACL", chkacl($this->acl, $val)); } $smarty->assign("staticAddress", ""); @@ -177,14 +308,12 @@ class termservice extends plugin } else { $smarty->assign("$val", ""); } - $smarty->assign($val."ACL", chkacl($this->acl, "gotoLpdEnable")); } /* Phone stuff */ $smarty->assign ("goFonHardware", $this->goFonHardware); $hl= "