diff --git a/gosa-plugins/fai/admin/fai/class_faiTemplate.inc b/gosa-plugins/fai/admin/fai/class_faiTemplate.inc
index 863ee2b3e877252db0be0d0c9543cebdacf9d167..7ea9a836befe4cb641f8e529647b32c37aa6c773 100644 (file)
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;
$attrs_to_search[] = "FAIstate";
$ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search);
+ $data = array();
while($object = $ldap->fetch()){
+ $data[] = $object;
+ }
+ foreach($data as $object){
/* Skip objects, that are tagged as removed */
if(isset($object['FAIstate'][0])){
$this->SubObjects[$objects['cn']] = $objects;
}
}
+ $this->is_new = FALSE;
+ if($this->dn == "new"){
+ $this->is_new =TRUE;
+ }
$this->ui = get_userinfo();
}
if(in_array_ics($attrs,$this->sub64coded)){
$var = base64_decode($var);
}
+ $var = stripslashes($var);
/* check if this is a binary entry */
if(in_array_ics($attrs,$this->subBinary)){
$var = $ldap->get_attribute($object['dn'], $attrs,$r_array=0);
}
-
- $var = stripslashes($var);
$object[$attrs] = $var;
}
$msgs = $this->dialog->check();
if(count($msgs)>0){
foreach($msgs as $msg){
- print_red($msg);
+ msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
}
}else{
/* Get return object */
}else{
$act .= "<input type='image' src='images/edit.png' name='editscript_%s' title='"._("edit")."' alt='"._("edit")."'>";
if(preg_match("/d/",$acl)){
- $act .="<input type='image' src='images/edittrash.png' name='deletescript_%s' title='"._("delete")."' alt='"._("delete")."'>";
+ $act .="<input type='image' src='images/lists/trash.png' name='deletescript_%s' title='"._("delete")."' alt='"._("delete")."'>";
}
}
/* Call common method to give check the hook */
$message= plugin::check();
+ /* Ensure that we do not overwrite an allready existing entry
+ */
+ if($this->is_new){
+ $new_dn= 'cn='.$this->cn.",".get_ou('faitemplateou').get_ou('faiou').session::get('CurrentMainBase');
+ $faifilter = session::get('faifilter');
+ if($faifilter['branch']!="main"){
+ $new_dn ='cn='.$this->cn.",".get_ou('faitemplateou').$faifilter['branch'];
+ }
+
+ $res = faiManagement::check_class_name("FAItemplate",$this->cn,$new_dn);
+ if(isset($res[$this->cn])){
+ $message[] = msgPool::duplicated(_("Name"));
+ }
+ }
+
return ($message);
}
$ldap = $this->config->get_ldap_link();
FAI::prepare_to_save_FAI_object($this->dn,$this->attrs);
- show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/template with dn '%s' failed."),$this->dn));
if($this->initially_was_account){
new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
"description" => _("Description"))
));
}
+
+
+ /*! \brief Used for copy & paste.
+ Returns a HTML input mask, which allows to change the cn of this entry.
+ @param Array Array containing current status && a HTML template.
+ */
+ function getCopyDialog()
+ {
+ $vars = array("cn");
+ $smarty = get_smarty();
+ $smarty->assign("cn", htmlentities($this->cn));
+ $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
+ $ret = array();
+ $ret['string'] = $str;
+ $ret['status'] = "";
+ return($ret);
+ }
+
+
+ /*! \brief Used for copy & paste.
+ Some entries must be renamed to avaoid duplicate entries.
+ */
+ function saveCopyDialog()
+ {
+ if(isset($_POST['cn'])){
+ $this->cn = get_post('cn');
+ }
+ }
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: