index 84637992ea8c04bba4320b6b7d997477246927a8..a6cbc9410df2aa1652403bcd071599be471e8e62 100644 (file)
<?php
/*
<?php
/*
- This code is part of GOsa (https://oss.gonicus.de/labs/gosa/)
- Copyright (C) 2007 Fabian Hickert
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
*/
/*
|
|->o_tab->enable_multiple_support() #Enable multiple support for ui handle
|->detect_multiple_used_attributes() #Update ui handle with some default values
|
|->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
+ |->handles[]
+ |->by_object->get_multi_init_values() #Get attributes from all handles
+ |->o_tab
+ |->by_object->init_multiple_support() #Assign values to ui handle
|
|->execute() #Display ui
| |->o_tab->execute()
|
|->execute() #Display ui
| |->o_tab->execute()
public $config = NULL;
private $s_class= "";
public $current = "";
public $config = NULL;
private $s_class= "";
public $current = "";
+ public $by_object = array();
+ public $by_name = array();
/*! \brief Creates a multi_plug object
@param object $config GOsa Configuration object
/*! \brief Creates a multi_plug object
@param object $config GOsa Configuration object
/* Initialize collector object
* Used to display the ui and to collect the user input.
*/
/* Initialize collector object
* Used to display the ui and to collect the user input.
*/
- $this->o_tab = new $class($config,$tab,"new",$acl_category);
+ $this->o_tab = new $class($config,$tab,"new",$acl_category, TRUE, TRUE);
$this->o_tab->set_acl_base($acl_base);
$this->o_tab->set_acl_base($acl_base);
+ $this->by_object = &$this->o_tab->by_object;
+ $this->by_name = &$this->o_tab->by_name;
+ $this->current = &$this->o_tab->current;
/* Check if the specified tab object supports multiple edits
*/
/* Check if the specified tab object supports multiple edits
*/
/* Initialize the objects we want to edit at once
*/
foreach($dns as $dn){
/* Initialize the objects we want to edit at once
*/
foreach($dns as $dn){
- $obj = new $class($config,$tab,$dn,$acl_category);
+ $obj = new $class($config,$tab,$dn,$acl_category, TRUE, TRUE);
$obj->set_acl_base($acl_base);
$this->a_handles[] = $obj;
}
$obj->set_acl_base($acl_base);
$this->a_handles[] = $obj;
}
*/
private function array_combine($base,$add)
{
*/
private function array_combine($base,$add)
{
+
foreach($add as $key => $attr) {
if(!is_numeric($key)){
foreach($add as $key => $attr) {
if(!is_numeric($key)){
+
+ if(!is_array($add[$key])){
+ $add[$key] = array('count' => 1,$add[$key]);
+ }
+
if(!isset($base[$key])){
$base[$key] = $add[$key];
if(!isset($base[$key])){
$base[$key] = $add[$key];
- }elseif(is_array($add[$key])){
+ }else{
+
+ if(!isset($base[$key]['count'])){
+ $base[$key]['count'] = count($base[$key]);
+ }
+
+ if(!isset($add[$key]['count'])){
+ $add[$key]['count'] = count($add[$key]);
+ }
for($i=0;$i<$add[$key]['count'];$i++){
if(!in_array($add[$key][$i],$base[$key])){
$base[$key][] = $add[$key][$i];
for($i=0;$i<$add[$key]['count'];$i++){
if(!in_array($add[$key][$i],$base[$key])){
$base[$key][] = $add[$key][$i];
unset($base[$key]);
}elseif(is_array($base[$key])){
$tmp = array();
unset($base[$key]);
}elseif(is_array($base[$key])){
$tmp = array();
+ if(!isset($base[$key]['count'])){
+ $base[$key]['count'] = count($base[$key]);
+ }
for($i = 0 ; $i < $base[$key]['count'] ; $i ++){
if(isset($base[$key][$i]) && in_array($base[$key][$i],$minus[$key])){
$tmp[] = $base[$key][$i];
for($i = 0 ; $i < $base[$key]['count'] ; $i ++){
if(isset($base[$key][$i]) && in_array($base[$key][$i],$minus[$key])){
$tmp[] = $base[$key][$i];
*/
private function detect_multiple_used_attributes()
{
*/
private function detect_multiple_used_attributes()
{
- $attrs = array();
- $first = $this->o_tab->current;
- $all = array();
- foreach($this->a_handles as $handle){
- if(count($attrs) == 0){
- $attrs = $handle->by_object[$first]->attrs;
- }else{
- $attrs = $this->array_intersect($attrs,$handle->by_object[$first]->attrs);
+ foreach($this->o_tab->by_object as $name => $plug){
+
+ if(empty($name)) continue;
+
+ $attrs = array();
+ $all = array();
+ foreach($this->a_handles as $hid => $handle){
+ $h_attrs = $this->a_handles[$hid]->by_object[$name]->get_multi_init_values();
+ if(count($attrs) == 0){
+ $attrs = $h_attrs;
+ }else{
+ $attrs = $this->array_intersect($attrs,$h_attrs);
+ }
+ $all = $this->array_combine($all,$h_attrs);
}
}
- $all = $this->array_combine($all,$handle->by_object[$first]->attrs);
- }
- foreach($this->o_tab->by_object as $name => $obj){
$this->o_tab->by_object[$name]->init_multiple_support($attrs,$all);
}
}
$this->o_tab->by_object[$name]->init_multiple_support($attrs,$all);
}
}
*/
public function execute()
{
*/
public function execute()
{
- return($this->o_tab->execute());
+ $str = $this->o_tab->execute();
+ return($str);
}
}
{
foreach($this->a_handles as $i_id => $o_handle){
if($o_handle->password_change_needed() && isset($o_handle->by_object['user'])){
{
foreach($this->a_handles as $i_id => $o_handle){
if($o_handle->password_change_needed() && isset($o_handle->by_object['user'])){
- new msg_dialog(_("Password reset"),_("The user password was resetted, please set a new password value!"),WARNING_DIALOG);
+ new msg_dialog(_("Reset password"),_("The user password has been reset. Please set a new password!"),WARNING_DIALOG);
change_password ($o_handle->dn, "",0, $o_handle->by_object['user']->pw_storage);
}
}
change_password ($o_handle->dn, "",0, $o_handle->by_object['user']->pw_storage);
}
}