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 /* 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->get_allowed_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' >
276 <input type='image' src='images/sort_down.png' class='center' name='Pattern_SortDown_%s'>
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' >
284 <input type='image' src='images/sort_down.png' class='center' name='Apps_SortDown_%s'>
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' >
292 <input type='image' src='images/sort_down.png' class='center' name='EApps_SortDown_%s'>
293 <input type='image' src='images/edittrash.png' class='center' name='EApps_Remove_%s'>";
294 }else{
295 $EApps_Actions= "";
296 }
298 /* Before adding some entries check acls */
299 if($this->acl_is_readable("gotoMimeFilePattern")){
300 foreach($this->use_gotoMimeFilePattern as $key => $pattern){
301 $field1 = array("string" => $pattern);
302 $field2 = array("string" => preg_replace("/%s/",$key,$Pattern_Actions),"attach"=>"style='border-right:0px;width:50px;'");
303 $fields = array($field1,$field2);
304 $DivPatterns -> AddEntry($fields);
305 }
306 }
308 if($this->acl_is_readable("gotoMimeApplication")){
309 foreach($this->use_gotoMimeApplication as $key => $pattern){
310 $field1 = array("string" => $pattern);
311 $field2 = array("string" => preg_replace("/%s/",$key,$Apps_Actions),"attach"=>"style='border-right:0px;width:50px;'");
312 $fields = array($field1,$field2);
313 $DivApps -> AddEntry($fields);
314 }
315 }
316 if($this->acl_is_readable("gotoMimeEmbeddedApplication")){
317 foreach($this->use_gotoMimeEmbeddedApplication as $key => $pattern){
318 $field1 = array("string" => $pattern);
319 $field2 = array("string" => preg_replace("/%s/",$key,$EApps_Actions),"attach"=>"style='border-right:0px;width:50px;'");
320 $fields = array($field1,$field2);
321 $DivEApps -> AddEntry($fields);
322 }
323 }
324 $smarty->assign("bases", $this->get_allowed_bases());
325 $smarty->assign("base_select", $this->base);
326 $smarty->assign("isReleaseMimeType", $this->isReleaseMimeType);
327 $smarty->assign("gotoMimeFilePatterns", $DivPatterns->DrawList());
328 $smarty->assign("gotoMimeApplications", $DivApps->DrawList());
329 $smarty->assign("gotoMimeEmbeddedApplications", $DivEApps->DrawList());
331 /* Assign class vars to smarty */
332 foreach($this->attributes as $attr){
333 $smarty->assign($attr,$this->$attr);
334 }
336 /* Assign additional vars that are not included in attributes*/
337 foreach(array("gotoMimeLeftClickAction_I","gotoMimeLeftClickAction_E","gotoMimeLeftClickAction_Q") as $attr){
338 $smarty->assign($attr,$this->$attr);
339 }
341 /* Assign select box options */
342 $smarty->assign("gotoMimeGroups",$this->MimeGroups);
343 $smarty->assign("gotoMimeIcon" ,$this->get_picture());
344 return($smarty->fetch(get_template_path("generic.tpl",TRUE,dirname(__FILE__))));
345 }
348 function save_object()
349 {
350 if(isset($_POST['MimeGeneric'])){
351 plugin::save_object();
353 /* Only save base if we are not in release mode */
354 if(!$this->isReleaseMimeType){
355 if(isset($_POST['base'])){
356 $this->base = $_POST['base'];
357 }
358 }
360 /* Save radio buttons */
361 if($this->acl_is_writeable("gotoMimeLeftClickAction")){
362 if(isset($_POST['gotoMimeLeftClickAction_IE'])){
363 $chr = $_POST['gotoMimeLeftClickAction_IE'];
364 if($chr == "E"){
365 $this->gotoMimeLeftClickAction_E = true;
366 $this->gotoMimeLeftClickAction_I = false;
367 }else{
368 $this->gotoMimeLeftClickAction_E = false;
369 $this->gotoMimeLeftClickAction_I = true;
370 }
371 }
372 if(isset($_POST['gotoMimeLeftClickAction_Q'])){
373 $this->gotoMimeLeftClickAction_Q = true;
374 }else{
375 $this->gotoMimeLeftClickAction_Q = false;
376 }
377 }
378 }
379 }
382 /* save current changes */
383 function save()
384 {
385 /* Create gotoMimeLeftClickAction out of checkboxes and radio buttons */
386 $arr = array ("E","I","Q");
387 $str = "";
388 foreach ($arr as $Chr){
389 $var = "gotoMimeLeftClickAction_".$Chr;
390 if($this->$var){
391 $str .= $Chr;
392 }
393 }
394 $this->gotoMimeLeftClickAction = $str;
396 /* Create array entries with priority tag ( Test|3 )*/
397 foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication") as $attr){
398 $i = 0;
399 $use_attr = "use_".$attr;
400 $tmp = array();
401 $this->$attr = array();
402 foreach($this->$use_attr as $entry){
403 $tmp[] = $entry."|".$i ++;
404 }
405 $this->$attr = $tmp;
406 }
408 /* Create array entries */
409 foreach(array("gotoMimeFilePattern") as $attr){
410 $i = 0;
411 $use_attr = "use_".$attr;
412 $tmp = array();
413 $this->$attr = array();
414 foreach($this->$use_attr as $entry){
415 $tmp[] = $entry;
416 }
417 $this->$attr = $tmp;
418 }
420 /* Remove Icon if requested */
421 if($this->use_gotoMimeIcon != "*removed*"){
422 $this->gotoMimeIcon = $this->iconData;
423 }else{
424 $this->gotoMimeIcon = "";
425 }
427 plugin::save();
429 /* If this is a newly created object, skip storing those
430 attributes that contain an empty array */
431 if($this->orig_dn == "new"){
432 foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern") as $attr){
433 if(!count($this->$attr)){
434 unset($this->attrs[$attr]);
435 }
436 }
437 }
439 $ldap = $this->config->get_ldap_link();
440 $ldap-> cd ( $this->config->current['BASE']);
441 $ldap->cat($this->dn);
442 if($ldap->count()){
443 $ldap->cd($this->dn);
444 $this->cleanup();
445 $ldap->modify($this->attrs);
446 }else{
447 $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
448 $ldap->cd($this->dn);
449 $ldap->add($this->attrs);
450 }
451 show_ldap_error($ldap->get_error(), sprintf(_("Saving of mime type/generic with dn '%s' failed."),$this->dn));
452 }
455 /* Remove current mime type */
456 function remove_from_parent()
457 {
458 $ldap = $this->config->get_ldap_link();
459 $ldap->rmDir($this->dn);
460 show_ldap_error($ldap->get_error(), sprintf(_("Removing of mime type/generic with dn '%s' failed."),$this->dn));
462 /* Optionally execute a command after we're done */
463 $this->handle_post_events("remove");
465 /* Delete references to object groups */
466 $ldap->cd ($this->config->current['BASE']);
467 $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
468 while ($ldap->fetch()){
469 $og= new ogroup($this->config, $ldap->getDN());
470 unset($og->member[$this->dn]);
471 $og->save ();
472 show_ldap_error($ldap->get_error(), sprintf(_("Removing mime type from objectgroup '%s' failed"), $og->dn));
473 }
474 }
477 /* Check given values */
478 function check()
479 {
480 $message = plugin::check();
481 if(empty($this->cn)){
482 $message[] = _("Please specify a valid name for this mime type.");
483 }
484 if(!count($this->use_gotoMimeFilePattern)){
485 $message[] = _("Please specify at least one file pattern.") ;
486 }
488 /* Check if there is already a mime type with this cn */
489 $ldap = $this->config->get_ldap_link();
490 $ldap->cd($this->config->current["BASE"]);
491 if($this->isReleaseMimeType && (isset($_SESSION['mimefilter']['release']))){
492 $baseDn = str_replace($this->config->current['BASE'],$this->base,$_SESSION['mimefilter']['release']);
493 $baseDn = preg_replace("/ou=mime,.*/","ou=mime,".$this->base,$_SESSION['mimefilter']['release']);
494 $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))",$baseDn,array("cn"));
495 if($ldap->count()){
496 $attrs = $ldap->fetch();
497 if($this->dn != $attrs['dn']) {
498 $message[]= _("There's already a mime type with this 'Name'.");
499 }
500 }
501 }else{
502 $ldap->ls("(&(objectClass=gotoMimeType)(cn=".$this->cn."))","ou=mime,".$this->base,array("cn"));
503 if ($ldap->count()){
504 $attrs = $ldap->fetch();
505 if($this->dn != $attrs['dn']) {
506 $message[]= _("There's already an mime with this 'Name'.");
507 }
508 }
509 }
511 /* Check permissions for that base? */
512 if ($this->base != ""){
513 $new_dn= "cn=".$this->cn.",ou=mime,".$this->base;
514 } else {
515 $new_dn= $this->dn;
516 }
518 /* Set new acl base */
519 if($this->dn == "new") {
520 $this->set_acl_base($new_dn);
521 }
523 if (!$this->acl_is_createable() && $this->dn == "new"){
524 $message[]= _("You have no permissions to create a mime type on this 'Base'.");
525 }
527 return($message);
528 }
530 /** Helper functions **/
532 /* Set a new picture */
533 function set_new_picture($filename)
534 {
535 if (empty($filename)){
536 $filename= "./images/default_icon.png";
537 $this->use_gotoMimeIcon= "*removed*";
538 }else{
539 $this->use_gotoMimeIcon= $filename;
540 }
542 if (file_exists($filename)){
543 $fd = fopen ($filename, "rb");
544 $this->iconData= fread ($fd, filesize ($filename));
545 $_SESSION['binary']= $this->iconData;
546 $_SESSION['binarytype']= "image/jpeg";
547 fclose ($fd);
548 }
549 }
551 /* Get picture link */
552 function get_picture()
553 {
554 $_SESSION['binary']= $this->iconData;
555 $_SESSION['binarytype']= "image/jpeg";
556 return("getbin.php");
557 }
559 /* Transports the given Arraykey one position up*/
560 function ArrayUp($atr,$attrs)
561 {
562 $ret = $attrs;
563 $pos = $this->getpos($atr,$attrs) ;
564 $cn = count($attrs);
565 if(!(($pos == -1)||($pos == 1))){
566 $before = array_slice($attrs,0,($pos-2));
567 $mitte = array_reverse(array_slice($attrs,($pos-2),2));
568 $unten = array_slice($attrs,$pos);
569 $ret = array();
570 $ret = $this->combineArrays($before,$mitte,$unten);
571 }
572 return($ret);
573 }
576 /* Transports the given Arraykey one position down*/
577 function ArrayDown($atr,$attrs)
578 {
579 $ret = $attrs;
580 $pos = $this->getpos($atr,$attrs) ;
581 $cn = count($attrs);
582 if(!(($pos == -1)||($pos == $cn))){
583 $before = array_slice($attrs,0,($pos-1));
584 $mitte = array_reverse(array_slice($attrs,($pos-1),2));
585 $unten = array_slice($attrs,($pos+1));
586 $ret = array();
587 $ret = $this->combineArrays($before,$mitte,$unten);
588 }
589 return($ret);
590 }
593 /* return the position of the element in the array */
594 function getpos($atr,$attrs)
595 {
596 $i = 0;
597 foreach($attrs as $attr => $name) {
598 $i++;
599 if($attr == $atr){
600 return($i);
601 }
602 }
603 return(-1);
604 }
607 /* Remove this element from array */
608 function ArrayRemove($key,$array,$reorder = false)
609 {
610 if(isset($array[$key])){
611 unset($array[$key]);
612 if($reorder){
613 $tmp = array();
614 foreach($array as $entry){
615 $tmp[] = $entry;
616 }
617 $array = $tmp;
618 }
619 }
620 return($array);
621 }
624 /* Combine new array */
625 function combineArrays($ar0,$ar1,$ar2)
626 {
627 $ret = array();
628 if(is_array($ar0))
629 foreach($ar0 as $ar => $a){
630 $ret[]=$a;
631 }
632 if(is_array($ar1))
633 foreach($ar1 as $ar => $a){
634 $ret[]=$a;
635 }
636 if(is_array($ar2))
637 foreach($ar2 as $ar => $a){
638 $ret[]=$a;
639 }
640 return($ret);
641 }
644 /* Return a dialog with all fields that must be changed,
645 if we want to copy this entry */
646 function getCopyDialog()
647 {
648 $str = "";
650 $smarty = get_smarty();
651 $smarty->assign("cn", $this->cn);
652 $smarty->assign("description", $this->description);
653 $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__)));
655 $ret = array();
656 $ret['string'] = $str;
657 $ret['status'] = "";
658 return($ret);
659 }
662 /* Save all */
663 function saveCopyDialog()
664 {
665 $attrs = array("cn","description");
666 foreach($attrs as $attr){
667 if(isset($_POST[$attr])){
668 $this->$attr = $_POST[$attr];
669 }
670 }
671 }
673 /* Return plugin informations for acl handling */
674 function plInfo()
675 {
676 return (array(
677 "plShortName" => _("Generic"),
678 "plDescription" => _("Mime type generic"),
679 "plSelfModify" => FALSE,
680 "plDepends" => array(),
681 "plPriority" => 0,
682 "plSection" => array("administration"),
683 "plCategory" => array("mimetypes" => array("description" => _("Mime types"),
684 "objectClass" => "gotoMimeType")),
685 "plProvidedAcls"=> array(
686 "cn" => _("Name"),
687 "gotoMimeGroup" => _("Mime group"),
688 "description" => _("Description"),
689 "base" => _("Base"),
690 "gotoMimeApplication" => _("Application"),
691 "gotoMimeLeftClickAction" => _("Left click action"),
692 "gotoMimeIcon" => _("Icon"),
693 "gotoMimeFilePattern" => _("File patterns"),
694 "gotoMimeEmbeddedApplication" => _("Embedded applications"))
695 ));
697 }
699 function PrepareForCopyPaste($source)
700 {
701 plugin::PrepareForCopyPaste($source);
702 $this->gotoMimeIcon = $this->iconData;
703 $this->use_gotoMimeIcon = $source->use_gotoMimeIcon;
704 }
705 }
706 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
707 ?>