Code

Added H/V Sync behavior from workstation-service to terminal-service.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 23 Nov 2006 05:24:08 +0000 (05:24 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 23 Nov 2006 05:24:08 +0000 (05:24 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5199 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_terminalService.inc
plugins/admin/systems/terminalService.tpl

index 1d4ae885afaa7a91f6a43f3c50a3a2e460a183f3..4e3a5f07dd263b31ba268c5d460ab6cd44fb337d 100644 (file)
@@ -29,6 +29,7 @@ class termservice extends plugin
   var $gotoScannerClients= "";
   var $gotoScannerBackend= "";
   var $goFonHardware= "automatic";
+  var $AutoSync = false;
 
   /* Needed values and lists */
   var $ignore_account= TRUE;
@@ -236,6 +237,11 @@ class termservice extends plugin
         }
       }
     }
+    if(preg_match("/\+/",$this->gotoXHsync)){
+      $this->AutoSync = true;
+      $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
+      $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
+    }
   }
 
   function execute()
@@ -321,6 +327,17 @@ class termservice extends plugin
     $smarty->assign ("hardware_list", $hl);
     $smarty->assign ("gotoXMonitor", $this->gotoXMonitor);
 
+    $smarty->assign("AutoSyncACL",chkacl($this->acl,"AutoSync"));
+  
+    if($this->AutoSync){
+      $smarty->assign("AutoSyncCHK"," checked ");
+      $smarty->assign("hiddenState"," disabled ");
+    }else{
+      $smarty->assign("AutoSyncCHK"," ");
+      $smarty->assign("hiddenState","");
+    }
+
+  
     /* Show main page */
     return($smarty->fetch (get_template_path('terminalService.tpl', TRUE)));
   }
@@ -346,7 +363,15 @@ class termservice extends plugin
           $this->$val= TRUE;
         }
       }
+    } 
+    if(isset($_POST['gotoXDriver'])){
+      if(isset($_POST['AutoSync'])){
+        $this->AutoSync = true;
+      }else{
+        $this->AutoSync = false;
+      }
     }
+
   }
 
 
@@ -355,6 +380,45 @@ class termservice extends plugin
   {
     /* Call common method to give check the hook */
     $message= plugin::check();
+
+    /* Default entries can use blank hsync/vsync entries */
+    if ($this->dn != "" && $this->cn != "default" && $this->cn != "default"){
+
+      /* But only if no auto sync is enabled... */
+      if (!$this->AutoSync){
+
+        /* Check vsync for correct usage */
+        $val= preg_replace ("/\s/", "", $this->gotoXVsync);
+        if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)
+            && chkacl ($this->acl, "gotoXVsync") == ""){
+
+          $message[]= _("Please specify a valid VSync range.");
+        } elseif (chkacl ($this->acl, "gotoXVsync") == ""){
+          list($v1,$v2)= preg_split ("/[-+]/", $val);
+          if ($v2 != ""){
+            if ($v1 > $v2){
+              $message[]= _("Please specify a valid VSync range.");
+            }
+          }
+        }
+
+        /* Check hsync for correct usage */
+        $val= preg_replace ("/\s/", "", $this->gotoXHsync);
+        if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)
+            && chkacl ($this->acl, "gotoXHsync") == ""){
+
+          $message[]= _("Please specify a valid HSync range.");
+        } elseif (chkacl ($this->acl, "gotoXHsync") == ""){
+          list($v1,$v2)= preg_split ("/[-+]/", $val);
+          if ($v2 != ""){
+            if ($v1 > $v2){
+              $message[]= _("Please specify a valid HSync range.");
+            }
+          }
+        }
+      }
+    }
+
     return ($message);
   }
 
@@ -378,6 +442,11 @@ class termservice extends plugin
       }
     }
 
+    if($this->AutoSync){
+      $this->attrs['gotoXHsync'] = "30+55";
+      $this->attrs['gotoXVsync'] = "50+70";
+    }
+
     /* Write back to ldap */
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->dn);
index db8fc0e295597ec1827b3d730bd0c9d8c0ac1dc7..24de0165e8919ce4d182d46d7ae293c475e7aa30 100644 (file)
      <td>{t}Type{/t}</td>
      <td>{$gotoXMonitor}</td>
     </tr>
+    <tr>
+     <td><input type="checkbox" name="AutoSync" value="1" {$AutoSyncACL} {$AutoSyncCHK} onChange="changeState('gotoXHsync');changeState('gotoXVsync');"></td>
+     <td>{t}Use DDC for automatic detection{/t}</td>
+    </tr>
+
     <tr>
      <td><LABEL for="gotoXHsync">{t}HSync{/t}</LABEL></td>
-     <td><input id="gotoXHsync" name="gotoXHsync" size=10 maxlength=60 {$gotoXHsyncACL}
+     <td><input id="gotoXHsync" name="gotoXHsync" size=10 maxlength=60 {$gotoXHsyncACL} {$hiddenState}
                 value="{$gotoXHsync}" title="{t}Horizontal refresh frequency for installed monitor{/t}"> kHz</td>
     </tr>
     <tr>
      <td><LABEL for="gotoXVsync">{t}VSync{/t}</LABEL></td>
-     <td><input id="gotoXVsync"  name="gotoXVsync" size=10 maxlength=60 {$gotoXVsyncACL}
+     <td><input id="gotoXVsync"  name="gotoXVsync" size=10 maxlength=60 {$gotoXVsyncACL} {$hiddenState}
                 value="{$gotoXVsync}" title="{t}Vertical refresh frequency for installed monitor{/t}"> Hz</td>
     </tr>
    </table>