Code

Updated acl/actions
[gosa.git] / include / class_tabs.inc
index a4ef265c766d48a5cd5d84e21629de45a7f06c15..c71fa94920e3988584c1371a0642647d7e7d1145 100644 (file)
@@ -24,6 +24,7 @@ class tabs
   var $config;
   var $acl;
   var $is_template;
+  var $is_new= FALSE;
 
   var $last= "";
   var $current= "";
@@ -32,23 +33,32 @@ class tabs
   var $by_object= array();
   var $SubDialog = false;
 
-  function tabs($config, $data, $dn)
+  function tabs($config, $data, $dn, $acl_category= "")
   {
        /* Save dn */
        $this->dn= $dn;
        $this->config= $config;
+       
+       $baseobject= NULL;
 
        foreach ($data as $tab){
                $this->by_name[$tab['CLASS']]= $tab['NAME'];
-               $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn);
+
+               if ($baseobject == NULL){
+                       $baseobject= new $tab['CLASS']($this->config, $this->dn);
+                       $this->by_object[$tab['CLASS']]= $baseobject;
+               } else {
+                       $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject);
+               }
+
                $this->by_object[$tab['CLASS']]->parent= &$this;
+               $this->by_object[$tab['CLASS']]->set_acl_category($acl_category);
 
                /* Initialize current */
                if ($this->current == ""){
                        $this->current= $tab['CLASS'];
                }
        }
-
   }
 
   function execute()
@@ -141,10 +151,13 @@ class tabs
 
                /* Shorten string if its too long for the tab headers*/
                $title= _($name);
-               if (mb_strlen($title, 'UTF-8') > 14){
-                       $title= mb_substr($title,0, 12, 'UTF-8')."...";
+               if (mb_strlen($title, 'UTF-8') > 28){
+                       $title= mb_substr($title,0, 25, 'UTF-8')."...";
                }
-               
+                       
+               /* nobr causes w3c warnings so we use   to keep the tab name in one line */
+               $title= preg_replace("/ /"," ",$title);
+
                if ($_SESSION['js']==FALSE){    
                        $display.= "<div class=\"$style[$index]\"><input type=\"submit\" name=\"$class\"".
                                   " class=\"$style[$index]\" value=\"$title\"";
@@ -292,7 +305,7 @@ class tabs
   function addSpecialTabs()
   {
        $this->by_name['acl']= _("ACL");
-       $this->by_object['acl']= new acl($this->config, $this->dn);
+       $this->by_object['acl']= new acl($this->config, $this, $this->dn);
        $this->by_object['acl']->parent= &$this;
        $this->by_name['reference']= _("References");
        $this->by_object['reference']= new reference($this->config, $this->dn);
@@ -300,6 +313,21 @@ class tabs
   }
 
 
+  function set_acl_base($base= "")
+  {
+       /* Update reference, transfer variables */
+       $first= ($base == "");
+       foreach ($this->by_object as $name => $obj){
+               if ($first){
+                       $first= FALSE;
+                       $base= $obj->acl_base;
+               } else {
+                       $obj->set_acl_base($base);
+                       $this->by_object[$name]= $obj;
+               }
+       }
+  }
+
 }
 
 ?>