summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7d95e41)
raw | patch | inline | side by side (parent: 7d95e41)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 7 Sep 2005 13:21:08 +0000 (13:21 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 7 Sep 2005 13:21:08 +0000 (13:21 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1318 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/FAI/class_faiHookEntry.inc | [new file with mode: 0644] | patch | blob |
plugins/admin/FAI/class_faiTemplate.inc | [new file with mode: 0644] | patch | blob |
plugins/admin/FAI/class_faiTemplateEntry.inc | [new file with mode: 0644] | patch | blob |
plugins/admin/FAI/class_faiVariable.inc | [new file with mode: 0644] | patch | blob |
plugins/admin/FAI/class_faiVariableEntry.inc | [new file with mode: 0644] | patch | blob |
diff --git a/plugins/admin/FAI/class_faiHookEntry.inc b/plugins/admin/FAI/class_faiHookEntry.inc
--- /dev/null
@@ -0,0 +1,100 @@
+<?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();
+
+
+ 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
--- /dev/null
@@ -0,0 +1,261 @@
+<?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","FAIowner");
+
+ /* 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];
+ }
+ }
+
+ $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();
+
+ /* Write FAIscript to ldap*/
+ $ldap->cd($this->dn);
+ $ldap->modify($this->attrs);
+
+ /* 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){
+ $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
--- /dev/null
@@ -0,0 +1,100 @@
+<?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_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 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();
+
+
+ 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
--- /dev/null
@@ -0,0 +1,261 @@
+<?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");
+
+ /* 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];
+ }
+ }
+
+ $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();
+
+ /* Write FAIscript to ldap*/
+ $ldap->cd($this->dn);
+ $ldap->modify($this->attrs);
+
+ /* 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){
+ $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
--- /dev/null
@@ -0,0 +1,100 @@
+<?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_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 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();
+
+
+ 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:
+?>