Commit df51be1a authored by Carsten  Rose's avatar Carsten Rose
Browse files

F6100 Url Forward Auto: Rename 'client' to 'auto'. Implement 'saseAndClose'

parent 4c4995d7
......@@ -89,7 +89,7 @@ try {
$answer = array();
if ($flagSuccess) {
$answer[API_MESSAGE] = 'Deleted';
$answer[API_REDIRECT] = API_ANSWER_REDIRECT_CLIENT;
$answer[API_REDIRECT] = API_ANSWER_REDIRECT_AUTO;
$answer[API_STATUS] = API_ANSWER_STATUS_SUCCESS;
} else {
$answer[API_STATUS] = API_ANSWER_STATUS_ERROR;
......
......@@ -49,12 +49,12 @@ require_once(__DIR__ . '/../qfq/exceptions/DbException.php');
$answer = array();
$answer[API_REDIRECT] = API_ANSWER_REDIRECT_CLIENT;
$answer[API_REDIRECT] = API_ANSWER_REDIRECT_AUTO;
$answer[API_STATUS] = API_ANSWER_STATUS_ERROR;
$answer[API_MESSAGE] = '';
try {
$qfq = new \qfq\QuickFormQuery(['bodytext' => ""]);
$qfq = new QuickFormQuery(['bodytext' => ""]);
$data = $qfq->saveForm();
......
......@@ -684,7 +684,8 @@ const API_ANSWER_STATUS_SUCCESS = 'success';
const API_ANSWER_STATUS_CONFLICT = 'conflict';
const API_ANSWER_STATUS_CONFLICT_ALLOW_FORCE = 'conflict_allow_force';
const API_ANSWER_STATUS_ERROR = 'error';
const API_ANSWER_REDIRECT_CLIENT = 'client';
const API_ANSWER_REDIRECT_AUTO = 'auto';
const API_ANSWER_REDIRECT_CLOSE = 'close';
const API_ANSWER_REDIRECT_NO = 'no';
const API_ANSWER_REDIRECT_URL = 'url';
const API_ANSWER_REDIRECT_URL_SKIP_HISTORY = 'url-skip-history';
......@@ -791,7 +792,7 @@ const F_SHOW_BUTTON = 'showButton';
const F_FORWARD_MODE = 'forwardMode';
const F_FORWARD_PAGE = 'forwardPage';
const F_FORWARD_MODE_CLIENT = API_ANSWER_REDIRECT_CLIENT;
const F_FORWARD_MODE_AUTO = API_ANSWER_REDIRECT_AUTO;
const F_FORWARD_MODE_NO = API_ANSWER_REDIRECT_NO;
const F_FORWARD_MODE_URL = API_ANSWER_REDIRECT_URL;
const F_FORWARD_MODE_URL_SKIP_HISTORY = API_ANSWER_REDIRECT_URL_SKIP_HISTORY;
......@@ -861,6 +862,8 @@ const F_ORDER_INTERVAL = 'orderInterval';
const F_ORDER_COLUMN = 'orderColumn';
const F_ORDER_COLUMN_NAME = 'ord';
const F_SAVE_AND_CLOSE = 'saveAndClose';
// FORM_ELEMENT_STATI
const FE_MODE_SHOW = 'show';
const FE_MODE_READONLY = 'readonly';
......
......@@ -208,6 +208,11 @@ class QuickFormQuery {
$this->formSpec[F_FORWARD_MODE] = F_FORWARD_MODE_URL_SKIP_HISTORY;
}
// with forwardMode='auto' check if the tab should be closed too.
if ($this->formSpec[F_FORWARD_MODE] == F_FORWARD_MODE_AUTO && $this->formSpec[F_SAVE_AND_CLOSE] == '1') {
$this->formSpec[F_FORWARD_MODE] = API_ANSWER_REDIRECT_CLOSE;
}
return ([
API_REDIRECT => $this->formSpec[F_FORWARD_MODE],
API_REDIRECT_URL => $forwardPage,
......@@ -548,7 +553,7 @@ class QuickFormQuery {
$forward = trim($forwardArray[0]);
switch ($forward) {
case F_FORWARD_MODE_CLIENT:
case F_FORWARD_MODE_AUTO:
case F_FORWARD_MODE_NO:
case F_FORWARD_MODE_URL:
case F_FORWARD_MODE_URL_SKIP_HISTORY:
......@@ -568,7 +573,7 @@ class QuickFormQuery {
if ('url' == substr($this->formSpec[F_FORWARD_MODE], 0, 3)) {
if ($this->formSpec[F_FORWARD_PAGE] == '') {
$this->formSpec[F_FORWARD_MODE] = F_FORWARD_MODE_CLIENT;
$this->formSpec[F_FORWARD_MODE] = F_FORWARD_MODE_AUTO;
$customForward = false;
} else {
$customForward = true;
......
......@@ -114,6 +114,12 @@ $UPDATE_ARRAY = array(
"ALTER TABLE `Cron` ADD `outputPattern` VARCHAR(255) NOT NULL AFTER `outputMode`",
],
'18.04.5' => [
"ALTER TABLE `Form` CHANGE `forwardMode` `forwardMode` ENUM('client','no','url','url-skip-history','url-sip','auto') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'client'",
"UPDATE `Form` SET forwardMode='auto' WHERE forwardMode='client'",
"ALTER TABLE `Form` CHANGE `forwardMode` `forwardMode` ENUM('auto','no','url','url-skip-history','url-sip') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'auto';",
],
);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment