From: hickert Date: Mon, 17 Dec 2007 10:59:50 +0000 (+0000) Subject: Multiple edit X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=654d905191af7e2a795fa39957b4c7445102a6cb;p=gosa.git Multiple edit -Prepared mail account to be edited. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8135 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_multi_plug.inc b/gosa-core/include/class_multi_plug.inc index 801e4a7be..84637992e 100644 --- a/gosa-core/include/class_multi_plug.inc +++ b/gosa-core/include/class_multi_plug.inc @@ -29,6 +29,61 @@ Data structure : ... |->tab object for dn n + +Other functions implemented: +============================ + +CLASS tab + - multiple_support_available() Check if there is at least one plugin with + enabled multiple edit support + - enable_multiple_support() Enable multiple edit, for this tab. + +CLASS plugin + - enable_multiple_support() Enable multiple support for this plugin. + - init_multiple_support() Init summy object, to preset some values. + - multiple_execute() Display dummy object ui. + - multiple_save_object() Get posted values in multiple edit mode. + - multiple_check() Check values specified in dummy object. + - get_multi_edit_values() Get values changed from dummy object. + - set_multi_edit_values() Set values collected with get_multi_edit_values. + to all objects currently edited. + + +Process: +======== + +multi_plug::multi_plug() + |->o_tab = new tab() #Initialize ui handle + | + |->handles + | |->handles[] = new tab() #Initialize objects we want to edit at once + | + |->o_tab->enable_multiple_support() #Enable multiple support for ui handle + |->detect_multiple_used_attributes() #Update ui handle with some default values + |->handles->attrs + |->ui->attrs + | + |->execute() #Display ui + | |->o_tab->execute() + |->by_object->multiple_execute() + | + |->check() #Check given values + |->o_tab->check() + |->by_object->multiple_check() + | + |->save_object() #Save posts + |->o_tab->save_object() + |->by_object->multiple_save_object() + | + |->save() #Save collected values + |->populate_values() #Populate values to all handles + |->o_tab->get_multi_edit_values() #Get values to populate + |->handles->set_multi_edit_values() #Set values + |->handles->save() #Save handles + + + + Using this class: ================= Simple Example: @@ -181,7 +236,6 @@ class multi_plug /*! \brief Detect values that are used in all edited objects. - * @returns array All multiple used attributes */ private function detect_multiple_used_attributes() { diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index 458aa41e3..025729703 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -1713,6 +1713,14 @@ class plugin } } + + /*! \brief Enables multiple support for this plugin + */ + function enable_multiple_support() + { + $this->multiple_support_active = TRUE; + } + /*! \brief Returns all values that have been modfied in multiple edit mode. @return array Cotaining all mdofied values. diff --git a/gosa-core/include/class_tabs.inc b/gosa-core/include/class_tabs.inc index d6ed872a5..aa70a4626 100644 --- a/gosa-core/include/class_tabs.inc +++ b/gosa-core/include/class_tabs.inc @@ -383,7 +383,7 @@ class tabs $this->multiple_support_active = TRUE; foreach($this->by_object as $name => $obj){ if($obj->multiple_support){ - $this->by_object[$name]->multiple_support_active = TRUE; + $this->by_object[$name]->enable_multiple_support(); }else{ unset($this->by_object[$name]); unset($this->by_name[$name]); diff --git a/gosa-core/plugins/personal/environment/class_environment.inc b/gosa-core/plugins/personal/environment/class_environment.inc index 86265ba24..35a15daed 100644 --- a/gosa-core/plugins/personal/environment/class_environment.inc +++ b/gosa-core/plugins/personal/environment/class_environment.inc @@ -1561,15 +1561,14 @@ class environment extends plugin } } } - $this->gotoHotplugDevices = array_values($this->gotoHotplugDevices); - $this->gotoHotplugDevices = array_values($tmp); + $this->gotoHotplugDevices = array_values($this->gotoHotplugDevices); for($i = 0 ; $i < strlen($this->gotoProfileFlags) ; $i ++){ $chr = $this->gotoProfileFlags[$i]; $name = "gotoProfileFlag".$chr; $this->$name=$chr; } -$this->update_kiosk_profiles(); -$this->gotoKioskProfile= preg_replace("/^.*\//i","",$this->gotoKioskProfile); + $this->update_kiosk_profiles(); + $this->gotoKioskProfile= preg_replace("/^.*\//i","",$this->gotoKioskProfile); if((!empty($this->gotoProfileServer))||($this->gotoProfileFlagC=="C")){ $this->useProfile = true; diff --git a/gosa-core/plugins/personal/mail/class_mailAccount.inc b/gosa-core/plugins/personal/mail/class_mailAccount.inc index 4b6a7b9ef..6d919d344 100644 --- a/gosa-core/plugins/personal/mail/class_mailAccount.inc +++ b/gosa-core/plugins/personal/mail/class_mailAccount.inc @@ -56,6 +56,7 @@ class mailAccount extends plugin var $uid = ""; var $sieve_management = NULL; + var $multiple_support = TRUE; /* constructor, if 'dn' is set, the node loads the given 'dn' from LDAP */ @@ -281,31 +282,32 @@ class mailAccount extends plugin } /* Do we represent a valid account? */ - if (!$this->is_account && $this->parent === NULL){ - $display= "\"\" ". - _("This account has no mail extensions.").""; + if(!$this->multiple_support_active){ + if (!$this->is_account && $this->parent === NULL){ + $display= "\"\" ". + _("This account has no mail extensions.").""; - $display.= back_to_main(); - return ($display); - } + $display.= back_to_main(); + return ($display); + } - /* Show tab dialog headers */ - if ($this->parent !== NULL){ - if ($this->is_account){ - if($this->accountDelegationsConfigured()){ - $display= $this->show_disable_header(_("Remove mail account"), - _("This account can't be removed while there are delegations configured. Remove those delegations first."),TRUE,TRUE); - }else{ - $display= $this->show_disable_header(_("Remove mail account"), - _("This account has mail features enabled. You can disable them by clicking below.")); + /* Show tab dialog headers */ + if ($this->parent !== NULL){ + if ($this->is_account){ + if($this->accountDelegationsConfigured()){ + $display= $this->show_disable_header(_("Remove mail account"), + _("This account can't be removed while there are delegations configured. Remove those delegations first."),TRUE,TRUE); + }else{ + $display= $this->show_disable_header(_("Remove mail account"), + _("This account has mail features enabled. You can disable them by clicking below.")); + } + } else { + $display= $this->show_enable_header(_("Create mail account"), _("This account has mail features disabled. You can enable them by clicking below.")); + return ($display); } - } else { - $display= $this->show_enable_header(_("Create mail account"), _("This account has mail features disabled. You can enable them by clicking below.")); - return ($display); } } - /* Forwarder subdialog */ /* Trigger forward add dialog? */ @@ -654,6 +656,7 @@ class mailAccount extends plugin $smarty->assign("spamlevel", $spamlevel); $smarty->assign("spambox", $this->mailboxList); + $smarty->assign("multiple_support",$this->multiple_support_active); $display.= $smarty->fetch (get_template_path('generic.tpl', TRUE, dirname(__FILE__))); return ($display); } @@ -1202,6 +1205,20 @@ class mailAccount extends plugin } } } + + /* Initialize plugin with given atribute arrays + */ + function init_multiple_support($attrs,$all) + { + plugin::init_multiple_support($attrs,$all); + + + } + + function multiple_execute() + { + return($this->execute()); + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: