From 95dc9dd891af37fadcaf1bc91f6e1f9359dc20ee Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 6 Dec 2007 14:03:49 +0000 Subject: [PATCH] Added Copy & Paste to Scripts/Hooks/Templates/Variables. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8046 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/fai/class_faiHook.inc | 35 ++++++++++++++++++ plugins/admin/fai/class_faiScript.inc | 34 +++++++++++++++++ plugins/admin/fai/class_faiTemplate.inc | 34 +++++++++++++++++ plugins/admin/fai/class_faiTemplateEntry.inc | 7 ++-- plugins/admin/fai/class_faiVariable.inc | 39 +++++++++++++++++++- 5 files changed, 145 insertions(+), 4 deletions(-) diff --git a/plugins/admin/fai/class_faiHook.inc b/plugins/admin/fai/class_faiHook.inc index a4fdd5640..ce60202a3 100644 --- a/plugins/admin/fai/class_faiHook.inc +++ b/plugins/admin/fai/class_faiHook.inc @@ -551,6 +551,41 @@ class faiHook extends plugin } } + + function PrepareForCopyPaste($source) + { + plugin::PrepareForCopyPaste($source); + + /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry) + */ + $ldap = $this->config->get_ldap_link(); + $ldap->cd ($source['dn']); + + $attrs_to_search = $this->subAttributes; + $attrs_to_search[] = "FAIstate"; + $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search); + + while($object = $ldap->fetch()){ + + /* Skip objects, that are tagged as removed */ + if(isset($object['FAIstate'][0])){ + if(preg_match("/removed$/",$object['FAIstate'][0])){ + continue; + } + } + + /* Set status for save management */ + $objects = array(); + $objects['status'] = "edited"; + $objects['dn'] = $object['dn']; + $objects = $this->get_object_attributes($objects,$this->subAttributes); + $objects = $this->get_object_attributes($objects,$this->sub_Load_Later); + + $this->SubObjects[$objects['cn']] = $objects; + } + } + + /* Return plugin informations for acl handling */ static function plInfo() { diff --git a/plugins/admin/fai/class_faiScript.inc b/plugins/admin/fai/class_faiScript.inc index 8a985da95..928aa0e94 100644 --- a/plugins/admin/fai/class_faiScript.inc +++ b/plugins/admin/fai/class_faiScript.inc @@ -600,6 +600,40 @@ class faiScript extends plugin $this->handle_object_tagging($sub_dn, $this->gosaUnitTag); } } + + + function PrepareForCopyPaste($source) + { + plugin::PrepareForCopyPaste($source); + + /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry) + */ + $ldap = $this->config->get_ldap_link(); + $ldap->cd ($source['dn']); + + $attrs_to_search = $this->subAttributes; + $attrs_to_search[] = "FAIstate"; + $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search); + + while($object = $ldap->fetch()){ + + /* Skip objects, that are tagged as removed */ + if(isset($object['FAIstate'][0])){ + if(preg_match("/removed$/",$object['FAIstate'][0])){ + continue; + } + } + + /* Set status for save management */ + $objects = array(); + $objects['status'] = "edited"; + $objects['dn'] = $object['dn']; + $objects = $this->get_object_attributes($objects,$this->subAttributes); + $objects = $this->get_object_attributes($objects,$this->sub_Load_Later); + + $this->SubObjects[$objects['cn']] = $objects; + } + } /* Return plugin informations for acl handling */ diff --git a/plugins/admin/fai/class_faiTemplate.inc b/plugins/admin/fai/class_faiTemplate.inc index 7d8e5ed73..5f4fcbf14 100644 --- a/plugins/admin/fai/class_faiTemplate.inc +++ b/plugins/admin/fai/class_faiTemplate.inc @@ -521,6 +521,40 @@ class faiTemplate extends plugin $this->handle_object_tagging($sub_dn, $this->gosaUnitTag); } } + + + function PrepareForCopyPaste($source) + { + plugin::PrepareForCopyPaste($source); + + /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry) + */ + $ldap = $this->config->get_ldap_link(); + $ldap->cd ($source['dn']); + + $attrs_to_search = $this->subAttributes; + $attrs_to_search[] = "FAIstate"; + $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search); + + while($object = $ldap->fetch()){ + + /* Skip objects, that are tagged as removed */ + if(isset($object['FAIstate'][0])){ + if(preg_match("/removed$/",$object['FAIstate'][0])){ + continue; + } + } + + /* Set status for save management */ + $objects = array(); + $objects['status'] = "edited"; + $objects['dn'] = $object['dn']; + $objects = $this->get_object_attributes($objects,$this->subAttributes); + $objects = $this->get_object_attributes($objects,$this->sub_Load_Later); + + $this->SubObjects[$objects['cn']] = $objects; + } + } /* Return plugin informations for acl handling */ diff --git a/plugins/admin/fai/class_faiTemplateEntry.inc b/plugins/admin/fai/class_faiTemplateEntry.inc index b24901c04..05c6b72ac 100644 --- a/plugins/admin/fai/class_faiTemplateEntry.inc +++ b/plugins/admin/fai/class_faiTemplateEntry.inc @@ -208,9 +208,10 @@ class faiTemplateEntry extends plugin $message[] = _("Please enter a file name."); } - if(preg_match('/\//', $this->cn)){ - $message[] = _("The file name should not contain / characters."); - } +# echo $this->cn; +# if(preg_match('/\//', $this->cn)){ +# $message[] = _("The file name should not contain / characters."); +# # } if(empty($this->user)){ $message[] = _("Please enter a user."); diff --git a/plugins/admin/fai/class_faiVariable.inc b/plugins/admin/fai/class_faiVariable.inc index c2eba3e00..ae6b79a99 100644 --- a/plugins/admin/fai/class_faiVariable.inc +++ b/plugins/admin/fai/class_faiVariable.inc @@ -415,7 +415,44 @@ class faiVariable extends plugin } } - + + function PrepareForCopyPaste($source) + { + plugin::PrepareForCopyPaste($source); + + /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry) + */ + $ldap = $this->config->get_ldap_link(); + $ldap->cd ($source['dn']); + $attrs_to_search = $this->subAttributes; + $attrs_to_search[] = "FAIstate"; + $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search); + while($object = $ldap->fetch()){ + + /* Skip objects, that are tagged as removed */ + if(isset($object['FAIstate'][0])){ + if(preg_match("/removed$/",$object['FAIstate'][0])){ + continue; + } + } + + /* Set status for save management */ + foreach($this->subAttributes as $attrs){ + if(!isset($object[$attrs][0])){ + $this->SubObjects[$object['cn'][0]][$attrs]=""; + }else{ + $this->SubObjects[$object['cn'][0]][$attrs]=$object[$attrs][0]; + } + } + foreach($this->sub64coded as $codeIt){ + $this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]); + } + $this->SubObjects[$object['cn'][0]]['status'] = "edited"; + $this->SubObjects[$object['cn'][0]]['dn'] = $object['dn']; + } + } + + /* Return plugin informations for acl handling */ static function plInfo() { -- 2.30.2