Code

b171bf9364d83bfe849264d4322a36488eb0ae83
[gosa.git] / plugins / admin / fai / class_faiManagement.inc
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;  
67     
68     /* Creat dialog object */
69     $this->DivListFai = new divListFai($this->config,$this);
70         }
72         function execute()
73         {
74     /* Call parent execute */
75     plugin::execute();
77     /* Initialise vars and smarty */
78                 $smarty         = get_smarty();
79                 $smarty->assign("BranchName","");
80     
81                 $display        = "";
82     $s_action   = "";
83                 $s_entry        = "";
84     
85     /* If an entry was locked, these vars will be stored in a session to allow direct edit */
86     $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit_entry$/","/^id$/","/^entry_edit_/","/^entry_delete_/");
89     /****************
90       Handle posts 
91      ****************/
93                 /* Check ImageButton posts
94                  * Create new tab ich new_xx is posted
95                  */
96     $posts = array( "/remove_branch/"=>"remove_branch",    "/branch_branch/"=>"branch_branch",
97                     "/freeze_branch/"=>"freeze_branch",    "/create_partition/i"=>"new_partition",
98                     "/create_script/i"=>"new_script",      "/create_hook/i"=>"new_hook",
99                     "/create_variable/i"=>"new_variable",  "/create_template/i"=>"new_template",
100                     "/create_package/i"=>"new_package",    "/create_profile/i"=>"new_profile",
101                     "/edit_continue/"=>"select_class_name_finished");
103                 foreach($_POST as $name => $value){
104       foreach($posts as $reg => $act ){
105         if(preg_match($reg,$name)){
106           $s_action = $act;
107         }
108       }
109                         if(preg_match("/^entry_edit_.*/",$name)){
110                                 $s_entry = preg_replace("/^entry_edit_/","",$name);
111                                 $s_entry = preg_replace("/_.*$/","",$s_entry);
112                                 $s_action = "edit";
113                         }elseif(preg_match("/^entry_delete_.*/",$name)){
114                                 $s_entry = preg_replace("/^entry_delete_/","",$name);
115                                 $s_entry = preg_replace("/_.*$/","",$s_entry);
116         $s_action = "delete";
117       }
118     }
120                 if(isset($_GET['edit_entry'])){
121                         $s_entry = $_GET['edit_entry'];
122                         $s_action = "edit";
123                 }
124     
125     if((isset($_POST['CancelBranchName'])) || (isset($_POST['CloseIFrame']))){
126       $this->dispNewBranch = false;
127       $this->dispNewFreeze = false;
128     }
131     /****************
132       Delete confirme dialog 
133      ****************/
135                 if ($s_action=="delete"){
137                         /* Get 'dn' from posted termlinst */
138                         $this->dn= $this->objects[$s_entry]['dn'];
140                         /* Load permissions for selected 'dn' and check if
141                            we're allowed to remove this 'dn' */
142                         $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
143                         $this->acl= get_module_permission($acl, "FAIclass", $this->dn);
144                         if (chkacl($this->acl, "delete") == ""){
146                                 /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */
147                                 if (($user= get_lock($this->dn)) != ""){
148                                         return(gen_locked_message ($user, $this->dn));
149                                 }
151                                 /* Lock the current entry, so nobody will edit it during deletion */
152                                 add_lock ($this->dn, $this->ui->dn);
153                                 $smarty->assign("warning", sprintf(_("You're about to delete all information about the FAI class at '%s'."), LDAP::fix($this->dn)));
154                                 return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
155                         } else {
157                                 /* Obviously the user isn't allowed to delete. Show message and
158                                    clean session. */
159                                 print_red (_("You are not allowed to delete this component!"));
160                         }
161                 }
164     /****************
165       Delete aborted  
166      ****************/
168                 /* Delete canceled? */
169                 if (isset($_POST['delete_cancel'])){
170                         del_lock ($this->dn);
171                 }
174     /****************
175       Delete confirmed 
176      ****************/
178                 /* Deltetion was confirmed, so delete this entry
179                  */
180                 if (isset($_POST['delete_terminal_confirm'])){
182                         /* Some nice guy may send this as POST, so we've to check
183                            for the permissions again. */
184                         if (chkacl($this->acl, "delete") == ""){
186                                 /* Find out more about the object type */
187                                 $ldap     = $this->config->get_ldap_link();
188                                 $ldap->cat($this->dn, array('objectClass'));
189                                 $attrs  = $ldap->fetch();
190                                 $type     = $this->get_type($attrs);                    
191                                 $this->dialog = new $type[0]($this->config,     $this->config->data['TABS'][$type[2]], $this->dn);
192                                 $this->dialog->set_acl(array($this->acl));
194                                 $this->dialog->by_object[$type[1]]->remove_from_parent ();
195                                 unset ($this->dialog);
196                                 gosa_log ("FAI class '".$this->dn."' has been removed");
197                                 $this->dialog= NULL;
198                         } else {
200                                 /* Normally this shouldn't be reached, send some extra
201                                    logs to notify the administrator */
202                                 print_red (_("You are not allowed to delete this component!"));
203                                 gosa_log ("Warning: '".$this->ui->uid."' tried to trick system ".
204                                                 "deletion.");
205                         }
207                         /* Remove lock file after successfull deletion */
208                         del_lock ($this->dn);
209                 }
212     /****************
213       Edit entry 
214      ****************/
216                 if(($s_action == "edit") && (!isset($this->dialog->config))){
217                         $entry    = $this->objects[$s_entry];
218                         $a_setup  = $this->get_type($entry);
219                         $this->dn = $entry['dn'];
221                         /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */
222                         if (($user= get_lock($this->dn)) != ""){
223                                 return(gen_locked_message ($user, $this->dn));
224                         }
225                         add_lock ($this->dn, $this->ui->dn);
227                         $this->dialog     = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn);
228                         $this->is_dialog  = true;
230       if($entry['FAIstate'] == "freeze"){
231         $this->dialog->set_acl(array("*none*"))  ;
232       }
233                         $_SESSION['objectinfo'] = $this->dn;
234                 }
237     /*  Branch handling 
238         09.01.2006
239     */
241     /****************
242       Remove branch
243      ****************/
245     /* Remove branch 
246      */
247     if($s_action == "remove_branch"){
248       $base= $this->DivListFai->selectedBranch;
250       /* Load permissions for selected 'dn' and check if
251          we're allowed to remove this 'dn' */
252       $acl= get_permissions ($this->DivListFai->selectedBase, $this->ui->subtreeACL);
253       $this->acl= get_module_permission($acl, "FAIclass", $base);
254       if (chkacl($this->acl, "delete") == ""){
255         $smarty->assign("info", sprintf(_("You're about to delete a fai branch / freeze  '%s'."), $this->DivListFai->selectedBranch));
256         return($smarty->fetch(get_template_path('remove_branch.tpl',TRUE)));
257       } else {
258         print_red (_("You are not allowed to delete this release!"));
259       }
260     }
262     
263     /****************
264       Remove branch confirmed
265      ****************/
267     if(isset($_POST['delete_branch_confirm'])){
268       $bb =  $this->DivListFai->selectedBranch;
269       if(!isset($ldap)){
270         $ldap = $this->config->get_ldap_link();
271       }
273       $br = $this->getBranches();
275       if(isset($br[$bb])){
276         $name = $br[$bb];
277         $ldap->cd($bb);
278         $ldap->recursive_remove();
279         $ldap->cd(preg_replace('/,ou=fai,ou=configs,ou=systems,/', ',ou=apps,', $bb));
280         $ldap->recursive_remove();
281         $this->DivListFai->selectedBranch = "main";
283         /* Post remove */
284         $this->lock_name   = $name;
285         $this->lock_dn     = $bb;
286         $this->postremove();
287       }
288     }
291     /****************
292       Create a new branch "insert Name"
293      ****************/
295     if((isset($_POST['UseBranchName']))&&(($this->dispNewBranch)||($this->dispNewFreeze))){
296       $_SESSION['LASTPOST'] = $_POST;
298       if($this->dispNewBranch){
299         $type = "branch";
300       }else{
301         $type = "freeze";
302       }
304       /* Check branch name */
305       $name = $_POST['BranchName'];
306       $is_ok = true;
307       $smarty->assign("BranchName",$name);
308       $base= "ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase;
310       /* Check used characters */
311       if(preg_match("/[^0-9a-z \ö\ä\ü\.-_:,]/i",$name)){
312         if($type == "branch"){
313           print_red(_("Specified branch name is invalid."));
314         }else{
315           print_red(_("Specified freeze name is invalid."));
316         }
317         $is_ok = false;
318       }
320       /* Check if this name is already in use */
321       if(!$this->CheckNewBranchName($_POST['BranchName'],$this->DivListFai->selectedBranch)){
322         print_red(_("This name is already in use."));
323         $is_ok = false;
324       }
326       if($is_ok){
327         $_SESSION['LASTPOST']['base'] = $base;
328         $_SESSION['LASTPOST']['type'] = $type;
329         $smarty->assign("iframe", true);
330         $smarty->assign("plugID", $_GET['plug']);
331         $display        = $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
332         return($display);
333       }
334     }
337     /****************
338       Create a new branch 
339      ****************/
341     if(isset($_GET['PerformBranch'])){
342       /* Create it know */
343       $this->dispNewBranch = false;
344       $this->dispNewFreeze = false;
345       $base = $_SESSION['LASTPOST']['base'];
346       $_POST = $_SESSION['LASTPOST'];      
347       $name = $_POST['BranchName'];
349       $type = $_SESSION['LASTPOST']['type'];
350       $ldap = $this->config->get_ldap_link();
352       $baseToUse = $base;
353       if($this->DivListFai->selectedBranch != "main" ){
354         $baseToUse = $this->DivListFai->selectedBranch;
355       }
357       $appsrc = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=apps,",$baseToUse); 
358       $appdst = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=apps,","ou=".$name.",".$baseToUse) ; 
360       /* Print header to have styles included */
361       echo "<!-- headers.tpl-->".$smarty->fetch(get_template_path('headers.tpl'));
362       echo "<body style='background-image:none;margin:3px;color:black'>";
364       /* Duplicate applications 
365        */
366       $ldap->cd ($appdst);
367       $ldap->recursive_remove();
368       $ldap->cd ($this->config->current['BASE']);
369       $ldap->copy_FAI_resource_recursive($appsrc,$appdst,$type,true);
371       /* Duplicate fai objects 
372        */
373       $ldap->cd ("ou=".$name.",".$baseToUse);
374       $ldap->recursive_remove();
375       $ldap->cd ($this->config->current['BASE']);
376       $ldap->copy_FAI_resource_recursive($baseToUse,"ou=".$name.",".$baseToUse,$type,true);
378       echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
379               <br><input type='submit' name='CloseIFrame' value='"._("Continue")."'>
380             </form></div>";
382       /* Print footer to have valid html */
383       echo "</body></html>";
385       $this->dispNewFreeze = false; 
387       /* Postcreate */ 
389       /* Assign possible attributes */
390       $this->lock_type  = $type; 
391       $this->lock_name  = $name; 
392       $this->lock_dn    = $baseToUse;
393       $this->postcreate();
394       exit();
395     }
398     /****************
399       Display dialog to enter new Branch name
400      ****************/
402     if(($s_action == "branch_branch")||($this->dispNewBranch)){
403       $this->dispNewBranch=true;
404       $smarty->assign("iframe",false);
405                   $display      .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
406       return($display);
407     }
408    
409  
410     /****************
411       Display dialog to enter new Freeze name
412      ****************/
414     if(($s_action == "freeze_branch")||($this->dispNewFreeze)){
415       $this->dispNewFreeze = true;
416       $smarty->assign("iframe",false);
417                   $display      .= $smarty->fetch(get_template_path('faiNewBranch.tpl', TRUE, dirname(__FILE__)));
418       return($display);
419     }
422     /****************
423       Create a new object 
424      ****************/
426     $types = array( "new_partition"     =>  "FAIpartitionTable",
427                     "new_script"        =>  "FAIscript",
428                     "new_hook"          =>  "FAIhook",
429                     "new_variable"      =>  "FAIvariable",
430                     "new_template"      =>  "FAItemplate",
431                     "new_package"       =>  "FAIpackageList");
433     if(isset($types[$s_action])){
434       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,$types[$s_action]);
435     }
437     /* New Profile */
438     if($s_action == "new_profile"){
439       $this->dn = "new" ;
440       $a_setup= $this->get_type(array("objectClass"=>array("FAIprofile")));
442       $this->dialog = new $a_setup[0]($this->config,
443           $this->config->data['TABS'][$a_setup[2]],$this->dn);
444       $this->is_dialog = true;
445     }
448     /****************
449       Get from ask class name dialog 
450      ****************/
452     if($s_action == "select_class_name_finished"){
453       $this->dialog->save_object();
454       if(count($this->dialog->check())!=0){
455         foreach($this->dialog->check() as $msg){
456           print_red($msg);
457         }               
458       }else{
459         $this->dn = "new" ;
460         $a_setup= $this->get_type(array("objectClass"=>array($this->dialog->objectClass)));
461         $name = $this->dialog->save();
463         $this->dialog = new $a_setup[0]($this->config,
464             $this->config->data['TABS'][$a_setup[2]],$this->dn,$name);
465         $this->dialog->by_object[$a_setup[1]]->cn = $name;
466         $this->is_dialog = true;
467       }         
468     }   
471     /****************
472      Cancel dialogs 
473      ****************/
475                 if(isset($_POST['edit_cancel'])){
476                         unset($this->dialog);
477                         $this->dialog=NULL;
478                         $this->is_dialog = false;
479                         unset($_SESSION['objectinfo']);
480                         del_lock ($this->dn);
481                 }
484     /****************
485       Save sub dialogs 
486      ****************/
488                 /* This check if the given tab could be saved 
489                  * If it was possible to save it, remove dialog object. 
490                  * If it wasn't possible, show errors and keep dialog.
491                  */
492                 if((isset($_POST['edit_finish'])) && (isset($this->dialog->config))){
493                         $this->dialog->save_object();
494                         if(count($this->dialog->check())!=0){
495                                 foreach($this->dialog->check() as $msg){
496                                         print_red($msg);
497                                 }
498                         }else{
499                                 del_lock ($this->dn);
500                                 $this->dialog->save();
501                                 unset($this->dialog);
502                                 $this->dialog=NULL;
503                                 $this->is_dialog=false;
504                                 unset($_SESSION['objectinfo']);
505                         }
506                 }
509     /****************
510       Display currently open dialog 
511      ****************/
513                 /* If dialog is set, but $this->is_dialog==false, then 
514                  *  only the "abort" button is shown, this are dialogs that must not be saved.  
515                  * If is_dialog == true, we are currently editing tab objects.
516                  *  Here we need both, save and cancel
517                  */ 
519                 if(($this->dialog != NULL) && (isset($this->dialog->config))){
520                         $display .= $this->dialog->execute();
521                         /* Don't show buttons if tab dialog requests this */
522                         if (((isset($this->dialog->current))&&($this->dialog->by_object[$this->dialog->current]->is_dialog))){
523                                 
524                         }elseif(((isset($this->dialog->current))&&(!$this->dialog->by_object[$this->dialog->current]->is_dialog))){
525                                 $display.= "<p style=\"text-align:right\">\n";
526                                 $display.= "<input type=\"submit\" name=\"edit_finish\" value=\""._("Save")."\">\n";
527                                 $display.= "&nbsp;\n";
528                                 $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
529                                 $display.= "</p>";
530                         }elseif(!isset($this->dialog->current)){
531                                 $display.= "<p style=\"text-align:right\">\n";
532                                 $display.= "<input type=\"submit\" name=\"edit_continue\" value=\""._("Continue")."\">&nbsp;";
533                                 $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
534                                 $display.= "</p>";
535                         }
536                         return($display);
537                 }
538                 
540     /****************
541       Dialog display
542      ****************/
544     /* Display dialog with system list */
545     $this->DivListFai->execute();
546     $this->DivListFai->AddDepartments($this->DivListFai->selectedBase,4);
547     $this->reload();
548     $this->DivListFai->setEntries($this->objects);
549     return($this->DivListFai->Draw());
550         }
553   /* Get available branches for current base */
554   function getBranches($base = false,$prefix = "")
555   {
556     $ret = array("main"=>"/");
557     $ldap = $this->config->get_ldap_link();
558     $ldap->cd($this->config->current['BASE']);
559     if(!$base){
560                 $base= "ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase;
561     }
562     $ldap->cd($base);
563     $ldap->ls("(objectClass=FAIbranch)",$base);
564     while($attrs = $ldap->fetch()){
565       if((isset($attrs['ou']))&&($attrs['dn']!=$base)){
566         $ret[$attrs['dn']]= $prefix.$attrs['ou'][0];
567         $ret = array_merge($ret,$this->getBranches($attrs['dn'],"".$prefix.$attrs['ou'][0]."/"));
568       }
569     }
570     return($ret);
571   }
573   
574   /* reload list of objects */
575         function reload()
576         {
577     /* Create a new list of FAI object 
578      * Generate List of Partitions,Hooks,Scripts,Templates,Profiles ... 
579      */
580     $ObjectTypes = array(
581         "FAIpartitionTable"  => array("OU"=>"ou=disks,"       , "CHKBOX"=>"ShowPartitions"),
582         "FAIpackageList"     => array("OU"=>"ou=packages,"    , "CHKBOX"=>"ShowPackages"),
583         "FAIscript"          => array("OU"=>"ou=scripts,"     , "CHKBOX"=>"ShowScripts"),
584         "FAIvariable"        => array("OU"=>"ou=variables,"   , "CHKBOX"=>"ShowVariables"),
585         "FAIhook"            => array("OU"=>"ou=hooks,"       , "CHKBOX"=>"ShowHooks"),
586         "FAIprofile"         => array("OU"=>"ou=profiles,"    , "CHKBOX"=>"ShowProfiles"),
587         "FAItemplate"        => array("OU"=>"ou=templates,"   , "CHKBOX"=>"ShowTemplates"));
589     /* Set base for all searches */
590     $base           = "ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase;
591     if($this->DivListFai->selectedBranch != "main"){
592       $br = $this->getBranches();
593       if(isset($br[$this->DivListFai->selectedBranch])){
594         $base = $this->DivListFai->selectedBranch;
595       }else{
596         $base = "ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase;
597       }
598     }
600     $Regex          = $this->DivListFai->Regex;
601     $str            = "";
602     $objects        = array();
603     $this->objects  = array();
605     /* Walk through possible sub departments and fetch all FAI objects */
606                 foreach($ObjectTypes as $type => $obj){
608       /* Skip all unchecked types */
609       if(! $this->DivListFai->$obj['CHKBOX']){
610         continue;
611       }
613       /* Fetch objects from fai sub department */
614       $res= get_list("(&(objectClass=".$type.")(cn=$Regex))", $this->ui->subtreeACL, $obj['OU'].$base,
615             array("cn","description","objectClass","FAIclass","FAIstate"), GL_SIZELIMIT);
617       /* Walk through objects */
618                         foreach($res as $object){
620         /* Prepare object */
621                                 unset($object['objectClass']['count']);
622                                 if(!isset($object['description'][0])){
623                                         $object['description'][0]="";
624                                 }
625                                 
626                                 /* Clean up object informations */
627                                 $obj['cn']                            = $object['cn'][0];
628                                 $obj['dn']                            = $object['dn'];
629                                 $obj['description']   = $object['description'][0];
630                                 $obj['objectClass']   = $object['objectClass'];
632         /* Append type to this string, to be able to check if the selected 
633          * entry is of type 'freeze' or 'branch'
634          */
635         if(isset($object['FAIstate'])){
636           $obj['FAIstate'] = $object['FAIstate'][0];
637           $str.="|".$obj['FAIstate'];
638         }else{
639           $obj['FAIstate'] ="";
640         }
641                                 $this->objects[strtolower($obj['cn']).$obj['cn'].$type] = $obj;
642                                 $this->objects[strtolower($obj['cn']).$obj['cn'].$type]['type']=$type;
643                         }
644                 }
646     /* Tell class what we have currently opened 
647         'main' has type '' */
648     if(preg_match("/freeze/",$str)){
649       $this->lock_type = "freeze";
650     }elseif(preg_match("/branch/",$str)){
651       $this->lock_type = "branch";
652     }else{
653       $this->lock_type = "";
654     }
656                 ksort($this->objects);
657                 reset ($this->objects);
658         
659                 /* use numeric index, thats a bit more secure */        
660                 $tmp0 = array();
661                 foreach($this->objects as $obj){
662                         $tmp0[]= $obj;
663                 }
664                 $this->objects = array();
665                 $this->objects = $tmp0;
666         }
668         function remove_lock()
669         {
670                 if (isset($this->dn)){
671                         del_lock ($this->dn);
672                 }
673         }
675         function get_type($array){
676                 if(in_array("FAIpartitionTable",$array['objectClass'])){
677                         return(array("tabsPartition","faiPartitionTable","FAIPARTITIONTABS"));
678                 }
679                 if(in_array("FAIscript",$array['objectClass'])){
680                         return(array("tabsScript","faiScript","FAISCRIPTTABS"));
681                 }
682                 if(in_array("FAItemplate",$array['objectClass'])){
683                         return(array("tabsTemplate","faiTemplate","FAITEMPLATETABS"));
684                 }
685                 if(in_array("FAIhook",$array['objectClass'])){
686                         return(array("tabsHook","faiHook","FAIHOOKTABS"));
687                 }
688                 if(in_array("FAIvariable",$array['objectClass'])){
689                         return(array("tabsVariable","faiVariable","FAIVARIABLETABS"));
690                 }
691                 if(in_array("FAIprofile",$array['objectClass'])){
692                         return(array("tabsProfile","faiProfile","FAIPROFILETABS"));
693                 }
694                 
695                 if(in_array("FAIpackageList",$array['objectClass'])){
696                         return(array("tabsPackage","faiPackage","FAIPACKAGETABS"));
697                 }
698         }
700   function CheckNewBranchName($name,$base)
701   {
702     $f = $this->DivListFai->selectedBranch;
703     if(empty($name)){
704       return(false);
705     }elseif(in_array($name,$this->getBranches($f))) {
706       return(false);
707     }elseif(empty($name)){
708       return(false);
709     }elseif(in_array($name,array("fai","disk","packages","scripts","templates","hooks","variables","profiles","apps"))){
710       return(false);
711     }
712     return(true);
713   }
715   function save_object()
716   {
717     $this->DivListFai->save_object();
718   }
721 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
722 ?>