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

Bug 4865: Labels are updated now. 'class="active"' on pills are lost.

parent 0d8850de
......@@ -42,7 +42,7 @@ Stream
{
"status": "error",
...
"field-name": "<field name>",
"field-name": "<field name>",
"field-message": "<message>",
...
}
......
......@@ -71,7 +71,7 @@ abstract class AbstractBuildForm {
private $bodytextParser = null;
/**
* @var Array of Database instantiated class
* @var Database[] Array of Database instantiated class
*/
protected $dbArray = array();
......
......@@ -380,7 +380,9 @@ class BuildFormBootstrap extends AbstractBuildForm {
// Iterate over all 'pill'
$ii = 0;
$active = 'class="active"';
$recordId = $this->store->getVar(COLUMN_ID, STORE_RECORD . STORE_ZERO);
foreach ($pillArray as $formElement) {
$htmlIdLi = $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_PILL_LI;
$htmlIdLiA = $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_PILL_LI_A;
......@@ -405,35 +407,37 @@ class BuildFormBootstrap extends AbstractBuildForm {
$attributeLiA = 'data-toggle="tab" ';
$hrefTarget = '#' . $this->createAnker($formElement[FE_ID]);
$htmlFormElementName = HelperFormElement::buildFormElementName($formElement, $recordId);
switch ($formElement[FE_MODE]) {
case FE_MODE_SHOW:
case FE_MODE_REQUIRED:
$attributeLi = '';
$json[API_ELEMENT_UPDATE][$htmlIdLi][API_ELEMENT_ATTRIBUTE]['class'] = '';
$json[API_ELEMENT_UPDATE][$htmlIdLiA][API_ELEMENT_ATTRIBUTE]['class'] = '';
$json[$htmlFormElementName][API_ELEMENT_UPDATE][$htmlIdLi][API_ELEMENT_ATTRIBUTE][HTML_ATTR_CLASS] = '';
$json[$htmlFormElementName][API_ELEMENT_UPDATE][$htmlIdLiA][API_ELEMENT_ATTRIBUTE][HTML_ATTR_CLASS] = '';
break;
case FE_MODE_READONLY:
$attributeLi = Support::doAttribute('class', 'disabled');
$json[API_ELEMENT_UPDATE][$htmlIdLi][API_ELEMENT_ATTRIBUTE]['class'] = 'disabled';
$json[$htmlFormElementName][API_ELEMENT_UPDATE][$htmlIdLi][API_ELEMENT_ATTRIBUTE][HTML_ATTR_CLASS] = 'disabled';
$hrefTarget = '#';
$attributeLiA .= Support::doAttribute('class', 'noclick');
$json[API_ELEMENT_UPDATE][$htmlIdLiA][API_ELEMENT_ATTRIBUTE]['class'] = 'noclick';
$json[$htmlFormElementName][API_ELEMENT_UPDATE][$htmlIdLiA][API_ELEMENT_ATTRIBUTE][HTML_ATTR_CLASS] = 'noclick';
break;
case FE_MODE_HIDDEN:
// $attributeLi = Support::doAttribute('style', 'display: none');
$attributeLi = Support::doAttribute('class', 'hidden');
$json[API_ELEMENT_UPDATE][$htmlIdLi][API_ELEMENT_ATTRIBUTE]['class'] = 'hidden';
$json[$htmlFormElementName][API_ELEMENT_UPDATE][$htmlIdLi][API_ELEMENT_ATTRIBUTE][HTML_ATTR_CLASS] = 'hidden';
$a = '';
break;
default:
throw new UserFormException("Unknown Mode: " . $formElement[FE_MODE], ERROR_UNKNOWN_MODE);
}
$attributeLi .= Support::doAttribute('id', $htmlIdLi);
$attributeLiA .= Support::doAttribute('id', $htmlIdLiA);
$attributeLi .= Support::doAttribute(HTML_ATTR_ID, $htmlIdLi);
$attributeLiA .= Support::doAttribute(HTML_ATTR_ID, $htmlIdLiA);
$a = Support::wrapTag("<a $attributeLiA" . Support::doAttribute('href', $hrefTarget) . ">", $formElement[FE_LABEL]);
$json[$htmlFormElementName][API_ELEMENT_UPDATE][$htmlIdLiA][API_ELEMENT_CONTENT] = $formElement[FE_LABEL];
if ($ii <= $maxVisiblePill) {
$pillButton .= '<li role="presentation"' . $attributeLi . $active . ">" . $a . "</li>";
......
......@@ -989,6 +989,10 @@ const HTML_ID_EXTENSION_CHARACTER_COUNT = '-cc';
const HTML_ID_EXTENSION_PILL_LI = '-pl';
const HTML_ID_EXTENSION_PILL_LI_A = '-pla';
const HTML_ATTR_ID = 'id';
const HTML_ATTR_NAME = 'name';
const HTML_ATTR_CLASS = 'class';
const SHEBANG_REPORT = '#!report';
// SUPPORT
......
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