Code

Updated blocklist base handling
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 29 Jan 2010 16:58:08 +0000 (16:58 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 29 Jan 2010 16:58:08 +0000 (16:58 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15467 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/gofax/gofax/blocklists/class_blocklistGeneric.inc
gosa-plugins/gofax/gofax/blocklists/generic.tpl

index c1701053bf4f01be2880dc2de6c0550649db166d..e240bb63b0e8c7399d67724d1b8f410a458c6f3d 100644 (file)
@@ -26,6 +26,7 @@ class blocklistGeneric extends plugin
 
   var $goFaxSBlocklist = array();
   var $goFaxRBlocklist = array();
+  var $baseSelector;
 
   
   function __construct($config,$dn = "new")
@@ -73,6 +74,12 @@ class blocklistGeneric extends plugin
     
     $this->orig_base = $this->base;
     $this->orig_dn   = $this->dn;
+
+    /* 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);
   }
 
   public function execute()
@@ -84,41 +91,6 @@ class blocklistGeneric extends plugin
     }
 
 
-    /**************
-     * Base select dialog 
-     **************/
-
-    $once = true;
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once){
-        $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()){
-
-        /* A new base was selected, check if it is a valid one */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-        $this->dialog= false;
-
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
-
     /***************
       Add numer to blocklist
      ***************/
@@ -149,6 +121,7 @@ class blocklistGeneric extends plugin
      ***************/
 
     $smarty = get_smarty();
+    $smarty->assign("usePrototype", "true");
     foreach($this->attributes as $name){
       $smarty->assign($name,$this->$name);
     }
@@ -159,8 +132,7 @@ class blocklistGeneric extends plugin
     $smarty->assign("goFaxBlocklist",$this->goFaxBlocklist);
     $smarty->assign("cnACL",$this->getacl("cn",$this->readonly));
     $smarty->assign("typeACL",$this->getacl("type",$this->readonly));
-    $smarty->assign("base",$this->base);
-    $smarty->assign("bases", $this->get_allowed_bases());
+    $smarty->assign("base", $this->baseSelector->render());
     $smarty->assign("types", array(BLOCK_LIST_SEND => _("send"), BLOCK_LIST_RECEIVE => _("receive")));
     $smarty->assign("type", $this->type);
     $smarty->assign("dn", $this->dn);
@@ -176,13 +148,18 @@ class blocklistGeneric extends plugin
       plugin::save_object();
       $this->cn = $tmp_cn;
 
-      /* Save base, since this is no LDAP attribute */
-      $tmp = $this->get_allowed_bases();
-      if(isset($_POST['base'])){
-        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;
         }
       }
+
+      /* Save attrbutes */
       $tmp = $this->attributes;
       $tmp[] = "type";
       foreach($tmp as $attr){
index 917153847770e82306d2ab98e62739477f111d6a..02a8cbe95e4bd16782d446c10dc35ff9e84ffc9e 100644 (file)
       <td><LABEL for="base">{t}Base{/t}</LABEL>{$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>
-{/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}">
+        {$base}
 {/render}
       </td>
      </tr>