Commit 3f282465 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Form: 1) subrecords supports per row '_rowClass' definition. 2) Rollover for subrecords.

UsersManual/Index.rst: See 'Type: subrecord'. Some hints how to use '_rowClass' to mark rows individual.
AbstractBuildForm.php: implement in buildSubrecord() parsing of column '_rowClass'. Active roll-over by assigning class 'table-hover' to the class.
formEditor.sql: disabled form element records now 'text-muted' displayed.
parent 1885d150
...@@ -790,21 +790,26 @@ Type: subrecord ...@@ -790,21 +790,26 @@ Type: subrecord
* Exactly one column 'id' has to exist; it specifies the primary record for the target form. * Exactly one column 'id' has to exist; it specifies the primary record for the target form.
* Columnname: *<title>[|<number>][|width=<number>][|nostrip][|icon][|url][|mailto]* * Columnname: *<title>[|<number>][|width=<number>][|nostrip][|icon][|url][|mailto]*
* *<number>*: any 'digit only' will be treated as '''width'''. * *<number>*: any 'digit only' will be treated as '''width'''.
* *width=<number>*: max. number of chars displayed per cell in the column. * *width=<number>*: max. number of chars displayed per cell in the column.
* *nostrip*: by default, html tags will be stripped off the cell content before rendering. This protects the table layout. 'nostrip' deactivates the cleaning to make links, images, ... possible. * *nostrip*: by default, html tags will be stripped off the cell content before rendering. This protects the table layout. 'nostrip' deactivates the cleaning to make links, images, ... possible.
* *icon*: the cell value contains the name of an icon in *typo3conf/ext/qfq/Resources/Public/icons*. Empty cell values will omit an html image tag (=nothing renderd in the cell). * *icon*: the cell value contains the name of an icon in *typo3conf/ext/qfq/Resources/Public/icons*. Empty cell values will omit an html image tag (=nothing renderd in the cell).
* *mailto*: value will be rendered as a mailto link. * *mailto*: value will be rendered as a mailto link.
* *url*: value will be rendered as a link. * *url*: value will be rendered as a link.
* *title=<text>* or '<none of the above>': column '''title'''. * *title=<text>* or '<none of the above>': column '''title'''.
* The parameters are position independet. * The parameters are position independet.
* Examples:: * Examples::
SELECT note1 AS 'Comment', note2 AS 'Comment\|50' , note3 AS 'title=Comment\|width=100\|nostrip', note4 AS '50\|Comment', SELECT note1 AS 'Comment', note2 AS 'Comment\|50' , note3 AS 'title=Comment\|width=100\|nostrip', note4 AS '50\|Comment',
'checked.png' AS 'Status\|icon', email AS 'mailto', CONCAT(homepage, '\|Homepage') AS 'url' ... 'checked.png' AS 'Status\|icon', email AS 'mailto', CONCAT(homepage, '\|Homepage') AS 'url' ...
* Special column name: *_rowClass*
* Defines CSS class name(s) which will be rendered in the *<tr class="<_rowClass>">*.
* By using Bootstrap, the following predefined classes are available:
* Text color: *text-muted|text-primary|text-success|text-info|text-warning|text-danger* (http://getbootstrap.com/css/#helper-classes)
* Row background: *active|success|info|warning|danger* (http://getbootstrap.com/css/#tables-contextual-classes)
Type: string Type: string
^^^^^^^^^^^^ ^^^^^^^^^^^^
...@@ -1168,18 +1173,19 @@ Processing of columns in the SQL result ...@@ -1168,18 +1173,19 @@ Processing of columns in the SQL result
* The content of all columns of all rows will be printed sequentially, without separator. * The content of all columns of all rows will be printed sequentially, without separator.
* Rows with `Special column names`_ will be processed in a special way. * Rows with `Special column names`_ will be processed in a special way.
* Column names, which start with a '_', will not be printed. This is useful if you only want to access the content of
some columns during later on via the {{<level>.<column>}} variable but don't want to print the content of those columns.
Special column names Special column names
-------------------- --------------------
* Special column names always start with '_'.
* Column names, which start with a '_' and which are not reserved (=special column name), will not be printed. Nevertheless,
access to it via the {{<level>.<column>}} variable (without '_') are possible.
* The input parameters for the processing function are stored as column values. * The input parameters for the processing function are stored as column values.
* Single parameters are delimited by the '|' character. * Single parameters are delimited by the '|' character.
* Parameters are identified by the function either * Parameters are identified by the function either
* by their **order** * by their **order**
* or by a **one character qualifier** followed by the : character, placed in front of the actual parameter value. * or by a **one character qualifier** followed by the ':' character, placed in front of the actual parameter value.
+------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|**Reserved column name**| **Purpose** | |**Reserved column name**| **Purpose** |
...@@ -1345,8 +1351,8 @@ Link Examples ...@@ -1345,8 +1351,8 @@ Link Examples
+-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+ +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
Columns: pageX & PageX Columns: _pageX & _PageX
^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^
These columns provide a shortcut version of the link interface to use for fast creation of internal links. The colum name These columns provide a shortcut version of the link interface to use for fast creation of internal links. The colum name
is composed of the string *page* and an optional character to specify the type of the link. is composed of the string *page* and an optional character to specify the type of the link.
...@@ -1424,8 +1430,8 @@ below. ...@@ -1424,8 +1430,8 @@ below.
+-------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+ +-------------+-------------------------------------------------------------------------------------------------+----------------------------------------------------------+---------------------------------------------------------------+
Column: vertical Column: _vertical
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
Render text vertically. This is useful for tables with limited column width. The vertical rendering is achieved via CSS tranformations (rotation) defined in the style attribute of the wrapping tag. You can optionally specify the rotation Render text vertically. This is useful for tables with limited column width. The vertical rendering is achieved via CSS tranformations (rotation) defined in the style attribute of the wrapping tag. You can optionally specify the rotation
angle. angle.
...@@ -1479,8 +1485,8 @@ angle. ...@@ -1479,8 +1485,8 @@ angle.
Column: mailto Column: _mailto
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
Easily create Email links. Easily create Email links.
...@@ -1528,8 +1534,8 @@ Easily create Email links. ...@@ -1528,8 +1534,8 @@ Easily create Email links.
Column: sendmail Column: _sendmail
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
Send simple plain text emails. Every mail will be logged in the mail log. The logfile can be configured in ext_localconf.php via $TYPO3_CONF_VARS[$_EXTKEY]['log']['mail']. Send simple plain text emails. Every mail will be logged in the mail log. The logfile can be configured in ext_localconf.php via $TYPO3_CONF_VARS[$_EXTKEY]['log']['mail'].
...@@ -1583,8 +1589,8 @@ This will send an email with subject *Latest News* from company@example.com to j ...@@ -1583,8 +1589,8 @@ This will send an email with subject *Latest News* from company@example.com to j
This will send an email with subject *Latest news* from company@example.com to customer1@example.com and to customer2@example.com. This will send an email with subject *Latest news* from company@example.com to customer1@example.com and to customer2@example.com.
Column: advancedmail Column: _advancedmail
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
Send plain text/html emails. This is identical to ?t#Column:_sendmail, but allows to additionaly set the cc:, bcc: and reply-to: -headers. Every mail will be logged in the mail log. The logfile can be configured in ext_localconf.php via Send plain text/html emails. This is identical to ?t#Column:_sendmail, but allows to additionaly set the cc:, bcc: and reply-to: -headers. Every mail will be logged in the mail log. The logfile can be configured in ext_localconf.php via
$TYPO3_CONF_VARS[$_EXTKEY]['log']['mail']. $TYPO3_CONF_VARS[$_EXTKEY]['log']['mail'].
...@@ -1621,8 +1627,8 @@ $TYPO3_CONF_VARS[$_EXTKEY]['log']['mail']. ...@@ -1621,8 +1627,8 @@ $TYPO3_CONF_VARS[$_EXTKEY]['log']['mail'].
+------------------------------------------------------------+----------------------------------------------------------------------------------------------+------------+ +------------------------------------------------------------+----------------------------------------------------------------------------------------------+------------+
Column: img Column: _img
^^^^^^^^^^^ ^^^^^^^^^^^^
Renders images. Allows to define an alternative text and a title attribute for the image. Alternative text and title text are optional. Renders images. Allows to define an alternative text and a title attribute for the image. Alternative text and title text are optional.
...@@ -1680,8 +1686,8 @@ Renders images. Allows to define an alternative text and a title attribute for t ...@@ -1680,8 +1686,8 @@ Renders images. Allows to define an alternative text and a title attribute for t
Column: exec Column: _exec
^^^^^^^^^^^^ ^^^^^^^^^^^^^
Runs batch files or executables on the webserver. In case of an error, returncode and errormessage will be returned. Runs batch files or executables on the webserver. In case of an error, returncode and errormessage will be returned.
...@@ -1715,8 +1721,8 @@ Runs batch files or executables on the webserver. In case of an error, returncod ...@@ -1715,8 +1721,8 @@ Runs batch files or executables on the webserver. In case of an error, returncod
Column: F Column: _F
^^^^^^^^^ ^^^^^^^^^^
Challenge 1 Challenge 1
''''''''''' '''''''''''
......
...@@ -1230,6 +1230,11 @@ abstract class AbstractBuildForm { ...@@ -1230,6 +1230,11 @@ abstract class AbstractBuildForm {
// construct column attributes // construct column attributes
$control = $this->getSubrecordColumnControl(array_keys($formElement['sql1'][0])); $control = $this->getSubrecordColumnControl(array_keys($formElement['sql1'][0]));
// Skip class control column
if (isset($control['title'][FE_SUBRECORD_ROW_CLASS])) {
unset($control['title'][FE_SUBRECORD_ROW_CLASS]);
}
// Subrecord: Column titles // Subrecord: Column titles
$columns = $linkNew; $columns = $linkNew;
$columns .= '<th>' . implode('</th><th>', $control['title']) . '</th>'; $columns .= '<th>' . implode('</th><th>', $control['title']) . '</th>';
...@@ -1249,6 +1254,11 @@ abstract class AbstractBuildForm { ...@@ -1249,6 +1254,11 @@ abstract class AbstractBuildForm {
// All columns // All columns
foreach ($row as $columnName => $value) { foreach ($row as $columnName => $value) {
// Skip class control column
if ($columnName === FE_SUBRECORD_ROW_CLASS) {
continue;
}
$rowHtml .= Support::wrapTag('<td>', $this->renderCell($control, $columnName, $value)); $rowHtml .= Support::wrapTag('<td>', $this->renderCell($control, $columnName, $value));
} }
...@@ -1261,10 +1271,12 @@ abstract class AbstractBuildForm { ...@@ -1261,10 +1271,12 @@ abstract class AbstractBuildForm {
$rowHtml .= Support::wrapTag('<td>', Support::wrapTag("<button type='button' class='record-delete' data-sip='$s'>", '<span class="glyphicon glyphicon-trash"></span>')); $rowHtml .= Support::wrapTag('<td>', Support::wrapTag("<button type='button' class='record-delete' data-sip='$s'>", '<span class="glyphicon glyphicon-trash"></span>'));
} }
$html .= Support::wrapTag('<tr class="record">', $rowHtml, true); $class = 'record ';
$class .= (isset($row[FE_SUBRECORD_ROW_CLASS]) ? $row[FE_SUBRECORD_ROW_CLASS] : '') . ' ';
$html .= Support::wrapTag("<tr class='$class'>", $rowHtml, true);
} }
return Support::wrapTag('<table class="table">', $html, true); return Support::wrapTag('<table class="table table-hover">', $html, true);
} }
/** /**
......
...@@ -364,6 +364,8 @@ const FE_MODE_REQUIRED = 'required'; ...@@ -364,6 +364,8 @@ const FE_MODE_REQUIRED = 'required';
const FE_MODE_LOCK = 'lock'; const FE_MODE_LOCK = 'lock';
const FE_MODE_DISABLED = 'disabled'; const FE_MODE_DISABLED = 'disabled';
const FE_SUBRECORD_ROW_CLASS = '_rowClass';
// FormElement columns: real // FormElement columns: real
const FE_TYPE = 'type'; const FE_TYPE = 'type';
......
...@@ -164,7 +164,7 @@ VALUES ...@@ -164,7 +164,7 @@ VALUES
'', '', 4, ''), '', '', 4, ''),
(1, '', 'FormElements', 'show', 'subrecord', 'all', 'native', 500, 0, 0, '', '', '', (1, '', 'FormElements', 'show', 'subrecord', 'all', 'native', 500, 0, 0, '', '', '',
'{{!SELECT id, feIdContainer, name, label, mode, class, type, ord, size, sql1, parameter FROM FormElement WHERE formId={{id:R0}} ORDER BY ord, id}}', '{{!SELECT IF(enabled="yes", "", "text-muted") AS _rowClass, id, feIdContainer, name, label, mode, class, type, ord, size, sql1, parameter FROM FormElement WHERE formId={{id:R0}} ORDER BY ord, id}}',
'', 'form=formElement\ndetail=id:formId', 5, 'new,edit,delete'); '', 'form=formElement\ndetail=id:formId', 5, 'new,edit,delete');
# #
......
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