Code

Updated workstation - Startup
[gosa.git] / plugins / admin / systems / class_servRepository.inc
index e3dc800cdd6368d0620b0e9b59827733fa139e89..c95860729cf54c183c1d698d635f0b1c9e15f205 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 
-require_once("class_goService.inc");
-
 class servrepository extends goService
 {
   /* CLI vars */
@@ -17,23 +15,30 @@ class servrepository extends goService
   /* Search filter */
   var $regex                  = "*";
 
-  /* Configurationdialog for repositories */
-  var $dialog                 = NULL;
-
   /* Repositories */
   var $repositories          = array();
   var $FAIrepository         = array();
   var $conflicts             = array("FAIrepositoryServer");
   var $DisplayName           = "";
   var $StatusFlag            = "";
+  
+  var $view_logged            = FALSE;
+  var $fai_activated          = FALSE;
 
-
-  function servrepository ($config, $dn= NULL, $parent= NULL)
+  function servrepository (&$config, $dn= NULL, $parent= NULL)
   {
     plugin::plugin ($config, $dn, $parent);
 
     $this->DisplayName = _("Repository service");
 
+    /* Skip this if fai is deactivated */
+    $tmp= $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+    if(!empty($tmp)){
+      $this->fai_activated = TRUE;    
+    }else{
+      return;
+    }
+
     $this->repositories = array();
     if(isset($this->attrs['FAIrepository'])){
       for($i = 0; $i < $this->attrs['FAIrepository']['count']; $i++){
@@ -81,6 +86,16 @@ class servrepository extends goService
     /* Call parent execute */
     plugin::execute();
 
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
+    if(!$this->fai_activated){
+      $str = "<h2>"._("You can't use this plugin until FAI is activated.")."</h2>";
+      return $str;
+    }
+
     /* Fill templating stuff */
     $smarty= get_smarty();
     $smarty->assign("is_createable",$this->acl_is_createable());
@@ -211,17 +226,17 @@ class servrepository extends goService
         }else{ 
           $this->repositories[$obj['Release']]=$obj;        
         }
-        $this->dialog = NULL;
+        $this->dialog = FALSE;
         $this->is_dialog= false;
       }
     }
 
     if(isset($_POST['repository_setup_cancel'])){
-      $this->dialog=NULL;
+      $this->dialog=FALSE;
       $this->is_dialog = false;
     }
    
-    if($this->dialog != NULL){
+    if(is_object($this->dialog)){
       $this->dialog->save_object();
       $this->is_dialog = true;
       return($this->dialog->execute());
@@ -231,9 +246,10 @@ class servrepository extends goService
       Repository setup dialog handling /END
     */
 
-    $divlist = new divList("repositories");
+    $divlist = new divlist("repositories");
     $divlist->SetEntriesPerPage(0);
     $divlist->setHeight(400);
+    $divlist->SetPluginMode();
 
     $divlist->setHeader(array(array("string"=>_("Release"),"attach"=>"style='width:80px;'"),
                               array("string"=>_("Sections")),
@@ -294,6 +310,8 @@ class servrepository extends goService
   /* Save to LDAP */
   function save()
   {
+    if(!$this->fai_activated) return;
+
     plugin::save();
 
     $arr = array();
@@ -330,6 +348,12 @@ class servrepository extends goService
       $ldap->add($this->attrs);
       $this->handle_post_events("add");
     }
+
+    if($this->initially_was_account){
+      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
   }
 
 
@@ -338,6 +362,7 @@ class servrepository extends goService
     $fields = goService::getListEntry();
     $fields['Message']    = _("Repository service");
     $fields['AllowEdit']  = true;
+    $fields['AllowStart'] = $fields['AllowStop'] = $fields['AllowRestart'] = false;
     return($fields);
   }
 
@@ -346,15 +371,18 @@ class servrepository extends goService
   {
     return (array(
           "plShortName"   => _("Repository"),
-          "plDescription" => _("Repository service"),
+          "plDescription" => _("Repository service")." ("._("Services").")",
           "plSelfModify"  => FALSE,
           "plDepends"     => array(),
-          "plPriority"    => 0,
+          "plPriority"    => 84,
           "plSection"     => array("administration"),
           "plCategory"    => array("server"),
 
           "plProvidedAcls"=> array(
               "cn"            => _("Name"),
+              "start"         => _("Start"),
+              "stop"          => _("Stop"),
+              "restart"       => _("Restart"),
               "Release"       => _("Releases"),
               "Section"       => _("Sections"),
               "ParentServer"  => _("Parent server"),