Code

Made dns serverService compatible
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Jun 2006 10:45:36 +0000 (10:45 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Jun 2006 10:45:36 +0000 (10:45 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3755 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_servDNS.inc
plugins/admin/systems/servdns.tpl

index 9bc83feefef694fd3c61785f44908bce96815539..2faa8a01ea3cc199515be6dd12cf5d7fc4648a05 100644 (file)
@@ -19,12 +19,18 @@ class servdns extends plugin
   var $orig_dn          = "";
 
   var $DNSinitially_was_account;
-
+  
+  /* ServerService tab vars */
+  var $conflicts        = array("servdns");
+  var $DisplayName      = "";
+  var $StatusFlag       = "";
 
   function servdns ($config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
 
+    $this->DisplayName = _("Domain name system service");
+
     $this->orig_dn = $dn;
 
     /* Get record types for zones
@@ -312,6 +318,68 @@ class servdns extends plugin
       show_ldap_error($ldap->get_error(), _("Saving DNS entries failed"));
     }
   }
+
+
+  /* Directly save new status flag */
+  function setStatus($value)
+  {
+    if($value == "none") return;
+    if(!$this->initially_was_account) return;
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $ldap->cat($this->dn,array("objectClass"));
+    if($ldap->count()){
+
+      $tmp = $ldap->fetch();
+      for($i = 0; $i < $tmp['objectClass']['count']; $i ++){
+        $attrs['objectClass'][] = $tmp['objectClass'][$i];
+      }
+      $flag = $this->StatusFlag;
+      $attrs[$flag] = $value;
+      $this->$flag = $value;
+      $ldap->modify($attrs);
+      show_ldap_error($ldap->get_error());
+      $this->action_hook();
+    }
+  }
+
+
+  function getListEntry()
+  {
+    $this->updateStatusState();
+    $flag = $this->StatusFlag;
+    if(empty($flag)){
+      $fields['Status']      = "";
+    }else{
+      $fields['Status']      = $this->$flag;
+    }
+    $fields['Message']    = _("DNS service");
+    $fields['AllowStart'] = true;
+    $fields['AllowStop']  = true;
+    $fields['AllowRestart'] = true;
+    $fields['AllowRemove']= true;
+    $fields['AllowEdit']  = true;
+    return($fields);
+  }
+
+
+  /* Get updates for status flag */
+  function updateStatusState()
+  {
+    if(empty($this->StatusFlag)) return;
+
+    $attrs = array();
+    $flag = $this->StatusFlag;
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->cn);
+    $ldap->cat($this->dn,array($flag));
+    if($ldap->count()){
+      $attrs = $ldap->fetch();
+    }
+    if(isset($attrs[$flag][0])){
+      $this->$flag = $attrs[$flag][0];
+    }
+  }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index ba53940884ad9bea5ff698678f0acbfe23ca6023..9cd1d91b3d4b92ddfa9d3f56e66d26efe54e7cab 100644 (file)
   document.mainform.AddZone.focus();
   -->
 </script>
+
+<p class="seperator">&nbsp;</p>
+<p>
+<div style="width:100%; text-align:right;">
+    <input type='submit' name='SaveService' value='{t}Save{/t}'>
+    &nbsp;
+    <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+</p>