diff --git a/gosa-core/plugins/admin/ogroups/class_ogroup.inc b/gosa-core/plugins/admin/ogroups/class_ogroup.inc
index 5e1dec7ae4113b6f7d64c8df6c33587f1cb3a738..b833a9186d5db04e62c5b92414c98e845fa4113d 100644 (file)
<?php
-
+/*
+ * 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
+ */
/* Sort multidimensional arrays for key 'text' */
function sort_list($val1, $val2)
}
}
if($skipped){
- print_red(_("You can only have terminals or workstations in one group, but not both."));
+ msg_dialog::display(_("Information"), _("You cannot combine terminals and workstations in one object group!"), INFO_DIALOG);
}
$this->reload();
}
/* Do we represent a valid group? */
if (!$this->is_account){
$display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\"> <b>".
- _("This 'dn' is no object group.")."</b>";
+ msgPool::noValidExtension("object group")."</b>";
return ($display);
}
- /* Delete objects from group */
- if (isset($_POST['delete_membership']) && isset($_POST['members'])){
- foreach ($_POST['members'] as $value){
- if(isset($this->memberList[$value])){
- $this->objects["$value"]= $this->memberList[$value];
- unset ($this->memberList["$value"]);
- unset ($this->member["$value"]);
- uasort ($this->objects, 'sort_list');
- reset ($this->objects);
- }
- }
- $this->reload();
- }
-
- /* Add objects to group */
- if (isset($_POST['add_object_finish']) && isset($_POST['objects'])){
- foreach ($_POST['objects'] as $value){
- if(isset($this->objects[$value])){
- $this->memberList["$value"]= $this->objects[$value];
- $this->member["$value"]= $value;
- unset ($this->objects[$value]);
- uasort ($this->memberList, 'sort_list');
- reset ($this->memberList);
- }
- }
- $this->reload();
- }
/* Load templating engine */
$smarty= get_smarty();
$smarty->assign("tree_image", get_template_path('images/tree.png'));
$smarty->assign("deplist", $this->config->idepartments);
$smarty->assign("alphabet", generate_alphabet());
- foreach( array("dselect", "regex", "accounts", "groups", "applications",
- "departments", "servers", "workstations", "winstations", "terminals","subtrees",
- "printers", "phones") as $type){
+ foreach( array("dselect", "regex", "subtrees") as $type){
$smarty->assign("$type", $ogfilter[$type]);
}
$smarty->assign("hint", print_sizelimit_warning());
$smarty->assign("apply", apply_filter());
+ /* Build up checkboxes
+ */
+ $ar = array(
+ "departments" => array(
+ "T" => msgPool::selectToView(_("departments")),
+ "C" => (isset($ogfilter['departments']) && ($ogfilter['departments'])),
+ "L" => sprintf(_("Show %s"),_("departments"))),
+ "accounts" => array(
+ "T" => msgPool::selectToView(_("people")),
+ "C" => (isset($ogfilter['accounts']) && ($ogfilter['accounts'])),
+ "L" => sprintf(_("Show %s"),_("people"))),
+ "groups"=> array(
+ "T" => msgPool::selectToView(_("groups")),
+ "C" => (isset($ogfilter['groups']) && ($ogfilter['groups'])),
+ "L" => sprintf(_("Show %s"),_("groups"))),
+ "applications"=> array(
+ "T" => msgPool::selectToView(_("applications")),
+ "C" => (isset($ogfilter['applications']) && ($ogfilter['applications'])),
+ "L" => sprintf(_("Show %s"),_("applications"))),
+ "servers"=> array(
+ "T" => msgPool::selectToView(_("servers")),
+ "C" => (isset($ogfilter['servers']) && ($ogfilter['servers'])),
+ "L" => sprintf(_("Show %s"),_("servers"))),
+ "workstations"=> array(
+ "T" => msgPool::selectToView(_("workstations")),
+ "C" => (isset($ogfilter['workstations']) && ($ogfilter['workstations'])),
+ "L" => sprintf(_("Show %s"),_("workstations"))),
+ "terminals"=> array(
+ "T" => msgPool::selectToView(_("terminals")),
+ "C" => (isset($ogfilter['terminals']) && ($ogfilter['terminals'])),
+ "L" => sprintf(_("Show %s"),_("terminals"))),
+ "printers"=> array(
+ "T" => msgPool::selectToView(_("printer")),
+ "C" => (isset($ogfilter['printers']) && ($ogfilter['printers'])),
+ "L" => sprintf(_("Show %s"),_("printers"))),
+ "phones"=> array(
+ "T" => msgPool::selectToView(_("phones")),
+ "C" => (isset($ogfilter['phones']) && ($ogfilter['phones'])),
+ "L" => sprintf(_("Show %s"),_("phones"))));
+ $smarty->assign("checkboxes",$ar);
$display= $smarty->fetch (get_template_path('ogroup_objects.tpl', TRUE, dirname(__FILE__)));
return ($display);
}
error_reporting(0);
if (isset($type[1]) && preg_match('/[UGADSFOWTP]/', $type[1])){
$p2= $conv[$type[1]];
- $smarty->assign("combinedObjects", "$p1 "._("and")." $p2");
+ $smarty->assign("combinedObjects", sprintf("'%s' and '%s'", $p1, $p2));
} else {
$smarty->assign("combinedObjects", "$p1");
}
it seams that this entry was removed
*/
/* Try to resolv the entry again, if it still fails, display error msg */
- $ldap->cat($dn, array("cn", "sn", "givenName", "ou", "description", "objectClass"));
+ $ldap->cat($dn, array("cn", "sn", "givenName", "ou", "description", "objectClass", "macAddress"));
/* It has failed, add entry with type flag I (Invalid)*/
- if ($ldap->error != "Success"){
+ if (!$ldap->success()){
$this->memberList[$dn]= array('text' => _("Non existing dn:")." ".@LDAP::fix($dn),"type" => "I");
} else {
$this->objcache[$attrs["dn"]]= array("text" => "$name", "type" => "$type");
}
$this->objcache[$attrs["dn"]]['objectClass'] = $attrs['objectClass'];
+
+ if(isset($attrs['macAddress'][0])){
+ $this->objcache[$attrs["dn"]]['macAddress'] = $attrs['macAddress'][0];
+ }else{
+ $this->objcache[$attrs["dn"]]['macAddress'] = "";
+ }
+
if(isset($attrs['uid'])){
$this->objcache[$attrs["dn"]]['uid'] = $attrs['uid'];
}
}
if($ldap->count() !=0){
- $message[]= _("There is already an object with this cn.");
+ $message[]= msgPool::duplicated(_("Name"));
}
/* Set new acl base */
/* must: cn */
if ($this->cn == ""){
- $message[]= "The required field 'Name' is not set.";
+ $message[]= msgPool::required(_("Name"));
}
/* To many different object types? */
if (strlen($this->gosaGroupObjects) > 4){
- $message[]= _("You can combine two different object types at maximum only!");
+ $message[]= _("You can combine two different object types at maximum, only!");
}
return ($message);
$this->handle_post_events($mode);
$ret= 0;
- if (show_ldap_error($ldap->get_error(), sprintf(_("Saving of object group/generic with dn '%s' failed."),$this->dn))){
+ if (!$ldap->success()){
+ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
$ret= 1;
}
$ldap= $this->config->get_ldap_link();
$ldap->rmdir($this->dn);
- show_ldap_error($ldap->get_error(), sprintf(_("Removing of object group/generic with dn '%s' failed."),$this->dn));
+ if (!$ldap->success()){
+ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
+ }
new log("remove","ogroups/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());