Code

Multiple edit
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 20 Dec 2007 12:52:49 +0000 (12:52 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 20 Dec 2007 12:52:49 +0000 (12:52 +0000)
-Enabled multiple edit for a set of connectivity addons

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8158 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/class_phpgwAccount.inc
gosa-core/plugins/personal/connectivity/class_webdavAccount.inc
gosa-core/plugins/personal/connectivity/phpgw.tpl
gosa-core/plugins/personal/connectivity/webdav.tpl

index 6efe9d75c465ba4a18ff94eea356f6d20883f72a..8aa1836d6d8eb584cde33e1e7762b8e2449202a1 100644 (file)
@@ -227,6 +227,22 @@ class connectivity extends plugin
     return($message);
   }
 
+  function get_multi_init_values()
+  {
+    $ret = array();
+    foreach($this->plugin as $name => $plugin){
+      $ret = array_merge($ret,$plugin->get_multi_init_values());
+    }
+    return($ret);
+  }
+
+  function init_multiple_support($attrs,$attr)
+  {
+    foreach($this->plugin as $name => $plugin){
+      $this->plugin[$name]->init_multiple_support($attrs,$attr);
+    }
+  }
+
   function get_multi_edit_values()
   {
     $ret['plugin'] = &$this->plugin;
index da2fb16894705514073b5c9937fce9c9610e70be..e1c9ffca9a423e21d4ba0b2b1848ebe2da060a67 100644 (file)
@@ -87,7 +87,6 @@ class intranetAccount extends plugin
     }
 
     $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__)));
@@ -211,19 +210,19 @@ class intranetAccount extends plugin
   {
     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";
+        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;
+          }
+        }
       }
     }
   }
@@ -244,6 +243,14 @@ class intranetAccount extends plugin
       $this->is_account = $values['is_account'];
     }
   }
+
+  function init_multiple_support($attrs,$all)
+  {
+    plugin::init_multiple_support($attrs,$all);
+    if(isset($attrs['objectClass']) && in_array("gosaIntranetAccount",$attrs['objectClass'])){
+      $this->is_account = TRUE;
+    }
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 7c5cf6e2c879a59af2bf835153c17505ddcd3cd7..0e2ac36b1fd0d4ce411b765d16b3e72617fed403 100644 (file)
@@ -17,6 +17,8 @@ class phpgwAccount extends plugin
 
   var $uid  = "";
   var $view_logged = FALSE;
+  
+  var $multiple_support = TRUE;
 
   function phpgwAccount (&$config, $dn= NULL)
   {
@@ -55,12 +57,9 @@ class phpgwAccount extends plugin
       $smarty->assign("phpgwState", "");
     }
 
-    if((!$this->ReadOnly)&&(($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))) {
-      $smarty->assign('phpgwAccountACL', "");
-    }else{
-      $smarty->assign('phpgwAccountACL', " disabled ");
-    }
-
+    $smarty->assign('phpgwAccountACL', $this->getacl("",$this->ReadOnly));
+    $smarty->assign("multiple_support",$this->multiple_support_active);
+    $smarty->assign("use_phpgw",in_array("phpgw",$this->multi_boxes));
     $display.= $smarty->fetch (get_template_path('phpgw.tpl', TRUE, dirname(__FILE__)));
     return ($display);
   }
@@ -166,6 +165,57 @@ class phpgwAccount extends plugin
           "plProvidedAcls"  => array()
           ));
   }
