Code

1ce25e12db65a58967c347c0fe865133df59815f
[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       $uids = array();
151       foreach($ids as $id){
152         $uids[] = $this->ogrouplist[$id]['cn'][0];
153       }
154       if(count($uids)){
155         $events = DaemonEvent::get_event_types(USER_EVENT);
156         $event = preg_replace("/^event_/","",$s_action);
157         if(isset($events['BY_CLASS'][$event])){
158           $type = $events['BY_CLASS'][$event];
159           $this->ogroup = new $type['CLASS_NAME']($this->config);
160           $this->ogroup->add_targets($uids);
161           $this->ogroup->set_type(TRIGGERED_EVENT);
162         }
163       }
164     }
166     /* Abort event dialog */
167     if(isset($_POST['abort_event_dialog'])){
168       $this->ogroup = FALSE;
169     }
171     /* Save event */
172     if(isset($_POST['save_event_dialog'])){
173       $o_queue = new gosaSupportDaemon();
174       $o_queue->append($this->ogroup);
175       if($o_queue->is_error()){
176         msg_dialog::display(_("Infrastructure error"), msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
177       }else{
178         $this->ogroup = FALSE;
179       }
180     }
182     /* Display event */
183     if($this->ogroup instanceof DaemonEvent){
184       $this->ogroup->save_object();
185       return($this->ogroup->execute());
186     }
189     /****************
190       Copy & Paste handling 
191      ****************/
193     /* Display the copy & paste dialog, if it is currently open */
194     $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
195     if($ret){
196       return($ret);
197     }
200     /***************
201       Create a new object group 
202      ****************/
204     /* New group? */
205     if ($s_action=="new"){
207       /* By default we set 'dn' to 'new', all relevant plugins will
208          react on this. */
209       $this->dn= "new";
211       /* Create new ogroup- object */
212       $this->ogroup= new ogrouptabs($this->config,$this->config->data['TABS']['OGROUPTABS'], $this->dn,"ogroups");
213       $this->ogroup->set_acl_base($this->DivListOGroup->selectedBase);
214     }
217     /********************
218       Delete MULTIPLE entries requested, display confirm dialog
219      ********************/
220     if ($s_action=="del_multiple"){
221       $ids = $this->list_get_selected_items();
223       if(count($ids)){
224         $this->dns = array();
225         $disallowed = array();
226         foreach($ids as $id){
227           $dn = $this->ogrouplist[$id]['dn'];
228           $acl = $this->ui->get_permissions($dn, "users/user");
229           if(preg_match("/d/",$acl)){
230             $this->dns[$id] = $dn;
231           }else{
232             $disallowed[] = $dn;
233           }
234         }
236         if(count($disallowed)){
237           msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG);
238         }
240         if(count($this->dns)){
242           /* Check locks */
243           if ($user= get_multiple_locks($this->dns)){
244             return(gen_locked_message($user,$this->dns));
245           }
247           $dns_names = array();
248           foreach($this->dns as $dn){
249             $dns_names[] = LDAP::fix($dn);
250           }
252           add_lock ($this->dns, $this->ui->dn);
254           /* Lock the current entry, so nobody will edit it during deletion */
255           $smarty->assign("info", msgPool::deleteInfo($dns_names,_("object group")));
256           $smarty->assign("multiple", true);
257           return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
258         }
259       }
260     }
263     /********************
264       Delete MULTIPLE entries confirmed
265      ********************/
267     /* Confirmation for deletion has been passed. Users should be deleted. */
268     if (isset($_POST['delete_multiple_ogroup_confirm'])){
270       /* Remove user by user and check acls before removeing them */
271       foreach($this->dns as $key => $dn){
273         $acl = $this->ui->get_permissions($dn, "ogroups");
274         if (preg_match('/d/', $acl)){
276           /* Delete request is permitted, perform LDAP action */
277           $this->ogroup= new ogrouptabs($this->config,$this->config->data['TABS']['OGROUPTABS'], $dn);
278           $this->ogroup->delete ();
279           unset ($this->ogroup);
280           $this->ogroup= NULL;
281         } else {
283           /* Normally this shouldn't be reached, send some extra
284              logs to notify the administrator */
285           msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
286           new log("security","ogroups/".get_class($this),$dn,array(),"Tried to trick deletion.");
287         }
288       }
290       /* Remove lock file after successfull deletion */
291       $this->remove_lock();
292       $this->dns = array();
293     }
296     /********************
297       Delete MULTIPLE entries Canceled
298      ********************/
300     /* Remove lock */
301     if(isset($_POST['delete_multiple_ogroup_cancel'])){
303       /* Remove lock file after successfull deletion */
304       $this->remove_lock();
305       $this->dns = array();
306     }
309     /****************
310       Delete object group
311      ****************/
313     if ($s_action=="del"){
315       /* Get 'dn' from posted 'uid' */
316       $this->dn= $this->ogrouplist[$s_entry]['dn'];
318       /* Load permissions for selected 'dn' and check if
319          we're allowed to remove this 'dn' */
320       $acl = $this->ui->get_permissions($this->dn,"ogroups");
321       if(preg_match("/d/",$acl)){
323         /* Check locking, save current plugin in 'back_plugin', so
324            the dialog knows where to return. */
325         if (($user= get_lock($this->dn)) != ""){
326           return(gen_locked_message ($user, $this->dn));
327         }
329         /* Lock the current entry, so nobody will edit it during deletion */
330         add_lock ($this->dn, $this->ui->dn);
331         $smarty->assign("info", msgPool::deleteInfo(LDAP::fix($this->dn),_("object group")));
332         $smarty->assign("multiple", false);
333         return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
334       } else {
336         /* Obviously the user isn't allowed to delete. Show message and
337            clean session. */
338         msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
339       }
340     }
343     /****************
344       Delete confirmed 
345      ****************/
347     /* Confirmation for deletion has been passed. Group should be deleted. */
348     if (isset($_POST['delete_group_confirm'])){
350       /* Some nice guy may send this as POST, so we've to check
351          for the permissions again. */
352       $acl = $this->ui->get_permissions($this->dn,"ogroups");
353       if(preg_match("/d/",$acl)){
355         /* Delete request is permitted, perform LDAP action */
356         $this->ogroup= new ogrouptabs($this->config,
357             $this->config->data['TABS']['OGROUPTABS'], $this->dn);
358         $this->ogroup->delete ();
359         unset ($this->ogroup);
360         $this->ogroup= NULL;
361       } else {
363         /* Normally this shouldn't be reached, send some extra
364            logs to notify the administrator */
365         msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
366         new log("security","ogroups/".get_class($this),$dn,array(),"Tried to trick deletion.");
367       }
369       /* Remove lock file after successfull deletion */
370       $this->remove_lock();
371       set_object_info();
372     }
375     /****************
376       Delete object group Canceled
377      ****************/
379     /* Delete group canceled? */
380     if (isset($_POST['delete_cancel'])){
381       $this->remove_lock();
382       set_object_info();
383     }
386     /****************
387       Edit group
388      ****************/
390     if (($s_action=="edit") && (! isset($this->ogroup->config)) ){
392       /* Get 'dn' from posted 'uid', must be unique */
393       $this->dn= $this->ogrouplist[$s_entry]['dn'];
395       /* Check locking, save current plugin in 'back_plugin', so
396          the dialog knows where to return. */
397       if (($user= get_lock($this->dn)) != ""){
398         return(gen_locked_message ($user, $this->dn,TRUE));
399       }
401       /* Lock the current entry, so everyone will get the
402          above dialog */
403       add_lock ($this->dn, $this->ui->dn);
405       /* Register grouptab to trigger edit dialog */
406       $this->ogroup= new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $this->dn, "ogroups");
407       $this->ogroup->set_acl_base($this->dn);
408       set_object_info($this->dn);
409     }
412     /****************
413       Edit finished save 
414      ****************/
416     /* Finish button has been pressed */
417     if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply'])) && (isset($this->ogroup->config)) ){
419       /* Check tabs, will feed message array */
420       $message= $this->ogroup->check();
422       /* Save, or display error message? */
423       if (count($message) == 0){
425         /* Save user data to ldap */
426         $this->ogroup->save();
428         if (!isset($_POST['edit_apply'])){
429           /* Group has been saved successfully, remove lock from
430              LDAP. */
431           if ($this->dn != "new"){
432             $this->remove_lock();
433           }
435           unset ($this->ogroup);
436           $this->ogroup= NULL;
437           set_object_info();
438         }else{
440           /* Reinitialize tab */
441           if($this->ogroup instanceof tabs){
442             $this->ogroup->re_init();
443           }
444         }
445       } else {
446         /* Ok. There seem to be errors regarding to the tab data,
447            show message and continue as usual. */
448         msg_dialog::displayChecks($message);
449       }
450     }
453     /****************
454       Cancel edit object group
455      ****************/
457     /* Cancel dialogs */
458     if ((isset($_POST['edit_cancel']))  && (isset($this->ogroup->dn))){
459       $this->remove_lock();
460       $this->ogroup= NULL;
461       set_object_info();
462     }
465     /****************
466       Display open dialogs 
467      ****************/
469     /* Show dialog if object is present */
470     if (isset($this->ogroup->config)){
471       $display= $this->ogroup->execute();
473       /* Don't show buttons if tab dialog requests this */
474       if(($this->ogroup instanceOf tabs || $this->ogroup instanceOf plugin) && $this->ogroup->read_only == TRUE){
475         $display.= "<p style=\"text-align:right\">
476           <input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">
477           </p>";
478       }elseif (!$this->ogroup->by_object[$this->ogroup->current]->dialog){
479         $display.= "<p style=\"text-align:right\">\n";
480         $display.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
481         $display.= "&nbsp;\n";
482         if ($this->dn != "new"){
483           $display.= "<input type=submit name=\"edit_apply\" value=\"".msgPool::applyButton()."\">\n";
484           $display.= "&nbsp;\n";
485         }
486         $display.= "<input type=submit name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
487         $display.= "</p>";
488       }
489       return ($display);
490     }
493     /****************
494       Display list 
495      ****************/
497     /* Check if there is a snapshot dialog open */
498     $base = $this->DivListOGroup->selectedBase;
499     if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases(),$this)){
500       return($str);
501     }
503     /* Display dialog with group list */
504     $this->DivListOGroup->parent = $this;
505     $this->DivListOGroup->execute();
507     /* Add departments if subsearch is disabled */
508     if(!$this->DivListOGroup->SubSearch){
509       $this->DivListOGroup->AddDepartments($this->DivListOGroup->selectedBase,4,1);
510     }
511     $this->reload ();
512     $this->DivListOGroup->setEntries($this->ogrouplist);
513     return($this->DivListOGroup->Draw());
514   }
517   /* Return departments, that will be included within snapshot detection */
518   function get_used_snapshot_bases()
519   {
520     return(array(get_ou('ogroupRDN').$this->DivListOGroup->selectedBase));
521   }
523   
525   function convert_list($input)
526   {
527     $temp= "";
529     $conv= array(   
530         "Y" => array("plugins/users/images/select_template.png",_("Templates") , "ogroup"),
531         "U" => array("plugins/generic/images/head.png"        ,_("User")        , "ogroup"),
532         "G" => array("plugins/groups/images/groups.png"       ,_("Group")       , "ogroup"),
533         "A" => array("plugins/ogroups/images/application.png" ,_("Application") , "ogroup"),
534         "D" => array("plugins/departments/department.png"     ,_("Department")  , "ogroup"),
535         "S" => array("plugins/ogroups/images/server.png"      ,_("Server")      , "ogroup"),
536         "F" => array("plugins/ogroups/images/asterisk.png"    ,_("Phone")       , "phonequeue"),
537         "W" => array("plugins/ogroups/images/workstation.png" ,_("Workstation") , "workstartup"),
538         "O" => array("plugins/ogroups/images/winstation.png"  ,_("Windows Install") , "ogroup"),
539         "T" => array("plugins/ogroups/images/terminal.png"    ,_("Terminal")    , "termgroup"),
540         "P" => array("plugins/ogroups/images/printer.png"     ,_("Printer")     , "ogroup"));
542     /* Assemble picture */
543     $type= $input['gosaGroupObjects'][0];
544     $type= preg_replace("/[^A-Z]/i","",$type);
545     if (isset($type[0])){
546       $p1['pic']= $conv[$type[0]][0];
547       $p1['tit']= $conv[$type[0]][1];
548       $p1['alt']= $type[0];
549       $p1['lnk']= $conv[$type[0]][2];
550       $html_object_1 = "<input type='image' name='".$p1['lnk']."_group_edit_%KEY' ";
551     } else {
552       $p1['pic']= "images/empty.png";
553       $p1['tit']= "";
554       $p1['alt']= "";
555       $p1['lnk']= "";//$conv[$type[0]][2];
556       $html_object_1 = "<img ";
557     }
559     if (isset($type[1])){
560       $p2['pic']= $conv[$type[1]][0];
561       $p2['alt']= $type[1];
562       $p2['tit']= $conv[$type[1]][1];
563       $p2['lnk']= $conv[$type[1]][2];
564       $html_object_2 = "<input type='image' name='".$p2['lnk']."_group_edit_%KEY' ";
565     } else {
566       $p2['pic']= "images/empty.png";
567       $p2['alt']= "";
568       $p2['tit']= "";
569       $p2['lnk']= ""; //$conv[$type[0]][2];
570       $html_object_2 = "<img ";
571     }
572     
573     $temp = $html_object_1." class='center' id='iconA".preg_replace("/_/","",$p1['lnk']."_group_edit_%KEY")."' 
574       src='".$p1['pic']."' alt='".$p1['alt']."' title='".$p1['tit']."'>";
575     $temp.= $html_object_2." class='center' id='iconB".preg_replace("/_/","",$p2['lnk']."_group_edit_%KEY")."' 
576       src='".$p2['pic']."' alt='".$p2['alt']."' title='".$p2['tit']."'>";
577     return ($temp);
578   }
581   function reload()
582   {
583     /* Set base for all searches && initialise some vars */
584     $this->ogrouplist= array();
585     $base     = $this->DivListOGroup->selectedBase;
586     $filter   = "(gosaGroupObjects=[])";
587     $Regex    = $this->DivListOGroup->Regex;
589     $chk = array(
590         "UserGroups"          => "(gosaGroupObjects=*U*)" ,
591         "GroupGroups"         => "(gosaGroupObjects=*G*)" ,
592         "ApplicationGroups"   => "(gosaGroupObjects=*A*)" ,
593         "DepartmentGroups"    => "(gosaGroupObjects=*D*)" ,
594         "ServerGroups"        => "(gosaGroupObjects=*S*)" ,
595         "WorkstationGroups"   => "(gosaGroupObjects=*W*)" ,
596         "WindowsGroups"       => "(gosaGroupObjects=*O*)" ,
597         "TerminalGroups"      => "(gosaGroupObjects=*T*)" ,
598         "PrinterGroups"       => "(gosaGroupObjects=*P*)" ,
599         "PhoneGroups"         => "(gosaGroupObjects=*F*)" );
600     /* Create filter */ 
601     foreach($chk as $chkBox => $FilterPart){
602       if($this->DivListOGroup->$chkBox){
603         $filter .=  $FilterPart;
604       }
605     }
606     $filter= "(&(cn=$Regex)(objectClass=gosaGroupOfNames)(|$filter))";
608     if($this->DivListOGroup->SubSearch){
609       $res= get_sub_list($filter, "ogroups",get_ou('ogroupRDN'), $base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT | GL_SUBSEARCH);
610     }else{
611       $res= get_sub_list($filter, "ogroups",get_ou('ogroupRDN'), get_ou('ogroupRDN').$base, array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT );
612     }
614     $this->ogrouplist= $res;
615     ksort ($this->ogrouplist);
616     reset ($this->ogrouplist);
617     $tmp=array();
618     $tmp2 = array();
619     foreach($this->ogrouplist as $tkey => $val ){
620       $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
621       $tmp2[strtolower($val['cn'][0]).$val['cn'][0]] = strtolower($val['cn'][0]).$val['cn'][0];
622     }
623     natcasesort($tmp2);
624     $this->ogrouplist=array();
625     foreach($tmp2 as $val){
626       $this->ogrouplist[]=$tmp[$val];
627     }
628     reset ($this->ogrouplist);
629   }
632   function list_get_selected_items()
633   {
634     $ids = array();
635     foreach($_POST as $name => $value){
636       if(preg_match("/^item_selected_[0-9]*$/",$name)){
637         $id   = preg_replace("/^item_selected_/","",$name);
638         $ids[$id] = $id;
639       }
640     }
641     return($ids);
642   }
645   function copyPasteHandling_from_queue($s_action,$s_entry)
646   {
647     /* Check if Copy & Paste is disabled */
648     if(!is_object($this->CopyPasteHandler)){
649       return("");
650     }
652     $ui = get_userinfo();
654     /* Add a single entry to queue */
655     if($s_action == "cut" || $s_action == "copy"){
657       /* Cleanup object queue */
658       $this->CopyPasteHandler->cleanup_queue();
659       $dn = $this->ogrouplist[$s_entry]['dn'];
660       if($s_action == "copy" && $ui->is_copyable($dn,"ogroups","ogroup")){
661         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"ogrouptabs","OGROUPTABS","ogroups");
662       }
663       if($s_action == "cut" && $ui->is_cutable($dn,"ogroups","ogroup")){
664         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"ogrouptabs","OGROUPTABS","ogroups");
665       }
666     }
669     /* Add entries to queue */
670     if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
672       /* Cleanup object queue */
673       $this->CopyPasteHandler->cleanup_queue();
675       /* Add new entries to CP queue */
676       foreach($this->list_get_selected_items() as $id){
677         $dn = $this->ogrouplist[$id]['dn'];
679         if($s_action == "copy_multiple" && $ui->is_copyable($dn,"ogroups","ogroup")){ 
680           $this->CopyPasteHandler->add_to_queue($dn,"copy","ogrouptabs","OGROUPTABS","ogroups");
681         }
682         if($s_action == "cut_multiple" && $ui->is_cutable($dn,"ogroups","ogroup")){
683           $this->CopyPasteHandler->add_to_queue($dn,"cut","ogrouptabs","OGROUPTABS","ogroups");
684         }
685       }
686     }
688     /* Start pasting entries */
689     if($s_action == "editPaste"){
690       $this->start_pasting_copied_objects = TRUE;
691     }
693     /* Return C&P dialog */
694     if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
696       /* Get dialog */
697       $this->CopyPasteHandler->SetVar("base",$this->DivListOGroup->selectedBase);
698       $data = $this->CopyPasteHandler->execute();
700       /* Return dialog data */
701       if(!empty($data)){
702         return($data);
703       }
704     }
705     /* Automatically disable status for pasting */
706     if(!$this->CopyPasteHandler->entries_queued()){
707       $this->start_pasting_copied_objects = FALSE;
708     }
709     return("");
710   }
713   function remove_lock()
714   {
715     if (isset($this->apptabs->dn)){
716       del_lock ($this->apptabs->dn);
717     }elseif(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
718       del_lock($this->dn);
719     }
720     if(isset($this->dns) && is_array($this->dns) && count($this->dns)){
721       del_lock($this->dns);
722     }
723   }
726   function save_object()
727   {
728     $this->DivListOGroup->save_object();
729     if(is_object($this->CopyPasteHandler)){
730       $this->CopyPasteHandler->save_object();
731     }
732   }
737 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
738 ?>