From f1ca520daf95525953d6e03c5bb0abf7c2648171 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 16 Nov 2006 04:21:17 +0000 Subject: [PATCH] Added Copy & Paste fixes from GOsa 2.5 to trunk. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5130 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/groups/class_groupApplication.inc | 4 +- plugins/admin/ogroups/class_mailogroup.inc | 14 ++-- plugins/admin/ogroups/class_ogroup.inc | 12 ++- .../admin/ogroups/class_ogroupManagement.inc | 75 +++++++++++-------- plugins/admin/ogroups/class_termgroup.inc | 2 + plugins/admin/ogroups/paste_generic.tpl | 10 +++ plugins/admin/ogroups/paste_mail.tpl | 10 +++ plugins/admin/ogroups/tabs_ogroups.inc | 9 ++- 8 files changed, 91 insertions(+), 45 deletions(-) create mode 100644 plugins/admin/ogroups/paste_generic.tpl create mode 100644 plugins/admin/ogroups/paste_mail.tpl diff --git a/plugins/admin/groups/class_groupApplication.inc b/plugins/admin/groups/class_groupApplication.inc index eff39655d..9efbbc63f 100644 --- a/plugins/admin/groups/class_groupApplication.inc +++ b/plugins/admin/groups/class_groupApplication.inc @@ -649,7 +649,9 @@ class appgroup extends plugin $departments = array(); $res = get_list("(objectClass=gosaDepartment)", "application", $this->curbase,array("description","cn","ou"),GL_SIZELIMIT); foreach($res as $value){ - $fdn= @LDAP::fix(str_replace($this->curbase,"",$value['dn'])); + $fdn = $value['dn']; + $fdn = preg_replace("/".normalizePreg($this->curbase)."/","",$fdn); + $fdn= @LDAP::fix($fdn); if($value["description"][0]!=".."){ $departments[$value['dn']]= convert_department_dn($fdn)." - [".$value["description"][0]."]"; }else{ diff --git a/plugins/admin/ogroups/class_mailogroup.inc b/plugins/admin/ogroups/class_mailogroup.inc index cddc5b07d..ce860169c 100644 --- a/plugins/admin/ogroups/class_mailogroup.inc +++ b/plugins/admin/ogroups/class_mailogroup.inc @@ -81,7 +81,7 @@ class mailogroup extends plugin /* Check if mail address is already in use */ $ldap->cd($this->config->current['BASE']); - $ldap->search ("(&(!(objectClass=gosaUserTemplate))(|(mail=".$this->mail. ")(gosaMailAlternateAddress=".$this->mail."))(!(cn=".$this->cn.")))", array("uid")); + $ldap->search ("(&(!(objectClass=gosaUserTemplate))(|(mail=".$this->mail.")(gosaMailAlternateAddress=".$this->mail."))(!(cn=".$this->cn.")))", array("uid")); if ($ldap->count() != 0){ $message[]= _("The primary address you've entered is already in use."); } @@ -142,10 +142,14 @@ class mailogroup extends plugin function getCopyDialog() { - $str = ""; - $str .= _("Phone number"); - $str .= " "; - return($str); + $str = ""; + $smarty = get_smarty(); + $smarty->assign("mail", $this->mail); + $str = $smarty->fetch(get_template_path("paste_mail.tpl",TRUE,dirname(__FILE__))); + $ret = array(); + $ret['string'] = $str; + $ret['status'] = ""; + return($ret); } diff --git a/plugins/admin/ogroups/class_ogroup.inc b/plugins/admin/ogroups/class_ogroup.inc index 03174fbd5..250cce677 100644 --- a/plugins/admin/ogroups/class_ogroup.inc +++ b/plugins/admin/ogroups/class_ogroup.inc @@ -683,12 +683,16 @@ class ogroup extends plugin $this->handle_post_events("remove"); } + function getCopyDialog() { - $str = ""; - $str .= _("Group name"); - $str .= " "; - return($str); + $smarty = get_smarty(); + $smarty->assign("cn", $this->cn); + $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE,dirname(__FILE__))); + $ret = array(); + $ret['string'] = $str; + $ret['status'] = ""; + return($ret); } function saveCopyDialog() diff --git a/plugins/admin/ogroups/class_ogroupManagement.inc b/plugins/admin/ogroups/class_ogroupManagement.inc index a852876df..f3a3ad259 100644 --- a/plugins/admin/ogroups/class_ogroupManagement.inc +++ b/plugins/admin/ogroups/class_ogroupManagement.inc @@ -111,39 +111,12 @@ class ogroupManagement extends plugin Copy & Paste handling ****************/ - /* Only perform copy / paste if it is enabled - */ - if($this->CopyPasteHandler){ - - /* Paste copied/cutted object in here - */ - if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){ - $this->CopyPasteHandler->save_object(); - $this->CopyPasteHandler->SetVar("base", $this->DivListOGroup->selectedBase); - return($this->CopyPasteHandler->execute()); - } - - /* Copy current object to CopyHandler - */ - if($s_action == "copy"){ - $this->CopyPasteHandler->Clear(); - $dn = $this->ogrouplist[$s_entry]['dn']; - $obj = new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn); - $objNew = new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], "new"); - $this->CopyPasteHandler->Copy($obj,$objNew); - } - - /* Copy current object to CopyHandler - */ - if($s_action == "cut"){ - $this->CopyPasteHandler->Clear(); - $dn = $this->ogrouplist[$s_entry]['dn']; - $obj = new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn); - $this->CopyPasteHandler->Cut($obj); - } + /* Display the copy & paste dialog, if it is currently open */ + $ret = $this->copyPasteHandling($s_action,$s_entry); + if($ret){ + return($ret); } - /**************** Create a new object group ****************/ @@ -466,6 +439,46 @@ class ogroupManagement extends plugin reset ($this->ogrouplist); } + + function copyPasteHandling($s_action,$s_entry) + { + if($this->CopyPasteHandler){ + + /* Paste copied/cutted object in here + */ + if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){ + $this->CopyPasteHandler->save_object(); + $this->CopyPasteHandler->SetVar("base", $this->DivListOGroup->selectedBase); + return($this->CopyPasteHandler->execute()); + } + + /* Copy current object to CopyHandler + */ + if($s_action == "copy"){ + $this->CopyPasteHandler->Clear(); + $dn = $this->ogrouplist[$s_entry]['dn']; + $obj = new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn); + $objNew = new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], "new"); + + $types_of_tabs = $obj->by_object['ogroup']->gosaGroupObjects; + $objNew->by_object['ogroup']->gosaGroupObjects = $types_of_tabs; + $objNew->reload($types_of_tabs); + + $this->CopyPasteHandler->Copy($obj,$objNew); + } + + /* Copy current object to CopyHandler + */ + if($s_action == "cut"){ + $this->CopyPasteHandler->Clear(); + $dn = $this->ogrouplist[$s_entry]['dn']; + $obj = new ogrouptabs($this->config, $this->config->data['TABS']['OGROUPTABS'], $dn); + $this->CopyPasteHandler->Cut($obj); + } + } + } + + function save_object() { $this->DivListOGroup->save_object(); diff --git a/plugins/admin/ogroups/class_termgroup.inc b/plugins/admin/ogroups/class_termgroup.inc index b60800884..f803cb85a 100644 --- a/plugins/admin/ogroups/class_termgroup.inc +++ b/plugins/admin/ogroups/class_termgroup.inc @@ -25,6 +25,8 @@ class termgroup extends plugin "memcheck" => "memcheck", "sysinfo" => "sysinfo"); + var $CopyPasteVars = array("gotoNtpServers","modes","inheritTimeServer"); + function termgroup ($config, $dn= NULL, $parent= NULL) { /*************** diff --git a/plugins/admin/ogroups/paste_generic.tpl b/plugins/admin/ogroups/paste_generic.tpl new file mode 100644 index 000000000..8daafc6a2 --- /dev/null +++ b/plugins/admin/ogroups/paste_generic.tpl @@ -0,0 +1,10 @@ + + + + + +
+ {$must} + + +
diff --git a/plugins/admin/ogroups/paste_mail.tpl b/plugins/admin/ogroups/paste_mail.tpl new file mode 100644 index 000000000..1930c44c8 --- /dev/null +++ b/plugins/admin/ogroups/paste_mail.tpl @@ -0,0 +1,10 @@ + + + + + +
+ {$must} + + +
diff --git a/plugins/admin/ogroups/tabs_ogroups.inc b/plugins/admin/ogroups/tabs_ogroups.inc index 35d19c4ff..0b5fcb9f2 100644 --- a/plugins/admin/ogroups/tabs_ogroups.inc +++ b/plugins/admin/ogroups/tabs_ogroups.inc @@ -212,10 +212,11 @@ class ogrouptabs extends tabs /* Don't touch base object */ if ($name != 'ogroup'){ - $obj->parent= &$this; - $obj->uid= $baseobject->uid; - $obj->sn= $baseobject->uid; - $obj->givenName= $baseobject->uid; + $obj->parent = &$this; + $obj->uid = $baseobject->uid; + $obj->cn = $baseobject->cn; + $obj->sn = $baseobject->uid; + $obj->givenName = $baseobject->uid; $this->by_object[$name]= $obj; } -- 2.30.2