From ca67f6e4181ee87bb49259260f8bdc6d8f86a18b Mon Sep 17 00:00:00 2001 From: cajus Date: Fri, 29 Jan 2010 17:36:37 +0000 Subject: [PATCH] Update base selector git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15477 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../systems/gofon/class_phoneGeneric.inc | 57 ++++++------------- .../gofon/admin/systems/gofon/phone.tpl | 7 +-- 2 files changed, 19 insertions(+), 45 deletions(-) diff --git a/gosa-plugins/gofon/admin/systems/gofon/class_phoneGeneric.inc b/gosa-plugins/gofon/admin/systems/gofon/class_phoneGeneric.inc index bb6bcad4c..09a0d272d 100644 --- a/gosa-plugins/gofon/admin/systems/gofon/class_phoneGeneric.inc +++ b/gosa-plugins/gofon/admin/systems/gofon/class_phoneGeneric.inc @@ -30,6 +30,7 @@ class phoneGeneric extends plugin var $selected_categorie = 0; var $netConfigDNS; var $view_logged = FALSE; + var $baseSelector; /* attribute list for save action */ var $attributes= array("cn", "description", @@ -93,6 +94,12 @@ class phoneGeneric extends plugin $this->orig_dn= $this->dn; $this->orig_base= $this->base; $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); } function set_acl_base($base) @@ -125,37 +132,6 @@ class phoneGeneric extends plugin return($display); } - /* 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()); - } - } - /* handle Permit Add*/ if(isset($_POST['goFonPermitAdd']) && $this->acl_is_writeable("goFonPermit")){ if(isset($_POST['goFonPermitNew'])){ @@ -217,8 +193,7 @@ class phoneGeneric extends plugin /* Fill templating stuff */ $smarty= get_smarty(); - - $smarty->assign("bases", $this->get_allowed_bases()); + $smarty->assign("usePrototype", "true"); $tmp = $this->plInfo(); foreach($tmp['plProvidedAcls'] as $name => $translation){ @@ -248,7 +223,7 @@ class phoneGeneric extends plugin $smarty->assign("selected_categorie",$this->selected_categorie); /* Assign attributes */ - $smarty->assign("base_select", $this->base); + $smarty->assign("base", $this->baseSelector->render()); $smarty->assign("goFonDefaultIPs",array("dynamic"=>_("dynamic"),"network"=>_("Networksettings"))); /* Show main page */ @@ -307,13 +282,17 @@ class phoneGeneric extends plugin $this->netConfigDNS->save_object(); - /* 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/gofon/admin/systems/gofon/phone.tpl b/gosa-plugins/gofon/admin/systems/gofon/phone.tpl index 691a06fe7..ddbfb7cf2 100644 --- a/gosa-plugins/gofon/admin/systems/gofon/phone.tpl +++ b/gosa-plugins/gofon/admin/systems/gofon/phone.tpl @@ -17,12 +17,7 @@ {$must} {render acl=$baseACL} - -{/render} -{render acl=$baseACL disable_picture='images/lists/folder_grey.png'} - + {$base} {/render} -- 2.30.2