Code

Next bunch of renamings
[gosa.git] / gosa-plugins / goto / admin / mimetypes / class_mimetypeManagement.inc
1 <?php
2 /*
3    This code is part of GOsa (https://gosa.gonicus.de)
4    Copyright (C) 2003  Cajus Pollmeier
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
21 class mimetypeManagement extends plugin
22 {
23   /* Definitions */
24   var $plHeadline     = "Mime types";
25   var $plDescription  = "Manage mime types";
26   var $plIcon         = "plugins/goto/images/mimetypes.png";
28   /* Dialog attributes */
29   var $ui                             = NULL;
30   var $DivListMimeTypes               = NULL;
31   var $mimetabs                       = NULL;
32   var $snapDialog                     = NULL;
33   var $CopyPasteHandler               = NULL;
34   var $start_pasting_copied_objects   = FALSE;
35   var $enableReleaseManagement        = false;
37   var $mime_base    = "";
38   var $mime_release = "";
40   var $acl_module = array("mimetypes");
42   function IsReleaseManagementActivated()
43   {
44     /* Check if we should enable the release selection */
45     $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
46     if(!empty($tmp)){
47       return(true);
48     }
49     return(false);
50   }
53   function mimetypeManagement (&$config, &$ui)
54   {
55     /* Save configuration for internal use */
56     $this->config   = &$config;
57     $this->ui       = &$ui;
59     /* Check if copy & paste is activated */
60     if($this->config->get_cfg_value("copyPaste")){
61       $this->CopyPasteHandler = new CopyPasteHandler($this->config);
62     }
64     /* Creat dialog object */
65     $this->DivListMimeTypes = new divListMimeTypes($this->config,$this);
67     if($this->IsReleaseManagementActivated()){
69       /* Check if we should enable the release selection */
70       $this->enableReleaseManagement = true;
72       /* Hide SubSearch checkbox */
73       $this->DivListMimeTypes->DisableCheckBox("SubSearch");
74     }
76     /* Set default release */
77     if(!$this->IsReleaseManagementActivated()){
78       $this->mime_base = get_ou("mimetypeou").$this->config->current['BASE'];
79       if(!session::is_set("mime_filter")){
81         /* Set intial release */
82         $rel = $config->search("faiManagement","DEFAULTFAIRELEASE",array("menu"));
83         if(empty($rel)){
84           $rel = $this->mime_base;
85         }
86         session::set("mime_filter",array("mime_base" => $rel));
87       }
88       $mime_filter     = session::get("mime_filter");
89       $this->mime_base = $mime_filter['mime_base'];
90     }else{
91       $this->mime_base = get_ou("mimetypeou").$this->config->current['BASE'];
93       /* Set intial release */
94       $rel = $config->search("faiManagement","DEFAULTFAIRELEASE",array("menu"));
95       $rels = array_flip($this->getReleases());
96       if(isset($rels[$rel])){
97         $rel = $rels[$rel];
98       }else{
99         $rel = $this->mime_base;
100       }
102       if(!session::is_set("mime_filter")){
103         session::set("mime_filter",array("mime_base" => $this->mime_base,"mime_release" => $rel));
104       }
105       $mime_filter         = session::get("mime_filter");
106       $this->mime_base     = $mime_filter['mime_base'];
107       $this->mime_release  = $mime_filter['mime_release'];
108     }
109   }
112   /* Get all releases */
113   function getReleases()
114   {
115     $ldap                   = $this->config->get_ldap_link();
116     $ret                    = array();
117     $ret [$this->mime_base] = "/";    
119     $ldap->cd($this->mime_base);
120     $ldap->search("(&(objectClass=FAIbranch)(objectClass=organizationalUnit))",array("ou"));
122     while($attrs = $ldap->fetch()){
123       $str = str_replace($this->mime_base,"",$attrs['dn']);
124       $tmp = array_reverse( split("ou=",$str));
125       $str = "";
126       foreach($tmp as $val){
127         $val = trim(preg_replace("/,/","",$val));
128         if(empty($val)) break;
129         $str .= "/".$val;
130       } 
131       if(!empty($str)){
132         $ret[$attrs['dn']]= preg_replace("/^\//","",$str);
133       }
134     }
135     asort($ret);
136     return($ret);
137   }
140   function execute()
141   {
142     /* Call parent execute */
143     plugin::execute();
146     /**************** 
147       Variable init 
148      ****************/
150     /* These vars will be stored if you try to open a locked mime, 
151         to be able to perform your last requests after showing a warning message */
152     session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^mime_edit_/","/^mime_del_/",
153           "/^item_selected/","/^remove_multiple_mimetypes/","/^menu_action/"));
155     $smarty       = get_smarty();             // Smarty instance
156     $s_action     = "";                       // Contains the action to proceed
157     $s_entry      = "";                       // The value for s_action
158     $base_back    = "";                       // The Link for Backbutton
159     
160     /* Test Posts */
161     foreach($_POST as $key => $val){
162       // Post for delete
163       if(preg_match("/mime_del.*/",$key)){
164         $s_action = "del";
165         $s_entry  = preg_replace("/mime_".$s_action."_/i","",$key);
166         // Post for edit
167       }elseif(preg_match("/mime_edit_.*/",$key)){
168         $s_action="edit";
169         $s_entry  = preg_replace("/mime_".$s_action."_/i","",$key);
170         // Post for new
171       }elseif(preg_match("/^copy_.*/",$key)){
172         $s_action="copy";
173         $s_entry  = preg_replace("/^copy_/i","",$key);
174       }elseif(preg_match("/^cut_.*/",$key)){
175         $s_action="cut";
176         $s_entry  = preg_replace("/^cut_/i","",$key);
177         // Post for new
178       }elseif(preg_match("/^mime_new.*/",$key)){
179         $s_action="new";
180       }elseif(preg_match("/^remove_multiple_mimetypes/",$key)){
181         $s_action="del_multiple";
182       }elseif(preg_match("/^editPaste.*/i",$key)){
183         $s_action="editPaste";
184       }elseif(preg_match("/^multiple_copy_mimetypes/",$key)){
185         $s_action = "copy_multiple";
186       }elseif(preg_match("/^multiple_cut_mimetypes/",$key)){
187         $s_action = "cut_multiple";
188       }
189     }
191     if((isset($_GET['act']))&&($_GET['act']=="edit_entry")){
192       $s_action ="edit";
193       $s_entry  = $_GET['id'];
194     }
196     $s_entry  = preg_replace("/_.$/","",$s_entry);
198     /* handle C&P from layers menu */
199     if(isset($_POST['menu_action']) && preg_match("/^multiple_copy_systems/",$_POST['menu_action'])){
200       $s_action = "copy_multiple";
201     }
202     if(isset($_POST['menu_action']) && preg_match("/^multiple_cut_systems/",$_POST['menu_action'])){
203       $s_action = "cut_multiple";
204     }
205     if(isset($_POST['menu_action']) && preg_match("/^editPaste/",$_POST['menu_action'])){
206       $s_action = "editPaste";
207     }
209     /* Create options */
210     if(isset($_POST['menu_action']) && $_POST['menu_action'] == "mime_new"){
211       $s_action = "new";
212     }
214     /* handle remove from layers menu */
215     if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
216       $s_action = "del_multiple";
217     }
220     /**************** 
221       Copy & Paste handling  
222      ****************/
224     /* Display the copy & paste dialog, if it is currently open */
225     $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
226     if($ret){
227       return($ret);
228     }
231     /**************** 
232       Create a new mime type 
233      ****************/
235     /* New mime type? */
236     $ui = get_userinfo();
237     $acl = $ui->get_permissions($this->mime_base,"mimetypes/mimetype");
238     if (($s_action=="new") && preg_match("/c/",$acl)){
240       /* By default we set 'dn' to 'new', all relevant plugins will
241          react on this. */
242       $this->dn= "new";
244       /* Create new usertab object */
245       $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $this->dn,"mimetypes");
246       $this->mimetabs->parent = &$this;
247       $this->mimetabs->set_acl_base($this->mime_base);
248     }   
251     /**************** 
252       Edit entry canceled 
253      ****************/
255     /* Cancel dialogs */
256     if (isset($_POST['edit_cancel'])){
257       $this->remove_lock();
258       $this->mimetabs= NULL;
259       session::un_set('objectinfo');
260     }
263     /**************** 
264       Edit entry finished 
265      ****************/
267     /* Finish mime edit is triggered by the tabulator dialog, so
268        the user wants to save edited data. Check and save at this point. */
269     if ((isset($_POST['edit_finish']) || isset($_POST['edit_apply']) ) && (isset($this->mimetabs->config))){
271       /* Check tabs, will feed message array */
272       $this->mimetabs->save_object();
273       $message= $this->mimetabs->check();
275       /* Save, or display error message? */
276       if (count($message) == 0){
278         /* Save data data to ldap */
279         $this->mimetabs->save();
281         if (!isset($_POST['edit_apply'])){
282           /* Mime type has been saved successfully, remove lock from LDAP. */
283           if ($this->dn != "new"){
284             $this->remove_lock();
285           }
286           unset ($this->mimetabs);
287           $this->mimetabs= NULL;
288           session::un_set('objectinfo');
289         }else{
291           /* Reinitialize tab */
292           if($this->mimetabs instanceof tabs){
293             $this->mimetabs->re_init();
294           }
295         }
296       } else {
297         /* Ok. There seem to be errors regarding to the tab data,
298            show message and continue as usual. */
299         msg_dialog::displayChecks($message);
300       }
301     }
304     /**************** 
305       Edit entry  
306      ****************/
308     /* User wants to edit data? */
309     if (($s_action=="edit") && (!isset($this->mimetabs->config))){
311       /* Get 'dn' from posted 'mimelist', must be unique */
312       $this->dn= $this->mimetypes[$s_entry]['dn'];
314       /* Check locking, save current plugin in 'back_plugin', so
315          the dialog knows where to return. */
316       if (($user= get_lock($this->dn)) != ""){
317         return(gen_locked_message ($user, $this->dn));
318       }
320       /* Lock the current entry, so everyone will get the
321          above dialog */
322       add_lock ($this->dn, $this->ui->dn);
324       /* Register mimetabs to trigger edit dialog */
325       $this->mimetabs= new mimetabs($this->config,$this->config->data['TABS']['MIMETABS'], $this->dn,"mimetypes");
326       if($this->IsReleaseManagementActivated()){
327         $this->mimetabs->set_FAIstate($this->mimetypes[$s_entry]['FAIstate'][0]);
328       }
329       $this->mimetabs->parent = &$this;
330       $this->mimetabs->set_acl_base($this->dn);
331       session::set('objectinfo',$this->dn);
332     }
335     /********************
336       Delete MULTIPLE entries requested, display confirm dialog
337      ********************/
339     if ($s_action=="del_multiple"){
340       $ids = $this->list_get_selected_items();
342       $this->dns = array();
343       if(count($ids)){
345         $disallowed = array();
346         foreach($ids as $id){
347           $dn = $this->mimetypes[$id]['dn'];
348           $acl = $this->ui->get_permissions($dn, "mimetypes/mimetype");
349           if(preg_match("/d/",$acl)){
350             $this->dns[$id] = $dn;
351           }else{
352             $disallowed[] = $dn;
353           }
354         }
356         if(count($disallowed)){
357           msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG);
358         }
360         if(count($this->dns)){
362           /* Check locks */
363           if ($user= get_multiple_locks($this->dns)){
364             return(gen_locked_message($user,$this->dns));
365           }
367           $dns_names = array();
368           foreach($this->dns as $dn){
369             $dns_names[] = @LDAP::fix($dn);
370           }
372           add_lock ($this->dns, $this->ui->dn);
374           /* Lock the current entry, so nobody will edit it during deletion */
375           $smarty->assign("info", msgPool::deleteInfo($dns_names,_("Mime type")));
376           $smarty->assign("multiple", true);
377           return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
378         }
379       }
380     }
383     /********************
384       Delete MULTIPLE entries confirmed
385      ********************/
387     /* Confirmation for deletion has been passed. Users should be deleted. */
388     if (isset($_POST['delete_multiple_mimetype_confirm'])){
390       $ui = get_userinfo();
392       /* Remove user by user and check acls before removeing them */
393       foreach($this->dns as $key => $dn){
395         $acl = $ui->get_permissions($dn,"mimetypes/mimetype");
396         if(preg_match("/d/",$acl)){
398           /* Delete request is permitted, perform LDAP action */
399           $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $dn,"mimetypes");
400           $this->mimetabs->parent = &$this;
401           $this->mimetabs->set_acl_base($dn);
402           $this->mimetabs->delete ();
403           unset ($this->mimetabs);
404           $this->mimetabs= NULL;
406         } else {
407           /* Normally this shouldn't be reached, send some extra
408              logs to notify the administrator */
409           msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
410           new log("security","mimetypes/".get_class($this),$dn,array(),"Tried to trick deletion.");
411         }
412       }
414       /* Remove lock file after successfull deletion */
415       $this->remove_lock();
416       $this->dns = array();
417     }
420     /********************
421       Delete MULTIPLE entries Canceled
422      ********************/
424     /* Remove lock */
425     if(isset($_POST['delete_multiple_mimetype_cancel'])){
426       $this->remove_lock();
427       $this->dns = array();
428     }
431     /**************** 
432       Delete mime type 
433      ****************/
435     /* Remove user was requested */
436     if ($s_action == "del"){
438       /* Get 'dn' from posted 'uid' */
439       $this->dn= $this->mimetypes[$s_entry]['dn'];
441       /* Load permissions for selected 'dn' and check if
442          we're allowed to remove this 'dn' */
443       $ui = get_userinfo();
444       $acl = $ui->get_permissions($this->dn,"mimetypes/mimetype");
445       if (preg_match("/d/",$acl)){
447         /* Check locking, save current plugin in 'back_plugin', so
448            the dialog knows where to return. */
449         if (($user= get_lock($this->dn)) != ""){
450           return (gen_locked_message ($user, $this->dn));
451         }
453         /* Lock the current entry, so nobody will edit it during deletion */
454         add_lock ($this->dn, $this->ui->dn);
455         $smarty= get_smarty();
456         $smarty->assign("info", msgPool::deleteInfo(@LDAP::fix($this->dn),_("Mime type")));
457         $smarty->assign("multiple", false);
458         return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
459       } else {
461         /* Obviously the user isn't allowed to delete. Show message and
462            clean session. */
463         msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
464       }
465     }
468     /**************** 
469       Delete mime confirmed 
470      ****************/
472     /* Confirmation for deletion has been passed. Group should be deleted. */
473     if (isset($_POST['delete_mime_confirm'])){
475       /* Some nice guy may send this as POST, so we've to check
476          for the permissions again. */
477       $ui = get_userinfo();
478       $acl = $ui->get_permissions($this->dn,"mimetypes/mimetype");
479       if(preg_match("/d/",$acl)){
481         /* Delete request is permitted, perform LDAP action */
482         $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $this->dn,"mimetypes");
483         $this->mimetabs->parent = &$this;
484         $this->mimetabs->set_acl_base($this->dn);
485         $this->mimetabs->delete ();
486         unset ($this->mimetabs);
487         $this->mimetabs= NULL;
489       } else {
491         /* Normally this shouldn't be reached, send some extra
492            logs to notify the administrator */
493         msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
494         new log("security","mimetypes/".get_class($this),$dn,array(),"Tried to trick deletion.");
495       }
497       /* Remove lock file after successfull deletion */
498       $this->remove_lock();
499     }
502     /**************** 
503       Delete mime canceled 
504      ****************/
506     /* Delete mime type canceled? */
507     if (isset($_POST['delete_cancel'])){
508       $this->remove_lock();
509       session::un_set('objectinfo');
510     }
512     /* Show tab dialog if object is present */
513     if (($this->mimetabs) && (isset($this->mimetabs->config))){
514       $display= $this->mimetabs->execute();
516       /* Don't show buttons if tab dialog requests this */
517       if (!$this->mimetabs->by_object[$this->mimetabs->current]->dialog){
518         $display.= "<p style=\"text-align:right\">\n";
520         if(isset($this->mimetabs->FAIstate) && !preg_match("/freeze/i",$this->mimetabs->FAIstate)){
521           $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
522           $display.= "&nbsp;\n";
523           if ($this->dn != "new"){
524             $display.= "<input type=submit name=\"edit_apply\" value=\"".msgPool::applyButton()."\">\n";
525             $display.= "&nbsp;\n";
526           }
527         }
528       
529         $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
530         $display.= "</p>";
531       }
532       return ($display);
533     }
536     /****************
537       Dialog display
538      ****************/
540     /* Check if there is a snapshot dialog open */
541     if($this->IsReleaseManagementActivated()){
542       $base = $this->mime_release;
543     }else{
544       $base = $this->mime_base;
545     }
546     if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases(),$this)){
547       return($str);
548     }
550     /* Display dialog with system list */
551     $this->DivListMimeTypes->parent = $this;
552     $this->DivListMimeTypes->execute();
553     if(!$this->IsReleaseManagementActivated()){
554       $this->DivListMimeTypes->AddDepartments($this->DivListMimeTypes->selectedBase,3,1);
555     }
556     $this->reload();
557     $this->DivListMimeTypes->setEntries($this->mimetypes);
558     return($this->DivListMimeTypes->Draw());
559   }
561     
562   /* Return departments, that will be included within snapshot detection */
563   function get_used_snapshot_bases()
564   {
565     if($this->IsReleaseManagementActivated()){
566       return(array($this->mime_release));
567     }else{
568       return(array($this->mime_base));
569     }
570   }
573   function reload()
574   {
575     $this->mimetypes= array();
577     /* Set base for all searches */
578     $base       = $this->mime_base;
579     $Regex      = $this->DivListMimeTypes->Regex;
580     $SubSearch  = $this->DivListMimeTypes->SubSearch; 
581     $Flags      =  GL_NONE | GL_SIZELIMIT;
582     $Filter     = "(&(|(cn=".$Regex.")(description=".$Regex."))(objectClass=gotoMimeType))";
583     $tmp        = array();
585     if(!$this->IsReleaseManagementActivated()){
586       $use_base = $this->mime_base;
587       if($SubSearch){
588         $use_base = preg_replace("/^".normalizePreg(get_ou("mimeou"))."/","",$use_base);
589       }
590     }else{
591       $use_base = $this->mime_release;
592       $SubSearch= FALSE;
593     }
595     /* Add FAIstate to the search attributes */
596     $search_attrs = array("cn","description","dn","objectClass");
597     if($this->IsReleaseManagementActivated()) {
598       $search_attrs[] = "FAIstate";
599     }
601     if($SubSearch){
602       $res= get_sub_list($Filter, "mimetypes",get_ou("mimeou"), $use_base, $search_attrs, $Flags);
603     }else{
604       $res= get_list($Filter, "mimetypes",$use_base, $search_attrs, $Flags);
605     }
608     $tmp2 = array();
609     foreach ($res as $val){
610       if(!isset($val['FAIstate'])){
611         $val['FAIstate'][0] = "";
612       }
613       $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val;
614       $tmp2[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']] = strtolower($val['cn'][0]).$val['cn'][0].$val['dn'];
615     }
617     /* sort entries */
618     natcasesort($tmp2);
619     $this->mimetypes=array();
620     foreach($tmp2 as $val){
621       $this->mimetypes[]=$tmp[$val];
622     }
623     reset ($this->mimetypes);
624   }
627   function remove_from_parent()
628   {
629     /* Optionally execute a command after we're done */
630     $this->postremove();
631   }
634   function copyPasteHandling_from_queue($s_action,$s_entry)
635   {
636     /* Check if Copy & Paste is disabled */
637     if(!is_object($this->CopyPasteHandler)){
638       return("");
639     }
641     $ui = get_userinfo();  
643     /* Add a single entry to queue */
644     if($s_action == "cut" || $s_action == "copy"){
646       /* Cleanup object queue */
647       $this->CopyPasteHandler->cleanup_queue();
648       $dn = $this->mimetypes[$s_entry]['dn'];
649       if($s_action == "copy" && $ui->is_copyable($dn,"mimetypes","mimetype")){
650         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"mimetabs","MIMETABS","mimetypes");
651       }
652       if($s_action == "cut" && $ui->is_cutable($dn,"mimetypes","mimetype")){ 
653         $this->CopyPasteHandler->add_to_queue($dn,$s_action,"mimetabs","MIMETABS","mimetypes");
654       }
655     }
657     /* Add entries to queue */
658     if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
660       /* Cleanup object queue */
661       $this->CopyPasteHandler->cleanup_queue();
662   
663       /* Add new entries to CP queue */
664       foreach($this->list_get_selected_items() as $id){
665         $dn = $this->mimetypes[$id]['dn'];
667         if($s_action == "copy_multiple" && $ui->is_copyable($dn,"mimetypes","mimetype")){ 
668           $this->CopyPasteHandler->add_to_queue($dn,"copy","mimetabs","MIMETABS","mimetypes");
669         }
670         if($s_action == "cut_multiple" && $ui->is_cutable($dn,"mimetypes","mimetype")){
671           $this->CopyPasteHandler->add_to_queue($dn,"cut","mimetabs","MIMETABS","mimetypes");
672         }
673       }
674     }
676     /* Start pasting entries */
677     if($s_action == "editPaste"){
678       $this->start_pasting_copied_objects = TRUE;
679     }
681     /* Return C&P dialog */
682     if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
684       /* Get dialog */
685       $this->CopyPasteHandler->SetVar("base",preg_replace("/^".normalizePreg(get_ou("mimetypeou"))."/","",$this->mime_base));
686       $this->CopyPasteHandler->SetVar("parent",$this);
687       $data = $this->CopyPasteHandler->execute();
689       /* Return dialog data */
690       if(!empty($data)){
691         return($data);
692       }
693     }
695     /* Automatically disable status for pasting */
696     if(!$this->CopyPasteHandler->entries_queued()){
697       $this->start_pasting_copied_objects = FALSE;
698     }
699     return("");
700   }
703   function list_get_selected_items()
704   {
705     $ids = array();
706     foreach($_POST as $name => $value){
707       if(preg_match("/^item_selected_[0-9]*$/",$name)){
708         $id   = preg_replace("/^item_selected_/","",$name);
709         $ids[$id] = $id;
710       }
711     }
712     return($ids);
713   }
716   /* Save to LDAP */
717   function save()
718   {
719     /* Optionally execute a command after we're done */
720     $this->postcreate();
721   }
723   function remove_lock()
724   {
725     if (isset($this->mimetabs->dn)){
726       del_lock ($this->mimetabs->dn);
727     }
728     if(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
729       del_lock($this->dn);
730     }
731     if(isset($this->dns) && is_array($this->dns) && count($this->dns)){
732       del_lock($this->dns);
733     }
734   }
736   function save_object() 
737   {
738     $this->DivListMimeTypes->save_object();
739     if(is_object($this->CopyPasteHandler)){
740       $this->CopyPasteHandler->save_object();
741     }
743     if($this->IsReleaseManagementActivated() && isset($_POST['mime_release'])){
744       $sel_rel = get_post('mime_release');
745       $releases = array_flip($this->getReleases());
746       if(isset($releases[$sel_rel])){
747         $this->mime_release = $releases[$sel_rel];
748       }
749       $mime_filter     = session::get("mime_filter");
750       $mime_filter['mime_release'] = $this->mime_release;
751       session::set("mime_filter",$mime_filter);
752     }elseif(!$this->IsReleaseManagementActivated()){
753       $this->mime_base = get_ou("mimetypeou").$this->DivListMimeTypes->selectedBase;
754       $mime_filter     = session::get("mime_filter");
755       $mime_filter['mime_base'] = $this->mime_base;
756       session::set("mime_filter",$mime_filter);
757     }
758   }
761   function check() {}
762   function adapt_from_template($dn, $skip= array()) {}
763   function password_change_needed() {}
765 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
766 ?>