Commit 41a2bb3a authored by Carsten  Rose's avatar Carsten Rose
Browse files

#3812 / extraButtonInfo (extraButtonLock, extraButtonPassword) - Problems in TemplateGroups.

Database.php, QuickFormQuery.php: Initializing of native FormElements: _tgIndex
HelperFormElement.php: new function formElementSetDefault(). Add '%d' to id's of extraButtonInfo text elements.
Manual.rst: minor typos fixed
parent 6a4f485c
......@@ -1982,28 +1982,28 @@ Note: If there are multiple pills defined on a form, only the first pill will be
extraButtonLock
;;;;;;;;;;;;;;;
* User has to click on the lock, before it's possible to change the value. This will protect data against unwanted modifcation.
* The user has to click on the lock, before it's possible to change the value. This will protect data against unwanted modifcation.
* After Form load, the value is shown, but not editable.
* Shows a 'lock' on the rigth side of an input element of type `text`, `date`, `time` or `datetime`.
* This option is not available for FormElement.mode=readonly.
* There is no value needed for this parameter
* Shows a 'lock' on the right side of an input element of type `text`, `date`, `time` or `datetime`.
* This option is not available for FormElements with `mode=readonly`.
* There is no value needed for this parameter.
.. _`extraButtonPassword`:
extraButtonPassword
;;;;;;;;;;;;;;;;;;;
* User has to click on the eye (unhide) to see the value.
* The user has to click on the eye (unhide) to see the value.
* After Form load, the data is hided by asteriks.
* Shows an 'eye' on the right side of an input element of type `text`, `date`, `time` or `datetime`.
* There is no value needed for this parameter
* There is no value needed for this parameter.
.. _`extraButtonInfo`:
extraButtonInfo
;;;;;;;;;;;;;;;
* User has to click on the `info` button/icon to see an additional message.
* The user has to click on the `info` button/icon to see an additional message.
* After Form load, the information message is hided.
* The value of this parameter is the text shown.
* Shows an `info` button/icon, depending of the type:
......
......@@ -362,7 +362,7 @@ abstract class AbstractBuildForm {
abstract public function getProcessFilter();
/**
* Process all FormElements: Collect and return all HTML code & JSON.
* Process all FormElements in $this->feSpecNative: Collect and return all HTML code & JSON.
*
* @param $recordId
* @param string $filter FORM_ELEMENTS_NATIVE | FORM_ELEMENTS_SUBRECORD | FORM_ELEMENTS_NATIVE_SUBRECORD
......@@ -479,7 +479,9 @@ abstract class AbstractBuildForm {
// Typically: $htmlElementNameIdZero = true
// After Saving a record, staying on the form, the FormElements on the Client are still known as '<feName>:0'.
$htmlFormElementName = HelperFormElement::buildFormElementName($formElement, ($htmlElementNameIdZero) ? 0 : $recordId);
$formElement[FE_HTML_ID] = HelperFormElement::buildFormElementId($this->formSpec[F_ID], $formElement[FE_ID], ($htmlElementNameIdZero) ? 0 : $recordId, 0);
$formElement[FE_HTML_ID] = HelperFormElement::buildFormElementId($this->formSpec[F_ID], $formElement[FE_ID],
($htmlElementNameIdZero) ? 0 : $recordId,
$formElement[FE_TG_INDEX]);
// Construct Marshaller Name: buildElement
$buildElementFunctionName = 'build' . $this->buildElementFunctionName[$formElement[FE_TYPE]];
......@@ -3167,6 +3169,7 @@ EOT;
$fe[FE_NAME] = str_replace(FE_TEMPLATE_GROUP_NAME_PATTERN, $ii, $fe[FE_NAME]);
$fe[FE_LABEL] = str_replace(FE_TEMPLATE_GROUP_NAME_PATTERN, $ii, $fe[FE_LABEL]);
$fe[FE_NOTE] = str_replace(FE_TEMPLATE_GROUP_NAME_PATTERN, $ii, $fe[FE_NOTE]);
$fe[FE_TG_INDEX] = $ii;
$columnName = $fe[FE_NAME];
// Column of primary table?
......
......@@ -51,7 +51,8 @@ const SQL_FORM_ELEMENT_CONTAINER_TEMPLATE_GROUP = "SELECT fe.id, fe.name, fe.lab
const SQL_FORM_ELEMENT_TEMPLATE_GROUP_FE_ID = "SELECT * FROM FormElement AS fe WHERE fe.id = ? AND fe.deleted = 'no' AND fe.class = 'container' AND fe.type='templateGroup' AND fe.enabled='yes' ";
const SQL_FORM_ELEMENT_NATIVE_TG_COUNT = "SELECT fe.*, IFNULL(feTg.maxLength,0) AS _tgCopies FROM FormElement AS fe LEFT JOIN FormElement AS feTg ON fe.feIdContainer=feTg.id AND feTg.deleted = 'no' AND feTg.class = 'container' AND feTg.type='templateGroup' AND feTg.enabled='yes' WHERE fe.formId = ? AND fe.deleted = 'no' AND fe.class = 'native' AND fe.enabled='yes'";
const NAME_TG_COPIES = '_tgCopies';
const NAME_TG_COPIES = '_tgCopies'; // Number of templatesGroup copies to create on the fly.
const FE_TG_INDEX = '_tgIndex'; // Index of the current copy of a templateGroup FE.
// SANITIZE Classifier
const SANITIZE_ALLOW_ALNUMX = "alnumx";
......
......@@ -461,6 +461,8 @@ class QuickFormQuery {
$feSpecNative = $this->db->sql($sql, ROW_REGULAR, $param);
$feSpecNative = HelperFormElement::formElementSetDefault($feSpecNative);
// Explode and Do $FormElement.parameter
HelperFormElement::explodeParameterInArrayElements($feSpecNative, FE_PARAMETER);
......
......@@ -668,12 +668,14 @@ class Database {
* @param array $formSpec Main FormSpec to copy generic parameter to FormElements
* @return array|int
* @throws \qfq\CodeException
* @throws \qfq\DbException
* @throws \qfq\DbException$this->feSpecNative
*/
public function getNativeFormElements($sql, array $param, $formSpec) {
$feSpecNative = $this->sql($sql, ROW_REGULAR, $param);
$feSpecNative = HelperFormElement::formElementSetDefault($feSpecNative);
// Explode and Do $FormElement.parameter
HelperFormElement::explodeParameterInArrayElements($feSpecNative, FE_PARAMETER);
......
......@@ -34,6 +34,19 @@ class HelperFormElement {
}
}
/**
* @param array $elements
* @return array
*/
public static function formElementSetDefault(array $elements) {
foreach ($elements AS $key => $element) {
$elements[$key][FE_TG_INDEX] = 0;
}
return $elements;
}
/**
* Take all rows from field $element[$keyName] and merge them with $element itself. '$element' grows in size.
*
......@@ -219,11 +232,17 @@ class HelperFormElement {
public static function prepareExtraButton(array $formElement, $showInline) {
$store = Store::getInstance();
$infoSymbolInside = $store->getVar(SYSTEM_GFX_EXTRA_BUTTON_INFO_INLINE, STORE_SYSTEM);
$infoSymbolOutside = $store->getVar(SYSTEM_GFX_EXTRA_BUTTON_INFO_BELOW, STORE_SYSTEM);
$extraButton = '';
$id = $formElement[FE_HTML_ID];
if (false !== strpos($formElement[FE_NAME], FE_TEMPLATE_GROUP_NAME_PATTERN)) {
$id .= '-' . FE_TEMPLATE_GROUP_NAME_PATTERN;
}
$formElement[FE_TMP_EXTRA_BUTTON_HTML] = '';
// INFO: $showinline =- TRUE ('input' elemente)
......
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