X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Ffai%2Fclass_faiVariable.inc;h=4e51ef8402784bcbe997faf42a119501c3800899;hb=90cb0cbd940168e234d506e42644e52fc7af5c4d;hp=4b10b70e4f2bf530972723bbfcc380834705ca8f;hpb=583eed02d9be15b6071a443d92a64fb430bc1ccc;p=gosa.git diff --git a/plugins/admin/fai/class_faiVariable.inc b/plugins/admin/fai/class_faiVariable.inc index 4b10b70e4..4e51ef840 100644 --- a/plugins/admin/fai/class_faiVariable.inc +++ b/plugins/admin/fai/class_faiVariable.inc @@ -38,6 +38,9 @@ class faiVariable extends plugin var $base = ""; var $release = ""; var $copy_paste_mode = false; + var $cut_paste_mode = false; + + var $CopyPasteVars = array("SubObjects"); function faiVariable ($config, $dn= NULL) { @@ -270,7 +273,7 @@ class faiVariable extends plugin $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){ + if(!empty($this->release) && ($this->copy_paste_mode || $this->cut_paste_mode) ){ /* Check if current name is already used for fai scripts in selected release */ $dn = 'cn='.$this->cn.",ou=variables,".$this->release; @@ -292,7 +295,12 @@ class faiVariable extends plugin plugin::save(); $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*/ @@ -347,6 +355,10 @@ class faiVariable extends plugin $sub_dn = "cn=".$obj['cn'].",".$this->dn; + if($this->copy_paste_mode){ + $obj['status'] = "new"; + } + if($obj['status']=="new"){ $ldap->cat($sub_dn,array("objectClass")); if($ldap->count()){ @@ -394,6 +406,28 @@ class faiVariable extends plugin $this->handle_object_tagging($sub_dn, $this->gosaUnitTag); } } + + /* return copy & paste dialog + */ + function getCopyDialog() + { + /* Ask for cn */ + $smarty = get_smarty(); + $smarty->assign("cn" ,$this->cn); + $str = $smarty->fetch(get_template_path("paste_fai_object.tpl",TRUE)); + $ret = array(); + $ret['string'] = $str; + $ret['status'] = ""; + return($ret); + } + + /* Get posted cn */ + function saveCopyDialog() + { + if(isset($_POST['cn'])){ + $this->cn = $_POST['cn']; + } + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: