Code

Added auto field for H-v sync
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 12 Jan 2006 10:19:51 +0000 (10:19 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 12 Jan 2006 10:19:51 +0000 (10:19 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2457 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_workstationService.inc
plugins/admin/systems/workstationService.tpl

index dd41f8bc3d1a70065dd92b962a37876d8cde99ab..c80b799fba8e8fe22e1027895e2573d1265df4e1 100644 (file)
@@ -15,6 +15,7 @@ class workservice extends plugin
   var $gotoXColordepth= "";
   var $gotoXHsync= "";
   var $gotoXVsync= "";
+  var $AutoSync = false;
   var $gotoXKbModel= "";
   var $gotoXKbLayout= "";
   var $gotoXKbVariant= "";
@@ -104,6 +105,12 @@ class workservice extends plugin
       }
     }
 
+    if(preg_match("/\+/",$this->gotoXHsync)){
+      $this->AutoSync = true;
+      $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
+      $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
+    }
+
     $this->hardware_list["automatic"]= _("automatic");
     ksort($this->hardware_list);
   }
@@ -186,6 +193,13 @@ class workservice extends plugin
     $hl.= "</select>\n";
     $smarty->assign ("hardware_list", $hl);
     $smarty->assign ("gotoXMonitor", $this->gotoXMonitor);
+    $smarty->assign("AutoSyncACL",chkacl($this->acl,"AutoSync"));
+
+    if($this->AutoSync){
+      $smarty->assign("AutoSyncCHK"," checked ");
+    }else{
+      $smarty->assign("AutoSyncCHK"," ");
+    }
 
     /* Show main page */
     return($smarty->fetch (get_template_path('workstationService.tpl',TRUE,dirname(__FILE__))));
@@ -196,15 +210,20 @@ class workservice extends plugin
       $this->handle_post_events("remove");
   }
 
-
   /* Save data to object */
   function save_object()
   {
     plugin::save_object();
 
+    if(isset($_POST['gotoXHsync'])){
+      if(isset($_POST['AutoSync'])){
+        $this->AutoSync = true;
+      }else{
+        $this->AutoSync = false;
+      }
+    }
   }
 
-
   /* Check supplied data */
   function check()
   {
@@ -215,7 +234,7 @@ class workservice extends plugin
 
       /* Check vsync for correct usage */
       $val= preg_replace ("/\s/", "", $this->gotoXVsync);
-      if (!preg_match ("/^\d+(\.\d+)?([-+]\d+(\.\d+)?)?$/", $val)
+      if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)
           && chkacl ($this->acl, "gotoXVsync") == ""){
 
         $message[]= _("Please specify a valid VSync range.");
@@ -230,7 +249,7 @@ class workservice extends plugin
 
       /* Check hsync for correct usage */
       $val= preg_replace ("/\s/", "", $this->gotoXHsync);
-      if (!preg_match ("/^\d+(\.\d+)?([-+]\d+(\.\d+)?)?$/", $val)
+      if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)
           && chkacl ($this->acl, "gotoXHsync") == ""){
 
         $message[]= _("Please specify a valid HSync range.");
@@ -263,6 +282,11 @@ class workservice extends plugin
       }
     }
 
+    if($this->AutoSync){
+      $this->attrs['gotoXHsync'] = preg_replace("/-/","+",$this->attrs['gotoXHsync']) ;
+      $this->attrs['gotoXVsync'] = preg_replace("/-/","+",$this->attrs['gotoXVsync']) ;
+    }
+
     /* Write back to ldap */
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->dn);
index 1cde8e980c88db651867b9f538b844ffdc5c61a0..3346fca5ff807cf3110d448a1bf40a30cbe4e906 100644 (file)
    <table summary="">
     <tr>
      <td>{t}Type{/t}</td>
-     <td>{$gotoXMonitor}</td>
+     <td>{if $gotoXMonitor==""}{t}unknown{/t}{/if}{$gotoXMonitor}</td>
+    </tr>
+    <tr>
+       <td><input type="checkbox" name="AutoSync" value="1" {$AutoSyncACL} {$AutoSyncCHK}>
+       </td>
+       <td>{t}Automatic modelines{/t}
+       </td>
     </tr>
     <tr>
      <td><LABEL for="gotoXHsync">{t}HSync{/t}</LABEL></td>