X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fgofon%2Fconference%2Fclass_phoneConferenceManagment.inc;h=5bf53a119714f539f099a556426b76511e51a3ec;hb=9ba37d0ddd9297f3eded1e12d899e939d9f15555;hp=e4913b2f4092ae18f827e461169197a143415d94;hpb=91b5d0b99be7089b0f72a6baaca9e95e7a7b2547;p=gosa.git diff --git a/plugins/gofon/conference/class_phoneConferenceManagment.inc b/plugins/gofon/conference/class_phoneConferenceManagment.inc index e4913b2f4..5bf53a119 100644 --- a/plugins/gofon/conference/class_phoneConferenceManagment.inc +++ b/plugins/gofon/conference/class_phoneConferenceManagment.inc @@ -30,15 +30,14 @@ class phoneConferenceManagment extends plugin var $cli_description = "Some longer text\nfor help"; var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser"); - /* Headpage attributes */ - var $conferences = array(); - /* attribute list for save action */ var $attributes = array(); var $objectclasses = array(); + + var $conferences = array(); var $conftab = false; - var $departments =array(); + var $DivListConference = NULL; /* Initialise Class */ function phoneConferenceManagment ($config, $ui) @@ -47,48 +46,34 @@ class phoneConferenceManagment extends plugin $this->dn = ""; $this->config = $config; - /* Get global filter config */ - if (!isset($_SESSION["conferencefilter"])){ - $base= get_base_from_people($ui->dn); - $conferencefilter= array( - "depselect" => $base, - "regex" => "*"); - $_SESSION["conferencefilter"] = $conferencefilter; - } + $acl= get_permissions ($ui->dn, $ui->subtreeACL); + $this->acl= get_module_permission($acl, "conference", $ui->dn); + + $this->DivListConference = new divListConference($this->config,$this); } + /* Execute class and display something */ function execute() { + /* Call parent execute */ + plugin::execute(); + + /*************** + Variable initialisation + ***************/ + /* Reload departments */ - $this->config->departments = get_departments(); $smarty = get_smarty(); $display = ""; $s_action = ""; // Will contain an action, like del or edit $s_entry = ""; // The entry name for edit delete -... - $conferencefilter = $_SESSION["conferencefilter"]; - - if(isset($_POST['regexit'])){ - $conferencefilter['regex']=$_POST['regexit']; - } - - if(isset($_GET['search'])){ - if($_GET['search']=="*"){ - $conferencefilter['regex']=$_GET['search']; - }else{ - $conferencefilter['regex']=$_GET['search']."*"; - } - } - - $smarty->assign("regex",$conferencefilter['regex']); - /* Start for New List Managment */ - if(isset($_GET['act'])&&($_GET['act']=="dep_open")){ - $s_action="open"; - $s_entry = base64_decode($_GET['dep_id']); - $conferencefilter['depselect']= "".$this->config->departments[trim($s_entry)]; - } + /*************** + Check posts + ***************/ + foreach($_POST as $key => $post){ if(preg_match("/.*new.*/i",$key)){ $s_action = "new"; @@ -102,12 +87,6 @@ class phoneConferenceManagment extends plugin $s_action="edit"; $s_entry = preg_replace("/conf_".$s_action."_/i","",$key); $s_entry = preg_replace("/_.*$/","",$s_entry); - }elseif(preg_match("/dep_back.*/i",$key)){ - $s_action="back"; - }elseif(preg_match("/dep_home.*/i",$key)){ - $s_action="home"; - }elseif(preg_match("/dep_root.*/i",$key)){ - $s_action="root"; } } @@ -117,39 +96,13 @@ class phoneConferenceManagment extends plugin $s_entry = $_GET['id']; } - /* Department changed? */ - if(isset($_POST['depselect']) && $_POST['depselect']){ - $conferencefilter['depselect']= $_POST['depselect']; - } - - /* Homebutton is posted */ - if($s_action=="home"){ - $conferencefilter['depselect']=(preg_replace("/^[^,]+,/","",$this->ui->dn)); - $conferencefilter['depselect']=(preg_replace("/^[^,]+,/","",$conferencefilter['depselect'])); - } - - /* back to root */ - if($s_action=="root"){ - $conferencefilter['depselect']=($this->config->current['BASE']); - } - - /* If Backbutton is Posted */ - if($s_action=="back"){ - $base_back = preg_replace("/^[^,]+,/","",$conferencefilter['depselect']); - $base_back = convert_department_dn($base_back); - - if(isset($this->config->departments[trim($base_back)])){ - $conferencefilter['depselect']= $this->config->departments[trim($base_back)]; - }else{ - $conferencefilter['depselect']= $this->config->departments["/"]; - } - } - - register_global("conferencefilter",$conferencefilter); - $this->reload(); + /*************** + Cancel dialogs + ***************/ + /* Reset requested? */ - if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){ + if (isset($_POST['edit_cancel'])){ if (isset($this->conftab)){ del_lock ($this->conftab->dn); unset ($this->conftab); @@ -160,6 +113,11 @@ class phoneConferenceManagment extends plugin unset ($_SESSION['objectinfo']); } + + /*************** + Delete + ***************/ + /* Delete Entry if Posted action (s_action) == del * The entry which will be deleted is defined in $s_entry */ @@ -178,25 +136,32 @@ class phoneConferenceManagment extends plugin } } + + /*************** + Delete confirmed + ***************/ + /* If department deletion is accepted ... * Finally delete department */ if (isset($_POST['delete_department_confirm'])){ - $acl= get_permissions ($this->dn, $this->ui->subtreeACL); - $acl= get_module_permission($acl, "goFonConference", $this->dn); - if (chkacl($acl, "all") == ""){ + if (chkacl($this->acl, "delete") == ""){ $this->remove_from_parent(); gosa_log ("Department object'".$this->dn."' has been removed"); - $this->reload (); } else { print_red (_("You have no permission to remove this department.")); } } + + /*************** + Edit + ***************/ + /* Edit Entry if Posted action (s_action) == edit * The entry which will be edited is defined in $s_entry */ - if ($s_action=="edit"){ + if (($s_action=="edit") && (!isset($this->conftab->config))){ $this->dn= $this->conferences[$s_entry]['dn']; @@ -207,24 +172,32 @@ class phoneConferenceManagment extends plugin /* Lock the current entry, so everyone will get the above dialog */ add_lock ($this->dn, $this->ui->dn); - /* Set up the users ACL's for this 'dn' */ - $this->acl= get_permissions ($this->dn, $this->ui->subtreeACL); - /* Register conftab to trigger edit dialog */ $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn); - $this->conftab->set_acl(array(":all")); $_SESSION['objectinfo']= $this->dn; } + + /*************** + Create new + ***************/ + /* Insert new entry*/ if($s_action == "new"){ + + /* Set up the users ACL's for this 'dn' */ $this->dn= "new"; $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn); - $this->conftab->set_acl(array(':all')); + unset($_SESSION['objectinfo']); } + + /*************** + Save entry + ***************/ + /* Edit finished, check and save changes */ - if (isset($_POST['edit_finish'])){ + if ((isset($_POST['edit_finish'])) && (isset($this->conftab->config))){ /* Check tabs, will feed message array */ $this->conftab->last= $this->conftab->current; $this->conftab->save_object(); @@ -242,193 +215,79 @@ class phoneConferenceManagment extends plugin } $this->conftab->save (); + del_lock ($this->conftab->dn);; unset ($this->conftab); $this->conftab= NULL; unset ($_SESSION['objectinfo']); } else { show_errors($message); } - $this->reload(); } + + /*************** + Display dialogs + ***************/ + /* if edit or new, show dialog */ - if($this->conftab){ + if(($this->conftab) && (isset($this->conftab->config))){ $display= $this->conftab->execute(); /* Don't show buttons if tab dialog requests this */ if (!$this->conftab->by_object[$this->conftab->current]->dialog){ $display.= "
\n"; - $display.= "\n"; + $display.= "\n"; $display.= " \n"; - $display.= "\n"; + $display.= "\n"; $display.= "
"; } return ($display); } - /* Header + Departmentlist*/ - $options= ""; - foreach ($this->config->idepartments as $key => $value){ - if ($conferencefilter['depselect'] == $key){ - $options.= ""; - } else { - $options.= ""; - } - } - - $listhead = "