+
+
+  function multiple_save_object()
+  {
+    if (isset($_POST['connectivityTab'])){
+      plugin::multiple_save_object();
+
+      /* Do we need to flip is_account state? */
+      if(isset($_POST['use_phpgw'])){
+        $this->multi_boxes[] = "phpgw";
+        if (isset($_POST['connectivityTab'])){
+          if (isset($_POST['phpgw'])){
+            if (!$this->is_account && $_POST['phpgw'] == "B"){
+              if($this->acl_is_createable()){
+                $this->is_account= TRUE;
+              }
+            }
+          } else {
+            if($this->acl_is_removeable()){
+              $this->is_account= FALSE;
+            }
+          }
+        }
+      }
+    }
+  }
+
+  function get_multi_edit_values()
+  {
+    $ret = plugin::get_multi_edit_values();
+    if(in_array("phpgw",$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'];
+    }
+  }
+
+  function init_multiple_support($attrs,$all)
+  {
+    plugin::init_multiple_support($attrs,$all);
+    if(isset($attrs['objectClass']) && in_array("phpgwAccount",$attrs['objectClass'])){
+      $this->is_account = TRUE;
+    }
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 59fdb60ef8ce24000dbdc102a315a9ae81be5242..4d7c179ded461f579c81029d8f377cf5d72db18f 100644 (file)
@@ -13,6 +13,8 @@ class webdavAccount extends plugin
   var $view_logged = FALSE;
   var $uid ="";
 
+  var $multiple_support =TRUE;
+
   function webdavAccount (&$config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
@@ -51,12 +53,9 @@ class webdavAccount extends plugin
       $smarty->assign("tabbed", 1);
     }
 
-    if((!$this->ReadOnly) && (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))) {
-      $smarty->assign('webdavAccountACL', "");
-    }else{
-      $smarty->assign('webdavAccountACL', " disabled ");
-    }
-
+    $smarty->assign('webdavAccountACL', $this->getacl("",$this->ReadOnly));
+    $smarty->assign("use_webdav",in_array("webdav",$this->multi_boxes));
+    $smarty->assign("multiple_support",$this->multiple_support_active);
     $display.= $smarty->fetch (get_template_path('webdav.tpl', TRUE, dirname(__FILE__)));
     return ($display);
   }
@@ -165,6 +164,53 @@ class webdavAccount extends plugin
           "plProvidedAcls"  => array()
           ));
   }
+
+  function multiple_save_object()
+  {
+    if (isset($_POST['connectivityTab'])){
+      plugin::multiple_save_object();
+
+      if(isset($_POST['use_webdav'])){
+        $this->multi_boxes[] = "webdav";
+        if (isset($_POST['webdav'])){
+          if (!$this->is_account && $_POST['webdav'] == "B"){
+            if($this->acl_is_createable()){
+              $this->is_account= TRUE;
+            }
+          }
+        } else {
+          if($this->acl_is_removeable()){
+            $this->is_account= FALSE;
+          }
+        }
+      }
+    }
+  }
+
+  function get_multi_edit_values()
+  {
+    $ret = plugin::get_multi_edit_values();
+    if(in_array("webdav",$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'];
+    }
+  }
+
+  function init_multiple_support($attrs,$all)
+  {
+    plugin::init_multiple_support($attrs,$all);
+    if(isset($attrs['objectClass']) && in_array("gosaWebdavAccount",$attrs['objectClass'])){
+      $this->is_account = TRUE;
+    }
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 299da67162db24bf52d9d2aeecad805369e9991f..a63cddaa2e71ff2194831f9c42e564e7277f6906 100644 (file)
@@ -1,4 +1,7 @@
 <h2>
-       <input type="checkbox" name="phpgw" value="B" {$phpgwState} {$phpgwAccountACL}>
+{render acl=$phpgwAccountACL checkbox=$multiple_support checked=$use_phpgw}
+       <input type="checkbox" name="phpgw" value="B" {$phpgwState} class="center">
+{/render}
        {t}PHPGroupware account{/t}
+
 </h2>
index ecd567cd3ba9523db04467400ef6f448bc95aa00..df52197a50415fbf36462fb5564d28650a1c40cd 100644 (file)
@@ -1,4 +1,6 @@
 <h2>
-       <input type="checkbox" name="webdav" value="B" {$webdavState} {$webdavAccountACL}>
+{render acl=$webdavAccountACL checkbox=$multiple_support checked=$use_webdav}
+       <input type="checkbox" name="webdav" value="B" {$webdavState} class="center">
+{/render}
        {t}WebDAV account{/t}
 </h2>