From 10e67b53de0ec5f94cd6e51c0d82e9cf136c038b Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 20 Dec 2007 12:21:51 +0000 Subject: [PATCH] Multiple edit. -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 --- .../connectivity/class_connectivity.inc | 57 ++++++++++++++++++- .../connectivity/class_intranetAccount.inc | 51 ++++++++++++++--- .../personal/connectivity/intranet.tpl | 4 +- 3 files changed, 103 insertions(+), 9 deletions(-) diff --git a/gosa-core/plugins/personal/connectivity/class_connectivity.inc b/gosa-core/plugins/personal/connectivity/class_connectivity.inc index 70cfd87a7..6efe9d75c 100644 --- a/gosa-core/plugins/personal/connectivity/class_connectivity.inc +++ b/gosa-core/plugins/personal/connectivity/class_connectivity.inc @@ -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.= ""; - 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: diff --git a/gosa-core/plugins/personal/connectivity/class_intranetAccount.inc b/gosa-core/plugins/personal/connectivity/class_intranetAccount.inc index c2b9573d3..da2fb1689 100644 --- a/gosa-core/plugins/personal/connectivity/class_intranetAccount.inc +++ b/gosa-core/plugins/personal/connectivity/class_intranetAccount.inc @@ -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: diff --git a/gosa-core/plugins/personal/connectivity/intranet.tpl b/gosa-core/plugins/personal/connectivity/intranet.tpl index f768285fe..303c0fbca 100644 --- a/gosa-core/plugins/personal/connectivity/intranet.tpl +++ b/gosa-core/plugins/personal/connectivity/intranet.tpl @@ -1,4 +1,6 @@

- + {render acl=$gosaIntranetACL checkbox=$multiple_support checked=$use_intranet} + {t}Intranet account{/t} + {/render}

-- 2.30.2