"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(preg_replace('/^[^,]+,[^,]+,/', '', $this->dn)); $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $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: ?>