Code

Updated base acl selector
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 29 Jan 2010 17:13:27 +0000 (17:13 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 29 Jan 2010 17:13:27 +0000 (17:13 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15471 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/acl/acl_role.tpl
gosa-core/plugins/admin/acl/class_aclRole.inc

index 1a9b90cd69dce42d4dc2e003aab71eda705ef395..25fb98959358006316b0c79b9c921c00c6ebd861 100644 (file)
 </tr>
 <tr>
        <td>
-               {t}Base{/t}
+               {t}Base{/t}{$MUST}
        </td>
        <td>
 {render acl=$baseACL}
-             <select id="base" size="1" name="base" title="{t}Choose subtree to place group in{/t}">
-              {html_options options=$bases selected=$base_select}
-             </select>
+  {$base}
 {/render}
-
-{render acl=$baseACL disable_picture='images/lists/folder_grey.png'}
-               <input type="image" name="chooseBase" src="images/lists/folder.png" class="center" title="{t}Select a base{/t}">
-{/render}
-
        </td>
 </tr>
 </table>
index 5f96b0dea1bda890c2ce83412e2cc720995bafea..5b90c32a8852677fc631127c394f81893ae6541f 100644 (file)
@@ -54,6 +54,7 @@ class aclrole extends acl
   var $orig_dn;
   var $orig_base;
   var $base ="";
+  var $baseSelector;
 
   function aclrole (&$config,  $dn= NULL)
   {
@@ -141,6 +142,12 @@ class aclrole extends acl
     $this->orig_base = $this->base;
     $this->orig_dn = $this->dn;
     $this->orig_cn = $this->cn;
+
+    /* Instanciate base selector */
+    $this->baseSelector= new baseSelector($this->get_allowed_bases(), $this->base);
+    $this->baseSelector->setSubmitButton(false);
+    $this->baseSelector->setHeight(300);
+    $this->baseSelector->update(true);
   }
 
 
@@ -149,36 +156,6 @@ class aclrole extends acl
     /* Call parent execute */
     plugin::execute();
 
-    /* Base select dialog */
-    $once = true;
-    foreach($_POST as $name => $value){
-      if((preg_match("/^chooseBase/",$name) && $once) && ($this->acl_is_moveable())){
-        $once = false;
-        $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
-        $this->dialog->setCurrentBase($this->base);
-      }
-    }
-
-    /* Dialog handling */
-    if(is_object($this->dialog)){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-
-        /* Check if selected base is valid */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
     $tmp= session::get('plist');
     $plist= $tmp->info;
 
@@ -362,9 +339,9 @@ class aclrole extends acl
 
     /* Create templating instance */
     $smarty= get_smarty();
+    $smarty->assign("usePrototype", "true");
 
-    $smarty->assign("bases", $this->get_allowed_bases());
-    $smarty->assign("base_select", $this->base);
+    $smarty->assign("base", $this->baseSelector->render());
 
     $tmp = $this->plInfo();
     foreach($tmp['plProvidedAcls'] as $name => $translation){
@@ -697,11 +674,14 @@ class aclrole extends acl
     plugin::save_object();
     if(isset($_POST['acl_role_posted'])){
      
-      /* Get base selection */
-      if(isset($_POST['base'])){
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$_POST['base']])){
-          $this->base = $_POST['base'];
+      /* 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;
         }
       }
     }