X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Ffai%2Fclass_faiTemplate.inc;h=f8d4c6b8b20e235aa37634cbe0f68f9f77b5d3e1;hb=ca98ca8c7d1adccfcf78ccc86faa5d9e2d69967e;hp=fd30c52e0204386f0fd2096d3695b4e62262815a;hpb=49899e00578701e9a43eb950074551bb54116f5c;p=gosa.git diff --git a/plugins/admin/fai/class_faiTemplate.inc b/plugins/admin/fai/class_faiTemplate.inc index fd30c52e0..f8d4c6b8b 100644 --- a/plugins/admin/fai/class_faiTemplate.inc +++ b/plugins/admin/fai/class_faiTemplate.inc @@ -24,8 +24,8 @@ class faiTemplate extends plugin var $subClassName = "faiTemplateEntry"; /* Attributes to initialise for each subObject */ - var $subAttributes = array("cn","description","FAItemplateFile","FAItemplatePath"); - var $sub64coded = array("FAItemplateFile","FAItemplatePath"); + var $subAttributes = array("cn","description","FAItemplateFile","FAItemplatePath","FAIowner","FAImode"); + var $sub64coded = array(); /* Specific attributes */ var $cn = ""; // The class name for this object @@ -64,19 +64,23 @@ class faiTemplate extends plugin } foreach($this->sub64coded as $codeIt){ - $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]); + $this->SubObjects[$object['cn'][0]][$codeIt]= base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]); } - $this->SubObjects[$object['cn'][0]]['FAItemplateFile'] =base64_decode($this->readBinary("FAItemplateFile",$object['dn'])); + $this->SubObjects[$object['cn'][0]]['FAItemplateFile']= $this->readBinary("FAItemplateFile",$object['dn']); - $this->SubObjects[$object['cn'][0]]['status'] = "edited"; - $this->SubObjects[$object['cn'][0]]['dn'] = $object['dn']; + $this->SubObjects[$object['cn'][0]]['status']= "edited"; + $this->SubObjects[$object['cn'][0]]['dn']= $object['dn']; } + ksort($this->SubObjects); } } function execute() { + /* Call parent execute */ + plugin::execute(); + /* Fill templating stuff */ $smarty= get_smarty(); $display= ""; @@ -87,9 +91,15 @@ class faiTemplate extends plugin $this->is_dialog=true; } + if($this->dn != "new"){ + $_SESSION['objectinfo']= $this->dn; + } + + /* Edit selected Sub Object */ if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){ $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$_POST['SubObject']]); + $_SESSION['objectinfo'] = $this->SubObjects[$_POST['SubObject']]['dn']; $this->is_dialog=true; } @@ -127,6 +137,7 @@ class faiTemplate extends plugin $this->is_dialog=false; unset($this->dialog); $this->dialog=NULL; + ksort($this->SubObjects); } } @@ -169,7 +180,11 @@ class faiTemplate extends plugin $a_return=array(); foreach($this->SubObjects as $obj){ if($obj['status'] != "delete"){ + if((isset($obj['description']))&&(!empty($obj['description']))){ + if(strlen($obj['description']) > 60){ + $obj['description'] = substr($obj['description'],0,60)."..."; + } $a_return[$obj['cn']]= $obj['cn']." [".$obj['description']."]"; }else{ $a_return[$obj['cn']]= $obj['cn']; @@ -194,10 +209,12 @@ class faiTemplate extends plugin */ function save_object() { - plugin::save_object(); - foreach($this->attributes as $attrs){ - if(isset($_POST[$attrs])){ - $this->$attrs = $_POST[$attrs]; + if(isset($_POST['FAItemplate_posted'])){ + plugin::save_object(); + foreach($this->attributes as $attrs){ + if(isset($_POST[$attrs])){ + $this->$attrs = $_POST[$attrs]; + } } } }