diff --git a/plugins/gofon/macro/class_gofonMacroManagement.inc b/plugins/gofon/macro/class_gofonMacroManagement.inc
index a88498d72c1075afe2761161b4d67b2a2b51b91c..6ea4e3649796721e42d60793da3b01dbd0269fb0 100755 (executable)
/* Get global filter config */
if (!is_global("macrofilter")){
$base= get_base_from_people($ui->dn);
- $macrofilter= array("depselect" => $base, "regex" => "*");
+ $macrofilter= array("regex" => "*");
register_global("macrofilter", $macrofilter);
}
+ if(!isset($_SESSION['CurrentMainBase'])){
+ $_SESSION['CurrentMainBase'] = $base= get_base_from_people($ui->dn);
+ }
+
$acl= get_permissions ($ui->dn, $ui->subtreeACL);
$this->acl= get_module_permission($acl, "goFonMacro", $ui->dn);
}
/* Save data */
$macrofilter= get_global("macrofilter");
- foreach( array("depselect", "regex") as $type){
+ foreach( array("regex") as $type){
if (isset($_POST[$type])){
$macrofilter[$type]= $_POST[$type];
}
if(isset($_GET['act'])&&($_GET['act']=="dep_open")){
$s_action="open";
$s_entry = base64_decode($_GET['dep_id']);
- $macrofilter['depselect']= "".$this->config->departments[trim($s_entry)];
+ $_SESSION['CurrentMainBase'] = $this->config->departments[trim($s_entry)];
+
}
/* Test Posts */
$s_entry = preg_replace("/_.$/","",$s_entry);
/* Department changed? */
- if(isset($_POST['depselect']) && $_POST['depselect']){
- $macrofilter['depselect']= $_POST['depselect'];
+ if(isset($_POST['CurrentMainBase']) && $_POST['CurrentMainBase']){
+ $_SESSION['CurrentMainBase']= $_POST['CurrentMainBase'];
}
/* Homebutton is posted */
if($s_action=="home"){
- $macrofilter['depselect']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
- $macrofilter['depselect']=(preg_replace("/^[^,]+,/","",$macrofilter['depselect']));
+ $_SESSION['CurrentMainBase'] = preg_replace("/^[^,]+,/","",$this->ui->dn);
+ $_SESSION['CurrentMainBase'] = preg_replace("/^[^,]+,/","", $_SESSION['CurrentMainBase']);
}
if($s_action=="root"){
- $macrofilter['depselect']=($this->config->current['BASE']);
+ $_SESSION['CurrentMainBase'] = $this->config->current['BASE'] ;
}
/* If Backbutton is Posted */
if($s_action=="back"){
- $base_back = preg_replace("/^[^,]+,/","",$macrofilter['depselect']);
+ $base_back = preg_replace("/^[^,]+,/","", $_SESSION['CurrentMainBase']);
$base_back = convert_department_dn($base_back);
if(isset($this->config->departments[trim($base_back)])){
- $macrofilter['depselect']= $this->config->departments[trim($base_back)];
+ $_SESSION['CurrentMainBase'] = $this->config->departments[trim($base_back)];
}else{
- $macrofilter['depselect']= $this->config->departments["/"];
+ $_SESSION['CurrentMainBase'] = $this->config->departments["/"];
}
}
/* Prepare departments */
$options= "";
foreach ($this->config->idepartments as $key => $value){
- if ($macrofilter['depselect'] == $key){
+ if ($_SESSION['CurrentMainBase'] == $key){
$options.= "<option selected='selected' value='$key'>$value</option>";
} else {
$options.= "<option value='$key'>$value</option>";
" <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
" <input class='center' type='image' align='middle' src='images/list_new_macro.png' title='"._("Create new phone macro")."' alt='"._("New")."' name='user_new'> ".
" <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
- _("Base")." <select name='depselect' onChange='mainform.submit()' class='center'>$options</select>".
+ _("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
" <input class='center' type='image' src='images/list_submit.png' align='middle' title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'> ".
"</div>";
$smarty->assign("infoimage", get_template_path('images/info.png'));
$smarty->assign("launchimage", get_template_path('images/launch.png'));
$smarty->assign("deplist", $this->config->idepartments);
- foreach( array("depselect", "regex") as $type){
+ foreach( array("regex") as $type){
$smarty->assign("$type", $macrofilter[$type]);
}
+ $smarty->assign("CurrentMainBase" , $_SESSION['CurrentMainBase']);
+
/* Extend if we are not using javascript */
$smarty->assign("apply", apply_filter());
$smarty->assign("alphabet", generate_alphabet());
$macrofilter= get_global('macrofilter');
/* Set base for all searches */
- $base= $macrofilter['depselect'];
+ $base= $_SESSION['CurrentMainBase'];
/* Regex filter? */
if ($macrofilter['regex'] != ""){
ksort($tmp);
foreach($tmp as $value){
if(isset($value["description"][0])){
- $this->departments[$value['dn']]=convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+ $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
}else{
- $this->departments[$value['dn']]=convert_department_dn2($value['dn']);//$value["description"][0];
+ $this->departments[$value['dn']]= convert_department_dn2($value['dn']);//$value["description"][0];
}
}