Commit 0e75d2bd authored by Carsten  Rose's avatar Carsten Rose
Browse files

#3569 / Input Optional '0' unterdruecken

Manual.rst: add 'hideZero' to doc.
AbstractBuildForm.php, Support.php: implement to suppress '0' if showZero=1
parent 0669683b
......@@ -155,7 +155,6 @@ Setup
}
page.includeCSS {
file1 = typo3conf/ext/qfq/Resources/Public/Css/bootstrap.min.css
file2 = typo3conf/ext/qfq/Resources/Public/Css/bootstrap-theme.min.css
file3 = typo3conf/ext/qfq/Resources/Public/Css/jqx.base.css
......@@ -164,7 +163,6 @@ Setup
}
page.includeJS {
file1 = typo3conf/ext/qfq/Resources/Public/JavaScript/jquery.min.js
file2 = typo3conf/ext/qfq/Resources/Public/JavaScript/bootstrap.min.js
file3 = typo3conf/ext/qfq/Resources/Public/JavaScript/validator.min.js
......@@ -190,7 +188,7 @@ Setup a *report* to manage all *forms*:
::
# If there is a form given by SIP: show
form={{form:S}}
form={{form:SE}}
10 {
# List of Forms: Do not show this list of forms if there is a form given by SIP.
......@@ -223,14 +221,12 @@ config.qfq.ini
+=============================+=================================================+============================================================================+
| DB_USER | DB_USER=qfqUser | Credentials configured in MySQL |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| DB_PASSWORD | DB_PASSWORD=12345678 | Credentials configured in MySQL |
| DB_PASSWORD | DB_PASSWORD=1234567890 | Credentials configured in MySQL |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| DB_SERVER | DB_SERVER=localhost | Hostname of MySQL Server |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| DB_NAME | DB_NAME=qfq_db | Database name |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| DB_NAME_TEST | DB_NAME_TEST=qfq_db_test | Used during development of QFQ |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| DB_INIT | DB_INIT=set names utf8 | Global init for using the database. |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| SQL_LOG | SQL_LOG=sql.log | Filename to log SQL commands: relative to <ext_dir> or absolute. |
......@@ -302,23 +298,35 @@ config.qfq.ini
|GFX_EXTRA_BUTTON_INFO_BELOW | <img src="info.png"> | Image for `extraButtonInfo`_ (below) |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| SAVE_BUTTON_TEXT | SAVE_BUTTON_TEXT = | Default text on the form save button. Typically none. |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| SAVE_BUTTON_TOOLTIP | SAVE_BUTTON_TOOLTIP = save | Default tooltip on the form save button. |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| SAVE_BUTTON_CLASS | SAVE_BUTTON_CLASS = btn btn-default navbar-btn | Default Bootstrap CSS class for buttons on top of the form |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| SAVE_BUTTON_GLYPH_ICON | SAVE_BUTTON_GLYPH_ICON = glyphicon-ok | Default Icon for the form save button |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| CLOSE_BUTTON_TEXT | CLOSE_BUTTON_TEXT = | Default text on the form close button. Typically none. |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| CLOSE_BUTTON_TOOLTIP | CLOSE_BUTTON_TOOLTIP = close | Default tooltip on the form close button. |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| CLOSE_BUTTON_CLASS | CLOSE_BUTTON_CLASS = btn btn-default navbar-btn | Default Bootstrap CSS class for buttons on top of the form |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| CLOSE_BUTTON_GLYPH_ICON | CLOSE_BUTTON_GLYPH_ICON = glyphicon-remove | Default Icon for the form close button |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| DELETE_BUTTON_TEXT | DELETE_BUTTON_TEXT = | Default text on the form delete button. Typically none. |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| DELETE_BUTTON_TOOLTIP | DELETE_BUTTON_TOOLTIP = delete | Default tooltip on the form delete button. |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| DELETE_BUTTON_CLASS | DELETE_BUTTON_CLASS = btn btn-default navbar-btn| Default Bootstrap CSS class for buttons on top of the form |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| DELETE_BUTTON_GLYPH_ICON | DELETE_BUTTON_GLYPH_ICON = glyphicon-trash | Default Icon for the form delete button |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| NEW_BUTTON_TEXT | NEW_BUTTON_TEXT = | Default text on the form new button. Typically none. |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| NEW_BUTTON_TOOLTIP | NEW_BUTTON_TOOLTIP = new | Default tooltip on the form new button. |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| NEW_BUTTON_CLASS | NEW_BUTTON_CLASS = btn btn-default navbar-btn | Default Bootstrap CSS class for buttons on top of the form |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| NEW_BUTTON_GLYPH_ICON | NEW_BUTTON_GLYPH_ICON = glyphicon-plus | Default Icon for the form new button |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
......@@ -343,20 +351,27 @@ Example: *typo3conf/config.qfq.ini*
CSS_CLASS_QFQ_FORM_PILL = qfq-color-grey-1
CSS_CLASS_QFQ_FORM_BODY = qfq-color-grey-2
; DATE_FORMAT= yyyy-mm-dd
; TECHNICAL CONTACT = john@doe.com
; FORM_DATA_PATTERN_ERROR =
; FORM_DATA_REQUIRED_ERROR =
; FORM_DATA_MATCH_ERROR =
; FORM_DATA_ERROR =
; FORM_BS_COLUMNS = 12
; FORM_BS_LABEL_COLUMNS = 3
; FORM_BS_INPUT_COLUMNS = 6
; FORM_BS_NOTE_COLUMNS = 3
BASE_URL_PRINT=http://example.com/
WKHTMLTOPDF=/usr/bin/wkhtmltopdf
; EDIT_FORM_PAGE = form
; LDAP_1_RDN='ou=Admin,dc=example,dc=com'
; LDAP_1_PASSWORD=mySecurePassword
; ESCAPE_TYPE_DEFAULT=s
; SECURITY_VARS_HONEYPOT=email,username,password
; SECURITY_ATTACK_DELAY=5
......@@ -2191,12 +2206,12 @@ Type: text
* *FormElement.parameter*:
* *retype* = 1 (optional): Current input element will be rendered twice. The form can only submitted if both elements are equal.
* *retypeLabel* =<text> (optional): The label of the second element.
* *retypeNote* =<text> (optional): The note of the second element.
* *retypeLabel* = <text> (optional): The label of the second element.
* *retypeNote* = <text> (optional): The note of the second element.
* *characterCountWrap* = <text1>|<text2> (optional). Displays a character counter below the input/textarea element. If
`text1` / `text2` is missing, just display `<current>/</max>`. Customization: `characterCountWrap=<div class=qfq-cc-style>Count: |</div>`
* Also check the :ref:`fe-parameter-attributes` *data-...-error* to customize error messages shown by the validator.
* *hideZero* = 0|1 (optional): `with hideZero=1` a '0' in the value will be replaced by an empty string.
Type Ahead
''''''''''
......
......@@ -915,6 +915,9 @@ abstract class AbstractBuildForm {
$colsRows = explode(',', $formElement[FE_SIZE], 2);
$flagTextarea = (count($colsRows) === 2);
if ($formElement[FE_HIDE_ZERO] != '0' && $value == '0') {
$value = '';
}
// $formElement = HelperFormElement::prepareExtraButton($formElement, !$flagTextarea, $extraButton);
$formElement = HelperFormElement::prepareExtraButton($formElement, !$flagTextarea);
if ($flagTextarea) {
......
......@@ -742,7 +742,8 @@ const FE_PLACEHOLDER = 'placeholder';
// FormElement columns: via parameter field
const FE_DATE_FORMAT = 'dateFormat'; // value: FORMAT_DATE_INTERNATIONAL | FORMAT_DATE_GERMAN
const FE_SHOW_SECONDS = 'showSeconds'; // value: 0|1
const FE_SHOW_ZERO = 'showZero'; // value: 0|1
const FE_SHOW_ZERO = 'showZero'; // 0|1 - Used for 'date/datime/time': in case of fe.value='0' shows corresponding '00-00-0000'|'00:00:00'
const FE_HIDE_ZERO = 'hideZero'; // 0|1 - In case of fe.value=0|'0', an empty string is shown.
const FE_FILE_DESTINATION = 'fileDestination'; // Target pathFilename for an uploaded file.
const FE_FILE_REPLACE_MODE = 'fileReplace'; // Target pathFilename for an uploaded file.
const FE_FILE_REPLACE_MODE_ALWAYS = 'always'; // Target pathFilename for an uploaded file.
......
......@@ -449,15 +449,16 @@ class Support {
* Returns a representation of 0 in a choosen variant.
*
* @param string $dateFormat FORMAT_DATE_INTERNATIONAL | FORMAT_DATE_GERMAN
* @param string $showZero '0' | '1'
* @param string $showZero
* @param string $showTime '0' | '1'
* @param string $showSeconds '0' | '1'
* @return string
*/
private static function dateTimeZero($dateFormat, $showZero, $showTime, $showSeconds) {
if ($showZero == 0)
if ($showZero != '1') {
return '';
}
// $dateFormat (INT/GER), $showTime, $showSeconds
$arr[0][0][0] = '0000-00-00';
......@@ -653,6 +654,7 @@ class Support {
// Some Defaults
self::setIfNotSet($formElement, FE_SHOW_SECONDS, '0');
self::setIfNotSet($formElement, FE_SHOW_ZERO, '0');
self::setIfNotSet($formElement, FE_HIDE_ZERO, '0');
self::setIfNotSet($formElement, FE_DATE_FORMAT, $store->getVar(SYSTEM_DATE_FORMAT, STORE_SYSTEM));
self::setIfNotSet($formElement, FE_HTML_BEFORE);
......
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