Code

Update for Trac Ticket #3181
[gosa.git] / trunk / gosa-core / plugins / admin / ogroups / class_ogroupManagement.inc
1 <?php
2 /*
3  * This code is part of GOsa (http://www.gosa-project.org)
4  * Copyright (C) 2003-2008 GONICUS GmbH
5  *
6  * ID: $$Id$$
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
23 class ogroupManagement extends plugin
24 {
25   /* Definitions */
26   var $plHeadline= "Object groups";
27   var $plDescription= "Manage object groups";
29   /* attribute list for save action */
30   var $attributes= array();
31   var $objectclasses= array();
32   var $obtypes= array();
33   var $ogroup;
35   var $CopyPasteHandler = NULL;
36   var $DivListOGroup    = NULL;
37   var $start_pasting_copied_objects = FALSE;
39   var $dns = array();
40   var $acl_module   = array("ogroups");  
42   function ogroupManagement (&$config, $dn= NULL)
43   {
44     /* Include config object */
45     $this->config= &$config;
46     $this->ui= get_userinfo();
48     /* Copy & Paste enabled ?
49      */
50     if ($this->config->get_cfg_value("copyPaste") == "true"){
51       $this->CopyPasteHandler = new CopyPasteHandler($this->config);
52     }
54     /* Div lsit management */
55     $this->DivListOGroup = new divListOGroup($this->config,$this);
56   }
58   function execute()
59   {
60     /* Call parent execute */
61     plugin::execute();
63     /****************
64       Variable intialisation && Check posts for commands  
65      ****************/
67     session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^group_edit_/","/^group_del_/","/^item_selected/","/^remove_multiple_ogroups/","/^menu_action/"));
69     $smarty     = get_smarty();
70     $s_action   = "";
71     $s_entry    = "";
73     /* Test Posts */
74     foreach($_POST as $key => $val){
75       // Post for delete
76       if(preg_match("/^group_del.*/",$key)){
77         $s_action = "del";
78         $s_entry  = preg_replace("/^group_".$s_action."_/i","",$key);
79         // Post for edit
80       }elseif(preg_match("/^group_edit_.*/",$key)){
81         $s_action="edit";
82         $s_entry  = preg_replace("/^group_".$s_action."_/i","",$key);
83         // Post for new
84       }elseif(preg_match("/^group_new.*/",$key)){
85         $s_action="new";
86       }elseif(preg_match("/^editPaste.*/i",$key)){
87         $s_action="editPaste";
88       }elseif(preg_match("/^copy_.*/",$key)){
89         $s_action="copy";
90         $s_entry  = preg_replace("/^copy_/i","",$key);
91       }elseif(preg_match("/^cut_.*/",$key)){
92         $s_action="cut";
93         $s_entry  = preg_replace("/^cut_/i","",$key);
94       }elseif(preg_match("/^remove_multiple_ogroups/",$key)){
95         $s_action="del_multiple";
96       }elseif(preg_match("/^multiple_cut_ogroups/",$key)){
97         $s_action = "cut_multiple";
98       }elseif(preg_match("/^multiple_copy_ogroups/",$key)){
99         $s_action = "copy_multiple";
100       }elseif(preg_match("/_group_edit_/",$key)){
101         $type = preg_replace("/_group_edit_.*$/","",$key);
102         $s_action="edit";
103         $s_entry  = preg_replace("/".$type."_group_edit_/i","",$key);
104         $_POST['arg'] = $type;
105       }
106     }
107     $s_entry  = preg_replace("/_.$/","",$s_entry);
109     // Edit if
110     if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
111       $s_action ="edit";
112       $s_entry  = $_GET['id'];
113     }
117     /* handle C&P from layers menu */
118     if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
119       $s_action = "copy_multiple";
120     }
121     if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
122       $s_action = "cut_multiple";
123     }
124     if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
125       $s_action = "editPaste";
126     }
128     /* Create options */
129     if(isset($_POST['menu_action']) && $_POST['menu_action'] == "group_new"){
130       $s_action = "new";
131     }
133     /* handle remove from layers menu */
134     if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
135       $s_action = "del_multiple";
136     }
138     /* Hanlde notification event requests */
139     if(isset($_POST['menu_action']) && preg_match("/^event/",$_POST['menu_action'])){
140       $s_action = $_POST['menu_action'];
141     }
144     /********************
145       Create notification event
146      ********************/
148     if(preg_match("/^event_/",$s_action) && class_available("DaemonEvent")){
149       $ids = $this->list_get_selected_items();
150       /* Resolve the selected items to their corresponding uids and group names */
151       $targets = array();
152       foreach($ids as $id){
153         $ogroup = $this->ogrouplist[$id]['cn'][0];
154         $targets['OBJECTGROUPS'][] = $ogroup;
155       }
156       if(count($targets)){
157         $events = DaemonEvent::get_event_types(USER_EVENT);
158         $event = preg_replace("/^event_/","",$s_action);
159         if(isset($events['BY_CLASS'][$event])){
160           $type = $events['BY_CLASS'][$event];
161           $this->ogroup = new $type['CLASS_NAME']($this->config);
162           $this->ogroup->add_targets($targets);
163           $this->ogroup->set_type(TRIGGERED_EVENT);
164         }
165       }
166     }
168     /* Abort event dialog */
169     if(isset($_POST['abort_event_dialog'])){
170       $this->ogroup = FALSE;
171     }
173     /* Save event */
174     if(isset($_POST['save_event_dialog'])){
175       $this->ogroup->save_object();
176       $msgs = $this->ogroup->check();
177       if (count($msgs)) {
178         msg_dialog::displayChecks($msgs);
179       }
180       else {
181         $o_queue = new gosaSupportDaemon();
182         $o_queue->append($this->ogroup);
183         if($o_queue->is_error()){
184           msg_dialog::display(_("Infrastructure error"), msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
185         }else{
186           $this->ogroup = FALSE;
187         }
188       }
189     }
191     /* Display event */
192     if($this->ogroup instanceof DaemonEvent){
193       $this->ogroup->save_object();
194       return($this->ogroup->execute());
195     }
198     /****************
199       Copy & Paste handling 
200      ****************/
202     /* Display the copy & paste dialog, if it is currently open */
203     $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
204     if($ret){
205       return($ret);
206     }
209     /***************
210       Create a new object group 
211      ****************/
213     /* New group? */
214     if ($s_action=="new"){
216       /* By default we set 'dn' to 'new', all relevant plugins will
217          react on this. */
218       $this->dn= "new";
220       /* Create new ogroup- object */
221       $this->ogroup= new ogrouptabs($this->config,$this->config->data['TABS']['OGROUPTABS'], $this->dn,"ogroups");
222       $this->ogroup->set_acl_base($this->DivListOGroup->selectedBase);
223     }
226     /********************
227       Delete MULTIPLE entries requested, display confirm dialog
228      ********************/
229     if ($s_action=="del_multiple"){
230       $ids = $this->list_get_selected_items();
232       if(count($ids)){
233         $this->dns = array();
234         $disallowed = array();
235         foreach($ids as $id){
236           $dn = $this->ogrouplist[$id]['dn'];
237           $acl = $this->ui->get_permissions($dn, "ogroups/ogroup");
238           if(preg_match("/d/",$acl)){
239             $this->dns[$id] = $dn;
240           }else{
241             $disallowed[] = $dn;
242           }
243         }
245         if(count($disallowed)){
246           msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG);
247         }
249         if(count($this->dns)){
251           /* Check locks */
252           if ($user= get_multiple_locks($this->dns)){
253             return(gen_locked_message($user,$this->dns));
254           }
256           $dns_names = array();
257           foreach($this->dns as $dn){
258             $dns_names[] = LDAP::fix($dn);
259           }
261           add_lock ($this->dns, $this->ui->dn);
263           /* Lock the current entry, so nobody will edit it during deletion */
264           $smarty->assign("info", msgPool::deleteInfo($dns_names,_("object group")));
265           $smarty->assign("multiple", true);
266           return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
267         }
268       }
269     }
272     /********************
273       Delete MULTIPLE entries confirmed
274      ********************/
276     /* Confirmation for deletion has been passed. Users should be deleted. */
277     if (isset($_POST['delete_multiple_ogroup_confirm'])){
279       /* Remove user by user and check acls before removeing them */
280       foreach($this->dns as $key => $dn){
282         $acl = $this->ui->get_permissions($dn, "ogroups/ogroup");
283         if (preg_match('/d/', $acl)){
285           /* Delete request is permitted, perform LDAP action */
286           $this->ogroup= new ogrouptabs($this->config,$this->config->data['TABS']['OGROUPTABS'], $dn);
287           $this->ogroup->delete ();
288           unset ($this->ogroup);
289           $this->ogroup= NULL;
290         } else {
292           /* Normally this shouldn't be reached, send some extra
293              logs to notify the administrator */
294           msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
295           new log("security","ogroups/".get_class($this),$dn,array(),"Tried to trick deletion.");
296         }
297       }
299       /* Remove lock file after successfull deletion */
300       $this->remove_lock();
301       $this->dns = array();
302     }
305     /********************
306       Delete MULTIPLE entries Canceled
307      ********************/
309     /* Remove lock */
310     if(isset($_POST['delete_multiple_ogroup_cancel'])){
312       /* Remove lock file after successfull deletion */
313       $this->remove_lock();
314       $this->dns = array();
315     }
318     /****************
319       Delete object group
320      ****************/
322     if ($s_action=="del"){
324       /* Get 'dn' from posted 'uid' */
325       $this->dn= $this->ogrouplist[$s_entry]['dn'];
327       /* Load permissions for selected 'dn' and check if
328          we're allowed to remove this 'dn' */
329       $acl = $this->ui->get_permissions($this->dn,"ogroups/ogroup");
330       if(preg_match("/d/",$acl)){
332         /* Check locking, save current plugin in 'back_plugin', so
333            the dialog knows where to return. */
334         if (($user= get_lock($this->dn)) != ""){
335           return(gen_locked_message ($user, $this->dn));
336         }
338         /* Lock the current entry, so nobody will edit it during deletion */
339         add_lock ($this->dn, $this->ui->dn);
340         $smarty->assign("info", msgPool::deleteInfo(LDAP::fix($this->dn),_("object group")));
341         $smarty->assign("multiple", false);
342         return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
343       } else {
345         /* Obviously the user isn't allowed to delete. Show message and
346            clean session. */
347         msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
348       }
349     }
352     /****************
353       Delete confirmed 
354      ****************/
356     /* Confirmation for deletion has been passed. Group should be deleted. */
357     if (isset($_POST['delete_group_confirm'])){
359       /* Some nice guy may send this as POST, so we've to check
360          for the permissions again. */
361       $acl = $this->ui->get_permissions($this->dn,"ogroups/ogroup");
362       if(preg_match("/d/",$acl)){
364         /* Delete request is permitted, perform LDAP action */
365         $this->ogroup= new ogrouptabs($this->config,
366             $this->config->data['TABS']['OGROUPTABS'], $this->dn);
367         $this->ogroup->delete ();
368         unset ($this->ogroup);
369         $this->ogroup= NULL;
370       } else {
372         /* Normally this shouldn't be reached, send some extra
373            logs to notify the administrator */
374         msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
375         new log("security","ogroups/".get_class($this),$dn,array(),"Tried to trick deletion.");
376       }
378       /* Remove lock file after successfull deletion */
379       $this->remove_lock();
380       set_object_info();
381     }
384     /****************
385       Delete object group Canceled
386      ****************/
388     /* Delete group canceled? */
389     if (isset($_POST['delete_cancel'])){
390       $this->remove_lock();
391       set_object_info();
392     }
395     /****************
396       Edit group
397      ****************/
399     if (($s_action=="edit") && (! isset($this->ogroup->config)) ){
401       /* Get 'dn' from posted 'uid', must be unique */
402       $this->dn= $this->ogrouplist[$s_entry]['dn'];
404       /* Check locking, save current plugin in 'back_plugin', so
405          the dialog knows where to return. */
406       if (($user= get_lock($this->dn)) != ""){
407         return(gen_locked_message ($user, $this->dn,TRUE));
408       }
410       /* Lock the current entry, so everyone will get the
411          above dialog */
412       add_lock ($this->dn, $this->ui->dn);
414       /* Register grouptab to trigger edit dialog */
415       $this->ogroup= new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $this->dn, "ogroups");
416       $this->ogroup->set_acl_base($this->dn);
417       set_object_info($this->dn);
418     }
421     /****************
422       Edit finished save 
423      ****************/
425     /* Finish button has been pressed */
426     if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->ogroup->config)) ){
428       /* Check tabs, will feed message array */
429       $message= $this->ogroup->check();
431       /* Save, or display error message? */
432       if (count($message) == 0){
434         /* Save user data to ldap */
435         $this->ogroup->save();
437         if (!isset($_POST['edit_apply'])){
438           /* Group has been saved successfully, remove lock from
439              LDAP. */
440           if ($this->dn != "new"){
441             $this->remove_lock();
442           }
444           unset ($this->ogroup);
445           $this->ogroup= NULL;
446           set_object_info();
447         }else{
449           /* Reinitialize tab */
450           if($this->ogroup instanceof tabs){
451             $this->ogroup->re_init();
452           }
453         }
454       } else {
455         /* Ok. There seem to be errors regarding to the tab data,
456            show message and continue as usual. */
457         msg_dialog::displayChecks($message);
458       }
459     }
462     /****************
463       Cancel edit object group
464      ****************/
466     /* Cancel dialogs */
467     if ((isset($_POST['edit_cancel']))  && (isset($this->ogroup->dn))){
468       $this->remove_lock();
469       $this->ogroup= NULL;
470       set_object_info();
471     }
474     /****************
475       Display open dialogs 
476      ****************/
478     /* Show dialog if object is present */
479     if (isset($this->ogroup->config)){
480       $display= $this->ogroup->execute();
482       /* Don't show buttons if tab dialog requests this */
483       if(($this->ogroup instanceOf tabs || $this->ogroup instanceOf plugin) && $this->ogroup->read_only == TRUE){
484         $display.= "<p style=\"text-align:right\">
485           <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">
486           </p>";
487       }elseif (!$this->ogroup->by_object[$this->ogroup->current]->dialog){
488         $display.= "<p style=\"text-align:right\">\n";
489         $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
490         $display.= "&nbsp;\n";
491         if ($this->dn != "new"){
492           $display.= "<input type=submit name=\"edit_apply\" value=\"".msgPool::applyButton()."\">\n";
493           $display.= "&nbsp;\n";
494         }
495         $display.= "<input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
496         $display.= "</p>";
497       }
498       return ($display);
499     }
502     /****************
503       Display list 
504      ****************/
506     /* Check if there is a snapshot dialog open */
507     $base = $this->DivListOGroup->selectedBase;
508     if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases(),$this)){
509       return($str);
510     }
512     /* Display dialog with group list */
513     $this->DivListOGroup->parent = $this;
514     $this->DivListOGroup->execute();
516     /* Add departments if subsearch is disabled */
517     if(!$this->DivListOGroup->SubSearch){
518       $this->DivListOGroup->AddDepartments($this->DivListOGroup->selectedBase,4,1);
519     }
520     $this->reload ();
521     $this->DivListOGroup->setEntries($this->ogrouplist);
522     return($this->DivListOGroup->Draw());
523   }
526   /* Return departments, that will be included within snapshot detection */
527   function get_used_snapshot_bases()
528   {
529     return(array(get_ou('ogroupRDN').$this->DivListOGroup->selectedBase));
530   }
532   
534   function convert_list($input)
535   {
536     $temp= "";
538     $conv= array(   
539         "Y" => array("plugins/users/images/select_template.png",_("Templates") , "ogroup"),
540         "U" => array("plugins/generic/images/head.png"        ,_("User")        , "ogroup"),
541         "G" => array("plugins/groups/images/groups.png"       ,_("Group")       , "ogroup"),
542         "A" => array("plugins/ogroups/images/application.png" ,_("Application") , "ogroup"),
543         "D" => array("plugins/departments/department.png"     ,_("Department")  , "ogroup"),
544         "S" => array("plugins/ogroups/images/server.png"      ,_("Server")      , "ogroup"),
545         "F" => array("plugins/ogroups/images/asterisk.png"    ,_("Phone")       , "phonequeue"),
546         "W" => array("plugins/ogroups/images/workstation.png" ,_("Workstation") , "workstartup"),
547         "O" => array("plugins/ogroups/images/winstation.png"  ,_("Windows Install") , "ogroup"),
548         "T" => array("plugins/ogroups/images/terminal.png"    ,_("Terminal")    , "termgroup"),
549         "P" => array("plugins/ogroups/images/printer.png"     ,_("Printer")     , "ogroup"));
551     /* Assemble picture */
552     $type= $input['gosaGroupObjects'][0];
553     $type= preg_replace("/[^A-Z]/i","",$type);
554     if (isset($type[0])){
555       $p1['pic']= $conv[$type[0]][0];
556       $p1['tit']= $conv[$type[0]][1];
557       $p1['alt']= $type[0];
558       $p1['lnk']= $conv[$type[0]][2];
559       $html_object_1 = "<input type='image' name='".$p1['lnk']."_group_edit_%KEY' ";
560     } else {
561       $p1['pic']= "images/empty.png";
562       $p1['tit']= "";
563       $p1['alt']= "";
564       $p1['lnk']= "";//$conv[$type[0]][2];
565       $html_object_1 = "<img ";
566     }
568     if (isset($type[1])){
569       $p2['pic']= $conv[$type[1]][0];
570       $p2['alt']= $type[1];
571       $p2['tit']= $conv[$type[1]][1];
572       $p2['lnk']= $conv[$type[1]][2];
573       $html_object_2 = "<input type='image' name='".$p2['lnk']."_group_edit_%KEY' ";
574     } else {
575       $p2['pic']= "images/empty.png";
576       $p2['alt']= "";
577       $p2['tit']= "";
578       $p2['lnk']= ""; //$conv[$type[0]][2];
579       $html_object_2 = "<img ";
580     }
581     
582     $temp = $html_object_1." class='center' id='iconA".preg_replace("/_/","",$p1['lnk']."_group_edit_%KEY")."' 
583       src='".$p1['pic']."' alt='".$p1['alt']."' title='".$p1['tit']."'>";
584     $temp.= $html_object_2." class='center' id='iconB".preg_replace("/_/","",$p2['lnk']."_group_edit_%KEY")."' 
585       src='".$p2['pic']."' alt='".$p2['alt']."' title='".$p2['tit']."'>";
586     return ($temp);
587   }
590   function reload()
591   {
592     /* Set base for all searches && initialise some vars */
593     $this->ogrouplist= array();
594     $base     = $this->DivListOGroup->selectedBase;
595     $filter   = "(gosaGroupObjects=[])";
596     $Regex    = $this->DivListOGroup->Regex;
598     $chk = array(
599         "UserGroups"          => "(gosaGroupObjects=*U*)" ,
600         "GroupGroups"         => "(gosaGroupObjects=*G*)" ,
601         "ApplicationGroups"   => "(gosaGroupObjects=*A*)" ,
602         "DepartmentGroups"    => "(gosaGroupObjects=*D*)" ,
603         "ServerGroups"        => "(gosaGroupObjects=*S*)" ,
604         "WorkstationGroups"   => "(gosaGroupObjects=*W*)" ,
605         "WindowsGroups"       => "(gosaGroupObjects=*O*)" ,
606         "TerminalGroups"      => "(gosaGroupObjects=*T*)" ,
607         "PrinterGroups"       => "(gosaGroupObjects=*P*)" ,
608         "PhoneGroups"         => "(gosaGroupObjects=*F*)" );
609     /* Create filter */ 
610     foreach($chk as $chkBox => $FilterPart){
611       if($this->DivListOGroup->$chkBox){
612         $filter .=  $FilterPart;
613       }
614     }
615     $filter= "(&(cn=$Regex)(objectClass=gosaGroupOfNames)(|$filter))";
617     if($this->DivListOGroup->SubSearch){
618       $res= get_sub_list($filter, "ogroups",get_ou('ogroupRDN'), $base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT | GL_SUBSEARCH);
619     }else{
620       $res= get_sub_list($filter, "ogroups",get_ou('ogroupRDN'), get_ou('ogroupRDN').$base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT );
621     }
623     $this->ogrouplist= $res;
624     ksort ($this->ogrouplist);
625     reset ($this->ogrouplist);
626     $tmp=array();
627     $tmp2 = array();
628     foreach($this->ogrouplist as $tkey => $val ){
629       $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
630       $tmp2[strtolower($val['cn'][0]).$val['cn'][0]] = strtolower($val['cn'][0]).$val['cn'][0];
631     }
632     natcasesort($tmp2);
633     $this->ogrouplist=array();
634     foreach($tmp2 as $val){
635       $this->ogrouplist[]=$tmp[$val];
636     }
637     reset ($this->ogrouplist);
638   }
641   function list_get_selected_items()
642   {
643     $ids = array();
644     foreach($_POST as $name => $value){
645       if(preg_match("/^item_selected_[0-9]*$/",$name)){
646         $id   = preg_replace("/^item_selected_/","",$name);
647         $ids[$id] = $id;
648       }
649     }
650     return($ids);
651   }
654   function copyPasteHandling_from_queue($s_action,$s_entry)
655   {
656     /* Check if Copy & Paste is disabled */
657     if(!is_object($this->CopyPasteHandler)){
658       return("");
659     }
661     $ui = get_userinfo();
663     /* Add a single entry to queue */
664     if($s_action == "cut" || $s_action == "copy"){
666       /* Cleanup object queue */
667       $this->CopyPasteHandler->cleanup_queue();
668       $dn = $this->ogrouplist[$s_entry]['dn'];
669       if($s_action == "copy" && $ui->is_copyable($dn,"ogroups","ogroup")){
670         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"ogrouptabs","OGROUPTABS","ogroups");
671       }
672       if($s_action == "cut" && $ui->is_cutable($dn,"ogroups","ogroup")){
673         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"ogrouptabs","OGROUPTABS","ogroups");
674       }
675     }
678     /* Add entries to queue */
679     if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
681       /* Cleanup object queue */
682       $this->CopyPasteHandler->cleanup_queue();
684       /* Add new entries to CP queue */
685       foreach($this->list_get_selected_items() as $id){
686         $dn = $this->ogrouplist[$id]['dn'];
688         if($s_action == "copy_multiple" && $ui->is_copyable($dn,"ogroups","ogroup")){ 
689           $this->CopyPasteHandler->add_to_queue($dn,"copy","ogrouptabs","OGROUPTABS","ogroups");
690         }
691         if($s_action == "cut_multiple" && $ui->is_cutable($dn,"ogroups","ogroup")){
692           $this->CopyPasteHandler->add_to_queue($dn,"cut","ogrouptabs","OGROUPTABS","ogroups");
693         }
694       }
695     }
697     /* Start pasting entries */
698     if($s_action == "editPaste"){
699       $this->start_pasting_copied_objects = TRUE;
700     }
702     /* Return C&P dialog */
703     if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
705       /* Get dialog */
706       $this->CopyPasteHandler->SetVar("base",$this->DivListOGroup->selectedBase);
707       $data = $this->CopyPasteHandler->execute();
709       /* Return dialog data */
710       if(!empty($data)){
711         return($data);
712       }
713     }
714     /* Automatically disable status for pasting */
715     if(!$this->CopyPasteHandler->entries_queued()){
716       $this->start_pasting_copied_objects = FALSE;
717     }
718     return("");
719   }
722   function remove_lock()
723   {
724     if (isset($this->apptabs->dn)){
725       del_lock ($this->apptabs->dn);
726     }elseif(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
727       del_lock($this->dn);
728     }
729     if(isset($this->dns) && is_array($this->dns) && count($this->dns)){
730       del_lock($this->dns);
731     }
732   }
735   function save_object()
736   {
737     $this->DivListOGroup->save_object();
738     if(is_object($this->CopyPasteHandler)){
739       $this->CopyPasteHandler->save_object();
740     }
741   }
746 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
747 ?>