Code

Updated parent handling for connectivity extensions
[gosa.git] / gosa-plugins / connectivity / personal / connectivity / class_connectivity.inc
index 6d97d165573216ccf8e7e7964bc054fc893ddc2e..f1be45aa0e325c7886cf5f4ce8e2664b1b3cca2f 100644 (file)
@@ -13,8 +13,8 @@ class connectivity extends plugin
 {
   /* Definitions */
   var $plHeadline= "Connectivity";
-  var $plDescription= "This does something";
-  var $plInfo = "plugins/connectivity/images/plugin.png";
+  var $plDescription= "Manage connectivity user settings";
+  var $plIcon = "plugins/connectivity/images/plugin.png";
 
   /* attribute list for save action */
   var $attributes= array();
@@ -30,6 +30,7 @@ class connectivity extends plugin
   function connectivity (&$config, $dn= NULL,$parent =NULL)
   {
     /* Preseed permissions */
+    $this->initTime = microtime(TRUE);
     $this->dn= $dn;
     $ui= get_userinfo();
 
@@ -37,9 +38,10 @@ class connectivity extends plugin
   
     /* Load accounts */
     foreach ($config->data['TABS']['CONNECTIVITY'] as $plug){
-      if (!plugin_available($plug['CLASS'])) {
+      if (!class_available($plug['CLASS']) || !plugin_available($plug['CLASS'])) {
        continue;
       }
+
       $name= $plug['CLASS'];
       $this->plugin_name[]= $name;
       $this->plugin[$name]= new $name($config, $dn,$parent);
@@ -50,6 +52,11 @@ class connectivity extends plugin
       $this->plugin[$name]-> set_acl_category("users");
       $this->plugin[$name]-> set_acl_base($this->dn);
     }
+
+    // Create statistic table entry
+    stats::log('plugin', $class = get_class($this), $category = array($this->acl_category),  $action = 'open',
+            $amount = 1, $duration = (microtime(TRUE) - $this->initTime));
+
   }
 
   function execute()
@@ -79,7 +86,6 @@ class connectivity extends plugin
       }
     }
 
-    /* Remove checkboxes in single edit mode */
     if ($this->parent !== NULL){
       foreach ($this->plugin_name as $name){
         $this->plugin[$name]->parent= $this->parent;
@@ -89,12 +95,10 @@ class connectivity extends plugin
     /* Execude  objects */
     $is_first= true;
 
-    $ReadOnly = (!isset($this->parent) || !$this->parent) && !session::is_set('edit');
-
     foreach ($this->plugin_name as $name){
-      $this->plugin[$name]->ReadOnly = $ReadOnly;
+      $this->plugin[$name]->read_only = &$this->read_only;
       if (!$is_first){
-        $display.= '<p class="seperator">&nbsp;</p>';
+        $display.= '<hr>';
       } else {
         $is_first= false;
       }
@@ -150,6 +154,13 @@ class connectivity extends plugin
   /* Save to LDAP */
   function save()
   {
+    // Append parent to sub-plugins.
+    if ($this->parent !== NULL){
+      foreach ($this->plugin_name as $name){
+        $this->plugin[$name]->parent= $this->parent;
+      }
+    }
+
     /* Save objects */
     foreach ($this->plugin_name as $name){
       $this->plugin[$name]->dn= $this->dn;
@@ -164,6 +175,13 @@ class connectivity extends plugin
 
   function remove_from_parent()
   {
+    // Append parent to sub-plugins.
+    if ($this->parent !== NULL){
+      foreach ($this->plugin_name as $name){
+        $this->plugin[$name]->parent= $this->parent;
+      }
+    }
+
     /* Remove objects */
     foreach ($this->plugin_name as $name){
       $this->plugin[$name]->dn= $this->dn;
@@ -273,7 +291,7 @@ class connectivity extends plugin
           "plCategory"    => array("users"),
           "plOptions"       => array(),
 
-          "plDescription"       => _("Connectivity addon"),
+          "plDescription"       => _("Connectivity add-on"),
           "plSelfModify"        => TRUE,
 
           "plProvidedAcls"  => array()