Code

Added translation tags to property description.
[gosa.git] / gosa-plugins / goto / admin / systems / goto / class_terminalGeneric.inc
index 4737b7fde59704be187386746f8f7f112b5a9645..ca979e91b47e4d36a41d20cab4d8180397f90820 100644 (file)
@@ -61,10 +61,7 @@ class termgeneric extends plugin
   function termgeneric (&$config, $dn= NULL, $parent= NULL)
   {
     /* Check if FAI is activated */
-    $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs'));
-    if(!empty($tmp)){
-      $this->fai_activated = TRUE;
-    }
+    $this->fai_activated = $config->pluginEnabled("faiManagement");
 
     plugin::plugin ($config, $dn, $parent);
 
@@ -128,8 +125,10 @@ class termgeneric extends plugin
     if ($this->dn == "new"){
       $ui= get_userinfo();
       $this->base= dn2base(session::global_is_set("CurrentMainBase")?"cn=dummy,".session::global_get("CurrentMainBase"):$ui->dn);
+    } elseif(preg_match("/".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN"), '/')."/i", $this->dn)){
+      $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN"), '/')."/i", "", $this->dn);
     } else {
-      $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("terminalRDN"), '/')."/i", "", $this->dn);
+      $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("termgeneric", "terminalRDN"), '/')."/i", "", $this->dn);
     }
 
     /* Create an array of all Syslog servers */
@@ -224,7 +223,7 @@ class termgeneric extends plugin
 
     /* Fill templating stuff */
     $smarty= get_smarty();
-    $smarty->assign("usePrototype", "true");
+
     
     $tmp = $this->plInfo();
     foreach($tmp['plProvidedAcls'] as $name => $translation){
@@ -233,7 +232,6 @@ class termgeneric extends plugin
 
     $smarty->assign("cn", $this->cn);
     $smarty->assign("description", $this->description);
-    $smarty->assign("staticAddress", "");
 
     /* tell smarty the inherit checkbox state */
     $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
@@ -422,12 +420,17 @@ class termgeneric extends plugin
     }
 
     /* Permissions for that base? */
-    $this->dn= "cn=".$this->cn.",".get_ou('terminalRDN').$this->base;
+    $this->dn= "cn=".$this->cn.",".get_ou("termgeneric", "terminalRDN").$this->base;
 
     if ($this->cn == ""){
       $message[]= msgPool::required(_("Name"));
     }
 
+    // Check if a wrong base was supplied
+    if(!$this->baseSelector->checkLastBaseUpdate()){
+      $message[]= msgPool::check_base();
+    }
+
     /* Check if given name is a valid host/dns name */
     if(!tests::is_dns_name($this->cn) ){
       $message[] = msgPool::invalid(_("Name"));
@@ -445,7 +448,7 @@ class termgeneric extends plugin
       }
       if ($ldap->count() != 0){
         while ($attrs= $ldap->fetch()){
-          if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou('systemIncomingRDN'), '/')."/i", $ldap->getDN())){
+          if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou("ArpNewDevice", "systemIncomingRDN"), '/')."/i", $ldap->getDN())){
             continue;
           } else {
             if ($attrs['dn'] != $this->orig_dn){
@@ -490,7 +493,7 @@ class termgeneric extends plugin
       $ldap= $this->config->get_ldap_link();
 
       /* Strip relevant part from dn, keep trailing ',' */
-      $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou('terminalRDN'), '/')."/i", "", $this->dn);
+      $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou("termgeneric", "terminalRDN"), '/')."/i", "", $this->dn);
       $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
 
       /* Walk from top to base and try to load default values for
@@ -498,7 +501,7 @@ class termgeneric extends plugin
       while (TRUE){
         $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
 
-        $ldap->cat("cn=default,".get_ou('terminalRDN').$tmp.
+        $ldap->cat("cn=default,".get_ou("termgeneric", "terminalRDN").$tmp.
             $this->config->current['BASE'], array('gotoTerminalPath'));
         $attrs= $ldap->fetch();
         if (isset($attrs['gotoTerminalPath'])){
@@ -673,7 +676,21 @@ class termgeneric extends plugin
           "plPriority"    => 1,
           "plSection"     => array("administration"),
           "plCategory"    => array("terminal" => array( "description"  => _("Terminal"),
-              "objectClass"  => "gotoTerminal")),
+                  "objectClass"  => "gotoTerminal")),
+          "plProperties" =>
+          array(
+              array(
+                  "name"          => "terminalRDN",
+                  "type"          => "rdn",
+                  "default"       => "ou=terminals,ou=systems,",
+                  "description"   => _("The 'terminalRDN' statement defines the location where new terminals will be created. The default is 'ou=terminals,ou=systems,'."),
+                  "check"         => "gosaProperty::isRdn",
+                  "migrate"       => "migrate_terminalRDN",
+                  "group"         => "plugin",
+                  "mandatory"     => FALSE
+                  )
+              ),
+
           "plProvidedAcls"=> array(
             "cn"                  => _("Name"),
             "description"         => _("Description"),