1 <?php
2 /*
3 This code is part of GOsa (https://gosa.gonicus.de)
4 Copyright (C) 2003 Cajus Pollmeier
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
21 require "tabsPartition.inc";
22 require "tabsVariable.inc";
23 require "tabsHook.inc";
24 require "tabsTemplate.inc";
25 require "tabsScript.inc";
26 require "tabsProfile.inc";
27 require "tabsPackage.inc";
29 class faiManagement extends plugin
30 {
31 /* Definitions */
32 var $plHeadline = "FAI";
33 var $plDescription = "Fully Automatic Installation - management";
35 /* CLI vars */
36 var $cli_summary = "Handling of FAI entries";
37 var $cli_description = "This plugin represents a management tool\n
38 which allows us to manage all needed attributes for fully automatic installations (FAI)";
39 var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
41 /* Headpage attributes */
42 var $lock_type = ""; // should be branch/freeze
43 var $lock_name = "";
44 var $lock_dn = "";
46 /* attribute list for save action */
47 var $attributes = array("lock_type","lock_name","lock_dn"); // Attributes Managed by this plugin
48 var $objectclasses= array(); // ObjectClasses which the attributes are related to
49 var $dialog = array(); // This object contains every dialog we have currently opened
51 var $objects = array(); // This array contains all available objects shown in divlist
52 var $is_dialog = false;
54 var $dispNewBranch= false;
55 var $dispNewFreeze= false;
57 var $DivListFai;
59 /* construction/reconstruction
60 */
61 function faiManagement ($config, $ui)
62 {
63 /* Set defaults */
64 $this->dn = "";
65 $this->config = $config;
66 $this->ui = $ui;
68 /* Creat dialog object */
69 $this->DivListFai = new divListFai($this->config,$this);
70 $this->DivListFai->AvailableBranches = $this->getBranches();
71 }
73 function execute()
74 {
75 /* Call parent execute */
76 plugin::execute();
78 /* Initialise vars and smarty */
79 $smarty = get_smarty();
80 $smarty->assign("BranchName","");
82 $display = "";
83 $s_action = "";
84 $s_entry = "";
86 /* If an entry was locked, these vars will be stored in a session to allow direct edit */
87 $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit_entry$/","/^id$/","/^entry_edit_/","/^entry_delete_/");
90 /****************
91 Handle posts
92 ****************/
94 /* Check ImageButton posts
95 * Create new tab ich new_xx is posted
96 */
97 $posts = array( "/remove_branch/"=>"remove_branch", "/branch_branch/"=>"branch_branch",
98 "/freeze_branch/"=>"freeze_branch", "/create_partition/i"=>"new_partition",
99 "/create_script/i"=>"new_script", "/create_hook/i"=>"new_hook",
100 "/create_variable/i"=>"new_variable", "/create_template/i"=>"new_template",
101 "/create_package/i"=>"new_package", "/create_profile/i"=>"new_profile",
102 "/edit_continue/"=>"select_class_name_finished");
104 foreach($_POST as $name => $value){
105 foreach($posts as $reg => $act ){
106 if(preg_match($reg,$name)){
107 $s_action = $act;
108 }
109 }
110 if(preg_match("/^entry_edit_.*/",$name)){
111 $s_entry = preg_replace("/^entry_edit_/","",$name);
112 $s_entry = preg_replace("/_.*$/","",$s_entry);
113 $s_action = "edit";
114 }elseif(preg_match("/^entry_delete_.*/",$name)){
115 $s_entry = preg_replace("/^entry_delete_/","",$name);
116 $s_entry = preg_replace("/_.*$/","",$s_entry);
117 $s_action = "delete";
118 }
119 }
121 if(isset($_GET['edit_entry'])){
122 $s_entry = $_GET['edit_entry'];
123 $s_action = "edit";
124 }
126 if((isset($_POST['CancelBranchName'])) || (isset($_POST['CloseIFrame']))){
127 $this->dispNewBranch = false;
128 $this->dispNewFreeze = false;
129 }
132 /****************
133 Delete confirme dialog
134 ****************/
136 if ($s_action=="delete"){
138 /* Get 'dn' from posted termlinst */
139 $this->dn= $this->objects[$s_entry]['dn'];
141 /* Load permissions for selected 'dn' and check if
142 we're allowed to remove this 'dn' */
143 $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
144 $this->acl= get_module_permission($acl, "FAIclass", $this->dn);
145 if (chkacl($this->acl, "delete") == ""){
147 /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */
148 if (($user= get_lock($this->dn)) != ""){
149 return(gen_locked_message ($user, $this->dn));
150 }
152 /* Lock the current entry, so nobody will edit it during deletion */
153 add_lock ($this->dn, $this->ui->dn);
154 $smarty->assign("warning", sprintf(_("You're about to delete all information about the FAI class at '%s'."), @LDAP::fix($this->dn)));
155 return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
156 } else {
158 /* Obviously the user isn't allowed to delete. Show message and
159 clean session. */
160 print_red (_("You are not allowed to delete this component!"));
161 }
162 }
165 /****************
166 Delete aborted
167 ****************/
169 /* Delete canceled? */
170 if (isset($_POST['delete_cancel'])){
171 del_lock ($this->dn);
172 }
175 /****************
176 Delete confirmed
177 ****************/
179 /* Deltetion was confirmed, so delete this entry
180 */
181 if (isset($_POST['delete_terminal_confirm'])){
183 /* Some nice guy may send this as POST, so we've to check
184 for the permissions again. */
185 if (chkacl($this->acl, "delete") == ""){
187 /* Find out more about the object type */
188 $ldap = $this->config->get_ldap_link();
189 $ldap->cat($this->dn, array('objectClass'));
190 $attrs = $ldap->fetch();
191 $type = $this->get_type($attrs);
192 $this->dialog = new $type[0]($this->config, $this->config->data['TABS'][$type[2]], $this->dn);
193 $this->dialog->set_acl(array($this->acl));
195 $this->dialog->by_object[$type[1]]->remove_from_parent ();
196 unset ($this->dialog);
197 gosa_log ("FAI class '".$this->dn."' has been removed");
198 $this->dialog= NULL;
199 $this->DivListFai->AvailableBranches = $this->getBranches();
200 } else {
202 /* Normally this shouldn't be reached, send some extra
203 logs to notify the administrator */
204 print_red (_("You are not allowed to delete this component!"));
205 gosa_log ("Warning: '".$this->ui->uid."' tried to trick system ".
206 "deletion.");
207 }
209 /* Remove lock file after successfull deletion */
210 del_lock ($this->dn);
211 }
214 /****************
215 Edit entry
216 ****************/
218 if(($s_action == "edit") && (!isset($this->dialog->config))){
219 $entry = $this->objects[$s_entry];
220 $a_setup = $this->get_type($entry);
221 $this->dn = $entry['dn'];
223 /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */
224 if (($user= get_lock($this->dn)) != ""){
225 return(gen_locked_message ($user, $this->dn));
226 }
227 add_lock ($this->dn, $this->ui->dn);
229 $this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn);
230 $this->is_dialog = true;
232 if($entry['FAIstate'] == "freeze"){
233 $this->dialog->set_acl(array("*none*")) ;
234 }
235 $_SESSION['objectinfo'] = $this->dn;
236 }
239 /* Branch handling
240 09.01.2006
241 */
243 /****************
244 Remove branch
245 ****************/
247 /* Remove branch
248 */
249 if($s_action == "remove_branch"){
250 $base= $this->DivListFai->selectedBranch;
252 /* Load permissions for selected 'dn' and check if
253 we're allowed to remove this 'dn' */
254 $acl= get_permissions ($this->DivListFai->selectedBase, $this->ui->subtreeACL);
255 $this->acl= get_module_permission($acl, "FAIclass", $base);
256 if (chkacl($this->acl, "delete") == ""){
257 $smarty->assign("info", sprintf(_("You're about to delete a fai branch / freeze '%s'."), $this->DivListFai->selectedBranch));
258 return($smarty->fetch(get_template_path('remove_branch.tpl',TRUE)));
259 } else {
260 print_red (_("You are not allowed to delete this release!"));
261 }
262 }
265 /****************
266 Remove branch confirmed
267 ****************/
269 if(isset($_POST['delete_branch_confirm'])){
270 $bb = $this->DivListFai->selectedBranch;
271 if(!isset($ldap)){
272 $ldap = $this->config->get_ldap_link();
273 }
275 $br = $this->DivListFai->AvailableBranches;
277 if(isset($br[$bb])){
278 $name = $br[$bb];
279 $ldap->cd($bb);
280 $ldap->recursive_remove();
281 $ldap->cd(preg_replace('/,ou=fai,ou=configs,ou=systems,/', ',ou=apps,', $bb));
282 $ldap->recursive_remove();
283 $this->DivListFai->selectedBranch = "main";
284 $this->DivListFai->AvailableBranches = $this->getBranches();
286 /* Post remove */
287 $this->lock_name = $name;
288 $this->lock_dn = $bb;
289 $this->postremove();
290 }
291 }
294 /****************
295 Create a new branch "insert Name"
296 ****************/
298 if((isset($_POST['UseBranchName']))&&(($this->dispNewBranch)||($this->dispNewFreeze))){
299 $_SESSION['LASTPOST'] = $_POST;
301 if($this->dispNewBranch){
302 $type = "branch";
303 }else{
304 $type = "freeze";
305 }
307 /* Check branch name */
308 $name = $_POST['BranchName'];
309 $is_ok = true;
310 $smarty->assign("BranchName",$name);
311 $base= "ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase;
313 /* Check used characters */
314 if(preg_match("/[^0-9a-z \ö\ä\ü\.-_:,]/i",$name)){
315 if($type == "branch"){
316 print_red(_("Specified branch name is invalid."));
317 }else{
318 print_red(_("Specified freeze name is invalid."));
319 }
320 $is_ok = false;
321 }
323 /* Check if this name is already in use */
324 if(!$this->CheckNewBranchName($_POST['BranchName'],$this->DivListFai->selectedBranch)){
325 print_red(_("This name is already in use."));
326 $is_ok = false;
327 }
329 if($is_ok){
330 $_SESSION['LASTPOST']['base'] = $base;
331 $_SESSION['LASTPOST']['type'] = $type;
332 $smarty->assign("iframe", true);
333 $smarty->assign("plugID", $_GET['plug']);
334 $display = $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
335 return($display);
336 }
337 }
340 /****************
341 Create a new branch
342 ****************/
344 if(isset($_GET['PerformBranch'])){
345 /* Create it know */
346 $this->dispNewBranch = false;
347 $this->dispNewFreeze = false;
348 $base = $_SESSION['LASTPOST']['base'];
349 $_POST = $_SESSION['LASTPOST'];
350 $name = $_POST['BranchName'];
352 $type = $_SESSION['LASTPOST']['type'];
353 $ldap = $this->config->get_ldap_link();
355 $baseToUse = $base;
356 if($this->DivListFai->selectedBranch != "main" ){
357 $baseToUse = $this->DivListFai->selectedBranch;
358 }
360 /* Create new Release name to be able to set faidebianRelease for FAIpackageList */
362 $CurrentReleases = $this->DivListFai->AvailableBranches;
363 $NewReleaseName = $name;
364 if(isset($CurrentReleases[$this->DivListFai->selectedBranch])) {
365 if($this->DivListFai->selectedBranch != "main"){
366 $NewReleaseName = $CurrentReleases[$this->DivListFai->selectedBranch]."/".$name;
367 $NewReleaseName = preg_replace("#\/#","/",$NewReleaseName);
368 }else{
369 $NewReleaseName = $name;
370 }
371 }
373 $appsrc = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=apps,",$baseToUse);
374 $appdst = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=apps,","ou=".$name.",".$baseToUse) ;
376 /* Print header to have styles included */
377 echo "<!-- headers.tpl-->".$smarty->fetch(get_template_path('headers.tpl'));
378 echo "<body style='background-image:none;margin:3px;color:black'>";
380 /* Duplicate applications
381 */
382 $ldap->cd ($appdst);
383 $ldap->recursive_remove();
384 $ldap->cd ($this->config->current['BASE']);
385 $ldap->copy_FAI_resource_recursive($appsrc,$appdst,$NewReleaseName,$type,true);
387 /* Duplicate fai objects
388 */
389 $ldap->cd ("ou=".$name.",".$baseToUse);
390 $ldap->recursive_remove();
391 $ldap->cd ($this->config->current['BASE']);
392 $ldap->copy_FAI_resource_recursive($baseToUse,"ou=".$name.",".$baseToUse,$NewReleaseName,$type,true);
394 echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
395 <br><input type='submit' name='CloseIFrame' value='"._("Continue")."'>
396 </form></div>";
398 /* Print footer to have valid html */
399 echo "</body></html>";
401 $this->dispNewFreeze = false;
403 /* Postcreate */
405 /* Assign possible attributes */
406 $this->lock_type = $type;
407 $this->lock_name = $name;
408 $this->lock_dn = $baseToUse;
409 $this->postcreate();
410 $this->DivListFai->AvailableBranches = $this->getBranches();
411 exit();
412 }
415 /****************
416 Display dialog to enter new Branch name
417 ****************/
419 if(($s_action == "branch_branch")||($this->dispNewBranch)){
420 $this->dispNewBranch=true;
421 $smarty->assign("iframe",false);
422 $display .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
423 return($display);
424 }
427 /****************
428 Display dialog to enter new Freeze name
429 ****************/
431 if(($s_action == "freeze_branch")||($this->dispNewFreeze)){
432 $this->dispNewFreeze = true;
433 $smarty->assign("iframe",false);
434 $display .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
435 return($display);
436 }
439 /****************
440 Create a new object
441 ****************/
443 $types = array( "new_partition" => "FAIpartitionTable",
444 "new_script" => "FAIscript",
445 "new_hook" => "FAIhook",
446 "new_variable" => "FAIvariable",
447 "new_template" => "FAItemplate",
448 "new_package" => "FAIpackageList");
450 if(isset($types[$s_action])){
451 $this->dialog = new askClassName($this->config,$this->dn,$this->ui,$types[$s_action]);
452 }
454 /* New Profile */
455 if($s_action == "new_profile"){
456 $this->dn = "new" ;
457 $a_setup= $this->get_type(array("objectClass"=>array("FAIprofile")));
459 $this->dialog = new $a_setup[0]($this->config,
460 $this->config->data['TABS'][$a_setup[2]],$this->dn);
461 $this->is_dialog = true;
462 }
465 /****************
466 Get from ask class name dialog
467 ****************/
469 if($s_action == "select_class_name_finished"){
470 $this->dialog->save_object();
471 if(count($this->dialog->check())!=0){
472 foreach($this->dialog->check() as $msg){
473 print_red($msg);
474 }
475 }else{
476 $this->dn = "new" ;
477 $a_setup= $this->get_type(array("objectClass"=>array($this->dialog->objectClass)));
478 $name = $this->dialog->save();
480 $this->dialog = new $a_setup[0]($this->config,
481 $this->config->data['TABS'][$a_setup[2]],$this->dn,$name);
482 $this->dialog->by_object[$a_setup[1]]->cn = $name;
483 $this->is_dialog = true;
484 }
485 }
488 /****************
489 Cancel dialogs
490 ****************/
492 if(isset($_POST['edit_cancel'])){
493 unset($this->dialog);
494 $this->dialog=NULL;
495 $this->is_dialog = false;
496 unset($_SESSION['objectinfo']);
497 del_lock ($this->dn);
498 }
501 /****************
502 Save sub dialogs
503 ****************/
505 /* This check if the given tab could be saved
506 * If it was possible to save it, remove dialog object.
507 * If it wasn't possible, show errors and keep dialog.
508 */
509 if((isset($_POST['edit_finish'])) && (isset($this->dialog->config))){
510 $this->dialog->save_object();
511 if(count($this->dialog->check())!=0){
512 foreach($this->dialog->check() as $msg){
513 print_red($msg);
514 }
515 }else{
516 del_lock ($this->dn);
517 $this->dialog->save();
518 unset($this->dialog);
519 $this->dialog=NULL;
520 $this->is_dialog=false;
521 unset($_SESSION['objectinfo']);
522 }
523 }
526 /****************
527 Display currently open dialog
528 ****************/
530 /* If dialog is set, but $this->is_dialog==false, then
531 * only the "abort" button is shown, this are dialogs that must not be saved.
532 * If is_dialog == true, we are currently editing tab objects.
533 * Here we need both, save and cancel
534 */
536 if(($this->dialog != NULL) && (isset($this->dialog->config))){
537 $display .= $this->dialog->execute();
538 /* Don't show buttons if tab dialog requests this */
539 if (((isset($this->dialog->current))&&($this->dialog->by_object[$this->dialog->current]->is_dialog))){
541 }elseif(((isset($this->dialog->current))&&(!$this->dialog->by_object[$this->dialog->current]->is_dialog))){
542 $display.= "<p style=\"text-align:right\">\n";
543 $display.= "<input type=\"submit\" name=\"edit_finish\" value=\""._("Save")."\">\n";
544 $display.= " \n";
545 $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
546 $display.= "</p>";
547 }elseif(!isset($this->dialog->current)){
548 $display.= "<p style=\"text-align:right\">\n";
549 $display.= "<input type=\"submit\" name=\"edit_continue\" value=\""._("Continue")."\"> ";
550 $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
551 $display.= "</p>";
552 }
553 return($display);
554 }
557 /****************
558 Dialog display
559 ****************/
561 /* Display dialog with system list */
562 $this->DivListFai->parent = $this;
563 $this->DivListFai->execute();
564 $this->DivListFai->AddDepartments($this->DivListFai->selectedBase,4);
565 $this->reload();
566 $this->DivListFai->setEntries($this->objects);
567 return($this->DivListFai->Draw());
568 }
571 /* Get available branches for current base */
572 function getBranches($base = false,$prefix = "")
573 {
574 $ret = array("main"=>"/");
575 $ldap = $this->config->get_ldap_link();
576 if(!$base){
577 $base= "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
578 }
579 $ldap->ls("(objectClass=FAIbranch)",$base);
580 while($attrs = $ldap->fetch()){
581 if((isset($attrs['ou']))&&($attrs['dn']!=$base)){
582 $ret[$attrs['dn']]= $prefix.$attrs['ou'][0];
583 $ret = array_merge($ret,$this->getBranches($attrs['dn'],"".$prefix.$attrs['ou'][0]."/"));
584 }
585 }
587 return ($ret);
588 }
591 /* reload list of objects */
592 function reload()
593 {
594 /* Create a new list of FAI object
595 * Generate List of Partitions,Hooks,Scripts,Templates,Profiles ...
596 */
597 $ObjectTypes = array(
598 "FAIpartitionTable" => array("OU"=>"ou=disk," , "CHKBOX"=>"ShowPartitions"),
599 "FAIpackageList" => array("OU"=>"ou=packages," , "CHKBOX"=>"ShowPackages"),
600 "FAIscript" => array("OU"=>"ou=scripts," , "CHKBOX"=>"ShowScripts"),
601 "FAIvariable" => array("OU"=>"ou=variables," , "CHKBOX"=>"ShowVariables"),
602 "FAIhook" => array("OU"=>"ou=hooks," , "CHKBOX"=>"ShowHooks"),
603 "FAIprofile" => array("OU"=>"ou=profiles," , "CHKBOX"=>"ShowProfiles"),
604 "FAItemplate" => array("OU"=>"ou=templates," , "CHKBOX"=>"ShowTemplates"));
606 /* Set base for all searches */
607 $base = "ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase;
608 if($this->DivListFai->selectedBranch != "main"){
609 $br = $this->DivListFai->AvailableBranches;
610 if(isset($br[$this->DivListFai->selectedBranch])){
611 $base = $this->DivListFai->selectedBranch;
612 }else{
613 $base = "ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase;
614 }
615 }
617 $Regex = $this->DivListFai->Regex;
618 $str = "";
619 $objects = array();
620 $this->objects = array();
622 /* Walk through possible sub departments and fetch all FAI objects */
623 foreach($ObjectTypes as $type => $obj){
625 /* Skip all unchecked types */
626 if(! $this->DivListFai->$obj['CHKBOX']){
627 continue;
628 }
630 /* Fetch objects from fai sub department */
631 $res= get_list("(&(objectClass=".$type.")(cn=$Regex))", $this->ui->subtreeACL, $obj['OU'].$base,
632 array("cn","description","objectClass","FAIclass","FAIstate"), GL_SIZELIMIT);
634 /* Walk through objects */
635 foreach($res as $object){
637 /* Prepare object */
638 unset($object['objectClass']['count']);
639 if(!isset($object['description'][0])){
640 $object['description'][0]="";
641 }
643 /* Clean up object informations */
644 $obj['cn'] = $object['cn'][0];
645 $obj['dn'] = $object['dn'];
646 $obj['description'] = $object['description'][0];
647 $obj['objectClass'] = $object['objectClass'];
649 /* Append type to this string, to be able to check if the selected
650 * entry is of type 'freeze' or 'branch'
651 */
652 if(isset($object['FAIstate'])){
653 $obj['FAIstate'] = $object['FAIstate'][0];
654 $str.="|".$obj['FAIstate'];
655 }else{
656 $obj['FAIstate'] ="";
657 }
658 $this->objects[strtolower($obj['cn']).$obj['cn'].$type] = $obj;
659 $this->objects[strtolower($obj['cn']).$obj['cn'].$type]['type']=$type;
660 }
661 }
663 /* Tell class what we have currently opened
664 'main' has type '' */
665 if(preg_match("/freeze/",$str)){
666 $this->lock_type = "freeze";
667 }elseif(preg_match("/branch/",$str)){
668 $this->lock_type = "branch";
669 }else{
670 $this->lock_type = "";
671 }
673 ksort($this->objects);
674 reset ($this->objects);
676 /* use numeric index, thats a bit more secure */
677 $tmp0 = array();
678 foreach($this->objects as $obj){
679 $tmp0[]= $obj;
680 }
681 $this->objects = array();
682 $this->objects = $tmp0;
683 }
685 function remove_lock()
686 {
687 if (isset($this->dn)){
688 del_lock ($this->dn);
689 }
690 }
692 function get_type($array){
693 if(in_array("FAIpartitionTable",$array['objectClass'])){
694 return(array("tabsPartition","faiPartitionTable","FAIPARTITIONTABS"));
695 }
696 if(in_array("FAIscript",$array['objectClass'])){
697 return(array("tabsScript","faiScript","FAISCRIPTTABS"));
698 }
699 if(in_array("FAItemplate",$array['objectClass'])){
700 return(array("tabsTemplate","faiTemplate","FAITEMPLATETABS"));
701 }
702 if(in_array("FAIhook",$array['objectClass'])){
703 return(array("tabsHook","faiHook","FAIHOOKTABS"));
704 }
705 if(in_array("FAIvariable",$array['objectClass'])){
706 return(array("tabsVariable","faiVariable","FAIVARIABLETABS"));
707 }
708 if(in_array("FAIprofile",$array['objectClass'])){
709 return(array("tabsProfile","faiProfile","FAIPROFILETABS"));
710 }
712 if(in_array("FAIpackageList",$array['objectClass'])){
713 return(array("tabsPackage","faiPackage","FAIPACKAGETABS"));
714 }
715 }
717 function CheckNewBranchName($name,$base)
718 {
719 $f = $this->DivListFai->selectedBranch;
720 if(empty($name)){
721 return(false);
722 }elseif(in_array($name,$this->getBranches($f))) {
723 return(false);
724 }elseif(empty($name)){
725 return(false);
726 }elseif(is_department_name_reserved($name,$base)){
727 return(false);
728 }
729 return(true);
730 }
732 function save_object()
733 {
734 $this->DivListFai->save_object();
735 }
737 }
738 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
739 ?>