Code

Multiple edit.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 20 Dec 2007 12:21:51 +0000 (12:21 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 20 Dec 2007 12:21:51 +0000 (12:21 +0000)
-Prepared connectivity tab, to be editable in multi edit

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8157 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/personal/connectivity/class_connectivity.inc
gosa-core/plugins/personal/connectivity/class_intranetAccount.inc
gosa-core/plugins/personal/connectivity/intranet.tpl

index 70cfd87a7adab1b2713b49a7c476494f36ccbe28..6efe9d75c465ba4a18ff94eea356f6d20883f72a 100644 (file)
@@ -24,6 +24,7 @@ class connectivity extends plugin
   var $plugin_name= array();
   var $CopyPasteVars = array("plugin","plugin_name");
 
+  var $multiple_support = TRUE;
 
   function connectivity (&$config, $dn= NULL,$parent =NULL)
   {
@@ -31,6 +32,8 @@ class connectivity extends plugin
     $this->dn= $dn;
     $ui= get_userinfo();
 
+    $this->config = $config;
+  
     /* Load accounts */
     foreach ($config->data['TABS']['CONNECTIVITY'] as $plug){
       $name= $plug['CLASS'];
@@ -96,7 +99,6 @@ class connectivity extends plugin
 
     /* Mark me as connectivity tab */
     $display.= "<input type='hidden' name='connectivityTab'>";
-
     return($display);
   }
 
@@ -184,6 +186,59 @@ class connectivity extends plugin
       $this->plugin[$key]->PrepareForCopyPaste($obj);
     }
   }
+
+
+  function enable_multiple_support()
+  {
+    plugin::enable_multiple_support();
+    
+    foreach($this->plugin_name as $key => $name){
+      if($this->plugin[$name]->multiple_support){
+        $this->plugin[$name]->enable_multiple_support();  
+      }else{
+        unset($this->plugin_name[$key]);
+        unset($this->plugin[$name]);
+      }
+    }
+  }
+  
+  
+  function multiple_execute()
+  {
+    return($this->execute());
+  }
+  
+  /* Save data to object */
+  function multiple_save_object()
+  {
+    if (isset($_POST['connectivityTab'])){
+      foreach ($this->plugin_name as $name){
+        $this->plugin[$name]->multiple_save_object();
+      }
+    }
+  }
+
+  function multiple_check()
+  {
+    $message = plugin::multiple_check();
+    foreach ($this->plugin_name as $name){
+      $message = array_merge($message,$this->plugin[$name]->multiple_check());
+    }
+    return($message);
+  }
+
+  function get_multi_edit_values()
+  {
+    $ret['plugin'] = &$this->plugin;
+    return($ret);
+  }
+
+  function set_multi_edit_values($values)
+  {
+    foreach($values['plugin'] as $name => $plugin){
+      $this->plugin[$name]->set_multi_edit_values($plugin->get_multi_edit_values());
+    }
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index c2b9573d32e5387063491a70b98a55a178851e08..da2fb16894705514073b5c9937fce9c9610e70be 100644 (file)
@@ -26,6 +26,7 @@ class intranetAccount extends plugin
   var $uid ="";
 
   var $view_logged = FALSE;
+  var $multiple_support = TRUE;
 
   /*! \brief Konstructor  
 
@@ -85,13 +86,10 @@ class intranetAccount extends plugin
       $smarty->assign("tabbed", 0);    
     }
 
-
-    $smarty->assign('gosaIntranetACL', " disabled ");
-    if((!$this->ReadOnly) && (    ($this->is_account && $this->acl_is_removeable()) 
-                               || (!$this->is_account && $this->acl_is_createable()))){
-      $smarty->assign('gosaIntranetACL', "");
-    }
-
+    $smarty->assign('gosaIntranetACL', $this->getacl("",$this->ReadOnly));
+  
+    $smarty->assign("use_intranet",in_array("intranet",$this->multi_boxes));
+    $smarty->assign("multiple_support",$this->multiple_support_active);
     $display.= $smarty->fetch (get_template_path('intranet.tpl', TRUE, dirname(__FILE__)));
     return ($display);
   }
@@ -207,6 +205,45 @@ class intranetAccount extends plugin
           "plProvidedAcls"  => array()
           ));
   }
+
+  
+  function multiple_save_object()
+  {
+    if (isset($_POST['connectivityTab'])){
+      plugin::multiple_save_object();
+      if (isset($_POST['intranet'])){
+        if (!$this->is_account && $_POST['intranet'] == "B"){
+          if($this->acl_is_createable()){
+            $this->is_account= TRUE;
+          }
+        }
+      } else {
+        if($this->acl_is_removeable()){
+          $this->is_account= FALSE;
+        }
+      }
+      if(isset($_POST['use_intranet'])){
+        $this->multi_boxes[] = "intranet";
+      }
+    }
+  }
+
+  function get_multi_edit_values()
+  {
+    $ret = plugin::get_multi_edit_values();
+    if(in_array("intranet",$this->multi_boxes)){
+      $ret['is_account'] = $this->is_account;
+    }
+    return($ret);
+  }
+
+  function set_multi_edit_values($values)
+  {
+    plugin::set_multi_edit_values($values);
+    if(isset($values['is_account'])){
+      $this->is_account = $values['is_account'];
+    }
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index f768285feb481b414cdefb7aa13425c390a12ed0..303c0fbcabc231fbb1bc6a0b047d234de41cc22e 100644 (file)
@@ -1,4 +1,6 @@
 <h2>
-       <input type="checkbox" name="intranet" value="B" {$intranetState} {$gosaIntranetACL}>
+       {render acl=$gosaIntranetACL checkbox=$multiple_support checked=$use_intranet}
+       <input type="checkbox" name="intranet" value="B" {$intranetState} class="center"> 
        {t}Intranet account{/t}
+       {/render}
 </h2>