9fbba6494df494ff352e4b0796cab11345a9c3f0
1 <?php
2 class appgroup extends plugin
3 {
4 /* CLI vars */
5 var $cli_summary= "Manage application groups";
6 var $cli_description= "Some longer text\nfor help";
7 var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
9 /* Appgroup attributes */
10 var $gosaMemberApplication= array();
12 /* Helpers */
13 var $departments = ""; // All departments within $this->curbase;
14 var $apps = array(); // All available applications
15 var $used_apps = array(); // Specifies which applications are currently assigned
17 var $option_name = array();
18 var $option_value = array();
19 var $appoption = array();
21 var $table = "";
22 var $curbase = "";
23 var $curCatDir ;
24 var $curCatDepth =0; //
26 /* attribute list for save action */
27 var $attributes= array();
28 var $objectclasses= array("gosaApplicationGroup");
31 function appgroup ($config, $dn= NULL)
32 {
33 plugin::plugin ($config, $dn);
35 /* Load member applications */
36 if (isset ($this->attrs["gosaMemberApplication"][0])){
37 for ($i= 0; $i<$this->attrs["gosaMemberApplication"]["count"]; $i++){
38 $this->gosaMemberApplication[]=
39 $this->attrs["gosaMemberApplication"][$i];
40 }
41 }
43 /* Load application options */
44 if (isset($this->attrs['gosaApplicationParameter'])){
45 for ($i= 0; $i<$this->attrs['gosaApplicationParameter']['count']; $i++){
46 $option= preg_replace('/^[^:]+:/', '',
47 $this->attrs['gosaApplicationParameter'][$i]);
48 $name= preg_replace('/:.*$/', '',
49 $this->attrs['gosaApplicationParameter'][$i]);
50 $this->appoption[$name]= $option;
51 }
52 }
54 /* Parse MemberApplication*/
55 $tmp = array();
56 $tmp2 = array();
57 $prios = array();
58 $cats = array();
60 foreach($this->gosaMemberApplication as $memberApp){
61 if(preg_match("/\|/i",$memberApp)){
63 $tmp = split("\|",$memberApp);
65 if(!empty($tmp[0])){
66 $tmp2[$tmp[1]][$tmp[2]] = array("App"=>$tmp[0]);
67 }
68 if(!empty($tmp[1])){
69 $n = split("/",$tmp[1]);
70 $c = count($n);
71 $cats [$tmp[1]] = $n[$c-1];
72 }
73 $prios[$tmp[1]][$tmp[2]] = $tmp[2];
74 }else{
75 $tmp2[]['App'] = $memberApp;
76 }
77 }
79 $this->Categories = $cats;
81 $this->gosaMemberApplication = $tmp2;
82 $cats[""]="";
83 foreach($cats as $cat ){
84 if((isset($prios[$cat]))&&(count($prios[$cat]))){
85 $max = max($prios[$cat]);
86 $min = 1;//min($prios[$cat]);
87 $last = false;
88 for($i = $min ; $i < $max ; $i++){
89 if(!isset($prios[$cat][$i])){
90 if($last == false){
91 $this->gosaMemberApplication[$cat][$i]['App'] = "__SEPARATOR__".$i;
93 $last = true;
94 }
95 }else{
96 $last = false;
97 }
98 }
99 }
100 }
102 $tmp = array();
103 foreach($this->gosaMemberApplication as $key => $entries){
104 ksort ($entries);
105 foreach($entries as $entry){
106 $tmp[$key][]= $entry;
107 }
108 }
109 $this->gosaMemberApplication = $tmp;
110 $this->curbase = $this->config->current['BASE'];
111 }
114 /* Combine new array */
115 function combineArrays($ar0,$ar1,$ar2)
116 {
117 $ret = array();
118 if(is_array($ar0))
119 foreach($ar0 as $ar => $a){
120 $ret[$ar]=$a;
121 }
122 if(is_array($ar1))
123 foreach($ar1 as $ar => $a){
124 $ret[$ar]=$a;
125 }
126 if(is_array($ar2))
127 foreach($ar2 as $ar => $a){
128 $ret[$ar]=$a;
129 }
130 return($ret);
131 }
133 function getpos($atr,$attrs)
134 {
135 $i = 0;
136 foreach($attrs as $attr => $name) {
137 $i++;
138 if($attr == $atr){
139 return($i);
140 }
141 }
142 return(-1);
143 }
146 /* TRansports the geiven Arraykey one position up*/
147 function ArrayUp($atr,$attrs)
148 {
149 $ret = $attrs;
150 $pos = $this->getpos($atr,$attrs) ;
151 $cn = count($attrs);
152 if(!(($pos == -1)||($pos == 1))){
153 $before = array_slice($attrs,0,($pos-2));
154 $mitte = array_reverse(array_slice($attrs,($pos-2),2));
155 $unten = array_slice($attrs,$pos);
156 $ret = array();
157 $ret = $this->combineArrays($before,$mitte,$unten);
158 }
159 return($ret);
160 }
163 /* TRansports the geiven Arraykey one position up*/
164 function ArrayDown($atr,$attrs)
165 {
166 $ret = $attrs;
167 $pos = $this->getpos($atr,$attrs) ;
168 $cn = count($attrs);
169 if(!(($pos == -1)||($pos == $cn))){
170 $before = array_slice($attrs,0,($pos-1));
171 $mitte = array_reverse(array_slice($attrs,($pos-1),2));
172 $unten = array_slice($attrs,($pos+1));
173 $ret = array();
174 $ret = $this->combineArrays($before,$mitte,$unten);
175 }
176 return($ret);
177 }
180 function catUp($id)
181 {
182 /* Get all cats depinding on current dir */
183 $cats = $this->GetSubdirs($this->curCatDir);
184 $newcats =$this->ArrayUp($id,$cats);
186 foreach($newcats as $cat => $name){
187 unset($this->Categories[$cat]);
188 }
189 foreach($newcats as $cat => $name){
190 $this->Categories[$cat]=$name;
191 }
192 }
195 function catDown($id)
196 {
197 /* Get all cats depinding on current dir */
198 $cats = $this->GetSubdirs($this->curCatDir);
200 $newcats =$this->ArrayDown($id,$cats);
202 foreach($newcats as $cat => $name){
203 unset($this->Categories[$cat]);
204 }
205 foreach($newcats as $cat => $name){
206 $this->Categories[$cat]=$name;
207 }
208 }
211 function getOneUp($appl)
212 {
213 $cat = $this->curCatDir;
214 $apps = $this->gosaMemberApplication[$cat];
216 $appsA = array();
217 foreach ($apps as $appkey => $name){
218 $appsA[$name['App']] =$name['App'];
219 }
221 $result = $this->ArrayUp($appl,$appsA);
223 $ret = array();
224 foreach($result as $app){
225 $ret[]=array("App"=>$app);
226 }
227 $this->gosaMemberApplication[$cat] = $ret;
228 }
231 function getOneDown($appl)
232 {
233 $cat = $this->curCatDir;
234 $apps = $this->gosaMemberApplication[$cat];
236 $appsA = array();
237 foreach ($apps as $appkey => $name){
238 $appsA[$name['App']] =$name['App'];
239 }
241 $result = $this->ArrayDown($appl,$appsA);
243 $ret = array();
244 foreach($result as $app){
245 $ret[]=array("App"=>$app);
246 }
247 $this->gosaMemberApplication[$cat] = $ret;
248 }
252 function AddSeperator($id)
253 {
254 $found = false;
255 $cat = "";
256 $tmp = array();
257 foreach($this->gosaMemberApplication[$this->curCatDir] as $appID => $app){
258 $tmp[] = $app;
259 if(($app['App'] == $id)&&(!$found)){
260 $cnt = count($this->gosaMemberApplication[$this->curCatDir]);
261 $tmp[] = array("App" => "__SEPARATOR__".($cnt+1));
262 $found = true;
263 }
264 }
265 if($found){
266 $this->gosaMemberApplication[$this->curCatDir]=$tmp;
267 }
268 }
270 function execute()
271 {
272 /* Call parent execute */
273 plugin::execute();
275 if((isset($_GET['act']))&&($_GET['act']=="depopen")){
276 $dep = base64_decode($_GET['depid']);
277 if(isset($this->config->idepartments[$dep])){
278 $this->curbase =$dep;
279 }
280 }
282 if((isset($_GET['act']))&&($_GET['act']=="open")){
283 $this->curCatDir = base64_decode($_GET['id']);
284 }
286 /* Do we need to flip is_account state? */
287 if (isset($_POST['modify_state'])){
288 $this->is_account= !$this->is_account;
289 }
291 /* Do we represent a valid group? */
292 if (!$this->is_account && $this->parent == NULL){
293 $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\"> <b>".
294 _("This 'dn' is no appgroup.")."</b>";
295 return ($display);
296 }
298 /* Show tab dialog headers */
299 $display= "";
300 if ($this->parent != NULL){
301 if ($this->is_account){
302 $display= $this->show_header(_("Remove applications"),
303 _("This group has application features enabled. You can disable them by clicking below."));
304 } else {
305 $display.= $this->show_header(_("Create applications"),
306 _("This group has application features disabled. You can enable them by clicking below."));
307 return ($display);
308 }
309 }
312 /* Add Categorie */
315 if((isset($_POST['AddCat']))&&(isset($_POST['CatName']))&&(!empty($_POST['CatName']))){
317 if(preg_match("/[\\\\\/]/i",$_POST['CatName'])){
318 print_red(_("Invalid character in category name."));
319 }elseif(!in_array($_POST['CatName'],$this->Categories)){
320 if(empty($this->curCatDir)){
321 $this->Categories[$_POST['CatName']]=$_POST['CatName'];
322 }else{
323 $this->Categories[$this->curCatDir."/".$_POST['CatName']]=$_POST['CatName'];
324 }
325 }else{
326 print_red(_("The specified category already exists."));
327 }
328 }
331 $this->reload();
332 $only_once = false;
333 foreach($_POST as $name => $value){
335 if((preg_match("/AddSep_/",$name))&&(!$only_once)){
336 $only_once = true;
337 $n = preg_replace("/AddSep_/","",$name);
338 $val= preg_replace("/_.*$/","",$n);
339 $this->AddSeperator($val);
340 }
342 if((preg_match("/DelApp_/",$name))&&(!$only_once)){
343 $only_once = true;
346 if(preg_match("/DelApp___SEPARATOR__/",$name)) {
347 $n= preg_replace("/DelApp___SEPARATOR__/","",$name);
348 $val= "__SEPARATOR__".preg_replace("/_.*$/","",$n);
349 }else{
350 $n = preg_replace("/DelApp_/","",$name);
351 $val= preg_replace("/_.*$/","",$n);
352 }
354 foreach($this->gosaMemberApplication as $key => $cat){
355 foreach($cat as $key2 => $app){
356 if($app['App'] == $val){
357 unset($this->gosaMemberApplication[$key][$key2]);
358 if(isset($this->used_apps[$val])){
359 unset($this->used_apps[$val]);
360 }
361 }
362 }
363 }
364 }
366 if(preg_match("/DelCat_/",$name)){
367 $n = preg_replace("/DelCat_/","",$name);
368 $app = base64_decode( preg_replace("/_.*$/","",$n));
369 foreach($this->Categories as $key => $cat){
370 if($cat == $app){
371 foreach($this->Categories as $p => $n){
372 if(preg_match("/^".$key."\/.*/",$p)){
373 unset($this->Categories[$p]);
374 }
375 }
376 unset($this->Categories[$key]);
377 }
378 }
379 }
381 if((preg_match("/EdiApp_/",$name))&&(!$only_once)){
383 $only_once = false;
384 $appname = $value;
385 $appname = preg_replace("/EdiApp_/","",$name);
386 $appname = preg_replace("/_.*$/","",$appname);
387 /* We've got the appname, get parameters from ldap */
388 $ldap= $this->config->get_ldap_link();
389 $ldap->cd($this->config->current['BASE']);
390 $ldap->search("(&(objectClass=gosaApplication)(cn=$appname))");
391 if ($ldap->count() != 1){
392 print_red (_("The selected application name is not uniq. Please check your LDAP."));
393 } else {
394 $attrs= $ldap->fetch();
395 if(isset($attrs['gosaApplicationParameter'])){
396 $this->dialog= TRUE;
398 /* Fill name and value arrays */
399 for ($i= 0; $i<$attrs['gosaApplicationParameter']['count']; $i++){
400 $option= preg_replace('/^[^:]+:/', '',
401 $attrs['gosaApplicationParameter'][$i]);
402 $name= preg_replace('/:.*$/', '',
403 $attrs['gosaApplicationParameter'][$i]);
404 $this->option_name[$i]= $name;
406 /* Fill with values from application, default should be
407 loaded by the external scripts */
408 if (isset($this->appoption[$name])){
409 $this->option_value[$i]= $this->appoption[$name];
410 }
411 }
413 /* Create edit field */
414 $table= "<table summary=\"\">";
415 for ($i= 0; $i < count($this->option_name); $i++){
416 if (isset($this->option_value[$i])){
417 $value= $this->option_value[$i];
418 } else {
419 $value= "";
420 }
421 $table.="<tr><td>".$this->option_name[$i]."</td><td>".
422 "<input name=\"value$i\" size=60 maxlength=250 ".
423 "value=\"".$value."\"><br></td></tr>";
424 }
425 $table.= "</table>";
426 $this->table= $table;
427 } else {
428 print_red (_("The selected application has no options."));
429 }
430 }
431 }
432 }
433 $this->reload();
434 /* Add group with post */
435 if((isset($_GET['act']))&&($_GET['act']=="add")){
436 $this->used_apps[$_GET['id']]= $_GET['id'];
437 asort($this->used_apps);
438 $this->addApp($_GET['id']);
439 }
441 /* Add multiple */
442 if(isset($_POST['AddApps'])){
443 foreach($_POST as $name => $value){
444 if(preg_match("/AddApp_/",$name)){
445 $app = preg_replace("/AddApp_/","",$name);
446 $this->addApp($app);
447 }
448 }
449 }
452 /* Cancel edit options? */
453 if (isset($_POST['edit_options_cancel'])){
454 $this->dialog= FALSE;
455 }
457 /* Finish edit options? */
458 if (isset($_POST['edit_options_finish'])){
459 $this->dialog= FALSE;
461 /* Save informations passed by the user */
462 $this->option_value= array();
463 for ($i= 0; $i<count($this->option_name); $i++){
464 $this->appoption[$this->option_name[$i]]= $_POST["value$i"];
465 $this->is_modified= TRUE;
466 }
467 }
469 /* Prepare templating stuff */
470 $smarty= get_smarty();
471 $smarty->assign("used_apps", $this->used_apps);
472 $apps= array();
473 foreach ($this->apps as $key => $value){
474 if (!array_key_exists($key, $this->used_apps)){
475 $apps["$key"]= "$value";
476 }
477 }
479 $div = new DivSelectBox("appgroup");
481 $div->SetHeight(400);
483 /* NEW LIST MANAGMENT
484 * We also need to search for the departments
485 * So we are able to navigate like in konquerer
486 */
488 $ldap = $this->config->get_ldap_link();
489 $ldap->cd($this->curbase) ;
490 $ldap->ls("(objectClass=gosaDepartment)");
491 $departments= array();
492 $tmp = array();
493 while ($value = $ldap->fetch()){
494 $tmp[strtolower($value['dn']).$value['dn']]=$value;
495 }
496 ksort($tmp);
497 foreach($tmp as $value){
498 if($value["description"][0]!=".."){
499 $departments[$value['dn']]=convert_department_dn($value['dn'])." - [".$value["description"][0]."]";
500 }else{
501 $departments[$value['dn']]=convert_department_dn($value['dn']);
502 }
503 }
505 /* END NEW LIST MANAGMENT
506 */
508 $linkopen = "<a href='?plug=".$_GET['plug']."&act=depopen&depid=%s'>%s</a>";
509 $linkadd = "<a href='?plug=".$_GET['plug']."&act=add&id=%s'>%s</a>";
511 $base_back = preg_replace("/^[^,]+,/","",$this->curbase);
512 if((strlen($base_back)>= strlen($this->config->current['BASE']))&&($this->curbase!=$this->config->current['BASE'])){
513 $div->AddEntry(array(
514 array("string"=>sprintf($linkopen,base64_encode($base_back),".. ["._("back")."]"),
515 "attach"=>"style='border:0px;'")
516 ));
517 }
518 foreach($departments as $key => $app){
519 $div->AddEntry(array(
520 array("string"=>"<img src='images/folder.png' alt='"._("department")."'> ".sprintf($linkopen,base64_encode($key),$app),
521 "attach"=>"style='border:0px;'")
522 ));
523 }
525 foreach($apps as $key => $app){
526 $div->AddEntry(array(
527 array("string"=>sprintf("<input type='checkbox' value='1' name='AddApp_%s'>",$key).
528 "<img src='images/select_application.png' alt='"._("application")."'> ".sprintf($linkadd,$key,$app),
529 "attach"=>"style='border:0px;'")
530 ));
531 }
533 if((isset($_GET['act']))&&(($_GET['act'] == "cat_up")||($_GET['act']=="cat_down"))){
534 if($_GET['act']=="cat_up"){
535 $this->catUp(base64_decode($_GET['id']));
536 }
537 if($_GET['act']=="cat_down"){
538 $this->catDown(base64_decode($_GET['id']));
539 }
540 }
542 if((isset($_GET['act']))&&(($_GET['act'] == "one_up")||($_GET['act']=="one_down"))){
543 if(isset($_GET['id'])){
544 $id = $_GET['id'];
545 $act = $_GET['act'];
547 if($act == "one_up"){
548 $this->getOneUp($id);
549 }elseif($act == "one_down") {
550 $this->getOneDown($id);
551 }
552 }
553 }
555 $div2 = new DivSelectBox("appgroup");
556 $div2->SetHeight(400);
558 $linkopen = "<img src='images/folder.png' alt=\"\"> <a href='?plug=".$_GET['plug']."&act=open&id=%s'>%s</a>";
559 $catremove = " <input type='image' src='images/edittrash.png' title='"._("Delete entry")."' name='DelCat_%s' value='%s'>";
560 $app = "<img src='images/select_application.png' alt=\"\"> %s";
562 $catupdown = "<a href='?plug=".$_GET['plug']."&act=cat_up&id=%s'>
563 <img align='top' alt=\"\" src='images/sort_up.png' border=0 title='"._("Move up")."'></a> <a href='?plug=".$_GET['plug']."&act=cat_down&id=%s'>
564 <img alt=\"\" src='images/sort_down.png' title='"._("Move down")."' border=0></a>";
566 if(empty($this->curCatDir)){
567 $cnt =0;
568 }else{
569 $cnt = count(split("/",$this->curCatDir));
570 $tmp = split("/",$this->curCatDir);
571 $bbk = "";
572 for($i = 0 ; $i < ($cnt -1 ) ; $i++){
573 $bbk .= $tmp[$i];
574 }
575 $div2 ->AddEntry(array(array("string"=>sprintf($linkopen,$bbk,"..")),array("string"=>" ","attach"=>"style='border-right:0px;'")));
576 }
578 $this->GetSubdirs($this->curCatDir);
580 foreach($this->GetSubdirs($this->curCatDir) as $path => $name){
581 $div2 ->AddEntry(array(
582 array("string"=>sprintf($linkopen,base64_encode($path),$name)),
583 array("string"=>preg_replace("/%s/",base64_encode($path),$catupdown.$catremove),
584 "attach"=>"align='right' style='width:80px;border-right:0px;'")));
585 }
587 /* Append entries */
589 $separator ="<hr size=1>";
591 $sep = "<input type='image' src='images/back.png' title='"._("Insert seperator")."' value='%s' name='AddSep_%s'>";
593 $upudown ="<a href='?plug=".$_GET['plug']."&act=one_up&id=%s'> <img alt='{t}sort{/t}' align='top' src='images/sort_up.png' title='"._("Move up")."' border=0></a>".
594 " <a href='?plug=".$_GET['plug']."&act=one_down&id=%s'> <img alt='{t}sort{/t}' src='images/sort_down.png' title='"._("Move down")."' border=0></a>".
595 " <input type='image' src='images/edittrash.png' title='"._("Delete entry")."' name='DelApp_%s' value='%s' alt='{t}delete{/t}' >";
596 $edit= " <input type='image' src='images/edit.png' title='"._("Edit entry")."' name='EdiApp_%s' value='%s' alt='{t}edit{/t}' >";
598 if(isset($this->gosaMemberApplication[$this->curCatDir])){
599 foreach($this->gosaMemberApplication[$this->curCatDir] as $cat => $entry){
600 if(preg_match("/__SEPARATOR__/",$entry['App'])){
601 $div2 ->AddEntry(array(array("string"=>$separator),
602 array("string"=>preg_replace("/\%s/",htmlentities($entry['App']),$upudown),"attach"=>"align='right' style='border-right:0px;'")));
603 }else{
604 $div2 ->AddEntry(array(array("string"=>sprintf($app,$entry['App'])),
605 array("string"=>preg_replace("/\%s/",htmlentities($entry['App']),$sep.$edit.$upudown),"attach"=>"align='right' style='border-right:0px;'")));
606 }
607 }
608 }
610 $smarty->assign("UsedApps", $div2->DrawList());
611 $smarty->assign("List", $div->DrawList());
612 $smarty->assign("apps", $apps);
614 /* Show main page */
615 if ($this->dialog){
616 $smarty->assign("table", $this->table);
617 $display.= $smarty->fetch (get_template_path('application_options.tpl', TRUE));
618 } else {
619 $display.= $smarty->fetch (get_template_path('application.tpl', TRUE));
620 }
621 return ($display);
622 }
625 function remove_from_parent()
626 {
627 plugin::remove_from_parent();
629 $this->attrs["gosaMemberApplication"]= array();
631 $ldap= $this->config->get_ldap_link();
632 $ldap->cd($this->dn);
633 $ldap->modify($this->attrs);
634 show_ldap_error($ldap->get_error());
636 /* Optionally execute a command after we're done */
637 $this->handle_post_events("remove");
638 }
641 /* Save to LDAP */
642 function save()
643 {
644 plugin::save();
646 /* Copy members */
647 $this->Categories[""]="";
648 $this->attrs["gosaMemberApplication"]= array();
649 $cats = array();
650 foreach($this->Categories as $name => $cats){
651 $cats[$name] =0;
652 if(isset($this->gosaMemberApplication[$name])){
653 foreach($this->gosaMemberApplication[$name] as $entry){
654 if(!preg_match("/__SEPARATOR__/",$entry['App'])){
655 $this->attrs["gosaMemberApplication"][]= $entry['App']."|".$name."|".$cats[$name];
656 }
657 $cats[$name] = $cats[$name] + 1;
658 }
659 }
660 if(($cats[$name]==0)&&(!empty($name))){
661 $this->attrs["gosaMemberApplication"][]= "|".$name."|".$cats[$name];
662 }
663 }
665 /* Are there application parameters to be saved */
666 $this->attrs['gosaApplicationParameter']= array();
667 foreach($this->appoption as $name => $value){
668 if ($value != ""){
669 $this->attrs['gosaApplicationParameter'][]= "$name:$value";
670 }
671 }
673 /* Write back to LDAP */
674 $ldap= $this->config->get_ldap_link();
675 $ldap->cd($this->dn);
676 $ldap->modify($this->attrs);
677 show_ldap_error($ldap->get_error());
679 /* Optionally execute a command after we're done */
680 if ($this->initially_was_account == $this->is_account){
681 if ($this->is_modified){
682 $this->handle_post_events("mofify");
683 }
684 } else {
685 $this->handle_post_events("add");
686 }
688 }
690 function check()
691 {
692 $message= array();
693 return ($message);
694 }
697 function reload()
698 {
699 /* Generate applist */
700 $this->apps= array();
701 $ldap= $this->config->get_ldap_link();
702 $ldap->cd ("ou=apps,".$this->curbase);
704 $ldap->ls ("(objectClass=gosaApplication)","ou=apps,".$this->curbase);
705 while ($attrs= $ldap->fetch()){
706 if (isset($attrs["description"][0])){
707 $this->apps[$attrs["cn"][0]]=
708 $attrs["cn"][0]." (".
709 $attrs["description"][0].")";
710 } else {
711 $this->apps[$attrs["cn"][0]]=
712 $attrs["cn"][0];
713 }
714 }
715 natcasesort ($this->apps);
716 reset ($this->apps);
718 if(is_array($this->gosaMemberApplication))
719 foreach ($this->gosaMemberApplication as $cat){
720 if(is_array($cat))
721 foreach($cat as $entry){
722 $this->used_apps[$entry['App']]= $entry['App'];
723 }
724 }
725 }
728 function addApp($cn)
729 {
730 if((isset($this->gosaMemberApplication[$this->curCatDir]))&&(is_array($this->gosaMemberApplication[$this->curCatDir]))){
731 foreach($this->gosaMemberApplication[$this->curCatDir] as $entry){
732 if($entry['App'] == $cn) return;
733 }
734 }
735 $this->gosaMemberApplication[$this->curCatDir][]= array("App"=>$cn);
736 $this->used_apps[$cn]=$cn;
737 $this->is_modified= TRUE;
738 }
741 function removeApp($cn)
742 {
743 $temp= array();
744 foreach ($this->gosaMemberApplication as $value){
745 if ($value != $cn){
746 $temp[]= $value;
747 }
748 }
749 $this->gosaMemberApplication= $temp;
750 $this->is_modified= TRUE;
751 }
753 function GetSubdirs($dir)
754 {
755 $ret = array();
756 $tmp1 = split("/",$this->curCatDir);
758 foreach($this->Categories as $path=>$cat){
759 $tmp2 = split("/",$path);
761 if((empty($this->curCatDir))&&(!preg_match("/\//",$path))){
762 $abort = false;
763 }elseif(((count($tmp1))+1) == (count($tmp2))){
764 $abort = false;
765 for($i = 0 ; $i < count($tmp1) ; $i++){
766 if($tmp1[$i] != $tmp2[$i]){
767 $abort = true;
768 }
769 }
770 }else{
771 $abort= true;
772 }
773 if(!$abort){
774 $ret[$path]=$cat;
775 }
776 }
777 return($ret);
778 }
780 }
782 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
783 ?>