Code

Removed plugin stuff from the Snapshot handler
[gosa.git] / gosa-core / include / class_tabs.inc
index 36cad26d20b0a41c11096795ffed9b1fe30e7af3..6d1b5e871781daf574a885a21751473dd6e8ffe6 100644 (file)
@@ -54,7 +54,7 @@ class tabs
     if(!count($data)) {
       $data[] = array("CLASS" => 'plugin',"NAME" => 'Error');
       msg_dialog::display(_("Error"),
-        sprintf(_("No plugin definitions found to initialize '%s', please check your configuration file."),get_class($this)),
+        sprintf(_("No plugin definition for %s found: please check the configuration file!"), bold(get_class($this))),
         "ERROR_DIALOG");
     }
 
@@ -63,8 +63,10 @@ class tabs
     foreach ($data as &$tab){
 
       if (!plugin_available($tab['CLASS'])){
+        trigger_error(sprintf("Unknown class %s!", bold($tab['CLASS'])));
        continue;
       }
+      if ($this->current == "")  $this->current= $tab['CLASS'];
 
       $this->by_name[$tab['CLASS']]= $tab['NAME'];
 
@@ -79,11 +81,6 @@ class tabs
       $this->read_only |= $this->by_object[$tab['CLASS']]->read_only;
       $this->by_object[$tab['CLASS']]->parent= &$this;
       $this->by_object[$tab['CLASS']]->set_acl_category($this->acl_category);
-
-      /* Initialize current */
-      if ($this->current == ""){
-        $this->current= $tab['CLASS'];
-      }
     }
   }
 
@@ -112,15 +109,13 @@ class tabs
 
   function execute()
   {
-
-
-    echo "Do not render TABS while a sub-dialog is opened!<br>";
-
     // Ensure that the currently selected tab is valid.
     if(!isset($this->by_name[$this->current])) {
       $this->current = key($this->by_name);
     }
 
+    pathNavigator::registerPlugin($this);
+
     // Rotate current to last 
     $this->last= $this->current;
 
@@ -148,11 +143,20 @@ class tabs
     }
     $tabs= $this->gen_tabs();
 
-    $display =          "{$tabs}
-                        <input type='hidden' name='arg' value=''>
-                          <div class='tab-content'>{$display}
-                        </div>";
+    if($this->is_modal_dialog()){
+        $display =   
+            "\n        <div class='plugin'>".
+            "\n          {$display}".
+            "\n        </div>";
+    }else{
 
+        $display =   
+            "\n        {$tabs}".
+            "\n        <input type='hidden' name='arg' value=''>".
+            "\n        <div class='tab-content'>".
+            "\n          {$display}".
+            "\n        </div>";
+    }
     return ($display);
   }
 
@@ -190,12 +194,19 @@ class tabs
     }
   }
 
+
+  function is_modal_dialog()
+  {
+    return($this->by_object[$this->current]->is_modal_dialog());
+  }
+
   function gen_tabs()
   {
+    if($this->is_modal_dialog()) return("");
+
     $display = "\n  <div class='tabs'>";
     $display.= "\n    <ul>";
 
-
     foreach ($this->by_name as $class => $name){
 
       // Shorten string if its too long for the tab headers
@@ -209,13 +220,13 @@ class tabs
 
       // Take care about notifications 
       $obj = $this->by_object[$class];
-      $notify ="";
+      $tabClass = ($this->current == $class) ? "current" :"";
       if ( $this->by_object[$class]->pl_notify && ($obj->is_account || $obj->ignore_account)){
-        $notify= "!";
+        $tabClass .= " info";
       }
-      $tabClass = ($this->current == $class) ? "class='current'" :"";
+      if(!empty($tabClass)) $tabClass="class='{$tabClass}'";
       $onClick = "document.mainform.arg.value='{$class}'; document.mainform.submit();";
-      $display.= "<li {$tabClass} onClick=\"{$onClick}\"><a href='#'>$title{$notify}</a></li>";
+      $display.= "\n      <li {$tabClass} onClick=\"{$onClick}\">{$title}</li>";
     }
     $display.="\n    </ul>";
     $display.="\n  </div>";
@@ -235,7 +246,7 @@ class tabs
     foreach (array_reverse($this->by_object) as $key => $obj){
       $reason= $obj->allow_remove();
       if ($reason != ""){
-        msg_dialog::display(_("Warning"), sprintf(_("Delete process has been canceled by plugin '%s': %s"), $key, $reason), WARNING_DIALOG);
+        msg_dialog::display(_("Warning"), sprintf(_("Delete process has been canceled by plugin %s: %s"), bold($key), $reason), WARNING_DIALOG);
         return;
       }
     }
@@ -356,7 +367,7 @@ class tabs
         }else{
           if(!empty($tmp['string'])){
             $ret .= $tmp['string'];
-            $ret .= "<p class='seperator'>&nbsp;</p>";
+            $ret .= "<hr>";
           }
         }
       }
@@ -376,6 +387,7 @@ class tabs
       $this->by_name['reference']= _("References");
       $this->by_object['reference']= new reference($this->config, $this->dn);
       $this->by_object['reference']->parent= &$this;
+      $this->by_object['reference']->set_acl_category($this->acl_category);
     }
   }
 
@@ -430,6 +442,14 @@ class tabs
     }
     return(TRUE);
   }
+
+  function setReadOnly($s = TRUE)
+  {
+    foreach($this->by_object as $name => $obj){
+      $this->by_object[$name]->read_only = $s;
+    }
+    $this->read_only = $s;
+  }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>