From 31ba03c962c5cb2f93f45a7530d3b3961a7a8343 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 28 Jan 2010 10:00:28 +0000 Subject: [PATCH] Updated object selection git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15398 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../plugins/admin/ogroups/class_ogroup.inc | 46 +++++++++++-------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/gosa-core/plugins/admin/ogroups/class_ogroup.inc b/gosa-core/plugins/admin/ogroups/class_ogroup.inc index 32bbecd37..75e952c14 100644 --- a/gosa-core/plugins/admin/ogroups/class_ogroup.inc +++ b/gosa-core/plugins/admin/ogroups/class_ogroup.inc @@ -178,7 +178,6 @@ class ogroup extends plugin session::set("sysfilter", $sysfilter); } - /* Load member data */ $this->reload(); } @@ -208,27 +207,37 @@ class ogroup extends plugin } /* Add objects to group */ - if (isset($_POST['objectSelect_save'])){ - + if (isset($_POST['objectSelect_save']) && $this->objectSelect instanceOf objectSelect){ $objects = $this->objectSelect->save(); - print_a($objects); - $this->objectSelect= FALSE; - $this->dialog= FALSE; - return; - $tmp = ""; - foreach($this->memberList as $obj){ - $tmp .= $obj['type']; - } $skipped = FALSE; - foreach ($_POST['objects'] as $value){ - if(preg_match("/T/",$tmp) && $this->objects[$value]['type'] == "W"){ + foreach($objects as $object){ + + $tmp = ""; + foreach($this->memberList as $obj){ + $tmp .= $obj['type']; + } + + $type = $this->getObjectType($object); + $name= $this->getObjectName($object); + $dn = $object['dn']; + + /* Fill array */ + if (isset($object["description"][0])){ + $object= array("text" => "$name [".$object["description"][0]."]", "type" => "$type"); + } elseif (isset($object["uid"][0])) { + $object= array("text" => "$name [".$object["uid"][0]."]", "type" => "$type"); + } else { + $object= array("text" => "$name", "type" => "$type"); + } + + if(preg_match("/T/",$tmp) && $type == "W"){ $skipped =TRUE; - }elseif(preg_match("/W/",$tmp) && $this->objects[$value]['type'] == "T"){ + }elseif(preg_match("/W/",$tmp) && $type == "T"){ $skipped =TRUE; }else{ - $this->memberList["$value"]= $this->objects[$value]; - $this->member["$value"]= $value; - unset ($this->objects[$value]); + + $this->memberList["$dn"]= $object; + $this->member["$dn"]= $dn; uasort ($this->memberList, 'sort_list'); reset ($this->memberList); } @@ -236,7 +245,8 @@ class ogroup extends plugin if($skipped){ msg_dialog::display(_("Information"), _("You cannot combine terminals and workstations in one object group!"), INFO_DIALOG); } - $this->reload(); + $this->objectSelect= FALSE; + $this->dialog= FALSE; } } } -- 2.30.2