From b948b75de8847afff30d11389bbeeb7f4544c81b Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 19 Oct 2007 08:30:55 +0000 Subject: [PATCH] Added handler for multiple edit git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7595 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_multi_plug.inc | 62 +++++++++++++++++++ plugins/admin/users/class_userManagement.inc | 65 +++++++++++--------- 2 files changed, 98 insertions(+), 29 deletions(-) create mode 100644 include/class_multi_plug.inc diff --git a/include/class_multi_plug.inc b/include/class_multi_plug.inc new file mode 100644 index 000000000..021bb287d --- /dev/null +++ b/include/class_multi_plug.inc @@ -0,0 +1,62 @@ +a_dns = $dns; + $this->o_config = $config; + $this->s_class = $class; + $this->o_tab = new $class($config,$tab,"new"); + + if($this->o_tab->multiple_support_available()){ + $this->o_tab->enable_multiple_support(); + + foreach($dns as $dn){ + $this->a_handles[] = new $class($config,$tab,$dn); + } + } + } + + public function entries_locked() + { + return(FALSE); + } + + public function display_lock_message() + { + return(""); + } + + public function lock_entries($uid) + { + return(TRUE); + } + + public function multiple_available() + { + return(TRUE); + } + + public function set_active_tab($str) + { + } + + public function get_object_info() + { + return("Oi"); + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc index 77cd106fe..af39e5f48 100644 --- a/plugins/admin/users/class_userManagement.inc +++ b/plugins/admin/users/class_userManagement.inc @@ -265,29 +265,20 @@ class userManagement extends plugin - - /******************** - Edit existing entry + /******************** + Edit existing entry ********************/ /* User wants to edit data? */ - if (($s_action == "multiple_edit" || $s_action=="edit") && (!isset($this->usertab->config))){ + if (($s_action=="edit") && (!isset($this->usertab->config))){ - $this->dn = array(); /* Get 'dn' from posted 'uid', must be unique */ - if($s_action == "multiple_edit"){ - foreach($this->list_get_selected_items() as $id){ - $this->dn[] = $this->list[trim($id)]['dn']; - } - }else{ - $this->dn= array($this->list[trim($s_entry)]['dn']); - } + $this->dn= $this->list[trim($s_entry)]['dn']; /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */ - $users= get_multiple_locks($this->dn); - if (count($users)){ - return(gen_locked_message($users, $this->dn)); + if (($user= get_lock($this->dn)) != ""){ + return(gen_locked_message ($user, $this->dn)); } /* Lock the current entry, so everyone will get the @@ -295,23 +286,39 @@ class userManagement extends plugin add_lock ($this->dn, $this->ui->dn); /* Register usertab to trigger edit dialog */ - $tbs = new usertabs($this->config,$this->config->data['TABS']['USERTABS'], $this->dn); + $this->usertab= new usertabs($this->config, + $this->config->data['TABS']['USERTABS'], $this->dn); - if($tbs){ - $this->usertab = $tbs; + /* Switch tab, if it was requested by the user */ + $this->usertab->current = $s_tab; - /* Switch tab, if it was requested by the user */ - $this->usertab->current = $s_tab; + /* Set ACL and move DN to the headline */ + $this->usertab->set_acl_base($this->dn); + $_SESSION['objectinfo']= $this->dn; + } - /* Set ACL and move DN to the headline */ - if(count($this->dn) == 1){ - reset($this->dn) ; - $dn = current($this->dn); - $this->usertab->set_acl_base($dn); - $_SESSION['objectinfo'] = $dn; - }else{ - $_SESSION['objectinfo']= _("Multiple edit"); - } + + + /******************** + Edit multiple entries + ********************/ + + /* User wants to edit data? */ + if ($s_action == "multiple_edit" && !isset($this->usertab->config)){ + + $this->dn = array(); + foreach($this->list_get_selected_items() as $id){ + $this->dn[] = $this->list[$id]['dn'];; + } + $tmp = new multi_plug($this->config,"usertabs",$this->config->data['TABS']['USERTABS'],$this->dn); + if ($tmp->entries_locked()){ + return($tmp->display_lock_message()); + } + $tmp->lock_entries($this->ui->dn); + if($tmp->multiple_available()){ + $this->usertab = $tmp; + $this->usertab->set_active_tab($s_tab); + $_SESSION['objectinfo']= $this->usertab->get_object_info(); } } -- 2.30.2