Code

Adapted path and image
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 19 Sep 2005 07:40:36 +0000 (07:40 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 19 Sep 2005 07:40:36 +0000 (07:40 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1391 594d385d-05f5-0310-b6e9-bd551577e9d8

81 files changed:
TODO
contrib/gosa.conf
html/images/fai.png
plugins/admin/FAI/askClassName.tpl [deleted file]
plugins/admin/FAI/class_askClassName.inc [deleted file]
plugins/admin/FAI/class_faiHook.inc [deleted file]
plugins/admin/FAI/class_faiHookEntry.inc [deleted file]
plugins/admin/FAI/class_faiManagement.inc [deleted file]
plugins/admin/FAI/class_faiPackage.inc [deleted file]
plugins/admin/FAI/class_faiPartitionTable.inc [deleted file]
plugins/admin/FAI/class_faiPartitionTableEntry.inc [deleted file]
plugins/admin/FAI/class_faiProfile.inc [deleted file]
plugins/admin/FAI/class_faiProfileEntry.inc [deleted file]
plugins/admin/FAI/class_faiScript.inc [deleted file]
plugins/admin/FAI/class_faiScriptEntry.inc [deleted file]
plugins/admin/FAI/class_faiTemplate.inc [deleted file]
plugins/admin/FAI/class_faiTemplateEntry.inc [deleted file]
plugins/admin/FAI/class_faiVariable.inc [deleted file]
plugins/admin/FAI/class_faiVariableEntry.inc [deleted file]
plugins/admin/FAI/faiHook.tpl [deleted file]
plugins/admin/FAI/faiHookEntry.tpl [deleted file]
plugins/admin/FAI/faiPackage.tpl [deleted file]
plugins/admin/FAI/faiPartitionTable.tpl [deleted file]
plugins/admin/FAI/faiPartitionTableEntry.tpl [deleted file]
plugins/admin/FAI/faiProfile.tpl [deleted file]
plugins/admin/FAI/faiProfileEntry.tpl [deleted file]
plugins/admin/FAI/faiScript.tpl [deleted file]
plugins/admin/FAI/faiScriptEntry.tpl [deleted file]
plugins/admin/FAI/faiTemplate.tpl [deleted file]
plugins/admin/FAI/faiTemplateEntry.tpl [deleted file]
plugins/admin/FAI/faiVariable.tpl [deleted file]
plugins/admin/FAI/faiVariableEntry.tpl [deleted file]
plugins/admin/FAI/headpage.tpl [deleted file]
plugins/admin/FAI/main.inc [deleted file]
plugins/admin/FAI/remove.tpl [deleted file]
plugins/admin/FAI/tabsHook.inc [deleted file]
plugins/admin/FAI/tabsPackage.inc [deleted file]
plugins/admin/FAI/tabsPartition.inc [deleted file]
plugins/admin/FAI/tabsProfile.inc [deleted file]
plugins/admin/FAI/tabsScript.inc [deleted file]
plugins/admin/FAI/tabsTemplate.inc [deleted file]
plugins/admin/FAI/tabsVariable.inc [deleted file]
plugins/admin/fai/askClassName.tpl [new file with mode: 0644]
plugins/admin/fai/class_askClassName.inc [new file with mode: 0644]
plugins/admin/fai/class_faiHook.inc [new file with mode: 0644]
plugins/admin/fai/class_faiHookEntry.inc [new file with mode: 0644]
plugins/admin/fai/class_faiManagement.inc [new file with mode: 0644]
plugins/admin/fai/class_faiPackage.inc [new file with mode: 0644]
plugins/admin/fai/class_faiPartitionTable.inc [new file with mode: 0644]
plugins/admin/fai/class_faiPartitionTableEntry.inc [new file with mode: 0644]
plugins/admin/fai/class_faiProfile.inc [new file with mode: 0644]
plugins/admin/fai/class_faiProfileEntry.inc [new file with mode: 0644]
plugins/admin/fai/class_faiScript.inc [new file with mode: 0644]
plugins/admin/fai/class_faiScriptEntry.inc [new file with mode: 0644]
plugins/admin/fai/class_faiTemplate.inc [new file with mode: 0644]
plugins/admin/fai/class_faiTemplateEntry.inc [new file with mode: 0644]
plugins/admin/fai/class_faiVariable.inc [new file with mode: 0644]
plugins/admin/fai/class_faiVariableEntry.inc [new file with mode: 0644]
plugins/admin/fai/faiHook.tpl [new file with mode: 0644]
plugins/admin/fai/faiHookEntry.tpl [new file with mode: 0644]
plugins/admin/fai/faiPackage.tpl [new file with mode: 0644]
plugins/admin/fai/faiPartitionTable.tpl [new file with mode: 0644]
plugins/admin/fai/faiPartitionTableEntry.tpl [new file with mode: 0644]
plugins/admin/fai/faiProfile.tpl [new file with mode: 0644]
plugins/admin/fai/faiProfileEntry.tpl [new file with mode: 0644]
plugins/admin/fai/faiScript.tpl [new file with mode: 0644]
plugins/admin/fai/faiScriptEntry.tpl [new file with mode: 0644]
plugins/admin/fai/faiTemplate.tpl [new file with mode: 0644]
plugins/admin/fai/faiTemplateEntry.tpl [new file with mode: 0644]
plugins/admin/fai/faiVariable.tpl [new file with mode: 0644]
plugins/admin/fai/faiVariableEntry.tpl [new file with mode: 0644]
plugins/admin/fai/headpage.tpl [new file with mode: 0644]
plugins/admin/fai/main.inc [new file with mode: 0644]
plugins/admin/fai/remove.tpl [new file with mode: 0644]
plugins/admin/fai/tabsHook.inc [new file with mode: 0644]
plugins/admin/fai/tabsPackage.inc [new file with mode: 0644]
plugins/admin/fai/tabsPartition.inc [new file with mode: 0644]
plugins/admin/fai/tabsProfile.inc [new file with mode: 0644]
plugins/admin/fai/tabsScript.inc [new file with mode: 0644]
plugins/admin/fai/tabsTemplate.inc [new file with mode: 0644]
plugins/admin/fai/tabsVariable.inc [new file with mode: 0644]

diff --git a/TODO b/TODO
index 1176b72d7f17e350143cb65c36f9ecc5468e6c1c..fbe5d7adcfcc0231672d91126417b2e9a7e7526f 100644 (file)
--- a/TODO
+++ b/TODO
@@ -19,6 +19,10 @@ Things to fix before 2.4:
 
 * Addressbook shows up with windows workstations
 
+* Rework environment tab
+
+* Rework printer tabs
+
 
 Target for 2.5:
 ===============
index 19c6166764ab491f7f2ae1b61a82149b41822b9a..6fb4f98dc1801949580fb7c3071c3a070ec0b8a7 100644 (file)
                                path="plugins/admin/departments" />
                        <plugin acl="application" class="applicationManagement"
                                icon="application.png" path="plugins/admin/applications" />
+                       <plugin acl="systems" class="systems" icon="system.png"
+                               path="plugins/admin/systems" />
+                       <plugin acl="FAIclass" class="faiManagement" icon="fai.png"
+                               path="plugins/admin/fai" />
                        <plugin acl="blocklists" class="blocklist" icon="blocklists.png"
                                path="plugins/gofax/blocklists" />
                        <plugin acl="goFonMacro" class="gofonMacro" icon="macros.png"
                                path="plugins/gofon/macro" />
                        <plugin acl="goFonConference" class="phoneConferenceManagment" icon="conference.png"
                                path="plugins/gofon/conference" />
-                       <plugin acl="systems" class="systems" icon="system.png"
-                               path="plugins/admin/systems" />
                </section>
 
                <section name="Addons">
index 313a66152b98589fc5ae888a8381231646403e21..f0a23d6f35e48deaa3eef5b9d464d1449a39acca 100644 (file)
Binary files a/html/images/fai.png and b/html/images/fai.png differ
diff --git a/plugins/admin/FAI/askClassName.tpl b/plugins/admin/FAI/askClassName.tpl
deleted file mode 100644 (file)
index b73f962..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<div style="font-size: 18px;">
-       {$headline}
-       <br><br>
-</div>
-       {t}Please select a class name for this object. The class name specifies a set of configurations.{/t}
-       <br>
-       {t}Every Class name must be unique. But it can be used for different objects at the same time.<br/>If you use this class name in a profile, all object with this class name will be included to this profile.{/t}
-       <br>
-       <br>
-       {t}The list box below shows all available class names you may use, for this object, to avoid duplicates.{/t}
-<br>
-<br>
-<table >
-       <tr>
-               <td colspan="2"><b>
-                       {t}You can select of one the following class names for this object.{/t}
-               </b></td>
-       </tr>
-       <tr>
-               <td><b>{t}Available class names.{/t}</b>
-               </td>
-               <td>
-           <select name="SelectedClass" title="{t}Choose class name{/t}" style="width:120px;">
-                       {html_options values=$ClassNameKeys output=$ClassNames}
-       </select>
-               <input type="submit" name="UseSelectedClass" value="{t}Use{/t}" {$ClassNamesAvailable}> 
-               </td>
-       </tr>
-       <tr>
-               <td colspan="2"><br>
-               </td>
-       </tr>
-       <tr>
-               <td colspan="2"><b>
-                       {t}Please enter your class name here, if want to create a new class.{/t}
-               </b></td>
-       </tr>
-       <tr>
-               <td><b>{t}A new class name.</b>{/t}
-               </td>
-               <td>
-               <input type="text"       name="UseTextInputName" value="" style="width:120px;">
-               <input type="submit" name="UseNewClass" value="{t}Use{/t}"> 
-               </td>
-       </tr>
-</table>
-<p class="seperator">&nbsp;</p>
-       
diff --git a/plugins/admin/FAI/class_askClassName.inc b/plugins/admin/FAI/class_askClassName.inc
deleted file mode 100644 (file)
index a2b380e..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-<?php
-
-class askClassName extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage server basic objects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account = TRUE;
-  var $attributes     = array();
-  var $objectclasses  = array("whatever");
-
-  var $objectClass    = false;
-  var $forbidden      =array();
-  var $ClassName          = "";  
-  var $ClassAlreadyExists = false;
-
-  function askClassName ($config, $dn= NULL,$ui = false, $objectClass)
-  {
-    $this->ui = $ui;
-    $this->objectClass = $objectClass;
-    plugin::plugin ($config, $dn);
-  }
-
-  function execute()
-  {
-    /* Fill templating stuff */
-    $smarty = get_smarty();
-    $display= "";
-
-    /* The faifilter contais 
-       The base for all fai objects 
-     */
-    $faifilter = $_SESSION['faifilter'];
-
-    /* First search for every ou, in given fai base
-     * With a second search detect all object that belong to the different ous. 
-     */
-    $ldap = $this->config->get_ldap_link();
-    $res  = get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)",FALSE, $faifilter['base'], array("cn","description","objectClass"),TRUE);
-    $used = array();
-
-    $delete = array();
-    foreach($res as $objecttypes){
-      $res2 = get_list2($this->ui->subtreeACL, "(objectClass=*)",
-          FALSE, $objecttypes['dn'], array("cn","description","objectClass","FAIclass"),TRUE);
-
-      foreach($res2 as $object){
-      
-        /* skip class names with this name */ 
-        if(in_array($this->objectClass,$object['objectClass'])){
-          $delete[] = $object['cn'][0];
-        }
-    
-        /* Skip profiles */
-        if(!in_array("FAIprofile",$object['objectClass'])){
-          $used[$object['cn'][0]]= $object['cn'][0];
-        }
-      }
-    }
-    
-    /* Create headline
-     * Depending on the object type we want to create, a different headline will be shown
-     */ 
-    switch($this->objectClass) {
-      case "FAIpartitionTable":  $str =_("Create new FAI object - partition table.");break;
-      case "FAIpackageList"   :  $str =_("Create new FAI object - package bundle.");break;
-      case "FAIscript"        :  $str =_("Create new FAI object - script bundle.");break;
-      case "FAIvariable"      :  $str =_("Create new FAI object - variable bundle.");break;
-      case "FAIhook"          :  $str =_("Create new FAI object - hook bundle.");break;
-      case "FAIprofile"       :  $str =_("Create new FAI object - profile.");break;
-      case "FAItemplate"      :  $str =_("Create new FAI object - template.");break;
-      default                 :  $str =_("Create new FAI object");break;
-    }
-    $smarty->assign("headline",$str);
-    
-    /* Save forbidden class names
-     */
-    $this->forbidden = $delete;
-
-    /* Delete all class names which already have this type of object 
-     */
-    foreach($delete as $del){
-      unset($used[$del]);
-    }
-   
-    /* if there is no class name which is missing for this type 
-     *  of objectClass, we only can create a new one, disable selectBox 
-     */
-    if(count ($used)==0){
-      $smarty->assign("ClassNamesAvailable", " disabled ");
-    }else{
-      $smarty->assign("ClassNamesAvailable", "");
-    }
-    $smarty->assign("ClassNames", $used);
-    $smarty->assign("ClassNameKeys", $used);
-    $display.= $smarty->fetch(get_template_path('askClassName.tpl', TRUE));
-    return($display);
-  }
-
-  /* Get posts and set class name 
-   */ 
-  function save_object()
-  {
-    if(isset($_POST['UseNewClass'])){
-      $this->ClassName          = $_POST['UseTextInputName'];
-      $this->ClassAlreadyExists = true;
-    }
-  
-    if(isset($_POST['UseSelectedClass'])){
-      $this->ClassAlreadyExists = false;
-      $this->ClassName          = $_POST['SelectedClass'];
-    }
-  }
-
-
-  /* Check given class name 
-   */
-  function check()
-  {
-    $message= array();
-    if(empty($this->ClassName)){
-      $message[]=_("The given class name is empty.");
-    }
-
-    if(in_array($this->ClassName,$this->forbidden)){
-      $message[]=_("The specified class name is already in use for this object type.");
-    }
-
-    if(preg_match("/[^a-z0-9]/i",$this->ClassName)){
-      $message[]=_("Please enter a valid class name. Only 0-9 a-z is allowed here.");
-    }
-    return ($message);
-  }
-
-
-  /* Return the class name */
-  function save()
-  {
-    return($this->ClassName);
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/FAI/class_faiHook.inc b/plugins/admin/FAI/class_faiHook.inc
deleted file mode 100644 (file)
index c7edf19..0000000
+++ /dev/null
@@ -1,291 +0,0 @@
-<?php
-
-class faiHook extends plugin
-{
-  /* CLI vars */
-  var $cli_summary      = "Manage server basic objects";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account   = TRUE;
-
-  /* Attributes for this Object */
-  var $attributes       = array("cn","description");
-
-  /* ObjectClasses for this Object*/
-  var $objectclasses    = array("top","FAIclass","FAIhook");
-
-  /* Class name of the Ldap ObjectClass for the Sub Object */
-  var $subClass         = "FAIhookEntry";
-  var $subClasses       = array("top","FAIclass","FAIhookEntry");
-
-  /* Class name of the php class which allows us to edit a Sub Object */
-  var $subClassName     = "faiHookEntry";      
-
-  /* Attributes to initialise for each subObject */
-  var $subAttributes    = array("cn","description","FAItask","FAIscript"); 
-  var $sub64coded       = array("FAItask","FAIscript");
-
-  /* Specific attributes */
-  var $cn               = "";       // The class name for this object
-  var $description      = "";       // The description for this set of partitions
-  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
-  var $dialog           = NULL;     // a dialog, e.g. new disk dialog
-  var $SubObjects       = array();  // All leafobjects of this object
-
-  function faiHook ($config, $dn= NULL)
-  {
-    /* Load Attributes */
-    plugin::plugin ($config, $dn);
-
-    /* If "dn==new" we try to create a new entry
-     * Else we must read all objects from ldap which belong to this entry.
-     */
-    if($dn != "new"){
-      $this->dn =$dn;
-
-      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
-       */
-      $ldap     = $this->config->get_ldap_link();
-      $ldap->cd ($this->dn);
-      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$this->subAttributes);
-
-      while($object = $ldap->fetch()){
-        /* Set status for save management */
-  
-        foreach($this->subAttributes as $attrs){
-          if(!isset($object[$attrs][0])){
-            $this->SubObjects[$object['cn'][0]][$attrs]="";
-          }else{
-            $this->SubObjects[$object['cn'][0]][$attrs]=$object[$attrs][0];
-          }
-        }
-      
-        $this->SubObjects[$object['cn'][0]]['status']      = "edited";
-        $this->SubObjects[$object['cn'][0]]['dn']          = $object['dn'];
-
-        foreach($this->sub64coded as $codeIt){
-          $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
-        }
-
-      }
-    }
-  }
-
-  function execute()
-  {
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    /* Add new sub object */
-    if(isset($_POST['AddSubObject'])){
-      $this->dialog= new $this->subClassName($this->config,"new");
-      $this->is_dialog=true;
-    }
-
-    /* Edit selected Sub Object */
-    if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
-      $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$_POST['SubObject']]);
-      $this->is_dialog=true;
-    }
-    
-    /* Remove Sub object */
-    if((isset($_POST['DelSubObject']))&&(isset($_POST['SubObject']))){
-      if($this->SubObjects[$_POST['SubObject']]['status'] == "edited"){
-        $this->SubObjects[$_POST['SubObject']]['status']= "delete";
-      }else{
-        unset($this->SubObjects[$_POST['SubObject']]);
-      }
-    }
-
-    /* Save Dialog */
-    if(isset($_POST['SaveSubObject'])){
-
-      /* Perform post check*/
-      $this->dialog->save_object();
-
-      /* Get messages */
-      $msgs = $this->dialog->check();
-
-      /* print errors */
-      if(count($msgs)>0){
-        foreach($msgs as $msg){
-          print_red($msg);
-        }
-      }else{
-
-        /* Get return object */
-        $obj = $this->dialog->save();
-        if(isset($obj['remove'])){
-
-          /* Depending on status, set new status */
-          if($this->SubObjects[$obj['remove']['from']]['status']=="edited"){
-            $this->SubObjects[$obj['remove']['from']]['status'] = "delete";
-          }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){
-            unset($this->SubObjects[$obj['remove']['from']]);
-          }
-          $obj['status'] = "new";
-          $this->SubObjects[$obj['remove']['to']] = $obj;
-          unset($this->SubObjects[$obj['remove']['to']]['remove']);
-        }else{
-          $this->SubObjects[$obj['cn']]=$obj;
-        }
-        $this->is_dialog=false;
-        unset($this->dialog);
-        $this->dialog=NULL;
-      }
-    }
-
-    /* Cancel Dialog */
-    if(isset($_POST['CancelSubObject'])){
-      $this->is_dialog=false; 
-      unset($this->dialog);
-      $this->dialog=NULL;
-    }
-
-    /* Print dialog if $this->dialog is set */
-    if($this->dialog){
-      $this->dialog->save_object();
-      $display = $this->dialog->execute();
-      return($display);
-    }
-
-    $smarty->assign("SubObjects",$this->getList());
-    $smarty->assign("SubObjectKeys",array_flip($this->getList()));
-    /* Assign variables */
-    foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,$this->$attrs);
-    }
-
-    $display.= $smarty->fetch(get_template_path('faiHook.tpl', TRUE));
-    return($display);
-  }
-
-  /* Generate listbox friendly SubObject list
-  */
-  function getList(){
-    $a_return=array();
-    foreach($this->SubObjects as $obj){
-      if($obj['status'] != "delete"){
-        $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]";
-      }
-    }
-    return($a_return);
-  }
-
-  /* Delete me, and all my subtrees
-   */
-  function remove_from_parent()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-    $ldap->rmdir_recursive($this->dn);
-    $this->handle_post_events("remove");    
-  }
-
-
-  /* Save data to object 
-   */
-  function save_object()
-  {
-    plugin::save_object();
-    foreach($this->attributes as $attrs){
-      if(isset($_POST[$attrs])){
-        $this->$attrs = $_POST[$attrs];
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    $message= array();
-    $str = utf8_encode("üöä");
-    if((empty($this->description))||(preg_match("/[^a-z0-9".$str."\-.,;:_\? ]/i",$this->description))){
-      $message[]=_("Please enter a valid description.");
-    }
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-    $ldap = $this->config->get_ldap_link();
-
-    $ldap->cat($this->dn);
-    if($ldap->count()!=0){     
-      /* Write FAIscript to ldap*/ 
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      /* Write FAIscript to ldap*/ 
-      $ldap->cd($this->dn);
-      $ldap->create_missing_trees($this->dn);
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-    }
-    show_ldap_error($ldap->get_error()); 
-    /* Prepare FAIscriptEntry to write it to ldap
-     * First sort array.
-     *  Because we must delete old entries first.
-     * After deletion, we perform add and modify 
-     */
-    $Objects = array();
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] == "delete"){
-        $Objects[$name] = $obj; 
-      }
-    }
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] != "delete"){
-        $Objects[$name] = $obj; 
-      }
-    }
-
-    foreach($Objects as $name => $obj){
-
-      foreach($this->sub64coded as $codeIt){
-        $obj[$codeIt]=base64_encode($obj[$codeIt]);
-      }
-
-      $tmp = array();
-      foreach($this->subAttributes as $attrs){
-        if(empty($obj[$attrs])){
-          $obj[$attrs] = array();
-        }
-        $tmp[$attrs] = $obj[$attrs];
-      }    
-
-      $tmp['objectClass'] = $this->subClasses;
-      
-      $sub_dn = "cn=".$obj['cn'].",".$this->dn;
-      if($obj['status'] == "delete"){
-        $ldap->cd($sub_dn);
-        $ldap->rmdir_recursive($sub_dn);
-        $this->handle_post_events("remove");
-      }elseif($obj['status'] == "edited"){
-        $ldap->cd($sub_dn);
-        $ldap->modify($tmp);
-        $this->handle_post_events("modify");
-      }elseif($obj['status']=="new"){
-        $ldap->cd($sub_dn);
-        $ldap->create_missing_trees($sub_dn);
-        $ldap->cd($sub_dn);
-        $ldap->add($tmp); 
-        $this->handle_post_events("add");
-      }
-      show_ldap_error($ldap->get_error()); 
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/FAI/class_faiHookEntry.inc b/plugins/admin/FAI/class_faiHookEntry.inc
deleted file mode 100644 (file)
index a73c493..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-
-class faiHookEntry extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage server basic objects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account= TRUE;
-  var $attributes   = array("Object_cn","Object_description","Object_FAIscript","Object_FAItask");
-  var $objectclasses= array();
-
-  var $orig_cn              = "";
-
-  var $Object_dn            = "";
-  var $Object_cn            = "";
-  var $Object_FAItask       = "";
-  var $Object_FAIscript     = "";
-  var $Object_description   = "";
-  var $Object_status        = "new";
-  
-  function faiHookEntry ($config, $dn= NULL,$object=false)
-  {
-    plugin::plugin ($config, $dn);
-    if($dn != "new"){
-      $this->orig_cn= $object['cn'];
-      $this->dn=$object['dn'];
-      foreach($object as $name=>$value){
-        $oname = "Object_".$name;
-        $this->$oname=$value;
-      }
-    }else{
-      $this->Object_status = "new";
-      $this->orig_cn       = false;
-    }
-  }
-
-  function execute()
-  {
-    /* Fill templating stuff */
-    $smarty     = get_smarty();
-    $display = "";
-
-    foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,stripslashes($this->$attrs));
-    }
-
-    for($i =1 ; $i <= 100 ; $i++){
-      $Object_FAIprioritys[$i]=$i;
-    }
-    $smarty->assign("Object_FAIprioritys",$Object_FAIprioritys);
-    $display.= $smarty->fetch(get_template_path('faiHookEntry.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    if(isset($_POST['SubObjectFormSubmitted'])){
-      foreach($this->attributes as $attrs){
-        if(isset($_POST[$attrs])){
-          $this->$attrs = $_POST[$attrs];
-        }else{
-          $this->$attrs = "";
-        }
-      }
-    }
-  }
-
-  /* Check supplied data */
-  function check()
-  {
-    $message= array();
-    if(empty($this->Object_FAItask)) {
-      $message[]=_("Please enter a value for task.");
-    }
-    if(empty($this->Object_FAIscript)) {
-      $message[]=_("Please enter a value for script.");
-    }
-
-    $str = utf8_encode("üöä");
-
-    if(empty($this->Object_description)){
-      $message[] = _("Please enter a description.");
-    }
-
-    if(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->Object_description)){
-      $message[] = _("Invalid character in description. Please enter a valid description.");
-    }
-
-    if(empty($this->Object_cn)){
-      $message[] = _("Please enter a name.");
-    }
-
-    if(preg_match("/[^0-9a-z]/i",$this->Object_cn)){
-      $message[] = _("Please enter a valid name. Only a-Z 0-9 are allowed.");
-    }
-  
-    return ($message);
-  }
-  function save()
-  {
-    $tmp=array();
-    foreach($this->attributes as $attrs){ 
-      $attr = preg_replace("/^Object_/","",$attrs);
-      $tmp[$attr] = $this->$attrs;
-    }
-
-    if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
-      $tmp['remove']['from']  = $this->orig_cn;
-      $tmp['remove']['to']    = $tmp['cn'];
-    }
-  
-    $tmp['dn']      = $this->dn;  
-    $tmp['status']  = $this->Object_status;  
-    return($tmp);
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/FAI/class_faiManagement.inc b/plugins/admin/FAI/class_faiManagement.inc
deleted file mode 100644 (file)
index 7ec7329..0000000
+++ /dev/null
@@ -1,600 +0,0 @@
-<?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2003  Cajus Pollmeier
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-require "tabsPartition.inc";
-require "tabsVariable.inc";
-require "tabsHook.inc";
-require "tabsTemplate.inc";
-require "tabsScript.inc";
-require "tabsProfile.inc";
-require "tabsPackage.inc";
-
-class faiManagement extends plugin
-{
-       /* Definitions */
-       var $plHeadline                 = "FAI management";
-       var $plDescription              = "Fully Automatic Installation - management";
-
-       /* CLI vars */
-       var $cli_summary                = "Handling of FAI entries";
-       var $cli_description    = "This plugin represents a management tool\n
-               which allows us to manage all needed attributes for fully automatic installations (FAI)";
-       var $cli_parameters             = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-       /* Headpage attributes */
-       var $departments= array();
-       var $deptabs= NULL;
-
-       /* attribute list for save action */
-       var $attributes                 = array();      //      Attributes Managed by this plugin, none, 
-       //      because this is only an overview over all objects already defined in FAI.
-       var $objectclasses              = array();      //      ObjectClasses which the attributes are related to
-       var $dialog                             = array();      //      This object contains every dialog we have currently opened
-
-       var $objects                    = array();      //      This array contains all available objects shown in divlist
-       var $is_dialog                  = false;
-
-       /* construction/reconstruction 
-        * The Filter ($faifilter stored in $_SESSION['faifilter']) defines the last 
-        *  selected department and filter options
-        * If it is not defined already we create a new fresh faifilter.
-        */
-       function faiManagement ($config, $ui)
-       {
-               $this->ui                       = $ui;  
-
-               /* Set current dn to "", */
-               $this->dn                       = "";
-
-               /* Assign config */
-               $this->config           = $config;
-
-               /* Get global filter config */
-               if (!is_global("faifilter")){
-                       $base   = get_base_from_people($ui->dn);
-                       $faifilter= array("base" => "ou=fai,ou=configs,ou=systems,".$base,
-                                       "regex" => "*");
-                       $faifilter['ShowProfiles']      = true;
-                       $faifilter['ShowTemplates'] = true;
-                       $faifilter['ShowScripts']       = true;
-                       $faifilter['ShowHooks']         = true;
-                       $faifilter['ShowVariables']     = true;
-                       $faifilter['ShowPackages']      = true;
-                       $faifilter['ShowPartitions']=true;
-                       register_global("faifilter", $faifilter);
-               }
-       }
-
-       function execute()
-       {
-               $display        = "";
-               $smarty         = get_smarty();
-               $s_action       = "";
-               $s_entry        = "";
-               /* filter management 
-                * Filter will be changed if POST['regex'] or $_GET['search'] isset
-                * New Filter will be stored in session and is used to generate list contents
-                */     
-               $faifilter = $_SESSION['faifilter'];
-
-               /* Filter is posted by apply button 
-                * Check every single chkbox 
-                */
-               if(isset($_POST['regex'])){
-                       $faifilter['regex'] = $_POST['regex']."*";
-                       foreach(array("ShowPartitions","ShowProfiles","ShowTemplates","ShowScripts","ShowHooks","ShowVariables","ShowPackages") as $attrs){
-                               if(isset($_POST[$attrs])){
-                                       $faifilter[$attrs] = true;
-                               }else{
-                                       $faifilter[$attrs] = false;
-                               }
-                       }
-               }
-
-               /* Check ImageButton posts
-                * Create new tab ich new_xx is posted
-                */
-               foreach($_POST as $key => $val){
-                       if(preg_match("/create_partition/i",$key)){
-                               $s_action = "new_partition";
-                       }elseif(preg_match("/create_script/i",$key)){
-                               $s_action = "new_script";
-                       }elseif(preg_match("/create_hook/i",$key)){
-                               $s_action = "new_hook";
-                       }elseif(preg_match("/create_variable/i",$key)){
-                               $s_action = "new_variable";
-                       }elseif(preg_match("/create_template/i",$key)){
-                               $s_action = "new_template";
-                       }elseif(preg_match("/create_package/i",$key)){
-                               $s_action = "new_package";
-                       }elseif(preg_match("/create_profile/i",$key)){
-                               $s_action = "new_profile";
-                       }elseif(preg_match("/UseNewClass/",$key)){
-                               $s_action = "select_class_name_finished";
-                       }elseif(preg_match("/UseSelectedClass/",$key)){
-                               $s_action = "select_class_name_finished";
-                       }elseif(preg_match("/^entry_edit_.*/",$key)){
-                               $s_entry = preg_replace("/^entry_edit_/","",$key);
-                               $s_entry = preg_replace("/_.*$/","",$s_entry);
-                               $s_action = "edit";
-                       }elseif(preg_match("/^entry_delete_.*/",$key)){
-                               $s_entry = preg_replace("/^entry_delete_/","",$key);
-                               $s_entry = preg_replace("/_.*$/","",$s_entry);
-                               $s_action = "delete";
-                       }
-
-               }
-
-               /* Confirm dialog 
-                * Delte object 
-         */
-               if ($s_action=="delete"){
-
-                       /* Get 'dn' from posted termlinst */
-                       $this->dn= $this->objects[$s_entry]['dn'];
-
-                       /* Load permissions for selected 'dn' and check if
-                          we're allowed to remove this 'dn' */
-                       $acl=           get_permissions ($this->dn, $this->ui->subtreeACL);
-                       $this->acl= get_module_permission($acl, "FAIclass", $this->dn);
-                       if (chkacl($this->acl, "delete") == ""){
-
-                               /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */
-                               if (($user= get_lock($this->dn)) != ""){
-                                       return(gen_locked_message ($user, $this->dn));
-                               }
-
-                               /* Lock the current entry, so nobody will edit it during deletion */
-                               add_lock ($this->dn, $this->ui->dn);
-                               $smarty->assign("warning", sprintf(_("You're about to delete all information about the component at '%s'."), $this->dn));
-                               return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
-                       } else {
-
-                               /* Obviously the user isn't allowed to delete. Show message and
-                                  clean session. */
-                               print_red (_("You are not allowed to delete this component!"));
-                       }
-               }
-
-               /* Deltetion was confirmed, so delete this entry
-                */
-               if (isset($_POST['delete_terminal_confirm'])){
-
-                       /* Some nice guy may send this as POST, so we've to check
-                          for the permissions again. */
-                       if (chkacl($this->acl, "delete") == ""){
-
-                               /* Find out more about the object type */
-                               $ldap   = $this->config->get_ldap_link();
-                               $ldap->cat($this->dn);
-                               $attrs  = $ldap->fetch();
-
-                               $type   = $this->get_type($attrs);                      
-
-                               $this->dialog= new $type[0]($this->config,      $this->config->data['TABS'][$type[2]], $this->dn);
-                               $this->dialog->set_acl(array($this->acl));
-
-                               $this->dialog->by_object[$type[1]]->remove_from_parent ();
-                               unset ($this->dialog);
-                               gosa_log ("System object'".$this->dn."' has been removed");
-                               $this->dialog= NULL;
-
-                               /* Terminal list has changed, reload it. */
-                               $this->reload ();
-                       } else {
-
-                               /* Normally this shouldn't be reached, send some extra
-                                  logs to notify the administrator */
-                               print_red (_("You are not allowed to delete this component!"));
-                               gosa_log ("Warning: '".$this->ui->uid."' tried to trick system ".
-                                               "deletion.");
-                       }
-
-                       /* Remove lock file after successfull deletion */
-                       del_lock ($this->dn);
-               }
-
-               /* Edit Entry */
-               if($s_action == "edit"){
-                       $entry  = $this->objects[$s_entry];
-
-                       $a_setup = ($this->get_type($entry));
-               
-                       $this->dn = $entry['dn'];
-
-                       $this->dialog= new $a_setup[0]($this->config,
-                                       $this->config->data['TABS'][$a_setup[2]],$this->dn);
-                       $this->is_dialog = true;
-               }
-
-
-               /* Dialog handling */
-               if($s_action == "new_partition"){
-                       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIpartitionTable");
-               }
-
-               /* Dialog handling */
-               if($s_action == "new_script"){
-                       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIscript");
-               }
-
-               /* Dialog handling */
-               if($s_action == "new_hook"){
-                       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIhook");
-               }
-
-               /* Dialog handling */
-               if($s_action == "new_variable"){
-                       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIvariable");
-               }
-
-               /* Dialog handling */
-               if($s_action == "new_template"){
-                       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAItemplate");
-               }
-
-               /* Dialog handling */
-               if($s_action == "new_package"){
-                       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIpackageList");
-               }
-
-               /* New Profile */
-               if($s_action == "new_profile"){
-                       $this->dn = "new" ;
-                       $a_setup= $this->get_type(array("objectClass"=>array("FAIprofile")));
-
-                       $this->dialog = new $a_setup[0]($this->config,
-                                       $this->config->data['TABS'][$a_setup[2]],$this->dn);
-                       $this->is_dialog = true;
-
-               }
-
-               if($s_action == "select_class_name_finished"){
-                       $this->dialog->save_object();
-                       if(count($this->dialog->check())!=0){
-                               foreach($this->dialog->check() as $msg){
-                                       print_red($msg);
-                               }               
-                       }else{
-                               $this->dn = "new" ;
-                               $a_setup= $this->get_type(array("objectClass"=>array($this->dialog->objectClass)));
-                               $name = $this->dialog->save();
-
-                               $this->dialog = new $a_setup[0]($this->config,
-                                               $this->config->data['TABS'][$a_setup[2]],$this->dn);
-                               $this->dialog->by_object[$a_setup[1]]->cn = $name;
-                               $this->is_dialog = true;
-                       }               
-               }       
-
-
-               /* Search is set */
-               if(isset($_GET['search'])){
-                       $faifilter['regex']=$_GET['search']."*";
-               }
-
-               /* remove double asterisks and save new filter */
-               $faifilter['regex'] = preg_replace("/\*\*/","*",$faifilter['regex']);
-               $_SESSION['faifilter']= $faifilter;
-
-               /* Edit dialog was canceled 
-                * Remove dialog an show management dialog
-                */
-               if(isset($_POST['edit_cancel'])){
-                       unset($this->dialog);
-                       $this->dialog=NULL;
-                       $this->is_dialog = false;
-               }
-
-
-               /* This check if the given tab could be saved 
-                * If it was possible to save it, remove dialog object. 
-                * If it wasn't possible, show errors and keep dialog.
-                */
-               if(isset($_POST['edit_finish'])){
-                       $this->dialog->save_object();
-                       if(count($this->dialog->check())!=0){
-                               foreach($this->dialog->check() as $msg){
-                                       print_red($msg);
-                               }
-                       }else{
-                               $this->dialog->save();
-                               unset($this->dialog);
-                               $this->dialog=NULL;
-                               $this->is_dialog=false;
-                       }
-               }
-
-
-               /* If dialog is set, but $this->is_dialog==false, then 
-                *  only the "abort" button is shown, this are dialogs that must not be saved.  
-                * If is_dialog == true, we are currently editing tab objects.
-                *  Here we need both, save and cancel
-                */ 
-
-               if($this->dialog != NULL){
-                       $display .= $this->dialog->execute();
-                       /* Don't show buttons if tab dialog requests this */
-                       if (((isset($this->dialog->current))&&($this->dialog->by_object[$this->dialog->current]->is_dialog))){
-                               
-                       }elseif(((isset($this->dialog->current))&&(!$this->dialog->by_object[$this->dialog->current]->is_dialog))){
-                               $display.= "<p style=\"text-align:right\">\n";
-                               $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
-                               $display.= "&nbsp;\n";
-                               $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-                               $display.= "</p>";
-                       }elseif(!isset($this->dialog->current)){
-                               $display.= "<p style=\"text-align:right\">\n";
-                               $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
-                               $display.= "</p>";
-                       }
-                       return($display);
-               }
-
-               /* Show Management template
-                * The following code will only be reached if no dialog (tabs or dialogs)
-                *  are currently opened.
-                * Assign all reguired vars to template engine
-                */
-
-               /* Create listhead, it will be shown on top of the divlist. 
-                * It provides general navigation and object creation
-                */
-               $faihead = 
-                       "<div style='background:#F0F0F9;padding:5px;'>&nbsp;".
-
-                       " <input type='image' src='images/fai_partitionTable.png' align='middle' 
-                       title='"._("New partition table")."' name='Create_partition' alt='"._("PT")."'>&nbsp;".
-
-                       " <input type='image' src='images/fai_script.png' align='middle' 
-                       title='"._("New script bundle")."' name='Create_script' alt='"._("S")."'>&nbsp;".
-
-                       " <input type='image' src='images/fai_hook.png' align='middle' 
-                       title='"._("New hook bundle")."' name='Create_hook' alt='"._("H")."'>&nbsp;".
-
-                       " <input type='image' src='images/fai_variable.png' align='middle' 
-                       title='"._("New variable bundle")."' name='Create_variable' alt='"._("V")."'>&nbsp;".
-                       
-                       " <input type='image' src='images/fai_template.png' align='middle' 
-                       title='"._("New template bundle")."' name='Create_template' alt='"._("T")."'>&nbsp;".
-
-                       " <input type='image' src='images/fai_packages.png' align='middle' 
-                       title='"._("New package bundle")."' name='Create_package' alt='"._("PK")."'>&nbsp;".
-                       
-                       "<img src=\"images/list_seperator.png\" alt=\"\" align=\"middle\" height=\"16\" width=\"1\">&nbsp;".
-                               
-                       " <input type='image' src='images/fai_profile.png' align='middle' 
-                       title='"._("New profile bundle")."' name='Create_profile' alt='"._("P")."'>&nbsp;".
-                       
-                       "</div>";
-
-               $this->reload();
-
-               /* Create list with objects */
-               $divlist = new divlist("faiManagement"); 
-               $divlist->SetEntriesPerPage(20);
-               $divlist->SetSummary(_("This table displays all systems, in the selected tree."));
-
-               $divlist->SetHeader(array(
-                                       array("string" => "&nbsp;"),
-                                       array("string" => _("FAI objects / ObjectClasses")),
-                                       array("string" => _("Object group")),
-                                       array("string" => _("Options"), "attach" => "style='border:none'" )));
-
-
-               $action  = "<input type='image' src='images/edit.png'   alt='"._("edit")."'   name='entry_edit_%KEY%' title='"._("Edit object")."'>";
-               $action .= "<input type='image' src='images/editdelete.png' alt='"._("delete")."' name='entry_delete_%KEY%' title='"._("Delete object")."'>";
-
-               /* Attach objects */
-               foreach($this->objects as $key => $value){
-                               $info= "";
-                               $img = "";
-                               $type = $value['type'];
-                               $abort=false;
-
-                               switch($type) {
-                                       case "FAIpartitionTable"        : 
-                                               if(!$faifilter['ShowPartitions']){ 
-                                                       $abort = true;
-                                               }
-                                       $img="<img src='images/fai_partitionTable.png' title='Partition table' alt='PT'>";
-                                       $info = _("Partition table");
-                                       break;
-                                       case "FAIpackageList"           : 
-                                               if(!$faifilter['ShowPackages']){ 
-                                                       $abort = true;
-                                               }
-                                       $img="<img src='images/fai_packages.png' title='Package list' alt='PL'>";
-                                       $info = _("Package list");
-                                       break;
-                                       case "FAIscript"                        : 
-                                               if(!$faifilter['ShowScripts']){ 
-                                                       $abort = true;
-                                               }
-                                       $img="<img src='images/fai_script' title='Set of scripts' alt='S'>";
-                                       $info = _("Script set");
-                                       break;
-                                       case "FAIvariable"                      : 
-                                               if(!$faifilter['ShowVariables']){ 
-                                                       $abort = true;
-                                               }
-                                       $img="<img src='images/fai_variable.png' title='Variable set' alt='V'>";
-                                       $info = _("Variable set");
-                                       break;
-                                       case "FAIhook"                          :
-                                               if(!$faifilter['ShowHooks']){ 
-                                                       $abort = true;
-                                               }
-                                       $img="<img src='images/fai_hook.png' title='Hooks' alt='H'>";
-                                       $info = _("Hook set");
-                                       break;
-                                       case "FAIprofile"                       : 
-                                               if(!$faifilter['ShowProfiles']){ 
-                                                       $abort = true;
-                                               }
-                                       $img="<img src='images/fai_profile.png' title='Profile' alt='P'>";
-                                       $info = _("Profile")." (".$value['FAIclass']." )";
-                                       break;
-                                       case "FAItemplate"                      : 
-                                               if(!$faifilter['ShowTemplates']){ 
-                                                       $abort = true;
-                                               }
-                                       $img="<img src='images/fai_template.png' title='Template' alt='T'>";
-                                       $info = _("Template");
-                                       break;
-                                       default                                         : 
-                                       $img="<img src='images/empty.png' >";$info = "";break;
-
-                               }
-                               if(!$abort)     {
-                                       if((isset($value['description']))&&(!empty($value['description']))){
-                                               $desc= " [".$value['description']."]";
-                                       }else{
-                                               $desc= "";
-                                       }
-
-                                       $field1 = array("string" => $img , "attach" => "style='height:26px;width=20px;'");
-                                       $field2 = array("string" => $value['cn'].$desc , "attach" => "");
-                                       $field3 = array("string" => $info, "attach" => "");
-                                       $field4 = array("string" => preg_replace("/%KEY%/",$key,$action) , "attach" => "style='border-right:none;'");
-                                       $divlist->AddEntry(array($field1,$field2,$field3,$field4));
-
-                       }
-               }
-
-               foreach($faifilter as $attrs => $value){
-                       if($value){
-                               $smarty->assign($attrs."CHK", " checked ");
-                       }else{
-                               $smarty->assign($attrs."CHK", " ");
-                       }
-               }
-
-               /* Assign all reguired vars to template engine */
-               $smarty->assign("faihead"               , $faihead);    
-               $smarty->assign("failist"               , $divlist->DrawList());
-               $smarty->assign("regex"                 , $faifilter['regex']); 
-               $smarty->assign("infoimage"             , get_template_path('images/info.png'));
-               $smarty->assign("launchimage"   , get_template_path('images/launch.png'));
-               $smarty->assign("alphabet"              , generate_alphabet());
-               $smarty->assign("apply"                 , apply_filter());
-               $smarty->assign("search_image"  , get_template_path('images/search.png'));
-
-               $display        = $smarty->fetch(get_template_path('headpage.tpl', TRUE, dirname(__FILE__)));
-               return ($display);
-       }
-
-
-       function reload()
-       {
-               /* Create a new list of FAI object 
-                * Object list depends on faifilter['regex']
-                * Generate List of Partitions,Hooks,Scripts,Templates,Profiles ... 
-                */
-               $faifilter= get_global('faifilter');
-               // Added for dirlist function...
-
-               /* Set base for all searches */
-               $base= $faifilter['base'];
-               $regex = $faifilter['regex'];   
-
-               /* Array to save objects */
-               $objects = array();
-       
-               $this->objects=array();
-
-               $res= get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)", 
-                               FALSE, $base, array("cn","description","objectClass"),TRUE);
-
-               foreach($res as $objecttypes){
-                       $res2 = get_list($this->ui->subtreeACL, "(&(objectClass=*)(cn=".$regex."))",
-                                       FALSE, $objecttypes['dn'], array("cn","description","objectClass","FAIclass"),TRUE);
-                       foreach($res2 as $object){
-                               $type= "";      
-                               unset($object['objectClass']['count']);
-                               if(!isset($object['description'][0])){
-                                       $object['description'][0]="";
-                               }
-                               
-                               /* Clean up object informations */
-                               $obj['cn']                      = $object['cn'][0];
-                               $obj['dn']                      = $object['dn'];
-                               $obj['description'] = $object['description'][0];
-                               $obj['objectClass'] = $object['objectClass'];
-
-                               if(in_array("FAIpartitionTable",$obj['objectClass'])){
-                                       $type = "FAIpartitionTable";
-                               }elseif(in_array("FAIpackageList",$obj['objectClass'])){
-                                       $type = "FAIpackageList";
-                               }elseif(in_array("FAIscript",$obj['objectClass'])){
-                                       $type = "FAIscript";
-                               }elseif(in_array("FAIvariable",$obj['objectClass'])){
-                                       $type = "FAIvariable";
-                               }elseif(in_array("FAIhook",$obj['objectClass'])){
-                                       $type = "FAIhook";
-                               }elseif(in_array("FAIprofile",$obj['objectClass'])){
-                                       $obj['FAIclass']        = $object['FAIclass'][0];
-                                       $type = "FAIprofile";
-                               }elseif(in_array("FAItemplate",$obj['objectClass'])){
-                                       $type = "FAItemplate";
-                               }
-                               $this->objects[strtolower($obj['cn']).$obj['cn'].$type] = $obj;
-                               $this->objects[strtolower($obj['cn']).$obj['cn'].$type]['type']=$type;
-                       }
-               }
-               ksort($this->objects);
-               reset ($this->objects);
-       }
-
-       function remove_lock()
-       {
-               if (isset($this->dn)){
-                       del_lock ($this->dn);
-               }
-       }
-
-       function get_type($array){
-               if(in_array("FAIpartitionTable",$array['objectClass'])){
-                       return(array("tabsPartition","faiPartitionTable","FAIPARTITIONTABS"));
-               }
-               if(in_array("FAIscript",$array['objectClass'])){
-                       return(array("tabsScript","faiScript","FAISCRIPTTABS"));
-               }
-               if(in_array("FAItemplate",$array['objectClass'])){
-                       return(array("tabsTemplate","faiTemplate","FAITEMPLATETABS"));
-               }
-               if(in_array("FAIhook",$array['objectClass'])){
-                       return(array("tabsHook","faiHook","FAIHOOKTABS"));
-               }
-               if(in_array("FAIvariable",$array['objectClass'])){
-                       return(array("tabsVariable","faiVariable","FAIVARIABLETABS"));
-               }
-               if(in_array("FAIprofile",$array['objectClass'])){
-                       return(array("tabsProfile","faiProfile","FAIPROFILETABS"));
-               }
-               
-               if(in_array("FAIpackageList",$array['objectClass'])){
-                       return(array("tabsPackage","faiPackage","FAIPACKAGETABS"));
-               }
-       }
-
-}
-
-?>
diff --git a/plugins/admin/FAI/class_faiPackage.inc b/plugins/admin/FAI/class_faiPackage.inc
deleted file mode 100644 (file)
index 78c9a18..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-<?php
-
-class faiPackage extends plugin
-{
-  /* CLI vars */
-  var $cli_summary      = "Manage server basic objects";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account   = TRUE;
-
-  /* Attributes for this Object */
-  var $attributes       = array("cn","description","FAIpackage");
-
-  /* ObjectClasses for this Object*/
-  var $objectclasses    = array("top","FAIclass","FAIpackageList");
-
-  /* Class name of the Ldap ObjectClass for the Sub Object */
-  var $subClass         = "";
-  var $subClasses       = array("top","FAIclass","FAIscriptEntry");
-
-  /* Class name of the php class which allows us to edit a Sub Object */
-  var $subClassName     = "";      
-
-  /* Attributes to initialise for each subObject */
-  var $subAttributes    = array("cn","description"); 
-  var $sub64coded       = array();
-
-  /* Specific attributes */
-  var $cn               = "";       // The class name for this object
-  var $description      = "";       // The description for this set of partitions
-  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
-  var $dialog           = NULL;     // a dialog, e.g. new disk dialog
-  var $SubObjects       = array();  // All leafobjects of this object
-
-  function faiPackage ($config, $dn= NULL)
-  {
-    /* Load Attributes */
-    plugin::plugin ($config, $dn);
-
-    /* If "dn==new" we try to create a new entry
-     * Else we must read all objects from ldap which belong to this entry.
-     * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
-     */
-    if($dn != "new"){
-      $this->dn =$dn;
-    }
-
-    $this->FAIpackage = "test";
-  }
-
-  function execute()
-  {
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    /* Assign variables */
-    foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,$this->$attrs);
-    }
-
-    $display.= $smarty->fetch(get_template_path('faiPackage.tpl', TRUE));
-    return($display);
-  }
-
-  /* Generate listbox friendly SubObject list
-  */
-  function getList(){
-    $a_return=array();
-    foreach($this->SubObjects as $obj){
-      if($obj['status'] != "delete"){
-        $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]";
-      }
-    }
-    return($a_return);
-  }
-
-  /* Delete me, and all my subtrees
-   */
-  function remove_from_parent()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-    $ldap->rmdir_recursive($this->dn);
-    $this->handle_post_events("remove");    
-  }
-
-
-  /* Save data to object 
-   */
-  function save_object()
-  {
-    plugin::save_object();
-    foreach($this->attributes as $attrs){
-      if(isset($_POST[$attrs])){
-        $this->$attrs = $_POST[$attrs];
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    $message= array();
-    $str = utf8_encode("üöä");
-    if((empty($this->description))){
-      $message[]=_("Please enter a valid description.");
-    } 
-    if((preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description))){
-      $message[]=_("Please enter a valid description.");
-    }
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-    $ldap = $this->config->get_ldap_link();
-  
-    $ldap->cat($this->dn);
-    if($ldap->count()!=0){
-      /* Write FAIscript to ldap*/
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      /* Write FAIscript to ldap*/
-      $ldap->cd($this->dn);
-      $ldap->create_missing_trees($this->dn);
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-    }
-    show_ldap_error($ldap->get_error());
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/FAI/class_faiPartitionTable.inc b/plugins/admin/FAI/class_faiPartitionTable.inc
deleted file mode 100644 (file)
index db65fed..0000000
+++ /dev/null
@@ -1,380 +0,0 @@
-<?php
-
-class faiPartitionTable extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage server basic objects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account   = TRUE;
-  var $attributes       = array("cn","description");
-  var $objectclasses    = array("top","FAIclass","FAIpartitionTable");
-  var $base64_encode    = array("FAImountPoint","FAImountOptions","FAIfsOptions","description");
-
-  /* Specific attributes */
-  var $cn               = "";       // The class name for this object
-  var $description      = "";       // The description for this set of partitions
-  var $disks            = array();  // All defined Disks 
-  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
-  var $dialog           = NULL;     // a dialog, e.g. new disk dialog
-
-  function faiPartitionTable ($config, $dn= NULL)
-  {
-    /* Load Attributes */
-    plugin::plugin ($config, $dn);
-
-    /* If "dn==new" we try to create a new entry
-     * Else we must read all objects from ldap which belong to this entry.
-     * First read disks from ldap ... and then the partition definitions for the disks.
-     */
-    if($dn != "new"){
-      $this->dn =$dn;
-
-      /* Read all disks from ldap taht are defined fot this partition table 
-       */
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd ($this->dn);
-      $ldap->search("(&(objectClass=FAIclass)(objectClass=FAIpartitionDisk))",array("*"));
-      while($object = $ldap->fetch()){
-        $this->disks[$object['cn'][0]]['status']      = "edited";
-        $this->disks[$object['cn'][0]]['dn']          = $object['dn'];
-        $this->disks[$object['cn'][0]]['cn']          = $object['cn'][0];
-        if(isset($object['description'][0])){
-          $this->disks[$object['cn'][0]]['description'] = $object['description'][0];
-        }else{
-          $this->disks[$object['cn'][0]]['description'] = "";
-        }
-        $this->disks[$object['cn'][0]]['partitions']   = array();
-      }
-  
-      /* read all partitions for each disk 
-       */
-      foreach($this->disks as $name => $disk){
-        $ldap->cd ($disk['dn']);
-        $ldap->search("(&(objectClass=FAIclass)(objectClass=FAIpartitionEntry))",array("*"));
-        while($partition = $ldap->fetch()){
-
-          /* remove count ... from ldap result 
-           */
-          foreach($partition as $key=>$val){
-            if((is_numeric($key))||($key=="count")||($key=="dn")){
-              unset($partition[$key]);
-            }else{
-              $partition[$key] = $val[0];
-            }
-          }
-          /* Append fetched partitions
-           */
-          $partition['status']="edited";
-    
-          foreach($this->base64_encode as $attrs){
-            $partition[$attrs] = base64_decode($partition[$attrs]);
-          }
-          $this->disks[$name]['partitions'][$partition['FAIpartitionNr']] = $partition; 
-        }  
-      }
-    }
-  }
-
-  function execute()
-  {
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-    /* Add Disk to this Partitionset
-     * This code adds a new HDD to the disks 
-     * A new Dialog will be opened 
-     */
-    if(isset($_POST['AddDisk'])){
-      $usedDiskNames =array();
-      foreach($this->disks as $key=>$disk){
-        $usedDiskNames[]= $key;
-      }
-      $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames); 
-      $this->is_dialog = true;
-    }
-
-    /* Edit disk.
-     * Open dialog which allows us to edit the selected entry 
-     */    
-    if((isset($_POST['EditDisk']))&&(isset($_POST['disks']))){
-      $usedDiskNames =array();
-      foreach($this->disks  as $key=>$disk){
-        if($key != $_POST['disks']){
-          $usedDiskNames[]= $key;
-        }
-      }
-      $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames,$this->disks[$_POST['disks']]); 
-      $this->is_dialog = true;
-    }
-
-    /* Edit aborted, close dialog, without saving anything
-     */
-    if(isset($_POST['CancelDisk'])){
-      unset($this->dialog);
-      $this->dialog = NULL;
-      $this->is_dialog=false;
-    }
-  
-    /* Dialog saved
-     * Save given data from Dialog, if no error is occured
-     */
-    if(isset($_POST['SaveDisk'])){
-      $this->dialog->save_object();
-      if(count($this->dialog->check())){
-        foreach($this->dialog->check() as $msg){
-          print_red($msg);
-        }
-      }else{
-        $disk = $this->dialog->save();
-        if(isset($disk['rename'])){
-          if($this->disks[$disk['rename']['from']]['status']=="edited"){
-            $this->disks[$disk['rename']['from']]['status']="delete";
-          }else{
-            unset($this->disks[$disk['rename']['from']]);
-          }
-  
-          foreach($disk['partitions'] as $key => $val){
-            if($disk['partitions'][$key]['status']!="delete"){
-              $disk['partitions'][$key]['status']= "new";
-            }
-          }
-
-          $disk['status']="new";
-          $disk['cn']= $disk['rename']['to'];
-        }
-      
-        $this->disks[$disk['cn']]=$disk; 
-        unset($this->dialog);
-        $this->dialog = NULL;
-        $this->is_dialog=false;
-      }
-    }
-
-    /* Delete selected disk drive from list
-     * Assign delete status for all its partitions      
-     */
-    if((isset($_POST['DelDisk']))&&(!empty($_POST['disks']))){
-      $disk = $_POST['disks'];
-      if($this->disks[$disk]['status']=="edited"){
-        $this->disks[$disk."-delete"]=$this->disks[$disk];
-        unset($this->disks[$disk]);
-        $disk = $disk."-delete";        
-        $this->disks[$disk]['status']="delete";
-        foreach($this->disks[$disk]['partitions'] as $name => $value ){
-          if($value['status']=="edited"){
-            $this->disks[$disk]['partitions'][$name]['status']="delete"; 
-          }else{
-            unset($this->disks[$disk]['partitions'][$name]);
-          }
-        }
-      }else{
-        unset($this->disks[$disk]);
-      }
-    }
-
-    /* Display dialog if one is defined
-     */
-    if(isset($this->dialog)){
-      $this->dialog->save_object();
-      return($this->dialog->execute());
-    }
-
-    /* Assign all attributes to smarty engine
-     */
-    foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,$this->$attrs);
-      if($this->$attrs){
-        $smarty->assign($attrs."CHK"," ");
-      }else{
-        $smarty->assign($attrs."CHK"," disabled ");
-      }
-    }
-    
-    $disks = $this->getDisks();
-    $smarty->assign("disks"   ,$disks);
-    $smarty->assign("diskKeys",array_flip($disks));
-    $display.= $smarty->fetch(get_template_path('faiPartitionTable.tpl', TRUE));
-    return($display);
-  }
-
-  function getDisks(){
-    /* Return all available disks for this partition table
-     * Return in listBox friendly array
-     */
-    $a_return = array();
-    foreach($this->disks as $key => $disk){
-      if($disk['status'] != "delete"){
-        $cnt=0;
-        foreach($disk['partitions'] as $val){
-          if($val['status']!="delete"){
-            $cnt ++;
-          }
-        }
-        if(!empty($disk['description'])){
-          $a_return[$key]=  $disk['cn']." [".$disk['description']."] - "._("Number of Partitions")." :".$cnt;
-        }else{
-          $a_return[$key]=  $disk['cn']." - "._("Number of Partitions")." :".$cnt;
-        }
-      }
-    }
-    return($a_return);
-  }
-
-
-  /* Delete me, and all my subtrees
-   */
-  function remove_from_parent()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-    $ldap->rmdir_recursive($this->dn);
-    $this->handle_post_events("remove");    
-  
-    /* This cannot be removed... */
-  }
-
-
-  /* Save data to object 
-   */
-  function save_object()
-  {
-    plugin::save_object();
-    foreach($this->attributes as $attrs){
-      if(isset($_POST[$attrs])){
-        $this->$attrs = $_POST[$attrs];
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-
-    $message= array();
-
-    $str = utf8_encode("üöä");
-    if((empty($this->description))||(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description))){
-      $message[]=_("Please enter a valid description.");
-    }
-
-    if((empty($this->cn))||(preg_match("/[^a-z0-9]/i",$this->cn))){
-      $message[]=_("Please enter a valid name.");
-    }
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-
-    plugin::save();
-    /* Save current settings.
-     * 1 : We must save the partition table, with its description and cn 
-     * 2 : Append Disk with cn and  description.
-     * 3 : Save partitions for each disk
-     */  
-
-    $ldap = $this->config->get_ldap_link();
-
-    if($this->new){
-      $ldap->cd($this->dn);
-      $ldap->create_missing_trees($this->dn);
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-      show_ldap_error($ldap->get_error());
-    }else{
-      /* Add partition table to ldap
-       */
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-      show_ldap_error($ldap->get_error());
-    }
-  
-  
-    /* Sort entries, because we must delete entries with status="delete" first */
-    $order = array();
-    foreach($this->disks as $key => $disk){
-      if($disk['status'] == "delete"){
-        $order[$key] = $disk;
-      }
-    }
-    foreach($this->disks as $key => $disk){
-      if($disk['status'] != "delete"){
-        $order[$key] = $disk;
-      }
-    }
-
-    /* Append all disks to ldap */
-    foreach($order as $cn=>$disk){
-      $disk_dn                    = "cn=".$disk['cn'].",".$this->dn;
-      $disk_attrs['cn']           =  $disk['cn'];
-      $disk_attrs['description']  =  $disk['description']; 
-      $disk_attrs['objectClass']  =  array("top","FAIclass","FAIpartitionDisk");
-  
-      if($disk['status'] == "delete"){
-        $ldap->cd($disk_dn);
-        $ldap->rmdir_recursive($disk_dn);
-      }elseif($disk['status']== "edited"){
-        $ldap->cd($disk_dn);
-        $ldap->modify($disk_attrs);
-      }elseif($disk['status']== "new"){
-        $ldap->cd($disk_dn);
-        $ldap->create_missing_trees($disk_dn);
-        $ldap->cd($disk_dn);
-        $ldap->add($disk_attrs);
-      }else{
-        print_red("unknown status while saving disks");
-      }
-
-      show_ldap_error($ldap->get_error());
-      if($disk['status']!="delete")
-      /* Add all partitions */
-      foreach($disk['partitions'] as $key => $partition){
-        $partition_attrs = array();
-
-        foreach($this->base64_encode as $attrs){
-          $partition[$attrs] = base64_encode($partition[$attrs]);          
-        }
-
-        foreach($partition as $key => $value){
-          if(!empty($value)){
-            $partition_attrs[$key]=$value;        
-          }else{
-            unset($partition_attrs[$key]);        
-          }
-        }
-
-        $partition_dn                       = "cn=".$partition_attrs['cn'].",".$disk_dn;      
-        $partition_attrs['objectClass']     = array("top","FAIclass","FAIpartitionEntry");
-        
-        unset($partition_attrs['status']);
-        unset($partition_attrs['old_cn']);
-      
-        if(($partition['status'] == "delete")&&($disk['status']!="new")){
-          $ldap->cd($partition_dn);
-          $ldap->rmdir_recursive($partition_dn);
-        }elseif($partition['status'] == "new"){
-          $ldap->cd($partition_dn);
-          $ldap->create_missing_trees($partition_dn);
-          $ldap->cd($partition_dn);
-          $ldap->add($partition_attrs);
-        }elseif($partition['status'] == "edited"){
-          $ldap->cd($partition_dn);
-          $ldap->modify($partition_attrs);
-        } 
-      show_ldap_error($ldap->get_error());
-      }
-    }
-    $this->handle_post_events("add");
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/FAI/class_faiPartitionTableEntry.inc b/plugins/admin/FAI/class_faiPartitionTableEntry.inc
deleted file mode 100644 (file)
index 878ffaf..0000000
+++ /dev/null
@@ -1,450 +0,0 @@
-<?php
-
-class faiPartitionTableEntry extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage server basic objects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account= TRUE;
-  var $attributes   = array("DISK_cn","DISK_description");
-  var $objectclasses= array();
-
-  var $DISK_cn              = "";
-  var $DISK_description     = "";
-  
-  var $partitions           = array();
-  var $UsedAttrs            = array();
-  var $AvailableDiskNames   = array();
-  var $is_edit              = false;
-  var $old_cn               = "";
-  var $status               = "new";
-  var $deletePartitions     = array();
-
-  function faiPartitionTableEntry ($config, $dn= NULL,$usedDiskNames=array(),$disk=false)
-  {
-    plugin::plugin ($config, $dn);
-    $this->UsedAttrs  = array("cn","description","FAIpartitionType","FAIpartitionNr","FAIfsType","FAImountPoint","FAIpartitionSize",
-                         "FAImountOptions","FAIfsOptions","FAIpartitionFlags");
-
-    /* Generate available disknames, to avoid duplicates in cn */
-    $this->AvailableDiskNames = array();
-    foreach(array("a","b","c","d","e","f","g","h") as $ts){
-      if(!in_array("hd".$ts,$usedDiskNames)){
-        $this->AvailableDiskNames["hd".$ts]= "hd".$ts;
-      }
-    }
-    
-    $this->AvailableDiskNames['disk1']= "disk1";
-    $this->AvailableDiskNames['disk2']= "disk2";
-    /* Default status is new */
-    $this->status = "new";    
-    /* We want to edit an entry */
-    if($disk){
-
-      /* Set disk status */      
-      $this->status = $disk['status'];
-
-      /* Walk through partitions */
-      foreach($disk['partitions'] as $name => $values){
-
-        /* If a partition is already marked as delete, attach it to deletePartitions only. */
-        if($values['status'] == "delete"){
-          unset($disk['partitions'][$name]);
-          $this->deletePartitions[]=$values;
-        }else{
-
-          /* Set status, to know which partition must be deleted from ldap
-             new    : Neu partition entry // save
-             edited : Update partition entry in ldap
-             deleted: Remove partition from ldap
-           */
-    
-          /* If status is not new, set to edit mode. 
-           * New means that this partition currently wasn't saved to ldap.
-           */
-          if($disk['partitions'][$name]['status']!="new"){
-            $disk['partitions'][$name]['status']="edited";
-          }
-     
-          $disk['partitions'][$name]['old_cn']= $disk['partitions'][$name]['cn'];
-          /* Assign empty attributes, if attribute is missing */
-          foreach($this->UsedAttrs as $attr){
-            if(!isset($values[$attr])){
-              $disk['partitions'][$name][$attr]="";  
-            }
-          }
-        }
-      }
-
-      /* Set default attributes */
-      $this->DISK_cn          = $disk['cn'];
-      $this->DISK_description = $disk['description'];
-      $this->partitions       = $disk['partitions'];
-      $this->is_edit          = true;
-      $this->old_cn           = $disk['cn'];
-    }
-  }
-
-  function execute()
-  {
-    /* Fill templating stuff */
-    $smarty     = get_smarty();
-    $s_action   = "";
-    $s_entry    = "";
-    $display    = "";
-    
-    /* Assign values 
-     * And Checkbox selection
-     */
-    foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,$this->$attrs);
-      if($this->$attrs){
-        $smarty->assign($attrs."CHK"," ");
-      }else{
-        $smarty->assign($attrs."CHK"," disabled ");
-      }
-    }
-
-    /* Check all Posts if there is something usefull for us,
-     * For example : Delete is posted as Delete_1 
-     * The number specifies the index we want to delete
-     */
-    foreach($_POST as $name => $value){
-      if(preg_match("/Delete_.*/",$name)){
-        $tmp = split("_",$name);
-        $s_action = "remove";
-        $s_entry  = $tmp[1]; 
-      }
-    }
-
-    /* To remove a partition we unset the index posted.
-     * We must sort the index again, else we possibly got problems 
-     * with partitions order.
-     */
-    if($s_action == "remove"){
-      if($this->partitions[$s_entry]['status'] == "edited"){
-        $this->deletePartitions[]= $this->partitions[$s_entry];
-        unset($this->partitions[$s_entry]);
-      }else{
-        unset($this->partitions[$s_entry]);
-      }
-      $tmp= array();
-      foreach($this->partitions as $part){
-        $tmp[count($tmp)+1]=$part;
-      }
-      $this->partitions = $tmp;
-    }
-
-
-    /* To add a partitions we only append an empty 
-     *  array to the already defined partitions.
-     */
-    if(isset($_POST['AddPartition'])){
-      foreach($this->UsedAttrs as $attr){
-        $tmp[$attr]                = "";     
-      }
-      $tmp["old_cn"]               = "";     
-      $tmp['status']="new";
-      $this->partitions[count($this->partitions)+1]=$tmp;
-    }
-
-    /* Tell smarty which Disknames are available.
-     */
-    $smarty->assign("cns", $this->AvailableDiskNames); 
-    
-    /* $setup contains a table with the partitions. 
-     */
-    $smarty->assign("setup", $this->generateParts());
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr,$this->$attr);
-    }
-
-    /* The user can't change a diskname 
-     *  if we are currently in edit mode for the specified disk 
-     */
-//    if($this->is_edit){
-//      $smarty->assign("DISK_cnACL"," disabled ");
-//    }else{
-      $smarty->assign("DISK_cnACL","");
-//    }
-
-    /* Fetch template and show the result
-     */
-    $display.= $smarty->fetch(get_template_path('faiPartitionTableEntry.tpl', TRUE));
-    return($display);
-  }
-
-  function generateParts()
-  {
-    /* Define Arrays with allowed syntax */
-    $PartitionTypes   = array("primary","logical");
-    $FAIfsTypes       = array("ext2","ext3","xfs","swap","reiserfs","dos fat 16","win fat 32");
-
-    /* Display Header */
-    $str = "<table>";
-    $str .= "<tr>";
-    $str .= "<td>"._("Nr")."</td>";
-    $str .= "<td>"._("Name")."</td>";
-    $str .= "<td>"._("Description")."</td>";
-    $str .= "<td>"._("Type")."</td>";
-    $str .= "<td>"._("FS type")."</td>";
-    $str .= "<td>"._("Mount point")."</td>";
-    $str .= "<td>"._("Size in MB")."</td>";
-    $str .= "<td>"._("Mount options")."</td>";
-    $str .= "<td>"._("FS option")."</td>";
-    $str .= "<td>"._("Preserve")."</td>";
-    $str .= "<td></td>";
-    $str .= "</tr>";
-
-    /* Walk through all defined partitions.
-     * Create a new row for each partition and append it to 
-     *  the header defined above.
-     * To be able to check the posts later, we append a key to each single postfield. like cn_1 ... cn_2
-     */
-    foreach($this->partitions as $key => $part){
-      if($part['status']!="delete"){
-        /* Generate Partition select box  
-         */
-        $PartitionType = "<select name='FAIpartitionType_".$key."'>";
-        foreach($PartitionTypes as $type){
-          if($part['FAIpartitionType'] == $type){
-            $PartitionType .="<option value='".$type."' selected >".$type."</option>";
-          }else{
-            $PartitionType .="<option value='".$type."'>".$type."</option>";
-          }
-        }        
-        $PartitionType.="</select>";   
-
-
-        /* Generate fsType select box  
-         */
-        $FAIfsType= "<select name='FAIfsType_".$key."'>";
-        foreach($FAIfsTypes as $type){
-          if($part['FAIfsType'] == $type){
-            $FAIfsType  .="<option value='".$type."' selected >".$type."</option>";
-          }else{
-            $FAIfsType .="<option value='".$type."'>".$type."</option>";
-          }
-        }        
-        $FAIfsType.="</select>";   
-
-        $str .= "<tr>";
-        $str .= "<td>".($key)."</td>";
-        $str .= "<td><input name='cn_".$key."'                value='".$part['cn']."'               maxlength='8' style='width:80px;'></td>";
-        $str .= "<td><input name='description_".$key."'       value='".$part['description']."'      maxlength='8' style='width:80px;'></td>";
-        $str .= "<td>".$PartitionType."</td>";
-        $str .= "<td>".$FAIfsType."</td>";
-        $str .= "<td><input name='FAImountPoint_".$key."'     value='".$part['FAImountPoint']."'    ></td>";
-        $str .= "<td><input name='FAIpartitionSize_".$key."'  value='".$part['FAIpartitionSize']."' style='width:200px;'></td>";
-        $str .= "<td><input name='FAImountOptions_".$key."'   value='".$part['FAImountOptions']."'  style='width:100px;'></td>";
-        $str .= "<td><input name='FAIfsOptions_".$key."'      value='".$part['FAIfsOptions']."'     style='width:100px;'></td>";
-        if($part['FAIpartitionFlags']!=false){
-          $str .= "<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve' checked></td>";
-        }else{
-          $str .= "<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve'></td>";
-        }
-        $str .= "<td><input type='submit' name='Delete_".$key."' value='"._("Remove")."'></td>";
-        $str .= "</tr>";    
-      }
-    }
-    $str.="</table>";
-    return($str);
-
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    if(isset($_POST['TableEntryFrameSubmitted'])){
-      plugin::save_object();
-
-      /* Check base attributes */
-      foreach($this->attributes as $attrs){
-        if(isset($_POST[$attrs])){
-          $this->$attrs = $_POST[$attrs];
-        }
-      }
-     
-      foreach($this->partitions as $key => $part){
-        foreach($this->UsedAttrs as $attrs){
-          if(isset($_POST[$attrs."_".$key])){
-            $this->partitions[$key][$attrs] = $_POST[$attrs."_".$key];
-          }else{
-            $this->partitions[$key][$attrs] = false;
-          }
-        }
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    $message= array();
-   
-    /* Check descriptions 
-     */ 
-    if(empty($this->DISK_description)){
-      $message[] = _("Please enter a description for your disk.");
-    }
-
-    $str = utf8_encode("üöä");
-    if(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->DISK_description)){
-      $message[]=_("Please enter a valid description.");
-    }
-    
-    /* check every partition.
-     * if there is an invalid value defined, append an errorstr to message
-     */
-
-    /* Array that contain every partitionname mountpoint etc already assigned */
-    $alreadyUsed    = array();
-    foreach($this->UsedAttrs as $attrs){
-      $alreadyUsed[$attrs] = array();
-    }      
-
-    foreach($this->partitions as $key => $part){
-    
-      if((empty($part['cn']))||(preg_match("/[^0-9a-z]/",$part['cn']))){
-        $message[]=sprintf(_("Please enter a valid name for partition %s."),($key));
-      }
-
-      if(in_array($part['cn'],$alreadyUsed['cn'])){
-        $message[]=sprintf(_("please enter a unique name for partition %s"),($key));
-      }
-    
-      if(in_array($part['FAImountPoint'],$alreadyUsed['FAImountPoint'])){
-        $message[]=sprintf(_("please enter a unique mount point for partition %s"),($key));
-      }
-
-      if(empty($part['description'])){
-        $message[]=sprintf(_("Please enter a valid description for partition %s." ),($key));
-      }
-
-      if((empty($part['FAImountPoint']))||(!((preg_match("/^\/.*/",$part['FAImountPoint']))||(preg_match("/^swap$/",$part['FAImountPoint']))))){
-        $message[]=sprintf(_("Please enter a valid mount point for partition %s." ),($key));
-      }
-
-      if($part['FAIfsType'] == "swap"){
-        if(in_array($part['FAIfsType'],$alreadyUsed['FAIfsType'])){
-          $message[]=sprintf(_("File system type 'swap' is already used, change file system type for partition %s."),$key);
-        }
-      }
-
-      $tmp = split("-",$part['FAIpartitionSize']);
-      if(count($tmp)!=2){
-        $message[]=sprintf(_("Please enter a range for partition size, 'from-to', for partition %s."),($key));
-      }elseif((!is_numeric($tmp[0]))||(!is_numeric($tmp[1]))){
-        $message[]=sprintf(_("Please enter a valid range for partition %s."),($key)); 
-      }elseif($tmp[0]>=$tmp[1]){
-        $message[]=sprintf(_("Please enter a valid range for partition %s."),($key));
-      }elseif($this->checkSize($part['FAIpartitionSize'],$alreadyUsed['FAIpartitionSize'],$key)){
-        $message[]=$this->checkSize($part['FAIpartitionSize'],$alreadyUsed['FAIpartitionSize'],$key);
-      }
-      foreach($this->UsedAttrs as $attrs){
-        $alreadyUsed[$attrs][$key] = $part[$attrs];
-      }      
-    }
-
-
-    /* Only show 5 errors */
-    $cnt = 0;
-    if(count($message)>5){
-      foreach($message as $msg){
-        if($cnt < 5){
-          $tmp2[]=$msg;
-        }
-        $cnt ++;
-      }
-    $tmp2[] = "...";
-    $message = $tmp2;
-    }
-
-    return ($message);
-  }
-
-  /* This function checks the selected partition sizes 
-   * If a size setting overlap with another, it returns an error msg
-   */ 
-  function checkSize($current,$others,$ckey){
-    $tmp = split("-",$current);
-    $from = $tmp[0];
-    $to   = $tmp[1];
-    foreach($others as $key=> $other){
-      $tmp  = split("-",$other);
-      $oth_from = $tmp[0];
-      $oth_to   = $tmp[1];
-      /* surrounds another entry */
-      if( (($from <= $oth_from)&&($to >= $oth_to))||    // inside
-          (($from >= $oth_from)&&($to <= $oth_to))||    // outside
-          (($to >= $oth_from)&&($to <= $oth_to))  ||    // overlap at right
-          (($from >= $oth_from)&&($from <= $oth_to)) ){ // overlap left
-        $message =sprintf( _("Size settings for partition %s, overlap with size settings for partition %s."),$ckey,$key);
-        return($message);
-      }
-    }
-    return(false);
-  }
-  
-  function save()
-  {
-    /* This function returns the new or edited disk with its partitions.
-     * If the disk was edited and not a new one, we reset the name of the disk
-     *  to keep the correct index.
-     */
-
-    /* Check partition rename
-    */
-    foreach($this->partitions as $key => $part){
-      if($part['cn'] != $part['old_cn']){
-        if($part['status'] == "edited"){
-
-          $tmp          = $part;
-          $tmp['status']= "delete";
-          $tmp['cn']    = $part['old_cn'];
-
-          $this->deletePartitions[] = $tmp;
-        }
-        $this->partitions[$key]['old_cn']=$part['cn'];
-        $this->partitions[$key]['status']="new";
-      }
-    }
-
-    $tmp = array();
-    $tmp['cn']          = $this->DISK_cn;
-    /* Attach partitions */ 
-    foreach($this->partitions as $key=>$val) {
-      $this->partitions[$key]['FAIpartitionNr']=$key;
-    }
-
-    /* Attach deleted */ 
-    foreach($this->deletePartitions as $key=>$val) {
-      $this->partitions[$key."-delete"]=$val;
-      $this->partitions[$key."-delete"]['status']="delete";
-    } 
-    $tmp['description'] = $this->DISK_description;
-    $tmp['partitions']  = $this->partitions;
-    $tmp['status']      = $this->status;
-
-    /* If hdd name has changed, tell partitionTable to rename it */
-    if(($this->is_edit)&&($this->old_cn != $this->DISK_cn)){
-      $tmp['rename']['from']  = $this->old_cn;    
-      $tmp['rename']['to']    = $this->DISK_cn;    
-    }
-
-    return($tmp);
-  }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/FAI/class_faiProfile.inc b/plugins/admin/FAI/class_faiProfile.inc
deleted file mode 100644 (file)
index 517b852..0000000
+++ /dev/null
@@ -1,267 +0,0 @@
-<?php
-
-class faiProfile extends plugin
-{
-  /* CLI vars */
-  var $cli_summary      = "Manage server basic objects";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account   = TRUE;
-
-  /* Attributes for this Object */
-  var $attributes       = array("cn","description","FAIclass");
-
-  /* ObjectClasses for this Object*/
-  var $objectclasses    = array("top","FAIclass","FAIprofile");
-
-  /* Class name of the Ldap ObjectClass for the Sub Object */
-  var $subClass         = "FAIscriptEntry";
-  var $subClasses       = array("top","FAIclass","FAIscriptEntry");
-
-  /* Specific attributes */
-  var $old_cn           = "";
-  var $cn               = "";       // The class name for this object
-  var $description      = "";       // The description for this set of partitions
-  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
-  var $dialog           = NULL;     // a dialog, e.g. new disk dialog
-  var $FAIclass         = "";       // Classnames used for this profile
-  var $FAIclasses       = array();  // Contains classname seperated in an array
-  var $FAIAllclasses    = array();  // Contains all possible Classnames
-
-  function faiProfile($config, $dn= NULL)
-  {
-    /* Load Attributes */
-    plugin::plugin ($config, $dn);
-    $ldap=$this->config->get_ldap_link();
-
-    $tmp = split(" ",$this->FAIclass);
-    
-    foreach($tmp as $class){
-      if(!empty($class)){
-        $this->FAIclasses[trim($class)] = trim($class);
-      }
-    }
-    natcasesort($this->FAIclasses);
-    reset($this->FAIclasses) ;
-    $categories = array("FAIscript","FAItemplate","FAIhook","FAIvariable","FAIpartitionTAble","FAIpackage");
-  
-    $sort = array();
-    
-    $base = $_SESSION['faifilter']['base'];
-    $ldap->cd($base);
-    $ldap->search("(objectClass=*)",array("*"));
-    while($attrs = $ldap->fetch()){
-      foreach($categories as $cat){
-        if(in_array($cat,$attrs['objectClass'])){
-          $this->FAIAllclasses[$attrs['cn'][0]][$cat]=$attrs;
-          $sort[strtolower($attrs['cn'][0])] = $attrs['cn'][0];
-        }
-      }
-    } 
-    ksort($sort);
-    foreach($sort as $name){
-      $tmp[$name] =$this->FAIAllclasses[$name];
-    }
-    $this->FAIAllclasses = array();
-    $this->FAIAllclasses = $tmp;
-
-    if($dn != "new"){
-      $this->dn =$dn;
-    }
-    $this->old_cn   = $this->cn;
-  }
-
-  function execute()
-  {
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    $s_entry = "";
-    $s_action = "";
-
-    /* Remove class name From list */
-    foreach($_POST as $name => $post){
-      if(preg_match("/DEL_/i",$name)){
-        $s_action = "delete";
-        $s_entry  = preg_replace("/DEL_/","",$name);
-        $s_entry  = preg_replace("/_.*$/","",$s_entry);
-      }elseif(preg_match("/Add_class/i",$name)){
-        $s_action  = "add";
-      }
-    }
-
-    if($s_action == "delete"){
-      unset($this->FAIclasses[$s_entry]);
-    }
-
-    if($s_action == "add"){
-      $this->dialog = new faiProfileEntry($this->config,$this->dn,$this->FAIclasses);
-      $this->is_dialog  =true;
-    }
-  
-    /* Save Dialog */
-    if(isset($_POST['SaveSubObject'])){
-      $this->dialog->save_object();
-      $msgs= $this->dialog->check();
-      if(count($msgs)){
-        print_red($msgs);
-      }else{
-        $ret = $this->dialog->save();
-        foreach($ret as $class){
-          $this->FAIclasses[$class] =$class; 
-        }
-        $this->is_dialog=false;
-        unset($this->dialog);
-        $this->dialog=NULL;
-      }
-    }
-
-    /* Cancel Dialog */
-    if(isset($_POST['CancelSubObject'])){
-      $this->is_dialog=false;
-      unset($this->dialog);
-      $this->dialog=NULL;
-    }
-    
-    if(isset($this->dialog)){
-      $this->dialog->save_object();
-      return($this->dialog->execute());
-    }
-
-    $divlist  =new divlist("Profile");
-    $divlist->SetSummary(_("This list displays all assigned class names for this profile."));
-    $divlist->SetEntriesPerPage(10);
-
-    $divlist->SetHeader(array(array("string"=>"Class name"),
-                              array("string"=>"Objects","attach"=>"style='width:120px;'"),
-                              array("string"=>"Options","attach"=>"style='border-right:none;width:60px;'")));
-    $listhead = 
-    "<div style='background:#F0F0F9;padding:5px;'>".
-    "<input type='image' align='middle' src='images/editpaste.png' title='"._("Append new class names")."' alt='"._("Add")."' name='Add_class'>&nbsp;".
-    "</div>";
-
-    $objTypes['FAIhook']            = "<image src='images/fai_hook.png' title='"._("Hook bundle")."' alt=''>";
-    $objTypes['FAItemplate']        = "<image src='images/fai_template.png' title='"._("Template bundle")."' alt=''>";
-    $objTypes['FAIscript']          = "<image src='images/fai_script.png' title='"._("Script bundle")."' alt=''>";
-    $objTypes['FAIvariable']        = "<image src='images/fai_variable.png' title='"._("Variable bundle")."' alt=''>";
-    $objTypes['FAIpackages']        = "<image src='images/fai_packages.png' title='"._("Packages bundle")."' alt=''>";
-    $objTypes['FAIpartitionTable']  = "<image src='images/fai_partitionTable.png' title='"._("Partition table")."' alt=''>";
-
-    $actions = "<input type='image' src='images/editdelete.png' title='"._("Remove class from profile")."' name='DEL_%KEY%'>"; 
-
-    foreach($this->FAIclasses as $usedClass){
-      $str = "";
-      if(isset($this->FAIAllclasses[$usedClass])){
-        foreach($this->FAIAllclasses[$usedClass] as $class => $obj){
-          $str.= $objTypes[$class]; 
-        }
-      }
-
-      $field1 = array("string"=> $usedClass,"attach"=>"");
-      $field2 = array("string"=> $str,"attach"=>"");
-      $field3 = array("string"=> preg_replace("/%KEY%/",$usedClass,$actions),"attach"=>"style='border-right:none;'");
-      $divlist->AddEntry(array($field1,$field2,$field3));
-    }
-
-    $smarty->assign("divlisthead" ,$listhead);
-    $smarty->assign("divlist"     ,$divlist->DrawList());
-
-    /* Assign variables */
-    foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,$this->$attrs);
-    }
-
-    $display.= $smarty->fetch(get_template_path('faiProfile.tpl', TRUE));
-    return($display);
-  }
-  
-  function remove_from_parent()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-    $ldap->rmdir_recursive($this->dn);
-    $this->handle_post_events("remove");    
-  }
-
-  /* Save data to object 
-   */
-  function save_object()
-  {
-    plugin::save_object();
-    foreach($this->attributes as $attrs){
-      if(isset($_POST[$attrs])){
-        $this->$attrs = $_POST[$attrs];
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    $message= array();
-    $str = utf8_encode("üöä");
-    if((empty($this->description))){
-      $message[] =_("Please specify a description for this profile.");
-    }
-
-    if((preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description))){
-      $message[]=_("Please enter a valid description.");
-    }
-    
-    if((empty($this->cn))||(preg_match("/[^a-z0-9]/i",$this->cn))){
-      $message[]=_("Please enter a valid name. Only 0-9 a-Z are allowed here.");
-    }
-
-    if(count($this->FAIclasses) == 0){
-      $message[]=_("Please assign at least one class to this  profile.");
-    }
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd($_SESSION['faifilter']['base']);
-    $ldap->search("(&(objectClass=FAIprofile)(cn=".$this->cn.")(!cn=".$this->old_cn."))",array("*"));
-    if($ldap->count()){
-      $message[]=_("There is already a profile with this class name defined.");
-    }
-
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-    $ldap = $this->config->get_ldap_link();
-
-    $this->FAIclass = "";
-    foreach($this->FAIclasses as $class){
-      $this->FAIclass.=$class." ";
-    }
-
-    $this->attrs['FAIclass']=trim($this->FAIclass);
-
-    $ldap->cat($this->dn);
-    if($ldap->count()!=0){
-      /* Write FAIscript to ldap*/
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      /* Write FAIscript to ldap*/
-      $ldap->cd($this->dn);
-      $ldap->create_missing_trees($this->dn);
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-    }
-    show_ldap_error($ldap->get_error());
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/FAI/class_faiProfileEntry.inc b/plugins/admin/FAI/class_faiProfileEntry.inc
deleted file mode 100644 (file)
index b38614e..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-<?php
-
-class faiProfileEntry extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage server basic objects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account= TRUE;
-  var $attributes   = array();
-  var $objectclasses= array();
-
-  /* Array with available class names */
-  var $FAIAllclasses        = array();
-
-  function faiProfileEntry ($config, $dn= NULL,$used=array(),$objects=false)
-  {
-    plugin::plugin ($config, $dn);
-
-    /* Search only in fai tree */
-    $base = $_SESSION['faifilter']['base'];
-
-    /* Create array with categories to be able to sort different types of objects */
-    $categories = array("FAIscript","FAItemplate","FAIhook","FAIvariable","FAIpartitionTable","FAIpackage");
-
-    /* Read out all objects from fai tree */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($base);
-    $ldap->search("(| (objectClass=FAIscript)(objectClass=FAItemplate)(objectClass=FAIhook)(objectClass=FAIvariable)
-                      (objectClass=FAIpartitionTable)(objectClass=FAIpackage))",array("*"));
-    while($attrs = $ldap->fetch()){
-      
-      /* Only use objects which have cn set */
-      if((isset($attrs['cn'][0]))&&(!in_array($attrs['cn'][0],$used))){
-        foreach($categories as $cat){
-          if(in_array($cat,$attrs['objectClass'])){
-        
-            /* Append different types of objects */
-            $this->FAIAllclasses[$attrs['cn'][0]]['objects'][$cat]=$cat;
-
-            /* Set selected status to false */
-            $this->FAIAllclasses[$attrs['cn'][0]]['status']=false;
-
-            $sort[strtolower($attrs['cn'][0])] = $attrs['cn'][0];
-          }
-        }
-      }
-    }
-
-    ksort($sort);
-    foreach($sort as $name){
-      $tmp[$name] =$this->FAIAllclasses[$name];
-    }
-    $this->FAIAllclasses = array();
-    $this->FAIAllclasses = $tmp;
-
-
-    /* If no search filter is set, create one */
-    if (!is_global("SUBfaifilter")){
-      $SUBfaifilter= array("base" => "ou=fai,ou=configs,ou=systems,".$base, "Sregex" => "*");
-      $SUBfaifilter['SShowTemplates'] = false;
-      $SUBfaifilter['SShowScripts']   = false;
-      $SUBfaifilter['SShowHooks']     = false;
-      $SUBfaifilter['SShowVariables'] = false;
-      $SUBfaifilter['SShowPackages']  = false;
-      $SUBfaifilter['SShowPartitions']= false;
-      register_global("SUBfaifilter", $SUBfaifilter);
-    }
-  }
-
-  function execute()
-  {
-    /* Fill templating stuff */
-    $smarty     = get_smarty();
-    $display = "";
-
-    $SUBfaifilter = $_SESSION['SUBfaifilter'];
-
-    /* If someone used the apply button, update searchfilter */
-    if(isset($_POST['Sregex'])){
-      foreach($SUBfaifilter as $key => $val){
-        if(!isset($_POST[$key])){
-          $SUBfaifilter[$key] = false;
-        }else{
-          $SUBfaifilter[$key] =$_POST[$key];
-        }
-      }
-      $SUBfaifilter['Sregex']= $_POST['Sregex'];
-      if(!strstr($SUBfaifilter['Sregex'],"*")){
-        $SUBfaifilter['Sregex'] = $SUBfaifilter['Sregex']."*";
-      }
-    }
-  
-    /* Save current searchfilter in session*/
-    $_SESSION['SUBfaifilter']= $SUBfaifilter;
-
-    /* Check if we used a checkboxe from the list, to select dselect an entry */
-    foreach($_POST as $name => $value){
-      foreach($this->FAIAllclasses as $class => $obj){
-        if(isset($_POST["ON_PAGE_".$class])){
-          if(isset($_POST['USE_'.$class])){
-            $this->FAIAllclasses[$class]['status']=true;  
-          }else{
-            $this->FAIAllclasses[$class]['status']=false;  
-          }    
-        }
-      }
-    }
-
-    /* Create different picture for each object type */
-    $objTypes['FAIhook']            = "<image src='images/fai_hook.png' title='"._("Hook bundle")."' alt=''>&nbsp;";
-    $objTypes['FAItemplate']        = "<image src='images/fai_template.png' title='"._("Template bundle")."' alt=''>&nbsp;";
-    $objTypes['FAIscript']          = "<image src='images/fai_script.png' title='"._("Script bundle")."' alt=''>&nbsp;";
-    $objTypes['FAIvariable']        = "<image src='images/fai_variable.png' title='"._("Variable bundle")."' alt=''>&nbsp;";
-    $objTypes['FAIpackages']        = "<image src='images/fai_packages.png' title='"._("Package bundle")."' alt=''>&nbsp;";
-    $objTypes['FAIpartitionTable']  = "<image src='images/fai_partitionTable.png' title='"._("Partition table")."' alt=''>&nbsp;";
-
-    /* assign basic attributes */
-    foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,stripslashes($this->$attrs));
-    }
-
-    /* Assign all filter attributes to smarty */
-    foreach($SUBfaifilter as $key => $val){
-      if(($key != "base")&&($key != "Sregex")){
-        if($val){
-          $smarty->assign($key."CHK", " checked ");
-        }else{
-          $smarty->assign($key."CHK", "");
-        }
-      }else{
-        $smarty->assign($key,$val);
-      }
-    }
-  
-    /* Create a divlist to display all available class names with the depending object types */
-    $divlist = new divlist("ProfileEntry");
-    $divlist->SetSummary(_("This list displays all assigned class names for this profile."));
-    $divlist->SetEntriesPerPage(20);
-    $divlist->SetHeader(array(array("string"=>"Class name"),
-                              array("string"=>"Objects")));
-
-    /* Action button allows us to delete an entry */
-    $action = "<input type='hidden' name='ON_PAGE_%KEY%' value='1'>
-              <input type='checkbox' name='USE_%KEY%' value='%KEY%' onChange='document.mainform.submit();' %CHECK%>";
-
-    /* Check every single class name to match the current search filter */
-    foreach($this->FAIAllclasses as $usedClass => $classes){
-
-      $fi = str_replace("*",".*",$SUBfaifilter['Sregex']);  
-      $abort = false; 
-      if(!preg_match("/".$fi."/",$usedClass)){
-        $abort = true;
-      }
-      if(($SUBfaifilter['SShowScripts'])&&(!in_array('FAIscript',$classes['objects']))){
-        $abort = true;
-      }
-      if(($SUBfaifilter['SShowTemplates'])&&(!in_array('FAItemplate',$classes['objects']))){
-        $abort = true;
-      }
-      if(($SUBfaifilter['SShowHooks'])&&(!in_array('FAIhook',$classes['objects']))){
-        $abort = true;
-      }
-      if(($SUBfaifilter['SShowVariables'])&&(!in_array('FAIvariable',$classes['objects']))){
-        $abort = true;
-      }
-      if(($SUBfaifilter['SShowPartitions'])&&(!in_array('FAIpartitionTable',$classes['objects']))){
-        $abort = true;
-      }
-      if(($SUBfaifilter['SShowPackages'])&&(!in_array('FAIpackages',$classes['objects']))){
-        $abort = true;
-      }
-
-      if(!$abort){
-        $str = "";
-        foreach($classes['objects'] as $class => $obj){
-          $str.= $objTypes[$obj];
-        }
-
-        /* Is this entry selected */ 
-        if($classes['status']==true){
-          $action_check = preg_replace("/%CHECK%/"," checked ",$action);
-        }else{
-          $action_check = preg_replace("/%CHECK%/","",$action);
-        }      
-        
-        /* Append to list */
-        $field1 = array("string"=> preg_replace("/%KEY%/",$usedClass,$action_check).$usedClass,"attach"=>"");
-        $field2 = array("string"=> $str,"attach"=>"");
-        $divlist->AddEntry(array($field1,$field2));
-      }
-    }
-
-    $smarty->assign("faihead"       , "");
-    $smarty->assign("failist"       , $divlist->DrawList());
-    $smarty->assign("infoimage"     , get_template_path('images/info.png'));
-    $smarty->assign("launchimage"   , get_template_path('images/launch.png'));
-    $smarty->assign("alphabet"      , generate_alphabet());
-    $smarty->assign("apply"         , apply_filter(TRUE));
-    $smarty->assign("search_image"  , get_template_path('images/search.png'));
-
-    $display.= $smarty->fetch(get_template_path('faiProfileEntry.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-  }
-
-  /* Check supplied data */
-  function check()
-  {
-    $message= array();
-    return ($message);
-  }
-
-  function save()
-  {
-    $tmp = array();
-    foreach($this->FAIAllclasses as $class => $obj){
-      if($obj['status']==true){
-        $tmp[$class]=$class;
-      }
-    }
-    return($tmp);
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/FAI/class_faiScript.inc b/plugins/admin/FAI/class_faiScript.inc
deleted file mode 100644 (file)
index 3ee246a..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-<?php
-
-class faiScript extends plugin
-{
-  /* CLI vars */
-  var $cli_summary      = "Manage server basic objects";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account   = TRUE;
-
-  /* Attributes for this Object */
-  var $attributes       = array("cn","description");
-
-  /* ObjectClasses for this Object*/
-  var $objectclasses    = array("top","FAIclass","FAIscript");
-
-  /* Class name of the Ldap ObjectClass for the Sub Object */
-  var $subClass         = "FAIscriptEntry";
-  var $subClasses       = array("top","FAIclass","FAIscriptEntry");
-
-  /* Class name of the php class which allows us to edit a Sub Object */
-  var $subClassName     = "faiScriptEntry";      
-
-  /* Attributes to initialise for each subObject */
-  var $subAttributes    = array("cn","description","FAIpriority","FAIscript"); 
-  var $sub64coded       = array("FAIscript");
-
-  /* Specific attributes */
-  var $cn               = "";       // The class name for this object
-  var $description      = "";       // The description for this set of partitions
-  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
-  var $dialog           = NULL;     // a dialog, e.g. new disk dialog
-  var $SubObjects       = array();  // All leafobjects of this object
-
-  function faiScript ($config, $dn= NULL)
-  {
-    /* Load Attributes */
-    plugin::plugin ($config, $dn);
-
-    /* If "dn==new" we try to create a new entry
-     * Else we must read all objects from ldap which belong to this entry.
-     * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
-     */
-    if($dn != "new"){
-      $this->dn =$dn;
-
-      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
-       */
-      $ldap     = $this->config->get_ldap_link();
-      $ldap->cd ($this->dn);
-      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$this->subAttributes);
-
-      while($object = $ldap->fetch()){
-        /* Set status for save management */
-  
-        foreach($this->subAttributes as $attrs){
-          if(!isset($object[$attrs][0])){
-            $this->SubObjects[$object['cn'][0]][$attrs]="";
-          }else{
-            $this->SubObjects[$object['cn'][0]][$attrs]=$object[$attrs][0];
-          }
-        }
-     
-        foreach($this->sub64coded as $codeIt){
-          $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
-        }
-        $this->SubObjects[$object['cn'][0]]['status']      = "edited";
-        $this->SubObjects[$object['cn'][0]]['dn']          = $object['dn'];
-      }
-    }
-  }
-
-  function execute()
-  {
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    /* Add new sub object */
-    if(isset($_POST['AddSubObject'])){
-      $this->dialog= new $this->subClassName($this->config,"new");
-      $this->is_dialog=true;
-    }
-
-    /* Edit selected Sub Object */
-    if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
-      $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$_POST['SubObject']]);
-      $this->is_dialog=true;
-    }
-    
-    /* Remove Sub object */
-    if((isset($_POST['DelSubObject']))&&(isset($_POST['SubObject']))){
-      if($this->SubObjects[$_POST['SubObject']]['status'] == "edited"){
-        $this->SubObjects[$_POST['SubObject']]['status']= "delete";
-      }else{
-        unset($this->SubObjects[$_POST['SubObject']]);
-      }
-    }
-
-    /* Save Dialog */
-    if(isset($_POST['SaveSubObject'])){
-      $this->dialog->save_object();
-      $msgs = $this->dialog->check();
-      if(count($msgs)>0){
-        foreach($msgs as $msg){
-          print_red($msg);
-        }
-      }else{
-        $obj = $this->dialog->save();
-        if(isset($obj['remove'])){
-          if($this->SubObjects[$obj['remove']['from']]['status']=="edited"){
-            $this->SubObjects[$obj['remove']['from']]['status'] = "delete";
-          }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){
-            unset($this->SubObjects[$obj['remove']['from']]);
-          }
-          $obj['status'] = "new";
-          $this->SubObjects[$obj['remove']['to']] = $obj;
-          unset($this->SubObjects[$obj['remove']['to']]['remove']);
-        }else{
-          $this->SubObjects[$obj['cn']]=$obj;
-        }
-        $this->is_dialog=false;
-        unset($this->dialog);
-        $this->dialog=NULL;
-      }
-    }
-
-    /* Cancel Dialog */
-    if(isset($_POST['CancelSubObject'])){
-      $this->is_dialog=false; 
-      unset($this->dialog);
-      $this->dialog=NULL;
-    }
-
-    /* Print dialog if $this->dialog is set */
-    if($this->dialog){
-      $this->dialog->save_object();
-      $display = $this->dialog->execute();
-      return($display);
-    }
-
-    $smarty->assign("SubObjects",$this->getList());
-    $smarty->assign("SubObjectKeys",array_flip($this->getList()));
-    /* Assign variables */
-    foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,$this->$attrs);
-    }
-
-    $display.= $smarty->fetch(get_template_path('faiScript.tpl', TRUE));
-    return($display);
-  }
-
-  /* Generate listbox friendly SubObject list
-  */
-  function getList(){
-    $a_return=array();
-    foreach($this->SubObjects as $obj){
-      if($obj['status'] != "delete"){
-        $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]";
-      }
-    }
-    return($a_return);
-  }
-
-  /* Delete me, and all my subtrees
-   */
-  function remove_from_parent()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-    $ldap->rmdir_recursive($this->dn);
-    $this->handle_post_events("remove");    
-  }
-
-
-  /* Save data to object 
-   */
-  function save_object()
-  {
-    plugin::save_object();
-    foreach($this->attributes as $attrs){
-      if(isset($_POST[$attrs])){
-        $this->$attrs = $_POST[$attrs];
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    $message= array();
-    $str = utf8_encode("üöä");
-    if((empty($this->description))||(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description))){
-      $message[]=_("Please enter a valid description.");
-    }
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-    $ldap = $this->config->get_ldap_link();
-  
-    $ldap->cat($this->dn);
-    if($ldap->count()!=0){
-      /* Write FAIscript to ldap*/
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      /* Write FAIscript to ldap*/
-      $ldap->cd($this->dn);
-      $ldap->create_missing_trees($this->dn);
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-    }
-    show_ldap_error($ldap->get_error());
-    /* Prepare FAIscriptEntry to write it to ldap
-     * First sort array.
-     *  Because we must delete old entries first.
-     * After deletion, we perform add and modify 
-     */
-    $Objects = array();
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] == "delete"){
-        $Objects[$name] = $obj; 
-      }
-    }
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] != "delete"){
-        $Objects[$name] = $obj; 
-      }
-    }
-
-    foreach($Objects as $name => $obj){
-
-      foreach($this->sub64coded as $codeIt){
-        $obj[$codeIt]=base64_encode($obj[$codeIt]);
-      }
-
-      $tmp = array();
-      foreach($this->subAttributes as $attrs){
-        if(empty($obj[$attrs])){
-          $obj[$attrs] = array();
-        }
-        $tmp[$attrs] = $obj[$attrs];
-      }    
-        
-      $tmp['objectClass'] = $this->subClasses;
-
-      $sub_dn = "cn=".$obj['cn'].",".$this->dn;
-      if($obj['status'] == "delete"){
-        $ldap->cd($sub_dn);
-        $ldap->rmdir_recursive($sub_dn);
-        $this->handle_post_events("remove");
-      }elseif($obj['status'] == "edited"){
-        $ldap->cd($sub_dn);
-        $ldap->modify($tmp);
-        $this->handle_post_events("modify");
-      }elseif($obj['status']=="new"){
-        $ldap->cd($sub_dn);
-        $ldap->create_missing_trees($sub_dn);
-        $ldap->cd($sub_dn);
-        $ldap->add($tmp); 
-        $this->handle_post_events("add");
-      }
-      show_ldap_error($ldap->get_error()); 
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/FAI/class_faiScriptEntry.inc b/plugins/admin/FAI/class_faiScriptEntry.inc
deleted file mode 100644 (file)
index 9032300..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-<?php
-
-class faiScriptEntry extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage server basic objects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account= TRUE;
-  var $attributes   = array("Object_cn","Object_description","Object_FAIpriority","Object_FAIscript");
-  var $objectclasses= array();
-
-  var $orig_cn              = "";
-
-  var $Object_dn            = "";
-  var $Object_cn            = "";
-  var $Object_FAIpriority   = "";
-  var $Object_FAIscript     = "";
-  var $Object_description   = "";
-  var $Object_status        = "new";
-  
-  function faiScriptEntry ($config, $dn= NULL,$object=false)
-  {
-    plugin::plugin ($config, $dn);
-    if($dn != "new"){
-      $this->orig_cn= $object['cn'];
-      $this->dn=$object['dn'];
-      foreach($object as $name=>$value){
-        $oname = "Object_".$name;
-        $this->$oname=$value;
-      }
-    }else{
-      $this->Object_status = "new";
-      $this->orig_cn       = false;
-    }
-  }
-
-  function execute()
-  {
-    /* Fill templating stuff */
-    $smarty     = get_smarty();
-    $display = "";
-  
-    if(isset($_POST['ImportUpload'])){
-      if(($_FILES['ImportFile']['error']!=0)){
-        print_red(_("Please select a valid file."));
-      }else
-      if(($_FILES['ImportFile']['size']==0)){
-        print_red(_("Selected file is empty."));
-      }else{
-        $str = file_get_contents($_FILES['ImportFile']['tmp_name']);
-        $this->Object_FAIscript = $str;
-      }
-    }
-
-  
-
-    foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,stripslashes($this->$attrs));
-    }
-
-    for($i =1 ; $i <= 100 ; $i++){
-      $Object_FAIprioritys[$i]=$i;
-    }
-    $smarty->assign("Object_FAIprioritys",$Object_FAIprioritys);
-    $display.= $smarty->fetch(get_template_path('faiScriptEntry.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    if(isset($_POST['SubObjectFormSubmitted'])){
-      foreach($this->attributes as $attrs){
-        if(isset($_POST[$attrs])){
-          $this->$attrs = $_POST[$attrs];
-        }else{
-          $this->$attrs = "";
-        }
-      }
-    }
-  }
-
-  /* Check supplied data */
-  function check()
-  {
-    $message= array();
-  
-    $str = utf8_encode("üöä");
-
-    if(empty($this->Object_FAIscript)){
-      $message[]=_("Please specify a script.");
-    }
-    
-    if(empty($this->Object_description)){
-      $message[] = _("Please enter a description.");
-    }
-
-    if(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->Object_description)){
-      $message[] = _("Invalid character in description. Please enter a valid description.");
-    }
-
-    if(empty($this->Object_cn)){
-      $message[] = _("Please enter a name.");
-    }
-
-    if(preg_match("/[^0-9a-z]/i",$this->Object_cn)){
-      $message[] = _("Please enter a valid name. Only a-Z 0-9 are allowed.");
-    }
-    return ($message);
-  }
-  function save()
-  {
-    $tmp=array();
-    foreach($this->attributes as $attrs){ 
-      $attr = preg_replace("/^Object_/","",$attrs);
-      $tmp[$attr] = $this->$attrs;
-    }
-
-    if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
-      $tmp['remove']['from']  = $this->orig_cn;
-      $tmp['remove']['to']    = $tmp['cn'];
-    }
-  
-    $tmp['dn']      = $this->dn;  
-    $tmp['status']  = $this->Object_status; 
-    return($tmp);
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/FAI/class_faiTemplate.inc b/plugins/admin/FAI/class_faiTemplate.inc
deleted file mode 100644 (file)
index 2c43775..0000000
+++ /dev/null
@@ -1,279 +0,0 @@
-<?php
-
-class faiTemplate extends plugin
-{
-  /* CLI vars */
-  var $cli_summary      = "Manage server basic objects";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account   = TRUE;
-
-  /* Attributes for this Object */
-  var $attributes       = array("cn","description");
-
-  /* ObjectClasses for this Object*/
-  var $objectclasses    = array("top","FAIclass","FAItemplate");
-
-  /* Class name of the Ldap ObjectClass for the Sub Object */
-  var $subClass         = "FAItemplateEntry";
-  var $subClasses       = array("top","FAIclass","FAItemplateEntry");
-
-  /* Class name of the php class which allows us to edit a Sub Object */
-  var $subClassName     = "faiTemplateEntry";      
-
-  /* Attributes to initialise for each subObject */
-  var $subAttributes    = array("cn","description","FAItemplateFile","FAItemplatePath"); 
-  var $sub64coded       = array("FAItemplateFile","FAItemplatePath");
-
-  /* Specific attributes */
-  var $cn               = "";       // The class name for this object
-  var $description      = "";       // The description for this set of partitions
-  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
-  var $dialog           = NULL;     // a dialog, e.g. new disk dialog
-  var $SubObjects       = array();  // All leafobjects of this object
-
-  function faiTemplate ($config, $dn= NULL)
-  {
-    /* Load Attributes */
-    plugin::plugin ($config, $dn);
-
-    /* If "dn==new" we try to create a new entry
-     * Else we must read all objects from ldap which belong to this entry.
-     * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
-     */
-    if($dn != "new"){
-      $this->dn =$dn;
-
-      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
-       */
-      $ldap     = $this->config->get_ldap_link();
-      $ldap->cd ($this->dn);
-      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$this->subAttributes);
-
-      while($object = $ldap->fetch()){
-        /* Set status for save management */
-  
-        foreach($this->subAttributes as $attrs){
-          if(!isset($object[$attrs][0])){
-            $this->SubObjects[$object['cn'][0]][$attrs]="";
-          }else{
-            $this->SubObjects[$object['cn'][0]][$attrs]=$object[$attrs][0];
-          }
-        }
-
-        foreach($this->sub64coded as $codeIt){
-          $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
-        }       
-        $this->SubObjects[$object['cn'][0]]['status']      = "edited";
-        $this->SubObjects[$object['cn'][0]]['dn']          = $object['dn'];
-      }
-    }
-  }
-
-  function execute()
-  {
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    /* Add new sub object */
-    if(isset($_POST['AddSubObject'])){
-      $this->dialog= new $this->subClassName($this->config,"new");
-      $this->is_dialog=true;
-    }
-
-    /* Edit selected Sub Object */
-    if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
-      $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$_POST['SubObject']]);
-      $this->is_dialog=true;
-    }
-    
-    /* Remove Sub object */
-    if((isset($_POST['DelSubObject']))&&(isset($_POST['SubObject']))){
-      if($this->SubObjects[$_POST['SubObject']]['status'] == "edited"){
-        $this->SubObjects[$_POST['SubObject']]['status']= "delete";
-      }else{
-        unset($this->SubObjects[$_POST['SubObject']]);
-      }
-    }
-
-    /* Save Dialog */
-    if(isset($_POST['SaveSubObject'])){
-      $this->dialog->save_object();
-      $msgs = $this->dialog->check();
-      if(count($msgs)>0){
-        foreach($msgs as $msg){
-          print_red($msg);
-        }
-      }else{
-        $obj = $this->dialog->save();
-        if(isset($obj['remove'])){
-          if($this->SubObjects[$obj['remove']['from']]['status']=="edited"){
-            $this->SubObjects[$obj['remove']['from']]['status'] = "delete";
-          }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){
-            unset($this->SubObjects[$obj['remove']['from']]);
-          }
-          $obj['status'] = "new";
-          $this->SubObjects[$obj['remove']['to']] = $obj;
-          unset($this->SubObjects[$obj['remove']['to']]['remove']);
-        }else{
-          $this->SubObjects[$obj['cn']]=$obj;
-        }
-        $this->is_dialog=false;
-        unset($this->dialog);
-        $this->dialog=NULL;
-      }
-    }
-
-    /* Cancel Dialog */
-    if(isset($_POST['CancelSubObject'])){
-      $this->is_dialog=false; 
-      unset($this->dialog);
-      $this->dialog=NULL;
-    }
-
-    /* Print dialog if $this->dialog is set */
-    if($this->dialog){
-      $this->dialog->save_object();
-      $display = $this->dialog->execute();
-      return($display);
-    }
-
-    $smarty->assign("SubObjects",$this->getList());
-    $smarty->assign("SubObjectKeys",array_flip($this->getList()));
-    /* Assign variables */
-    foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,$this->$attrs);
-    }
-
-    $display.= $smarty->fetch(get_template_path('faiTemplate.tpl', TRUE));
-    return($display);
-  }
-
-  /* Generate listbox friendly SubObject list
-  */
-  function getList(){
-    $a_return=array();
-    foreach($this->SubObjects as $obj){
-      if($obj['status'] != "delete"){
-        $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]";
-      }
-    }
-    return($a_return);
-  }
-
-  /* Delete me, and all my subtrees
-   */
-  function remove_from_parent()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-    $ldap->rmdir_recursive($this->dn);
-    $this->handle_post_events("remove");    
-  }
-
-
-  /* Save data to object 
-   */
-  function save_object()
-  {
-    plugin::save_object();
-    foreach($this->attributes as $attrs){
-      if(isset($_POST[$attrs])){
-        $this->$attrs = $_POST[$attrs];
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    $message= array();
-    $str = utf8_encode("üöä");
-    if((empty($this->description))||(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description))){
-      $message[]=_("Please enter a valid description.");
-    }
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-    $ldap = $this->config->get_ldap_link();
-  
-    $ldap->cat($this->dn);
-    if($ldap->count()!=0){
-      /* Write FAIscript to ldap*/
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      /* Write FAIscript to ldap*/
-      $ldap->cd($this->dn);
-      $ldap->create_missing_trees($this->dn);
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-    }
-    show_ldap_error($ldap->get_error());
-    /* Prepare FAIscriptEntry to write it to ldap
-     * First sort array.
-     *  Because we must delete old entries first.
-     * After deletion, we perform add and modify 
-     */
-    $Objects = array();
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] == "delete"){
-        $Objects[$name] = $obj; 
-      }
-    }
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] != "delete"){
-        $Objects[$name] = $obj; 
-      }
-    }
-
-    foreach($Objects as $name => $obj){
-      foreach($this->sub64coded as $codeIt){
-        $obj[$codeIt]=base64_encode($obj[$codeIt]);
-      }
-      $tmp = array();
-      foreach($this->subAttributes as $attrs){
-        if(empty($obj[$attrs])){
-          $obj[$attrs] = array();
-        }
-        $tmp[$attrs] = $obj[$attrs];
-      }    
-        
-      $tmp['objectClass'] = $this->subClasses;
-
-      $sub_dn = "cn=".$obj['cn'].",".$this->dn;
-
-      if($obj['status'] == "delete"){
-        $ldap->cd($sub_dn);
-        $ldap->rmdir_recursive($sub_dn);
-        $this->handle_post_events("remove");
-      }elseif($obj['status'] == "edited"){
-        $ldap->cd($sub_dn);
-        $ldap->modify($tmp);
-        $this->handle_post_events("modify");
-      }elseif($obj['status']=="new"){
-        $ldap->cd($sub_dn);
-        $ldap->create_missing_trees($sub_dn);
-        $ldap->cd($sub_dn);
-        $ldap->add($tmp); 
-        $this->handle_post_events("add");
-      }
-      show_ldap_error($ldap->get_error()); 
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/FAI/class_faiTemplateEntry.inc b/plugins/admin/FAI/class_faiTemplateEntry.inc
deleted file mode 100644 (file)
index 24d8d82..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-<?php
-
-class faiTemplateEntry extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage server basic objects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account= TRUE;
-  var $attributes   = array("Object_cn","Object_description","Object_FAItemplateFile","Object_FAItemplatePath");
-  var $objectclasses= array();
-
-  var $orig_cn              = "";
-
-  var $Object_dn            = "";
-  var $Object_cn            = "";
-  var $Object_FAItemplateFile   = "";
-  var $Object_FAItemplatePath   = "";
-  var $Object_description   = "";
-  var $Object_status        = "new";
-  
-  function faiTemplateEntry ($config, $dn= NULL,$object=false)
-  {
-    plugin::plugin ($config, $dn);
-    if($dn != "new"){
-      $this->orig_cn= $object['cn'];
-      $this->dn=$object['dn'];
-      foreach($object as $name=>$value){
-        $oname = "Object_".$name;
-        $this->$oname=$value;
-      }
-    }else{
-      $this->Object_status = "new";
-      $this->orig_cn       = false;
-    }
-  }
-
-  function execute()
-  {
-    /* Fill templating stuff */
-    $smarty     = get_smarty();
-    $display = "";
-
-    foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,stripslashes($this->$attrs));
-    }
-
-    for($i =1 ; $i <= 100 ; $i++){
-      $Object_FAIprioritys[$i]=$i;
-    }
-    $smarty->assign("Object_FAIprioritys",$Object_FAIprioritys);
-    $display.= $smarty->fetch(get_template_path('faiTemplateEntry.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    if(isset($_POST['SubObjectFormSubmitted'])){
-      foreach($this->attributes as $attrs){
-        if(isset($_POST[$attrs])){
-          $this->$attrs = $_POST[$attrs];
-        }else{
-          $this->$attrs = "";
-        }
-      }
-    }
-  }
-
-  /* Check supplied data */
-  function check()
-  {
-    $message= array();
-    if(empty($this->Object_FAItemplateFile)){
-      $message[]=_("Please specify a value for attribute 'file'.");
-    } 
-
-    if(empty($this->Object_FAItemplatePath)){
-      $message[]=_("Please specify a value for attribute 'path'.");
-    } 
-  
-    $str = utf8_encode("üöä");
-
-    if(empty($this->Object_description)){
-      $message[] = _("Please enter a description.");
-    }
-
-    if(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->Object_description)){
-      $message[] = _("Invalid character in description. Please enter a valid description.");
-    }
-
-    if(empty($this->Object_cn)){
-      $message[] = _("Please enter a name.");
-    }
-
-    if(preg_match("/[^0-9a-z]/i",$this->Object_cn)){
-      $message[] = _("Please enter a valid name. Only a-Z 0-9 are allowed.");
-    }
-    return ($message);
-  }
-  function save()
-  {
-    $tmp=array();
-    foreach($this->attributes as $attrs){ 
-      $attr = preg_replace("/^Object_/","",$attrs);
-      $tmp[$attr] = $this->$attrs;
-    }
-
-    if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
-      $tmp['remove']['from']  = $this->orig_cn;
-      $tmp['remove']['to']    = $tmp['cn'];
-    }
-  
-    $tmp['dn']      = $this->dn;  
-    $tmp['status']  = $this->Object_status;  
-
-    return($tmp);
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/FAI/class_faiVariable.inc b/plugins/admin/FAI/class_faiVariable.inc
deleted file mode 100644 (file)
index 606f18c..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-<?php
-
-class faiVariable extends plugin
-{
-  /* CLI vars */
-  var $cli_summary      = "Manage server basic objects";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account   = TRUE;
-
-  /* Attributes for this Object */
-  var $attributes       = array("cn","description");
-
-  /* ObjectClasses for this Object*/
-  var $objectclasses    = array("top","FAIclass","FAIvariable");
-
-  /* Class name of the Ldap ObjectClass for the Sub Object */
-  var $subClass         = "FAIvariableEntry";
-  var $subClasses       = array("top","FAIclass","FAIvariableEntry");
-
-  /* Class name of the php class which allows us to edit a Sub Object */
-  var $subClassName     = "faiVariableEntry";      
-
-  /* Attributes to initialise for each subObject */
-  var $subAttributes    = array("cn","description","FAIvariableContent"); 
-  var $sub64coded       = array("FAIvariableContent");  
-
-  /* Specific attributes */
-  var $cn               = "";       // The class name for this object
-  var $description      = "";       // The description for this set of partitions
-  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
-  var $dialog           = NULL;     // a dialog, e.g. new disk dialog
-  var $SubObjects       = array();  // All leafobjects of this object
-
-  function faiVariable ($config, $dn= NULL)
-  {
-    /* Load Attributes */
-    plugin::plugin ($config, $dn);
-
-    /* If "dn==new" we try to create a new entry
-     * Else we must read all objects from ldap which belong to this entry.
-     * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
-     */
-    if($dn != "new"){
-      $this->dn =$dn;
-
-      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
-       */
-      $ldap     = $this->config->get_ldap_link();
-      $ldap->cd ($this->dn);
-      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$this->subAttributes);
-
-      while($object = $ldap->fetch()){
-        /* Set status for save management */
-  
-        foreach($this->subAttributes as $attrs){
-          if(!isset($object[$attrs][0])){
-            $this->SubObjects[$object['cn'][0]][$attrs]="";
-          }else{
-            $this->SubObjects[$object['cn'][0]][$attrs]=$object[$attrs][0];
-          }
-        }
-     
-        foreach($this->sub64coded as $codeIt){
-          $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
-        }
-        $this->SubObjects[$object['cn'][0]]['status']      = "edited";
-        $this->SubObjects[$object['cn'][0]]['dn']          = $object['dn'];
-      }
-    }
-  }
-
-  function execute()
-  {
-    /* Fill templating stuff */
-    $smarty= get_smarty();
-    $display= "";
-
-    /* Add new sub object */
-    if(isset($_POST['AddSubObject'])){
-      $this->dialog= new $this->subClassName($this->config,"new");
-      $this->is_dialog=true;
-    }
-
-    /* Edit selected Sub Object */
-    if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
-      $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$_POST['SubObject']]);
-      $this->is_dialog=true;
-    }
-    
-    /* Remove Sub object */
-    if((isset($_POST['DelSubObject']))&&(isset($_POST['SubObject']))){
-      if($this->SubObjects[$_POST['SubObject']]['status'] == "edited"){
-        $this->SubObjects[$_POST['SubObject']]['status']= "delete";
-      }else{
-        unset($this->SubObjects[$_POST['SubObject']]);
-      }
-    }
-
-    /* Save Dialog */
-    if(isset($_POST['SaveSubObject'])){
-      $this->dialog->save_object();
-      $msgs = $this->dialog->check();
-      if(count($msgs)>0){
-        foreach($msgs as $msg){
-          print_red($msg);
-        }
-      }else{
-        $obj = $this->dialog->save();
-        if(isset($obj['remove'])){
-          if($this->SubObjects[$obj['remove']['from']]['status']=="edited"){
-            $this->SubObjects[$obj['remove']['from']]['status'] = "delete";
-          }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){
-            unset($this->SubObjects[$obj['remove']['from']]);
-          }
-          $obj['status'] = "new";
-          $this->SubObjects[$obj['remove']['to']] = $obj;
-          unset($this->SubObjects[$obj['remove']['to']]['remove']);
-        }else{
-          $this->SubObjects[$obj['cn']]=$obj;
-        }
-        $this->is_dialog=false;
-        unset($this->dialog);
-        $this->dialog=NULL;
-      }
-    }
-
-    /* Cancel Dialog */
-    if(isset($_POST['CancelSubObject'])){
-      $this->is_dialog=false; 
-      unset($this->dialog);
-      $this->dialog=NULL;
-    }
-
-    /* Print dialog if $this->dialog is set */
-    if($this->dialog){
-      $this->dialog->save_object();
-      $display = $this->dialog->execute();
-      return($display);
-    }
-
-    $smarty->assign("SubObjects",$this->getList());
-    $smarty->assign("SubObjectKeys",array_flip($this->getList()));
-    /* Assign variables */
-    foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,$this->$attrs);
-    }
-
-    $display.= $smarty->fetch(get_template_path('faiVariable.tpl', TRUE));
-    return($display);
-  }
-
-  /* Generate listbox friendly SubObject list
-  */
-  function getList(){
-    $a_return=array();
-    foreach($this->SubObjects as $obj){
-      if($obj['status'] != "delete"){
-        $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]";
-      }
-    }
-    return($a_return);
-  }
-
-  /* Delete me, and all my subtrees
-   */
-  function remove_from_parent()
-  {
-    $ldap = $this->config->get_ldap_link();
-    $ldap->cd ($this->dn);
-    $ldap->rmdir_recursive($this->dn);
-    $this->handle_post_events("remove");    
-  }
-
-
-  /* Save data to object 
-   */
-  function save_object()
-  {
-    plugin::save_object();
-    foreach($this->attributes as $attrs){
-      if(isset($_POST[$attrs])){
-        $this->$attrs = $_POST[$attrs];
-      }
-    }
-  }
-
-
-  /* Check supplied data */
-  function check()
-  {
-    $message= array();
-    $str = utf8_encode("üöä");
-    if((empty($this->description))||(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description))){
-      $message[]=_("Please enter a valid description.");
-    }
-    return ($message);
-  }
-
-
-  /* Save to LDAP */
-  function save()
-  {
-    plugin::save();
-    $ldap = $this->config->get_ldap_link();
-  
-    $ldap->cat($this->dn);
-    if($ldap->count()!=0){
-      /* Write FAIscript to ldap*/
-      $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
-    }else{
-      /* Write FAIscript to ldap*/
-      $ldap->cd($this->dn);
-      $ldap->create_missing_trees($this->dn);
-      $ldap->cd($this->dn);
-      $ldap->add($this->attrs);
-    }
-    show_ldap_error($ldap->get_error());
-    /* Prepare FAIscriptEntry to write it to ldap
-     * First sort array.
-     *  Because we must delete old entries first.
-     * After deletion, we perform add and modify 
-     */
-    $Objects = array();
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] == "delete"){
-        $Objects[$name] = $obj; 
-      }
-    }
-    foreach($this->SubObjects as $name => $obj){
-      if($obj['status'] != "delete"){
-        $Objects[$name] = $obj; 
-      }
-    }
-
-    foreach($Objects as $name => $obj){
-
-      foreach($this->sub64coded as $codeIt){
-        $obj[$codeIt]=base64_encode($obj[$codeIt]);
-      }
-
-      $tmp = array();
-      foreach($this->subAttributes as $attrs){
-        if(empty($obj[$attrs])){
-          $obj[$attrs] = array();
-        }
-        $tmp[$attrs] = $obj[$attrs];
-      }    
-        
-      $tmp['objectClass'] = $this->subClasses;
-
-      $sub_dn = "cn=".$obj['cn'].",".$this->dn;
-      if($obj['status'] == "delete"){
-        $ldap->cd($sub_dn);
-        $ldap->rmdir_recursive($sub_dn);
-        $this->handle_post_events("remove");
-      }elseif($obj['status'] == "edited"){
-        $ldap->cd($sub_dn);
-        $ldap->modify($tmp);
-        $this->handle_post_events("modify");
-      }elseif($obj['status']=="new"){
-        $ldap->cd($sub_dn);
-        $ldap->create_missing_trees($sub_dn);
-        $ldap->cd($sub_dn);
-        $ldap->add($tmp); 
-        $this->handle_post_events("add");
-      }
-      show_ldap_error($ldap->get_error()); 
-    }
-  }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/FAI/class_faiVariableEntry.inc b/plugins/admin/FAI/class_faiVariableEntry.inc
deleted file mode 100644 (file)
index 3f993cb..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-<?php
-
-class faiVariableEntry extends plugin
-{
-  /* CLI vars */
-  var $cli_summary= "Manage server basic objects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-  /* attribute list for save action */
-  var $ignore_account= TRUE;
-  var $attributes   = array("Object_cn","Object_description","Object_FAIvariableContent");
-  var $objectclasses= array();
-
-  var $orig_cn              = "";
-  var $Object_dn            = "";
-  var $Object_cn            = "";
-  var $Object_FAIvariableContent   = "";
-  var $Object_description   = "";
-  var $Object_status        = "new";
-  
-  function faiVariableEntry ($config, $dn= NULL,$object=false)
-  {
-    plugin::plugin ($config, $dn);
-    if($dn != "new"){
-      $this->orig_cn= $object['cn'];
-      $this->dn=$object['dn'];
-      foreach($object as $name=>$value){
-        $oname = "Object_".$name;
-        $this->$oname=$value;
-      }
-    }else{
-      $this->Object_status = "new";
-      $this->orig_cn       = false;
-    }
-  }
-
-  function execute()
-  {
-    /* Fill templating stuff */
-    $smarty     = get_smarty();
-    $display = "";
-
-    foreach($this->attributes as $attrs){
-      $smarty->assign($attrs,stripslashes($this->$attrs));
-    }
-
-    for($i =1 ; $i <= 100 ; $i++){
-      $Object_FAIprioritys[$i]=$i;
-    }
-    $smarty->assign("Object_FAIprioritys",$Object_FAIprioritys);
-    $display.= $smarty->fetch(get_template_path('faiVariableEntry.tpl', TRUE));
-    return($display);
-  }
-
-  /* Save data to object */
-  function save_object()
-  {
-    if(isset($_POST['SubObjectFormSubmitted'])){
-      foreach($this->attributes as $attrs){
-        if(isset($_POST[$attrs])){
-          $this->$attrs = $_POST[$attrs];
-        }else{
-          $this->$attrs = "";
-        }
-      }
-    }
-  }
-
-  /* Check supplied data */
-  function check()
-  {
-    $message= array();
-    
-    $str = utf8_encode("üöä");
-    if(empty($this->Object_FAIvariableContent)) {
-      $message[]=_("Please specify a value for the attribute 'content'."); 
-    }
-   
-    if(empty($this->Object_description)){
-      $message[] = _("Please enter a description.");
-    }
-
-    if(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->Object_description)){
-      $message[] = _("Invalid character in description. Please enter a valid description.");
-    }
-
-    if(empty($this->Object_cn)){
-      $message[] = _("Please enter a name.");
-    }
-
-    if(preg_match("/[^0-9a-z]/i",$this->Object_cn)){
-      $message[] = _("Please enter a valid name. Only a-Z 0-9 are allowed.");
-    }
-    return ($message);
-  }
-  function save()
-  {
-    $tmp=array();
-    foreach($this->attributes as $attrs){ 
-      $attr = preg_replace("/^Object_/","",$attrs);
-      $tmp[$attr] = $this->$attrs;
-    }
-
-    if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
-      $tmp['remove']['from']  = $this->orig_cn;
-      $tmp['remove']['to']    = $tmp['cn'];
-    }
-  
-    $tmp['dn']      = $this->dn;  
-    $tmp['status']  = $this->Object_status;  
-    return($tmp);
-  }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/plugins/admin/FAI/faiHook.tpl b/plugins/admin/FAI/faiHook.tpl
deleted file mode 100644 (file)
index 0a3d8e6..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<table width="100%">
-       <tr>
-               <td width="50%" valign="top">
-                               <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2><br>
-                               <table summary="" cellspacing="4">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="cn">
-                                                       {t}Name{/t}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input value="{$cn}" disabled id="cn">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="description">
-                                                       {t}Description{/t}{$must}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input value="{$description}" {$description} name="description" id="description">
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160);">
-                  &nbsp;
-               </td>
-               <td>
-                               <h2><img alt="" src="images/fai_hook.png" align="middle" title="{t}Objects{/t}">&nbsp;
-                                       <LABEL for="SubObject">
-                                               {t}This bundle contains the following objects{/t}
-                                       </LABEL>
-                               </h2><br>
-                               <table width="100%">
-                               <tr>
-                                       <td>
-                                               <select name="SubObject" title="{t}Choose a hook to delete or edit{/t}" style="width:350px;height:120px;" size=10 id="SubObject">
-                                                       {html_options values=$SubObjectKeys output=$SubObjects}
-                                               </select><br>
-                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}">
-                                               <input type="submit" name="EditSubObject"    value="{t}Edit{/t}"    title="{t}Edit{/t}">
-                                               <input type="submit" name="DelSubObject"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
-                                       </td>
-                               </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
diff --git a/plugins/admin/FAI/faiHookEntry.tpl b/plugins/admin/FAI/faiHookEntry.tpl
deleted file mode 100644 (file)
index 2dd86e4..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<input type="hidden" name="SubObjectFormSubmitted" value="1">
-<table width="100%" summary="">
-       <tr>
-               <td valign="top" width="50%">
-                       <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
-                               <table>
-                                       <tr>
-                                               <td>
-                                                       {t}Name{/t}&nbsp;{$must}
-                                               </td>
-                                               <td>
-                                                       <input value="{$Object_cn}" name="Object_cn">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       {t}Description{/t}&nbsp;{$must}
-                                               </td>
-                                               <td>
-                                                       <input value="{$Object_description}" name="Object_description">
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160);">
-           &nbsp;
-        </td>
-               <td>
-                               <h2><img alt="" src="images/fai_hook.png" align="middle" title="{t}Hook attributes{/t}">&nbsp;{t}Hook attributes{/t}</h2>
-                               <table width="100%">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="Object_FAIscript">
-                                                       {t}Script{/t}&nbsp;{$must}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input type="text" name="Object_FAIscript" value="{$Object_FAIscript}" id="Object_FAIscript" style="width:280px;">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="Object_FAItask">
-                                                       {t}Task{/t}&nbsp;{$must}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input type="text" name="Object_FAItask" value="{$Object_FAItask}" id="Object_FAItask" style="width:280px;">
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
-<p class="seperator">&nbsp;</p>
-<br>
-<div style="align:right;" align="right">
-       <input type="submit" value="{t}Save{/t}"        name="SaveSubObject">&nbsp;
-       <input type="submit" value="{t}Abort{/t}"       name="CancelSubObject">
-</div>
-
diff --git a/plugins/admin/FAI/faiPackage.tpl b/plugins/admin/FAI/faiPackage.tpl
deleted file mode 100644 (file)
index d72310d..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<table width="100%">
-       <tr>
-               <td width="50%" valign="top">
-                               <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2><br>
-                               <table summary="" cellspacing="4">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="cn">
-                                                       {t}Name{/t}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input value="{$cn}" disabled id="cn">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="description">
-                                                       {t}Description{/t}{$must}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input value="{$description}" {$description} name="description" id="description">
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
diff --git a/plugins/admin/FAI/faiPartitionTable.tpl b/plugins/admin/FAI/faiPartitionTable.tpl
deleted file mode 100644 (file)
index 6d3f622..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<table width="100%">
-       <tr>
-               <td width="50%" valign="top">
-                               <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2><br>
-                               <table summary="" cellspacing="4">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="cn">
-                                                       {t}Name{/t}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input value="{$cn}" disabled id="cn">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="description">
-                                                       {t}Description{/t}{$must}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input value="{$description}" {$description} name="description" id="description">
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160);">
-                  &nbsp;
-               </td>
-               <td>
-                               <h2><img alt="" src="images/list_ogroup.png" align="middle" title="{t}Objects{/t}">&nbsp;
-                                       <LABEL for="SubObject">
-                                               {t}This partition table contains following disks{/t}
-                                       </LABEL>
-                               </h2><br>
-                               <table width="100%">
-                               <tr>
-                                       <td>
-                                               <select name="disks" title="{t}Choose a disk to delete or edit{/t}" style="width:350px;height:120px;" size=10 id="SubObject">
-                                                       {html_options values=$diskKeys output=$disks}
-                                               </select><br>
-                                               <input type="submit" name="AddDisk"     value="{t}Add{/t}"              title="{t}Add{/t}">
-                                               <input type="submit" name="EditDisk"    value="{t}Edit{/t}"    title="{t}Edit{/t}">
-                                               <input type="submit" name="DelDisk"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
-                                       </td>
-                               </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
diff --git a/plugins/admin/FAI/faiPartitionTableEntry.tpl b/plugins/admin/FAI/faiPartitionTableEntry.tpl
deleted file mode 100644 (file)
index 776905d..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<input type="hidden" name="TableEntryFrameSubmitted" value="1">
-<br>
-<h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
-<table>
-       <tr>
-               <td><LABEL for="DISK_cn">
-                       {t}Name{/t}
-                       </LABEL>&nbsp;{$must}
-               </td>
-               <td>
-                       <select name="DISK_cn" title="{t}Choose a disc name{/t}" {$DISK_cnACL} id="DISK_cn">
-                {html_options values=$cns output=$cns selected=$DISK_cn}
-            </select>
-               </td>
-       </tr>
-       <tr>
-               <td><LABEL for="DISK_description">
-                       {t}Description{/t}
-                       </LABEL>&nbsp;{$must}
-               </td>
-               <td>
-                       <input value="{$DISK_description}" name="DISK_description" id="DISK_description">
-               </td>
-       </tr>
-</table>
-<br>
-<p class="seperator">&nbsp;</p>
-<br>
-<h2><img alt="" src="images/editpaste.png" align="middle" title="{t}Partition entries{/t}">&nbsp;{t}Partition entries{/t}</h2>
-{$setup}
-<br>
-<input type="submit" name="AddPartition" value="{t}Add partition{/t}" >
-<br>   
-<br>
-<p class="seperator">&nbsp;</p>
-<br>
-<div style="align:right;" align="right">
-<input type="submit" name="SaveDisk" value="{t}Save{/t}" >
-<input type="submit" name="CancelDisk" value="{t}cancel{/t}" >
-</div>
diff --git a/plugins/admin/FAI/faiProfile.tpl b/plugins/admin/FAI/faiProfile.tpl
deleted file mode 100644 (file)
index 11185d2..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2><br>
-<table summary="" cellspacing="4">
-       <tr>
-               <td>
-                       <LABEL for="cn">
-                       {t}Name{/t}{$must}
-                       </LABEL>
-               </td>
-               <td>
-                       <input value="{$cn}" id="cn" name="cn">
-               </td>
-       </tr>
-       <tr>
-               <td>
-                       <LABEL for="description">
-                       {t}Description{/t}{$must}
-                       </LABEL>
-               </td>
-               <td>
-                       <input value="{$description}" {$description} name="description" id="description">
-               </td>
-       </tr>
-</table>
-<br>
-
-<table summary="" style="vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top;">
-  <div class="contentboxh">
-    <p class="contentboxh">
-     <LABEL for="userlist">{t}List of used class names{/t}</LABEL> 
-    </p>
-  </div>
-                       <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
-                               
-                               {$divlisthead}
-                       </div>
-                       <div style='height:4px;'>
-                       </div>
-                       <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
-                               {$divlist}
-                               <input type="hidden" name="edit_helper">
-                       </div>
-               </td>
-       </tr>
-</table>
diff --git a/plugins/admin/FAI/faiProfileEntry.tpl b/plugins/admin/FAI/faiProfileEntry.tpl
deleted file mode 100644 (file)
index b493523..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top;width:600px">
-  <div class="contentboxh">
-    <p class="contentboxh">
-     {t}List of FAI objects (Fully Automatic Installation){/t}
-    </p>
-  </div>
-  <div class="contentboxb">
-      {$faihead}
-  </div>
-  <div style='height:4px;'></div>
-  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
-      {$failist}
-    <input type=hidden name="edit_helper">
-  </div>
-  </td>
-  <td style="vertical-align:top;">
-   <div class="contentboxh">
-    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
-   </div>
-   <div class="contentboxb">
-   <p class="contentboxb">
-     {t}This menu allows you to select FAI class names and to add them to the currently edited profile.{/t}
-   </p>
-   </div>
-   <br>
-   <div class="contentboxh">
-    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
-   </div>
-   <div class="contentboxb">
-     <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-      {$alphabet}
-     </table>
-        <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-               <tr><td><input onChange='document.mainform.submit()' 
-                                                               type="checkbox" name="SShowTemplates"   {$SShowTemplatesCHK}>{t}Show only classes with templates{/t}</td></tr>
-               <tr><td><input onChange='document.mainform.submit()'
-                                                               type="checkbox" name="SShowScripts"             {$SShowScriptsCHK}>{t}Show only classes with scripts{/t}</td></tr>
-               <tr><td><input onChange='document.mainform.submit()'
-                                                               type="checkbox" name="SShowHooks"               {$SShowHooksCHK}>{t}Show only classes with hooks{/t}</td></tr>
-               <tr><td><input onChange='document.mainform.submit()'
-                                                               type="checkbox" name="SShowVariables"   {$SShowVariablesCHK}>{t}Show only classes with variables{/t}</td></tr>
-               <tr><td><input onChange='document.mainform.submit()'
-                                                               type="checkbox" name="SShowPackages"    {$SShowPackagesCHK}>{t}Show only classes with packages{/t}</td></tr>
-               <tr><td><input onChange='document.mainform.submit()'
-                                                               type="checkbox" name="SShowPartitions"  {$SShowPartitionsCHK}>{t}Show only classes with partitions{/t}</td></tr>
-        </table>
-     <table summary=""  style="width:100%;border-top:1px solid #B0B0B0;">
-     <tr>
-     <td>
-     <LABEL for "regex"><img alt="{t}Display objects matching{/t}" src="{$search_image}" align=middle title='{t}Display objects matching{/t}'></LABEL>
-     </td>
-     <td width="99%">
-     <input type='text' name='Sregex' maxlength='20' style='width:99%' value='{$Sregex}' id='filter' 
-     title='{t}Regular expression for matching object names{/t}' onChange="mainform.submit()">
-     </td>
-     </tr>
-     </table>
-                           {$apply}
-   </div>
-  </td>
-</tr>
-</table summary="">
-<div align="right" style="align:right;">
-       <input name="SaveSubObject" value="Use" type="submit">
-       <input name="CancelSubObject" value="Cancel" type="submit">
-</div>
-<input type="hidden" name="ignore">
diff --git a/plugins/admin/FAI/faiScript.tpl b/plugins/admin/FAI/faiScript.tpl
deleted file mode 100644 (file)
index 0d405a1..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<table width="100%">
-       <tr>
-               <td width="50%" valign="top">
-                               <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2><br>
-                               <table summary="" cellspacing="4">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="cn">
-                                                       {t}Name{/t}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input value="{$cn}" disabled id="cn">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="description">
-                                                       {t}Description{/t}{$must}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input value="{$description}" {$description} name="description" id="description">
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160);">
-                  &nbsp;
-               </td>
-               <td>
-                               <h2><img alt="" src="images/list_ogroup.png" align="middle" title="{t}Objects{/t}">&nbsp;
-                                       <LABEL for="SubObject">
-                                               {t}This bundle contains the following objects{/t}
-                                       </LABEL>
-                               </h2><br>
-                               <table width="100%">
-                               <tr>
-                                       <td>
-                                               <select name="SubObject" title="{t}Choose a script to delete or edit{/t}" style="width:350px;height:120px;" size=10 id="SubObject">
-                                                       {html_options values=$SubObjectKeys output=$SubObjects}
-                                               </select><br>
-                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}">
-                                               <input type="submit" name="EditSubObject"    value="{t}Edit{/t}"    title="{t}Edit{/t}">
-                                               <input type="submit" name="DelSubObject"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
-                                       </td>
-                               </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
diff --git a/plugins/admin/FAI/faiScriptEntry.tpl b/plugins/admin/FAI/faiScriptEntry.tpl
deleted file mode 100644 (file)
index e5d7a70..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-<input type="hidden" name="SubObjectFormSubmitted" value="1">
-<table width="100%" summary="">
-       <tr>
-               <td valign="top" width="50%">
-                       <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
-                               <table>
-                                       <tr>
-                                               <td>
-                                                       {t}Name{/t}&nbsp;{$must}
-                                               </td>
-                                               <td>
-                                                       <input value="{$Object_cn}" name="Object_cn">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       {t}Description{/t}&nbsp;{$must}
-                                               </td>
-                                               <td>
-                                                       <input value="{$Object_description}" name="Object_description">
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160);">
-           &nbsp;
-        </td>
-               <td valign="top">
-                               <h2><img alt="" src="images/edit.png" align="middle" title="{t}Script attributes{/t}">&nbsp;{t}Script attributes{/t}</h2>
-                               <table width="100%">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="Object_FAIpriority">
-                                                       {t}Priority{/t}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                   <select name="Object_FAIpriority" title="{t}Choose a priority{/t}" Object_FAIpriority>
-                                               {html_options values=$Object_FAIprioritys output=$Object_FAIprioritys selected=$Object_FAIpriority}
-                                       </select>
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
-<p class="seperator">&nbsp;</p>
-<h2><img alt="" src="images/envelope.png" align="middle" title="{t}Script attributes{/t}">&nbsp;
-       <LABEL for="Object_FAIscript">
-               {t}Script{/t}
-       </LABEL>
-       </h2>
-<div>
-       {t}Import script{/t} &nbsp;
-       <input type="file" name="ImportFile">&nbsp;
-       <input type="submit" name="ImportUpload" value="{t}Import{/t}">
-</div>
-<br>
-<table width="100%">
-    <tr>
-        <td>
-            <textarea name="Object_FAIscript" style="width:100%;height:300px;" id="Object_FAIscript">{$Object_FAIscript}</textarea>
-        </td>
-    </tr>
-</table>
-
-<br>
-<div style="align:right;" align="right">
-       <input type="submit" value="{t}Save{/t}"        name="SaveSubObject">&nbsp;
-       <input type="submit" value="{t}Abort{/t}"       name="CancelSubObject">
-</div>
-
diff --git a/plugins/admin/FAI/faiTemplate.tpl b/plugins/admin/FAI/faiTemplate.tpl
deleted file mode 100644 (file)
index e310be2..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<table width="100%">
-       <tr>
-               <td width="50%" valign="top">
-                               <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2><br>
-                               <table summary="" cellspacing="4">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="cn">
-                                                       {t}Name{/t}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input value="{$cn}" disabled id="cn">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="description">
-                                                       {t}Description{/t}{$must}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input value="{$description}" {$description} name="description" id="description">
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160);">
-                  &nbsp;
-               </td>
-               <td>
-                               <h2><img alt="" src="images/fai_template.png" align="middle" title="{t}Objects{/t}">&nbsp;
-                                       <LABEL for="SubObject">
-                                               {t}This bundle contains the following objects{/t}
-                                       </LABEL>
-                               </h2><br>
-                               <table width="100%">
-                               <tr>
-                                       <td>
-                                               <select name="SubObject" title="{t}Choose a template to delete or edit{/t}" style="width:350px;height:120px;" size=10 id="SubObject">
-                                                       {html_options values=$SubObjectKeys output=$SubObjects}
-                                               </select><br>
-                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}">
-                                               <input type="submit" name="EditSubObject"    value="{t}Edit{/t}"    title="{t}Edit{/t}">
-                                               <input type="submit" name="DelSubObject"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
-                                       </td>
-                               </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
diff --git a/plugins/admin/FAI/faiTemplateEntry.tpl b/plugins/admin/FAI/faiTemplateEntry.tpl
deleted file mode 100644 (file)
index 44c3bf8..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<input type="hidden" name="SubObjectFormSubmitted" value="1">
-<table width="100%" summary="">
-       <tr>
-               <td valign="top" width="50%">
-                       <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
-                               <table>
-                                       <tr>
-                                               <td>
-                                                       {t}Name{/t}&nbsp;{$must}
-                                               </td>
-                                               <td>
-                                                       <input value="{$Object_cn}" name="Object_cn">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       {t}Description{/t}&nbsp;{$must}
-                                               </td>
-                                               <td>
-                                                       <input value="{$Object_description}" name="Object_description">
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160);">
-           &nbsp;
-        </td>
-               <td>
-                               <h2><img alt="" src="images/fai_template.png" align="middle" title="{t}Template attributes{/t}">&nbsp;{t}Template attributes{/t}</h2>
-                               <table width="100%">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="Object_FAItemplatePath">
-                                                       {t}Path{/t}&nbsp;{$must}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input type="text" name="Object_FAItemplatePath" value="{$Object_FAItemplatePath}" id="Object_FAItemplatePath">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="Object_FAItemplateFile">
-                                                       {t}File{/t}&nbsp;{$must}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input type="text" name="Object_FAItemplateFile" value="{$Object_FAItemplateFile}" id="Object_FAItemplateFile">
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
-<p class="seperator">&nbsp;</p>
-<br>
-<div style="align:right;" align="right">
-       <input type="submit" value="{t}Save{/t}"        name="SaveSubObject">&nbsp;
-       <input type="submit" value="{t}Abort{/t}"       name="CancelSubObject">
-</div>
-
diff --git a/plugins/admin/FAI/faiVariable.tpl b/plugins/admin/FAI/faiVariable.tpl
deleted file mode 100644 (file)
index cc3871e..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<table width="100%">
-       <tr>
-               <td width="50%" valign="top">
-                               <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2><br>
-                               <table summary="" cellspacing="4">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="cn">
-                                                       {t}Name{/t}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input value="{$cn}" disabled id="cn">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="description">
-                                                       {t}Description{/t}{$must}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input value="{$description}" {$description} name="description" id="description">
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160);">
-                  &nbsp;
-               </td>
-               <td>
-                               <h2><img alt="" src="images/fai_variable.png" align="middle" title="{t}Objects{/t}">&nbsp;
-                                       <LABEL for="SubObject">
-                                               {t}This bundle contains the following objects{/t}
-                                       </LABEL>
-                               </h2><br>
-                               <table width="100%">
-                               <tr>
-                                       <td>
-                                               <select name="SubObject" title="{t}Choose a variable to delete or edit{/t}" style="width:350px;height:120px;" size=10 id="SubObject">
-                                                       {html_options values=$SubObjectKeys output=$SubObjects}
-                                               </select><br>
-                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}">
-                                               <input type="submit" name="EditSubObject"    value="{t}Edit{/t}"    title="{t}Edit{/t}">
-                                               <input type="submit" name="DelSubObject"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
-                                       </td>
-                               </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
diff --git a/plugins/admin/FAI/faiVariableEntry.tpl b/plugins/admin/FAI/faiVariableEntry.tpl
deleted file mode 100644 (file)
index 131e7d1..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<input type="hidden" name="SubObjectFormSubmitted" value="1">
-<table width="100%" summary="">
-       <tr>
-               <td valign="top" width="50%">
-                       <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
-                               <table>
-                                       <tr>
-                                               <td>
-                                                       {t}Name{/t}&nbsp;{$must}
-                                               </td>
-                                               <td>
-                                                       <input value="{$Object_cn}" name="Object_cn">
-                                               </td>
-                                       </tr>
-                                       <tr>
-                                               <td>
-                                                       {t}Description{/t}&nbsp;{$must}
-                                               </td>
-                                               <td>
-                                                       <input value="{$Object_description}" name="Object_description">
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-               <td style="border-left: 1px solid rgb(160, 160, 160);">
-           &nbsp;
-        </td>
-               <td valign="top">
-                               <h2><img alt="" src="images/fai_variable.png" align="middle" title="{t}Variable attributes{/t}">&nbsp;{t}Variable attributes{/t}</h2>
-                               <table width="100%">
-                                       <tr>
-                                               <td>
-                                                       <LABEL for="Content">
-                                                       {t}Variable Content{/t}{$must}
-                                                       </LABEL>
-                                               </td>
-                                               <td>
-                                                       <input type="text" name="Object_FAIvariableContent" value="{$Object_FAIvariableContent}" id="Content" style="width:250px;">
-                                               </td>
-                                       </tr>
-                               </table>
-               </td>
-       </tr>
-</table>
-<p class="seperator">&nbsp;</p>
-<br>
-<div style="align:right;" align="right">
-       <input type="submit" value="{t}Save{/t}"        name="SaveSubObject">&nbsp;
-       <input type="submit" value="{t}Abort{/t}"       name="CancelSubObject">
-</div>
-
diff --git a/plugins/admin/FAI/headpage.tpl b/plugins/admin/FAI/headpage.tpl
deleted file mode 100644 (file)
index 2a4714c..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top;width:600px">
-  <div class="contentboxh">
-    <p class="contentboxh">
-     {t}List of FAI objects (Fully Automatic Installation){/t}
-    </p>
-  </div>
-  <div class="contentboxb">
-      {$faihead}
-  </div>
-  <div style='height:4px;'></div>
-  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
-      {$failist}
-    <input type=hidden name="edit_helper">
-  </div>
-  </td>
-  <td style="vertical-align:top;">
-   <div class="contentboxh">
-    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
-   </div>
-   <div class="contentboxb">
-   <p class="contentboxb">
-     {t}This menu allows you to create, delete and edit FAI objects.{/t}
-   </p>
-   </div>
-   <br>
-   <div class="contentboxh">
-    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
-   </div>
-   <div class="contentboxb">
-     <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-      {$alphabet}
-     </table>
-        <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-               <tr><td><input onChange='document.mainform.submit();' type="checkbox" name="ShowProfiles"               {$ShowProfilesCHK}>{t}Show profiles{/t}</td></tr>
-               <tr><td><input onChange='document.mainform.submit();' type="checkbox" name="ShowTemplates"      {$ShowTemplatesCHK}>{t}Show templates{/t}</td></tr>
-               <tr><td><input onChange='document.mainform.submit();' type="checkbox" name="ShowScripts"                {$ShowScriptsCHK}>{t}Show scripts{/t}</td></tr>
-               <tr><td><input onChange='document.mainform.submit();' type="checkbox" name="ShowHooks"          {$ShowHooksCHK}>{t}Show hooks{/t}</td></tr>
-               <tr><td><input onChange='document.mainform.submit();' type="checkbox" name="ShowVariables"      {$ShowVariablesCHK}>{t}Show variables{/t}</td></tr>
-               <tr><td><input onChange='document.mainform.submit();' type="checkbox" name="ShowPackages"               {$ShowPackagesCHK}>{t}Show packages{/t}</td></tr>
-               <tr><td><input onChange='document.mainform.submit();' type="checkbox" name="ShowPartitions"     {$ShowPartitionsCHK}>{t}Show partitions{/t}</td></tr>
-        </table>
-     <table summary=""  style="width:100%;border-top:1px solid #B0B0B0;">
-     <tr>
-     <td>
-     <LABEL for "regex"><img alt="{t}Display objects matching{/t}" src="{$search_image}" align=middle title='{t}Display objects matching{/t}'></LABEL>
-     </td>
-     <td width="99%">
-     <input type='text' name='regex' maxlength='20' style='width:99%' value='{$regex}' id='filter' 
-     title='{t}Regular expression for matching object names{/t}' onChange="mainform.submit()">
-     </td>
-     </tr>
-     </table>
-                           {$apply}
-   </div>
-  </td>
-</tr>
-</table summary="">
-
-<input type="hidden" name="ignore">
diff --git a/plugins/admin/FAI/main.inc b/plugins/admin/FAI/main.inc
deleted file mode 100644 (file)
index 36d3c50..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-/*
-  This code is part of GOsa (https://gosa.gonicus.de)
-  Copyright (C) 2003  Cajus Pollmeier
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-if ($remove_lock){
-        if(isset($_SESSION['FAI'])){
-                $FAI= $_SESSION['FAI'];
-                $FAI->remove_lock();
-                del_lock ($ui->dn);
-                sess_del ('FAI');
-        }
-} else {
-       /* Create usermanagement object on demand */
-       if (!isset($_SESSION['FAI']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
-               $_SESSION['FAI']= new faiManagement($config, $ui);
-       }
-       $FAI= $_SESSION['FAI'];
-       $output= $FAI->execute();
-
-       /* Page header*/
-       if (isset($_SESSION['objectinfo'])){
-               $display= print_header(get_template_path('images/fai.png'), _("FAI management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".$_SESSION['objectinfo']);
-       } else {
-               $display= print_header(get_template_path('images/fai.png'), _("FAI management"));
-       }
-
-       /* Reset requested? */
-       if (isset($_GET['reset']) && $_GET['reset'] == 1){
-               del_lock ($ui->dn);
-               sess_del ('FAI');
-       }
-
-       /* Show and save dialog */
-       $FAI->save_object();
-       $display.= $output;
-       $_SESSION['FAI']= $FAI;
-}
-
-?>
diff --git a/plugins/admin/FAI/remove.tpl b/plugins/admin/FAI/remove.tpl
deleted file mode 100644 (file)
index 2d1deee..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<div style="font-size:18px;">
-<img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
-</div>
-
-<p>
- {$warning}
- {t}This includes <b>all</b> object informations. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
-</p>
-
-<p>
- {t}Best thing to do before performing this action would be to save the current contents of your LDAP tree in a file. So - if you've done so - press <i>Delete</i> to continue or <i>Cancel</i> to abort.{/t}
-</p>
-
-<p class="plugbottom">
-  <input type=submit name="delete_terminal_confirm" value="{t}Delete{/t}">
-  &nbsp;
-  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
-</p>
diff --git a/plugins/admin/FAI/tabsHook.inc b/plugins/admin/FAI/tabsHook.inc
deleted file mode 100644 (file)
index f438f82..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-class tabsHook extends tabs
-{
-  var $base= "";
-
-  function tabsHook($config, $data, $dn)
-  {
-       tabs::tabs($config, $data, $dn);
-  }
-
-  function check()
-  {
-       return (tabs::check(TRUE));
-  }
-  
-
-  function save()
-  {
-       $baseobject= $this->by_object['faiHook'];
-
-       $new_dn= 'cn='.$baseobject->cn.",ou=hooks,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE'];
-
-       if ($this->dn != $new_dn && $this->dn != "new"){
-               
-               /* if( new_dn is subtree of this->dn ) */
-               $cnt1 = count(split(",",$this->dn));
-               $cnt2 = count(split(",",$new_dn));
-               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
-                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
-               }else{
-                       $baseobject->recursive_move($this->dn, $new_dn);
-               }
-       }
-       $this->dn= $new_dn;
-
-       tabs::save(TRUE);
-  }
-
-}
-
-?>
diff --git a/plugins/admin/FAI/tabsPackage.inc b/plugins/admin/FAI/tabsPackage.inc
deleted file mode 100644 (file)
index fdb1cb5..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-class tabsPackage extends tabs
-{
-  var $base= "";
-
-  function tabsPackage($config, $data, $dn)
-  {
-       tabs::tabs($config, $data, $dn);
-  }
-
-  function check()
-  {
-       return (tabs::check(TRUE));
-  }
-  
-
-  function save()
-  {
-       $baseobject= $this->by_object['faiPackage'];
-
-       $new_dn= 'cn='.$baseobject->cn.",ou=packages,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE'];
-       
-       if ($this->dn != $new_dn && $this->dn != "new"){
-               
-               /* if( new_dn is subtree of this->dn ) */
-               $cnt1 = count(split(",",$this->dn));
-               $cnt2 = count(split(",",$new_dn));
-               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
-                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
-               }else{
-                       $baseobject->recursive_move($this->dn, $new_dn);
-               }
-       }
-       $this->dn= $new_dn;
-
-       tabs::save(TRUE);
-  }
-
-}
-
-?>
diff --git a/plugins/admin/FAI/tabsPartition.inc b/plugins/admin/FAI/tabsPartition.inc
deleted file mode 100644 (file)
index d61396d..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-class tabsPartition extends tabs
-{
-  var $base= "";
-
-  function tabsPartition($config, $data, $dn)
-  {
-       tabs::tabs($config, $data, $dn);
-  }
-
-  function check()
-  {
-       return (tabs::check(TRUE));
-  }
-  
-
-  function save()
-  {
-       $baseobject= $this->by_object['faiPartitionTable'];
-
-       // cn=FAIBASE,ou=disk,ou=fai,ou=configs,ou=systems,dc=gonicus,dc=de
-       $new_dn= 'cn='.$baseobject->cn.",ou=disk,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE'];
-       
-       // Old .. $new_dn= 'ou='.$baseobject->ou.','.$baseobject->base;
-
-       if ($this->dn != $new_dn && $this->dn != "new"){
-               
-               /* if( new_dn is subtree of this->dn ) */
-               $cnt1 = count(split(",",$this->dn));
-               $cnt2 = count(split(",",$new_dn));
-               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
-                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
-               }else{
-                       $baseobject->recursive_move($this->dn, $new_dn);
-               }
-       }
-       $this->dn= $new_dn;
-
-       tabs::save(TRUE);
-  }
-
-}
-
-?>
diff --git a/plugins/admin/FAI/tabsProfile.inc b/plugins/admin/FAI/tabsProfile.inc
deleted file mode 100644 (file)
index 97dcdb0..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-class tabsProfile extends tabs
-{
-  var $base= "";
-
-  function tabsProfile($config, $data, $dn)
-  {
-       tabs::tabs($config, $data, $dn);
-  }
-
-  function check()
-  {
-       return (tabs::check(TRUE));
-  }
-  
-
-  function save()
-  {
-       $baseobject= $this->by_object['faiProfile'];
-
-       $new_dn= 'cn='.$baseobject->cn.",ou=profiles,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE'];
-       
-       if ($this->dn != $new_dn && $this->dn != "new"){
-               
-               /* if( new_dn is subtree of this->dn ) */
-               $cnt1 = count(split(",",$this->dn));
-               $cnt2 = count(split(",",$new_dn));
-               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
-                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
-               }else{
-                       $baseobject->recursive_move($this->dn, $new_dn);
-               }
-       }
-       $this->dn= $new_dn;
-
-       tabs::save(TRUE);
-  }
-
-}
-
-?>
diff --git a/plugins/admin/FAI/tabsScript.inc b/plugins/admin/FAI/tabsScript.inc
deleted file mode 100644 (file)
index cb6dcf3..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-class tabsScript extends tabs
-{
-  var $base= "";
-
-  function tabsScript($config, $data, $dn)
-  {
-       tabs::tabs($config, $data, $dn);
-  }
-
-  function check()
-  {
-       return (tabs::check(TRUE));
-  }
-  
-
-  function save()
-  {
-       $baseobject= $this->by_object['faiScript'];
-
-       $new_dn= 'cn='.$baseobject->cn.",ou=scripts,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE'];
-       
-       if ($this->dn != $new_dn && $this->dn != "new"){
-               
-               /* if( new_dn is subtree of this->dn ) */
-               $cnt1 = count(split(",",$this->dn));
-               $cnt2 = count(split(",",$new_dn));
-               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
-                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
-               }else{
-                       $baseobject->recursive_move($this->dn, $new_dn);
-               }
-       }
-       $this->dn= $new_dn;
-
-       tabs::save(TRUE);
-  }
-
-}
-
-?>
diff --git a/plugins/admin/FAI/tabsTemplate.inc b/plugins/admin/FAI/tabsTemplate.inc
deleted file mode 100644 (file)
index ada68ce..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-class tabsTemplate extends tabs
-{
-  var $base= "";
-
-  function tabsTemplate($config, $data, $dn)
-  {
-       tabs::tabs($config, $data, $dn);
-  }
-
-  function check()
-  {
-       return (tabs::check(TRUE));
-  }
-  
-
-  function save()
-  {
-       $baseobject= $this->by_object['faiTemplate'];
-
-       $new_dn= 'cn='.$baseobject->cn.",ou=templates,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE'];
-       
-       if ($this->dn != $new_dn && $this->dn != "new"){
-               
-               /* if( new_dn is subtree of this->dn ) */
-               $cnt1 = count(split(",",$this->dn));
-               $cnt2 = count(split(",",$new_dn));
-               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
-                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
-               }else{
-                       $baseobject->recursive_move($this->dn, $new_dn);
-               }
-       }
-       $this->dn= $new_dn;
-
-       tabs::save(TRUE);
-  }
-
-}
-
-?>
diff --git a/plugins/admin/FAI/tabsVariable.inc b/plugins/admin/FAI/tabsVariable.inc
deleted file mode 100644 (file)
index 86a8851..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-
-class tabsVariable extends tabs
-{
-  var $base= "";
-
-  function tabsVariable($config, $data, $dn)
-  {
-       tabs::tabs($config, $data, $dn);
-  }
-
-  function check()
-  {
-       return (tabs::check(TRUE));
-  }
-  
-
-  function save()
-  {
-       $baseobject= $this->by_object['faiVariable'];
-
-       $new_dn= 'cn='.$baseobject->cn.",ou=variables,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE'];
-       
-       if ($this->dn != $new_dn && $this->dn != "new"){
-               
-               /* if( new_dn is subtree of this->dn ) */
-               $cnt1 = count(split(",",$this->dn));
-               $cnt2 = count(split(",",$new_dn));
-               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
-                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
-               }else{
-                       $baseobject->recursive_move($this->dn, $new_dn);
-               }
-       }
-       $this->dn= $new_dn;
-
-       tabs::save(TRUE);
-  }
-
-}
-
-?>
diff --git a/plugins/admin/fai/askClassName.tpl b/plugins/admin/fai/askClassName.tpl
new file mode 100644 (file)
index 0000000..b73f962
--- /dev/null
@@ -0,0 +1,48 @@
+<div style="font-size: 18px;">
+       {$headline}
+       <br><br>
+</div>
+       {t}Please select a class name for this object. The class name specifies a set of configurations.{/t}
+       <br>
+       {t}Every Class name must be unique. But it can be used for different objects at the same time.<br/>If you use this class name in a profile, all object with this class name will be included to this profile.{/t}
+       <br>
+       <br>
+       {t}The list box below shows all available class names you may use, for this object, to avoid duplicates.{/t}
+<br>
+<br>
+<table >
+       <tr>
+               <td colspan="2"><b>
+                       {t}You can select of one the following class names for this object.{/t}
+               </b></td>
+       </tr>
+       <tr>
+               <td><b>{t}Available class names.{/t}</b>
+               </td>
+               <td>
+           <select name="SelectedClass" title="{t}Choose class name{/t}" style="width:120px;">
+                       {html_options values=$ClassNameKeys output=$ClassNames}
+       </select>
+               <input type="submit" name="UseSelectedClass" value="{t}Use{/t}" {$ClassNamesAvailable}> 
+               </td>
+       </tr>
+       <tr>
+               <td colspan="2"><br>
+               </td>
+       </tr>
+       <tr>
+               <td colspan="2"><b>
+                       {t}Please enter your class name here, if want to create a new class.{/t}
+               </b></td>
+       </tr>
+       <tr>
+               <td><b>{t}A new class name.</b>{/t}
+               </td>
+               <td>
+               <input type="text"       name="UseTextInputName" value="" style="width:120px;">
+               <input type="submit" name="UseNewClass" value="{t}Use{/t}"> 
+               </td>
+       </tr>
+</table>
+<p class="seperator">&nbsp;</p>
+       
diff --git a/plugins/admin/fai/class_askClassName.inc b/plugins/admin/fai/class_askClassName.inc
new file mode 100644 (file)
index 0000000..a2b380e
--- /dev/null
@@ -0,0 +1,149 @@
+<?php
+
+class askClassName extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage server basic objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account = TRUE;
+  var $attributes     = array();
+  var $objectclasses  = array("whatever");
+
+  var $objectClass    = false;
+  var $forbidden      =array();
+  var $ClassName          = "";  
+  var $ClassAlreadyExists = false;
+
+  function askClassName ($config, $dn= NULL,$ui = false, $objectClass)
+  {
+    $this->ui = $ui;
+    $this->objectClass = $objectClass;
+    plugin::plugin ($config, $dn);
+  }
+
+  function execute()
+  {
+    /* Fill templating stuff */
+    $smarty = get_smarty();
+    $display= "";
+
+    /* The faifilter contais 
+       The base for all fai objects 
+     */
+    $faifilter = $_SESSION['faifilter'];
+
+    /* First search for every ou, in given fai base
+     * With a second search detect all object that belong to the different ous. 
+     */
+    $ldap = $this->config->get_ldap_link();
+    $res  = get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)",FALSE, $faifilter['base'], array("cn","description","objectClass"),TRUE);
+    $used = array();
+
+    $delete = array();
+    foreach($res as $objecttypes){
+      $res2 = get_list2($this->ui->subtreeACL, "(objectClass=*)",
+          FALSE, $objecttypes['dn'], array("cn","description","objectClass","FAIclass"),TRUE);
+
+      foreach($res2 as $object){
+      
+        /* skip class names with this name */ 
+        if(in_array($this->objectClass,$object['objectClass'])){
+          $delete[] = $object['cn'][0];
+        }
+    
+        /* Skip profiles */
+        if(!in_array("FAIprofile",$object['objectClass'])){
+          $used[$object['cn'][0]]= $object['cn'][0];
+        }
+      }
+    }
+    
+    /* Create headline
+     * Depending on the object type we want to create, a different headline will be shown
+     */ 
+    switch($this->objectClass) {
+      case "FAIpartitionTable":  $str =_("Create new FAI object - partition table.");break;
+      case "FAIpackageList"   :  $str =_("Create new FAI object - package bundle.");break;
+      case "FAIscript"        :  $str =_("Create new FAI object - script bundle.");break;
+      case "FAIvariable"      :  $str =_("Create new FAI object - variable bundle.");break;
+      case "FAIhook"          :  $str =_("Create new FAI object - hook bundle.");break;
+      case "FAIprofile"       :  $str =_("Create new FAI object - profile.");break;
+      case "FAItemplate"      :  $str =_("Create new FAI object - template.");break;
+      default                 :  $str =_("Create new FAI object");break;
+    }
+    $smarty->assign("headline",$str);
+    
+    /* Save forbidden class names
+     */
+    $this->forbidden = $delete;
+
+    /* Delete all class names which already have this type of object 
+     */
+    foreach($delete as $del){
+      unset($used[$del]);
+    }
+   
+    /* if there is no class name which is missing for this type 
+     *  of objectClass, we only can create a new one, disable selectBox 
+     */
+    if(count ($used)==0){
+      $smarty->assign("ClassNamesAvailable", " disabled ");
+    }else{
+      $smarty->assign("ClassNamesAvailable", "");
+    }
+    $smarty->assign("ClassNames", $used);
+    $smarty->assign("ClassNameKeys", $used);
+    $display.= $smarty->fetch(get_template_path('askClassName.tpl', TRUE));
+    return($display);
+  }
+
+  /* Get posts and set class name 
+   */ 
+  function save_object()
+  {
+    if(isset($_POST['UseNewClass'])){
+      $this->ClassName          = $_POST['UseTextInputName'];
+      $this->ClassAlreadyExists = true;
+    }
+  
+    if(isset($_POST['UseSelectedClass'])){
+      $this->ClassAlreadyExists = false;
+      $this->ClassName          = $_POST['SelectedClass'];
+    }
+  }
+
+
+  /* Check given class name 
+   */
+  function check()
+  {
+    $message= array();
+    if(empty($this->ClassName)){
+      $message[]=_("The given class name is empty.");
+    }
+
+    if(in_array($this->ClassName,$this->forbidden)){
+      $message[]=_("The specified class name is already in use for this object type.");
+    }
+
+    if(preg_match("/[^a-z0-9]/i",$this->ClassName)){
+      $message[]=_("Please enter a valid class name. Only 0-9 a-z is allowed here.");
+    }
+    return ($message);
+  }
+
+
+  /* Return the class name */
+  function save()
+  {
+    return($this->ClassName);
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/fai/class_faiHook.inc b/plugins/admin/fai/class_faiHook.inc
new file mode 100644 (file)
index 0000000..c7edf19
--- /dev/null
@@ -0,0 +1,291 @@
+<?php
+
+class faiHook extends plugin
+{
+  /* CLI vars */
+  var $cli_summary      = "Manage server basic objects";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account   = TRUE;
+
+  /* Attributes for this Object */
+  var $attributes       = array("cn","description");
+
+  /* ObjectClasses for this Object*/
+  var $objectclasses    = array("top","FAIclass","FAIhook");
+
+  /* Class name of the Ldap ObjectClass for the Sub Object */
+  var $subClass         = "FAIhookEntry";
+  var $subClasses       = array("top","FAIclass","FAIhookEntry");
+
+  /* Class name of the php class which allows us to edit a Sub Object */
+  var $subClassName     = "faiHookEntry";      
+
+  /* Attributes to initialise for each subObject */
+  var $subAttributes    = array("cn","description","FAItask","FAIscript"); 
+  var $sub64coded       = array("FAItask","FAIscript");
+
+  /* Specific attributes */
+  var $cn               = "";       // The class name for this object
+  var $description      = "";       // The description for this set of partitions
+  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
+  var $dialog           = NULL;     // a dialog, e.g. new disk dialog
+  var $SubObjects       = array();  // All leafobjects of this object
+
+  function faiHook ($config, $dn= NULL)
+  {
+    /* Load Attributes */
+    plugin::plugin ($config, $dn);
+
+    /* If "dn==new" we try to create a new entry
+     * Else we must read all objects from ldap which belong to this entry.
+     */
+    if($dn != "new"){
+      $this->dn =$dn;
+
+      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
+       */
+      $ldap     = $this->config->get_ldap_link();
+      $ldap->cd ($this->dn);
+      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$this->subAttributes);
+
+      while($object = $ldap->fetch()){
+        /* Set status for save management */
+  
+        foreach($this->subAttributes as $attrs){
+          if(!isset($object[$attrs][0])){
+            $this->SubObjects[$object['cn'][0]][$attrs]="";
+          }else{
+            $this->SubObjects[$object['cn'][0]][$attrs]=$object[$attrs][0];
+          }
+        }
+      
+        $this->SubObjects[$object['cn'][0]]['status']      = "edited";
+        $this->SubObjects[$object['cn'][0]]['dn']          = $object['dn'];
+
+        foreach($this->sub64coded as $codeIt){
+          $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
+        }
+
+      }
+    }
+  }
+
+  function execute()
+  {
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* Add new sub object */
+    if(isset($_POST['AddSubObject'])){
+      $this->dialog= new $this->subClassName($this->config,"new");
+      $this->is_dialog=true;
+    }
+
+    /* Edit selected Sub Object */
+    if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
+      $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$_POST['SubObject']]);
+      $this->is_dialog=true;
+    }
+    
+    /* Remove Sub object */
+    if((isset($_POST['DelSubObject']))&&(isset($_POST['SubObject']))){
+      if($this->SubObjects[$_POST['SubObject']]['status'] == "edited"){
+        $this->SubObjects[$_POST['SubObject']]['status']= "delete";
+      }else{
+        unset($this->SubObjects[$_POST['SubObject']]);
+      }
+    }
+
+    /* Save Dialog */
+    if(isset($_POST['SaveSubObject'])){
+
+      /* Perform post check*/
+      $this->dialog->save_object();
+
+      /* Get messages */
+      $msgs = $this->dialog->check();
+
+      /* print errors */
+      if(count($msgs)>0){
+        foreach($msgs as $msg){
+          print_red($msg);
+        }
+      }else{
+
+        /* Get return object */
+        $obj = $this->dialog->save();
+        if(isset($obj['remove'])){
+
+          /* Depending on status, set new status */
+          if($this->SubObjects[$obj['remove']['from']]['status']=="edited"){
+            $this->SubObjects[$obj['remove']['from']]['status'] = "delete";
+          }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){
+            unset($this->SubObjects[$obj['remove']['from']]);
+          }
+          $obj['status'] = "new";
+          $this->SubObjects[$obj['remove']['to']] = $obj;
+          unset($this->SubObjects[$obj['remove']['to']]['remove']);
+        }else{
+          $this->SubObjects[$obj['cn']]=$obj;
+        }
+        $this->is_dialog=false;
+        unset($this->dialog);
+        $this->dialog=NULL;
+      }
+    }
+
+    /* Cancel Dialog */
+    if(isset($_POST['CancelSubObject'])){
+      $this->is_dialog=false; 
+      unset($this->dialog);
+      $this->dialog=NULL;
+    }
+
+    /* Print dialog if $this->dialog is set */
+    if($this->dialog){
+      $this->dialog->save_object();
+      $display = $this->dialog->execute();
+      return($display);
+    }
+
+    $smarty->assign("SubObjects",$this->getList());
+    $smarty->assign("SubObjectKeys",array_flip($this->getList()));
+    /* Assign variables */
+    foreach($this->attributes as $attrs){
+      $smarty->assign($attrs,$this->$attrs);
+    }
+
+    $display.= $smarty->fetch(get_template_path('faiHook.tpl', TRUE));
+    return($display);
+  }
+
+  /* Generate listbox friendly SubObject list
+  */
+  function getList(){
+    $a_return=array();
+    foreach($this->SubObjects as $obj){
+      if($obj['status'] != "delete"){
+        $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]";
+      }
+    }
+    return($a_return);
+  }
+
+  /* Delete me, and all my subtrees
+   */
+  function remove_from_parent()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+    $ldap->rmdir_recursive($this->dn);
+    $this->handle_post_events("remove");    
+  }
+
+
+  /* Save data to object 
+   */
+  function save_object()
+  {
+    plugin::save_object();
+    foreach($this->attributes as $attrs){
+      if(isset($_POST[$attrs])){
+        $this->$attrs = $_POST[$attrs];
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    $message= array();
+    $str = utf8_encode("üöä");
+    if((empty($this->description))||(preg_match("/[^a-z0-9".$str."\-.,;:_\? ]/i",$this->description))){
+      $message[]=_("Please enter a valid description.");
+    }
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+    $ldap = $this->config->get_ldap_link();
+
+    $ldap->cat($this->dn);
+    if($ldap->count()!=0){     
+      /* Write FAIscript to ldap*/ 
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      /* Write FAIscript to ldap*/ 
+      $ldap->cd($this->dn);
+      $ldap->create_missing_trees($this->dn);
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    show_ldap_error($ldap->get_error()); 
+    /* Prepare FAIscriptEntry to write it to ldap
+     * First sort array.
+     *  Because we must delete old entries first.
+     * After deletion, we perform add and modify 
+     */
+    $Objects = array();
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] == "delete"){
+        $Objects[$name] = $obj; 
+      }
+    }
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] != "delete"){
+        $Objects[$name] = $obj; 
+      }
+    }
+
+    foreach($Objects as $name => $obj){
+
+      foreach($this->sub64coded as $codeIt){
+        $obj[$codeIt]=base64_encode($obj[$codeIt]);
+      }
+
+      $tmp = array();
+      foreach($this->subAttributes as $attrs){
+        if(empty($obj[$attrs])){
+          $obj[$attrs] = array();
+        }
+        $tmp[$attrs] = $obj[$attrs];
+      }    
+
+      $tmp['objectClass'] = $this->subClasses;
+      
+      $sub_dn = "cn=".$obj['cn'].",".$this->dn;
+      if($obj['status'] == "delete"){
+        $ldap->cd($sub_dn);
+        $ldap->rmdir_recursive($sub_dn);
+        $this->handle_post_events("remove");
+      }elseif($obj['status'] == "edited"){
+        $ldap->cd($sub_dn);
+        $ldap->modify($tmp);
+        $this->handle_post_events("modify");
+      }elseif($obj['status']=="new"){
+        $ldap->cd($sub_dn);
+        $ldap->create_missing_trees($sub_dn);
+        $ldap->cd($sub_dn);
+        $ldap->add($tmp); 
+        $this->handle_post_events("add");
+      }
+      show_ldap_error($ldap->get_error()); 
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/fai/class_faiHookEntry.inc b/plugins/admin/fai/class_faiHookEntry.inc
new file mode 100644 (file)
index 0000000..a73c493
--- /dev/null
@@ -0,0 +1,123 @@
+<?php
+
+class faiHookEntry extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage server basic objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account= TRUE;
+  var $attributes   = array("Object_cn","Object_description","Object_FAIscript","Object_FAItask");
+  var $objectclasses= array();
+
+  var $orig_cn              = "";
+
+  var $Object_dn            = "";
+  var $Object_cn            = "";
+  var $Object_FAItask       = "";
+  var $Object_FAIscript     = "";
+  var $Object_description   = "";
+  var $Object_status        = "new";
+  
+  function faiHookEntry ($config, $dn= NULL,$object=false)
+  {
+    plugin::plugin ($config, $dn);
+    if($dn != "new"){
+      $this->orig_cn= $object['cn'];
+      $this->dn=$object['dn'];
+      foreach($object as $name=>$value){
+        $oname = "Object_".$name;
+        $this->$oname=$value;
+      }
+    }else{
+      $this->Object_status = "new";
+      $this->orig_cn       = false;
+    }
+  }
+
+  function execute()
+  {
+    /* Fill templating stuff */
+    $smarty     = get_smarty();
+    $display = "";
+
+    foreach($this->attributes as $attrs){
+      $smarty->assign($attrs,stripslashes($this->$attrs));
+    }
+
+    for($i =1 ; $i <= 100 ; $i++){
+      $Object_FAIprioritys[$i]=$i;
+    }
+    $smarty->assign("Object_FAIprioritys",$Object_FAIprioritys);
+    $display.= $smarty->fetch(get_template_path('faiHookEntry.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    if(isset($_POST['SubObjectFormSubmitted'])){
+      foreach($this->attributes as $attrs){
+        if(isset($_POST[$attrs])){
+          $this->$attrs = $_POST[$attrs];
+        }else{
+          $this->$attrs = "";
+        }
+      }
+    }
+  }
+
+  /* Check supplied data */
+  function check()
+  {
+    $message= array();
+    if(empty($this->Object_FAItask)) {
+      $message[]=_("Please enter a value for task.");
+    }
+    if(empty($this->Object_FAIscript)) {
+      $message[]=_("Please enter a value for script.");
+    }
+
+    $str = utf8_encode("üöä");
+
+    if(empty($this->Object_description)){
+      $message[] = _("Please enter a description.");
+    }
+
+    if(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->Object_description)){
+      $message[] = _("Invalid character in description. Please enter a valid description.");
+    }
+
+    if(empty($this->Object_cn)){
+      $message[] = _("Please enter a name.");
+    }
+
+    if(preg_match("/[^0-9a-z]/i",$this->Object_cn)){
+      $message[] = _("Please enter a valid name. Only a-Z 0-9 are allowed.");
+    }
+  
+    return ($message);
+  }
+  function save()
+  {
+    $tmp=array();
+    foreach($this->attributes as $attrs){ 
+      $attr = preg_replace("/^Object_/","",$attrs);
+      $tmp[$attr] = $this->$attrs;
+    }
+
+    if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
+      $tmp['remove']['from']  = $this->orig_cn;
+      $tmp['remove']['to']    = $tmp['cn'];
+    }
+  
+    $tmp['dn']      = $this->dn;  
+    $tmp['status']  = $this->Object_status;  
+    return($tmp);
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/fai/class_faiManagement.inc b/plugins/admin/fai/class_faiManagement.inc
new file mode 100644 (file)
index 0000000..7ec7329
--- /dev/null
@@ -0,0 +1,600 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2003  Cajus Pollmeier
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+require "tabsPartition.inc";
+require "tabsVariable.inc";
+require "tabsHook.inc";
+require "tabsTemplate.inc";
+require "tabsScript.inc";
+require "tabsProfile.inc";
+require "tabsPackage.inc";
+
+class faiManagement extends plugin
+{
+       /* Definitions */
+       var $plHeadline                 = "FAI management";
+       var $plDescription              = "Fully Automatic Installation - management";
+
+       /* CLI vars */
+       var $cli_summary                = "Handling of FAI entries";
+       var $cli_description    = "This plugin represents a management tool\n
+               which allows us to manage all needed attributes for fully automatic installations (FAI)";
+       var $cli_parameters             = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+       /* Headpage attributes */
+       var $departments= array();
+       var $deptabs= NULL;
+
+       /* attribute list for save action */
+       var $attributes                 = array();      //      Attributes Managed by this plugin, none, 
+       //      because this is only an overview over all objects already defined in FAI.
+       var $objectclasses              = array();      //      ObjectClasses which the attributes are related to
+       var $dialog                             = array();      //      This object contains every dialog we have currently opened
+
+       var $objects                    = array();      //      This array contains all available objects shown in divlist
+       var $is_dialog                  = false;
+
+       /* construction/reconstruction 
+        * The Filter ($faifilter stored in $_SESSION['faifilter']) defines the last 
+        *  selected department and filter options
+        * If it is not defined already we create a new fresh faifilter.
+        */
+       function faiManagement ($config, $ui)
+       {
+               $this->ui                       = $ui;  
+
+               /* Set current dn to "", */
+               $this->dn                       = "";
+
+               /* Assign config */
+               $this->config           = $config;
+
+               /* Get global filter config */
+               if (!is_global("faifilter")){
+                       $base   = get_base_from_people($ui->dn);
+                       $faifilter= array("base" => "ou=fai,ou=configs,ou=systems,".$base,
+                                       "regex" => "*");
+                       $faifilter['ShowProfiles']      = true;
+                       $faifilter['ShowTemplates'] = true;
+                       $faifilter['ShowScripts']       = true;
+                       $faifilter['ShowHooks']         = true;
+                       $faifilter['ShowVariables']     = true;
+                       $faifilter['ShowPackages']      = true;
+                       $faifilter['ShowPartitions']=true;
+                       register_global("faifilter", $faifilter);
+               }
+       }
+
+       function execute()
+       {
+               $display        = "";
+               $smarty         = get_smarty();
+               $s_action       = "";
+               $s_entry        = "";
+               /* filter management 
+                * Filter will be changed if POST['regex'] or $_GET['search'] isset
+                * New Filter will be stored in session and is used to generate list contents
+                */     
+               $faifilter = $_SESSION['faifilter'];
+
+               /* Filter is posted by apply button 
+                * Check every single chkbox 
+                */
+               if(isset($_POST['regex'])){
+                       $faifilter['regex'] = $_POST['regex']."*";
+                       foreach(array("ShowPartitions","ShowProfiles","ShowTemplates","ShowScripts","ShowHooks","ShowVariables","ShowPackages") as $attrs){
+                               if(isset($_POST[$attrs])){
+                                       $faifilter[$attrs] = true;
+                               }else{
+                                       $faifilter[$attrs] = false;
+                               }
+                       }
+               }
+
+               /* Check ImageButton posts
+                * Create new tab ich new_xx is posted
+                */
+               foreach($_POST as $key => $val){
+                       if(preg_match("/create_partition/i",$key)){
+                               $s_action = "new_partition";
+                       }elseif(preg_match("/create_script/i",$key)){
+                               $s_action = "new_script";
+                       }elseif(preg_match("/create_hook/i",$key)){
+                               $s_action = "new_hook";
+                       }elseif(preg_match("/create_variable/i",$key)){
+                               $s_action = "new_variable";
+                       }elseif(preg_match("/create_template/i",$key)){
+                               $s_action = "new_template";
+                       }elseif(preg_match("/create_package/i",$key)){
+                               $s_action = "new_package";
+                       }elseif(preg_match("/create_profile/i",$key)){
+                               $s_action = "new_profile";
+                       }elseif(preg_match("/UseNewClass/",$key)){
+                               $s_action = "select_class_name_finished";
+                       }elseif(preg_match("/UseSelectedClass/",$key)){
+                               $s_action = "select_class_name_finished";
+                       }elseif(preg_match("/^entry_edit_.*/",$key)){
+                               $s_entry = preg_replace("/^entry_edit_/","",$key);
+                               $s_entry = preg_replace("/_.*$/","",$s_entry);
+                               $s_action = "edit";
+                       }elseif(preg_match("/^entry_delete_.*/",$key)){
+                               $s_entry = preg_replace("/^entry_delete_/","",$key);
+                               $s_entry = preg_replace("/_.*$/","",$s_entry);
+                               $s_action = "delete";
+                       }
+
+               }
+
+               /* Confirm dialog 
+                * Delte object 
+         */
+               if ($s_action=="delete"){
+
+                       /* Get 'dn' from posted termlinst */
+                       $this->dn= $this->objects[$s_entry]['dn'];
+
+                       /* Load permissions for selected 'dn' and check if
+                          we're allowed to remove this 'dn' */
+                       $acl=           get_permissions ($this->dn, $this->ui->subtreeACL);
+                       $this->acl= get_module_permission($acl, "FAIclass", $this->dn);
+                       if (chkacl($this->acl, "delete") == ""){
+
+                               /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */
+                               if (($user= get_lock($this->dn)) != ""){
+                                       return(gen_locked_message ($user, $this->dn));
+                               }
+
+                               /* Lock the current entry, so nobody will edit it during deletion */
+                               add_lock ($this->dn, $this->ui->dn);
+                               $smarty->assign("warning", sprintf(_("You're about to delete all information about the component at '%s'."), $this->dn));
+                               return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+                       } else {
+
+                               /* Obviously the user isn't allowed to delete. Show message and
+                                  clean session. */
+                               print_red (_("You are not allowed to delete this component!"));
+                       }
+               }
+
+               /* Deltetion was confirmed, so delete this entry
+                */
+               if (isset($_POST['delete_terminal_confirm'])){
+
+                       /* Some nice guy may send this as POST, so we've to check
+                          for the permissions again. */
+                       if (chkacl($this->acl, "delete") == ""){
+
+                               /* Find out more about the object type */
+                               $ldap   = $this->config->get_ldap_link();
+                               $ldap->cat($this->dn);
+                               $attrs  = $ldap->fetch();
+
+                               $type   = $this->get_type($attrs);                      
+
+                               $this->dialog= new $type[0]($this->config,      $this->config->data['TABS'][$type[2]], $this->dn);
+                               $this->dialog->set_acl(array($this->acl));
+
+                               $this->dialog->by_object[$type[1]]->remove_from_parent ();
+                               unset ($this->dialog);
+                               gosa_log ("System object'".$this->dn."' has been removed");
+                               $this->dialog= NULL;
+
+                               /* Terminal list has changed, reload it. */
+                               $this->reload ();
+                       } else {
+
+                               /* Normally this shouldn't be reached, send some extra
+                                  logs to notify the administrator */
+                               print_red (_("You are not allowed to delete this component!"));
+                               gosa_log ("Warning: '".$this->ui->uid."' tried to trick system ".
+                                               "deletion.");
+                       }
+
+                       /* Remove lock file after successfull deletion */
+                       del_lock ($this->dn);
+               }
+
+               /* Edit Entry */
+               if($s_action == "edit"){
+                       $entry  = $this->objects[$s_entry];
+
+                       $a_setup = ($this->get_type($entry));
+               
+                       $this->dn = $entry['dn'];
+
+                       $this->dialog= new $a_setup[0]($this->config,
+                                       $this->config->data['TABS'][$a_setup[2]],$this->dn);
+                       $this->is_dialog = true;
+               }
+
+
+               /* Dialog handling */
+               if($s_action == "new_partition"){
+                       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIpartitionTable");
+               }
+
+               /* Dialog handling */
+               if($s_action == "new_script"){
+                       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIscript");
+               }
+
+               /* Dialog handling */
+               if($s_action == "new_hook"){
+                       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIhook");
+               }
+
+               /* Dialog handling */
+               if($s_action == "new_variable"){
+                       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIvariable");
+               }
+
+               /* Dialog handling */
+               if($s_action == "new_template"){
+                       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAItemplate");
+               }
+
+               /* Dialog handling */
+               if($s_action == "new_package"){
+                       $this->dialog = new askClassName($this->config,$this->dn,$this->ui,"FAIpackageList");
+               }
+
+               /* New Profile */
+               if($s_action == "new_profile"){
+                       $this->dn = "new" ;
+                       $a_setup= $this->get_type(array("objectClass"=>array("FAIprofile")));
+
+                       $this->dialog = new $a_setup[0]($this->config,
+                                       $this->config->data['TABS'][$a_setup[2]],$this->dn);
+                       $this->is_dialog = true;
+
+               }
+
+               if($s_action == "select_class_name_finished"){
+                       $this->dialog->save_object();
+                       if(count($this->dialog->check())!=0){
+                               foreach($this->dialog->check() as $msg){
+                                       print_red($msg);
+                               }               
+                       }else{
+                               $this->dn = "new" ;
+                               $a_setup= $this->get_type(array("objectClass"=>array($this->dialog->objectClass)));
+                               $name = $this->dialog->save();
+
+                               $this->dialog = new $a_setup[0]($this->config,
+                                               $this->config->data['TABS'][$a_setup[2]],$this->dn);
+                               $this->dialog->by_object[$a_setup[1]]->cn = $name;
+                               $this->is_dialog = true;
+                       }               
+               }       
+
+
+               /* Search is set */
+               if(isset($_GET['search'])){
+                       $faifilter['regex']=$_GET['search']."*";
+               }
+
+               /* remove double asterisks and save new filter */
+               $faifilter['regex'] = preg_replace("/\*\*/","*",$faifilter['regex']);
+               $_SESSION['faifilter']= $faifilter;
+
+               /* Edit dialog was canceled 
+                * Remove dialog an show management dialog
+                */
+               if(isset($_POST['edit_cancel'])){
+                       unset($this->dialog);
+                       $this->dialog=NULL;
+                       $this->is_dialog = false;
+               }
+
+
+               /* This check if the given tab could be saved 
+                * If it was possible to save it, remove dialog object. 
+                * If it wasn't possible, show errors and keep dialog.
+                */
+               if(isset($_POST['edit_finish'])){
+                       $this->dialog->save_object();
+                       if(count($this->dialog->check())!=0){
+                               foreach($this->dialog->check() as $msg){
+                                       print_red($msg);
+                               }
+                       }else{
+                               $this->dialog->save();
+                               unset($this->dialog);
+                               $this->dialog=NULL;
+                               $this->is_dialog=false;
+                       }
+               }
+
+
+               /* If dialog is set, but $this->is_dialog==false, then 
+                *  only the "abort" button is shown, this are dialogs that must not be saved.  
+                * If is_dialog == true, we are currently editing tab objects.
+                *  Here we need both, save and cancel
+                */ 
+
+               if($this->dialog != NULL){
+                       $display .= $this->dialog->execute();
+                       /* Don't show buttons if tab dialog requests this */
+                       if (((isset($this->dialog->current))&&($this->dialog->by_object[$this->dialog->current]->is_dialog))){
+                               
+                       }elseif(((isset($this->dialog->current))&&(!$this->dialog->by_object[$this->dialog->current]->is_dialog))){
+                               $display.= "<p style=\"text-align:right\">\n";
+                               $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+                               $display.= "&nbsp;\n";
+                               $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+                               $display.= "</p>";
+                       }elseif(!isset($this->dialog->current)){
+                               $display.= "<p style=\"text-align:right\">\n";
+                               $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+                               $display.= "</p>";
+                       }
+                       return($display);
+               }
+
+               /* Show Management template
+                * The following code will only be reached if no dialog (tabs or dialogs)
+                *  are currently opened.
+                * Assign all reguired vars to template engine
+                */
+
+               /* Create listhead, it will be shown on top of the divlist. 
+                * It provides general navigation and object creation
+                */
+               $faihead = 
+                       "<div style='background:#F0F0F9;padding:5px;'>&nbsp;".
+
+                       " <input type='image' src='images/fai_partitionTable.png' align='middle' 
+                       title='"._("New partition table")."' name='Create_partition' alt='"._("PT")."'>&nbsp;".
+
+                       " <input type='image' src='images/fai_script.png' align='middle' 
+                       title='"._("New script bundle")."' name='Create_script' alt='"._("S")."'>&nbsp;".
+
+                       " <input type='image' src='images/fai_hook.png' align='middle' 
+                       title='"._("New hook bundle")."' name='Create_hook' alt='"._("H")."'>&nbsp;".
+
+                       " <input type='image' src='images/fai_variable.png' align='middle' 
+                       title='"._("New variable bundle")."' name='Create_variable' alt='"._("V")."'>&nbsp;".
+                       
+                       " <input type='image' src='images/fai_template.png' align='middle' 
+                       title='"._("New template bundle")."' name='Create_template' alt='"._("T")."'>&nbsp;".
+
+                       " <input type='image' src='images/fai_packages.png' align='middle' 
+                       title='"._("New package bundle")."' name='Create_package' alt='"._("PK")."'>&nbsp;".
+                       
+                       "<img src=\"images/list_seperator.png\" alt=\"\" align=\"middle\" height=\"16\" width=\"1\">&nbsp;".
+                               
+                       " <input type='image' src='images/fai_profile.png' align='middle' 
+                       title='"._("New profile bundle")."' name='Create_profile' alt='"._("P")."'>&nbsp;".
+                       
+                       "</div>";
+
+               $this->reload();
+
+               /* Create list with objects */
+               $divlist = new divlist("faiManagement"); 
+               $divlist->SetEntriesPerPage(20);
+               $divlist->SetSummary(_("This table displays all systems, in the selected tree."));
+
+               $divlist->SetHeader(array(
+                                       array("string" => "&nbsp;"),
+                                       array("string" => _("FAI objects / ObjectClasses")),
+                                       array("string" => _("Object group")),
+                                       array("string" => _("Options"), "attach" => "style='border:none'" )));
+
+
+               $action  = "<input type='image' src='images/edit.png'   alt='"._("edit")."'   name='entry_edit_%KEY%' title='"._("Edit object")."'>";
+               $action .= "<input type='image' src='images/editdelete.png' alt='"._("delete")."' name='entry_delete_%KEY%' title='"._("Delete object")."'>";
+
+               /* Attach objects */
+               foreach($this->objects as $key => $value){
+                               $info= "";
+                               $img = "";
+                               $type = $value['type'];
+                               $abort=false;
+
+                               switch($type) {
+                                       case "FAIpartitionTable"        : 
+                                               if(!$faifilter['ShowPartitions']){ 
+                                                       $abort = true;
+                                               }
+                                       $img="<img src='images/fai_partitionTable.png' title='Partition table' alt='PT'>";
+                                       $info = _("Partition table");
+                                       break;
+                                       case "FAIpackageList"           : 
+                                               if(!$faifilter['ShowPackages']){ 
+                                                       $abort = true;
+                                               }
+                                       $img="<img src='images/fai_packages.png' title='Package list' alt='PL'>";
+                                       $info = _("Package list");
+                                       break;
+                                       case "FAIscript"                        : 
+                                               if(!$faifilter['ShowScripts']){ 
+                                                       $abort = true;
+                                               }
+                                       $img="<img src='images/fai_script' title='Set of scripts' alt='S'>";
+                                       $info = _("Script set");
+                                       break;
+                                       case "FAIvariable"                      : 
+                                               if(!$faifilter['ShowVariables']){ 
+                                                       $abort = true;
+                                               }
+                                       $img="<img src='images/fai_variable.png' title='Variable set' alt='V'>";
+                                       $info = _("Variable set");
+                                       break;
+                                       case "FAIhook"                          :
+                                               if(!$faifilter['ShowHooks']){ 
+                                                       $abort = true;
+                                               }
+                                       $img="<img src='images/fai_hook.png' title='Hooks' alt='H'>";
+                                       $info = _("Hook set");
+                                       break;
+                                       case "FAIprofile"                       : 
+                                               if(!$faifilter['ShowProfiles']){ 
+                                                       $abort = true;
+                                               }
+                                       $img="<img src='images/fai_profile.png' title='Profile' alt='P'>";
+                                       $info = _("Profile")." (".$value['FAIclass']." )";
+                                       break;
+                                       case "FAItemplate"                      : 
+                                               if(!$faifilter['ShowTemplates']){ 
+                                                       $abort = true;
+                                               }
+                                       $img="<img src='images/fai_template.png' title='Template' alt='T'>";
+                                       $info = _("Template");
+                                       break;
+                                       default                                         : 
+                                       $img="<img src='images/empty.png' >";$info = "";break;
+
+                               }
+                               if(!$abort)     {
+                                       if((isset($value['description']))&&(!empty($value['description']))){
+                                               $desc= " [".$value['description']."]";
+                                       }else{
+                                               $desc= "";
+                                       }
+
+                                       $field1 = array("string" => $img , "attach" => "style='height:26px;width=20px;'");
+                                       $field2 = array("string" => $value['cn'].$desc , "attach" => "");
+                                       $field3 = array("string" => $info, "attach" => "");
+                                       $field4 = array("string" => preg_replace("/%KEY%/",$key,$action) , "attach" => "style='border-right:none;'");
+                                       $divlist->AddEntry(array($field1,$field2,$field3,$field4));
+
+                       }
+               }
+
+               foreach($faifilter as $attrs => $value){
+                       if($value){
+                               $smarty->assign($attrs."CHK", " checked ");
+                       }else{
+                               $smarty->assign($attrs."CHK", " ");
+                       }
+               }
+
+               /* Assign all reguired vars to template engine */
+               $smarty->assign("faihead"               , $faihead);    
+               $smarty->assign("failist"               , $divlist->DrawList());
+               $smarty->assign("regex"                 , $faifilter['regex']); 
+               $smarty->assign("infoimage"             , get_template_path('images/info.png'));
+               $smarty->assign("launchimage"   , get_template_path('images/launch.png'));
+               $smarty->assign("alphabet"              , generate_alphabet());
+               $smarty->assign("apply"                 , apply_filter());
+               $smarty->assign("search_image"  , get_template_path('images/search.png'));
+
+               $display        = $smarty->fetch(get_template_path('headpage.tpl', TRUE, dirname(__FILE__)));
+               return ($display);
+       }
+
+
+       function reload()
+       {
+               /* Create a new list of FAI object 
+                * Object list depends on faifilter['regex']
+                * Generate List of Partitions,Hooks,Scripts,Templates,Profiles ... 
+                */
+               $faifilter= get_global('faifilter');
+               // Added for dirlist function...
+
+               /* Set base for all searches */
+               $base= $faifilter['base'];
+               $regex = $faifilter['regex'];   
+
+               /* Array to save objects */
+               $objects = array();
+       
+               $this->objects=array();
+
+               $res= get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)", 
+                               FALSE, $base, array("cn","description","objectClass"),TRUE);
+
+               foreach($res as $objecttypes){
+                       $res2 = get_list($this->ui->subtreeACL, "(&(objectClass=*)(cn=".$regex."))",
+                                       FALSE, $objecttypes['dn'], array("cn","description","objectClass","FAIclass"),TRUE);
+                       foreach($res2 as $object){
+                               $type= "";      
+                               unset($object['objectClass']['count']);
+                               if(!isset($object['description'][0])){
+                                       $object['description'][0]="";
+                               }
+                               
+                               /* Clean up object informations */
+                               $obj['cn']                      = $object['cn'][0];
+                               $obj['dn']                      = $object['dn'];
+                               $obj['description'] = $object['description'][0];
+                               $obj['objectClass'] = $object['objectClass'];
+
+                               if(in_array("FAIpartitionTable",$obj['objectClass'])){
+                                       $type = "FAIpartitionTable";
+                               }elseif(in_array("FAIpackageList",$obj['objectClass'])){
+                                       $type = "FAIpackageList";
+                               }elseif(in_array("FAIscript",$obj['objectClass'])){
+                                       $type = "FAIscript";
+                               }elseif(in_array("FAIvariable",$obj['objectClass'])){
+                                       $type = "FAIvariable";
+                               }elseif(in_array("FAIhook",$obj['objectClass'])){
+                                       $type = "FAIhook";
+                               }elseif(in_array("FAIprofile",$obj['objectClass'])){
+                                       $obj['FAIclass']        = $object['FAIclass'][0];
+                                       $type = "FAIprofile";
+                               }elseif(in_array("FAItemplate",$obj['objectClass'])){
+                                       $type = "FAItemplate";
+                               }
+                               $this->objects[strtolower($obj['cn']).$obj['cn'].$type] = $obj;
+                               $this->objects[strtolower($obj['cn']).$obj['cn'].$type]['type']=$type;
+                       }
+               }
+               ksort($this->objects);
+               reset ($this->objects);
+       }
+
+       function remove_lock()
+       {
+               if (isset($this->dn)){
+                       del_lock ($this->dn);
+               }
+       }
+
+       function get_type($array){
+               if(in_array("FAIpartitionTable",$array['objectClass'])){
+                       return(array("tabsPartition","faiPartitionTable","FAIPARTITIONTABS"));
+               }
+               if(in_array("FAIscript",$array['objectClass'])){
+                       return(array("tabsScript","faiScript","FAISCRIPTTABS"));
+               }
+               if(in_array("FAItemplate",$array['objectClass'])){
+                       return(array("tabsTemplate","faiTemplate","FAITEMPLATETABS"));
+               }
+               if(in_array("FAIhook",$array['objectClass'])){
+                       return(array("tabsHook","faiHook","FAIHOOKTABS"));
+               }
+               if(in_array("FAIvariable",$array['objectClass'])){
+                       return(array("tabsVariable","faiVariable","FAIVARIABLETABS"));
+               }
+               if(in_array("FAIprofile",$array['objectClass'])){
+                       return(array("tabsProfile","faiProfile","FAIPROFILETABS"));
+               }
+               
+               if(in_array("FAIpackageList",$array['objectClass'])){
+                       return(array("tabsPackage","faiPackage","FAIPACKAGETABS"));
+               }
+       }
+
+}
+
+?>
diff --git a/plugins/admin/fai/class_faiPackage.inc b/plugins/admin/fai/class_faiPackage.inc
new file mode 100644 (file)
index 0000000..78c9a18
--- /dev/null
@@ -0,0 +1,143 @@
+<?php
+
+class faiPackage extends plugin
+{
+  /* CLI vars */
+  var $cli_summary      = "Manage server basic objects";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account   = TRUE;
+
+  /* Attributes for this Object */
+  var $attributes       = array("cn","description","FAIpackage");
+
+  /* ObjectClasses for this Object*/
+  var $objectclasses    = array("top","FAIclass","FAIpackageList");
+
+  /* Class name of the Ldap ObjectClass for the Sub Object */
+  var $subClass         = "";
+  var $subClasses       = array("top","FAIclass","FAIscriptEntry");
+
+  /* Class name of the php class which allows us to edit a Sub Object */
+  var $subClassName     = "";      
+
+  /* Attributes to initialise for each subObject */
+  var $subAttributes    = array("cn","description"); 
+  var $sub64coded       = array();
+
+  /* Specific attributes */
+  var $cn               = "";       // The class name for this object
+  var $description      = "";       // The description for this set of partitions
+  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
+  var $dialog           = NULL;     // a dialog, e.g. new disk dialog
+  var $SubObjects       = array();  // All leafobjects of this object
+
+  function faiPackage ($config, $dn= NULL)
+  {
+    /* Load Attributes */
+    plugin::plugin ($config, $dn);
+
+    /* If "dn==new" we try to create a new entry
+     * Else we must read all objects from ldap which belong to this entry.
+     * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
+     */
+    if($dn != "new"){
+      $this->dn =$dn;
+    }
+
+    $this->FAIpackage = "test";
+  }
+
+  function execute()
+  {
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* Assign variables */
+    foreach($this->attributes as $attrs){
+      $smarty->assign($attrs,$this->$attrs);
+    }
+
+    $display.= $smarty->fetch(get_template_path('faiPackage.tpl', TRUE));
+    return($display);
+  }
+
+  /* Generate listbox friendly SubObject list
+  */
+  function getList(){
+    $a_return=array();
+    foreach($this->SubObjects as $obj){
+      if($obj['status'] != "delete"){
+        $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]";
+      }
+    }
+    return($a_return);
+  }
+
+  /* Delete me, and all my subtrees
+   */
+  function remove_from_parent()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+    $ldap->rmdir_recursive($this->dn);
+    $this->handle_post_events("remove");    
+  }
+
+
+  /* Save data to object 
+   */
+  function save_object()
+  {
+    plugin::save_object();
+    foreach($this->attributes as $attrs){
+      if(isset($_POST[$attrs])){
+        $this->$attrs = $_POST[$attrs];
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    $message= array();
+    $str = utf8_encode("üöä");
+    if((empty($this->description))){
+      $message[]=_("Please enter a valid description.");
+    } 
+    if((preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description))){
+      $message[]=_("Please enter a valid description.");
+    }
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+    $ldap = $this->config->get_ldap_link();
+  
+    $ldap->cat($this->dn);
+    if($ldap->count()!=0){
+      /* Write FAIscript to ldap*/
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      /* Write FAIscript to ldap*/
+      $ldap->cd($this->dn);
+      $ldap->create_missing_trees($this->dn);
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    show_ldap_error($ldap->get_error());
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/fai/class_faiPartitionTable.inc b/plugins/admin/fai/class_faiPartitionTable.inc
new file mode 100644 (file)
index 0000000..db65fed
--- /dev/null
@@ -0,0 +1,380 @@
+<?php
+
+class faiPartitionTable extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage server basic objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account   = TRUE;
+  var $attributes       = array("cn","description");
+  var $objectclasses    = array("top","FAIclass","FAIpartitionTable");
+  var $base64_encode    = array("FAImountPoint","FAImountOptions","FAIfsOptions","description");
+
+  /* Specific attributes */
+  var $cn               = "";       // The class name for this object
+  var $description      = "";       // The description for this set of partitions
+  var $disks            = array();  // All defined Disks 
+  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
+  var $dialog           = NULL;     // a dialog, e.g. new disk dialog
+
+  function faiPartitionTable ($config, $dn= NULL)
+  {
+    /* Load Attributes */
+    plugin::plugin ($config, $dn);
+
+    /* If "dn==new" we try to create a new entry
+     * Else we must read all objects from ldap which belong to this entry.
+     * First read disks from ldap ... and then the partition definitions for the disks.
+     */
+    if($dn != "new"){
+      $this->dn =$dn;
+
+      /* Read all disks from ldap taht are defined fot this partition table 
+       */
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd ($this->dn);
+      $ldap->search("(&(objectClass=FAIclass)(objectClass=FAIpartitionDisk))",array("*"));
+      while($object = $ldap->fetch()){
+        $this->disks[$object['cn'][0]]['status']      = "edited";
+        $this->disks[$object['cn'][0]]['dn']          = $object['dn'];
+        $this->disks[$object['cn'][0]]['cn']          = $object['cn'][0];
+        if(isset($object['description'][0])){
+          $this->disks[$object['cn'][0]]['description'] = $object['description'][0];
+        }else{
+          $this->disks[$object['cn'][0]]['description'] = "";
+        }
+        $this->disks[$object['cn'][0]]['partitions']   = array();
+      }
+  
+      /* read all partitions for each disk 
+       */
+      foreach($this->disks as $name => $disk){
+        $ldap->cd ($disk['dn']);
+        $ldap->search("(&(objectClass=FAIclass)(objectClass=FAIpartitionEntry))",array("*"));
+        while($partition = $ldap->fetch()){
+
+          /* remove count ... from ldap result 
+           */
+          foreach($partition as $key=>$val){
+            if((is_numeric($key))||($key=="count")||($key=="dn")){
+              unset($partition[$key]);
+            }else{
+              $partition[$key] = $val[0];
+            }
+          }
+          /* Append fetched partitions
+           */
+          $partition['status']="edited";
+    
+          foreach($this->base64_encode as $attrs){
+            $partition[$attrs] = base64_decode($partition[$attrs]);
+          }
+          $this->disks[$name]['partitions'][$partition['FAIpartitionNr']] = $partition; 
+        }  
+      }
+    }
+  }
+
+  function execute()
+  {
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+    /* Add Disk to this Partitionset
+     * This code adds a new HDD to the disks 
+     * A new Dialog will be opened 
+     */
+    if(isset($_POST['AddDisk'])){
+      $usedDiskNames =array();
+      foreach($this->disks as $key=>$disk){
+        $usedDiskNames[]= $key;
+      }
+      $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames); 
+      $this->is_dialog = true;
+    }
+
+    /* Edit disk.
+     * Open dialog which allows us to edit the selected entry 
+     */    
+    if((isset($_POST['EditDisk']))&&(isset($_POST['disks']))){
+      $usedDiskNames =array();
+      foreach($this->disks  as $key=>$disk){
+        if($key != $_POST['disks']){
+          $usedDiskNames[]= $key;
+        }
+      }
+      $this->dialog = new faiPartitionTableEntry($this->config,$this->dn,$usedDiskNames,$this->disks[$_POST['disks']]); 
+      $this->is_dialog = true;
+    }
+
+    /* Edit aborted, close dialog, without saving anything
+     */
+    if(isset($_POST['CancelDisk'])){
+      unset($this->dialog);
+      $this->dialog = NULL;
+      $this->is_dialog=false;
+    }
+  
+    /* Dialog saved
+     * Save given data from Dialog, if no error is occured
+     */
+    if(isset($_POST['SaveDisk'])){
+      $this->dialog->save_object();
+      if(count($this->dialog->check())){
+        foreach($this->dialog->check() as $msg){
+          print_red($msg);
+        }
+      }else{
+        $disk = $this->dialog->save();
+        if(isset($disk['rename'])){
+          if($this->disks[$disk['rename']['from']]['status']=="edited"){
+            $this->disks[$disk['rename']['from']]['status']="delete";
+          }else{
+            unset($this->disks[$disk['rename']['from']]);
+          }
+  
+          foreach($disk['partitions'] as $key => $val){
+            if($disk['partitions'][$key]['status']!="delete"){
+              $disk['partitions'][$key]['status']= "new";
+            }
+          }
+
+          $disk['status']="new";
+          $disk['cn']= $disk['rename']['to'];
+        }
+      
+        $this->disks[$disk['cn']]=$disk; 
+        unset($this->dialog);
+        $this->dialog = NULL;
+        $this->is_dialog=false;
+      }
+    }
+
+    /* Delete selected disk drive from list
+     * Assign delete status for all its partitions      
+     */
+    if((isset($_POST['DelDisk']))&&(!empty($_POST['disks']))){
+      $disk = $_POST['disks'];
+      if($this->disks[$disk]['status']=="edited"){
+        $this->disks[$disk."-delete"]=$this->disks[$disk];
+        unset($this->disks[$disk]);
+        $disk = $disk."-delete";        
+        $this->disks[$disk]['status']="delete";
+        foreach($this->disks[$disk]['partitions'] as $name => $value ){
+          if($value['status']=="edited"){
+            $this->disks[$disk]['partitions'][$name]['status']="delete"; 
+          }else{
+            unset($this->disks[$disk]['partitions'][$name]);
+          }
+        }
+      }else{
+        unset($this->disks[$disk]);
+      }
+    }
+
+    /* Display dialog if one is defined
+     */
+    if(isset($this->dialog)){
+      $this->dialog->save_object();
+      return($this->dialog->execute());
+    }
+
+    /* Assign all attributes to smarty engine
+     */
+    foreach($this->attributes as $attrs){
+      $smarty->assign($attrs,$this->$attrs);
+      if($this->$attrs){
+        $smarty->assign($attrs."CHK"," ");
+      }else{
+        $smarty->assign($attrs."CHK"," disabled ");
+      }
+    }
+    
+    $disks = $this->getDisks();
+    $smarty->assign("disks"   ,$disks);
+    $smarty->assign("diskKeys",array_flip($disks));
+    $display.= $smarty->fetch(get_template_path('faiPartitionTable.tpl', TRUE));
+    return($display);
+  }
+
+  function getDisks(){
+    /* Return all available disks for this partition table
+     * Return in listBox friendly array
+     */
+    $a_return = array();
+    foreach($this->disks as $key => $disk){
+      if($disk['status'] != "delete"){
+        $cnt=0;
+        foreach($disk['partitions'] as $val){
+          if($val['status']!="delete"){
+            $cnt ++;
+          }
+        }
+        if(!empty($disk['description'])){
+          $a_return[$key]=  $disk['cn']." [".$disk['description']."] - "._("Number of Partitions")." :".$cnt;
+        }else{
+          $a_return[$key]=  $disk['cn']." - "._("Number of Partitions")." :".$cnt;
+        }
+      }
+    }
+    return($a_return);
+  }
+
+
+  /* Delete me, and all my subtrees
+   */
+  function remove_from_parent()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+    $ldap->rmdir_recursive($this->dn);
+    $this->handle_post_events("remove");    
+  
+    /* This cannot be removed... */
+  }
+
+
+  /* Save data to object 
+   */
+  function save_object()
+  {
+    plugin::save_object();
+    foreach($this->attributes as $attrs){
+      if(isset($_POST[$attrs])){
+        $this->$attrs = $_POST[$attrs];
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+
+    $message= array();
+
+    $str = utf8_encode("üöä");
+    if((empty($this->description))||(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description))){
+      $message[]=_("Please enter a valid description.");
+    }
+
+    if((empty($this->cn))||(preg_match("/[^a-z0-9]/i",$this->cn))){
+      $message[]=_("Please enter a valid name.");
+    }
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+
+    plugin::save();
+    /* Save current settings.
+     * 1 : We must save the partition table, with its description and cn 
+     * 2 : Append Disk with cn and  description.
+     * 3 : Save partitions for each disk
+     */  
+
+    $ldap = $this->config->get_ldap_link();
+
+    if($this->new){
+      $ldap->cd($this->dn);
+      $ldap->create_missing_trees($this->dn);
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+      show_ldap_error($ldap->get_error());
+    }else{
+      /* Add partition table to ldap
+       */
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+      show_ldap_error($ldap->get_error());
+    }
+  
+  
+    /* Sort entries, because we must delete entries with status="delete" first */
+    $order = array();
+    foreach($this->disks as $key => $disk){
+      if($disk['status'] == "delete"){
+        $order[$key] = $disk;
+      }
+    }
+    foreach($this->disks as $key => $disk){
+      if($disk['status'] != "delete"){
+        $order[$key] = $disk;
+      }
+    }
+
+    /* Append all disks to ldap */
+    foreach($order as $cn=>$disk){
+      $disk_dn                    = "cn=".$disk['cn'].",".$this->dn;
+      $disk_attrs['cn']           =  $disk['cn'];
+      $disk_attrs['description']  =  $disk['description']; 
+      $disk_attrs['objectClass']  =  array("top","FAIclass","FAIpartitionDisk");
+  
+      if($disk['status'] == "delete"){
+        $ldap->cd($disk_dn);
+        $ldap->rmdir_recursive($disk_dn);
+      }elseif($disk['status']== "edited"){
+        $ldap->cd($disk_dn);
+        $ldap->modify($disk_attrs);
+      }elseif($disk['status']== "new"){
+        $ldap->cd($disk_dn);
+        $ldap->create_missing_trees($disk_dn);
+        $ldap->cd($disk_dn);
+        $ldap->add($disk_attrs);
+      }else{
+        print_red("unknown status while saving disks");
+      }
+
+      show_ldap_error($ldap->get_error());
+      if($disk['status']!="delete")
+      /* Add all partitions */
+      foreach($disk['partitions'] as $key => $partition){
+        $partition_attrs = array();
+
+        foreach($this->base64_encode as $attrs){
+          $partition[$attrs] = base64_encode($partition[$attrs]);          
+        }
+
+        foreach($partition as $key => $value){
+          if(!empty($value)){
+            $partition_attrs[$key]=$value;        
+          }else{
+            unset($partition_attrs[$key]);        
+          }
+        }
+
+        $partition_dn                       = "cn=".$partition_attrs['cn'].",".$disk_dn;      
+        $partition_attrs['objectClass']     = array("top","FAIclass","FAIpartitionEntry");
+        
+        unset($partition_attrs['status']);
+        unset($partition_attrs['old_cn']);
+      
+        if(($partition['status'] == "delete")&&($disk['status']!="new")){
+          $ldap->cd($partition_dn);
+          $ldap->rmdir_recursive($partition_dn);
+        }elseif($partition['status'] == "new"){
+          $ldap->cd($partition_dn);
+          $ldap->create_missing_trees($partition_dn);
+          $ldap->cd($partition_dn);
+          $ldap->add($partition_attrs);
+        }elseif($partition['status'] == "edited"){
+          $ldap->cd($partition_dn);
+          $ldap->modify($partition_attrs);
+        } 
+      show_ldap_error($ldap->get_error());
+      }
+    }
+    $this->handle_post_events("add");
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/fai/class_faiPartitionTableEntry.inc b/plugins/admin/fai/class_faiPartitionTableEntry.inc
new file mode 100644 (file)
index 0000000..878ffaf
--- /dev/null
@@ -0,0 +1,450 @@
+<?php
+
+class faiPartitionTableEntry extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage server basic objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account= TRUE;
+  var $attributes   = array("DISK_cn","DISK_description");
+  var $objectclasses= array();
+
+  var $DISK_cn              = "";
+  var $DISK_description     = "";
+  
+  var $partitions           = array();
+  var $UsedAttrs            = array();
+  var $AvailableDiskNames   = array();
+  var $is_edit              = false;
+  var $old_cn               = "";
+  var $status               = "new";
+  var $deletePartitions     = array();
+
+  function faiPartitionTableEntry ($config, $dn= NULL,$usedDiskNames=array(),$disk=false)
+  {
+    plugin::plugin ($config, $dn);
+    $this->UsedAttrs  = array("cn","description","FAIpartitionType","FAIpartitionNr","FAIfsType","FAImountPoint","FAIpartitionSize",
+                         "FAImountOptions","FAIfsOptions","FAIpartitionFlags");
+
+    /* Generate available disknames, to avoid duplicates in cn */
+    $this->AvailableDiskNames = array();
+    foreach(array("a","b","c","d","e","f","g","h") as $ts){
+      if(!in_array("hd".$ts,$usedDiskNames)){
+        $this->AvailableDiskNames["hd".$ts]= "hd".$ts;
+      }
+    }
+    
+    $this->AvailableDiskNames['disk1']= "disk1";
+    $this->AvailableDiskNames['disk2']= "disk2";
+    /* Default status is new */
+    $this->status = "new";    
+    /* We want to edit an entry */
+    if($disk){
+
+      /* Set disk status */      
+      $this->status = $disk['status'];
+
+      /* Walk through partitions */
+      foreach($disk['partitions'] as $name => $values){
+
+        /* If a partition is already marked as delete, attach it to deletePartitions only. */
+        if($values['status'] == "delete"){
+          unset($disk['partitions'][$name]);
+          $this->deletePartitions[]=$values;
+        }else{
+
+          /* Set status, to know which partition must be deleted from ldap
+             new    : Neu partition entry // save
+             edited : Update partition entry in ldap
+             deleted: Remove partition from ldap
+           */
+    
+          /* If status is not new, set to edit mode. 
+           * New means that this partition currently wasn't saved to ldap.
+           */
+          if($disk['partitions'][$name]['status']!="new"){
+            $disk['partitions'][$name]['status']="edited";
+          }
+     
+          $disk['partitions'][$name]['old_cn']= $disk['partitions'][$name]['cn'];
+          /* Assign empty attributes, if attribute is missing */
+          foreach($this->UsedAttrs as $attr){
+            if(!isset($values[$attr])){
+              $disk['partitions'][$name][$attr]="";  
+            }
+          }
+        }
+      }
+
+      /* Set default attributes */
+      $this->DISK_cn          = $disk['cn'];
+      $this->DISK_description = $disk['description'];
+      $this->partitions       = $disk['partitions'];
+      $this->is_edit          = true;
+      $this->old_cn           = $disk['cn'];
+    }
+  }
+
+  function execute()
+  {
+    /* Fill templating stuff */
+    $smarty     = get_smarty();
+    $s_action   = "";
+    $s_entry    = "";
+    $display    = "";
+    
+    /* Assign values 
+     * And Checkbox selection
+     */
+    foreach($this->attributes as $attrs){
+      $smarty->assign($attrs,$this->$attrs);
+      if($this->$attrs){
+        $smarty->assign($attrs."CHK"," ");
+      }else{
+        $smarty->assign($attrs."CHK"," disabled ");
+      }
+    }
+
+    /* Check all Posts if there is something usefull for us,
+     * For example : Delete is posted as Delete_1 
+     * The number specifies the index we want to delete
+     */
+    foreach($_POST as $name => $value){
+      if(preg_match("/Delete_.*/",$name)){
+        $tmp = split("_",$name);
+        $s_action = "remove";
+        $s_entry  = $tmp[1]; 
+      }
+    }
+
+    /* To remove a partition we unset the index posted.
+     * We must sort the index again, else we possibly got problems 
+     * with partitions order.
+     */
+    if($s_action == "remove"){
+      if($this->partitions[$s_entry]['status'] == "edited"){
+        $this->deletePartitions[]= $this->partitions[$s_entry];
+        unset($this->partitions[$s_entry]);
+      }else{
+        unset($this->partitions[$s_entry]);
+      }
+      $tmp= array();
+      foreach($this->partitions as $part){
+        $tmp[count($tmp)+1]=$part;
+      }
+      $this->partitions = $tmp;
+    }
+
+
+    /* To add a partitions we only append an empty 
+     *  array to the already defined partitions.
+     */
+    if(isset($_POST['AddPartition'])){
+      foreach($this->UsedAttrs as $attr){
+        $tmp[$attr]                = "";     
+      }
+      $tmp["old_cn"]               = "";     
+      $tmp['status']="new";
+      $this->partitions[count($this->partitions)+1]=$tmp;
+    }
+
+    /* Tell smarty which Disknames are available.
+     */
+    $smarty->assign("cns", $this->AvailableDiskNames); 
+    
+    /* $setup contains a table with the partitions. 
+     */
+    $smarty->assign("setup", $this->generateParts());
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+
+    /* The user can't change a diskname 
+     *  if we are currently in edit mode for the specified disk 
+     */
+//    if($this->is_edit){
+//      $smarty->assign("DISK_cnACL"," disabled ");
+//    }else{
+      $smarty->assign("DISK_cnACL","");
+//    }
+
+    /* Fetch template and show the result
+     */
+    $display.= $smarty->fetch(get_template_path('faiPartitionTableEntry.tpl', TRUE));
+    return($display);
+  }
+
+  function generateParts()
+  {
+    /* Define Arrays with allowed syntax */
+    $PartitionTypes   = array("primary","logical");
+    $FAIfsTypes       = array("ext2","ext3","xfs","swap","reiserfs","dos fat 16","win fat 32");
+
+    /* Display Header */
+    $str = "<table>";
+    $str .= "<tr>";
+    $str .= "<td>"._("Nr")."</td>";
+    $str .= "<td>"._("Name")."</td>";
+    $str .= "<td>"._("Description")."</td>";
+    $str .= "<td>"._("Type")."</td>";
+    $str .= "<td>"._("FS type")."</td>";
+    $str .= "<td>"._("Mount point")."</td>";
+    $str .= "<td>"._("Size in MB")."</td>";
+    $str .= "<td>"._("Mount options")."</td>";
+    $str .= "<td>"._("FS option")."</td>";
+    $str .= "<td>"._("Preserve")."</td>";
+    $str .= "<td></td>";
+    $str .= "</tr>";
+
+    /* Walk through all defined partitions.
+     * Create a new row for each partition and append it to 
+     *  the header defined above.
+     * To be able to check the posts later, we append a key to each single postfield. like cn_1 ... cn_2
+     */
+    foreach($this->partitions as $key => $part){
+      if($part['status']!="delete"){
+        /* Generate Partition select box  
+         */
+        $PartitionType = "<select name='FAIpartitionType_".$key."'>";
+        foreach($PartitionTypes as $type){
+          if($part['FAIpartitionType'] == $type){
+            $PartitionType .="<option value='".$type."' selected >".$type."</option>";
+          }else{
+            $PartitionType .="<option value='".$type."'>".$type."</option>";
+          }
+        }        
+        $PartitionType.="</select>";   
+
+
+        /* Generate fsType select box  
+         */
+        $FAIfsType= "<select name='FAIfsType_".$key."'>";
+        foreach($FAIfsTypes as $type){
+          if($part['FAIfsType'] == $type){
+            $FAIfsType  .="<option value='".$type."' selected >".$type."</option>";
+          }else{
+            $FAIfsType .="<option value='".$type."'>".$type."</option>";
+          }
+        }        
+        $FAIfsType.="</select>";   
+
+        $str .= "<tr>";
+        $str .= "<td>".($key)."</td>";
+        $str .= "<td><input name='cn_".$key."'                value='".$part['cn']."'               maxlength='8' style='width:80px;'></td>";
+        $str .= "<td><input name='description_".$key."'       value='".$part['description']."'      maxlength='8' style='width:80px;'></td>";
+        $str .= "<td>".$PartitionType."</td>";
+        $str .= "<td>".$FAIfsType."</td>";
+        $str .= "<td><input name='FAImountPoint_".$key."'     value='".$part['FAImountPoint']."'    ></td>";
+        $str .= "<td><input name='FAIpartitionSize_".$key."'  value='".$part['FAIpartitionSize']."' style='width:200px;'></td>";
+        $str .= "<td><input name='FAImountOptions_".$key."'   value='".$part['FAImountOptions']."'  style='width:100px;'></td>";
+        $str .= "<td><input name='FAIfsOptions_".$key."'      value='".$part['FAIfsOptions']."'     style='width:100px;'></td>";
+        if($part['FAIpartitionFlags']!=false){
+          $str .= "<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve' checked></td>";
+        }else{
+          $str .= "<td><input type='checkbox' name='FAIpartitionFlags_".$key."' value='preserve'></td>";
+        }
+        $str .= "<td><input type='submit' name='Delete_".$key."' value='"._("Remove")."'></td>";
+        $str .= "</tr>";    
+      }
+    }
+    $str.="</table>";
+    return($str);
+
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    if(isset($_POST['TableEntryFrameSubmitted'])){
+      plugin::save_object();
+
+      /* Check base attributes */
+      foreach($this->attributes as $attrs){
+        if(isset($_POST[$attrs])){
+          $this->$attrs = $_POST[$attrs];
+        }
+      }
+     
+      foreach($this->partitions as $key => $part){
+        foreach($this->UsedAttrs as $attrs){
+          if(isset($_POST[$attrs."_".$key])){
+            $this->partitions[$key][$attrs] = $_POST[$attrs."_".$key];
+          }else{
+            $this->partitions[$key][$attrs] = false;
+          }
+        }
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    $message= array();
+   
+    /* Check descriptions 
+     */ 
+    if(empty($this->DISK_description)){
+      $message[] = _("Please enter a description for your disk.");
+    }
+
+    $str = utf8_encode("üöä");
+    if(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->DISK_description)){
+      $message[]=_("Please enter a valid description.");
+    }
+    
+    /* check every partition.
+     * if there is an invalid value defined, append an errorstr to message
+     */
+
+    /* Array that contain every partitionname mountpoint etc already assigned */
+    $alreadyUsed    = array();
+    foreach($this->UsedAttrs as $attrs){
+      $alreadyUsed[$attrs] = array();
+    }      
+
+    foreach($this->partitions as $key => $part){
+    
+      if((empty($part['cn']))||(preg_match("/[^0-9a-z]/",$part['cn']))){
+        $message[]=sprintf(_("Please enter a valid name for partition %s."),($key));
+      }
+
+      if(in_array($part['cn'],$alreadyUsed['cn'])){
+        $message[]=sprintf(_("please enter a unique name for partition %s"),($key));
+      }
+    
+      if(in_array($part['FAImountPoint'],$alreadyUsed['FAImountPoint'])){
+        $message[]=sprintf(_("please enter a unique mount point for partition %s"),($key));
+      }
+
+      if(empty($part['description'])){
+        $message[]=sprintf(_("Please enter a valid description for partition %s." ),($key));
+      }
+
+      if((empty($part['FAImountPoint']))||(!((preg_match("/^\/.*/",$part['FAImountPoint']))||(preg_match("/^swap$/",$part['FAImountPoint']))))){
+        $message[]=sprintf(_("Please enter a valid mount point for partition %s." ),($key));
+      }
+
+      if($part['FAIfsType'] == "swap"){
+        if(in_array($part['FAIfsType'],$alreadyUsed['FAIfsType'])){
+          $message[]=sprintf(_("File system type 'swap' is already used, change file system type for partition %s."),$key);
+        }
+      }
+
+      $tmp = split("-",$part['FAIpartitionSize']);
+      if(count($tmp)!=2){
+        $message[]=sprintf(_("Please enter a range for partition size, 'from-to', for partition %s."),($key));
+      }elseif((!is_numeric($tmp[0]))||(!is_numeric($tmp[1]))){
+        $message[]=sprintf(_("Please enter a valid range for partition %s."),($key)); 
+      }elseif($tmp[0]>=$tmp[1]){
+        $message[]=sprintf(_("Please enter a valid range for partition %s."),($key));
+      }elseif($this->checkSize($part['FAIpartitionSize'],$alreadyUsed['FAIpartitionSize'],$key)){
+        $message[]=$this->checkSize($part['FAIpartitionSize'],$alreadyUsed['FAIpartitionSize'],$key);
+      }
+      foreach($this->UsedAttrs as $attrs){
+        $alreadyUsed[$attrs][$key] = $part[$attrs];
+      }      
+    }
+
+
+    /* Only show 5 errors */
+    $cnt = 0;
+    if(count($message)>5){
+      foreach($message as $msg){
+        if($cnt < 5){
+          $tmp2[]=$msg;
+        }
+        $cnt ++;
+      }
+    $tmp2[] = "...";
+    $message = $tmp2;
+    }
+
+    return ($message);
+  }
+
+  /* This function checks the selected partition sizes 
+   * If a size setting overlap with another, it returns an error msg
+   */ 
+  function checkSize($current,$others,$ckey){
+    $tmp = split("-",$current);
+    $from = $tmp[0];
+    $to   = $tmp[1];
+    foreach($others as $key=> $other){
+      $tmp  = split("-",$other);
+      $oth_from = $tmp[0];
+      $oth_to   = $tmp[1];
+      /* surrounds another entry */
+      if( (($from <= $oth_from)&&($to >= $oth_to))||    // inside
+          (($from >= $oth_from)&&($to <= $oth_to))||    // outside
+          (($to >= $oth_from)&&($to <= $oth_to))  ||    // overlap at right
+          (($from >= $oth_from)&&($from <= $oth_to)) ){ // overlap left
+        $message =sprintf( _("Size settings for partition %s, overlap with size settings for partition %s."),$ckey,$key);
+        return($message);
+      }
+    }
+    return(false);
+  }
+  
+  function save()
+  {
+    /* This function returns the new or edited disk with its partitions.
+     * If the disk was edited and not a new one, we reset the name of the disk
+     *  to keep the correct index.
+     */
+
+    /* Check partition rename
+    */
+    foreach($this->partitions as $key => $part){
+      if($part['cn'] != $part['old_cn']){
+        if($part['status'] == "edited"){
+
+          $tmp          = $part;
+          $tmp['status']= "delete";
+          $tmp['cn']    = $part['old_cn'];
+
+          $this->deletePartitions[] = $tmp;
+        }
+        $this->partitions[$key]['old_cn']=$part['cn'];
+        $this->partitions[$key]['status']="new";
+      }
+    }
+
+    $tmp = array();
+    $tmp['cn']          = $this->DISK_cn;
+    /* Attach partitions */ 
+    foreach($this->partitions as $key=>$val) {
+      $this->partitions[$key]['FAIpartitionNr']=$key;
+    }
+
+    /* Attach deleted */ 
+    foreach($this->deletePartitions as $key=>$val) {
+      $this->partitions[$key."-delete"]=$val;
+      $this->partitions[$key."-delete"]['status']="delete";
+    } 
+    $tmp['description'] = $this->DISK_description;
+    $tmp['partitions']  = $this->partitions;
+    $tmp['status']      = $this->status;
+
+    /* If hdd name has changed, tell partitionTable to rename it */
+    if(($this->is_edit)&&($this->old_cn != $this->DISK_cn)){
+      $tmp['rename']['from']  = $this->old_cn;    
+      $tmp['rename']['to']    = $this->DISK_cn;    
+    }
+
+    return($tmp);
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/fai/class_faiProfile.inc b/plugins/admin/fai/class_faiProfile.inc
new file mode 100644 (file)
index 0000000..517b852
--- /dev/null
@@ -0,0 +1,267 @@
+<?php
+
+class faiProfile extends plugin
+{
+  /* CLI vars */
+  var $cli_summary      = "Manage server basic objects";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account   = TRUE;
+
+  /* Attributes for this Object */
+  var $attributes       = array("cn","description","FAIclass");
+
+  /* ObjectClasses for this Object*/
+  var $objectclasses    = array("top","FAIclass","FAIprofile");
+
+  /* Class name of the Ldap ObjectClass for the Sub Object */
+  var $subClass         = "FAIscriptEntry";
+  var $subClasses       = array("top","FAIclass","FAIscriptEntry");
+
+  /* Specific attributes */
+  var $old_cn           = "";
+  var $cn               = "";       // The class name for this object
+  var $description      = "";       // The description for this set of partitions
+  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
+  var $dialog           = NULL;     // a dialog, e.g. new disk dialog
+  var $FAIclass         = "";       // Classnames used for this profile
+  var $FAIclasses       = array();  // Contains classname seperated in an array
+  var $FAIAllclasses    = array();  // Contains all possible Classnames
+
+  function faiProfile($config, $dn= NULL)
+  {
+    /* Load Attributes */
+    plugin::plugin ($config, $dn);
+    $ldap=$this->config->get_ldap_link();
+
+    $tmp = split(" ",$this->FAIclass);
+    
+    foreach($tmp as $class){
+      if(!empty($class)){
+        $this->FAIclasses[trim($class)] = trim($class);
+      }
+    }
+    natcasesort($this->FAIclasses);
+    reset($this->FAIclasses) ;
+    $categories = array("FAIscript","FAItemplate","FAIhook","FAIvariable","FAIpartitionTAble","FAIpackage");
+  
+    $sort = array();
+    
+    $base = $_SESSION['faifilter']['base'];
+    $ldap->cd($base);
+    $ldap->search("(objectClass=*)",array("*"));
+    while($attrs = $ldap->fetch()){
+      foreach($categories as $cat){
+        if(in_array($cat,$attrs['objectClass'])){
+          $this->FAIAllclasses[$attrs['cn'][0]][$cat]=$attrs;
+          $sort[strtolower($attrs['cn'][0])] = $attrs['cn'][0];
+        }
+      }
+    } 
+    ksort($sort);
+    foreach($sort as $name){
+      $tmp[$name] =$this->FAIAllclasses[$name];
+    }
+    $this->FAIAllclasses = array();
+    $this->FAIAllclasses = $tmp;
+
+    if($dn != "new"){
+      $this->dn =$dn;
+    }
+    $this->old_cn   = $this->cn;
+  }
+
+  function execute()
+  {
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    $s_entry = "";
+    $s_action = "";
+
+    /* Remove class name From list */
+    foreach($_POST as $name => $post){
+      if(preg_match("/DEL_/i",$name)){
+        $s_action = "delete";
+        $s_entry  = preg_replace("/DEL_/","",$name);
+        $s_entry  = preg_replace("/_.*$/","",$s_entry);
+      }elseif(preg_match("/Add_class/i",$name)){
+        $s_action  = "add";
+      }
+    }
+
+    if($s_action == "delete"){
+      unset($this->FAIclasses[$s_entry]);
+    }
+
+    if($s_action == "add"){
+      $this->dialog = new faiProfileEntry($this->config,$this->dn,$this->FAIclasses);
+      $this->is_dialog  =true;
+    }
+  
+    /* Save Dialog */
+    if(isset($_POST['SaveSubObject'])){
+      $this->dialog->save_object();
+      $msgs= $this->dialog->check();
+      if(count($msgs)){
+        print_red($msgs);
+      }else{
+        $ret = $this->dialog->save();
+        foreach($ret as $class){
+          $this->FAIclasses[$class] =$class; 
+        }
+        $this->is_dialog=false;
+        unset($this->dialog);
+        $this->dialog=NULL;
+      }
+    }
+
+    /* Cancel Dialog */
+    if(isset($_POST['CancelSubObject'])){
+      $this->is_dialog=false;
+      unset($this->dialog);
+      $this->dialog=NULL;
+    }
+    
+    if(isset($this->dialog)){
+      $this->dialog->save_object();
+      return($this->dialog->execute());
+    }
+
+    $divlist  =new divlist("Profile");
+    $divlist->SetSummary(_("This list displays all assigned class names for this profile."));
+    $divlist->SetEntriesPerPage(10);
+
+    $divlist->SetHeader(array(array("string"=>"Class name"),
+                              array("string"=>"Objects","attach"=>"style='width:120px;'"),
+                              array("string"=>"Options","attach"=>"style='border-right:none;width:60px;'")));
+    $listhead = 
+    "<div style='background:#F0F0F9;padding:5px;'>".
+    "<input type='image' align='middle' src='images/editpaste.png' title='"._("Append new class names")."' alt='"._("Add")."' name='Add_class'>&nbsp;".
+    "</div>";
+
+    $objTypes['FAIhook']            = "<image src='images/fai_hook.png' title='"._("Hook bundle")."' alt=''>";
+    $objTypes['FAItemplate']        = "<image src='images/fai_template.png' title='"._("Template bundle")."' alt=''>";
+    $objTypes['FAIscript']          = "<image src='images/fai_script.png' title='"._("Script bundle")."' alt=''>";
+    $objTypes['FAIvariable']        = "<image src='images/fai_variable.png' title='"._("Variable bundle")."' alt=''>";
+    $objTypes['FAIpackages']        = "<image src='images/fai_packages.png' title='"._("Packages bundle")."' alt=''>";
+    $objTypes['FAIpartitionTable']  = "<image src='images/fai_partitionTable.png' title='"._("Partition table")."' alt=''>";
+
+    $actions = "<input type='image' src='images/editdelete.png' title='"._("Remove class from profile")."' name='DEL_%KEY%'>"; 
+
+    foreach($this->FAIclasses as $usedClass){
+      $str = "";
+      if(isset($this->FAIAllclasses[$usedClass])){
+        foreach($this->FAIAllclasses[$usedClass] as $class => $obj){
+          $str.= $objTypes[$class]; 
+        }
+      }
+
+      $field1 = array("string"=> $usedClass,"attach"=>"");
+      $field2 = array("string"=> $str,"attach"=>"");
+      $field3 = array("string"=> preg_replace("/%KEY%/",$usedClass,$actions),"attach"=>"style='border-right:none;'");
+      $divlist->AddEntry(array($field1,$field2,$field3));
+    }
+
+    $smarty->assign("divlisthead" ,$listhead);
+    $smarty->assign("divlist"     ,$divlist->DrawList());
+
+    /* Assign variables */
+    foreach($this->attributes as $attrs){
+      $smarty->assign($attrs,$this->$attrs);
+    }
+
+    $display.= $smarty->fetch(get_template_path('faiProfile.tpl', TRUE));
+    return($display);
+  }
+  
+  function remove_from_parent()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+    $ldap->rmdir_recursive($this->dn);
+    $this->handle_post_events("remove");    
+  }
+
+  /* Save data to object 
+   */
+  function save_object()
+  {
+    plugin::save_object();
+    foreach($this->attributes as $attrs){
+      if(isset($_POST[$attrs])){
+        $this->$attrs = $_POST[$attrs];
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    $message= array();
+    $str = utf8_encode("üöä");
+    if((empty($this->description))){
+      $message[] =_("Please specify a description for this profile.");
+    }
+
+    if((preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description))){
+      $message[]=_("Please enter a valid description.");
+    }
+    
+    if((empty($this->cn))||(preg_match("/[^a-z0-9]/i",$this->cn))){
+      $message[]=_("Please enter a valid name. Only 0-9 a-Z are allowed here.");
+    }
+
+    if(count($this->FAIclasses) == 0){
+      $message[]=_("Please assign at least one class to this  profile.");
+    }
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($_SESSION['faifilter']['base']);
+    $ldap->search("(&(objectClass=FAIprofile)(cn=".$this->cn.")(!cn=".$this->old_cn."))",array("*"));
+    if($ldap->count()){
+      $message[]=_("There is already a profile with this class name defined.");
+    }
+
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+    $ldap = $this->config->get_ldap_link();
+
+    $this->FAIclass = "";
+    foreach($this->FAIclasses as $class){
+      $this->FAIclass.=$class." ";
+    }
+
+    $this->attrs['FAIclass']=trim($this->FAIclass);
+
+    $ldap->cat($this->dn);
+    if($ldap->count()!=0){
+      /* Write FAIscript to ldap*/
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      /* Write FAIscript to ldap*/
+      $ldap->cd($this->dn);
+      $ldap->create_missing_trees($this->dn);
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    show_ldap_error($ldap->get_error());
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/fai/class_faiProfileEntry.inc b/plugins/admin/fai/class_faiProfileEntry.inc
new file mode 100644 (file)
index 0000000..b38614e
--- /dev/null
@@ -0,0 +1,233 @@
+<?php
+
+class faiProfileEntry extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage server basic objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account= TRUE;
+  var $attributes   = array();
+  var $objectclasses= array();
+
+  /* Array with available class names */
+  var $FAIAllclasses        = array();
+
+  function faiProfileEntry ($config, $dn= NULL,$used=array(),$objects=false)
+  {
+    plugin::plugin ($config, $dn);
+
+    /* Search only in fai tree */
+    $base = $_SESSION['faifilter']['base'];
+
+    /* Create array with categories to be able to sort different types of objects */
+    $categories = array("FAIscript","FAItemplate","FAIhook","FAIvariable","FAIpartitionTable","FAIpackage");
+
+    /* Read out all objects from fai tree */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($base);
+    $ldap->search("(| (objectClass=FAIscript)(objectClass=FAItemplate)(objectClass=FAIhook)(objectClass=FAIvariable)
+                      (objectClass=FAIpartitionTable)(objectClass=FAIpackage))",array("*"));
+    while($attrs = $ldap->fetch()){
+      
+      /* Only use objects which have cn set */
+      if((isset($attrs['cn'][0]))&&(!in_array($attrs['cn'][0],$used))){
+        foreach($categories as $cat){
+          if(in_array($cat,$attrs['objectClass'])){
+        
+            /* Append different types of objects */
+            $this->FAIAllclasses[$attrs['cn'][0]]['objects'][$cat]=$cat;
+
+            /* Set selected status to false */
+            $this->FAIAllclasses[$attrs['cn'][0]]['status']=false;
+
+            $sort[strtolower($attrs['cn'][0])] = $attrs['cn'][0];
+          }
+        }
+      }
+    }
+
+    ksort($sort);
+    foreach($sort as $name){
+      $tmp[$name] =$this->FAIAllclasses[$name];
+    }
+    $this->FAIAllclasses = array();
+    $this->FAIAllclasses = $tmp;
+
+
+    /* If no search filter is set, create one */
+    if (!is_global("SUBfaifilter")){
+      $SUBfaifilter= array("base" => "ou=fai,ou=configs,ou=systems,".$base, "Sregex" => "*");
+      $SUBfaifilter['SShowTemplates'] = false;
+      $SUBfaifilter['SShowScripts']   = false;
+      $SUBfaifilter['SShowHooks']     = false;
+      $SUBfaifilter['SShowVariables'] = false;
+      $SUBfaifilter['SShowPackages']  = false;
+      $SUBfaifilter['SShowPartitions']= false;
+      register_global("SUBfaifilter", $SUBfaifilter);
+    }
+  }
+
+  function execute()
+  {
+    /* Fill templating stuff */
+    $smarty     = get_smarty();
+    $display = "";
+
+    $SUBfaifilter = $_SESSION['SUBfaifilter'];
+
+    /* If someone used the apply button, update searchfilter */
+    if(isset($_POST['Sregex'])){
+      foreach($SUBfaifilter as $key => $val){
+        if(!isset($_POST[$key])){
+          $SUBfaifilter[$key] = false;
+        }else{
+          $SUBfaifilter[$key] =$_POST[$key];
+        }
+      }
+      $SUBfaifilter['Sregex']= $_POST['Sregex'];
+      if(!strstr($SUBfaifilter['Sregex'],"*")){
+        $SUBfaifilter['Sregex'] = $SUBfaifilter['Sregex']."*";
+      }
+    }
+  
+    /* Save current searchfilter in session*/
+    $_SESSION['SUBfaifilter']= $SUBfaifilter;
+
+    /* Check if we used a checkboxe from the list, to select dselect an entry */
+    foreach($_POST as $name => $value){
+      foreach($this->FAIAllclasses as $class => $obj){
+        if(isset($_POST["ON_PAGE_".$class])){
+          if(isset($_POST['USE_'.$class])){
+            $this->FAIAllclasses[$class]['status']=true;  
+          }else{
+            $this->FAIAllclasses[$class]['status']=false;  
+          }    
+        }
+      }
+    }
+
+    /* Create different picture for each object type */
+    $objTypes['FAIhook']            = "<image src='images/fai_hook.png' title='"._("Hook bundle")."' alt=''>&nbsp;";
+    $objTypes['FAItemplate']        = "<image src='images/fai_template.png' title='"._("Template bundle")."' alt=''>&nbsp;";
+    $objTypes['FAIscript']          = "<image src='images/fai_script.png' title='"._("Script bundle")."' alt=''>&nbsp;";
+    $objTypes['FAIvariable']        = "<image src='images/fai_variable.png' title='"._("Variable bundle")."' alt=''>&nbsp;";
+    $objTypes['FAIpackages']        = "<image src='images/fai_packages.png' title='"._("Package bundle")."' alt=''>&nbsp;";
+    $objTypes['FAIpartitionTable']  = "<image src='images/fai_partitionTable.png' title='"._("Partition table")."' alt=''>&nbsp;";
+
+    /* assign basic attributes */
+    foreach($this->attributes as $attrs){
+      $smarty->assign($attrs,stripslashes($this->$attrs));
+    }
+
+    /* Assign all filter attributes to smarty */
+    foreach($SUBfaifilter as $key => $val){
+      if(($key != "base")&&($key != "Sregex")){
+        if($val){
+          $smarty->assign($key."CHK", " checked ");
+        }else{
+          $smarty->assign($key."CHK", "");
+        }
+      }else{
+        $smarty->assign($key,$val);
+      }
+    }
+  
+    /* Create a divlist to display all available class names with the depending object types */
+    $divlist = new divlist("ProfileEntry");
+    $divlist->SetSummary(_("This list displays all assigned class names for this profile."));
+    $divlist->SetEntriesPerPage(20);
+    $divlist->SetHeader(array(array("string"=>"Class name"),
+                              array("string"=>"Objects")));
+
+    /* Action button allows us to delete an entry */
+    $action = "<input type='hidden' name='ON_PAGE_%KEY%' value='1'>
+              <input type='checkbox' name='USE_%KEY%' value='%KEY%' onChange='document.mainform.submit();' %CHECK%>";
+
+    /* Check every single class name to match the current search filter */
+    foreach($this->FAIAllclasses as $usedClass => $classes){
+
+      $fi = str_replace("*",".*",$SUBfaifilter['Sregex']);  
+      $abort = false; 
+      if(!preg_match("/".$fi."/",$usedClass)){
+        $abort = true;
+      }
+      if(($SUBfaifilter['SShowScripts'])&&(!in_array('FAIscript',$classes['objects']))){
+        $abort = true;
+      }
+      if(($SUBfaifilter['SShowTemplates'])&&(!in_array('FAItemplate',$classes['objects']))){
+        $abort = true;
+      }
+      if(($SUBfaifilter['SShowHooks'])&&(!in_array('FAIhook',$classes['objects']))){
+        $abort = true;
+      }
+      if(($SUBfaifilter['SShowVariables'])&&(!in_array('FAIvariable',$classes['objects']))){
+        $abort = true;
+      }
+      if(($SUBfaifilter['SShowPartitions'])&&(!in_array('FAIpartitionTable',$classes['objects']))){
+        $abort = true;
+      }
+      if(($SUBfaifilter['SShowPackages'])&&(!in_array('FAIpackages',$classes['objects']))){
+        $abort = true;
+      }
+
+      if(!$abort){
+        $str = "";
+        foreach($classes['objects'] as $class => $obj){
+          $str.= $objTypes[$obj];
+        }
+
+        /* Is this entry selected */ 
+        if($classes['status']==true){
+          $action_check = preg_replace("/%CHECK%/"," checked ",$action);
+        }else{
+          $action_check = preg_replace("/%CHECK%/","",$action);
+        }      
+        
+        /* Append to list */
+        $field1 = array("string"=> preg_replace("/%KEY%/",$usedClass,$action_check).$usedClass,"attach"=>"");
+        $field2 = array("string"=> $str,"attach"=>"");
+        $divlist->AddEntry(array($field1,$field2));
+      }
+    }
+
+    $smarty->assign("faihead"       , "");
+    $smarty->assign("failist"       , $divlist->DrawList());
+    $smarty->assign("infoimage"     , get_template_path('images/info.png'));
+    $smarty->assign("launchimage"   , get_template_path('images/launch.png'));
+    $smarty->assign("alphabet"      , generate_alphabet());
+    $smarty->assign("apply"         , apply_filter(TRUE));
+    $smarty->assign("search_image"  , get_template_path('images/search.png'));
+
+    $display.= $smarty->fetch(get_template_path('faiProfileEntry.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+  }
+
+  /* Check supplied data */
+  function check()
+  {
+    $message= array();
+    return ($message);
+  }
+
+  function save()
+  {
+    $tmp = array();
+    foreach($this->FAIAllclasses as $class => $obj){
+      if($obj['status']==true){
+        $tmp[$class]=$class;
+      }
+    }
+    return($tmp);
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/fai/class_faiScript.inc b/plugins/admin/fai/class_faiScript.inc
new file mode 100644 (file)
index 0000000..3ee246a
--- /dev/null
@@ -0,0 +1,281 @@
+<?php
+
+class faiScript extends plugin
+{
+  /* CLI vars */
+  var $cli_summary      = "Manage server basic objects";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account   = TRUE;
+
+  /* Attributes for this Object */
+  var $attributes       = array("cn","description");
+
+  /* ObjectClasses for this Object*/
+  var $objectclasses    = array("top","FAIclass","FAIscript");
+
+  /* Class name of the Ldap ObjectClass for the Sub Object */
+  var $subClass         = "FAIscriptEntry";
+  var $subClasses       = array("top","FAIclass","FAIscriptEntry");
+
+  /* Class name of the php class which allows us to edit a Sub Object */
+  var $subClassName     = "faiScriptEntry";      
+
+  /* Attributes to initialise for each subObject */
+  var $subAttributes    = array("cn","description","FAIpriority","FAIscript"); 
+  var $sub64coded       = array("FAIscript");
+
+  /* Specific attributes */
+  var $cn               = "";       // The class name for this object
+  var $description      = "";       // The description for this set of partitions
+  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
+  var $dialog           = NULL;     // a dialog, e.g. new disk dialog
+  var $SubObjects       = array();  // All leafobjects of this object
+
+  function faiScript ($config, $dn= NULL)
+  {
+    /* Load Attributes */
+    plugin::plugin ($config, $dn);
+
+    /* If "dn==new" we try to create a new entry
+     * Else we must read all objects from ldap which belong to this entry.
+     * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
+     */
+    if($dn != "new"){
+      $this->dn =$dn;
+
+      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
+       */
+      $ldap     = $this->config->get_ldap_link();
+      $ldap->cd ($this->dn);
+      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$this->subAttributes);
+
+      while($object = $ldap->fetch()){
+        /* Set status for save management */
+  
+        foreach($this->subAttributes as $attrs){
+          if(!isset($object[$attrs][0])){
+            $this->SubObjects[$object['cn'][0]][$attrs]="";
+          }else{
+            $this->SubObjects[$object['cn'][0]][$attrs]=$object[$attrs][0];
+          }
+        }
+     
+        foreach($this->sub64coded as $codeIt){
+          $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
+        }
+        $this->SubObjects[$object['cn'][0]]['status']      = "edited";
+        $this->SubObjects[$object['cn'][0]]['dn']          = $object['dn'];
+      }
+    }
+  }
+
+  function execute()
+  {
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* Add new sub object */
+    if(isset($_POST['AddSubObject'])){
+      $this->dialog= new $this->subClassName($this->config,"new");
+      $this->is_dialog=true;
+    }
+
+    /* Edit selected Sub Object */
+    if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
+      $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$_POST['SubObject']]);
+      $this->is_dialog=true;
+    }
+    
+    /* Remove Sub object */
+    if((isset($_POST['DelSubObject']))&&(isset($_POST['SubObject']))){
+      if($this->SubObjects[$_POST['SubObject']]['status'] == "edited"){
+        $this->SubObjects[$_POST['SubObject']]['status']= "delete";
+      }else{
+        unset($this->SubObjects[$_POST['SubObject']]);
+      }
+    }
+
+    /* Save Dialog */
+    if(isset($_POST['SaveSubObject'])){
+      $this->dialog->save_object();
+      $msgs = $this->dialog->check();
+      if(count($msgs)>0){
+        foreach($msgs as $msg){
+          print_red($msg);
+        }
+      }else{
+        $obj = $this->dialog->save();
+        if(isset($obj['remove'])){
+          if($this->SubObjects[$obj['remove']['from']]['status']=="edited"){
+            $this->SubObjects[$obj['remove']['from']]['status'] = "delete";
+          }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){
+            unset($this->SubObjects[$obj['remove']['from']]);
+          }
+          $obj['status'] = "new";
+          $this->SubObjects[$obj['remove']['to']] = $obj;
+          unset($this->SubObjects[$obj['remove']['to']]['remove']);
+        }else{
+          $this->SubObjects[$obj['cn']]=$obj;
+        }
+        $this->is_dialog=false;
+        unset($this->dialog);
+        $this->dialog=NULL;
+      }
+    }
+
+    /* Cancel Dialog */
+    if(isset($_POST['CancelSubObject'])){
+      $this->is_dialog=false; 
+      unset($this->dialog);
+      $this->dialog=NULL;
+    }
+
+    /* Print dialog if $this->dialog is set */
+    if($this->dialog){
+      $this->dialog->save_object();
+      $display = $this->dialog->execute();
+      return($display);
+    }
+
+    $smarty->assign("SubObjects",$this->getList());
+    $smarty->assign("SubObjectKeys",array_flip($this->getList()));
+    /* Assign variables */
+    foreach($this->attributes as $attrs){
+      $smarty->assign($attrs,$this->$attrs);
+    }
+
+    $display.= $smarty->fetch(get_template_path('faiScript.tpl', TRUE));
+    return($display);
+  }
+
+  /* Generate listbox friendly SubObject list
+  */
+  function getList(){
+    $a_return=array();
+    foreach($this->SubObjects as $obj){
+      if($obj['status'] != "delete"){
+        $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]";
+      }
+    }
+    return($a_return);
+  }
+
+  /* Delete me, and all my subtrees
+   */
+  function remove_from_parent()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+    $ldap->rmdir_recursive($this->dn);
+    $this->handle_post_events("remove");    
+  }
+
+
+  /* Save data to object 
+   */
+  function save_object()
+  {
+    plugin::save_object();
+    foreach($this->attributes as $attrs){
+      if(isset($_POST[$attrs])){
+        $this->$attrs = $_POST[$attrs];
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    $message= array();
+    $str = utf8_encode("üöä");
+    if((empty($this->description))||(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description))){
+      $message[]=_("Please enter a valid description.");
+    }
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+    $ldap = $this->config->get_ldap_link();
+  
+    $ldap->cat($this->dn);
+    if($ldap->count()!=0){
+      /* Write FAIscript to ldap*/
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      /* Write FAIscript to ldap*/
+      $ldap->cd($this->dn);
+      $ldap->create_missing_trees($this->dn);
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    show_ldap_error($ldap->get_error());
+    /* Prepare FAIscriptEntry to write it to ldap
+     * First sort array.
+     *  Because we must delete old entries first.
+     * After deletion, we perform add and modify 
+     */
+    $Objects = array();
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] == "delete"){
+        $Objects[$name] = $obj; 
+      }
+    }
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] != "delete"){
+        $Objects[$name] = $obj; 
+      }
+    }
+
+    foreach($Objects as $name => $obj){
+
+      foreach($this->sub64coded as $codeIt){
+        $obj[$codeIt]=base64_encode($obj[$codeIt]);
+      }
+
+      $tmp = array();
+      foreach($this->subAttributes as $attrs){
+        if(empty($obj[$attrs])){
+          $obj[$attrs] = array();
+        }
+        $tmp[$attrs] = $obj[$attrs];
+      }    
+        
+      $tmp['objectClass'] = $this->subClasses;
+
+      $sub_dn = "cn=".$obj['cn'].",".$this->dn;
+      if($obj['status'] == "delete"){
+        $ldap->cd($sub_dn);
+        $ldap->rmdir_recursive($sub_dn);
+        $this->handle_post_events("remove");
+      }elseif($obj['status'] == "edited"){
+        $ldap->cd($sub_dn);
+        $ldap->modify($tmp);
+        $this->handle_post_events("modify");
+      }elseif($obj['status']=="new"){
+        $ldap->cd($sub_dn);
+        $ldap->create_missing_trees($sub_dn);
+        $ldap->cd($sub_dn);
+        $ldap->add($tmp); 
+        $this->handle_post_events("add");
+      }
+      show_ldap_error($ldap->get_error()); 
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/fai/class_faiScriptEntry.inc b/plugins/admin/fai/class_faiScriptEntry.inc
new file mode 100644 (file)
index 0000000..9032300
--- /dev/null
@@ -0,0 +1,135 @@
+<?php
+
+class faiScriptEntry extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage server basic objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account= TRUE;
+  var $attributes   = array("Object_cn","Object_description","Object_FAIpriority","Object_FAIscript");
+  var $objectclasses= array();
+
+  var $orig_cn              = "";
+
+  var $Object_dn            = "";
+  var $Object_cn            = "";
+  var $Object_FAIpriority   = "";
+  var $Object_FAIscript     = "";
+  var $Object_description   = "";
+  var $Object_status        = "new";
+  
+  function faiScriptEntry ($config, $dn= NULL,$object=false)
+  {
+    plugin::plugin ($config, $dn);
+    if($dn != "new"){
+      $this->orig_cn= $object['cn'];
+      $this->dn=$object['dn'];
+      foreach($object as $name=>$value){
+        $oname = "Object_".$name;
+        $this->$oname=$value;
+      }
+    }else{
+      $this->Object_status = "new";
+      $this->orig_cn       = false;
+    }
+  }
+
+  function execute()
+  {
+    /* Fill templating stuff */
+    $smarty     = get_smarty();
+    $display = "";
+  
+    if(isset($_POST['ImportUpload'])){
+      if(($_FILES['ImportFile']['error']!=0)){
+        print_red(_("Please select a valid file."));
+      }else
+      if(($_FILES['ImportFile']['size']==0)){
+        print_red(_("Selected file is empty."));
+      }else{
+        $str = file_get_contents($_FILES['ImportFile']['tmp_name']);
+        $this->Object_FAIscript = $str;
+      }
+    }
+
+  
+
+    foreach($this->attributes as $attrs){
+      $smarty->assign($attrs,stripslashes($this->$attrs));
+    }
+
+    for($i =1 ; $i <= 100 ; $i++){
+      $Object_FAIprioritys[$i]=$i;
+    }
+    $smarty->assign("Object_FAIprioritys",$Object_FAIprioritys);
+    $display.= $smarty->fetch(get_template_path('faiScriptEntry.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    if(isset($_POST['SubObjectFormSubmitted'])){
+      foreach($this->attributes as $attrs){
+        if(isset($_POST[$attrs])){
+          $this->$attrs = $_POST[$attrs];
+        }else{
+          $this->$attrs = "";
+        }
+      }
+    }
+  }
+
+  /* Check supplied data */
+  function check()
+  {
+    $message= array();
+  
+    $str = utf8_encode("üöä");
+
+    if(empty($this->Object_FAIscript)){
+      $message[]=_("Please specify a script.");
+    }
+    
+    if(empty($this->Object_description)){
+      $message[] = _("Please enter a description.");
+    }
+
+    if(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->Object_description)){
+      $message[] = _("Invalid character in description. Please enter a valid description.");
+    }
+
+    if(empty($this->Object_cn)){
+      $message[] = _("Please enter a name.");
+    }
+
+    if(preg_match("/[^0-9a-z]/i",$this->Object_cn)){
+      $message[] = _("Please enter a valid name. Only a-Z 0-9 are allowed.");
+    }
+    return ($message);
+  }
+  function save()
+  {
+    $tmp=array();
+    foreach($this->attributes as $attrs){ 
+      $attr = preg_replace("/^Object_/","",$attrs);
+      $tmp[$attr] = $this->$attrs;
+    }
+
+    if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
+      $tmp['remove']['from']  = $this->orig_cn;
+      $tmp['remove']['to']    = $tmp['cn'];
+    }
+  
+    $tmp['dn']      = $this->dn;  
+    $tmp['status']  = $this->Object_status; 
+    return($tmp);
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/fai/class_faiTemplate.inc b/plugins/admin/fai/class_faiTemplate.inc
new file mode 100644 (file)
index 0000000..2c43775
--- /dev/null
@@ -0,0 +1,279 @@
+<?php
+
+class faiTemplate extends plugin
+{
+  /* CLI vars */
+  var $cli_summary      = "Manage server basic objects";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account   = TRUE;
+
+  /* Attributes for this Object */
+  var $attributes       = array("cn","description");
+
+  /* ObjectClasses for this Object*/
+  var $objectclasses    = array("top","FAIclass","FAItemplate");
+
+  /* Class name of the Ldap ObjectClass for the Sub Object */
+  var $subClass         = "FAItemplateEntry";
+  var $subClasses       = array("top","FAIclass","FAItemplateEntry");
+
+  /* Class name of the php class which allows us to edit a Sub Object */
+  var $subClassName     = "faiTemplateEntry";      
+
+  /* Attributes to initialise for each subObject */
+  var $subAttributes    = array("cn","description","FAItemplateFile","FAItemplatePath"); 
+  var $sub64coded       = array("FAItemplateFile","FAItemplatePath");
+
+  /* Specific attributes */
+  var $cn               = "";       // The class name for this object
+  var $description      = "";       // The description for this set of partitions
+  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
+  var $dialog           = NULL;     // a dialog, e.g. new disk dialog
+  var $SubObjects       = array();  // All leafobjects of this object
+
+  function faiTemplate ($config, $dn= NULL)
+  {
+    /* Load Attributes */
+    plugin::plugin ($config, $dn);
+
+    /* If "dn==new" we try to create a new entry
+     * Else we must read all objects from ldap which belong to this entry.
+     * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
+     */
+    if($dn != "new"){
+      $this->dn =$dn;
+
+      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
+       */
+      $ldap     = $this->config->get_ldap_link();
+      $ldap->cd ($this->dn);
+      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$this->subAttributes);
+
+      while($object = $ldap->fetch()){
+        /* Set status for save management */
+  
+        foreach($this->subAttributes as $attrs){
+          if(!isset($object[$attrs][0])){
+            $this->SubObjects[$object['cn'][0]][$attrs]="";
+          }else{
+            $this->SubObjects[$object['cn'][0]][$attrs]=$object[$attrs][0];
+          }
+        }
+
+        foreach($this->sub64coded as $codeIt){
+          $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
+        }       
+        $this->SubObjects[$object['cn'][0]]['status']      = "edited";
+        $this->SubObjects[$object['cn'][0]]['dn']          = $object['dn'];
+      }
+    }
+  }
+
+  function execute()
+  {
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* Add new sub object */
+    if(isset($_POST['AddSubObject'])){
+      $this->dialog= new $this->subClassName($this->config,"new");
+      $this->is_dialog=true;
+    }
+
+    /* Edit selected Sub Object */
+    if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
+      $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$_POST['SubObject']]);
+      $this->is_dialog=true;
+    }
+    
+    /* Remove Sub object */
+    if((isset($_POST['DelSubObject']))&&(isset($_POST['SubObject']))){
+      if($this->SubObjects[$_POST['SubObject']]['status'] == "edited"){
+        $this->SubObjects[$_POST['SubObject']]['status']= "delete";
+      }else{
+        unset($this->SubObjects[$_POST['SubObject']]);
+      }
+    }
+
+    /* Save Dialog */
+    if(isset($_POST['SaveSubObject'])){
+      $this->dialog->save_object();
+      $msgs = $this->dialog->check();
+      if(count($msgs)>0){
+        foreach($msgs as $msg){
+          print_red($msg);
+        }
+      }else{
+        $obj = $this->dialog->save();
+        if(isset($obj['remove'])){
+          if($this->SubObjects[$obj['remove']['from']]['status']=="edited"){
+            $this->SubObjects[$obj['remove']['from']]['status'] = "delete";
+          }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){
+            unset($this->SubObjects[$obj['remove']['from']]);
+          }
+          $obj['status'] = "new";
+          $this->SubObjects[$obj['remove']['to']] = $obj;
+          unset($this->SubObjects[$obj['remove']['to']]['remove']);
+        }else{
+          $this->SubObjects[$obj['cn']]=$obj;
+        }
+        $this->is_dialog=false;
+        unset($this->dialog);
+        $this->dialog=NULL;
+      }
+    }
+
+    /* Cancel Dialog */
+    if(isset($_POST['CancelSubObject'])){
+      $this->is_dialog=false; 
+      unset($this->dialog);
+      $this->dialog=NULL;
+    }
+
+    /* Print dialog if $this->dialog is set */
+    if($this->dialog){
+      $this->dialog->save_object();
+      $display = $this->dialog->execute();
+      return($display);
+    }
+
+    $smarty->assign("SubObjects",$this->getList());
+    $smarty->assign("SubObjectKeys",array_flip($this->getList()));
+    /* Assign variables */
+    foreach($this->attributes as $attrs){
+      $smarty->assign($attrs,$this->$attrs);
+    }
+
+    $display.= $smarty->fetch(get_template_path('faiTemplate.tpl', TRUE));
+    return($display);
+  }
+
+  /* Generate listbox friendly SubObject list
+  */
+  function getList(){
+    $a_return=array();
+    foreach($this->SubObjects as $obj){
+      if($obj['status'] != "delete"){
+        $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]";
+      }
+    }
+    return($a_return);
+  }
+
+  /* Delete me, and all my subtrees
+   */
+  function remove_from_parent()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+    $ldap->rmdir_recursive($this->dn);
+    $this->handle_post_events("remove");    
+  }
+
+
+  /* Save data to object 
+   */
+  function save_object()
+  {
+    plugin::save_object();
+    foreach($this->attributes as $attrs){
+      if(isset($_POST[$attrs])){
+        $this->$attrs = $_POST[$attrs];
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    $message= array();
+    $str = utf8_encode("üöä");
+    if((empty($this->description))||(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description))){
+      $message[]=_("Please enter a valid description.");
+    }
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+    $ldap = $this->config->get_ldap_link();
+  
+    $ldap->cat($this->dn);
+    if($ldap->count()!=0){
+      /* Write FAIscript to ldap*/
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      /* Write FAIscript to ldap*/
+      $ldap->cd($this->dn);
+      $ldap->create_missing_trees($this->dn);
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    show_ldap_error($ldap->get_error());
+    /* Prepare FAIscriptEntry to write it to ldap
+     * First sort array.
+     *  Because we must delete old entries first.
+     * After deletion, we perform add and modify 
+     */
+    $Objects = array();
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] == "delete"){
+        $Objects[$name] = $obj; 
+      }
+    }
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] != "delete"){
+        $Objects[$name] = $obj; 
+      }
+    }
+
+    foreach($Objects as $name => $obj){
+      foreach($this->sub64coded as $codeIt){
+        $obj[$codeIt]=base64_encode($obj[$codeIt]);
+      }
+      $tmp = array();
+      foreach($this->subAttributes as $attrs){
+        if(empty($obj[$attrs])){
+          $obj[$attrs] = array();
+        }
+        $tmp[$attrs] = $obj[$attrs];
+      }    
+        
+      $tmp['objectClass'] = $this->subClasses;
+
+      $sub_dn = "cn=".$obj['cn'].",".$this->dn;
+
+      if($obj['status'] == "delete"){
+        $ldap->cd($sub_dn);
+        $ldap->rmdir_recursive($sub_dn);
+        $this->handle_post_events("remove");
+      }elseif($obj['status'] == "edited"){
+        $ldap->cd($sub_dn);
+        $ldap->modify($tmp);
+        $this->handle_post_events("modify");
+      }elseif($obj['status']=="new"){
+        $ldap->cd($sub_dn);
+        $ldap->create_missing_trees($sub_dn);
+        $ldap->cd($sub_dn);
+        $ldap->add($tmp); 
+        $this->handle_post_events("add");
+      }
+      show_ldap_error($ldap->get_error()); 
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/fai/class_faiTemplateEntry.inc b/plugins/admin/fai/class_faiTemplateEntry.inc
new file mode 100644 (file)
index 0000000..24d8d82
--- /dev/null
@@ -0,0 +1,124 @@
+<?php
+
+class faiTemplateEntry extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage server basic objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account= TRUE;
+  var $attributes   = array("Object_cn","Object_description","Object_FAItemplateFile","Object_FAItemplatePath");
+  var $objectclasses= array();
+
+  var $orig_cn              = "";
+
+  var $Object_dn            = "";
+  var $Object_cn            = "";
+  var $Object_FAItemplateFile   = "";
+  var $Object_FAItemplatePath   = "";
+  var $Object_description   = "";
+  var $Object_status        = "new";
+  
+  function faiTemplateEntry ($config, $dn= NULL,$object=false)
+  {
+    plugin::plugin ($config, $dn);
+    if($dn != "new"){
+      $this->orig_cn= $object['cn'];
+      $this->dn=$object['dn'];
+      foreach($object as $name=>$value){
+        $oname = "Object_".$name;
+        $this->$oname=$value;
+      }
+    }else{
+      $this->Object_status = "new";
+      $this->orig_cn       = false;
+    }
+  }
+
+  function execute()
+  {
+    /* Fill templating stuff */
+    $smarty     = get_smarty();
+    $display = "";
+
+    foreach($this->attributes as $attrs){
+      $smarty->assign($attrs,stripslashes($this->$attrs));
+    }
+
+    for($i =1 ; $i <= 100 ; $i++){
+      $Object_FAIprioritys[$i]=$i;
+    }
+    $smarty->assign("Object_FAIprioritys",$Object_FAIprioritys);
+    $display.= $smarty->fetch(get_template_path('faiTemplateEntry.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    if(isset($_POST['SubObjectFormSubmitted'])){
+      foreach($this->attributes as $attrs){
+        if(isset($_POST[$attrs])){
+          $this->$attrs = $_POST[$attrs];
+        }else{
+          $this->$attrs = "";
+        }
+      }
+    }
+  }
+
+  /* Check supplied data */
+  function check()
+  {
+    $message= array();
+    if(empty($this->Object_FAItemplateFile)){
+      $message[]=_("Please specify a value for attribute 'file'.");
+    } 
+
+    if(empty($this->Object_FAItemplatePath)){
+      $message[]=_("Please specify a value for attribute 'path'.");
+    } 
+  
+    $str = utf8_encode("üöä");
+
+    if(empty($this->Object_description)){
+      $message[] = _("Please enter a description.");
+    }
+
+    if(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->Object_description)){
+      $message[] = _("Invalid character in description. Please enter a valid description.");
+    }
+
+    if(empty($this->Object_cn)){
+      $message[] = _("Please enter a name.");
+    }
+
+    if(preg_match("/[^0-9a-z]/i",$this->Object_cn)){
+      $message[] = _("Please enter a valid name. Only a-Z 0-9 are allowed.");
+    }
+    return ($message);
+  }
+  function save()
+  {
+    $tmp=array();
+    foreach($this->attributes as $attrs){ 
+      $attr = preg_replace("/^Object_/","",$attrs);
+      $tmp[$attr] = $this->$attrs;
+    }
+
+    if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
+      $tmp['remove']['from']  = $this->orig_cn;
+      $tmp['remove']['to']    = $tmp['cn'];
+    }
+  
+    $tmp['dn']      = $this->dn;  
+    $tmp['status']  = $this->Object_status;  
+
+    return($tmp);
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/fai/class_faiVariable.inc b/plugins/admin/fai/class_faiVariable.inc
new file mode 100644 (file)
index 0000000..606f18c
--- /dev/null
@@ -0,0 +1,281 @@
+<?php
+
+class faiVariable extends plugin
+{
+  /* CLI vars */
+  var $cli_summary      = "Manage server basic objects";
+  var $cli_description  = "Some longer text\nfor help";
+  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account   = TRUE;
+
+  /* Attributes for this Object */
+  var $attributes       = array("cn","description");
+
+  /* ObjectClasses for this Object*/
+  var $objectclasses    = array("top","FAIclass","FAIvariable");
+
+  /* Class name of the Ldap ObjectClass for the Sub Object */
+  var $subClass         = "FAIvariableEntry";
+  var $subClasses       = array("top","FAIclass","FAIvariableEntry");
+
+  /* Class name of the php class which allows us to edit a Sub Object */
+  var $subClassName     = "faiVariableEntry";      
+
+  /* Attributes to initialise for each subObject */
+  var $subAttributes    = array("cn","description","FAIvariableContent"); 
+  var $sub64coded       = array("FAIvariableContent");  
+
+  /* Specific attributes */
+  var $cn               = "";       // The class name for this object
+  var $description      = "";       // The description for this set of partitions
+  var $is_dialog        = false;    // specifies which buttons will be shown to save or abort
+  var $dialog           = NULL;     // a dialog, e.g. new disk dialog
+  var $SubObjects       = array();  // All leafobjects of this object
+
+  function faiVariable ($config, $dn= NULL)
+  {
+    /* Load Attributes */
+    plugin::plugin ($config, $dn);
+
+    /* If "dn==new" we try to create a new entry
+     * Else we must read all objects from ldap which belong to this entry.
+     * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
+     */
+    if($dn != "new"){
+      $this->dn =$dn;
+
+      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
+       */
+      $ldap     = $this->config->get_ldap_link();
+      $ldap->cd ($this->dn);
+      $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$this->subAttributes);
+
+      while($object = $ldap->fetch()){
+        /* Set status for save management */
+  
+        foreach($this->subAttributes as $attrs){
+          if(!isset($object[$attrs][0])){
+            $this->SubObjects[$object['cn'][0]][$attrs]="";
+          }else{
+            $this->SubObjects[$object['cn'][0]][$attrs]=$object[$attrs][0];
+          }
+        }
+     
+        foreach($this->sub64coded as $codeIt){
+          $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
+        }
+        $this->SubObjects[$object['cn'][0]]['status']      = "edited";
+        $this->SubObjects[$object['cn'][0]]['dn']          = $object['dn'];
+      }
+    }
+  }
+
+  function execute()
+  {
+    /* Fill templating stuff */
+    $smarty= get_smarty();
+    $display= "";
+
+    /* Add new sub object */
+    if(isset($_POST['AddSubObject'])){
+      $this->dialog= new $this->subClassName($this->config,"new");
+      $this->is_dialog=true;
+    }
+
+    /* Edit selected Sub Object */
+    if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
+      $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$_POST['SubObject']]);
+      $this->is_dialog=true;
+    }
+    
+    /* Remove Sub object */
+    if((isset($_POST['DelSubObject']))&&(isset($_POST['SubObject']))){
+      if($this->SubObjects[$_POST['SubObject']]['status'] == "edited"){
+        $this->SubObjects[$_POST['SubObject']]['status']= "delete";
+      }else{
+        unset($this->SubObjects[$_POST['SubObject']]);
+      }
+    }
+
+    /* Save Dialog */
+    if(isset($_POST['SaveSubObject'])){
+      $this->dialog->save_object();
+      $msgs = $this->dialog->check();
+      if(count($msgs)>0){
+        foreach($msgs as $msg){
+          print_red($msg);
+        }
+      }else{
+        $obj = $this->dialog->save();
+        if(isset($obj['remove'])){
+          if($this->SubObjects[$obj['remove']['from']]['status']=="edited"){
+            $this->SubObjects[$obj['remove']['from']]['status'] = "delete";
+          }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){
+            unset($this->SubObjects[$obj['remove']['from']]);
+          }
+          $obj['status'] = "new";
+          $this->SubObjects[$obj['remove']['to']] = $obj;
+          unset($this->SubObjects[$obj['remove']['to']]['remove']);
+        }else{
+          $this->SubObjects[$obj['cn']]=$obj;
+        }
+        $this->is_dialog=false;
+        unset($this->dialog);
+        $this->dialog=NULL;
+      }
+    }
+
+    /* Cancel Dialog */
+    if(isset($_POST['CancelSubObject'])){
+      $this->is_dialog=false; 
+      unset($this->dialog);
+      $this->dialog=NULL;
+    }
+
+    /* Print dialog if $this->dialog is set */
+    if($this->dialog){
+      $this->dialog->save_object();
+      $display = $this->dialog->execute();
+      return($display);
+    }
+
+    $smarty->assign("SubObjects",$this->getList());
+    $smarty->assign("SubObjectKeys",array_flip($this->getList()));
+    /* Assign variables */
+    foreach($this->attributes as $attrs){
+      $smarty->assign($attrs,$this->$attrs);
+    }
+
+    $display.= $smarty->fetch(get_template_path('faiVariable.tpl', TRUE));
+    return($display);
+  }
+
+  /* Generate listbox friendly SubObject list
+  */
+  function getList(){
+    $a_return=array();
+    foreach($this->SubObjects as $obj){
+      if($obj['status'] != "delete"){
+        $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]";
+      }
+    }
+    return($a_return);
+  }
+
+  /* Delete me, and all my subtrees
+   */
+  function remove_from_parent()
+  {
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->dn);
+    $ldap->rmdir_recursive($this->dn);
+    $this->handle_post_events("remove");    
+  }
+
+
+  /* Save data to object 
+   */
+  function save_object()
+  {
+    plugin::save_object();
+    foreach($this->attributes as $attrs){
+      if(isset($_POST[$attrs])){
+        $this->$attrs = $_POST[$attrs];
+      }
+    }
+  }
+
+
+  /* Check supplied data */
+  function check()
+  {
+    $message= array();
+    $str = utf8_encode("üöä");
+    if((empty($this->description))||(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->description))){
+      $message[]=_("Please enter a valid description.");
+    }
+    return ($message);
+  }
+
+
+  /* Save to LDAP */
+  function save()
+  {
+    plugin::save();
+    $ldap = $this->config->get_ldap_link();
+  
+    $ldap->cat($this->dn);
+    if($ldap->count()!=0){
+      /* Write FAIscript to ldap*/
+      $ldap->cd($this->dn);
+      $ldap->modify($this->attrs);
+    }else{
+      /* Write FAIscript to ldap*/
+      $ldap->cd($this->dn);
+      $ldap->create_missing_trees($this->dn);
+      $ldap->cd($this->dn);
+      $ldap->add($this->attrs);
+    }
+    show_ldap_error($ldap->get_error());
+    /* Prepare FAIscriptEntry to write it to ldap
+     * First sort array.
+     *  Because we must delete old entries first.
+     * After deletion, we perform add and modify 
+     */
+    $Objects = array();
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] == "delete"){
+        $Objects[$name] = $obj; 
+      }
+    }
+    foreach($this->SubObjects as $name => $obj){
+      if($obj['status'] != "delete"){
+        $Objects[$name] = $obj; 
+      }
+    }
+
+    foreach($Objects as $name => $obj){
+
+      foreach($this->sub64coded as $codeIt){
+        $obj[$codeIt]=base64_encode($obj[$codeIt]);
+      }
+
+      $tmp = array();
+      foreach($this->subAttributes as $attrs){
+        if(empty($obj[$attrs])){
+          $obj[$attrs] = array();
+        }
+        $tmp[$attrs] = $obj[$attrs];
+      }    
+        
+      $tmp['objectClass'] = $this->subClasses;
+
+      $sub_dn = "cn=".$obj['cn'].",".$this->dn;
+      if($obj['status'] == "delete"){
+        $ldap->cd($sub_dn);
+        $ldap->rmdir_recursive($sub_dn);
+        $this->handle_post_events("remove");
+      }elseif($obj['status'] == "edited"){
+        $ldap->cd($sub_dn);
+        $ldap->modify($tmp);
+        $this->handle_post_events("modify");
+      }elseif($obj['status']=="new"){
+        $ldap->cd($sub_dn);
+        $ldap->create_missing_trees($sub_dn);
+        $ldap->cd($sub_dn);
+        $ldap->add($tmp); 
+        $this->handle_post_events("add");
+      }
+      show_ldap_error($ldap->get_error()); 
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/fai/class_faiVariableEntry.inc b/plugins/admin/fai/class_faiVariableEntry.inc
new file mode 100644 (file)
index 0000000..3f993cb
--- /dev/null
@@ -0,0 +1,118 @@
+<?php
+
+class faiVariableEntry extends plugin
+{
+  /* CLI vars */
+  var $cli_summary= "Manage server basic objects";
+  var $cli_description= "Some longer text\nfor help";
+  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+  /* attribute list for save action */
+  var $ignore_account= TRUE;
+  var $attributes   = array("Object_cn","Object_description","Object_FAIvariableContent");
+  var $objectclasses= array();
+
+  var $orig_cn              = "";
+  var $Object_dn            = "";
+  var $Object_cn            = "";
+  var $Object_FAIvariableContent   = "";
+  var $Object_description   = "";
+  var $Object_status        = "new";
+  
+  function faiVariableEntry ($config, $dn= NULL,$object=false)
+  {
+    plugin::plugin ($config, $dn);
+    if($dn != "new"){
+      $this->orig_cn= $object['cn'];
+      $this->dn=$object['dn'];
+      foreach($object as $name=>$value){
+        $oname = "Object_".$name;
+        $this->$oname=$value;
+      }
+    }else{
+      $this->Object_status = "new";
+      $this->orig_cn       = false;
+    }
+  }
+
+  function execute()
+  {
+    /* Fill templating stuff */
+    $smarty     = get_smarty();
+    $display = "";
+
+    foreach($this->attributes as $attrs){
+      $smarty->assign($attrs,stripslashes($this->$attrs));
+    }
+
+    for($i =1 ; $i <= 100 ; $i++){
+      $Object_FAIprioritys[$i]=$i;
+    }
+    $smarty->assign("Object_FAIprioritys",$Object_FAIprioritys);
+    $display.= $smarty->fetch(get_template_path('faiVariableEntry.tpl', TRUE));
+    return($display);
+  }
+
+  /* Save data to object */
+  function save_object()
+  {
+    if(isset($_POST['SubObjectFormSubmitted'])){
+      foreach($this->attributes as $attrs){
+        if(isset($_POST[$attrs])){
+          $this->$attrs = $_POST[$attrs];
+        }else{
+          $this->$attrs = "";
+        }
+      }
+    }
+  }
+
+  /* Check supplied data */
+  function check()
+  {
+    $message= array();
+    
+    $str = utf8_encode("üöä");
+    if(empty($this->Object_FAIvariableContent)) {
+      $message[]=_("Please specify a value for the attribute 'content'."); 
+    }
+   
+    if(empty($this->Object_description)){
+      $message[] = _("Please enter a description.");
+    }
+
+    if(preg_match("/[^a-z0-9".$str."\.,;:\-_\? ]/i",$this->Object_description)){
+      $message[] = _("Invalid character in description. Please enter a valid description.");
+    }
+
+    if(empty($this->Object_cn)){
+      $message[] = _("Please enter a name.");
+    }
+
+    if(preg_match("/[^0-9a-z]/i",$this->Object_cn)){
+      $message[] = _("Please enter a valid name. Only a-Z 0-9 are allowed.");
+    }
+    return ($message);
+  }
+  function save()
+  {
+    $tmp=array();
+    foreach($this->attributes as $attrs){ 
+      $attr = preg_replace("/^Object_/","",$attrs);
+      $tmp[$attr] = $this->$attrs;
+    }
+
+    if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
+      $tmp['remove']['from']  = $this->orig_cn;
+      $tmp['remove']['to']    = $tmp['cn'];
+    }
+  
+    $tmp['dn']      = $this->dn;  
+    $tmp['status']  = $this->Object_status;  
+    return($tmp);
+  }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/fai/faiHook.tpl b/plugins/admin/fai/faiHook.tpl
new file mode 100644 (file)
index 0000000..0a3d8e6
--- /dev/null
@@ -0,0 +1,51 @@
+<table width="100%">
+       <tr>
+               <td width="50%" valign="top">
+                               <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2><br>
+                               <table summary="" cellspacing="4">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="cn">
+                                                       {t}Name{/t}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input value="{$cn}" disabled id="cn">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="description">
+                                                       {t}Description{/t}{$must}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input value="{$description}" {$description} name="description" id="description">
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160);">
+                  &nbsp;
+               </td>
+               <td>
+                               <h2><img alt="" src="images/fai_hook.png" align="middle" title="{t}Objects{/t}">&nbsp;
+                                       <LABEL for="SubObject">
+                                               {t}This bundle contains the following objects{/t}
+                                       </LABEL>
+                               </h2><br>
+                               <table width="100%">
+                               <tr>
+                                       <td>
+                                               <select name="SubObject" title="{t}Choose a hook to delete or edit{/t}" style="width:350px;height:120px;" size=10 id="SubObject">
+                                                       {html_options values=$SubObjectKeys output=$SubObjects}
+                                               </select><br>
+                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}">
+                                               <input type="submit" name="EditSubObject"    value="{t}Edit{/t}"    title="{t}Edit{/t}">
+                                               <input type="submit" name="DelSubObject"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
+                                       </td>
+                               </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
diff --git a/plugins/admin/fai/faiHookEntry.tpl b/plugins/admin/fai/faiHookEntry.tpl
new file mode 100644 (file)
index 0000000..2dd86e4
--- /dev/null
@@ -0,0 +1,61 @@
+<input type="hidden" name="SubObjectFormSubmitted" value="1">
+<table width="100%" summary="">
+       <tr>
+               <td valign="top" width="50%">
+                       <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
+                               <table>
+                                       <tr>
+                                               <td>
+                                                       {t}Name{/t}&nbsp;{$must}
+                                               </td>
+                                               <td>
+                                                       <input value="{$Object_cn}" name="Object_cn">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       {t}Description{/t}&nbsp;{$must}
+                                               </td>
+                                               <td>
+                                                       <input value="{$Object_description}" name="Object_description">
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160);">
+           &nbsp;
+        </td>
+               <td>
+                               <h2><img alt="" src="images/fai_hook.png" align="middle" title="{t}Hook attributes{/t}">&nbsp;{t}Hook attributes{/t}</h2>
+                               <table width="100%">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="Object_FAIscript">
+                                                       {t}Script{/t}&nbsp;{$must}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input type="text" name="Object_FAIscript" value="{$Object_FAIscript}" id="Object_FAIscript" style="width:280px;">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="Object_FAItask">
+                                                       {t}Task{/t}&nbsp;{$must}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input type="text" name="Object_FAItask" value="{$Object_FAItask}" id="Object_FAItask" style="width:280px;">
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
+<p class="seperator">&nbsp;</p>
+<br>
+<div style="align:right;" align="right">
+       <input type="submit" value="{t}Save{/t}"        name="SaveSubObject">&nbsp;
+       <input type="submit" value="{t}Abort{/t}"       name="CancelSubObject">
+</div>
+
diff --git a/plugins/admin/fai/faiPackage.tpl b/plugins/admin/fai/faiPackage.tpl
new file mode 100644 (file)
index 0000000..d72310d
--- /dev/null
@@ -0,0 +1,29 @@
+<table width="100%">
+       <tr>
+               <td width="50%" valign="top">
+                               <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2><br>
+                               <table summary="" cellspacing="4">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="cn">
+                                                       {t}Name{/t}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input value="{$cn}" disabled id="cn">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="description">
+                                                       {t}Description{/t}{$must}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input value="{$description}" {$description} name="description" id="description">
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
diff --git a/plugins/admin/fai/faiPartitionTable.tpl b/plugins/admin/fai/faiPartitionTable.tpl
new file mode 100644 (file)
index 0000000..6d3f622
--- /dev/null
@@ -0,0 +1,51 @@
+<table width="100%">
+       <tr>
+               <td width="50%" valign="top">
+                               <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2><br>
+                               <table summary="" cellspacing="4">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="cn">
+                                                       {t}Name{/t}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input value="{$cn}" disabled id="cn">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="description">
+                                                       {t}Description{/t}{$must}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input value="{$description}" {$description} name="description" id="description">
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160);">
+                  &nbsp;
+               </td>
+               <td>
+                               <h2><img alt="" src="images/list_ogroup.png" align="middle" title="{t}Objects{/t}">&nbsp;
+                                       <LABEL for="SubObject">
+                                               {t}This partition table contains following disks{/t}
+                                       </LABEL>
+                               </h2><br>
+                               <table width="100%">
+                               <tr>
+                                       <td>
+                                               <select name="disks" title="{t}Choose a disk to delete or edit{/t}" style="width:350px;height:120px;" size=10 id="SubObject">
+                                                       {html_options values=$diskKeys output=$disks}
+                                               </select><br>
+                                               <input type="submit" name="AddDisk"     value="{t}Add{/t}"              title="{t}Add{/t}">
+                                               <input type="submit" name="EditDisk"    value="{t}Edit{/t}"    title="{t}Edit{/t}">
+                                               <input type="submit" name="DelDisk"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
+                                       </td>
+                               </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
diff --git a/plugins/admin/fai/faiPartitionTableEntry.tpl b/plugins/admin/fai/faiPartitionTableEntry.tpl
new file mode 100644 (file)
index 0000000..776905d
--- /dev/null
@@ -0,0 +1,40 @@
+<input type="hidden" name="TableEntryFrameSubmitted" value="1">
+<br>
+<h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
+<table>
+       <tr>
+               <td><LABEL for="DISK_cn">
+                       {t}Name{/t}
+                       </LABEL>&nbsp;{$must}
+               </td>
+               <td>
+                       <select name="DISK_cn" title="{t}Choose a disc name{/t}" {$DISK_cnACL} id="DISK_cn">
+                {html_options values=$cns output=$cns selected=$DISK_cn}
+            </select>
+               </td>
+       </tr>
+       <tr>
+               <td><LABEL for="DISK_description">
+                       {t}Description{/t}
+                       </LABEL>&nbsp;{$must}
+               </td>
+               <td>
+                       <input value="{$DISK_description}" name="DISK_description" id="DISK_description">
+               </td>
+       </tr>
+</table>
+<br>
+<p class="seperator">&nbsp;</p>
+<br>
+<h2><img alt="" src="images/editpaste.png" align="middle" title="{t}Partition entries{/t}">&nbsp;{t}Partition entries{/t}</h2>
+{$setup}
+<br>
+<input type="submit" name="AddPartition" value="{t}Add partition{/t}" >
+<br>   
+<br>
+<p class="seperator">&nbsp;</p>
+<br>
+<div style="align:right;" align="right">
+<input type="submit" name="SaveDisk" value="{t}Save{/t}" >
+<input type="submit" name="CancelDisk" value="{t}cancel{/t}" >
+</div>
diff --git a/plugins/admin/fai/faiProfile.tpl b/plugins/admin/fai/faiProfile.tpl
new file mode 100644 (file)
index 0000000..11185d2
--- /dev/null
@@ -0,0 +1,46 @@
+<h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2><br>
+<table summary="" cellspacing="4">
+       <tr>
+               <td>
+                       <LABEL for="cn">
+                       {t}Name{/t}{$must}
+                       </LABEL>
+               </td>
+               <td>
+                       <input value="{$cn}" id="cn" name="cn">
+               </td>
+       </tr>
+       <tr>
+               <td>
+                       <LABEL for="description">
+                       {t}Description{/t}{$must}
+                       </LABEL>
+               </td>
+               <td>
+                       <input value="{$description}" {$description} name="description" id="description">
+               </td>
+       </tr>
+</table>
+<br>
+
+<table summary="" style="vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top;">
+  <div class="contentboxh">
+    <p class="contentboxh">
+     <LABEL for="userlist">{t}List of used class names{/t}</LABEL> 
+    </p>
+  </div>
+                       <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+                               
+                               {$divlisthead}
+                       </div>
+                       <div style='height:4px;'>
+                       </div>
+                       <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+                               {$divlist}
+                               <input type="hidden" name="edit_helper">
+                       </div>
+               </td>
+       </tr>
+</table>
diff --git a/plugins/admin/fai/faiProfileEntry.tpl b/plugins/admin/fai/faiProfileEntry.tpl
new file mode 100644 (file)
index 0000000..b493523
--- /dev/null
@@ -0,0 +1,69 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top;width:600px">
+  <div class="contentboxh">
+    <p class="contentboxh">
+     {t}List of FAI objects (Fully Automatic Installation){/t}
+    </p>
+  </div>
+  <div class="contentboxb">
+      {$faihead}
+  </div>
+  <div style='height:4px;'></div>
+  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+      {$failist}
+    <input type=hidden name="edit_helper">
+  </div>
+  </td>
+  <td style="vertical-align:top;">
+   <div class="contentboxh">
+    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
+   </div>
+   <div class="contentboxb">
+   <p class="contentboxb">
+     {t}This menu allows you to select FAI class names and to add them to the currently edited profile.{/t}
+   </p>
+   </div>
+   <br>
+   <div class="contentboxh">
+    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
+   </div>
+   <div class="contentboxb">
+     <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+      {$alphabet}
+     </table>
+        <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+               <tr><td><input onChange='document.mainform.submit()' 
+                                                               type="checkbox" name="SShowTemplates"   {$SShowTemplatesCHK}>{t}Show only classes with templates{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit()'
+                                                               type="checkbox" name="SShowScripts"             {$SShowScriptsCHK}>{t}Show only classes with scripts{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit()'
+                                                               type="checkbox" name="SShowHooks"               {$SShowHooksCHK}>{t}Show only classes with hooks{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit()'
+                                                               type="checkbox" name="SShowVariables"   {$SShowVariablesCHK}>{t}Show only classes with variables{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit()'
+                                                               type="checkbox" name="SShowPackages"    {$SShowPackagesCHK}>{t}Show only classes with packages{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit()'
+                                                               type="checkbox" name="SShowPartitions"  {$SShowPartitionsCHK}>{t}Show only classes with partitions{/t}</td></tr>
+        </table>
+     <table summary=""  style="width:100%;border-top:1px solid #B0B0B0;">
+     <tr>
+     <td>
+     <LABEL for "regex"><img alt="{t}Display objects matching{/t}" src="{$search_image}" align=middle title='{t}Display objects matching{/t}'></LABEL>
+     </td>
+     <td width="99%">
+     <input type='text' name='Sregex' maxlength='20' style='width:99%' value='{$Sregex}' id='filter' 
+     title='{t}Regular expression for matching object names{/t}' onChange="mainform.submit()">
+     </td>
+     </tr>
+     </table>
+                           {$apply}
+   </div>
+  </td>
+</tr>
+</table summary="">
+<div align="right" style="align:right;">
+       <input name="SaveSubObject" value="Use" type="submit">
+       <input name="CancelSubObject" value="Cancel" type="submit">
+</div>
+<input type="hidden" name="ignore">
diff --git a/plugins/admin/fai/faiScript.tpl b/plugins/admin/fai/faiScript.tpl
new file mode 100644 (file)
index 0000000..0d405a1
--- /dev/null
@@ -0,0 +1,51 @@
+<table width="100%">
+       <tr>
+               <td width="50%" valign="top">
+                               <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2><br>
+                               <table summary="" cellspacing="4">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="cn">
+                                                       {t}Name{/t}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input value="{$cn}" disabled id="cn">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="description">
+                                                       {t}Description{/t}{$must}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input value="{$description}" {$description} name="description" id="description">
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160);">
+                  &nbsp;
+               </td>
+               <td>
+                               <h2><img alt="" src="images/list_ogroup.png" align="middle" title="{t}Objects{/t}">&nbsp;
+                                       <LABEL for="SubObject">
+                                               {t}This bundle contains the following objects{/t}
+                                       </LABEL>
+                               </h2><br>
+                               <table width="100%">
+                               <tr>
+                                       <td>
+                                               <select name="SubObject" title="{t}Choose a script to delete or edit{/t}" style="width:350px;height:120px;" size=10 id="SubObject">
+                                                       {html_options values=$SubObjectKeys output=$SubObjects}
+                                               </select><br>
+                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}">
+                                               <input type="submit" name="EditSubObject"    value="{t}Edit{/t}"    title="{t}Edit{/t}">
+                                               <input type="submit" name="DelSubObject"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
+                                       </td>
+                               </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
diff --git a/plugins/admin/fai/faiScriptEntry.tpl b/plugins/admin/fai/faiScriptEntry.tpl
new file mode 100644 (file)
index 0000000..e5d7a70
--- /dev/null
@@ -0,0 +1,72 @@
+<input type="hidden" name="SubObjectFormSubmitted" value="1">
+<table width="100%" summary="">
+       <tr>
+               <td valign="top" width="50%">
+                       <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
+                               <table>
+                                       <tr>
+                                               <td>
+                                                       {t}Name{/t}&nbsp;{$must}
+                                               </td>
+                                               <td>
+                                                       <input value="{$Object_cn}" name="Object_cn">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       {t}Description{/t}&nbsp;{$must}
+                                               </td>
+                                               <td>
+                                                       <input value="{$Object_description}" name="Object_description">
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160);">
+           &nbsp;
+        </td>
+               <td valign="top">
+                               <h2><img alt="" src="images/edit.png" align="middle" title="{t}Script attributes{/t}">&nbsp;{t}Script attributes{/t}</h2>
+                               <table width="100%">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="Object_FAIpriority">
+                                                       {t}Priority{/t}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                   <select name="Object_FAIpriority" title="{t}Choose a priority{/t}" Object_FAIpriority>
+                                               {html_options values=$Object_FAIprioritys output=$Object_FAIprioritys selected=$Object_FAIpriority}
+                                       </select>
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
+<p class="seperator">&nbsp;</p>
+<h2><img alt="" src="images/envelope.png" align="middle" title="{t}Script attributes{/t}">&nbsp;
+       <LABEL for="Object_FAIscript">
+               {t}Script{/t}
+       </LABEL>
+       </h2>
+<div>
+       {t}Import script{/t} &nbsp;
+       <input type="file" name="ImportFile">&nbsp;
+       <input type="submit" name="ImportUpload" value="{t}Import{/t}">
+</div>
+<br>
+<table width="100%">
+    <tr>
+        <td>
+            <textarea name="Object_FAIscript" style="width:100%;height:300px;" id="Object_FAIscript">{$Object_FAIscript}</textarea>
+        </td>
+    </tr>
+</table>
+
+<br>
+<div style="align:right;" align="right">
+       <input type="submit" value="{t}Save{/t}"        name="SaveSubObject">&nbsp;
+       <input type="submit" value="{t}Abort{/t}"       name="CancelSubObject">
+</div>
+
diff --git a/plugins/admin/fai/faiTemplate.tpl b/plugins/admin/fai/faiTemplate.tpl
new file mode 100644 (file)
index 0000000..e310be2
--- /dev/null
@@ -0,0 +1,51 @@
+<table width="100%">
+       <tr>
+               <td width="50%" valign="top">
+                               <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2><br>
+                               <table summary="" cellspacing="4">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="cn">
+                                                       {t}Name{/t}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input value="{$cn}" disabled id="cn">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="description">
+                                                       {t}Description{/t}{$must}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input value="{$description}" {$description} name="description" id="description">
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160);">
+                  &nbsp;
+               </td>
+               <td>
+                               <h2><img alt="" src="images/fai_template.png" align="middle" title="{t}Objects{/t}">&nbsp;
+                                       <LABEL for="SubObject">
+                                               {t}This bundle contains the following objects{/t}
+                                       </LABEL>
+                               </h2><br>
+                               <table width="100%">
+                               <tr>
+                                       <td>
+                                               <select name="SubObject" title="{t}Choose a template to delete or edit{/t}" style="width:350px;height:120px;" size=10 id="SubObject">
+                                                       {html_options values=$SubObjectKeys output=$SubObjects}
+                                               </select><br>
+                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}">
+                                               <input type="submit" name="EditSubObject"    value="{t}Edit{/t}"    title="{t}Edit{/t}">
+                                               <input type="submit" name="DelSubObject"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
+                                       </td>
+                               </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
diff --git a/plugins/admin/fai/faiTemplateEntry.tpl b/plugins/admin/fai/faiTemplateEntry.tpl
new file mode 100644 (file)
index 0000000..44c3bf8
--- /dev/null
@@ -0,0 +1,61 @@
+<input type="hidden" name="SubObjectFormSubmitted" value="1">
+<table width="100%" summary="">
+       <tr>
+               <td valign="top" width="50%">
+                       <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
+                               <table>
+                                       <tr>
+                                               <td>
+                                                       {t}Name{/t}&nbsp;{$must}
+                                               </td>
+                                               <td>
+                                                       <input value="{$Object_cn}" name="Object_cn">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       {t}Description{/t}&nbsp;{$must}
+                                               </td>
+                                               <td>
+                                                       <input value="{$Object_description}" name="Object_description">
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160);">
+           &nbsp;
+        </td>
+               <td>
+                               <h2><img alt="" src="images/fai_template.png" align="middle" title="{t}Template attributes{/t}">&nbsp;{t}Template attributes{/t}</h2>
+                               <table width="100%">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="Object_FAItemplatePath">
+                                                       {t}Path{/t}&nbsp;{$must}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input type="text" name="Object_FAItemplatePath" value="{$Object_FAItemplatePath}" id="Object_FAItemplatePath">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="Object_FAItemplateFile">
+                                                       {t}File{/t}&nbsp;{$must}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input type="text" name="Object_FAItemplateFile" value="{$Object_FAItemplateFile}" id="Object_FAItemplateFile">
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
+<p class="seperator">&nbsp;</p>
+<br>
+<div style="align:right;" align="right">
+       <input type="submit" value="{t}Save{/t}"        name="SaveSubObject">&nbsp;
+       <input type="submit" value="{t}Abort{/t}"       name="CancelSubObject">
+</div>
+
diff --git a/plugins/admin/fai/faiVariable.tpl b/plugins/admin/fai/faiVariable.tpl
new file mode 100644 (file)
index 0000000..cc3871e
--- /dev/null
@@ -0,0 +1,51 @@
+<table width="100%">
+       <tr>
+               <td width="50%" valign="top">
+                               <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2><br>
+                               <table summary="" cellspacing="4">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="cn">
+                                                       {t}Name{/t}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input value="{$cn}" disabled id="cn">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="description">
+                                                       {t}Description{/t}{$must}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input value="{$description}" {$description} name="description" id="description">
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160);">
+                  &nbsp;
+               </td>
+               <td>
+                               <h2><img alt="" src="images/fai_variable.png" align="middle" title="{t}Objects{/t}">&nbsp;
+                                       <LABEL for="SubObject">
+                                               {t}This bundle contains the following objects{/t}
+                                       </LABEL>
+                               </h2><br>
+                               <table width="100%">
+                               <tr>
+                                       <td>
+                                               <select name="SubObject" title="{t}Choose a variable to delete or edit{/t}" style="width:350px;height:120px;" size=10 id="SubObject">
+                                                       {html_options values=$SubObjectKeys output=$SubObjects}
+                                               </select><br>
+                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}">
+                                               <input type="submit" name="EditSubObject"    value="{t}Edit{/t}"    title="{t}Edit{/t}">
+                                               <input type="submit" name="DelSubObject"     value="{t}Delete{/t}"  title="{t}Delete{/t}">
+                                       </td>
+                               </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
diff --git a/plugins/admin/fai/faiVariableEntry.tpl b/plugins/admin/fai/faiVariableEntry.tpl
new file mode 100644 (file)
index 0000000..131e7d1
--- /dev/null
@@ -0,0 +1,51 @@
+<input type="hidden" name="SubObjectFormSubmitted" value="1">
+<table width="100%" summary="">
+       <tr>
+               <td valign="top" width="50%">
+                       <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}">&nbsp;{t}Generic{/t}</h2>
+                               <table>
+                                       <tr>
+                                               <td>
+                                                       {t}Name{/t}&nbsp;{$must}
+                                               </td>
+                                               <td>
+                                                       <input value="{$Object_cn}" name="Object_cn">
+                                               </td>
+                                       </tr>
+                                       <tr>
+                                               <td>
+                                                       {t}Description{/t}&nbsp;{$must}
+                                               </td>
+                                               <td>
+                                                       <input value="{$Object_description}" name="Object_description">
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+               <td style="border-left: 1px solid rgb(160, 160, 160);">
+           &nbsp;
+        </td>
+               <td valign="top">
+                               <h2><img alt="" src="images/fai_variable.png" align="middle" title="{t}Variable attributes{/t}">&nbsp;{t}Variable attributes{/t}</h2>
+                               <table width="100%">
+                                       <tr>
+                                               <td>
+                                                       <LABEL for="Content">
+                                                       {t}Variable Content{/t}{$must}
+                                                       </LABEL>
+                                               </td>
+                                               <td>
+                                                       <input type="text" name="Object_FAIvariableContent" value="{$Object_FAIvariableContent}" id="Content" style="width:250px;">
+                                               </td>
+                                       </tr>
+                               </table>
+               </td>
+       </tr>
+</table>
+<p class="seperator">&nbsp;</p>
+<br>
+<div style="align:right;" align="right">
+       <input type="submit" value="{t}Save{/t}"        name="SaveSubObject">&nbsp;
+       <input type="submit" value="{t}Abort{/t}"       name="CancelSubObject">
+</div>
+
diff --git a/plugins/admin/fai/headpage.tpl b/plugins/admin/fai/headpage.tpl
new file mode 100644 (file)
index 0000000..2a4714c
--- /dev/null
@@ -0,0 +1,61 @@
+<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
+<tr>
+  <td style="vertical-align:top;width:600px">
+  <div class="contentboxh">
+    <p class="contentboxh">
+     {t}List of FAI objects (Fully Automatic Installation){/t}
+    </p>
+  </div>
+  <div class="contentboxb">
+      {$faihead}
+  </div>
+  <div style='height:4px;'></div>
+  <div class="contentboxb" style="border-top:1px solid #B0B0B0;">
+      {$failist}
+    <input type=hidden name="edit_helper">
+  </div>
+  </td>
+  <td style="vertical-align:top;">
+   <div class="contentboxh">
+    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
+   </div>
+   <div class="contentboxb">
+   <p class="contentboxb">
+     {t}This menu allows you to create, delete and edit FAI objects.{/t}
+   </p>
+   </div>
+   <br>
+   <div class="contentboxh">
+    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
+   </div>
+   <div class="contentboxb">
+     <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+      {$alphabet}
+     </table>
+        <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+               <tr><td><input onChange='document.mainform.submit();' type="checkbox" name="ShowProfiles"               {$ShowProfilesCHK}>{t}Show profiles{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit();' type="checkbox" name="ShowTemplates"      {$ShowTemplatesCHK}>{t}Show templates{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit();' type="checkbox" name="ShowScripts"                {$ShowScriptsCHK}>{t}Show scripts{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit();' type="checkbox" name="ShowHooks"          {$ShowHooksCHK}>{t}Show hooks{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit();' type="checkbox" name="ShowVariables"      {$ShowVariablesCHK}>{t}Show variables{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit();' type="checkbox" name="ShowPackages"               {$ShowPackagesCHK}>{t}Show packages{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit();' type="checkbox" name="ShowPartitions"     {$ShowPartitionsCHK}>{t}Show partitions{/t}</td></tr>
+        </table>
+     <table summary=""  style="width:100%;border-top:1px solid #B0B0B0;">
+     <tr>
+     <td>
+     <LABEL for "regex"><img alt="{t}Display objects matching{/t}" src="{$search_image}" align=middle title='{t}Display objects matching{/t}'></LABEL>
+     </td>
+     <td width="99%">
+     <input type='text' name='regex' maxlength='20' style='width:99%' value='{$regex}' id='filter' 
+     title='{t}Regular expression for matching object names{/t}' onChange="mainform.submit()">
+     </td>
+     </tr>
+     </table>
+                           {$apply}
+   </div>
+  </td>
+</tr>
+</table summary="">
+
+<input type="hidden" name="ignore">
diff --git a/plugins/admin/fai/main.inc b/plugins/admin/fai/main.inc
new file mode 100644 (file)
index 0000000..36d3c50
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2003  Cajus Pollmeier
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+if ($remove_lock){
+        if(isset($_SESSION['FAI'])){
+                $FAI= $_SESSION['FAI'];
+                $FAI->remove_lock();
+                del_lock ($ui->dn);
+                sess_del ('FAI');
+        }
+} else {
+       /* Create usermanagement object on demand */
+       if (!isset($_SESSION['FAI']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+               $_SESSION['FAI']= new faiManagement($config, $ui);
+       }
+       $FAI= $_SESSION['FAI'];
+       $output= $FAI->execute();
+
+       /* Page header*/
+       if (isset($_SESSION['objectinfo'])){
+               $display= print_header(get_template_path('images/fai.png'), _("FAI management"), "<img alt=\"\" align=\"middle\" src=\"".get_template_path('images/closedlock.png')."\"> ".$_SESSION['objectinfo']);
+       } else {
+               $display= print_header(get_template_path('images/fai.png'), _("FAI management"));
+       }
+
+       /* Reset requested? */
+       if (isset($_GET['reset']) && $_GET['reset'] == 1){
+               del_lock ($ui->dn);
+               sess_del ('FAI');
+       }
+
+       /* Show and save dialog */
+       $FAI->save_object();
+       $display.= $output;
+       $_SESSION['FAI']= $FAI;
+}
+
+?>
diff --git a/plugins/admin/fai/remove.tpl b/plugins/admin/fai/remove.tpl
new file mode 100644 (file)
index 0000000..2d1deee
--- /dev/null
@@ -0,0 +1,18 @@
+<div style="font-size:18px;">
+<img alt="" src="images/button_cancel.png" align=top>&nbsp;{t}Warning{/t}
+</div>
+
+<p>
+ {$warning}
+ {t}This includes <b>all</b> object informations. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
+</p>
+
+<p>
+ {t}Best thing to do before performing this action would be to save the current contents of your LDAP tree in a file. So - if you've done so - press <i>Delete</i> to continue or <i>Cancel</i> to abort.{/t}
+</p>
+
+<p class="plugbottom">
+  <input type=submit name="delete_terminal_confirm" value="{t}Delete{/t}">
+  &nbsp;
+  <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+</p>
diff --git a/plugins/admin/fai/tabsHook.inc b/plugins/admin/fai/tabsHook.inc
new file mode 100644 (file)
index 0000000..f438f82
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+
+class tabsHook extends tabs
+{
+  var $base= "";
+
+  function tabsHook($config, $data, $dn)
+  {
+       tabs::tabs($config, $data, $dn);
+  }
+
+  function check()
+  {
+       return (tabs::check(TRUE));
+  }
+  
+
+  function save()
+  {
+       $baseobject= $this->by_object['faiHook'];
+
+       $new_dn= 'cn='.$baseobject->cn.",ou=hooks,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE'];
+
+       if ($this->dn != $new_dn && $this->dn != "new"){
+               
+               /* if( new_dn is subtree of this->dn ) */
+               $cnt1 = count(split(",",$this->dn));
+               $cnt2 = count(split(",",$new_dn));
+               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+               }else{
+                       $baseobject->recursive_move($this->dn, $new_dn);
+               }
+       }
+       $this->dn= $new_dn;
+
+       tabs::save(TRUE);
+  }
+
+}
+
+?>
diff --git a/plugins/admin/fai/tabsPackage.inc b/plugins/admin/fai/tabsPackage.inc
new file mode 100644 (file)
index 0000000..fdb1cb5
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+
+class tabsPackage extends tabs
+{
+  var $base= "";
+
+  function tabsPackage($config, $data, $dn)
+  {
+       tabs::tabs($config, $data, $dn);
+  }
+
+  function check()
+  {
+       return (tabs::check(TRUE));
+  }
+  
+
+  function save()
+  {
+       $baseobject= $this->by_object['faiPackage'];
+
+       $new_dn= 'cn='.$baseobject->cn.",ou=packages,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE'];
+       
+       if ($this->dn != $new_dn && $this->dn != "new"){
+               
+               /* if( new_dn is subtree of this->dn ) */
+               $cnt1 = count(split(",",$this->dn));
+               $cnt2 = count(split(",",$new_dn));
+               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+               }else{
+                       $baseobject->recursive_move($this->dn, $new_dn);
+               }
+       }
+       $this->dn= $new_dn;
+
+       tabs::save(TRUE);
+  }
+
+}
+
+?>
diff --git a/plugins/admin/fai/tabsPartition.inc b/plugins/admin/fai/tabsPartition.inc
new file mode 100644 (file)
index 0000000..d61396d
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+
+class tabsPartition extends tabs
+{
+  var $base= "";
+
+  function tabsPartition($config, $data, $dn)
+  {
+       tabs::tabs($config, $data, $dn);
+  }
+
+  function check()
+  {
+       return (tabs::check(TRUE));
+  }
+  
+
+  function save()
+  {
+       $baseobject= $this->by_object['faiPartitionTable'];
+
+       // cn=FAIBASE,ou=disk,ou=fai,ou=configs,ou=systems,dc=gonicus,dc=de
+       $new_dn= 'cn='.$baseobject->cn.",ou=disk,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE'];
+       
+       // Old .. $new_dn= 'ou='.$baseobject->ou.','.$baseobject->base;
+
+       if ($this->dn != $new_dn && $this->dn != "new"){
+               
+               /* if( new_dn is subtree of this->dn ) */
+               $cnt1 = count(split(",",$this->dn));
+               $cnt2 = count(split(",",$new_dn));
+               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+               }else{
+                       $baseobject->recursive_move($this->dn, $new_dn);
+               }
+       }
+       $this->dn= $new_dn;
+
+       tabs::save(TRUE);
+  }
+
+}
+
+?>
diff --git a/plugins/admin/fai/tabsProfile.inc b/plugins/admin/fai/tabsProfile.inc
new file mode 100644 (file)
index 0000000..97dcdb0
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+
+class tabsProfile extends tabs
+{
+  var $base= "";
+
+  function tabsProfile($config, $data, $dn)
+  {
+       tabs::tabs($config, $data, $dn);
+  }
+
+  function check()
+  {
+       return (tabs::check(TRUE));
+  }
+  
+
+  function save()
+  {
+       $baseobject= $this->by_object['faiProfile'];
+
+       $new_dn= 'cn='.$baseobject->cn.",ou=profiles,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE'];
+       
+       if ($this->dn != $new_dn && $this->dn != "new"){
+               
+               /* if( new_dn is subtree of this->dn ) */
+               $cnt1 = count(split(",",$this->dn));
+               $cnt2 = count(split(",",$new_dn));
+               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+               }else{
+                       $baseobject->recursive_move($this->dn, $new_dn);
+               }
+       }
+       $this->dn= $new_dn;
+
+       tabs::save(TRUE);
+  }
+
+}
+
+?>
diff --git a/plugins/admin/fai/tabsScript.inc b/plugins/admin/fai/tabsScript.inc
new file mode 100644 (file)
index 0000000..cb6dcf3
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+
+class tabsScript extends tabs
+{
+  var $base= "";
+
+  function tabsScript($config, $data, $dn)
+  {
+       tabs::tabs($config, $data, $dn);
+  }
+
+  function check()
+  {
+       return (tabs::check(TRUE));
+  }
+  
+
+  function save()
+  {
+       $baseobject= $this->by_object['faiScript'];
+
+       $new_dn= 'cn='.$baseobject->cn.",ou=scripts,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE'];
+       
+       if ($this->dn != $new_dn && $this->dn != "new"){
+               
+               /* if( new_dn is subtree of this->dn ) */
+               $cnt1 = count(split(",",$this->dn));
+               $cnt2 = count(split(",",$new_dn));
+               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+               }else{
+                       $baseobject->recursive_move($this->dn, $new_dn);
+               }
+       }
+       $this->dn= $new_dn;
+
+       tabs::save(TRUE);
+  }
+
+}
+
+?>
diff --git a/plugins/admin/fai/tabsTemplate.inc b/plugins/admin/fai/tabsTemplate.inc
new file mode 100644 (file)
index 0000000..ada68ce
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+
+class tabsTemplate extends tabs
+{
+  var $base= "";
+
+  function tabsTemplate($config, $data, $dn)
+  {
+       tabs::tabs($config, $data, $dn);
+  }
+
+  function check()
+  {
+       return (tabs::check(TRUE));
+  }
+  
+
+  function save()
+  {
+       $baseobject= $this->by_object['faiTemplate'];
+
+       $new_dn= 'cn='.$baseobject->cn.",ou=templates,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE'];
+       
+       if ($this->dn != $new_dn && $this->dn != "new"){
+               
+               /* if( new_dn is subtree of this->dn ) */
+               $cnt1 = count(split(",",$this->dn));
+               $cnt2 = count(split(",",$new_dn));
+               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+               }else{
+                       $baseobject->recursive_move($this->dn, $new_dn);
+               }
+       }
+       $this->dn= $new_dn;
+
+       tabs::save(TRUE);
+  }
+
+}
+
+?>
diff --git a/plugins/admin/fai/tabsVariable.inc b/plugins/admin/fai/tabsVariable.inc
new file mode 100644 (file)
index 0000000..86a8851
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+
+class tabsVariable extends tabs
+{
+  var $base= "";
+
+  function tabsVariable($config, $data, $dn)
+  {
+       tabs::tabs($config, $data, $dn);
+  }
+
+  function check()
+  {
+       return (tabs::check(TRUE));
+  }
+  
+
+  function save()
+  {
+       $baseobject= $this->by_object['faiVariable'];
+
+       $new_dn= 'cn='.$baseobject->cn.",ou=variables,ou=fai,ou=configs,ou=systems,".$_SESSION['config']->current['BASE'];
+       
+       if ($this->dn != $new_dn && $this->dn != "new"){
+               
+               /* if( new_dn is subtree of this->dn ) */
+               $cnt1 = count(split(",",$this->dn));
+               $cnt2 = count(split(",",$new_dn));
+               if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+                       print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+               }else{
+                       $baseobject->recursive_move($this->dn, $new_dn);
+               }
+       }
+       $this->dn= $new_dn;
+
+       tabs::save(TRUE);
+  }
+
+}
+
+?>