index ee8c3c5c143e4157edee795e4d1be61599353aa1..c8337c4a1572b3cbe4e24edc2547b028413581a0 100644 (file)
var $FAIstate ="";
+ var $base ="";
+ var $release ="";
+ var $copy_paste_mode = false;
+ var $CopyPasteVars = array("SubObjects","FAIstate");
+
+
function faiScript ($config, $dn= NULL)
{
/* Load Attributes */
/* Call common method to give check the hook */
$message= plugin::check();
+ /* If this is a new script, check if a script with this name already exists */
+ if(!empty($this->release) && $this->copy_paste_mode){
+
+ /* Check if current name is already used for fai scripts in selected release */
+ $dn = 'cn='.$this->cn.",ou=scripts,".$this->release;
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cat($dn);
+ if($ldap->count()){
+
+ $r =convert_department_dn($this->release);;
+ $message[] = sprintf(_("Can't insert a script named '%s' in '%s' there is already a script with the given name."),$this->cn,$r);
+ }
+ }
return ($message);
}
$ldap = $this->config->get_ldap_link();
+ /* Copy & Paste : Ensure that FAIstate is copied too */
+ if($this->copy_paste_mode && preg_match("/freeze/",$this->FAIstate)){
+ $this->attrs['FAIstate'] = $this->FAIstate;
+ }
+
$ldap->cat($this->dn,array("objectClass"));
if($ldap->count()!=0){
/* Write FAIscript to ldap*/
/* We do not need to save untouched objects */
foreach($this->SubObjects as $name => $obj){
if($obj['status'] == "FreshLoaded"){
- unset($this->SubObjects[$name]);
+ if($this->copy_paste_mode){
+ $this->SubObjects[$name] = $this->get_object_attributes($obj,$this->sub_Load_Later);
+ $this->SubObjects[$name]['status'] = "new";
+ }else{
+ unset($this->SubObjects[$name]);
+ }
}
}