diff --git a/plugins/admin/fai/class_faiVariableEntry.inc b/plugins/admin/fai/class_faiVariableEntry.inc
index a73a13ab1342846a9cb6d1bbc59c4a771392b99c..6dc864d17c9ba9fadef3a28bff5a15101b6a6439 100644 (file)
var $FAIvariableContent = "";
var $description = "";
var $status = "new";
+
+ var $FAIstate = "";
function faiVariableEntry ($config, $dn= NULL,$object=false)
{
plugin::plugin ($config, $dn);
- if($dn != "new"){
+ if((isset($object['cn'])) && (!empty($object['cn']))){
$this->orig_cn= $object['cn'];
$this->dn=$object['dn'];
foreach($object as $name=>$value){
$oname = $name;
$this->$oname=addslashes($value);
}
+
+ if(isset($this->attrs['FAIstate'][0])){
+ $this->FAIstate = $this->attrs['FAIstate'][0];
+ }
+
}else{
$this->status = "new";
$this->orig_cn = false;
function execute()
{
+ /* Call parent execute */
+ plugin::execute();
+
/* Fill templating stuff */
$smarty = get_smarty();
$display = "";
*/
foreach($this->attributes as $attrs){
if(get_magic_quotes_gpc()){
- $smarty->assign($attrs,htmlentities (stripslashes($this->$attrs)));
+ $smarty->assign($attrs,htmlentities (stripslashes(utf8_decode($this->$attrs))));
}else{
- $smarty->assign($attrs,htmlentities (($this->$attrs)));
+ $smarty->assign($attrs,htmlentities (utf8_decode($this->$attrs)));
+ }
+ }
+
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $name => $translated){
+ $acl = $this->getacl($name);
+ if($this->FAIstate == "freezed"){
+ $acl = preg_replace("/w/","",$acl);
}
+ $smarty->assign($name."ACL",$acl);
}
+
+
$display.= $smarty->fetch(get_template_path('faiVariableEntry.tpl', TRUE));
return($display);
}
/* Save data to object */
function save_object()
{
- if(isset($_POST['SubObjectFormSubmitted'])){
+ if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
foreach($this->attributes as $attrs){
- if(isset($_POST[$attrs])){
- $this->$attrs = $_POST[$attrs];
- }else{
- $this->$attrs = "";
+ if($this->acl_is_writeable($attrs)){
+ if(isset($_POST[$attrs])){
+ $this->$attrs = $_POST[$attrs];
+ }else{
+ $this->$attrs = "";
+ }
}
}
}
/* Check supplied data */
function check()
{
- $message= array();
+ /* Call common method to give check the hook */
+ $message= plugin::check();
if(empty($this->FAIvariableContent)) {
$message[]=_("Please specify a value for the attribute 'content'.");
$tmp['status'] = $this->status;
return($tmp);
}
+
+ /* Return plugin informations for acl handling */
+ function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Variable entry"),
+ "plDescription" => _("FAI variable entry "),
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 23,
+ "plSection" => array("administration"),
+ "plCategory" => array("fai"),
+ "plProvidedAcls" => array(
+ "cn" => _("Name"),
+ "description" => _("Description"),
+ "FAIvariableContent"=> _("Variable content") )
+ ));
+ }
+
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>