Commit dc9de538 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Feature #3752 / Pills auf mode|modeSql=hidden|readonly setzen - implemented...

Feature #3752 / Pills auf mode|modeSql=hidden|readonly setzen - implemented during 'form load' (not dynamic update)
parent fcb2f433
......@@ -2043,12 +2043,21 @@ Type: pill
* Pill is synonymous for a tab. A pill looks like a tab.
* Pills are only available with mode render='bootstrap'.
* If there is at least one pill defined, every native *FormElement* needs to be assigned to a pill or to a fieldset.
* If there is at least one pill defined, every fieldset needs to be assigned to a pill.
* If there is at least one pill defined, every *fieldset* needs to be assigned to a pill.
* Pills are not 'dynamicUpdate' aware (at the moment). At least during form load, *modeSql* can be dynamically computed to
switch the pill in show / readonly (disabled) / hidden state.
* FormElement settings:
* *name*: technical name, used as HTML identifier.
* *label*: Label shown on the corresponding pill button or inside the drop-down menu.
* *mode*:
* *show*, *required*: regular mode. The pill will be shown.
* *readonly*: the pill and it's name is visible, but not clickable.
* *hidden*: the pill is not shown at all.
* *modeSql*:
* *type*: *pill*
* *feIdContainer*: `0` - Pill's can't be nested.
* *parameter*:
......
......@@ -2407,13 +2407,8 @@ abstract class AbstractBuildForm {
$toolTip .= PHP_EOL . "form = '" . $formElement[F_FINAL_DELETE_FORM] . "'" . PHP_EOL . "r = '" . $row[$nameColumnId] . "'";
}
// $buttonDelete = $this->buildButtonCode('delete-button', $toolTip, GLYPH_ICON_DELETE, $disabled);
$s = $this->createDeleteUrl($formElement[F_FINAL_DELETE_FORM], $row[$nameColumnId], RETURN_SIP);
// $rowHtml .= Support::wrapTag('<td>', Support::wrapTag("<button type='button' class='record-delete btn btn-default' data-sip='$s'>", '<span class="glyphicon ' . GLYPH_ICON_DELETE . '"></span>'));
$rowHtml .= Support::wrapTag('<td>', Support::wrapTag("<button type='button' class='record-delete btn btn-default' data-sip='$s' " . Support::doAttribute('title', $toolTip) . ">", '<span class="glyphicon ' . GLYPH_ICON_DELETE . '"></span>'));
}
Support::setIfNotSet($row, FE_SUBRECORD_ROW_CLASS);
......
......@@ -168,9 +168,9 @@ class BuildFormBootstrap extends AbstractBuildForm {
$formId = $this->store->getVar(COLUMN_ID, STORE_RECORD . STORE_ZERO);
$queryStringArray = [
'id' => $this->store->getVar(SYSTEM_EDIT_FORM_PAGE, STORE_SYSTEM),
'id' => $this->store->getVar(SYSTEM_EDIT_FORM_PAGE, STORE_SYSTEM),
'form' => 'copyForm',
'r' => 0,
'r' => 0,
'idSrc' => $formId,
];
$queryString = Support::arrayToQueryString($queryStringArray);
......@@ -216,7 +216,7 @@ class BuildFormBootstrap extends AbstractBuildForm {
$queryStringArray = [
'id' => $this->store->getVar(SYSTEM_EDIT_FORM_PAGE, STORE_SYSTEM),
'form' => $form,
'r' => 0,
'r' => 0,
];
$queryString = Support::arrayToQueryString($queryStringArray);
$sip = $this->store->getSipInstance();
......@@ -389,6 +389,9 @@ class BuildFormBootstrap extends AbstractBuildForm {
$formElement = $this->evaluate->parseArray($formElement);
HelperFormElement::explodeParameter($formElement, F_PARAMETER);
$formElement = HelperFormElement::setLanguage($formElement, $parameterLanguageFieldName);
if (!empty($formElement[FE_MODE_SQL])) {
$formElement[FE_MODE] = $formElement[FE_MODE_SQL];
}
$ii++;
......@@ -399,12 +402,34 @@ class BuildFormBootstrap extends AbstractBuildForm {
}
// Anker for pill navigation
$a = '<a ' . Support::doAttribute('href', '#' . $this->createAnker($formElement['id'])) . ' data-toggle="tab">' . $formElement[FE_LABEL] . '</a>';
// $a = '<a ' . Support::doAttribute('href', '#' . $this->createAnker($formElement[FE_ID])) . ' data-toggle="tab">' . $formElement[FE_LABEL] . '</a>';
$attributeA = 'data-toggle="tab" ';
$hrefTarget = '#' . $this->createAnker($formElement[FE_ID]);
switch ($formElement[FE_MODE]) {
case FE_MODE_SHOW:
case FE_MODE_REQUIRED:
$attributeLi = '';
break;
case FE_MODE_READONLY:
$attributeLi = Support::doAttribute('class', 'disabled');
$hrefTarget = '#';
$attributeA .= Support::doAttribute('class', 'noclick');
break;
case FE_MODE_HIDDEN:
$attributeLi = Support::doAttribute('style', 'display: none');
$a = '';
break;
default:
throw new UserFormException("Unknown Mode: " . $formElement[FE_MODE], ERROR_UNKNOWN_MODE);
}
$a = Support::wrapTag("<a $attributeA" . Support::doAttribute('href', $hrefTarget) . ">", $formElement[FE_LABEL]);
if ($ii <= $maxVisiblePill) {
$pillButton .= '<li role="presentation" ' . $active . '>' . $a . '</li>';
$pillButton .= '<li role="presentation"' . $attributeLi . $active . ">" . $a . "</li>";
} else {
$pillDropdown .= '<li>' . $a . '</li>';
$pillDropdown .= '<li ' . $attributeLi . '>' . $a . "</li>";
}
$active = '';
}
......@@ -430,7 +455,7 @@ class BuildFormBootstrap extends AbstractBuildForm {
* @return string
*/
private function createAnker($id) {
return $this->formSpec['name'] . '_' . $id;
return $this->formSpec[FE_NAME] . '_' . $id;
}
/**
......
......@@ -281,4 +281,8 @@ i.@{spinner_class} {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
a.noclick {
pointer-events: none;
}
\ No newline at end of file
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