Code

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

gosa-plugins/gofon/gofon/conference/class_phoneConferenceGeneric.inc
gosa-plugins/gofon/gofon/conference/generic.tpl

index dc5a16bd67b14f250d42c2ab43b67a7ffd8c3851..069010e809aa6e458d94713eb11d2c656bad565a 100644 (file)
@@ -49,10 +49,9 @@ class conference extends plugin
 
   var $old_tele_number         = false;
   var $old_dn;
+  var $baseSelector;
 
   /* Headpage attributes */
-  var $last_dep_sorting= "invalid";
-  var $departments= array();
   var $view_logged = FALSE;
   var $dialog ;
 
@@ -152,6 +151,11 @@ class conference 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);
   }
 
 
@@ -167,36 +171,7 @@ class conference extends plugin
     }
 
     $smarty= get_smarty();
-
-    $smarty->assign("bases" ,$this->config->idepartments);
-    $smarty->assign("base"  ,$this->base);
-
-    $once = true; 
-    foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_writeable("base")){
-        $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()){
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
+    $smarty->assign("usePrototype", "true");
 
     foreach ($this->attributes as $val){
       $smarty->assign("$val", $this->$val);
@@ -226,15 +201,7 @@ class conference extends plugin
       $smarty->assign($name."ACL",$this->getacl($name));
     }
 
-    if($this->acl_is_writeable("base")){
-      $smarty->assign("baseSelect",true);
-    }else{
-      $smarty->assign("baseSelect",false);
-    }
-
-    $smarty->assign("bases" ,$this->get_allowed_bases());
-    $smarty->assign("base_select"  ,$this->base);
-
+    $smarty->assign("base"  ,$this->baseSelector->render());
 
     if(session::get('js')==1){
       if($this->goFonConferenceOption_P != "P"){
@@ -294,13 +261,17 @@ class conference extends plugin
       plugin::save_object();
       $this->base = $base_tmp;
 
-      /* 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;
         }
       }
+
       foreach(array("goFonConferenceOption_P","goFonConferenceOption_r","goFonConferenceOption_M","goFonConferenceOption_s",
             "goFonConferenceOption_i","goFonConferenceOption_c","goFonConferenceOption_D") as $attrs){
 
index 83f25206a2f7e35b12e0d57e49c273b3bf78c478..0916cea2aa23f6234173629458695d5905661703 100644 (file)
           <td>
 
 {render acl=$baseACL}
-            <select id="base" size="1" name="base" title="{t}Select a base{/t}">
-              {html_options options=$bases selected=$base_select}
-            </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>