diff --git a/plugins/admin/fai/class_faiPartitionTable.inc b/plugins/admin/fai/class_faiPartitionTable.inc
index f5ca9f7b1ec3568fbdfc860c86543c8293db9232..96b4adc2201e1acf5a6b0ddc52b01fd1c30a531c 100644 (file)
var $base = "";
var $release = "";
var $copy_paste_mode = false;
+ var $cut_paste_mode = false;
+
+ var $CopyPasteVars = array("disks");
function faiPartitionTable ($config, $dn= NULL)
{
$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=disk,".$this->release;
* 3 : Save partitions for each disk
*/
+ /* Copy & Paste : Ensure that FAIstate is copied too */
+ if($this->copy_paste_mode && preg_match("/freeze/",$this->FAIstate)){
+ $this->attrs['FAIstate'] = $this->FAIstate;
+ }
+
$ldap = $this->config->get_ldap_link();
if($this->new){
$disk_attrs['description'] = $disk['description'];
$disk_attrs['objectClass'] = array("top","FAIclass","FAIpartitionDisk");
+ /* We currently use the copy & paste method */
+ if($this->copy_paste_mode){
+ $disk['status'] = "new";
+ }
+
if($disk['status']=="new"){
$ldap->cat($disk_dn,array("objectClass"));
if($ldap->count()){
if(isset($attrs['objectClass']) && in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
$disk_attrs['objectClass'][] = "gosaAdministrativeUnitTag";
}
-
+
if($disk['status'] == "delete"){
$ldap->cd($disk_dn);
$ldap->rmdir_recursive($disk_dn);
unset($partition_attrs['status']);
unset($partition_attrs['old_cn']);
+ /* We currently use the copy & paste method */
+ if($this->copy_paste_mode){
+ $partition['status']="new";
+ }
+
/* Check if this partition is realy new .. */
if($partition['status']=="new"){
$ldap->cat($partition_dn,array("objectClass"));
}
$this->handle_post_events("add");
}
+
+
+ /* 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: