Code

Moved to POST for selector lists
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 29 Jan 2010 16:54:29 +0000 (16:54 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 29 Jan 2010 16:54:29 +0000 (16:54 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15465 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_baseSelector.inc
gosa-core/plugins/admin/departments/class_department.inc
gosa-core/plugins/admin/groups/class_group.inc
gosa-core/plugins/admin/ogroups/class_ogroup.inc
gosa-core/plugins/personal/generic/class_user.inc

index fa9ad7ddb2397d87611d9300233d6f75ce025153..81951f440061b17588d81381e0cd5cffdf114db1 100644 (file)
@@ -101,9 +101,9 @@ class baseSelector {
     // Analyze for base changes if needed
     $this->action= null;
     $last_base= $this->base;
-    if(isset($_REQUEST['PID']) && $_REQUEST['PID'] == $this->pid) {
-      if (isset($_REQUEST['REBASE'])) {
-        $new_base= base64_decode($_REQUEST['REBASE']);
+    if(isset($_REQUEST['BPID']) && $_REQUEST['BPID'] == $this->pid) {
+      if (isset($_POST['bs_rebase_'.$this->pid]) && !empty($_POST['bs_rebase_'.$this->pid])) {
+        $new_base= base64_decode($_POST['bs_rebase_'.$this->pid]);
         if (isset($this->pathMapping[$new_base])) {
           $this->base= $new_base;
           $this->action= 'rebase';
@@ -132,7 +132,7 @@ class baseSelector {
       return true;
     }
 
-    $link= "href='?plug=".$_GET['plug']."&amp;PID=".$this->pid."&amp;REBASE=".base64_encode($config->current['BASE'])."'";
+    $link= "onclick=\"\$('bs_rebase_".$this->pid."').value='".base64_encode($config->current['BASE'])."';  $('submit_tree_base_".$this->pid."').click();\"";
     $this->tree= "<input type='text' size='35' name='bs_input_".$this->pid."' id='bs_input_".$this->pid."' onkeydown=\"\$('bs_".$this->pid."').hide()\" onfocus=\"\$('bs_".$this->pid."').hide()\" onmouseover=\"Element.clonePosition(\$('bs_".$this->pid."'), 'bs_input_".$this->pid."', {setHeight: false, setWidth: false, offsetTop:(Element.getHeight('bs_input_".$this->pid."'))});\$('bs_".$this->pid."').show();\" onmouseout=\"rtimer= Element.hide.delay(0.25, 'bs_".$this->pid."')\" value=\"".preg_replace('/"/', '&quot;',$this->pathMapping[$this->base])."\">";
 
 
@@ -174,7 +174,7 @@ class baseSelector {
         $this->tree.= "</li>\n";
       }
       $selected= $this->base == $base?" class='treeListSelected'":"";
-      $link= "href='?plug=".$_GET['plug']."&amp;PID=".$this->pid."&amp;REBASE=".base64_encode($base)."'";
+      $link= "onclick=\"\$('bs_rebase_".$this->pid."').value='".base64_encode($base)."';$('submit_tree_base_".$this->pid."').click();\"";
       $this->tree.= "<li><a$selected $link>".str_replace(' ', '&nbsp;', ldap::fix(preg_replace('/^[a-z0-9]+=([^,]+),.*$/i', '$1', $base)))."</a>";
 
       $last_indent= $indent;
@@ -191,6 +191,9 @@ class baseSelector {
     if ($this->submitButton) {
       $this->tree.= "&nbsp;<input class='center' type='image' src='images/lists/submit.png' align='middle' title='"._("Submit")."' name='submit_base_".$this->pid."' id='submit_base_".$this->pid."' alt='"._("Submit")."'>";
     }
+    $this->tree.= "<input type='submit' style='display:none' name='submit_tree_base_".$this->pid."' id='submit_tree_base_".$this->pid."'>";
+    $this->tree.= "<input type='hidden' name='bs_rebase_".$this->pid."' id='bs_rebase_".$this->pid."'>";
+    $this->tree.= "<input type='hidden' name='BPID' id='BPID' value='".$this->pid."'>";
 
     return true;
   }
@@ -209,8 +212,8 @@ class baseSelector {
 
   function getAction()
   {
-    // Do not do anything if this is not our PID, or there's even no PID available...
-    if(!isset($_REQUEST['PID']) || $_REQUEST['PID'] != $this->pid) {
+    // Do not do anything if this is not our BPID, or there's even no BPID available...
+    if(!isset($_REQUEST['BPID']) || $_REQUEST['BPID'] != $this->pid) {
       return;
     }
 
index 35baf3a11508e0652302066d204e29e350cd43fa..685564bf5afea0703a7572e5ca4f4342ef6835b7 100644 (file)
@@ -230,17 +230,6 @@ class department extends plugin
        /* Save data to object */
        function save_object()
        {       
-               /* Refresh base */
-               if ($this->acl_is_moveable($this->base)){
-                       if (!$this->baseSelector->update()) {
-                               msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
-                       }
-                       if ($this->base != $this->baseSelector->getBase()) {
-                               $this->base= $this->baseSelector->getBase();
-                               $this->is_modified= TRUE;
-                       }
-               }
-
                if (isset($_POST['dep_generic_posted'])){
 
                        $nA = $this->namingAttr;
@@ -255,6 +244,18 @@ class department extends plugin
       plugin::save_object();
       $this->base = $base_tmp;
 
+               /* Refresh base */
+               if ($this->acl_is_moveable($this->base)){
+                       if (!$this->baseSelector->update()) {
+                               msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
+                       }
+                       if ($this->base != $this->baseSelector->getBase()) {
+                               $this->base= $this->baseSelector->getBase();
+                               $this->is_modified= TRUE;
+                       }
+               }
+
+
       /* Save tagging flag */
       if ($this->acl_is_writeable("gosaUnitTag")){
         if (isset($_POST['is_administrational_unit'])){
index 456eb4c25761d517864518b9ba2d4e90a09bf89a..d63a6965b82575e11f2bde1df12a5e949dd88e89 100644 (file)
@@ -737,17 +737,6 @@ class group extends plugin
   /* Save data to object */
   function save_object()
   {
-    /* Refresh base */
-    if ($this->acl_is_moveable($this->base)){
-      if (!$this->baseSelector->update()) {
-        msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
-      }
-      if ($this->base != $this->baseSelector->getBase()) {
-        $this->base= $this->baseSelector->getBase();
-        $this->is_modified= TRUE;
-      }
-    }
-
     /* Save additional values for possible next step */
     if (isset($_POST['groupedit'])){
 
@@ -758,6 +747,17 @@ class group extends plugin
       plugin::save_object();
       $this->base = $base_tmp;
 
+      /* Refresh base */
+      if ($this->acl_is_moveable($this->base)){
+        if (!$this->baseSelector->update()) {
+          msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
+        }
+        if ($this->base != $this->baseSelector->getBase()) {
+          $this->base= $this->baseSelector->getBase();
+          $this->is_modified= TRUE;
+        }
+      }
+
       $this->force_gid= 0;
 
       /* Only reset sambagroup flag if we are able to write this flag */
index 5c51363c5701aa5c4d97fe80e5319ea3b654dd83..e98bc65c2b0c5175976ef1c6592dc51bb61f229a 100644 (file)
@@ -466,17 +466,6 @@ class ogroup extends plugin
   /* Save data to object */
   function save_object()
   {
-    /* Refresh base */
-    if ($this->acl_is_moveable($this->base)){
-      if (!$this->baseSelector->update()) {
-        msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
-      }
-      if ($this->base != $this->baseSelector->getBase()) {
-        $this->base= $this->baseSelector->getBase();
-        $this->is_modified= TRUE;
-      }
-    }
-
     /* Save additional values for possible next step */
     if (isset($_POST['ogroupedit'])){
 
@@ -509,6 +498,18 @@ class ogroup extends plugin
       $base_tmp = $this->base;
       plugin::save_object();
       $this->base = $base_tmp;
+
+      /* Refresh base */
+      if ($this->acl_is_moveable($this->base)){
+        if (!$this->baseSelector->update()) {
+          msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
+        }
+        if ($this->base != $this->baseSelector->getBase()) {
+          $this->base= $this->baseSelector->getBase();
+          $this->is_modified= TRUE;
+        }
+      }
+
     }
   }
 
index aec8e0340cdc7b589af5e77ec36fcb0286edee2e..4ceb1dc2ae4992d05b1fdfdd0560959aba6080a7 100644 (file)
@@ -740,17 +740,6 @@ class user extends plugin
   /* Save data to object */
   function save_object()
   {
-    /* Refresh base */
-    if ($this->acl_is_moveable($this->base)){
-      if (!$this->baseSelector->update()) {
-        msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
-      }
-      if ($this->base != $this->baseSelector->getBase()) {
-        $this->base= $this->baseSelector->getBase();
-        $this->is_modified= TRUE;
-      }
-    }
-      
     if(isset($_POST['generic']) || isset($_POST['multiple_user_posted'])){
 
       /* Make a backup of the current selected base */
@@ -759,6 +748,17 @@ class user extends plugin
       /* Parents save function */
       plugin::save_object ();
 
+      /* Refresh base */
+      if ($this->acl_is_moveable($this->base)){
+        if (!$this->baseSelector->update()) {
+          msg_dialog::display(_("Error"), msgPool::permMove(), ERROR_DIALOG);
+        }
+        if ($this->base != $this->baseSelector->getBase()) {
+          $this->base= $this->baseSelector->getBase();
+          $this->is_modified= TRUE;
+        }
+      }
+      
       /* Sync lists */
       $this->gosaLoginRestrictionWidget->save_object();
       if ($this->gosaLoginRestrictionWidget->isModified()) {