From 4836752715a56f524c3e3e4ce3f62ad5e2cc6b26 Mon Sep 17 00:00:00 2001 From: cajus Date: Fri, 29 Jan 2010 17:52:36 +0000 Subject: [PATCH] Updated base selector git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15480 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../systems/goto/class_terminalGeneric.inc | 56 ++++++------------- .../goto/admin/systems/goto/terminal.tpl | 7 +-- 2 files changed, 19 insertions(+), 44 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/goto/class_terminalGeneric.inc b/gosa-plugins/goto/admin/systems/goto/class_terminalGeneric.inc index ca80b1a7f..c1af91cae 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_terminalGeneric.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_terminalGeneric.inc @@ -37,6 +37,7 @@ class termgeneric extends plugin /* Plugin side filled */ var $modes= array(); + var $baseSelector; /* attribute list for save action */ var $ignore_account= TRUE; @@ -144,6 +145,12 @@ class termgeneric extends plugin $this->orig_dn= $this->dn; $this->orig_cn= $this->cn; $this->orig_base= $this->base; + + /* 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); } function set_acl_base($base) @@ -196,36 +203,6 @@ class termgeneric extends plugin } - /* 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()){ - - /* 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()); - } - } - /* Do we represent a valid terminal? */ if (!$this->is_account && $this->parent === NULL){ $display= "\"\" ". @@ -247,6 +224,7 @@ class termgeneric extends plugin /* Fill templating stuff */ $smarty= get_smarty(); + $smarty->assign("usePrototype", "true"); $tmp = $this->plInfo(); foreach($tmp['plProvidedAcls'] as $name => $translation){ @@ -257,8 +235,6 @@ class termgeneric extends plugin $smarty->assign("description", $this->description); $smarty->assign("staticAddress", ""); - $smarty->assign("bases", $this->get_allowed_bases()); - /* tell smarty the inherit checkbox state */ $smarty->assign("inheritTimeServer",$this->inheritTimeServer); @@ -317,9 +293,10 @@ class termgeneric extends plugin $smarty->assign("fai_activated",$this->fai_activated); /* Variables */ - foreach(array("base", "gotoMode", "gotoTerminalPath", "gotoSwapServer","gotoSyslogServer", "gotoNtpServer") as $val){ + foreach(array("gotoMode", "gotoTerminalPath", "gotoSwapServer","gotoSyslogServer", "gotoNtpServer") as $val){ $smarty->assign($val."_select", $this->$val); } + $smarty->assign("base", $this->baseSelector->render()); $smarty->assign("member_of_ogroup",$this->member_of_ogroup); @@ -396,11 +373,14 @@ class termgeneric extends plugin plugin::save_object(); $this->base = $base_tmp; - /* Set new base if allowed */ - $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; } } diff --git a/gosa-plugins/goto/admin/systems/goto/terminal.tpl b/gosa-plugins/goto/admin/systems/goto/terminal.tpl index e43e5d0fb..d5e6e81e2 100644 --- a/gosa-plugins/goto/admin/systems/goto/terminal.tpl +++ b/gosa-plugins/goto/admin/systems/goto/terminal.tpl @@ -28,12 +28,7 @@ {render acl=$baseACL} - -{/render} -{render acl=$baseACL disable_picture='images/lists/folder_grey.png'} - + {$base} {/render} -- 2.30.2