Code

Added repository service
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Jun 2006 11:24:38 +0000 (11:24 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 9 Jun 2006 11:24:38 +0000 (11:24 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3765 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_servRepository.inc
plugins/admin/systems/servRepository.tpl

index 9a3114e80a317c724535f7b809264afb504bc60e..44b59d757139f99435f0c3ada98f230408df3a42 100644 (file)
@@ -19,13 +19,21 @@ class servrepository extends plugin
   var $dialog                 = NULL;
 
   /* Repositories */
-  var $repositories           = array();
-  var $FAIrepository           = array();
+  var $repositories          = array();
+  var $FAIrepository         = array();
+
+
+  var $conflicts             = array("FAIrepositoryServer");
+  var $DisplayName           = "";
+  var $StatusFlag            = "";
+
 
   function servrepository ($config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
 
+    $this->DisplayName = _("Repository service");
+
     $this->repositories = array();
     if(isset($this->attrs['FAIrepository'])){
       for($i = 0; $i < $this->attrs['FAIrepository']['count']; $i++){
@@ -362,6 +370,67 @@ class servrepository extends plugin
     }
   }
 
+  /* 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];
+    }
+  }
+
+
+  function getListEntry()
+  {
+    $this->updateStatusState();
+    $flag = $this->StatusFlag;
+    if(empty($flag)){
+      $fields['Status']      = "";
+    }else{
+      $fields['Status']      = $this->$flag;
+    }
+    $fields['Message']    = _("Repository service");
+    $fields['AllowStart'] = true;
+    $fields['AllowStop']  = true;
+    $fields['AllowRestart'] = true;
+    $fields['AllowRemove']= true;
+    $fields['AllowEdit']  = true;
+    return($fields);
+  }
+
+
+  /* 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();
+    }
+  }
+
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 8213703a2d3249193e7c0e53b7009f9da1c20742..84a4bcdb97e5bacfde0e2483843eb2e17e6f85bd 100644 (file)
 </tr>
 </table>
 <input type="hidden" name="servRepository" value="1">
+
+<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>