Code

Added Copy & Paste fixes from GOsa 2.5 to trunk.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 16 Nov 2006 04:21:17 +0000 (04:21 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 16 Nov 2006 04:21:17 +0000 (04:21 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5130 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/groups/class_groupApplication.inc
plugins/admin/ogroups/class_mailogroup.inc
plugins/admin/ogroups/class_ogroup.inc
plugins/admin/ogroups/class_ogroupManagement.inc
plugins/admin/ogroups/class_termgroup.inc
plugins/admin/ogroups/paste_generic.tpl [new file with mode: 0644]
plugins/admin/ogroups/paste_mail.tpl [new file with mode: 0644]
plugins/admin/ogroups/tabs_ogroups.inc

index eff39655d6e7d8c3226961119088a7de7606c672..9efbbc63f59ea7fb8e53a2c0a569e7bf279d5cdb 100644 (file)
@@ -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{
index cddc5b07d2c13cc15a6a1e237cf45c467c1f53c7..ce860169c94e70dc69ab0c9da857ce516b4ec99f 100644 (file)
@@ -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 .= "&nbsp;<input type='text' name='mail' value='".$this->mail."'>";
-    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);
   }
 
 
index 03174fbd579e6f7dfa7fb4509bf5ba7e140e133b..250cce677815efb36e0dd5d6a216a52e20f11a87 100644 (file)
@@ -683,12 +683,16 @@ class ogroup extends plugin
     $this->handle_post_events("remove");
   }
 
+
   function getCopyDialog()
   {
-    $str  = "";
-    $str .= _("Group name");
-    $str .= "&nbsp;<input type='text' name='cn' value='".$this->cn."'>";
-    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()
index a852876df8eb608d018392f2b5c9831cafc87b05..f3a3ad2593eb9f6bb10cf2e6821a0b876f9d1251 100644 (file)
@@ -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();
index b60800884be2fc3e6b6d709d629502c085e25860..f803cb85adb6880f89b3fd21abf65925f19665bb 100644 (file)
@@ -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 (file)
index 0000000..8daafc6
--- /dev/null
@@ -0,0 +1,10 @@
+<table width='100%'>
+       <tr>
+               <td width='120'>
+                       <LABEL for="cn">{t}Group name{/t}</LABEL>{$must}
+               </td>
+               <td>
+                       <input type='text' id='cn' name='cn' value='{$cn}' size='40' title='{t}Please enter the new object group name{/t}'> 
+               </td>
+       </tr>
+</table>
diff --git a/plugins/admin/ogroups/paste_mail.tpl b/plugins/admin/ogroups/paste_mail.tpl
new file mode 100644 (file)
index 0000000..1930c44
--- /dev/null
@@ -0,0 +1,10 @@
+<table width='100%'>
+        <tr>
+                <td width='120'>
+                       <LABEL for="cn">{t}Mail{/t}</LABEL>{$must}
+               </td>
+               <td>
+                       <input type='text' id='main' name='mail' value='{$mail}' size='40' title='{t}Please enter a mail address{/t}'> 
+               </td>
+       </tr>
+</table>
index 35d19c4ff23b4a7a2f2c347f8708a1a7b6130c15..0b5fcb9f26020d2b8e918b70b4f0e3ba4b132262 100644 (file)
@@ -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;
       }