diff --git a/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc b/trunk/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc
index 47a3da9d939fda67aac55933038af92f214ce26e..b5c8e3488a8c06a191593def1f3958031191f15a 100644 (file)
var $hardware_list= array();
var $used_hardware= array();
var $ogroup = FALSE;
+ var $member_of_ogroup = FALSE;
/* attribute list for save action */
var $attributes= array("gotoXMonitor", "gotoXDriver", "gotoXResolution", "gotoXColordepth",
var $XKbLayouts =array();
var $XKbVariants =array();
+ var $InheritXYSync = FALSE;
+
function workservice (&$config, $dn= NULL, $parent= NULL)
{
plugin::plugin ($config, $dn, $parent);
}
}
- if(preg_match("/\+/",$this->gotoXHsync)){
- $this->AutoSync = true;
- $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
- $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
+ if(isset($this->attrs['gotoXHsync']) && isset($this->attrs['gotoXYsync'])) {
+ $this->InheritXYSync = FALSE;
}
/* Workaround to fill in inherited values if we've specified an objectclass */
$this->XKbVariants= array('default' => _("inherited"));
$this->MouseTypes= array('default' => _("inherited"));
$this->MousePorts= array('default' => _("inherited"));
+ $this->member_of_ogroup = TRUE;
}
+
}
function execute()
/* Load hardware list */
$this->loadHardwareList();
+ if(preg_match("/\+/",$this->gotoXHsync)){
+ $this->AutoSync = true;
+ $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
+ $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
+ }
+
if($this->is_account && !$this->view_logged){
$this->view_logged = TRUE;
new log("view","workstation/".get_class($this),$this->dn);
$smarty->assign($name."ACL",$this->getacl($name));
}
+ $smarty->assign("member_of_ogroup", $this->member_of_ogroup);
+
/* Arrays */
foreach(array("XDrivers", "XResolutions", "XColordepths",
"XKbModels", "XKbVariants",
$smarty->assign("AutoSyncCHK"," ");
$smarty->assign("hiddenState","");
}
+ if($this->InheritXYSync) {
+ $smarty->assign("InheritXYSync", " checked ");
+ $smarty->assign("hiddenState", " disabled ");
+ $smarty->assign("AutoSynchiddenState", " disabled ");
+ } else {
+ $smarty->assign("InheritXYSync", "");
+ $smarty->assign("AutoSynchiddenState", "");
+ }
/* Show main page */
return($smarty->fetch (get_template_path('workstationService.tpl',TRUE,dirname(__FILE__))));
$this->AutoSync = false;
}
}
+ if(isset($_POST['workservicePosted'])) {
+ if(isset($_POST['InheritXYSync'])) {
+ $this->InheritXYSync = TRUE;
+ }else {
+ $this->InheritXYSync = FALSE;
+ }
+ }
}
/* Check supplied data */
if ($this->dn != "" && $this->cn != "default" && $this->cn != "wdefault"){
/* But only if no auto sync is enabled... */
- if (!$this->AutoSync){
+ if (!$this->AutoSync && !$this->InheritXYSync){
+
+
+ $vsync_empty = FALSE;
+ $hsync_empty = FALSE;
/* Check vsync for correct usage */
$val= preg_replace ("/\s/", "", $this->gotoXVsync);
if($this->acl_is_writeable("gotoXVsync")){
if(empty($val)){
- $message[]= msgPool::required(_("VSync"));
+ $vsync_empty = TRUE;
}elseif (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){
$message[]= msgPool::invalid(_("VSync"));
} else{
$val= preg_replace ("/\s/", "", $this->gotoXHsync);
if($this->acl_is_writeable("gotoXHsync")){
if(empty($val)){
- $message[]= msgPool::required(_("HSync"));
+ $hsync_empty = TRUE;
}elseif (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)){
$message[]= msgPool::invalid(_("HSync"));
} else{
}
}
}
+
+ /* Decide weither show empty value errors, if this is not an object group it
+ * will always be shown... */
+ $show_errors = TRUE;
+ if ($vsync_empty || $hsync_empty) {
+
+ if (isset($this->attrs['gosaGroupObjects'])) {
+ /* ... but an object group can contain empty values if both values are empty */
+ if ($vsync_empty != $hsync_empty) {
+ $show_errors = TRUE;
+ } else {
+ $show_errors = FALSE;
+ }
+ }
+ if ($show_errors && $vsync_empty) {
+ $message[]= msgPool::required(_("VSync"));
+ }
+ if ($show_errors && $hsync_empty) {
+ $message[] = msgPool::required(_("HSync"));
+ }
+ }
}
}
}
}
+ if($this->InheritXYSync) {
+ $this->attrs['gotoXHsync'] = array();
+ $this->attrs['gotoXVsync'] = array();
+ }
+
if($this->AutoSync){
$this->attrs['gotoXHsync'] = "30+55";
$this->attrs['gotoXVsync'] = "50+70";
$ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))");
}
if ($ldap->count() == 1){
+ $this->member_of_ogroup = TRUE;
$attrs= $ldap->fetch();
$map= array("gotoXResolution", "gotoXColordepth", "gotoXKbModel", "gotoXKbLayout",
- "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport", "gotoXDriver");
+ "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport", "gotoXDriver",
+ "gotoXVsync", "gotoXHsync"
+ );
+
foreach ($map as $name){
if (!isset($attrs[$name][0])){
continue;
}
-
+
switch ($name){
+ case 'gotoXHsync':
+ if (empty($this->$name) && !empty($attrs[$name])) {
+ $this->$name = $attrs[$name][0];
+ $this->InheritXYSync = TRUE;
+ }
+ break;
+ case 'gotoXVsync':
+ if (empty($this->$name) && !empty($attrs[$name])) {
+ $this->$name = $attrs[$name][0];
+ $this->InheritXYSync = TRUE;
+ }
+ break;
case 'gotoXDriver':
$ogroup_driver = $attrs['gotoXDriver'][0];
if (in_array($ogroup_driver, $this->XDrivers) && (empty($this->attrs['gotoXDriver']))) {