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",
48 "gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q","use_gotoMimeIcon");
50 /* Select options */
51 var $MimeGroups = array("application","audio","chemical","image","inode","message","model",
52 "multipart","text","video","x-conference","x-world");
54 /* Orig_Dn is used to verify if this object is new or only edited */
55 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 /* Base select dialog */
157 $once = true;
158 foreach($_POST as $name => $value){
159 if(preg_match("/^chooseBase/",$name) && $once){
160 $once = false;
161 $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
162 $this->dialog->setCurrentBase($this->base);
163 }
164 }
166 /* Dialog handling */
167 if(is_object($this->dialog)){
169 /* Must be called before save_object */
170 $this->dialog->save_object();
172 if($this->dialog->isClosed()){
173 $this->dialog = false;
174 }elseif($this->dialog->isSelected()){
176 /* A new base was selected, check if it is a valid one */
177 $tmp = $this->get_allowed_bases();
178 if(isset($tmp[$this->dialog->isSelected()])){
179 $this->base = $this->dialog->isSelected();
180 }
182 $this->dialog= false;
183 }else{
184 return($this->dialog->execute());
185 }
186 }
188 /* Check Posts */
189 $posts = array(
190 "/^Pattern_SortUp_/" => array("Action" => "Pattern_SortUp", "Func" => "ArrayUp", "Attr" => "use_gotoMimeFilePattern"),
191 "/^Pattern_SortDown_/" => array("Action" => "Pattern_SortDown","Func" => "ArrayDown", "Attr" => "use_gotoMimeFilePattern"),
192 "/^Pattern_Remove_/" => array("Action" => "Pattern_Remove", "Func" => "ArrayRemove","Attr" => "use_gotoMimeFilePattern"),
193 "/^Apps_SortUp_/" => array("Action" => "Apps_SortUp", "Func" => "ArrayUp", "Attr" => "use_gotoMimeApplication"),
194 "/^Apps_SortDown_/" => array("Action" => "Apps_SortDown", "Func" => "ArrayDown", "Attr" => "use_gotoMimeApplication"),
195 "/^Apps_Remove_/" => array("Action" => "Apps_Remove", "Func" => "ArrayRemove","Attr" => "use_gotoMimeApplication"),
196 "/^EApps_SortUp_/" => array("Action" => "EApps_SortUp", "Func" => "ArrayUp", "Attr" => "use_gotoMimeEmbeddedApplication"),
197 "/^EApps_SortDown_/" => array("Action" => "EApps_SortDown", "Func" => "ArrayDown", "Attr" => "use_gotoMimeEmbeddedApplication"),
198 "/^EApps_Remove_/" => array("Action" => "EApps_Remove", "Func" => "ArrayRemove","Attr" => "use_gotoMimeEmbeddedApplication"));
199 $once = true;
201 /* Walk through posts and try to find some commands for us. */
202 foreach($_POST as $name => $value){
204 /* Walk through possible commands */
205 foreach($posts as $regex => $action){
207 /* Check if there is a command posted */
208 if(preg_match($regex,$name) && $once){
209 $once = false;
211 /* Get action vars */
212 $func = $action['Func']; // Get function name
213 $attr = $action['Attr']; // Get attribute name
215 /* Get entry id */
216 $s_entry = preg_replace($regex,"",$name);
217 $s_entry = preg_replace("/_[xy]$/","",$s_entry);
219 /* Execute a command with the given attribute and entry
220 e.g. $this->gotoMimeFilePattern = $this->ArrayUp(3,$this->gotoMimeFilePattern) */
221 if($this->acl_is_writeable($attr)){
222 $this->$attr= $this->$func($s_entry,$this->$attr,true);
223 }
224 }
225 }
226 }
228 /* Set a new icon was requested */
229 if(isset($_POST['update_icon']) && (isset($_FILES['picture_file']['name']))){
230 $this->set_new_picture($_FILES['picture_file']['tmp_name']);
231 }
233 /* Add gotoMimeFilePattern */
234 if(isset($_POST['AddNewFilePattern']) && isset($_POST['NewFilePattern'])){
235 if($this->acl_is_writeable("gotoMimeFilePattern")){
236 $str = $_POST['NewFilePattern'];
237 if(!empty($str)){
238 $this->use_gotoMimeFilePattern[] = $str;
239 }
240 }
241 }
243 /* Add gotoMimeFilePattern */
244 if(isset($_POST['AddNewApplication']) && isset($_POST['NewApplication'])){
245 if($this->acl_is_writeable("gotoMimeApplication")){
246 $str = $_POST['NewApplication'];
247 if(!empty($str)){
248 $this->use_gotoMimeApplication[] = $str;
249 }
250 }
251 }
253 /* Add gotoMimeFilePattern */
254 if(isset($_POST['AddNewEmbeddedApplication']) && isset($_POST['NewEmbeddedApplication'])){
255 if($this->acl_is_writeable("gotoMimeEmbeddedApplication")){
256 $str = $_POST['NewEmbeddedApplication'];
257 if(!empty($str)){
258 $this->use_gotoMimeEmbeddedApplication[] = $str;
259 }
260 }
261 }
263 /* Create divlists */
264 $DivPatterns = new DivSelectBox("gotoMimePatterns");
265 $DivApps = new DivSelectBox("gotoMimeApplications");
266 $DivEApps = new DivSelectBox("gotoMimeEmbeddedApplications");
267 $DivPatterns -> SetHeight(100);
268 $DivApps -> SetHeight(100);
269 $DivEApps -> SetHeight(100);
272 if($this->acl_is_writeable("gotoMimeFilePattern")){
273 $Pattern_Actions= " <input type='image' src='images/sort_up.png' class='center' name='Pattern_SortUp_%s' >
274 <input type='image' src='images/sort_down.png' class='center' name='Pattern_SortDown_%s'>
275 <input type='image' src='images/edittrash.png' class='center' name='Pattern_Remove_%s'>";
276 }else{
277 $Pattern_Actions= "";
278 }
280 if($this->acl_is_writeable("gotoMimeApplication")){
281 $Apps_Actions = " <input type='image' src='images/sort_up.png' class='center' name='Apps_SortUp_%s' >
282 <input type='image' src='images/sort_down.png' class='center' name='Apps_SortDown_%s'>
283 <input type='image' src='images/edittrash.png' class='center' name='Apps_Remove_%s'>";
284 }else{
285 $Apps_Actions= "";
286 }
288 if($this->acl_is_writeable("gotoMimeEmbeddedApplication")){
289 $EApps_Actions = " <input type='image' src='images/sort_up.png' class='center' name='EApps_SortUp_%s' >
290 <input type='image' src='images/sort_down.png' class='center' name='EApps_SortDown_%s'>
291 <input type='image' src='images/edittrash.png' class='center' name='EApps_Remove_%s'>";
292 }else{
293 $EApps_Actions= "";
294 }
296 /* Before adding some entries check acls */
297 if($this->acl_is_readable("gotoMimeFilePattern")){
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 }
306 if($this->acl_is_readable("gotoMimeApplication")){
307 foreach($this->use_gotoMimeApplication as $key => $pattern){
308 $field1 = array("string" => $pattern);
309 $field2 = array("string" => preg_replace("/%s/",$key,$Apps_Actions),"attach"=>"style='border-right:0px;width:50px;'");
310 $fields = array($field1,$field2);
311 $DivApps -> AddEntry($fields);
312 }
313 }
314 if($this->acl_is_readable("gotoMimeEmbeddedApplication")){
315 foreach($this->use_gotoMimeEmbeddedApplication as $key => $pattern){
316 $field1 = array("string" => $pattern);
317 $field2 = array("string" => preg_replace("/%s/",$key,$EApps_Actions),"attach"=>"style='border-right:0px;width:50px;'");
318 $fields = array($field1,$field2);
319 $DivEApps -> AddEntry($fields);
320 }
321 }
322 $smarty->assign("bases", $this->get_allowed_bases());
323 $smarty->assign("base_select", $this->base);
324 $smarty->assign("isReleaseMimeType", $this->isReleaseMimeType);
325 $smarty->assign("gotoMimeFilePatterns", $DivPatterns->DrawList());
326 $smarty->assign("gotoMimeApplications", $DivApps->DrawList());
327 $smarty->assign("gotoMimeEmbeddedApplications", $DivEApps->DrawList());
329 /* Assign class vars to smarty */
330 foreach($this->attributes as $attr){
331 $smarty->assign($attr,$this->$attr);
332 }
334 /* Assign additional vars that are not included in attributes*/
335 foreach(array("gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q") as $attr){
336 $smarty->assign($attr,$this->$attr);
337 }
339 /* Assign select box options */
340 $smarty->assign("gotoMimeGroups",$this->MimeGroups);
341 $smarty->assign("gotoMimeIcon" ,$this->get_picture());
342 return($smarty->fetch(get_template_path("generic.tpl",TRUE,dirname(__FILE__))));
343 }
346 function save_object()
347 {
348 if(isset($_POST['MimeGeneric'])){
350 /* Create a base backup and reset the
351 base directly after calling plugin::save_object();
352 Base will be set seperatly a few lines below */
353 $base_tmp = $this->base;
354 plugin::save_object();
355 $this->base = $base_tmp;
357 /* Only save base if we are not in release mode */
358 if(!$this->isReleaseMimeType){
360 /* Set new base if allowed */
361 $tmp = $this->get_allowed_bases();
362 if(isset($_POST['base'])){
363 if(isset($tmp[$_POST['base']])){
364 $this->base= $_POST['base'];
365 }
366 }
368 }
370 /* Save radio buttons */
371 if($this->acl_is_writeable("gotoMimeLeftClickAction")){
372 if(isset($_POST['gotoMimeLeftClickAction_IE'])){
373 $chr = $_POST['gotoMimeLeftClickAction_IE'];
374 if($chr == "E"){
375 $this->gotoMimeLeftClickAction_E = true;
376 $this->gotoMimeLeftClickAction_I = false;
377 }else{
378 $this->gotoMimeLeftClickAction_E = false;
379 $this->gotoMimeLeftClickAction_I = true;
380 }
381 }
382 if(isset($_POST['gotoMimeLeftClickAction_Q'])){
383 $this->gotoMimeLeftClickAction_Q = true;
384 }else{
385 $this->gotoMimeLeftClickAction_Q = false;
386 }
387 }
388 }
389 }
392 /* save current changes */
393 function save()
394 {
395 /* Create gotoMimeLeftClickAction out of checkboxes and radio buttons */
396 $arr = array ("E","I","Q");
397 $str = "";
398 foreach ($arr as $Chr){
399 $var = "gotoMimeLeftClickAction_".$Chr;
400 if($this->$var){
401 $str .= $Chr;
402 }
403 }
404 $this->gotoMimeLeftClickAction = $str;
406 /* Create array entries with priority tag ( Test|3 )*/
407 foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication") as $attr){
408 $i = 0;
409 $use_attr = "use_".$attr;
410 $tmp = array();
411 $this->$attr = array();
412 foreach($this->$use_attr as $entry){
413 $tmp[] = $entry."|".$i ++;
414 }
415 $this->$attr = $tmp;
416 }
418 /* Create array entries */
419 foreach(array("gotoMimeFilePattern") as $attr){
420 $i = 0;
421 $use_attr = "use_".$attr;
422 $tmp = array();
423 $this->$attr = array();
424 foreach($this->$use_attr as $entry){
425 $tmp[] = $entry;
426 }
427 $this->$attr = $tmp;
428 }
430 /* Remove Icon if requested */
431 if($this->use_gotoMimeIcon != "*removed*"){
432 $this->gotoMimeIcon = $this->iconData;
433 }else{
434 $this->gotoMimeIcon = "";
435 }
437 plugin::save();
439 /* If this is a newly created object, skip storing those
440 attributes that contain an empty array */
441 if($this->orig_dn == "new"){
442 foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern") as $attr){
443 if(!count($this->$attr)){
444 unset($this->attrs[$attr]);
445 }
446 }
447 }
449 $ldap = $this->config->get_ldap_link();
450 $ldap-> cd ( $this->config->current['BASE']);
451 $ldap->cat($this->dn);
452 if($ldap->count()){
453 $ldap->cd($this->dn);
454 $this->cleanup();
455 $ldap->modify($this->attrs);
456 }else{
457 $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
458 $ldap->cd($this->dn);
459 $ldap->add($this->attrs);
460 }
461 show_ldap_error($ldap->get_error(), sprintf(_("Saving of mime type/generic with dn '%s' failed."),$this->dn));
462 }
465 /* Remove current mime type */
466 function remove_from_parent()
467 {
468 $ldap = $this->config->get_ldap_link();
469 $ldap->rmDir($this->dn);
470 show_ldap_error($ldap->get_error(), sprintf(_("Removing of mime type/generic with dn '%s' failed."),$this->dn));
472 /* Optionally execute a command after we're done */
473 $this->handle_post_events("remove");
475 /* Delete references to object groups */
476 $ldap->cd ($this->config->current['BASE']);
477 $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
478 while ($ldap->fetch()){
479 $og= new ogroup($this->config, $ldap->getDN());
480 unset($og->member[$this->dn]);
481 $og->save ();
482 show_ldap_error($ldap->get_error(), sprintf(_("Removing mime type from objectgroup '%s' failed"), $og->dn));
483 }
484 }
487 /* Check given values */
488 function check()
489 {
490 $message = plugin::check();
491 if(empty($this->cn)){
492 $message[] = _("Please specify a valid name for this mime type.");
493 }
494 if(!count($this->use_gotoMimeFilePattern)){
495 $message[] = _("Please specify at least one file pattern.") ;
496 }
498 /* Check if there is already a mime type with this cn */
499 $ldap = $this->config->get_ldap_link();
500 $ldap->cd($this->config->current["BASE"]);
501 if($this->isReleaseMimeType && (isset($_SESSION['mimefilter']['release']))){
502 $baseDn = str_replace($this->config->current['BASE'],$this->base,$_SESSION['mimefilter']['release']);
503 $baseDn = preg_replace("/ou=mime,.*/","ou=mime,".$this->base,$_SESSION['mimefilter']['release']);
504 $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))",$baseDn,array("cn"));
505 if($ldap->count()){
506 $attrs = $ldap->fetch();
507 if($this->dn != $attrs['dn']) {
508 $message[]= _("There's already a mime type with this 'Name'.");
509 }
510 }
511 }else{
512 $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))","ou=mime,".$this->base,array("cn"));
513 if ($ldap->count()){
514 $attrs = $ldap->fetch();
515 if($this->dn != $attrs['dn']) {
516 $message[]= _("There's already an mime with this 'Name'.");
517 }
518 }
519 }
521 return($message);
522 }
524 /** Helper functions **/
526 /* Set a new picture */
527 function set_new_picture($filename)
528 {
529 if (empty($filename)){
530 $filename= "./images/default_icon.png";
531 $this->use_gotoMimeIcon= "*removed*";
532 }else{
533 $this->use_gotoMimeIcon= $filename;
534 }
536 if (file_exists($filename)){
537 $fd = fopen ($filename, "rb");
538 $this->iconData= fread ($fd, filesize ($filename));
539 $_SESSION['binary']= $this->iconData;
540 $_SESSION['binarytype']= "image/jpeg";
541 fclose ($fd);
542 }
543 }
545 /* Get picture link */
546 function get_picture()
547 {
548 $_SESSION['binary']= $this->iconData;
549 $_SESSION['binarytype']= "image/jpeg";
550 return("getbin.php");
551 }
553 /* Transports the given Arraykey one position up*/
554 function ArrayUp($atr,$attrs)
555 {
556 $ret = $attrs;
557 $pos = $this->getpos($atr,$attrs) ;
558 $cn = count($attrs);
559 if(!(($pos == -1)||($pos == 1))){
560 $before = array_slice($attrs,0,($pos-2));
561 $mitte = array_reverse(array_slice($attrs,($pos-2),2));
562 $unten = array_slice($attrs,$pos);
563 $ret = array();
564 $ret = $this->combineArrays($before,$mitte,$unten);
565 }
566 return($ret);
567 }
570 /* Transports the given Arraykey one position down*/
571 function ArrayDown($atr,$attrs)
572 {
573 $ret = $attrs;
574 $pos = $this->getpos($atr,$attrs) ;
575 $cn = count($attrs);
576 if(!(($pos == -1)||($pos == $cn))){
577 $before = array_slice($attrs,0,($pos-1));
578 $mitte = array_reverse(array_slice($attrs,($pos-1),2));
579 $unten = array_slice($attrs,($pos+1));
580 $ret = array();
581 $ret = $this->combineArrays($before,$mitte,$unten);
582 }
583 return($ret);
584 }
587 /* return the position of the element in the array */
588 function getpos($atr,$attrs)
589 {
590 $i = 0;
591 foreach($attrs as $attr => $name) {
592 $i++;
593 if($attr == $atr){
594 return($i);
595 }
596 }
597 return(-1);
598 }
601 /* Remove this element from array */
602 function ArrayRemove($key,$array,$reorder = false)
603 {
604 if(isset($array[$key])){
605 unset($array[$key]);
606 if($reorder){
607 $tmp = array();
608 foreach($array as $entry){
609 $tmp[] = $entry;
610 }
611 $array = $tmp;
612 }
613 }
614 return($array);
615 }
618 /* Combine new array */
619 function combineArrays($ar0,$ar1,$ar2)
620 {
621 $ret = array();
622 if(is_array($ar0))
623 foreach($ar0 as $ar => $a){
624 $ret[]=$a;
625 }
626 if(is_array($ar1))
627 foreach($ar1 as $ar => $a){
628 $ret[]=$a;
629 }
630 if(is_array($ar2))
631 foreach($ar2 as $ar => $a){
632 $ret[]=$a;
633 }
634 return($ret);
635 }
638 /* Return a dialog with all fields that must be changed,
639 if we want to copy this entry */
640 function getCopyDialog()
641 {
642 $str = "";
644 $smarty = get_smarty();
645 $smarty->assign("cn", $this->cn);
646 $smarty->assign("description", $this->description);
647 $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
649 $ret = array();
650 $ret['string'] = $str;
651 $ret['status'] = "";
652 return($ret);
653 }
656 /* Save all */
657 function saveCopyDialog()
658 {
659 $attrs = array("cn","description");
660 foreach($attrs as $attr){
661 if(isset($_POST[$attr])){
662 $this->$attr = $_POST[$attr];
663 }
664 }
665 }
667 /* Return plugin informations for acl handling */
668 function plInfo()
669 {
670 return (array(
671 "plShortName" => _("Generic"),
672 "plDescription" => _("Mime type generic"),
673 "plSelfModify" => FALSE,
674 "plDepends" => array(),
675 "plPriority" => 0,
676 "plSection" => array("administration"),
677 "plCategory" => array("mimetypes" => array("description" => _("Mime types"),
678 "objectClass" => "gotoMimeType")),
679 "plProvidedAcls"=> array(
680 "cn" => _("Name"),
681 "gotoMimeGroup" => _("Mime group"),
682 "description" => _("Description"),
683 "base" => _("Base"),
684 "gotoMimeApplication" => _("Application"),
685 "gotoMimeLeftClickAction" => _("Left click action"),
686 "gotoMimeIcon" => _("Icon"),
687 "gotoMimeFilePattern" => _("File patterns"),
688 "gotoMimeEmbeddedApplication" => _("Embedded applications"))
689 ));
691 }
693 function PrepareForCopyPaste($source)
694 {
695 plugin::PrepareForCopyPaste($source);
696 $this->gotoMimeIcon = $this->iconData;
697 $this->use_gotoMimeIcon = $source->use_gotoMimeIcon;
698 }
699 }
700 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
701 ?>