X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-plugins%2Fgoto%2Fadmin%2Fsystems%2Fgoto%2Fclass_workstationService.inc;h=9db68641561576e5e4ec24b1f022ded8c97342b6;hb=a1b99a991d7fc72451c2fd558a33fead5b97e93d;hp=f3a7f17a15c52d155e5c3503335b8042cf880631;hpb=8e7a67036810003fc2bdf835f9bdb98b4eea3bbe;p=gosa.git diff --git a/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc b/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc index f3a7f17a1..9db686415 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc @@ -66,7 +66,7 @@ class workservice extends plugin if(is_readable($file)){ $str = file_get_contents($file); - $lines = split("\n",$str); + $lines = preg_split("/\n/",$str); foreach($lines as $line){ $line = trim($line); if(!empty($line)){ @@ -98,12 +98,18 @@ class workservice extends plugin $this->XKbModels[$type] = $type; } - $this->MouseTypes= array("ImPS/2" => "ImPS/2", "PS/2" => "PS/2", "Microsoft" => "Microsoft", - "Logitech" => "Logitech","explorerps/2"=>"explorerps/2",); + $this->MouseTypes= array("auto" => "auto", + "explorerps/2" => "explorerps/2", + "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"); + $this->MousePorts= array("/dev/input/mice" => "/dev/input/mice", + "/dev/mouse" => "/dev/mouse", + "/dev/psaux" => "/dev/psaux", + "/dev/ttyS0" => "/dev/ttyS0", + "/dev/ttyS1" => "/dev/ttyS1"); /* Additional values will be extracted from CONFIG_DIR./keyboardLayouts */ $this->XKbLayouts = array("de"=> "de","en" =>"en", "es" => "es", "us" =>"us", "fr" => "fr"); @@ -114,11 +120,11 @@ class workservice extends plugin if(file_exists(CONFIG_DIR."/keyboardLayouts")){ if(is_readable(CONFIG_DIR."/keyboardLayouts")){ $str = file_get_contents(CONFIG_DIR."/keyboardLayouts"); - $tmp = split("\n",$str); + $tmp = preg_split("/\n/",$str); foreach($tmp as $entry){ if((!empty($entry)) && (!preg_match("/^#/",$entry))){ $entry = trim($entry); - $tmp2 = split ("\:",$entry); + $tmp2 = explode(":",$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; @@ -178,7 +184,7 @@ class workservice extends plugin $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))"); if ($ldap->count() == 1){ $map= array("gotoXResolution", "gotoXColordepth", "gotoXKbModel", "gotoXKbLayout", - "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport"); + "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport", "gotoXDriver"); $attrs= $ldap->fetch(); foreach ($map as $name){ @@ -187,6 +193,9 @@ class workservice extends plugin } switch ($name){ + case 'gotoXDriver': + $this->XDrivers= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XDrivers; + break; case 'gotoXResolution': $this->XResolutions= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XResolutions; break; @@ -203,10 +212,10 @@ class workservice extends plugin $this->XKbVariants= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbVariants; break; case 'gotoXMouseType': - $this->MouseTypes= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MouseTypes; + $this->MouseTypes= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MouseTypes; break; case 'gotoXMouseport': - $this->MousePorts= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MousePorts; + $this->MousePorts= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MousePorts; break; } @@ -222,8 +231,8 @@ class workservice extends plugin $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")); + $this->MouseTypes= array('default' => _("inherited")); + $this->MousePorts= array('default' => _("inherited")); } } @@ -286,7 +295,6 @@ class workservice extends plugin foreach(array("gotoXHsync", "gotoXVsync") as $val){ $smarty->assign($val, $this->$val); } - $smarty->assign("staticAddress", ""); /* Checkboxes */ foreach(array("gotoScannerEnable") as $val){ @@ -374,13 +382,15 @@ class workservice extends plugin if($this->acl_is_writeable("gotoXVsync")){ if(empty($val)){ $message[]= msgPool::required(_("VSync")); - }elseif (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){ + }elseif (!preg_match ("/^\d+(\.\d+)?([+-]\d+(\.\d+)?)?$/", $val)){ $message[]= msgPool::invalid(_("VSync")); } else{ - list($v1,$v2)= preg_split ("/[-+]/", $val); - if ($v2 != ""){ - if ($v1 > $v2){ - $message[]= msgPool::invalid(_("VSync")); + if (!preg_match('/^\d+$/', $val)){ + list($v1,$v2)= preg_split ("/[-+]/", $val); + if ($v2 != ""){ + if ($v1 > $v2){ + $message[]= msgPool::invalid(_("VSync")); + } } } } @@ -394,10 +404,12 @@ class workservice extends plugin }elseif (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){ $message[]= msgPool::invalid(_("HSync")); } else{ - list($v1,$v2)= preg_split ("/[-+]/", $val); - if ($v2 != ""){ - if ($v1 > $v2){ - $message[]= msgPool::invalid(_("HSync")); + if (!preg_match('/^\d+$/', $val)){ + list($v1,$v2)= preg_split ("/[-+]/", $val); + if ($v2 != ""){ + if ($v1 > $v2){ + $message[]= msgPool::invalid(_("HSync")); + } } } } @@ -472,8 +484,13 @@ class workservice extends plugin "i128", "i740", "i810", "intel", "imstt", "mga", "neomagic", "newport", "nsc", "nv", "nvidia", "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion", "sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga", "vmware"); + } + $tmp = array(); + foreach($drivers as $name){ + $tmp[$name] = $name; } - return($drivers); + + return($tmp); } @@ -527,7 +544,7 @@ class workservice extends plugin */ $p = $this->parent->by_object['ogroup']; foreach($p->memberList as $dn => $obj){ - if(preg_match("/".preg_quote(get_ou("systemIncomingRDN"))."/",$dn)) continue; + if(preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$dn)) continue; if(isset($p->objcache[$dn]['macAddress']) && !empty($p->objcache[$dn]['macAddress'])){ $macs[] = $p->objcache[$dn]['macAddress']; } @@ -537,7 +554,7 @@ class workservice extends plugin /* We are a workstation. Add current mac. */ $mac = $this->parent->by_object['workgeneric']->netConfigDNS->macAddress; - if(!empty($mac) && !preg_match("/".preg_quote(get_ou("systemIncomingRDN"))."/",$this->orig_dn)){ + if(!empty($mac) && !preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$this->orig_dn)){ $macs[] = $mac; } }