X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_workstationService.inc;h=54af9393d7f4567a411d4a39d24d587c35b5c3a4;hb=83bf4784d9c121ae787dd9b266a24ae2f56c7b83;hp=ffbb2cbce859f11c220dcc23a1fff68b0f4c30dc;hpb=07e6492263fef837908f515518bd362b433a44ce;p=gosa.git diff --git a/plugins/admin/systems/class_workstationService.inc b/plugins/admin/systems/class_workstationService.inc index ffbb2cbce..54af9393d 100644 --- a/plugins/admin/systems/class_workstationService.inc +++ b/plugins/admin/systems/class_workstationService.inc @@ -2,11 +2,6 @@ class workservice extends plugin { - /* CLI vars */ - var $cli_summary= "Manage terminal service aspects"; - var $cli_description= "Some longer text\nfor help"; - var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser"); - var $gotoScannerEnable; /* Generic terminal attributes */ var $gotoXMonitor= ""; @@ -31,24 +26,15 @@ class workservice extends plugin 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", "vmware"); - 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"); - - /* 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"); + + var $XResolutions = array(); + + var $MouseTypes= array(); + var $MousePorts= array(); var $hardware_list= array(); var $used_hardware= array(); @@ -62,10 +48,68 @@ class workservice extends plugin "gotoXMouseType", "gotoXMouseport", "goFonHardware"); var $objectclasses= array("GOhard"); + var $XColordepths =array(); + var $XKbModels =array(); + var $XKbLayouts =array(); + var $XKbVariants =array(); - function workservice ($config, $dn= NULL) + function workservice ($config, $dn= NULL, $parent= NULL) { - plugin::plugin ($config, $dn); + plugin::plugin ($config, $dn, $parent); + + $this->XResolutions= array( + "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)); + } + } + + array_unshift($this->XDrivers, "["._("unknown")."]"); + + $this->XColordepths= array( + "8" => "8 " ._("bit"), + "15" => "15 "._("bit"), + "16" => "16 "._("bit"), + "24" => "24 "._("bit")); + + 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; + } + + $this->MouseTypes= array("ImPS/2" => "ImPS/2", "PS/2" => "PS/2", "Microsoft" => "Microsoft", + "Logitech" => "Logitech"); + + $this->MousePorts= array("/dev/ttyS0" =>"/dev/ttyS0", + "/dev/ttyS1" => "/dev/ttyS1", "/dev/psaux" =>"/dev/psaux", + "/dev/input/mice" => "/dev/input/mice"); + + /* Additional values will be extracted from CONFIG_DIR/gosa/keyboardLayouts */ + $this->XKbLayouts= array ("de"=> "de","intl" =>"intl","us" =>"us"); + $this->XKbVariants= array ("basic"=>"basic", "nodeadkeys"=>"nodeadkeys"); /* try to read additional keyboard layouts */ @@ -84,16 +128,15 @@ class workservice extends plugin } } } - + /* Initialize methods */ - $this->XMethods["default"]= _("default"); $this->XMethods["indirect"]= _("show chooser"); $this->XMethods["query"]= _("direct"); -#$this->XMethods["squery"]= _("direct via ssh"); -#$this->XMethods["nquery"]= _("direct via nx"); + #$this->XMethods["squery"]= _("direct via ssh"); + #$this->XMethods["nquery"]= _("direct via nx"); $this->XMethods["load"]= _("load balanced"); -#$this->XMethods["sload"]= _("load balanced via ssh"); -#$this->XMethods["nload"]= _("load balanced via nx"); + #$this->XMethods["sload"]= _("load balanced via ssh"); + #$this->XMethods["nload"]= _("load balanced via nx"); $this->XMethods["rdp"]= _("Windows RDP"); $this->XMethods["citrix"]= _("ICA client"); @@ -133,12 +176,65 @@ class workservice extends plugin $this->hardware_list["automatic"]= _("automatic"); ksort($this->hardware_list); + + /* 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= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XResolutions; + break; + case 'gotoXColordepth': + $this->XColordepths= array('default' => _("inherited").' ['.$attrs[$name][0].' '._('Bit').']') + $this->XColordepths; + break; + case 'gotoXKbModel': + $this->XKbModels= array('default' => _("inherited").' ['.$attrs[$name][0].']') + $this->XKbModels; + break; + case 'gotoXKbLayout': + $this->XKbLayouts= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbLayouts; + break; + case 'gotoXKbVariant': + $this->XKbVariants= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbVariants; + break; + case 'gotoXMouseType': + $this->MouseTypes= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MouseTypes; + break; + case 'gotoXMouseport': + $this->MousePorts= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MousePorts; + break; + } + + } + + } + + /* Workaround to fill in inherited values if we've specified an objectclass */ + if (isset($_SESSION['SelectedSystemType']['ogroup']) && $_SESSION['SelectedSystemType']['ogroup'] != 'none'){ + $this->XResolutions= array('default' => _("inherited")); + $this->XColordepths= array('default' => _("inherited")); + $this->XKbModels= array('default' => _("inherited")); + $this->XKbLayouts= array('default' => _("inherited")); + $this->XKbVariants= array('default' => _("inherited")); + $this->MouseTypes= array('AUTO' => _("inherited")); + $this->MousePorts= array('AUTO' => _("inherited")); + } } function execute() { - /* Call parent execute */ - plugin::execute(); + /* Call parent execute */ + plugin::execute(); /* Do we need to flip is_account state? */ if (isset($_POST['modify_state'])){ @@ -198,8 +294,8 @@ class workservice extends plugin /* Phone stuff */ $smarty->assign ("goFonHardware", $this->goFonHardware); $hl= "