Code

Added new base method
[gosa.git] / plugins / admin / mimetypes / class_mimetypeGeneric.inc
1 <?php
2 class mimetype extends plugin
3 {
4         /* CLI vars */
5         var $cli_summary                  = "This tab allows you to modify, add or remove mime types in the selected department.";
6         var $cli_description    = "Management dialog to handle mime types";
7         var $ignore_account     = true; // This is always a valid account
8         var $cli_parameters             = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
9         var $objectclasses              = array("top","gotoMimeType");
10         var $attributes                   = array("cn","gotoMimeApplication","gotoMimeLeftClickAction","gotoMimeIcon",
11                                                                         "description","gotoMimeFilePattern","gotoMimeEmbeddedApplication",
12                                                                         "gotoMimeGroup");       
14         /* Class vars */
15         var $ui;
16         var $cn                                                                               = "";                                     
17         var $gotoMimeLeftClickAction                        = "I";
18         var $gotoMimeLeftClickAction_I              = true;
19         var $gotoMimeLeftClickAction_E              = false;
20         var $gotoMimeLeftClickAction_Q              = false;
21         var $gotoMimeIcon                                                         = "*removed*";
22         var $description                                                          = "";
23         var $gotoMimeFilePattern                                      = array();
24         var $gotoMimeApplication                                      = array();
25         var $gotoMimeEmbeddedApplication            = array();
26         var $gotoMimeGroup                                                      = "";
27         var $iconData                                                               = NULL;     
28         var $base                                                                             = "";
30   /* To prevent errors when using the 'apply' button, we use this variables 
31       to manage array attributes */
32         var $use_gotoMimeIcon                                           = NULL;
33         var $use_gotoMimeFilePattern                        = array();
34         var $use_gotoMimeApplication                        = array();
35         var $use_gotoMimeEmbeddedApplication    = array();
37   /* divLists */
38   var $DivPatterns                                                        = NULL;
39   var $DivApps                                                              = NULL;
40   var $DivEApps                                                             = NULL;
42   /* Mime type release mode */
43   var $isReleaseMimeType                                              = false;
44   var $dialog                                                                       = NULL;
46   /* These vars will be copied too, if you use copy&paste mode */
47   var $CopyPasteVars        = array("use_gotoMimeFilePattern","use_gotoMimeApplication","use_gotoMimeEmbeddedApplication","iconData");
49   /* Select options */
50   var $MimeGroups                             = array("application","audio","chemical","image","inode","message","model",
51                                       "multipart","text","video","x-conference","x-world");
53   /* Orig_Dn is used to verify if this object is new or only edited */          
54   var $orig_dn                  = "";
57   function mimetype($config,$dn= NULL)
58   {
59     plugin::plugin ($config, $dn);
61     /* Save original dn */
62     $this->orig_dn = $dn;       
64     /* get gotoMimeLeftClickActions I/E/Q */
65     if(isset($this->gotoMimeLeftClickAction)){
66       $str = $this->gotoMimeLeftClickAction;
67       for($i = 0 ; $i < strlen($str) ; $i ++ ){
68         $varna = "gotoMimeLeftClickAction_". $str[$i];
69         if(isset($this->$varna)){
70           $this->$varna = true;
71         }
72       }
73     }
75     /* If both radio buttons arn't set, set option I */
76     if(!$this->gotoMimeLeftClickAction_I && !$this->gotoMimeLeftClickAction_E){
77       $this->gotoMimeLeftClickAction_I = true;
78     }
80     /* Get list of array attributes */
81     foreach(array("gotoMimeFilePattern") as $attr){
82       $this->$attr = array();
83       if(isset($this->attrs[$attr])){
84         $tmp = array();
85         for($i = 0 ; $i < $this->attrs[$attr]['count'] ; $i ++){
86           $str = $this->attrs[$attr][$i];
87           $tmp[] = $str;
88         }
89         $use_attr = "use_".$attr;
90         $this->$use_attr = $tmp;
91       }
92     }
94     /* Get list of array attributes with priority tag ( Test|32 )*/
95     foreach(array("gotoMimeApplication","gotoMimeEmbeddedApplication") as $attr){
96       $this->$attr = array();
97       if(isset($this->attrs[$attr])){
98         $tmp = array();
99         for($i = 0 ; $i < $this->attrs[$attr]['count'] ; $i ++){
100           $str = $this->attrs[$attr][$i];
101           $tmp2= split("\|",$str);
103           if(count($tmp2) == 2){
104             $name = $tmp2[0];
105             $prio = $tmp2[1];
106             $tmp[$prio] = $name;
107           }
108         }
109         ksort($tmp);
110         $use_attr = "use_".$attr;
111         $this->$use_attr = $tmp;
112       }
113     }
115     /* Check if release Management is enabled */
116     $tmp = search_config($this->config->data,"faiManagement","CLASS");
117     if(!empty($tmp)) {
118       $this->isReleaseMimeType= true;
119     }
121     /* Set base */      
122     if ($this->dn == "new"){
123       if(isset($_SESSION['CurrentMainBase'])){
124         $this->base= $_SESSION['CurrentMainBase'];
125       }else{
126         $ui= get_userinfo();
127         $this->base= dn2base($ui->dn);
128       }
129     } else {
130       $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
131     }
133     /* Get icon data */
134     if(isset($this->attrs['gotoMimeIcon'])){
135       $ldap = $this->config->get_ldap_link();
136       $this->iconData = $ldap->get_attribute($this->dn,"gotoMimeIcon");
137       $this->saved_attributes['gotoMimeIcon'] = $this->iconData;
138     }
139     if ($this->iconData == ""){
140       $this->set_new_picture("");
141     }
142     $_SESSION['binary']                 = $this->iconData;
143     $_SESSION['binarytype']             = "image/jpeg";
144   }
147   function execute()
148   {
149     $smarty = get_smarty();
151     $tmp = $this->plInfo();
152     foreach($tmp['plProvidedAcls'] as $name => $translation){
153       $smarty->assign($name."ACL",$this->getacl($name));
154     }
156     /* Assign base ACL */
157     $baseACL = $this->getacl("base");
158     if(!$this->acl_is_moveable()) {
159       $baseACL = preg_replace("/w/","",$baseACL);
160     }
161     $smarty->assign("baseACL",          $baseACL);
163     /* Base select dialog */
164     $once = true;
165     foreach($_POST as $name => $value){
166       if(preg_match("/^chooseBase/",$name) && $once){
167         $once = false;
168         $this->dialog = new baseSelectDialog($this->config,$this,$this->acl_get_bases());
169         echo $this->base;
170         $this->dialog->setCurrentBase($this->base);
171       }
172     }
174     /* Dialog handling */
175     if(is_object($this->dialog)){
177       /* Must be called before save_object */
178       $this->dialog->save_object();
180       if($this->dialog->isClosed()){
181         $this->dialog = false;
182       }elseif($this->dialog->isSelected()){
183         $this->base = $this->dialog->isSelected();
184         $this->dialog= false;
185       }else{
186         return($this->dialog->execute());
187       }
188     }
190     /* Check Posts */
191     $posts = array(     
192         "/^Pattern_SortUp_/"    => array("Action" => "Pattern_SortUp",  "Func" => "ArrayUp",    "Attr" => "use_gotoMimeFilePattern"),
193         "/^Pattern_SortDown_/"  => array("Action" => "Pattern_SortDown","Func" => "ArrayDown",  "Attr" => "use_gotoMimeFilePattern"),
194         "/^Pattern_Remove_/"    => array("Action" => "Pattern_Remove",  "Func" => "ArrayRemove","Attr" => "use_gotoMimeFilePattern"),
195         "/^Apps_SortUp_/"               => array("Action" => "Apps_SortUp",             "Func" => "ArrayUp",    "Attr" => "use_gotoMimeApplication"),
196         "/^Apps_SortDown_/"     => array("Action" => "Apps_SortDown",   "Func" => "ArrayDown",  "Attr" => "use_gotoMimeApplication"),
197         "/^Apps_Remove_/"               => array("Action" => "Apps_Remove",             "Func" => "ArrayRemove","Attr" => "use_gotoMimeApplication"),
198         "/^EApps_SortUp_/"              => array("Action" => "EApps_SortUp",    "Func" => "ArrayUp",    "Attr" => "use_gotoMimeEmbeddedApplication"),
199         "/^EApps_SortDown_/"    => array("Action" => "EApps_SortDown",  "Func" => "ArrayDown",  "Attr" => "use_gotoMimeEmbeddedApplication"),
200         "/^EApps_Remove_/"              => array("Action" => "EApps_Remove",    "Func" => "ArrayRemove","Attr" => "use_gotoMimeEmbeddedApplication"));          
201     $once = true;
203     /* Walk through posts and try to find some commands for us. */
204     foreach($_POST as $name => $value){
206       /* Walk through possible commands */
207       foreach($posts as $regex => $action){
209         /* Check if there is a command posted */
210         if(preg_match($regex,$name) && $once){
211           $once = false;
213           /* Get action vars */
214           $func                 = $action['Func'];              // Get function name 
215           $attr                 = $action['Attr'];              // Get attribute name
217           /* Get entry id */
218           $s_entry      = preg_replace($regex,"",$name);
219           $s_entry      = preg_replace("/_[xy]$/","",$s_entry); 
221           /* Execute a command with the given attribute and entry 
222              e.g. $this->gotoMimeFilePattern = $this->ArrayUp(3,$this->gotoMimeFilePattern) */
223           if($this->acl_is_writeable($attr)){
224             $this->$attr= $this->$func($s_entry,$this->$attr,true);                                      
225           }
226         }
227       }
228     }
230     /* Set a new icon was requested */
231     if(isset($_POST['update_icon']) && (isset($_FILES['picture_file']['name']))){
232       $this->set_new_picture($_FILES['picture_file']['tmp_name']);              
233     }
235     /* Add gotoMimeFilePattern */
236     if(isset($_POST['AddNewFilePattern']) && isset($_POST['NewFilePattern'])){
237       if($this->acl_is_writeable("gotoMimeFilePattern")){
238         $str = $_POST['NewFilePattern'];
239         if(!empty($str)){
240           $this->use_gotoMimeFilePattern[] = $str;
241         }
242       }
243     }   
245     /* Add gotoMimeFilePattern */
246     if(isset($_POST['AddNewApplication']) && isset($_POST['NewApplication'])){
247       if($this->acl_is_writeable("gotoMimeApplication")){
248         $str = $_POST['NewApplication'];
249         if(!empty($str)){
250           $this->use_gotoMimeApplication[] = $str;
251         }
252       }
253     }   
255     /* Add gotoMimeFilePattern */
256     if(isset($_POST['AddNewEmbeddedApplication']) && isset($_POST['NewEmbeddedApplication'])){
257       if($this->acl_is_writeable("gotoMimeEmbeddedApplication")){
258         $str = $_POST['NewEmbeddedApplication'];
259         if(!empty($str)){
260           $this->use_gotoMimeEmbeddedApplication[] = $str;
261         }
262       }
263     }   
265     /* Create divlists */
266     $DivPatterns        = new DivSelectBox("gotoMimePatterns");
267     $DivApps            = new DivSelectBox("gotoMimeApplications");
268     $DivEApps           = new DivSelectBox("gotoMimeEmbeddedApplications");
269     $DivPatterns        -> SetHeight(100);
270     $DivApps            -> SetHeight(100);
271     $DivEApps           -> SetHeight(100);
274     if($this->acl_is_writeable("gotoMimeFilePattern")){
275       $Pattern_Actions= " <input type='image' src='images/sort_up.png'  class='center'  name='Pattern_SortUp_%s' >&nbsp;
276       <input type='image' src='images/sort_down.png'    class='center'  name='Pattern_SortDown_%s'>&nbsp;
277       <input type='image' src='images/edittrash.png'    class='center'  name='Pattern_Remove_%s'>";
278     }else{
279       $Pattern_Actions= "";     
280     }
282     if($this->acl_is_writeable("gotoMimeApplication")){
283       $Apps_Actions     = " <input type='image' src='images/sort_up.png'        class='center'  name='Apps_SortUp_%s' >&nbsp;
284       <input type='image' src='images/sort_down.png'    class='center'  name='Apps_SortDown_%s'>&nbsp;
285       <input type='image' src='images/edittrash.png'    class='center'  name='Apps_Remove_%s'>";
286     }else{
287       $Apps_Actions= "";        
288     }
290     if($this->acl_is_writeable("gotoMimeEmbeddedApplication")){
291       $EApps_Actions    = " <input type='image' src='images/sort_up.png'        class='center'  name='EApps_SortUp_%s' >&nbsp;
292       <input type='image' src='images/sort_down.png'    class='center'  name='EApps_SortDown_%s'>&nbsp;
293       <input type='image' src='images/edittrash.png'    class='center'  name='EApps_Remove_%s'>";
294     }else{
295       $EApps_Actions= "";       
296     }
298     foreach($this->use_gotoMimeFilePattern as $key => $pattern){
299       $field1 = array("string" => $pattern);
300       $field2 = array("string" => preg_replace("/%s/",$key,$Pattern_Actions),"attach"=>"style='border-right:0px;width:50px;'");
301       $fields = array($field1,$field2);
302       $DivPatterns -> AddEntry($fields);
303     }                   
304     foreach($this->use_gotoMimeApplication as $key => $pattern){
305       $field1 = array("string" => $pattern);
306       $field2 = array("string" => preg_replace("/%s/",$key,$Apps_Actions),"attach"=>"style='border-right:0px;width:50px;'");
307       $fields = array($field1,$field2);
308       $DivApps -> AddEntry($fields);
309     }                   
310     foreach($this->use_gotoMimeEmbeddedApplication as $key => $pattern){
311       $field1 = array("string" => $pattern);
312       $field2 = array("string" => preg_replace("/%s/",$key,$EApps_Actions),"attach"=>"style='border-right:0px;width:50px;'");
313       $fields = array($field1,$field2);
314       $DivEApps -> AddEntry($fields);
315     }
316     $smarty->assign("bases",                                            $this->acl_get_bases());                
317     $smarty->assign("base_select",                                      $this->base);           
318     $smarty->assign("isReleaseMimeType",                        $this->isReleaseMimeType);
319     $smarty->assign("gotoMimeFilePatterns",                     $DivPatterns->DrawList());
320     $smarty->assign("gotoMimeApplications",                     $DivApps->DrawList());
321     $smarty->assign("gotoMimeEmbeddedApplications",     $DivEApps->DrawList());
323     /* Assign class vars to smarty */
324     foreach($this->attributes as $attr){
325       $smarty->assign($attr,$this->$attr);
326     }   
328     /* Assign additional vars that are not included in attributes*/
329     foreach(array("gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q") as $attr){
330       $smarty->assign($attr,$this->$attr);
331     }   
333     /* Assign select box options */
334     $smarty->assign("gotoMimeGroups",$this->MimeGroups);
335     $smarty->assign("gotoMimeIcon"      ,$this->get_picture());
336     return($smarty->fetch(get_template_path("generic.tpl",TRUE,dirname(__FILE__))));
337   }
340   function save_object()
341   {
342     if(isset($_POST['MimeGeneric'])){
343       plugin::save_object();
344   
345       /* Only save base if we are not in release mode */
346       if(!$this->isReleaseMimeType){
347         if(isset($_POST['base'])){
348           $this->base = $_POST['base'];
349         }
350       }
352       /* Save radio buttons */
353       if($this->acl_is_writeable("gotoMimeLeftClickAction")){
354         if(isset($_POST['gotoMimeLeftClickAction_IE'])){
355           $chr = $_POST['gotoMimeLeftClickAction_IE'];
356           if($chr == "E"){
357             $this->gotoMimeLeftClickAction_E = true;
358             $this->gotoMimeLeftClickAction_I = false;
359           }else{
360             $this->gotoMimeLeftClickAction_E = false;
361             $this->gotoMimeLeftClickAction_I = true;
362           }
363         }
364         if(isset($_POST['gotoMimeLeftClickAction_Q'])){
365           $this->gotoMimeLeftClickAction_Q = true;
366         }else{
367           $this->gotoMimeLeftClickAction_Q = false;
368         }
369       }
370     }
371   }
374   /* save current changes */
375   function save()
376   {
377     /* Create gotoMimeLeftClickAction out of checkboxes and radio buttons */    
378     $arr = array ("E","I","Q");
379     $str = "";
380     foreach ($arr as $Chr){
381       $var = "gotoMimeLeftClickAction_".$Chr;
382       if($this->$var){
383         $str .= $Chr;
384       }
385     }
386     $this->gotoMimeLeftClickAction = $str;
388     /* Create array entries with priority tag ( Test|3 )*/
389     foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication") as $attr){
390       $i                                = 0;
391       $use_attr                 = "use_".$attr;
392       $tmp                      = array();
393       $this->$attr      = array();
394       foreach($this->$use_attr as $entry){
395         $tmp[] = $entry."|".$i ++;
396       }
397       $this->$attr = $tmp;
398     }
400     /* Create array entries */
401     foreach(array("gotoMimeFilePattern") 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;
408       }
409       $this->$attr = $tmp;
410     }
412     /* Remove Icon if requested  */
413     if($this->use_gotoMimeIcon != "*removed*"){
414       $this->gotoMimeIcon = $this->iconData;
415     }else{
416       $this->gotoMimeIcon = "";
417     }
419     plugin::save();
421     /* If this is a newly created object, skip storing those 
422        attributes that contain an empty array */
423     if($this->orig_dn == "new"){
424       foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern") as $attr){
425         if(!count($this->$attr)){
426           unset($this->attrs[$attr]);
427         }
428       }
429     }
431     $ldap = $this->config->get_ldap_link();
432     $ldap-> cd ( $this->config->current['BASE']);
433     $ldap->cat($this->dn);
434     if($ldap->count()){
435       $ldap->cd($this->dn);
436       $this->cleanup();
437       $ldap->modify($this->attrs);
438     }else{
439       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
440       $ldap->cd($this->dn);
441       $ldap->add($this->attrs);
442     }
443     show_ldap_error($ldap->get_error(), sprintf(_("Saving of mime type/generic with dn '%s' failed."),$this->dn));
444   }
447   /* Remove current mime type */
448   function remove_from_parent()
449   {
450     $ldap = $this->config->get_ldap_link();
451     $ldap->rmDir($this->dn);
452     show_ldap_error($ldap->get_error(), sprintf(_("Removing of mime type/generic with dn '%s' failed."),$this->dn));
454     /* Optionally execute a command after we're done */
455     $this->handle_post_events("remove");
457     /* Delete references to object groups */
458     $ldap->cd ($this->config->current['BASE']);
459     $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
460     while ($ldap->fetch()){
461       $og= new ogroup($this->config, $ldap->getDN());
462       unset($og->member[$this->dn]);
463       $og->save ();
464       show_ldap_error($ldap->get_error(), sprintf(_("Removing mime type from objectgroup '%s' failed"), $og->dn));
465     }
466   }
469   /* Check given values */
470   function check()
471   {
472     $message = plugin::check();
473     if(empty($this->cn)){
474       $message[] = _("Please specify a valid name for this mime type.");
475     }
476     if(!count($this->use_gotoMimeFilePattern)){
477       $message[] = _("Please specify at least one file pattern.") ;
478     }
480     /* Check if there is already a mime type with this cn */
481     $ldap = $this->config->get_ldap_link();
482     $ldap->cd($this->config->current["BASE"]);
483     if($this->isReleaseMimeType && (isset($_SESSION['mimefilter']['release']))){
484       $baseDn = str_replace($this->config->current['BASE'],$this->base,$_SESSION['mimefilter']['release']);
485       $baseDn = preg_replace("/ou=mime,.*/","ou=mime,".$this->base,$_SESSION['mimefilter']['release']);
486       $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))",$baseDn,array("cn"));
487       if($ldap->count()){
488         $attrs = $ldap->fetch();
489         if($this->dn != $attrs['dn']) {
490           $message[]= _("There's already a mime type with this 'Name'.");
491         }
492       }
493     }else{
494       $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))","ou=mime,".$this->base,array("cn"));
495       if ($ldap->count()){
496         $attrs = $ldap->fetch();
497         if($this->dn != $attrs['dn']) {
498           $message[]= _("There's already an mime with this 'Name'.");
499         }
500       }
501     }
503     /* Check permissions for that base? */
504     if ($this->base != ""){
505       $new_dn= "cn=".$this->cn.",ou=mime,".$this->base;
506     } else {
507       $new_dn= $this->dn;
508     }
509     if (!$this->acl_is_createable() && $this->dn == "new"){
510       $message[]= _("You have no permissions to create a mime type on this 'Base'.");
511     }
513     return($message);
514   }
516   /** Helper functions **/
518   /* Set a new picture */       
519   function set_new_picture($filename)
520   {
521     if (empty($filename)){
522       $filename= "./images/default_icon.png";
523       $this->use_gotoMimeIcon= "*removed*";
524     }else{
525       $this->use_gotoMimeIcon= $filename;
526     }
528     if (file_exists($filename)){
529       $fd = fopen ($filename, "rb");
530       $this->iconData= fread ($fd, filesize ($filename));
531       $_SESSION['binary']= $this->iconData;
532       $_SESSION['binarytype']= "image/jpeg";
533       fclose ($fd);
534     }
535   }
537   /* Get picture link */
538   function get_picture()
539   {
540     $_SESSION['binary']= $this->iconData;
541     $_SESSION['binarytype']= "image/jpeg";
542     return("getbin.php");
543   }
545   /* Transports the given Arraykey one position up*/
546   function ArrayUp($atr,$attrs)
547   {
548     $ret = $attrs;
549     $pos = $this->getpos($atr,$attrs) ;
550     $cn = count($attrs);
551     if(!(($pos == -1)||($pos == 1))){
552       $before = array_slice($attrs,0,($pos-2));
553       $mitte  = array_reverse(array_slice($attrs,($pos-2),2));
554       $unten  = array_slice($attrs,$pos);
555       $ret = array();
556       $ret = $this->combineArrays($before,$mitte,$unten);
557     }
558     return($ret);
559   }
562   /* Transports the given Arraykey one position down*/
563   function ArrayDown($atr,$attrs)
564   {
565     $ret = $attrs;
566     $pos = $this->getpos($atr,$attrs) ;
567     $cn = count($attrs);
568     if(!(($pos == -1)||($pos == $cn))){
569       $before = array_slice($attrs,0,($pos-1));
570       $mitte  = array_reverse(array_slice($attrs,($pos-1),2));
571       $unten  = array_slice($attrs,($pos+1));
572       $ret = array();
573       $ret = $this->combineArrays($before,$mitte,$unten);
574     }
575     return($ret);
576   }
579   /* return the position of the element in the array */
580   function getpos($atr,$attrs)
581   {
582     $i = 0;
583     foreach($attrs as $attr => $name)    {
584       $i++;
585       if($attr == $atr){
586         return($i);
587       }
588     }
589     return(-1);
590   }
593   /* Remove this element from array */
594   function ArrayRemove($key,$array,$reorder = false)    
595   {
596     if(isset($array[$key])){
597       unset($array[$key]);
598       if($reorder){
599         $tmp = array();
600         foreach($array as $entry){
601           $tmp[] = $entry;
602         }
603         $array = $tmp;
604       }
605     }   
606     return($array);
607   }
610   /* Combine new array */
611   function combineArrays($ar0,$ar1,$ar2)
612   {
613     $ret = array();
614     if(is_array($ar0))
615       foreach($ar0 as $ar => $a){
616         $ret[]=$a;
617       }
618     if(is_array($ar1))
619       foreach($ar1 as $ar => $a){
620         $ret[]=$a;
621       }
622     if(is_array($ar2))
623       foreach($ar2 as $ar => $a){
624         $ret[]=$a;
625       }
626     return($ret);
627   }
630   /* Return a dialog with all fields that must be changed, 
631      if we want to copy this entry */
632   function getCopyDialog()
633   {
634     $str = "";
636     $smarty = get_smarty();
637     $smarty->assign("cn",               $this->cn);
638     $smarty->assign("description",  $this->description);
639     $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
641     $ret = array();
642     $ret['string'] = $str;
643     $ret['status'] = "";
644     return($ret);
645   }
648   /* Save all */
649   function saveCopyDialog()
650   {
651     $attrs = array("cn","description");
652     foreach($attrs as $attr){
653       if(isset($_POST[$attr])){
654         $this->$attr = $_POST[$attr];
655       }
656     }
657   }
659   /* Return plugin informations for acl handling  */ 
660   function plInfo()
661   {
662     return (array(
663           "plShortName"   => _("Generic"),
664           "plDescription" => _("Mime type generic"),
665           "plSelfModify"  => FALSE,
666           "plDepends"     => array(),
667           "plPriority"    => 0,
668           "plSection"     => array("administration"),
669           "plCategory"    => array("mimetypes" => array("description"  => _("Mime types"),
670                                                         "objectClass"  => "gotoMimeType")),
671           "plProvidedAcls"=> array(
672             "cn"                          => _("Name"),
673             "gotoMimeGroup"               => _("Mime group"),
674             "description"                 => _("Description"),
675             "base"                        => _("Base"),
676             "gotoMimeApplication"         => _("Application"),
677             "gotoMimeLeftClickAction"     => _("Left click action"),
678             "gotoMimeIcon"                => _("Icon"),
679             "gotoMimeFilePattern"         => _("File patterns"),
680             "gotoMimeEmbeddedApplication" => _("Embedded applications"))
681           ));
683   }
685 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
686 ?>