Skip to content

Commit a01f0ec

Browse files
committed
added return to infos for lists
1 parent 4991f9e commit a01f0ec

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

interface/lib/classes/plugin_listview.inc.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ function onShow() {
7373
$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$app->listform->listDef['name']."_list.lng";
7474
include($lng_file);
7575
$listTpl->setVar($wb);
76+
77+
// Setting Returnto information in the session
78+
$list_name = $app->listform->listDef["name"];
79+
$_SESSION["s"]["list"][$list_name]["parent_id"] = $app->tform_actions->id;
80+
$_SESSION["s"]["list"][$list_name]["parent_tab"] = $_SESSION["s"]["form"]["tab"];
81+
$_SESSION["s"]["list"][$list_name]["parent_script"] = $app->tform->formDef["action"];
82+
$_SESSION["s"]["form"]["return_to"] = $list_name;
7683

7784
return $listTpl->grab();
7885

interface/lib/classes/tform_actions.inc.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,14 @@ function onUpdate() {
115115
}
116116

117117
if($_REQUEST["next_tab"] == '') {
118-
header("Location: ".$app->tform->formDef['list_default']);
118+
if($_SESSION["s"]["form"]["return_to"] != '') {
119+
$list_name = $_SESSION["s"]["form"]["return_to"];
120+
$redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
121+
unset($_SESSION["s"]["form"]["return_to"]);
122+
header($redirect);
123+
} else {
124+
header("Location: ".$app->tform->formDef['list_default']);
125+
}
119126
exit;
120127
} else {
121128
$this->onShow();
@@ -145,7 +152,14 @@ function onInsert() {
145152
}
146153

147154
if($_REQUEST["next_tab"] == '') {
148-
header("Location: ".$app->tform->formDef['list_default']);
155+
if($_SESSION["s"]["form"]["return_to"] != '') {
156+
$list_name = $_SESSION["s"]["form"]["return_to"];
157+
$redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
158+
unset($_SESSION["s"]["form"]["return_to"]);
159+
header($redirect);
160+
} else {
161+
header("Location: ".$app->tform->formDef['list_default']);
162+
}
149163
exit;
150164
} else {
151165
$this->onShow();

interface/web/sites/mail_box_edit.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
$app->uses('tpl,tform,tform_actions');
5252
$app->load('tform_actions');
5353

54+
die(print_r($_SESSION));
55+
5456
class page_action extends tform_actions {
5557

5658
function onShowEnd() {

0 commit comments

Comments
 (0)