Code

e583d72fd8c53509c52b5bc7dc53ea0ab2968490
[gosa.git] / gosa-plugins / goto / admin / mimetypes / class_mimetypeGeneric.inc
1 <?php
2 class mimetype extends plugin
3 {
4     var $ignore_account         = true; // This is always a valid account
5     var $objectclasses          = array("top","gotoMimeType");
6     var $attributes                       = array("cn","gotoMimeApplication","gotoMimeLeftClickAction","gotoMimeIcon",
7             "description","gotoMimeFilePattern","gotoMimeEmbeddedApplication",
8             "gotoMimeGroup");   
10     /* Class vars */
11     var $ui;
12     var $cn                                                                                   = "";                                     
13     var $gotoMimeLeftClickAction                            = "I";
14     var $gotoMimeLeftClickAction_I                  = true;
15     var $gotoMimeLeftClickAction_E                  = false;
16     var $gotoMimeLeftClickAction_Q                  = false;
17     var $gotoMimeIcon                                                     = "*removed*";
18     var $description                                                      = "";
19     var $gotoMimeFilePattern                                  = array();
20     var $gotoMimeApplication                                  = array();
21     var $gotoMimeEmbeddedApplication        = array();
22     var $gotoMimeGroup                                                  = "";
23     var $iconData                                                                   = NULL;     
24     var $base                                                                         = "";
25     var $ApplicationList                  = array();  
28     /* To prevent errors when using the 'apply' button, we use this variables 
29        to manage array attributes */
30     var $use_gotoMimeIcon                                               = NULL;
31     var $use_gotoMimeFilePattern                            = array();
32     var $use_gotoMimeApplication                            = array();
33     var $use_gotoMimeEmbeddedApplication        = array();
35     var $FAIstate ="";
37     /* These vars will be copied too, if you use copy&paste mode */
38     var $CopyPasteVars        = array("use_gotoMimeFilePattern","use_gotoMimeApplication","use_gotoMimeEmbeddedApplication","iconData",
39             "gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q","use_gotoMimeIcon");
41     var $view_logged  = FALSE;
43     /* Select options */
44     var $MimeGroups                           = array("application","audio","chemical","image","inode","message","model",
45             "multipart","text","video","x-conference","x-world");
47     /* Orig_Dn is used to verify if this object is new or only edited */                
48     var $orig_dn                        = "";
49     var $orig_base        = "";
51     var $baseSelector;
53     function mimetype(&$config,$dn= NULL)
54     {
55         plugin::plugin ($config, $dn);
57         /* Save original dn */
58         $this->orig_dn = $dn;   
60         /* get gotoMimeLeftClickActions I/E/Q */
61         if(isset($this->gotoMimeLeftClickAction)){
62             $str = $this->gotoMimeLeftClickAction;
63             for($i = 0 ; $i < strlen($str) ; $i ++ ){
64                 $varna = "gotoMimeLeftClickAction_". $str[$i];
65                 if(isset($this->$varna)){
66                     $this->$varna = true;
67                 }
68             }
69         }
71         /* Create list of defined applications in GOsa */
72         $ldap = $this->config->get_ldap_link();
73         $ldap->cd($this->config->current['BASE']);
74         $ldap->search("(&(objectClass=gosaApplication)(cn=*))",array('cn'));
75         $this->ApplicationList = array();
76         while($attrs = $ldap->fetch()){
77             $this->ApplicationList[$attrs['cn'][0]] = $attrs['cn'][0];
78         }
80         /* If both radio buttons arn't set, set option I */
81         if(!$this->gotoMimeLeftClickAction_I && !$this->gotoMimeLeftClickAction_E){
82             $this->gotoMimeLeftClickAction_I = true;
83         }
85         /* Get list of array attributes */
86         foreach(array("gotoMimeFilePattern") as $attr){
87             $this->$attr = array();
88             if(isset($this->attrs[$attr])){
89                 $tmp = array();
90                 for($i = 0 ; $i < $this->attrs[$attr]['count'] ; $i ++){
91                     $str = $this->attrs[$attr][$i];
92                     $tmp[] = $str;
93                 }
94                 $use_attr = "use_".$attr;
95                 $this->$use_attr = $tmp;
96             }
97         }
99         /* Get list of array attributes with priority tag ( Test|32 )*/
100         foreach(array("gotoMimeApplication","gotoMimeEmbeddedApplication") as $attr){
101             $this->$attr = array();
102             if(isset($this->attrs[$attr])){
103                 $tmp = array();
104                 for($i = 0 ; $i < $this->attrs[$attr]['count'] ; $i ++){
105                     $str = $this->attrs[$attr][$i];
106                     $tmp2= explode("|",$str);
108                     if(count($tmp2) == 2){
109                         $name = $tmp2[0];
110                         $prio = $tmp2[1];
111                         $tmp[$prio] = $name;
112                     }
113                 }
114                 ksort($tmp);
115                 $use_attr = "use_".$attr;
116                 $this->$use_attr = $tmp;
117             }
118         }
120         /* Set base */  
121         if ($this->dn == "new"){
122             if(session::is_set('CurrentMainBase')){
123                 $this->base= session::get('CurrentMainBase');
124             }else{
125                 $ui= get_userinfo();
126                 $this->base= dn2base($ui->dn);
127             }
128         } else {
129             $this->base= preg_replace ("/^.*,".preg_quote(get_ou("mimetype", "mimetypeRDN"), '/')."/i", "", $this->dn);
130         }
132         /* Get icon data */
133         if(isset($this->attrs['gotoMimeIcon'])){
134             $ldap = $this->config->get_ldap_link();
135             $this->iconData = $ldap->get_attribute($this->dn,"gotoMimeIcon");
136             $this->saved_attributes['gotoMimeIcon'] = $this->iconData;
137         }
138         if ($this->iconData == ""){
139             $this->set_new_picture("");
140         }
141         session::set('binary',$this->iconData);
142         session::set('binarytype',"image/jpeg");
144         /* Instanciate base selector */
145         $this->baseSelector= new baseSelector($this->get_allowed_bases(), $this->base);
146         $this->baseSelector->setSubmitButton(false);
147         $this->baseSelector->setHeight(300);
148         $this->baseSelector->update(true);
150         $this->orig_base = $this->base;
153         // Prepare lists
154         $this->patternList = new sortableListing(array(),array(),TRUE);
155         $this->patternList->setDeleteable(true);
156         $this->patternList->setInstantDelete(true);
157         $this->patternList->setEditable(false);
158         $this->patternList->setWidth("100%");
159         $this->patternList->setHeight("100px");
160         $this->patternList->setColspecs(array('200px','*'));
161         $this->patternList->setHeader(array(_("Section"),_("Description")));
162         $this->patternList->setDefaultSortColumn(1);
163         $this->patternList->setAcl('rwcdm'); // All ACLs, we filter on our own here.
165         $this->applicationList = new sortableListing(array(),array(),TRUE);
166         $this->applicationList->setDeleteable(true);
167         $this->applicationList->setEditable(false);
168         $this->applicationList->setWidth("100%");
169         $this->applicationList->setHeight("100px");
170         $this->applicationList->setColspecs(array('200px','*'));
171         $this->applicationList->setHeader(array(_("Section"),_("Description")));
172         $this->applicationList->setInstantDelete(true);
173         $this->applicationList->setDefaultSortColumn(1);
174         $this->applicationList->setAcl('rwcdm'); // All ACLs, we filter on our own here.
176         $this->embeddedList = new sortableListing(array(),array(),TRUE);
177         $this->embeddedList->setDeleteable(true);
178         $this->embeddedList->setEditable(false);
179         $this->embeddedList->setWidth("100%");
180         $this->embeddedList->setInstantDelete(true);
181         $this->embeddedList->setHeight("100px");
182         $this->embeddedList->setColspecs(array('200px','*'));
183         $this->embeddedList->setHeader(array(_("Section"),_("Description")));
184         $this->embeddedList->setDefaultSortColumn(1);
185         $this->embeddedList->setAcl('rwcdm'); // All ACLs, we filter on our own here.
186     }
189     function execute()
190     {
191         plugin::execute();
192         $smarty = get_smarty();
194         /* Assign base ACL */
195         $smarty->assign("base", $this->baseSelector->render());
197         if(!$this->view_logged){
198             $this->view_logged =TRUE;
199             new log("view","mimetypes/".get_class($this),$this->dn);
200         }
202         $tmp = $this->plInfo();
203         foreach($tmp['plProvidedAcls'] as $name => $translation){
204             $smarty->assign($name."ACL",$this->getacl($name,preg_match("/freeze/i",$this->FAIstate)));
205         }
206         $smarty->assign("IconReadable", preg_match("/r/",$this->getacl("gotoMimeIcon",preg_match("/freeze/i",$this->FAIstate))));
208         /* Walk through posts and try to find some commands for us. */
209         if(!preg_match("/freeze/i",$this->FAIstate)){
211             /* Set a new icon was requested */
212             if(isset($_POST['update_icon']) && (isset($_FILES['picture_file']['name']))){
213                 $this->set_new_picture(gosa_file_name($_FILES['picture_file']['tmp_name']));            
214             }
216             /* Add gotoMimeFilePattern */
217             if(isset($_POST['AddNewFilePattern']) && isset($_POST['NewFilePattern'])){
218                 if($this->acl_is_writeable("gotoMimeFilePattern")){
219                     $str = trim(get_post('NewFilePattern'));
220                     if($str != ""){
221                         $this->use_gotoMimeFilePattern[] = $str;
222                     }
223                 }
224             }   
226             /* Add gotoMimeFilePattern */
227             if(isset($_POST['AddNewApplication']) && 
228                     (isset($_POST['NewApplication']) || isset($_POST['NewApplicationSelect']))){
229                 if($this->acl_is_writeable("gotoMimeApplication")){
230                     $str = "";
231                     if(isset($_POST['NewApplicationSelect']) && !empty($_POST['NewApplicationSelect'])){
232                         $str = trim(get_post("NewApplicationSelect"));
233                     }
234                     if(isset($_POST['NewApplication']) && !empty($_POST['NewApplication'])){
235                         $str = trim(get_post("NewApplication"));
236                     }
237                     if($str != "" && !in_array($str,$this->use_gotoMimeApplication)){
238                         $this->use_gotoMimeApplication[] = $str;
239                     }
240                 }
241             }   
243             /* Add embedded application 
244              *  - From input or from select box 
245              */
246             if(isset($_POST['AddNewEmbeddedApplication']) && 
247                     (isset($_POST['NewEmbeddedApplication']) || isset($_POST['NewEmbeddedApplicationSelect']))){
248                 if($this->acl_is_writeable("gotoMimeEmbeddedApplication")){
249                     $str = "";
250                     if(isset($_POST['NewEmbeddedApplicationSelect']) && !empty($_POST['NewEmbeddedApplicationSelect'])){
251                         $str = trim(get_post('NewEmbeddedApplicationSelect'));
252                     }
253                     if(isset($_POST['NewEmbeddedApplication']) && !empty($_POST['NewEmbeddedApplication'])){
254                         $str = trim(get_post('NewEmbeddedApplication'));
255                     }
256                     if($str != "" && !in_array($str,$this->use_gotoMimeEmbeddedApplication)){
257                         $this->use_gotoMimeEmbeddedApplication[] = $str;
258                     }
259                 }
260             }   
261         }       
263         // Set list acls 
264         $this->patternList->setAcl($this->getacl("gotoMimeFilePattern", 
265                     preg_match("/freeze/i",$this->FAIstate)));
266         $this->applicationList->setAcl($this->getacl("gotoMimeApplication",
267                     preg_match("/freeze/i",$this->FAIstate)));
268         $this->embeddedList->setAcl($this->getacl("gotoMimeEmbeddedApplication",
269                     preg_match("/freeze/i",$this->FAIstate)));
272         /* Before adding some entries check acls */
273         $data = $lData = array();
274         foreach($this->use_gotoMimeFilePattern as $key => $pattern){
275             $data[$key] = $pattern;
276             $lData[$key] = array('data'=>array($pattern));
277         }                       
278         $this->patternList->setListData($data, $lData);
279         $this->patternList->update();
281         $data = $lData = array();
282         foreach($this->use_gotoMimeApplication as $key => $pattern){
283             $data[$key] = $pattern;
284             $lData[$key] = array('data'=>array($pattern));
285         }                       
286         $this->applicationList->setListData($data, $lData);
287         $this->applicationList->update();
289         $data = $lData = array();
290         foreach($this->use_gotoMimeEmbeddedApplication as $key => $pattern){
291             $data[$key] = $pattern;
292             $lData[$key] = array('data'=>array($pattern));
293         }
294         $this->embeddedList->setListData($data, $lData);
295         $this->embeddedList->update();
298         $smarty->assign("isReleaseMimeType",                    $this->is_release());
299         $smarty->assign("gotoMimeFilePatterns",                 $this->patternList->render());
300         $smarty->assign("gotoMimeApplications",                 $this->applicationList->render());
301         $smarty->assign("gotoMimeEmbeddedApplications", $this->embeddedList->render());
303         $smarty->assign("ApplicationList",$this->ApplicationList);
305         /* Assign class vars to smarty */
306         foreach($this->attributes as $attr){
307             $smarty->assign($attr,set_post($this->$attr));
308         }       
310         /* Assign additional vars that are not included in attributes*/
311         foreach(array("gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q") as $attr){
312             $smarty->assign($attr, set_post($this->$attr));
313         }       
315         /* Assign select box options */
316         $smarty->assign("gotoMimeGroups", set_post($this->MimeGroups));
317         $smarty->assign("gotoMimeIcon"  ,$this->get_picture());
318         return($smarty->fetch(get_template_path("generic.tpl",TRUE,dirname(__FILE__))));
319     }
322     function save_object()
323     {
324         if(isset($_POST['MimeGeneric']) && !preg_match("/freeze/i",$this->FAIstate)){
326             // Act on list actions here
327             $this->patternList->save_object();
328             $this->applicationList->save_object();
329             $this->embeddedList->save_object();
331             $action=$this->patternList->getAction();
332             if(in_array($action['action'],array('delete', 'reorder'))){
333                 $this->use_gotoMimeFilePattern = array_values($this->patternList->getMaintainedData());
334             }
335             $action=$this->applicationList->getAction();
336             if(in_array($action['action'],array('delete', 'reorder'))){
337                 $this->use_gotoMimeApplication = array_values($this->applicationList->getMaintainedData());
338             }
339             $action=$this->embeddedList->getAction();
340             if(in_array($action['action'],array('delete', 'reorder'))){
341                 $this->use_gotoMimeEmbeddedApplication = array_values($this->embeddedList->getMaintainedData());
342             }
344             /* Create a base backup and reset the
345                base directly after calling plugin::save_object();
346                Base will be set seperatly a few lines below */
347             $base_tmp = $this->base;
348             plugin::save_object();
349             $this->base = $base_tmp;
351             /* Refresh base */
352             if(!$this->is_release()){
353                 if ($this->acl_is_moveable($this->base)){
354                     if (!$this->baseSelector->update()) {
355                         msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
356                     }
357                     if ($this->base != $this->baseSelector->getBase()) {
358                         $this->base= $this->baseSelector->getBase();
359                         $this->is_modified= TRUE;
360                     }
361                 }
362             }
364             /* Save radio buttons */
365             if($this->acl_is_writeable("gotoMimeLeftClickAction")){
366                 if(isset($_POST['gotoMimeLeftClickAction_IE'])){
367                     $chr = get_post('gotoMimeLeftClickAction_IE');
368                     if($chr == "E"){
369                         $this->gotoMimeLeftClickAction_E = true;
370                         $this->gotoMimeLeftClickAction_I = false;
371                     }else{
372                         $this->gotoMimeLeftClickAction_E = false;
373                         $this->gotoMimeLeftClickAction_I = true;
374                     }
375                 }
376                 if(isset($_POST['gotoMimeLeftClickAction_Q'])){
377                     $this->gotoMimeLeftClickAction_Q = true;
378                 }else{
379                     $this->gotoMimeLeftClickAction_Q = false;
380                 }
381             }
382         }
383     }
386     /* save current changes */
387     function save()
388     {
389         /* Create gotoMimeLeftClickAction out of checkboxes and radio buttons */        
390         $arr = array ("E","I","Q");
391         $str = "";
392         foreach ($arr as $Chr){
393             $var = "gotoMimeLeftClickAction_".$Chr;
394             if($this->$var){
395                 $str .= $Chr;
396             }
397         }
398         $this->gotoMimeLeftClickAction = $str;
400         /* Create array entries with priority tag ( Test|3 )*/
401         foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication") as $attr){
402             $i                          = 0;
403             $use_attr           = "use_".$attr;
404             $tmp                        = array();
405             $this->$attr        = array();
406             foreach($this->$use_attr as $entry){
407                 $tmp[] = $entry."|".$i ++;
408             }
409             $this->$attr = $tmp;
410         }
412         /* Create array entries */
413         foreach(array("gotoMimeFilePattern") as $attr){
414             $i                          = 0;
415             $use_attr           = "use_".$attr;
416             $tmp                        = array();
417             $this->$attr        = array();
418             foreach($this->$use_attr as $entry){
419                 $tmp[] = $entry;
420             }
421             $this->$attr = $tmp;
422         }
424         /* Remove Icon if requested  */
425         if($this->use_gotoMimeIcon != "*removed*"){
426             $this->gotoMimeIcon = $this->iconData;
427         }else{
428             $this->gotoMimeIcon = "";
429         }
431         plugin::save();
433         /* If this is a newly created object, skip storing those 
434            attributes that contain an empty array */
435         if($this->orig_dn == "new"){
436             foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern") as $attr){
437                 if(!count($this->$attr)){
438                     unset($this->attrs[$attr]);
439                 }
440             }
441         }
443         $ldap = $this->config->get_ldap_link();
444         $ldap-> cd ( $this->config->current['BASE']);
445         $ldap->cat($this->dn);
446         if($ldap->count()){
447             $ldap->cd($this->dn);
448             $this->cleanup();
449             $ldap->modify($this->attrs);
450             new log("modify","mimetypes/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
451         }else{
452             $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
453             $ldap->cd($this->dn);
454             $ldap->add($this->attrs);
455             new log("create","mimetypes/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
456         }
457         if (!$ldap->success()){
458             msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
459         }
460     }
463     /* Remove current mime type */
464     function remove_from_parent()
465     {
466         plugin::remove_from_parent();
467         $ldap = $this->config->get_ldap_link();
468         $ldap->rmDir($this->dn);
469         if (!$ldap->success()){
470             msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
471         }
472         new log("remove","mimetypes/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
474         /* Optionally execute a command after we're done */
475         $this->handle_post_events("remove");
477         /* Delete references to object groups */
478         $ldap->cd ($this->config->current['BASE']);
479         $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
480         while ($ldap->fetch()){
481             $og= new ogroup($this->config, $ldap->getDN());
482             unset($og->member[$this->dn]);
483             $og->save ();
484             if (!$ldap->success()){
485                 msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $og->dn, 0, get_class()));
486             }
487         }
488     }
491     /* Check given values */
492     function check()
493     {
494         $message = plugin::check();
495         if($this->cn == "" ){
496             $message[] = msgPool::required(_("Name"));
497         }
498         if(!count($this->use_gotoMimeFilePattern)){
499             $message[] = msgPool::required(_("File pattern"));
500         }
502         // Check if a wrong base was supplied
503         if(!$this->baseSelector->checkLastBaseUpdate()){
504             $message[]= msgPool::check_base();;
505         }
507         /* Check if there is already a mime type with this cn */
508         $ldap = $this->config->get_ldap_link();
509         $ldap->cd($this->config->current["BASE"]);
511         if($this->is_release()){
512             $base = $this->parent->parent->mime_release;
513         }else{
514             $base = get_ou("mimetype", "mimetypeRDN").$this->base;
515         }
517         $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))",$base,array("cn"));
518         if($ldap->count()){
519             $attrs = $ldap->fetch();
520             if($this->dn != $attrs['dn']) {
521                 $message[]= msgPool::duplicated("cn");
522             }
523         }
525         /* Check if we are allowed to create or move this object
526          */
527         if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
528             $message[] = msgPool::permCreate();
529         }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
530             $message[] = msgPool::permMove();
531         }
533         return($message);
534     }
537     /** Helper functions **/
539     /* Set a new picture */     
540     function set_new_picture($filename)
541     {
542         if (empty($filename)){
543             $filename= "./plugins/goto/images/default_icon.png";
544             $this->use_gotoMimeIcon= "*removed*";
545         }else{
546             $this->use_gotoMimeIcon= $filename;
547         }
549         if (file_exists($filename)){
550             $fd = fopen ($filename, "rb");
551             $this->iconData= fread ($fd, filesize ($filename));
552             session::set('binary',$this->iconData);
553             session::set('binarytype',"image/jpeg");
554             fclose ($fd);
555         }
556     }
558     /* Get picture link */
559     function get_picture()
560     {
561         session::set('binary',$this->iconData);
562         session::set('binarytype',"image/jpeg");
563         return("getbin.php");
564     }
567     /* Return a dialog with all fields that must be changed, 
568        if we want to copy this entry */
569     function getCopyDialog()
570     {
571         $str = "";
573         $smarty = get_smarty();
574         $smarty->assign("cn",              set_post($this->cn));
575         $smarty->assign("description", set_post($this->description));
576         $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
578         $ret = array();
579         $ret['string'] = $str;
580         $ret['status'] = "";
581         return($ret);
582     }
585     /* Save all */
586     function saveCopyDialog()
587     {
588         $attrs = array("cn","description");
589         foreach($attrs as $attr){
590             if(isset($_POST[$attr])){
591                 $this->$attr = get_post($attr);
592             }
593         }
594     }
596     /* Return plugin informations for acl handling  */ 
597     static function plInfo()
598     {
599         return (array(
600                     "plShortName"   => _("Generic"),
601                     "plDescription" => _("Mime type generic"),
602                     "plSelfModify"  => FALSE,
603                     "plDepends"     => array(),
604                     "plPriority"    => 0,
605                     "plSection"     => array("administration"),
606                     "plRequirements"=> array(
607                         'ldapSchema' => array('gotoMimeType' => '>=2.7'),
608                         'onFailureDisablePlugin' => array(get_class(), 'mimetypeManagement')
609                         ),
610                     "plCategory"    => array("mimetypes" => array("description"  => _("Mime types"),
611                             "objectClass"  => "gotoMimeType")),
613                     "plProperties" =>
614                     array(
615                         array(
616                             "name"          => "mimetypeRDN",
617                             "type"          => "rdn",
618                             "default"       => "ou=mime,",
619                             "description"   => _("RDN for mime type storage."),
620                             "check"         => "gosaProperty::isRdn",
621                             "migrate"       => "migrate_mimetypeRDN",
622                             "group"         => "plugin",
623                             "mandatory"     => FALSE)),
625             "plProvidedAcls"=> array(
626                     "cn"                          => _("Name"),
627                     "gotoMimeGroup"               => _("Mime group"),
628                     "description"                 => _("Description"),
629                     "base"                        => _("Base"),
630                     "gotoMimeApplication"         => _("Application"),
631                     "gotoMimeLeftClickAction"     => _("Left click action"),
632                     "gotoMimeIcon"                => _("Icon"),
633                     "gotoMimeFilePattern"         => _("File patterns"),
634                     "gotoMimeEmbeddedApplication" => _("Embedded applications"))
635                 ));
637     }
640     function is_release()
641     {
642         if(is_object($this->parent->parent)){
643             return($this->parent->parent->IsReleaseManagementActivated());
644         }else{
645             return($this->config->pluginEnabled("faiManagement"));
646         }
647         return(FALSE);
648     }
651     function PrepareForCopyPaste($source)
652     {
653         plugin::PrepareForCopyPaste($source);
655         $source_o = new mimetype($this->config,$source['dn'],$this->parent);
657         foreach(array("gotoMimeLeftClickAction_Q","gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern","gotoMimeIcon","iconData") as $name){
658             $use_attr     = "use_".$name;
659             if(isset($this->$use_attr)){
660                 $this->$use_attr= $source_o->$use_attr;
661             }
662             $this->$name = $source_o->$name;
663         } 
664         foreach($this->attributes as $name){
665             $this->$name = $source_o->$name;
666         }
668         if($this->iconData){
669             $this->use_gotoMimeIcon ="Not emtpy, causes icon to be written.";
670         }
671     }
673 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
674 ?>