From: hickert Date: Mon, 13 Nov 2006 11:34:01 +0000 (+0000) Subject: Added Copy & Paste functionality to FAI objects X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4c904f719e603b62faf64e370449b1ad8e727b35;p=gosa.git Added Copy & Paste functionality to FAI objects git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5080 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/fai/class_divListFai.inc b/plugins/admin/fai/class_divListFai.inc index 4637552b7..3f8f520a8 100644 --- a/plugins/admin/fai/class_divListFai.inc +++ b/plugins/admin/fai/class_divListFai.inc @@ -219,8 +219,10 @@ _("Submit")."'> ". /* Create action icons */ $action =""; if($this->parent->CopyPasteHandler){ - $action .= " "; + if($value['FAIstate'] != "freeze"){ + $action .= " "; + } $action.= " "; } diff --git a/plugins/admin/fai/class_faiHook.inc b/plugins/admin/fai/class_faiHook.inc index 121d0ca5c..2d6e6f94a 100644 --- a/plugins/admin/fai/class_faiHook.inc +++ b/plugins/admin/fai/class_faiHook.inc @@ -41,6 +41,8 @@ class faiHook extends plugin var $release = ""; var $copy_paste_mode = false; + var $CopyPasteVars = array("SubObjects","FAIstate"); + function faiHook ($config, $dn= NULL) { /* Load Attributes */ @@ -395,6 +397,11 @@ class faiHook extends plugin $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*/ @@ -429,6 +436,7 @@ class faiHook extends plugin if($obj['status'] == "FreshLoaded"){ 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]); } diff --git a/plugins/admin/fai/class_faiPackage.inc b/plugins/admin/fai/class_faiPackage.inc index 7697beb74..27faa1c58 100644 --- a/plugins/admin/fai/class_faiPackage.inc +++ b/plugins/admin/fai/class_faiPackage.inc @@ -64,7 +64,7 @@ class faiPackage extends plugin var $base = ""; var $release = ""; var $copy_paste_mode = false; - var $CopyPasteVars = array("FAIdebianRelease","FAIdebianSection","FAIinstallMethod","mirror","servers","releases","sections","list","mirrors","usedPackages"); + var $CopyPasteVars = array("FAIstate","ConfiguredPackages","FAIdebianRelease","FAIdebianSection","FAIinstallMethod","mirror","servers","releases","sections","list","mirrors","usedPackages"); function faiPackage ($config, $dn= NULL) @@ -479,6 +479,11 @@ class faiPackage extends plugin $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; + } + $this->attrs['FAIpackage'] = array(); foreach($this->usedPackages as $pkg => $obj){ $this->attrs['FAIpackage'][] = $pkg; diff --git a/plugins/admin/fai/class_faiPartitionTable.inc b/plugins/admin/fai/class_faiPartitionTable.inc index f5ca9f7b1..e30634059 100644 --- a/plugins/admin/fai/class_faiPartitionTable.inc +++ b/plugins/admin/fai/class_faiPartitionTable.inc @@ -24,6 +24,8 @@ class faiPartitionTable extends plugin var $release = ""; var $copy_paste_mode = false; + var $CopyPasteVars = array("disks","FAIstate"); + function faiPartitionTable ($config, $dn= NULL) { /* Load Attributes */ @@ -347,6 +349,11 @@ class faiPartitionTable extends plugin * 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){ @@ -386,6 +393,11 @@ class faiPartitionTable extends plugin $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()){ @@ -399,7 +411,7 @@ class faiPartitionTable extends plugin 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); @@ -456,6 +468,11 @@ class faiPartitionTable extends plugin 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")); diff --git a/plugins/admin/fai/class_faiProfile.inc b/plugins/admin/fai/class_faiProfile.inc index 1b11447e4..69af93981 100644 --- a/plugins/admin/fai/class_faiProfile.inc +++ b/plugins/admin/fai/class_faiProfile.inc @@ -442,6 +442,11 @@ class faiProfile extends plugin $this->attrs['FAIclass']=trim($this->FAIclass); + /* 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*/ diff --git a/plugins/admin/fai/class_faiScript.inc b/plugins/admin/fai/class_faiScript.inc index 50a73992b..c8337c4a1 100644 --- a/plugins/admin/fai/class_faiScript.inc +++ b/plugins/admin/fai/class_faiScript.inc @@ -370,6 +370,11 @@ class faiScript extends plugin $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*/ @@ -401,6 +406,7 @@ class faiScript extends plugin if($obj['status'] == "FreshLoaded"){ 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]); } diff --git a/plugins/admin/fai/class_faiTemplate.inc b/plugins/admin/fai/class_faiTemplate.inc index 1b2f78752..0ef911b09 100644 --- a/plugins/admin/fai/class_faiTemplate.inc +++ b/plugins/admin/fai/class_faiTemplate.inc @@ -41,6 +41,8 @@ class faiTemplate extends plugin var $release = ""; var $copy_paste_mode = false; + var $CopyPasteVars = array("SubObjects","FAIstate"); + function faiTemplate ($config, $dn= NULL) { /* Load Attributes */ @@ -365,6 +367,11 @@ class faiTemplate extends plugin $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*/ @@ -396,6 +403,7 @@ class faiTemplate extends plugin if($obj['status'] == "FreshLoaded"){ 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]); } diff --git a/plugins/admin/fai/class_faiVariable.inc b/plugins/admin/fai/class_faiVariable.inc index 4b10b70e4..83027c7df 100644 --- a/plugins/admin/fai/class_faiVariable.inc +++ b/plugins/admin/fai/class_faiVariable.inc @@ -39,6 +39,8 @@ class faiVariable extends plugin var $release = ""; var $copy_paste_mode = false; + var $CopyPasteVars = array("SubObjects","FAIstate"); + function faiVariable ($config, $dn= NULL) { /* Load Attributes */ @@ -292,7 +294,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 +354,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()){