diff --git a/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc b/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc
index 6196913603eced98f9665ca62e60f15af43383c1..9db68641561576e5e4ec24b1f022ded8c97342b6 100644 (file)
class workservice extends plugin
{
var $gotoScannerEnable;
- var $gotoLpdEnable = array();
/* Generic terminal attributes */
var $gotoXMonitor= "";
/* attribute list for save action */
- var $attributes= array("gotoXMonitor","gotoLpdEnable",
- "gotoXDriver", "gotoXResolution", "gotoXColordepth",
+ var $attributes= array("gotoXMonitor", "gotoXDriver", "gotoXResolution", "gotoXColordepth",
"gotoXHsync", "gotoXVsync",
"gotoScannerEnable", "gotoScannerClients",
"gotoScannerBackend", "gotoXKbModel", "gotoXKbLayout", "gotoXKbVariant",
"1400x1050" => "1400x1050",
"1600x1200" => "1600x1200");
- /* Load gotoLpdEnable
- */
- $this->gotoLpdEnable = array();
- if(isset($this->attrs['gotoLpdEnable']['count'])){
- for($i = 0 ; $i < $this->attrs['gotoLpdEnable']['count']; $i ++){
- $this->gotoLpdEnable[] = $this->attrs['gotoLpdEnable'][$i];
- }
- }
-
if($this->config->get_cfg_value("resolutions") != ""){
$file = $this->config->get_cfg_value("resolutions");
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)){
$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");
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;
$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){
}
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;
$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;
}
$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"));
}
}
}
}
-
- /**********
- gotoLpdEnable
- **********/
- if(isset($_POST['gotoLpdEnable_Close'])){
- $this->dialog = NULL;
- }
-
- if(isset($_POST['gotoLpdEnable_Ok'])){
- $this->dialog->save_object();
- $msgs = $this->dialog->check();
- if(count($msgs)) {
- msg_dialog::displayChecks($msgs);
- }else{
- $this->gotoLpdEnable = $this->dialog->save();
- $this->dialog = NULL;
- }
- }
-
- if(isset($_POST['gotoLpdEnable_Edit'])){
- $this->dialog = new gotoLpdEnable($this->config,$this->gotoLpdEnable,$this);
- }
-
- if($this->dialog instanceof plugin){
- $this->dialog->save_object();
- return($this->dialog->execute());
- }
-
-
- /**********
- Ende: gotoLpdEnable
- **********/
-
-
/* Show main page */
$smarty= get_smarty();
foreach(array("gotoXHsync", "gotoXVsync") as $val){
$smarty->assign($val, $this->$val);
}
- $smarty->assign("staticAddress", "");
/* Checkboxes */
foreach(array("gotoScannerEnable") as $val){
$val= preg_replace ("/\s/", "", $this->gotoXVsync);
if($this->acl_is_writeable("gotoXVsync")){
- if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){
+ if(empty($val)){
+ $message[]= msgPool::required(_("VSync"));
+ }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"));
+ }
}
}
}
/* Check hsync for correct usage */
$val= preg_replace ("/\s/", "", $this->gotoXHsync);
if($this->acl_is_writeable("gotoXHsync")){
- if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){
+ if(empty($val)){
+ $message[]= msgPool::required(_("HSync"));
+ }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"));
+ }
}
}
}
"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);
}
"gotoXVsync" => _("VSync"),
"AutoSync" => _("Use DDC"),
"gotoScannerEnable" => _("Scanner enabled"),
- "gotoLpdEnable" => _("Printer enabled"),
"gotoXKbModel" => _("Keyboard model"),
"gotoXKbLayout" => _("Keyboard layout"),
"gotoXKbVariant" => _("Keyboard variant"),
*/
$p = $this->parent->by_object['ogroup'];
foreach($p->memberList as $dn => $obj){
- if(preg_match("/".normalizePreg(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'];
}
/* We are a workstation. Add current mac.
*/
$mac = $this->parent->by_object['workgeneric']->netConfigDNS->macAddress;
- if(!empty($mac) && !preg_match("/".normalizePreg(get_ou("systemIncomingRDN"))."/",$this->orig_dn)){
+ if(!empty($mac) && !preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$this->orig_dn)){
$macs[] = $mac;
}
}