Code

Added requirement dependencies
[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($_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($_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("bases",                                            $this->get_allowed_bases());            
299     $smarty->assign("base_select",                                      $this->base);           
300     $smarty->assign("isReleaseMimeType",                        $this->is_release());
301     $smarty->assign("gotoMimeFilePatterns",                     $this->patternList->render());
302     $smarty->assign("gotoMimeApplications",                     $this->applicationList->render());
303     $smarty->assign("gotoMimeEmbeddedApplications",     $this->embeddedList->render());
305     $smarty->assign("ApplicationList",$this->ApplicationList);
306   
307     /* Assign class vars to smarty */
308     foreach($this->attributes as $attr){
309       $smarty->assign($attr,$this->$attr);
310     }   
312     /* Assign additional vars that are not included in attributes*/
313     foreach(array("gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q") as $attr){
314       $smarty->assign($attr,$this->$attr);
315     }   
317     /* Assign select box options */
318     $smarty->assign("gotoMimeGroups",$this->MimeGroups);
319     $smarty->assign("gotoMimeIcon"      ,$this->get_picture());
320     return($smarty->fetch(get_template_path("generic.tpl",TRUE,dirname(__FILE__))));
321   }
324   function save_object()
325   {
326       if(isset($_POST['MimeGeneric']) && !preg_match("/freeze/i",$this->FAIstate)){
327         
328           // Act on list actions here
329           $this->patternList->save_object();
330           $this->applicationList->save_object();
331           $this->embeddedList->save_object();
333           $action=$this->patternList->getAction();
334           if(in_array($action['action'],array('delete', 'reorder'))){
335               $this->use_gotoMimeFilePattern = array_values($this->patternList->getMaintainedData());
336           }
337           $action=$this->applicationList->getAction();
338           if(in_array($action['action'],array('delete', 'reorder'))){
339               $this->use_gotoMimeApplication = array_values($this->applicationList->getMaintainedData());
340           }
341           $action=$this->embeddedList->getAction();
342           if(in_array($action['action'],array('delete', 'reorder'))){
343               $this->use_gotoMimeEmbeddedApplication = array_values($this->embeddedList->getMaintainedData());
344           }
346       /* Create a base backup and reset the
347          base directly after calling plugin::save_object();
348          Base will be set seperatly a few lines below */
349       $base_tmp = $this->base;
350       plugin::save_object();
351       $this->base = $base_tmp;
352   
353       /* Only save base if we are not in release mode */
354       if(!$this->is_release()){
356         /* Set new base if allowed */
357         $tmp = $this->get_allowed_bases();
358         if(isset($_POST['base'])){
359           if(isset($tmp[$_POST['base']])){
360             $this->base= $_POST['base'];
361           }
362         }
364       }
366       /* Refresh base */
367       if ($this->acl_is_moveable($this->base)){
368         if (!$this->baseSelector->update()) {
369           msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
370         }
371         if ($this->base != $this->baseSelector->getBase()) {
372           $this->base= $this->baseSelector->getBase();
373           $this->is_modified= TRUE;
374         }
375       }
377       /* Save radio buttons */
378       if($this->acl_is_writeable("gotoMimeLeftClickAction")){
379         if(isset($_POST['gotoMimeLeftClickAction_IE'])){
380           $chr = $_POST['gotoMimeLeftClickAction_IE'];
381           if($chr == "E"){
382             $this->gotoMimeLeftClickAction_E = true;
383             $this->gotoMimeLeftClickAction_I = false;
384           }else{
385             $this->gotoMimeLeftClickAction_E = false;
386             $this->gotoMimeLeftClickAction_I = true;
387           }
388         }
389         if(isset($_POST['gotoMimeLeftClickAction_Q'])){
390           $this->gotoMimeLeftClickAction_Q = true;
391         }else{
392           $this->gotoMimeLeftClickAction_Q = false;
393         }
394       }
395     }
396   }
399   /* save current changes */
400   function save()
401   {
402     /* Create gotoMimeLeftClickAction out of checkboxes and radio buttons */    
403     $arr = array ("E","I","Q");
404     $str = "";
405     foreach ($arr as $Chr){
406       $var = "gotoMimeLeftClickAction_".$Chr;
407       if($this->$var){
408         $str .= $Chr;
409       }
410     }
411     $this->gotoMimeLeftClickAction = $str;
413     /* Create array entries with priority tag ( Test|3 )*/
414     foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication") as $attr){
415       $i                                = 0;
416       $use_attr                 = "use_".$attr;
417       $tmp                      = array();
418       $this->$attr      = array();
419       foreach($this->$use_attr as $entry){
420         $tmp[] = $entry."|".$i ++;
421       }
422       $this->$attr = $tmp;
423     }
425     /* Create array entries */
426     foreach(array("gotoMimeFilePattern") as $attr){
427       $i                                = 0;
428       $use_attr                 = "use_".$attr;
429       $tmp                      = array();
430       $this->$attr      = array();
431       foreach($this->$use_attr as $entry){
432         $tmp[] = $entry;
433       }
434       $this->$attr = $tmp;
435     }
437     /* Remove Icon if requested  */
438     if($this->use_gotoMimeIcon != "*removed*"){
439       $this->gotoMimeIcon = $this->iconData;
440     }else{
441       $this->gotoMimeIcon = "";
442     }
444     plugin::save();
446     /* If this is a newly created object, skip storing those 
447        attributes that contain an empty array */
448     if($this->orig_dn == "new"){
449       foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern") as $attr){
450         if(!count($this->$attr)){
451           unset($this->attrs[$attr]);
452         }
453       }
454     }
456     $ldap = $this->config->get_ldap_link();
457     $ldap-> cd ( $this->config->current['BASE']);
458     $ldap->cat($this->dn);
459     if($ldap->count()){
460       $ldap->cd($this->dn);
461       $this->cleanup();
462       $ldap->modify($this->attrs);
463       new log("modify","mimetypes/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
464     }else{
465       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
466       $ldap->cd($this->dn);
467       $ldap->add($this->attrs);
468       new log("create","mimetypes/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
469     }
470     if (!$ldap->success()){
471       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
472     }
473   }
476   /* Remove current mime type */
477   function remove_from_parent()
478   {
479     plugin::remove_from_parent();
480     $ldap = $this->config->get_ldap_link();
481     $ldap->rmDir($this->dn);
482     if (!$ldap->success()){
483       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
484     }
485     new log("remove","mimetypes/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
487     /* Optionally execute a command after we're done */
488     $this->handle_post_events("remove");
490     /* Delete references to object groups */
491     $ldap->cd ($this->config->current['BASE']);
492     $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
493     while ($ldap->fetch()){
494       $og= new ogroup($this->config, $ldap->getDN());
495       unset($og->member[$this->dn]);
496       $og->save ();
497       if (!$ldap->success()){
498         msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $og->dn, 0, get_class()));
499       }
500     }
501   }
504   /* Check given values */
505   function check()
506   {
507     $message = plugin::check();
508     if($this->cn == "" ){
509       $message[] = msgPool::required(_("Name"));
510     }
511     if(!count($this->use_gotoMimeFilePattern)){
512       $message[] = msgPool::required(_("File pattern"));
513     }
515     // Check if a wrong base was supplied
516     if(!$this->baseSelector->checkLastBaseUpdate()){
517       $message[]= msgPool::check_base();;
518     }
520     /* Check if there is already a mime type with this cn */
521     $ldap = $this->config->get_ldap_link();
522     $ldap->cd($this->config->current["BASE"]);
524     if($this->is_release()){
525       $base = $this->parent->parent->mime_release;
526     }else{
527       $base = get_ou("mimetype", "mimetypeRDN").$this->base;
528     }
530     $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))",$base,array("cn"));
531     if($ldap->count()){
532       $attrs = $ldap->fetch();
533       if($this->dn != $attrs['dn']) {
534         $message[]= msgPool::duplicated("cn");
535       }
536     }
538     /* Check if we are allowed to create or move this object
539      */
540     if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
541       $message[] = msgPool::permCreate();
542     }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
543       $message[] = msgPool::permMove();
544     }
546     return($message);
547   }
550   /** Helper functions **/
552   /* Set a new picture */       
553   function set_new_picture($filename)
554   {
555     if (empty($filename)){
556       $filename= "./plugins/goto/images/default_icon.png";
557       $this->use_gotoMimeIcon= "*removed*";
558     }else{
559       $this->use_gotoMimeIcon= $filename;
560     }
562     if (file_exists($filename)){
563       $fd = fopen ($filename, "rb");
564       $this->iconData= fread ($fd, filesize ($filename));
565       session::set('binary',$this->iconData);
566       session::set('binarytype',"image/jpeg");
567       fclose ($fd);
568     }
569   }
571   /* Get picture link */
572   function get_picture()
573   {
574     session::set('binary',$this->iconData);
575     session::set('binarytype',"image/jpeg");
576     return("getbin.php");
577   }
580   /* Return a dialog with all fields that must be changed, 
581      if we want to copy this entry */
582   function getCopyDialog()
583   {
584     $str = "";
586     $smarty = get_smarty();
587     $smarty->assign("cn",               $this->cn);
588     $smarty->assign("description",  $this->description);
589     $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
591     $ret = array();
592     $ret['string'] = $str;
593     $ret['status'] = "";
594     return($ret);
595   }
598   /* Save all */
599   function saveCopyDialog()
600   {
601     $attrs = array("cn","description");
602     foreach($attrs as $attr){
603       if(isset($_POST[$attr])){
604         $this->$attr = $_POST[$attr];
605       }
606     }
607   }
609   /* Return plugin informations for acl handling  */ 
610   static function plInfo()
611   {
612     return (array(
613           "plShortName"   => _("Generic"),
614           "plDescription" => _("Mime type generic"),
615           "plSelfModify"  => FALSE,
616           "plDepends"     => array(),
617           "plPriority"    => 0,
618           "plSection"     => array("administration"),
619           "plRequirements"=> array(
620               'ldapSchema' => array('gotoMimeType' => '>=2.7'),
621               'onFailureDisablePlugin' => array(get_class(), 'mimetypeManagement')
622               ),
623           "plCategory"    => array("mimetypes" => array("description"  => _("Mime types"),
624                                                         "objectClass"  => "gotoMimeType")),
626         "plProperties" =>
627           array(
628               array(
629             "name"          => "mimetypeRDN",
630             "type"          => "rdn",
631             "default"       => "ou=mime,",
632             "description"   => _("The 'mimetypeRDN' statement defines the location where new mimetypes will be created. The default is 'ou=mime,'."),
633             "check"         => "gosaProperty::isRdn",
634             "migrate"       => "migrate_mimetypeRDN",
635             "group"         => "plugin",
636             "mandatory"     => FALSE)),
638           "plProvidedAcls"=> array(
639             "cn"                          => _("Name"),
640             "gotoMimeGroup"               => _("Mime group"),
641             "description"                 => _("Description"),
642             "base"                        => _("Base"),
643             "gotoMimeApplication"         => _("Application"),
644             "gotoMimeLeftClickAction"     => _("Left click action"),
645             "gotoMimeIcon"                => _("Icon"),
646             "gotoMimeFilePattern"         => _("File patterns"),
647             "gotoMimeEmbeddedApplication" => _("Embedded applications"))
648           ));
650   }
653   function is_release()
654   {
655     if(is_object($this->parent->parent)){
656       return($this->parent->parent->IsReleaseManagementActivated());
657     }else{
658       return($this->config->pluginEnabled("faiManagement"));
659     }
660     return(FALSE);
661   }
664   function PrepareForCopyPaste($source)
665   {
666     plugin::PrepareForCopyPaste($source);
668     $source_o = new mimetype($this->config,$source['dn'],$this->parent);
670     foreach(array("gotoMimeLeftClickAction_Q","gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern","gotoMimeIcon","iconData") as $name){
671       $use_attr     = "use_".$name;
672       if(isset($this->$use_attr)){
673         $this->$use_attr= $source_o->$use_attr;
674       }
675       $this->$name = $source_o->$name;
676     } 
677     foreach($this->attributes as $name){
678       $this->$name = $source_o->$name;
679     }
681     if($this->iconData){
682       $this->use_gotoMimeIcon ="Not emtpy, causes icon to be written.";
683     }
684   }
686 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
687 ?>