Code

Updated copy & paste base adaption
[gosa.git] / 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();
41   function ogroupManagement (&$config, $dn= NULL)
42   {
43     /* Include config object */
44     $this->config= &$config;
45     $this->ui= get_userinfo();
47     /* Copy & Paste enabled ?
48      */
49     if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE'] ))){
50       $this->CopyPasteHandler = new CopyPasteHandler($this->config);
51     }
53     /* Div lsit management */
54     $this->DivListOGroup = new divListOGroup($this->config,$this);
55   }
57   function execute()
58   {
59     /* Call parent execute */
60     plugin::execute();
62     /****************
63       Variable intialisation && Check posts for commands  
64      ****************/
66     session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^group_edit_/","/^group_del_/","/^item_selected/","/^remove_multiple_ogroups/","/^menu_action/"));
68     $smarty     = get_smarty();
69     $s_action   = "";
70     $s_entry    = "";
72     /* Test Posts */
73     foreach($_POST as $key => $val){
74       // Post for delete
75       if(preg_match("/^group_del.*/",$key)){
76         $s_action = "del";
77         $s_entry  = preg_replace("/^group_".$s_action."_/i","",$key);
78         // Post for edit
79       }elseif(preg_match("/^group_edit_.*/",$key)){
80         $s_action="edit";
81         $s_entry  = preg_replace("/^group_".$s_action."_/i","",$key);
82         // Post for new
83       }elseif(preg_match("/^group_new.*/",$key)){
84         $s_action="new";
85       }elseif(preg_match("/^editPaste.*/i",$key)){
86         $s_action="editPaste";
87       }elseif(preg_match("/^copy_.*/",$key)){
88         $s_action="copy";
89         $s_entry  = preg_replace("/^copy_/i","",$key);
90       }elseif(preg_match("/^cut_.*/",$key)){
91         $s_action="cut";
92         $s_entry  = preg_replace("/^cut_/i","",$key);
93       }elseif(preg_match("/^remove_multiple_ogroups/",$key)){
94         $s_action="del_multiple";
95       }elseif(preg_match("/^multiple_cut_ogroups/",$key)){
96         $s_action = "cut_multiple";
97       }elseif(preg_match("/^multiple_copy_ogroups/",$key)){
98         $s_action = "copy_multiple";
99       }elseif(preg_match("/_group_edit_/",$key)){
100         $type = preg_replace("/_group_edit_.*$/","",$key);
101         $s_action="edit";
102         $s_entry  = preg_replace("/".$type."_group_edit_/i","",$key);
103         $_POST['arg'] = $type;
104       }
105     }
106     $s_entry  = preg_replace("/_.$/","",$s_entry);
108     // Edit if
109     if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
110       $s_action ="edit";
111       $s_entry  = $_GET['id'];
112     }
116     /* handle C&P from layers menu */
117     if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
118       $s_action = "copy_multiple";
119     }
120     if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
121       $s_action = "cut_multiple";
122     }
123     if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
124       $s_action = "editPaste";
125     }
127     /* Create options */
128     if(isset($_POST['menu_action']) && $_POST['menu_action'] == "group_new"){
129       $s_action = "new";
130     }
132     /* handle remove from layers menu */
133     if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
134       $s_action = "del_multiple";
135     }
137     /* Hanlde notification event requests */
138     if(isset($_POST['menu_action']) && preg_match("/^event/",$_POST['menu_action'])){
139       $s_action = $_POST['menu_action'];
140     }
143     /********************
144       Create notification event
145      ********************/
147     if(preg_match("/^event_/",$s_action) && class_available("DaemonEvent")){
148       $ids = $this->list_get_selected_items();
149       $uids = array();
150       foreach($ids as $id){
151         $uids[] = $this->ogrouplist[$id]['cn'][0];
152       }
153       if(count($uids)){
154         $events = DaemonEvent::get_event_types(USER_EVENT);
155         $event = preg_replace("/^event_/","",$s_action);
156         if(isset($events['BY_CLASS'][$event])){
157           $type = $events['BY_CLASS'][$event];
158           $this->ogroup = new $type['CLASS_NAME']($this->config);
159           $this->ogroup->add_targets($uids);
160           $this->ogroup->set_type(TRIGGERED_EVENT);
161         }
162       }
163     }
165     /* Abort event dialog */
166     if(isset($_POST['abort_event_dialog'])){
167       $this->ogroup = FALSE;
168     }
170     /* Save event */
171     if(isset($_POST['save_event_dialog'])){
172       $o_queue = new gosaSupportDaemon();
173       $o_queue->append($this->ogroup);
174       if($o_queue->is_error()){
175         msg_dialog::display(_("Infrastructure error"), msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
176       }else{
177         $this->ogroup = FALSE;
178       }
179     }
181     /* Display event */
182     if($this->ogroup instanceof DaemonEvent){
183       $this->ogroup->save_object();
184       return($this->ogroup->execute());
185     }
188     /****************
189       Copy & Paste handling 
190      ****************/
192     /* Display the copy & paste dialog, if it is currently open */
193     $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
194     if($ret){
195       return($ret);
196     }
199     /***************
200       Create a new object group 
201      ****************/
203     /* New group? */
204     if ($s_action=="new"){
206       /* By default we set 'dn' to 'new', all relevant plugins will
207          react on this. */
208       $this->dn= "new";
210       /* Create new ogroup- object */
211       $this->ogroup= new ogrouptabs($this->config,$this->config->data['TABS']['OGROUPTABS'], $this->dn,"ogroups");
212       $this->ogroup->set_acl_base($this->DivListOGroup->selectedBase);
213     }
216     /********************
217       Delete MULTIPLE entries requested, display confirm dialog
218      ********************/
219     if ($s_action=="del_multiple"){
220       $ids = $this->list_get_selected_items();
222       if(count($ids)){
223         $this->dns = array();
224         $disallowed = array();
225         foreach($ids as $id){
226           $dn = $this->ogrouplist[$id]['dn'];
227           $acl = $this->ui->get_permissions($dn, "users/user");
228           if(preg_match("/d/",$acl)){
229             $this->dns[$id] = $dn;
230           }else{
231             $disallowed[] = $dn;
232           }
233         }
235         if(count($disallowed)){
236           msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG);
237         }
239         if(count($this->dns)){
241           /* Check locks */
242           if ($user= get_multiple_locks($this->dns)){
243             return(gen_locked_message($user,$this->dns));
244           }
246           $dns_names = array();
247           foreach($this->dns as $dn){
248             $dns_names[] = @LDAP::fix($dn);
249           }
251           add_lock ($this->dns, $this->ui->dn);
253           /* Lock the current entry, so nobody will edit it during deletion */
254           $smarty->assign("info", msgPool::deleteInfo($dns_names,_("object group")));
255           $smarty->assign("multiple", true);
256           return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
257         }
258       }
259     }
262     /********************
263       Delete MULTIPLE entries confirmed
264      ********************/
266     /* Confirmation for deletion has been passed. Users should be deleted. */
267     if (isset($_POST['delete_multiple_ogroup_confirm'])){
269       /* Remove user by user and check acls before removeing them */
270       foreach($this->dns as $key => $dn){
272         $acl = $this->ui->get_permissions($dn, "ogroups");
273         if (preg_match('/d/', $acl)){
275           /* Delete request is permitted, perform LDAP action */
276           $this->ogroup= new ogrouptabs($this->config,$this->config->data['TABS']['OGROUPTABS'], $dn);
277           $this->ogroup->delete ();
278           unset ($this->ogroup);
279           $this->ogroup= NULL;
280         } else {
282           /* Normally this shouldn't be reached, send some extra
283              logs to notify the administrator */
284           msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
285           new log("security","ogroups/".get_class($this),$dn,array(),"Tried to trick deletion.");
286         }
287       }
289       /* Remove lock file after successfull deletion */
290       $this->remove_lock();
291       $this->dns = array();
292     }
295     /********************
296       Delete MULTIPLE entries Canceled
297      ********************/
299     /* Remove lock */
300     if(isset($_POST['delete_multiple_ogroup_cancel'])){
302       /* Remove lock file after successfull deletion */
303       $this->remove_lock();
304       $this->dns = array();
305     }
308     /****************
309       Delete object group
310      ****************/
312     if ($s_action=="del"){
314       /* Get 'dn' from posted 'uid' */
315       $this->dn= $this->ogrouplist[$s_entry]['dn'];
317       /* Load permissions for selected 'dn' and check if
318          we're allowed to remove this 'dn' */
319       $acl = $this->ui->get_permissions($this->dn,"ogroups");
320       if(preg_match("/d/",$acl)){
322         /* Check locking, save current plugin in 'back_plugin', so
323            the dialog knows where to return. */
324         if (($user= get_lock($this->dn)) != ""){
325           return(gen_locked_message ($user, $this->dn));
326         }
328         /* Lock the current entry, so nobody will edit it during deletion */
329         add_lock ($this->dn, $this->ui->dn);
330         $smarty->assign("info", msgPool::deleteInfo(@LDAP::fix($this->dn),_("object group")));
331         $smarty->assign("multiple", false);
332         return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
333       } else {
335         /* Obviously the user isn't allowed to delete. Show message and
336            clean session. */
337         msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
338       }
339     }
342     /****************
343       Delete confirmed 
344      ****************/
346     /* Confirmation for deletion has been passed. Group should be deleted. */
347     if (isset($_POST['delete_group_confirm'])){
349       /* Some nice guy may send this as POST, so we've to check
350          for the permissions again. */
351       $acl = $this->ui->get_permissions($this->dn,"ogroups");
352       if(preg_match("/d/",$acl)){
354         /* Delete request is permitted, perform LDAP action */
355         $this->ogroup= new ogrouptabs($this->config,
356             $this->config->data['TABS']['OGROUPTABS'], $this->dn);
357         $this->ogroup->delete ();
358         unset ($this->ogroup);
359         $this->ogroup= NULL;
360       } else {
362         /* Normally this shouldn't be reached, send some extra
363            logs to notify the administrator */
364         msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
365         new log("security","ogroups/".get_class($this),$dn,array(),"Tried to trick deletion.");
366       }
368       /* Remove lock file after successfull deletion */
369       $this->remove_lock();
370       session::un_set('objectinfo');
371     }
374     /****************
375       Delete object group Canceled
376      ****************/
378     /* Delete group canceled? */
379     if (isset($_POST['delete_cancel'])){
380       $this->remove_lock();
381       session::un_set('objectinfo');
382     }
385     /****************
386       Edit group
387      ****************/
389     if (($s_action=="edit") && (! isset($this->ogroup->config)) ){
391       /* Get 'dn' from posted 'uid', must be unique */
392       $this->dn= $this->ogrouplist[$s_entry]['dn'];
394       /* Check locking, save current plugin in 'back_plugin', so
395          the dialog knows where to return. */
396       if (($user= get_lock($this->dn)) != ""){
397         return(gen_locked_message ($user, $this->dn));
398       }
400       /* Lock the current entry, so everyone will get the
401          above dialog */
402       add_lock ($this->dn, $this->ui->dn);
404       /* Register grouptab to trigger edit dialog */
405       $this->ogroup= new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $this->dn, "ogroups");
406       $this->ogroup->set_acl_base($this->dn);
407       session::set('objectinfo',$this->dn);
408     }
411     /****************
412       Edit finished save 
413      ****************/
415     /* Finish button has been pressed */
416     if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->ogroup->config)) ){
418       /* Check tabs, will feed message array */
419       $message= $this->ogroup->check();
421       /* Save, or display error message? */
422       if (count($message) == 0){
424         /* Save user data to ldap */
425         $this->ogroup->save();
427         if (!isset($_POST['edit_apply'])){
428           /* Group has been saved successfully, remove lock from
429              LDAP. */
430           if ($this->dn != "new"){
431             $this->remove_lock();
432           }
434           unset ($this->ogroup);
435           $this->ogroup= NULL;
436           session::un_set('objectinfo');
437         }else{
439           /* Reinitialize tab */
440           if($this->ogroup instanceof tabs){
441             $this->ogroup->re_init();
442           }
443         }
444       } else {
445         /* Ok. There seem to be errors regarding to the tab data,
446            show message and continue as usual. */
447         msg_dialog::displayChecks($message);
448       }
449     }
452     /****************
453       Cancel edit object group
454      ****************/
456     /* Cancel dialogs */
457     if ((isset($_POST['edit_cancel']))  && (isset($this->ogroup->dn))){
458       $this->remove_lock();
459       $this->ogroup= NULL;
460       session::un_set('objectinfo');
461     }
464     /****************
465       Display open dialogs 
466      ****************/
468     /* Show dialog if object is present */
469     if (isset($this->ogroup->config)){
470       $display= $this->ogroup->execute();
472       /* Don't show buttons if tab dialog requests this */
473       if (!$this->ogroup->by_object[$this->ogroup->current]->dialog){
474         $display.= "<p style=\"text-align:right\">\n";
475         $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
476         $display.= "&nbsp;\n";
477         if ($this->dn != "new"){
478           $display.= "<input type=submit name=\"edit_apply\" value=\"".msgPool::applyButton()."\">\n";
479           $display.= "&nbsp;\n";
480         }
481         $display.= "<input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
482         $display.= "</p>";
483       }
484       return ($display);
485     }
488     /****************
489       Display list 
490      ****************/
492     /* Check if there is a snapshot dialog open */
493     $base = $this->DivListOGroup->selectedBase;
494     if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
495       return($str);
496     }
498     /* Display dialog with group list */
499     $this->DivListOGroup->parent = $this;
500     $this->DivListOGroup->execute();
502     /* Add departments if subsearch is disabled */
503     if(!$this->DivListOGroup->SubSearch){
504       $this->DivListOGroup->AddDepartments($this->DivListOGroup->selectedBase,4,1);
505     }
506     $this->reload ();
507     $this->DivListOGroup->setEntries($this->ogrouplist);
508     return($this->DivListOGroup->Draw());
509   }
512   /* Return departments, that will be included within snapshot detection */
513   function get_used_snapshot_bases()
514   {
515     return(array(get_ou('ogroupou').$this->DivListOGroup->selectedBase));
516   }
518   
520   function convert_list($input)
521   {
522     $temp= "";
524     $conv= array(   
525         "U" => array("plugins/generic/images/head.png"        ,_("User")        , "ogroup"),
526         "G" => array("plugins/groups/images/groups.png"       ,_("Group")       , "ogroup"),
527         "A" => array("plugins/ogroups/images/application.png" ,_("Application") , "ogroup"),
528         "D" => array("plugins/departments/department.png"     ,_("Department")  , "ogroup"),
529         "S" => array("plugins/ogroups/images/server.png"      ,_("Server")      , "ogroup"),
530         "F" => array("plugins/ogroups/images/asterisk.png"    ,_("Phone")       , "phonequeue"),
531         "W" => array("plugins/ogroups/images/workstation.png" ,_("Workstation") , "workstartup"),
532         "O" => array("plugins/ogroups/images/winstation.png"  ,_("Windows Install") , "ogroup"),
533         "T" => array("plugins/ogroups/images/terminal.png"    ,_("Terminal")    , "termgroup"),
534         "P" => array("plugins/ogroups/images/printer.png"     ,_("Printer")     , "ogroup"));
536     /* Assemble picture */
537     $type= $input['gosaGroupObjects'][0];
538     $type= preg_replace("/[^A-Z]/i","",$type);
539     if (isset($type[0])){
540       $p1['pic']= $conv[$type[0]][0];
541       $p1['tit']= $conv[$type[0]][1];
542       $p1['alt']= $type[0];
543       $p1['lnk']= $conv[$type[0]][2];
544       $html_object_1 = "<input type='image' name='".$p1['lnk']."_group_edit_%KEY' ";
545     } else {
546       $p1['pic']= "images/empty.png";
547       $p1['tit']= "";
548       $p1['alt']= "";
549       $p1['lnk']= "";//$conv[$type[0]][2];
550       $html_object_1 = "<img ";
551     }
553     if (isset($type[1])){
554       $p2['pic']= $conv[$type[1]][0];
555       $p2['alt']= $type[1];
556       $p2['tit']= $conv[$type[1]][1];
557       $p2['lnk']= $conv[$type[1]][2];
558       $html_object_2 = "<input type='image' name='".$p2['lnk']."_group_edit_%KEY' ";
559     } else {
560       $p2['pic']= "images/empty.png";
561       $p2['alt']= "";
562       $p2['tit']= "";
563       $p2['lnk']= ""; //$conv[$type[0]][2];
564       $html_object_2 = "<img ";
565     }
566     
567     $temp = $html_object_1." class='center' id='iconA".preg_replace("/_/","",$p1['lnk']."_group_edit_%KEY")."' 
568       src='".$p1['pic']."' alt='".$p1['alt']."' title='".$p1['tit']."'>";
569     $temp.= $html_object_2." class='center' id='iconB".preg_replace("/_/","",$p2['lnk']."_group_edit_%KEY")."' 
570       src='".$p2['pic']."' alt='".$p2['alt']."' title='".$p2['tit']."'>";
571     return ($temp);
572   }
575   function reload()
576   {
577     /* Set base for all searches && initialise some vars */
578     $this->ogrouplist= array();
579     $base     = $this->DivListOGroup->selectedBase;
580     $filter   = "(gosaGroupObjects=[])";
581     $Regex    = $this->DivListOGroup->Regex;
583     $chk = array(
584         "UserGroups"          => "(gosaGroupObjects=*U*)" ,
585         "GroupGroups"         => "(gosaGroupObjects=*G*)" ,
586         "ApplicationGroups"   => "(gosaGroupObjects=*A*)" ,
587         "DepartmentGroups"    => "(gosaGroupObjects=*D*)" ,
588         "ServerGroups"        => "(gosaGroupObjects=*S*)" ,
589         "WorkstationGroups"   => "(gosaGroupObjects=*W*)" ,
590         "WindowsGroups"       => "(gosaGroupObjects=*O*)" ,
591         "TerminalGroups"      => "(gosaGroupObjects=*T*)" ,
592         "PrinterGroups"       => "(gosaGroupObjects=*P*)" ,
593         "PhoneGroups"         => "(gosaGroupObjects=*F*)" );
594     /* Create filter */ 
595     foreach($chk as $chkBox => $FilterPart){
596       if($this->DivListOGroup->$chkBox){
597         $filter .=  $FilterPart;
598       }
599     }
600     $filter= "(&(cn=$Regex)(objectClass=gosaGroupOfNames)(|$filter))";
602     if($this->DivListOGroup->SubSearch){
603       $res= get_sub_list($filter, "ogroups",get_ou('ogroupou'), $base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT | GL_SUBSEARCH);
604     }else{
605       $res= get_sub_list($filter, "ogroups",get_ou('ogroupou'), get_ou('ogroupou').$base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT );
606     }
608     $this->ogrouplist= $res;
609     ksort ($this->ogrouplist);
610     reset ($this->ogrouplist);
611     $tmp=array();
612     $tmp2 = array();
613     foreach($this->ogrouplist as $tkey => $val ){
614       $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
615       $tmp2[strtolower($val['cn'][0]).$val['cn'][0]] = strtolower($val['cn'][0]).$val['cn'][0];
616     }
617     natcasesort($tmp2);
618     $this->ogrouplist=array();
619     foreach($tmp2 as $val){
620       $this->ogrouplist[]=$tmp[$val];
621     }
622     reset ($this->ogrouplist);
623   }
626   function list_get_selected_items()
627   {
628     $ids = array();
629     foreach($_POST as $name => $value){
630       if(preg_match("/^item_selected_[0-9]*$/",$name)){
631         $id   = preg_replace("/^item_selected_/","",$name);
632         $ids[$id] = $id;
633       }
634     }
635     return($ids);
636   }
639   function copyPasteHandling_from_queue($s_action,$s_entry)
640   {
641     /* Check if Copy & Paste is disabled */
642     if(!is_object($this->CopyPasteHandler)){
643       return("");
644     }
646     $ui = get_userinfo();
648     /* Add a single entry to queue */
649     if($s_action == "cut" || $s_action == "copy"){
651       /* Cleanup object queue */
652       $this->CopyPasteHandler->cleanup_queue();
653       $dn = $this->ogrouplist[$s_entry]['dn'];
654       if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,"ogroups"))){
655         $this->CopyPasteHandler->add_to_queue($dn,$s_action, "ogrouptabs","OGROUPTABS","ogroups");
656       }
657       if($s_action == "cut" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"ogroups"))){
658         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"ogrouptabs","OGROUPTABS","ogroups");
659       }
660     }
663     /* Add entries to queue */
664     if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
666       /* Cleanup object queue */
667       $this->CopyPasteHandler->cleanup_queue();
669       /* Add new entries to CP queue */
670       foreach($this->list_get_selected_items() as $id){
671         $dn = $this->ogrouplist[$id]['dn'];
673         if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,"ogroups"))){
674           $this->CopyPasteHandler->add_to_queue($dn,"copy","ogrouptabs","OGROUPTABS","ogroups");
675         }
676         if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"ogroups"))){
677           $this->CopyPasteHandler->add_to_queue($dn,"cut","ogrouptabs","OGROUPTABS","ogroups");
678         }
679       }
680     }
682     /* Start pasting entries */
683     if($s_action == "editPaste"){
684       $this->start_pasting_copied_objects = TRUE;
685     }
687     /* Return C&P dialog */
688     if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
690       /* Get dialog */
691       $this->CopyPasteHandler->SetVar("base",$this->DivListOGroup->selectedBase);
692       $data = $this->CopyPasteHandler->execute();
694       /* Return dialog data */
695       if(!empty($data)){
696         return($data);
697       }
698     }
699     /* Automatically disable status for pasting */
700     if(!$this->CopyPasteHandler->entries_queued()){
701       $this->start_pasting_copied_objects = FALSE;
702     }
703     return("");
704   }
707   function remove_lock()
708   {
709     if (isset($this->apptabs->dn)){
710       del_lock ($this->apptabs->dn);
711     }
712     if(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
713       del_lock($this->dn);
714     }
715     if(isset($this->dns) && is_array($this->dns) && count($this->dns)){
716       del_lock($this->dns);
717     }
718   }
721   function save_object()
722   {
723     $this->DivListOGroup->save_object();
724     if(is_object($this->CopyPasteHandler)){
725       $this->CopyPasteHandler->save_object();
726     }
727   }
732 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
733 ?>