diff --git a/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc b/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc
index 5740877402040ba9736e3be50994c5d5dd4044e9..8a0fd3dc7698d6fc658f9989dc9d4349a61937ce 100644 (file)
<?php
/*
- This code is part of GOsa (https://gosa.gonicus.de)
- Copyright (C) 2004 Cajus Pollmeier
-
- 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
*/
class ogroupManagement extends plugin
{
/* Definitions */
var $plHeadline= "Object groups";
- var $plDescription= "This does something";
+ var $plDescription= "Manage object groups";
/* attribute list for save action */
var $attributes= array();
Variable intialisation && Check posts for commands
****************/
- $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^group_edit_/","/^group_del_/","/^item_selected/","/^remove_multiple_ogroups/");
+ session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^group_edit_/","/^group_del_/","/^item_selected/","/^remove_multiple_ogroups/"));
$smarty = get_smarty();
$s_action = "";
$s_action = "del_multiple";
}
+ /* Hanlde notification event requests */
+ if(isset($_POST['menu_action']) && preg_match("/^event/",$_POST['menu_action'])){
+ $s_action = $_POST['menu_action'];
+ }
+
+
+ /********************
+ Create notification event
+ ********************/
+
+ if(preg_match("/^event_/",$s_action) && class_available("DaemonEvent")){
+ $ids = $this->list_get_selected_items();
+ $uids = array();
+ foreach($ids as $id){
+ $uids[] = $this->ogrouplist[$id]['cn'][0];
+ }
+ if(count($uids)){
+ $events = DaemonEvent::get_event_types(USER_EVENT);
+ $event = preg_replace("/^event_/","",$s_action);
+ if(isset($events['BY_CLASS'][$event])){
+ $type = $events['BY_CLASS'][$event];
+ $this->ogroup = new $type['CLASS_NAME']($this->config);
+ $this->ogroup->add_targets($uids);
+ $this->ogroup->set_type(TRIGGERED_EVENT);
+ }
+ }
+ }
+
+ /* Abort event dialog */
+ if(isset($_POST['abort_event_dialog'])){
+ $this->ogroup = FALSE;
+ }
+
+ /* Save event */
+ if(isset($_POST['save_event_dialog'])){
+ $o_queue = new gosaSupportDaemon();
+ $o_queue->append($this->ogroup);
+ if($o_queue->is_error()){
+ msg_dialog::display(_("Infrastructure error"), msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
+ }else{
+ $this->ogroup = FALSE;
+ }
+ }
+
+ /* Display event */
+ if($this->ogroup instanceof DaemonEvent){
+ $this->ogroup->save_object();
+ return($this->ogroup->execute());
+ }
+
/****************
Copy & Paste handling
react on this. */
$this->dn= "new";
- /* Create new usertab object */
+ /* Create new ogroup- object */
$this->ogroup= new ogrouptabs($this->config,$this->config->data['TABS']['OGROUPTABS'], $this->dn,"ogroups");
$this->ogroup->set_acl_base($this->DivListOGroup->selectedBase);
}
}
$this->dns[$id] = $dn;
}
- $dns_names = "<br><pre>";
+ $dns_names = array();
foreach($this->dns as $dn){
add_lock ($dn, $this->ui->dn);
- $dns_names .= $dn."\n";
+ $dns_names[] = @LDAP::fix($dn);
}
- $dns_names .="</pre>";
+
/* Lock the current entry, so nobody will edit it during deletion */
- if (count($this->dns) == 1){
- $smarty->assign("info", sprintf(_("You're about to delete the following object entry %s"), @LDAP::fix($dns_names)));
- } else {
- $smarty->assign("info", sprintf(_("You're about to delete the following object entries %s"), @LDAP::fix($dns_names)));
- }
+ $smarty->assign("info", msgPool::deleteInfo($dns_names,_("object group")));
$smarty->assign("multiple", true);
return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
}
/* Normally this shouldn't be reached, send some extra
logs to notify the administrator */
- print_red (_("You are not allowed to delete this object group!"));
+ msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
new log("security","ogroups/".get_class($this),$dn,array(),"Tried to trick deletion.");
}
/* Remove lock file after successfull deletion */
/* Lock the current entry, so nobody will edit it during deletion */
add_lock ($this->dn, $this->ui->dn);
- $smarty->assign("info", sprintf(_("You're about to delete the object group '%s'."), @LDAP::fix($this->dn)));
+ $smarty->assign("info", msgPool::deleteInfo(@LDAP::fix($this->dn),_("object group")));
$smarty->assign("multiple", false);
return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
} else {
/* Obviously the user isn't allowed to delete. Show message and
clean session. */
- print_red (_("You are not allowed to delete this object group!"));
+ msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
}
}
/* Normally this shouldn't be reached, send some extra
logs to notify the administrator */
- print_red (_("You are not allowed to delete this object group!"));
+ msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
new log("security","ogroups/".get_class($this),$dn,array(),"Tried to trick deletion.");
}
/* Remove lock file after successfull deletion */
del_lock ($this->dn);
- unset($_SESSION['objectinfo']);
+ session::un_set('objectinfo');
}
/* Delete group canceled? */
if (isset($_POST['delete_cancel'])){
del_lock ($this->dn);
- unset($_SESSION['objectinfo']);
+ session::un_set('objectinfo');
}
/* Register grouptab to trigger edit dialog */
$this->ogroup= new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $this->dn, "ogroups");
$this->ogroup->set_acl_base($this->dn);
- $_SESSION['objectinfo']= $this->dn;
+ session::set('objectinfo',$this->dn);
}
unset ($this->ogroup);
$this->ogroup= NULL;
- unset ($_SESSION['objectinfo']);
+ session::un_set('objectinfo');
}
} else {
/* Ok. There seem to be errors regarding to the tab data,
show message and continue as usual. */
- show_errors($message);
+ msg_dialog::displayChecks($message);
}
}
del_lock ($this->ogroup->dn);
unset ($this->ogroup);
$this->ogroup= NULL;
- unset($_SESSION['objectinfo']);
+ session::un_set('objectinfo');
}
/* Don't show buttons if tab dialog requests this */
if (!$this->ogroup->by_object[$this->ogroup->current]->dialog){
$display.= "<p style=\"text-align:right\">\n";
- $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\""._("Ok")."\">\n";
+ $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
$display.= " \n";
if ($this->dn != "new"){
- $display.= "<input type=submit name=\"edit_apply\" value=\""._("Apply")."\">\n";
+ $display.= "<input type=submit name=\"edit_apply\" value=\"".msgPool::applyButton()."\">\n";
$display.= " \n";
}
- $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+ $display.= "<input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
$display.= "</p>";
}
return ($display);
/* Return departments, that will be included within snapshot detection */
function get_used_snapshot_bases()
{
- return(array(get_groups_ou().$this->DivListOGroup->selectedBase));
+ return(array(get_ou('ogroupou').$this->DivListOGroup->selectedBase));
}
"S" => array("select_server.png" ,_("Server") , "ogroup"),
"F" => array("select_phone.png" ,_("Phone") , "phonequeue"),
"W" => array("select_workstation.png" ,_("Workstation") , "workstartup"),
+ "O" => array("select_winstation.png" ,_("Windows Install") , "ogroup"),
"T" => array("select_terminal.png" ,_("Terminal") , "termgroup"),
"P" => array("select_printer.png" ,_("Printer") , "ogroup"));
"DepartmentGroups" => "(gosaGroupObjects=*D*)" ,
"ServerGroups" => "(gosaGroupObjects=*S*)" ,
"WorkstationGroups" => "(gosaGroupObjects=*W*)" ,
+ "WindowsGroups" => "(gosaGroupObjects=*O*)" ,
"TerminalGroups" => "(gosaGroupObjects=*T*)" ,
"PrinterGroups" => "(gosaGroupObjects=*P*)" ,
"PhoneGroups" => "(gosaGroupObjects=*F*)" );
$filter= "(&(cn=$Regex)(objectClass=gosaGroupOfNames)(|$filter))";
if($this->DivListOGroup->SubSearch){
- $res= get_list($filter, "ogroups", $base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT | GL_SUBSEARCH);
+ $res= get_sub_list($filter, "ogroups",get_ou('ogroupou'), $base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT | GL_SUBSEARCH);
}else{
- $res= get_list($filter, "ogroups", get_groups_ou().$base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT );
+ $res= get_sub_list($filter, "ogroups",get_ou('ogroupou'), get_ou('ogroupou').$base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT );
}
$this->ogrouplist= $res;
ksort ($this->ogrouplist);
reset ($this->ogrouplist);
$tmp=array();
+ $tmp2 = array();
foreach($this->ogrouplist as $tkey => $val ){
$tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
+ $tmp2[strtolower($val['cn'][0]).$val['cn'][0]] = strtolower($val['cn'][0]).$val['cn'][0];
}
- ksort($tmp);
+ natcasesort($tmp2);
$this->ogrouplist=array();
- foreach($tmp as $val){
- $this->ogrouplist[]=$val;
+ foreach($tmp2 as $val){
+ $this->ogrouplist[]=$tmp[$val];
}
reset ($this->ogrouplist);
}
/* Return C&P dialog */
if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
- /* Load entry from queue and set base */
- $this->CopyPasteHandler->load_entry_from_queue();
- $this->CopyPasteHandler->SetVar("base",$this->DivListOGroup->selectedBase);
-
/* Get dialog */
$data = $this->CopyPasteHandler->execute();
+ $this->CopyPasteHandler->SetVar("base",$this->DivListOGroup->selectedBase);
/* Return dialog data */
if(!empty($data)){
function save_object()
{
$this->DivListOGroup->save_object();
+ if(is_object($this->CopyPasteHandler)){
+ $this->CopyPasteHandler->save_object();
+ }
}
}