X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fgofon%2Fconference%2Fclass_phoneConferenceGeneric.inc;h=cd62cf5c5d54f99be6d58a4c6289d588dc2bbedd;hb=9ba37d0ddd9297f3eded1e12d899e939d9f15555;hp=961650e37a091935b86aba0f127327b3c987266f;hpb=43aa42aff6eed0e27a2a3eca01f5ed19b9fa7c57;p=gosa.git diff --git a/plugins/gofon/conference/class_phoneConferenceGeneric.inc b/plugins/gofon/conference/class_phoneConferenceGeneric.inc index 961650e37..cd62cf5c5 100644 --- a/plugins/gofon/conference/class_phoneConferenceGeneric.inc +++ b/plugins/gofon/conference/class_phoneConferenceGeneric.inc @@ -54,6 +54,8 @@ class conference extends plugin var $last_dep_sorting= "invalid"; var $departments= array(); + var $dialog ; + /* attribute list for save action */ var $attributes= array("cn","base", "description", "goFonPIN","goFonConferenceOption_P","goFonConferenceOption_r", "goFonConferenceOption_M","goFonConferenceOption_s","goFonConferenceOption_i","goFonConferenceOption_c", @@ -61,9 +63,9 @@ class conference extends plugin var $objectclasses= array("top", "goFonConference"); - function conference ($config, $dn) + function conference ($config, $dn, $plugin= NULL) { - plugin::plugin($config, $dn); + plugin::plugin($config, $dn, $plugin); $this->is_account = TRUE; $this->ui = get_userinfo(); $this->dn = $dn; @@ -73,8 +75,8 @@ class conference extends plugin /* Set base */ if ($this->dn == "new"){ $ui= get_userinfo(); - if(isset($_SESSION['conferencefilter']['depselect'])){ - $this->base = $_SESSION['conferencefilter']['depselect']; + if(isset($_SESSION['CurrentMainBase'])){ + $this->base = $_SESSION['CurrentMainBase']; }else{ $this->base= dn2base($ui->dn); } @@ -82,8 +84,9 @@ class conference extends plugin $this->base= preg_replace ("/^[^,]+,/", "", $this->dn); } - $acl= get_permissions ($this->dn, $this->ui->subtreeACL); - $this->acl= get_module_permission($acl, "conference", $this->dn); + $ui= get_userinfo(); + $acl= get_permissions ($ui->dn, $this->ui->subtreeACL); + $this->acl= get_module_permission($acl, "conference", $ui->dn); $this->goFonConferenceOwner=$this->ui->dn; /* Parse Options ... @@ -110,16 +113,38 @@ class conference extends plugin function execute() { - /* Call parent execute */ - plugin::execute(); + /* Call parent execute */ + plugin::execute(); - $this->config->departments = get_departments($this->dn); - $this->config->make_idepartments(); $smarty= get_smarty(); - $smarty->assign("bases" ,array_flip($this->config->departments)); + $smarty->assign("bases" ,$this->config->idepartments); $smarty->assign("base" ,$this->base); + $once = true; + foreach($_POST as $name => $value){ + if(preg_match("/^chooseBase/",$name) && $once){ + $once = false; + $this->dialog = new baseSelectDialog($this->config); + $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()){ + $this->base = $this->dialog->isSelected(); + $this->dialog= false; + }else{ + return($this->dialog->execute()); + } + } + $smarty->assign("goFonConferenceOptions", array("D"=>"Conference ","d"=>"Conference without PIN")); $smarty->assign("goFonConferenceOptionFormats", array("WAV"=>"Wave","GSM"=>"GSM","WAV49"=>"Wave49")); $smarty->assign("goFonConferenceOption", $this->goFonConferenceOption_D); @@ -148,7 +173,7 @@ class conference extends plugin function remove_from_parent() { - $this->SQL_remove_me(true); + $this->SQL_remove_me(true); $ldap= $this->config->get_ldap_link(); $ldap->cd ($this->dn); @@ -179,7 +204,8 @@ class conference extends plugin /* Check values */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); if($this->is_number_used()){ $message[] = $this->is_number_used(); @@ -466,18 +492,21 @@ class conference extends plugin } $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->cat($this->dn, array('dn')); - $ldap->cat($this->dn); - $a= $ldap->fetch(); - $ldap->cd($this->dn); - if (count($a)){ - $ldap->modify($this->attrs); + if ($ldap->count()){ + $ldap->cd($this->dn); + $this->cleanup(); + $ldap->modify ($this->attrs); $this->handle_post_events('modify'); } else { + $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); + $ldap->cd($this->dn); $ldap->add($this->attrs); $this->handle_post_events('add'); } - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving phone conference failed")); /* Optionally execute a command after we're done */ $this->postcreate();