X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fgofon%2Fconference%2Fclass_phoneConferenceGeneric.inc;h=cd62cf5c5d54f99be6d58a4c6289d588dc2bbedd;hb=9ba37d0ddd9297f3eded1e12d899e939d9f15555;hp=4713d45703d790ebebe80e6cb8dd196313dc9327;hpb=07e6492263fef837908f515518bd362b433a44ce;p=gosa.git diff --git a/plugins/gofon/conference/class_phoneConferenceGeneric.inc b/plugins/gofon/conference/class_phoneConferenceGeneric.inc index 4713d4570..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); } @@ -111,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" ,$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); @@ -468,20 +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)){ + if ($ldap->count()){ + $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); - + $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();