Commit 02fd569a authored by Rafael Ostertag's avatar Rafael Ostertag
Browse files

Merge remote-tracking branch 'origin/crose_work' into raos_work

parents 35cd16f6 b49a8d21
......@@ -218,7 +218,7 @@ config.qfq.ini
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| FORM_BS_NOTE_COLUMNS | FORM_BS_NOTE_COLUMNS = 3 | Default number of BS columns for the 'note'-column |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| FORM_BUTTON_ON_CHANGE_CLASS | FORM_BUTTON_ON_CHANGE_CLASS=alert-info btn-info | Color for save button after modification |
| FORM_BUTTON_ON_CHANGE_CLASS | FORM_BUTTON_ON_CHANGE_CLASS=alert-info btn-info | Color for save button after modification |
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
| BASE_URL_PRINT | BASE_URL_PRINT=http://example.com | URL where wkhtmltopdf will fetch the HTML (no parameter, those comes later)|
+-----------------------------+-------------------------------------------------+----------------------------------------------------------------------------+
......@@ -874,7 +874,7 @@ The *FormElement.parameter*=*typeAheadLdap* will trigger LDAP searches on every
* *typeAheadLdapSearch* = `(|(cn=*?*)(mail=*?*))`
* *typeAheadLdapValuePrintf* = `'%s / %s', cn, email`
* *typeAheadLdapIdPrintf* = `'%s', email`
* Optional: *ldapUseBindCredentials*=1
* Optional: *ldapUseBindCredentials* = 1
All fetched LDAP values will be formatted with:
* *typeAheadLdapValuePrintf*, shown to the user in a drop-down box and
......@@ -920,7 +920,7 @@ Important: LDAP access might slow down the *Form* processing on load, update or
* *typeAheadLdapSearch* = `(|(cn=*?*)(mail=*?*))`
* *ldapAttributes* = `givenName, sn, telephoneNumber, email`
* *ldapSearch* = `(mail={{email::l}})`
* Optional: *ldapUseBindCredentials*=1
* Optional: *ldapUseBindCredentials* = 1
After filling the store, access the content via `{{<attributename>:allbut:L:s}}`.
......@@ -1070,8 +1070,12 @@ parameter
+--------------------------+--------+----------------------------------------------------------------------------------------------------------+
| typeAheadMinLength | int | Minimum number of characters which have to typed to start the search. |
+--------------------------+--------+----------------------------------------------------------------------------------------------------------+
| fillStoreLdap | - | Activate `Fill STORE LDAP` with the first retrieved record |
| mode | string | The value `readonly` will activate a global readonly mode of the form - the user can't change any data. |
| | | See :ref:`form-mode-readonly` |
+--------------------------+--------+----------------------------------------------------------------------------------------------------------+
| saveButtonActive | - | Make the 'save'-button active on *Form* load (instead of waiting for the first user change) |
+--------------------------+--------+----------------------------------------------------------------------------------------------------------+
* Example:
......@@ -1157,6 +1161,30 @@ E.g. if there are multiple different forms to work on the same table, all of the
The 'extraDeleteForm' parameter might be specified for a 'form' and/or for 'subrecords'
.. _form-mode-readonly:
Global Form mode 'readonly'
'''''''''''''''''''''''''''
The form.parameter setting `mode=readonly` will switch the whole form into a `readonly` mode, which 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.
The mode can be statically defined in the *Form.parameter* field via::
mode=readonly
Or dynamically, e.g. via::
mode={{formModeGlobal:S:alnumx}}
Such variant might be called via SIP. The following shows the same *Form* in the `regular` mode and second in `readonly` mode::
10.sql = SELECT CONCAT('from&form=person&r=', p.id) as _Pagee, CONCAT('from&form=person&formModeGlobal=readonly&r=', p.id) as _Pagee FROM Person AS p
FormElements
------------
......@@ -3304,7 +3332,7 @@ The colum name is composed of the string *page* and a trailing character to spec
+---------------+-----------------------------------------------+-------------------------------------+----------------------------------------------+
|_pagen |Internal link with new icon (sheet) |empty |p:<pageId>[&param] |
+---------------+-----------------------------------------------+-------------------------------------+----------------------------------------------+
|_pages |Internal link with how icon (magnifier) |empty |p:<pageId>[&param] |
|_pages |Internal link with show icon (magnifier) |empty |p:<pageId>[&param] |
+---------------+-----------------------------------------------+-------------------------------------+----------------------------------------------+
......
......@@ -28,7 +28,7 @@ Changes
* #3431, Parameter keyword 'typeAheadLdapKeyPrintf' changed to 'typeAheadLdapIdPrintf'.::
UPDATE FormElement SET parameter = REPLACE(parameter, 'typeAheadLdapKeyPrintf', 'typeAheadLdapIdPrintf')
UPDATE FormElement SET parameter = REPLACE(parameter, 'typeAheadLdapKeyPrintf', 'typeAheadLdapIdPrintf')
Features
^^^^^^^^
......@@ -37,8 +37,8 @@ Features
will direct to that page. Fix #3420 / Quicklink 'editform' on form: directs to the current T3 page which might be insufficient.
* Form 'subrecord' columns: the default width limit of 20 chars are disabled if 'nostrip' is specifed.
* #3431 / typeAheadSql: columnname 'key' is a reserverd SQL statement - replace by 'id'. Additional the parametername
'typeAheadLdapKeyPrintf' renamed to 'typeAheadLdapIdPrintf'. By using 'id' instead of 'key' the quoting of the columnname
is not necessary anoymore.
'typeAheadLdapKeyPrintf' renamed to 'typeAheadLdapIdPrintf'. By using 'id' instead of 'key' the quoting of the columnname
is not necessary anoymore.
......
......@@ -356,7 +356,6 @@ abstract class AbstractBuildForm {
$modeCollectFe = FLAG_DYNAMIC_UPDATE, $htmlElementNameIdZero = false,
$storeUseDefault = STORE_USE_DEFAULT, $mode = FORM_LOAD) {
$html = '';
$flagOutput = false;
// The following 'FormElement.parameter' will never be used during load (fe.type='upload'). FE_PARAMETER has been already expanded.
$skip = [FE_SQL_UPDATE, FE_SQL_INSERT, FE_SQL_DELETE, FE_SQL_AFTER, FE_SQL_BEFORE, FE_PARAMETER];
......@@ -386,6 +385,12 @@ abstract class AbstractBuildForm {
$debugStack = array();
// Copy global readonly mode.
if ($this->formSpec[F_MODE] == F_MODE_READONLY) {
$fe[FE_MODE] = FE_MODE_READONLY;
$fe[FE_MODE_SQL] = '';
}
// Preparation for Log, Debug
$this->store->setVar(SYSTEM_FORM_ELEMENT, Logger::formatFormElementName($fe), STORE_SYSTEM);
......
......@@ -164,7 +164,7 @@ class BuildFormBootstrap extends AbstractBuildForm {
}
// Button: Save
if (Support::findInSet(FORM_BUTTON_SAVE, $this->formSpec['showButton']) && $this->formSpec[F_SUBMIT_BUTTON_TEXT] === '') {
if (Support::findInSet(FORM_BUTTON_SAVE, $this->formSpec[F_SHOW_BUTTON]) && $this->formSpec[F_SUBMIT_BUTTON_TEXT] === '') {
$toolTip = 'Save';
if ($this->showDebugInfo) {
......@@ -175,14 +175,14 @@ class BuildFormBootstrap extends AbstractBuildForm {
}
// Button: Close
if (Support::findInSet(FORM_BUTTON_CLOSE, $this->formSpec['showButton'])) {
if (Support::findInSet(FORM_BUTTON_CLOSE, $this->formSpec[F_SHOW_BUTTON])) {
$toolTip = 'Close';
$buttonClose = $this->buildButtonCode('close-button', 'Close', GLYPH_ICON_CLOSE);
}
// Button: Delete
if (Support::findInSet(FORM_BUTTON_DELETE, $this->formSpec['showButton'])) {
if (Support::findInSet(FORM_BUTTON_DELETE, $this->formSpec[F_SHOW_BUTTON])) {
$toolTip = 'Delete';
if ($this->showDebugInfo && $recordId > 0) {
......@@ -194,7 +194,7 @@ class BuildFormBootstrap extends AbstractBuildForm {
}
// Button: New
if (Support::findInSet(FORM_BUTTON_NEW, $this->formSpec['showButton'])) {
if (Support::findInSet(FORM_BUTTON_NEW, $this->formSpec[F_SHOW_BUTTON])) {
$toolTip = 'New';
$url = $this->deriveNewRecordUrlFromExistingSip($toolTip);
......@@ -330,7 +330,9 @@ class BuildFormBootstrap extends AbstractBuildForm {
$attribute['class'] = 'form-horizontal';
$attribute['data-toggle'] = 'validator';
if (isset($this->formSpec[F_SAVE_BUTTON_ACTIVE])) {
$attribute[DATA_ENABLE_SAVE_BUTTON] = 'true';
}
return '<form ' . OnArray::toString($attribute, '=', ' ', "'") . '>';
}
......
......@@ -494,6 +494,8 @@ const DATA_TYPEAHEAD_SIP = 'data-typeahead-sip'; // Used for typeAhead
const CLASS_NOTE = 'qfq-note';
const DATA_ENABLE_SAVE_BUTTON = 'data-enable-save-button';
//const CLASS_TYPEAHEAD = 'qfq-type-ahead';
//const DATA_TYPEAHEAD_SIP = 'data-sip'; // Used for typeAhead
......@@ -559,6 +561,8 @@ const F_CLASS = 'class';
const F_CLASS_PILL = 'classPill';
const F_CLASS_BODY = 'classBody';
const F_SHOW_BUTTON = 'showButton';
const F_FE_DATA_PATTERN_ERROR = 'data-pattern-error';
const F_FE_DATA_REQUIRED_ERROR = 'data-required-error';
const F_FE_DATA_MATCH_ERROR = 'data-match-error';
......@@ -578,6 +582,11 @@ const F_TYPEAHEAD_LDAP_VALUE_PRINTF = 'typeAheadLdapValuePrintf';
const F_TYPEAHEAD_LDAP_ID_PRINTF = 'typeAheadLdapIdPrintf';
const F_TYPEAHEAD_LDAP_SEARCH = 'typeAheadLdapSearch';
const F_MODE = 'mode';
const F_MODE_READONLY = 'readonly';
const F_SAVE_BUTTON_ACTIVE = 'saveButtonActive';
// FORM_ELEMENT_STATI
const FE_MODE_SHOW = 'show';
const FE_MODE_READONLY = 'readonly';
......
......@@ -573,16 +573,22 @@ class QuickFormQuery {
/**
* Set form parameter which are expected to exist.
*
* @param array $config
* @param array $formSpec
* @return array
*/
private function initForm(array $config) {
Support::setIfNotSet($config, F_EXTRA_DELETE_FORM, '');
Support::setIfNotSet($config, F_SUBMIT_BUTTON_TEXT, '');
Support::setIfNotSet($config, F_BUTTON_ON_CHANGE_CLASS, '');
Support::setIfNotSet($config, F_LDAP_USE_BIND_CREDENTIALS, '');
private function initForm(array $formSpec) {
Support::setIfNotSet($formSpec, F_EXTRA_DELETE_FORM, '');
Support::setIfNotSet($formSpec, F_SUBMIT_BUTTON_TEXT, '');
Support::setIfNotSet($formSpec, F_BUTTON_ON_CHANGE_CLASS, '');
Support::setIfNotSet($formSpec, F_LDAP_USE_BIND_CREDENTIALS, '');
Support::setIfNotSet($formSpec, F_MODE, '');
if ($formSpec[F_MODE] == F_MODE_READONLY) {
$formSpec[F_SHOW_BUTTON] = FORM_BUTTON_CLOSE;
$formSpec[F_SUBMIT_BUTTON_TEXT] = '';
}
return $config;
return $formSpec;
}
/**
......
......@@ -172,7 +172,7 @@ class FormAction {
}
/**
* Process all FormElements given in the `requiredList` identified be their name.
* Process all FormElements given in the `requiredList` identified by their name.
* If none is empty in STORE_FORM return true, else false.
* If none FormElement is specified, return true.
*
......@@ -189,7 +189,7 @@ class FormAction {
foreach ($arr as $key) {
$key = trim($key);
$val = $this->store->getVar($key, STORE_FORM);
$val = $this->store->getVar($key, STORE_FORM, SANITIZE_ALLOW_ALL);
if ($val === false || $val === '' || $val === '0') {
return false;
......
......@@ -89,6 +89,7 @@ CREATE TABLE IF NOT EXISTS `FormElement` (
`bsNoteColumns` VARCHAR(255) NOT NULL DEFAULT '',
`rowLabelInputNote` SET('row', 'label', '/label', 'input', '/input', 'note', '/note', '/row') NOT NULL DEFAULT 'row,label,/label,input,/input,note,/note,/row',
`note` TEXT NOT NULL,
`adminNote` TEXT NOT NULL,
`tooltip` VARCHAR(255) NOT NULL DEFAULT '',
`placeholder` VARCHAR(512) NOT NULL DEFAULT '',
......@@ -180,7 +181,7 @@ VALUES
'', '', '', 4, '', '', ''),
(1, '', 'FormElements', 'show', 'subrecord', 'all', 'native', 500, 0, 0, '', '', '',
'{{!SELECT IF( fe.enabled="yes", IF( fe.enabled="yes" AND fe.feIdContainer=0 AND !ISNULL(feCX.id) AND fe.class="native", "danger", IF( fe.class="container", "text-info", IF( fe.class="action", "text-success", ""))), "text-muted") AS _rowClass, IF( fe.enabled="yes", IF(fe.feIdContainer=0 AND !ISNULL(feCX.id) AND fe.class="native", "Please choose a container for this formelement", fe.class), "Disabled") AS _rowTitle, fe.id, CONCAT( IFNULL( CONCAT( feC.name, " (", fe.feIdContainer, ")"),"")) AS Container, fe.name, fe.label, fe.mode, fe.class, fe.type, fe.ord, IF(fe.dynamicUpdate="yes", \'<span class="glyphicon glyphicon-random"></span>\',"") AS "dyn|||nostrip", fe.parameter FROM FormElement AS fe LEFT JOIN FormElement AS feC ON feC.id=fe.feIdContainer AND feC.formId=fe.formId LEFT JOIN FormElement AS feCX ON feCX.class="container" AND feCX.enabled="yes" AND feCX.formId=fe.formId WHERE fe.formId={{id:R0}} GROUP BY fe.id ORDER BY fe.class DESC, feC.ord, fe.ord, fe.id}}',
'{{!SELECT IF( fe.enabled="yes", IF( fe.enabled="yes" AND fe.feIdContainer=0 AND !ISNULL(feCX.id) AND fe.class="native", "danger", IF( fe.class="container", "text-info", IF( fe.class="action", "text-success", ""))), "text-muted") AS _rowClass, IF( fe.enabled="yes", IF(fe.feIdContainer=0 AND !ISNULL(feCX.id) AND fe.class="native", "Please choose a container for this formelement", fe.class), "Disabled") AS _rowTitle, fe.id, CONCAT( IFNULL( CONCAT( feC.name, " (", fe.feIdContainer, ")"),"")) AS Container, fe.name AS "Name|50", fe.label, fe.mode, fe.class, fe.type, fe.ord, IF(fe.dynamicUpdate="yes", \'<span class="glyphicon glyphicon-random"></span>\',"") AS "dyn|||nostrip", fe.parameter FROM FormElement AS fe LEFT JOIN FormElement AS feC ON feC.id=fe.feIdContainer AND feC.formId=fe.formId LEFT JOIN FormElement AS feCX ON feCX.class="container" AND feCX.enabled="yes" AND feCX.formId=fe.formId WHERE fe.formId={{id:R0}} GROUP BY fe.id ORDER BY fe.class DESC, feC.ord, fe.ord, fe.id}}',
'form=formElement\ndetail=id:formId', 5, 'new,edit,delete', '', '');
......@@ -249,12 +250,14 @@ VALUES
(2, 'parameter', 'Parameter', 'show', 'text', 'all', 'native', 520, '40,8', 0, '',
'', '', '', '', 103, '', 'no', '', '', '', '', ''),
(2, 'clientJs', 'ClientJS', 'show', 'text', 'all', 'native', 530, 0, 0, '', '', '', '', '', 103, '', 'no', '', '', '', '', ''),
(2, 'feGroup', 'feGroup', 'show', 'text', 'all', 'native', 600, 0, 0, '', '', '', '', '', 104, '', 'no', '', '', '', '', ''),
(2, 'deleted', 'Deleted', 'show', 'checkbox', 'all', 'native', 610, 0, 0, '', '', '', '', '', 104, '', 'no', '', '',
(2, 'adminNote', 'Admin Note', 'show', 'text', 'all', 'native', 600, 0, 0, '', '', '', '', '', 104, '', 'no', '', '', '', '', ''),
(2, 'feGroup', 'feGroup', 'show', 'text', 'all', 'native', 610, 0, 0, '', '', '', '', '', 104, '', 'no', '', '', '',
'', ''),
(2, 'deleted', 'Deleted', 'show', 'checkbox', 'all', 'native', 620, 0, 0, '', '', '', '', '', 104, '', 'no', '', '',
'', '', ''),
(2, 'modified', 'Modified', 'readonly', 'text', 'all', 'native', 620, 0, 20, '', '', '', '', '', 104, '', 'no',
(2, 'modified', 'Modified', 'readonly', 'text', 'all', 'native', 630, 0, 20, '', '', '', '', '', 104, '', 'no',
'', '', '', '', ''),
(2, 'created', 'Created', 'readonly', 'text', 'all', 'native', 630, 0, 20, '', '', '', '', '', 104, '', 'no', '',
(2, 'created', 'Created', 'readonly', 'text', 'all', 'native', 640, 0, 20, '', '', '', '', '', 104, '', 'no', '',
'', '', '', '');
......
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