diff --git a/gosa-plugins/fai/admin/fai/class_faiTemplate.inc b/gosa-plugins/fai/admin/fai/class_faiTemplate.inc
index ffb910eac52dd750a0962ab809cc8951b38b8259..7ea9a836befe4cb641f8e529647b32c37aa6c773 100644 (file)
$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;
}
}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: