Commit 472094b3 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Implements #9617. 'requiredOff' is replaced by 'skipRequiredCheck' and now deprecated.

parent 6ee8e007
Pipeline #2726 passed with stages
in 2 minutes and 45 seconds
......@@ -2481,7 +2481,7 @@ The CLIENT `submit_reason` shows the user action:
Example forwardPage
^^^^^^^^^^^^^^^^^^^
* `{{SELECT IF('{{formModeGlobal:S}}'='requiredOff', 'no', 'auto') }}`
* `{{SELECT IF('{{formModeGlobal:S}}'='skipRequiredCheck', 'no', 'auto') }}`
* `{{SELECT IF('{{submit_reason:CE:alnumx}}'='save', 'no', 'url'), '|http://example.com' }}`
Type: combined dynamic mode & URL/page
......@@ -2690,27 +2690,31 @@ The Form global mode `mode` is given by default with `{{formModeGlobal:SE:alnumx
Optional it might be defined via *Form.parameter* ::
mode=readonly|requiredOff
mode=readonly|skipRequiredCheck
* `readonly`: all `FormElement` of the whole form are temporarily in `readonly` mode. This is a fast way to use an
existing *Form* just to display the form data, without a possibility for the user to change any data of the form.
* `requiredOff`: all `FormElement` of the whole, with `mode=required`, will temporarily switch to `mode=show`. In this
mode, the user might save the form without providing all necessary data. Later on, when application logic requires a
final submit, this mode is not used any longer (call the form as regular without the 'formModeGlobal' parameter) and
the form can only be saved with all data given.
Than, e.g. an action-FormElement 'afterSave' can be used to detect the final submit situation and do some extra stuff,
necessary for the final submit.
* `skipRequiredCheck`:
The following shows the same *Form* in the `regular`, `readonly` and `requiredOff` mode::
* All `FormElement` with `mode=required`, will switch to `mode=show`.
* The user might save the form without providing all necessary data.
* Calling the form without this mode (regular), the form can only be saved with all data given. Than, e.g. an
action-FormElement 'afterSave' can be used to detect the final submit situation and do some extra stuff,
necessary for a final submit.
* `requiredOff` is a deprecated synonym of `skipRequiredCheck`.
The following shows the same *Form* in the `regular`, `readonly` and `skipRequiredCheck` mode::
10.sql = SELECT CONCAT('p:{{pageAlias:T}}&form=person&r=', p.id, '|Regular') as _pagee,
CONCAT('p:{{pageAlias:T}}&form=person&formModeGlobal=readonly&r=', p.id, '|Readonly') as _pagee,
CONCAT('p:{{pageAlias:T}}&form=person&formModeGlobal=requiredOff&r=', p.id, '|Required off') as _pagee
CONCAT('p:{{pageAlias:T}}&form=person&formModeGlobal=skipRequiredCheck&r=', p.id, '|Required off') as _pagee
FROM Person AS p
..
FormElements
------------
......
......@@ -987,8 +987,7 @@ abstract class AbstractBuildForm {
for ($i = 0; $i < count($this->feSpecNative); ++$i) {
// Only check native elements which will be shown
if ($this->feSpecNative[$i][FE_CLASS] == FE_CLASS_NATIVE &&
($this->feSpecNative[$i][FE_MODE] == FE_MODE_SHOW || $this->feSpecNative[$i][FE_MODE] == FE_MODE_REQUIRED ||
$this->feSpecNative[$i][FE_MODE] == FE_MODE_SHOW_REQUIRED)
($this->feSpecNative[$i][FE_MODE] == FE_MODE_SHOW || $this->feSpecNative[$i][FE_MODE] == FE_MODE_REQUIRED)
) {
// Check if there is an explicit definition.
if (isset($this->feSpecNative[$i][FE_AUTOFOCUS])) {
......@@ -1144,7 +1143,7 @@ abstract class AbstractBuildForm {
// }
}
if ($formElement[FE_MODE] == FE_MODE_REQUIRED || $formElement[FE_MODE] == FE_MODE_SHOW_REQUIRED) {
if ($formElement[FE_MODE] == FE_MODE_REQUIRED) {
$addClassRequired = HelperFormElement::getRequiredPositionClass($formElement[F_FE_REQUIRED_POSITION]);
}
......@@ -1250,7 +1249,6 @@ abstract class AbstractBuildForm {
switch ($feMode) {
case FE_MODE_SHOW:
case FE_MODE_SHOW_REQUIRED:
break;
case FE_MODE_REQUIRED:
$required = 'yes';
......@@ -1679,7 +1677,6 @@ abstract class AbstractBuildForm {
switch ($feMode) {
case FE_MODE_HIDDEN:
case FE_MODE_SHOW:
case FE_MODE_SHOW_REQUIRED:
break;
case FE_MODE_REQUIRED:
case FE_MODE_READONLY:
......
......@@ -594,8 +594,9 @@ class BuildFormBootstrap extends AbstractBuildForm {
$attribute['class'] = 'form-horizontal';
$attribute['data-toggle'] = 'validator';
if ($this->store::getVar(F_MODE_GLOBAL, STORE_SIP) == F_MODE_REQUIRED_SHOW_ONLY) {
$attribute['data-required-show-only'] = 'true';
$flag = $this->store::getVar(F_MODE_GLOBAL, STORE_SIP);
if ($flag == F_MODE_SKIP_REQUIRED_CHECK || $flag == F_MODE_REQUIRED_OFF) {
$attribute[DATA_SKIP_REQUIRED_CHECK] = 'true';
}
if (isset($this->formSpec[F_SAVE_BUTTON_ACTIVE]) && $this->formSpec[F_SAVE_BUTTON_ACTIVE] != '0') {
$attribute[DATA_ENABLE_SAVE_BUTTON] = 'true';
......@@ -798,7 +799,7 @@ EOF;
}
}
if ($formElement[FE_MODE] == FE_MODE_REQUIRED || $formElement[FE_MODE] == FE_MODE_SHOW_REQUIRED) {
if ($formElement[FE_MODE] == FE_MODE_REQUIRED) {
$addClassRequired = HelperFormElement::getRequiredPositionClass($formElement[F_FE_REQUIRED_POSITION]);
}
......
......@@ -836,6 +836,8 @@ const API_ANSWER_REDIRECT_URL_SKIP_HISTORY = 'url-skip-history';
const API_TYPEAHEAD_KEY = 'key';
const API_TYPEAHEAD_VALUE = 'value';
const DATA_SKIP_REQUIRED_CHECK = 'data-skip-required-check';
const DATA_HIDDEN = 'data-hidden';
const DATA_DISABLED = 'data-disabled';
const DATA_REQUIRED = 'data-required';
......@@ -1008,8 +1010,8 @@ const F_TYPEAHEAD_LDAP_SEARCH_PER_TOKEN = 'typeAheadLdapSearchPerToken';
const F_MODE = 'mode';
const F_MODE_READONLY = 'readonly';
const F_MODE_REQUIRED_OFF = 'requiredOff';
const F_MODE_REQUIRED_SHOW_ONLY = 'requiredShowOnly';
const F_MODE_REQUIRED_OFF = 'requiredOff'; // deprecated, #9617
const F_MODE_SKIP_REQUIRED_CHECK = 'skipRequiredCheck';
const F_MODE_GLOBAL = 'formModeGlobal';
const F_SAVE_BUTTON_ACTIVE = 'saveButtonActive';
......@@ -1061,7 +1063,6 @@ const CLIENT_REST_FORM = '_form';
const FE_MODE_SHOW = 'show';
const FE_MODE_READONLY = 'readonly';
const FE_MODE_REQUIRED = 'required';
const FE_MODE_SHOW_REQUIRED = 'showRequired';
const FE_MODE_HIDDEN = 'hidden';
const FE_CLASS_NATIVE = 'native';
......
......@@ -408,7 +408,7 @@ EOF;
EOF;
}
$skip = (!($formElement[FE_MODE] == FE_MODE_SHOW || $formElement[FE_MODE] == FE_MODE_REQUIRED || $formElement[FE_MODE] == FE_MODE_SHOW_REQUIRED));
$skip = (!($formElement[FE_MODE] == FE_MODE_SHOW || $formElement[FE_MODE] == FE_MODE_REQUIRED));
// LOCK
if (!$skip && HelperFormElement::booleParameter($formElement[FE_INPUT_EXTRA_BUTTON_LOCK] ?? '-')) {
......
......@@ -1171,8 +1171,6 @@ class Support {
case FE_MODE_REQUIRED:
if ($formMode == F_MODE_READONLY) {
$feMode = FE_MODE_READONLY;
} elseif ($formMode == F_MODE_REQUIRED_OFF && $feMode == FE_MODE_REQUIRED) {
$feMode = FE_MODE_SHOW_REQUIRED;
}
break;
......
......@@ -545,7 +545,7 @@ class Save {
public function checkRequiredHidden() {
$formModeGlobal = $this->store->getVar(F_MODE_GLOBAL, STORE_SIP);
$reportRequiredFailed = ($formModeGlobal != F_MODE_REQUIRED_OFF && $formModeGlobal != F_MODE_REQUIRED_SHOW_ONLY);
$reportRequiredFailed = ($formModeGlobal != F_MODE_REQUIRED_OFF && $formModeGlobal != F_MODE_SKIP_REQUIRED_CHECK);
$clientValues = $this->store::getStore(STORE_FORM);
......
......@@ -184,7 +184,7 @@ class FillStoreForm {
if ($formMode == FORM_UPDATE && $formModeGlobal == '') {
# During 'update': fake all elements to be not 'required'.
$formModeGlobal = F_MODE_REQUIRED_OFF;
$formModeGlobal = F_MODE_SKIP_REQUIRED_CHECK;
}
// If called through 'api/...': get STORE_TYPO3 via SIP parameter.
......@@ -289,7 +289,6 @@ class FillStoreForm {
if ($formElement[FE_DYNAMIC_UPDATE] === 'yes' ||
$formElement[FE_MODE] === FE_MODE_REQUIRED ||
$formElement[FE_MODE] === FE_MODE_SHOW_REQUIRED ||
$formElement[FE_MODE] === FE_MODE_SHOW ||
(isset($formElement[FE_PROCESS_READ_ONLY]) && $formElement[FE_PROCESS_READ_ONLY] != '0')) {
......
Markdown is supported
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