Commit 1c63c477 authored by Carsten  Rose's avatar Carsten Rose
Browse files

3612 / Konflikt typeAheadLdap mit dynamic modesql: the problematic HTML input...

3612 / Konflikt typeAheadLdap mit dynamic modesql: the problematic HTML input element, added with typeahead functionality, is completely JS controlled by a Twitter library. For hiding / showing elements via dynamicUpdate, QFQ uses now API_ELEMENT_UPDATE on the outer row element.
AbstractBuildForm.php: add function elementUpdateAttrClassOnRow().
BuildFormBootstrap.php: split the class definition in an extra var.
parent 6da2605e
......@@ -497,7 +497,7 @@ abstract class AbstractBuildForm {
$json = array_merge($json, $jsonElement);
}
} else {
// for non container elements: just add the current json status
// for non-container elements: just add the current json status
if ($modeCollectFe === FLAG_ALL || ($modeCollectFe == FLAG_DYNAMIC_UPDATE && $fe[FE_DYNAMIC_UPDATE] == 'yes')) {
if (isset($jsonElement[0]) && is_array($jsonElement[0])) {
// Checkboxes are delivered as array of arrays: unnest them and append them to the existing json array.
......@@ -505,6 +505,7 @@ abstract class AbstractBuildForm {
} else {
$json[] = $jsonElement;
}
$json = $this->elementUpdateAttrClassOnRow($json, $formElement);
}
}
......@@ -535,6 +536,30 @@ abstract class AbstractBuildForm {
return $html;
}
/**
* Add API_ELEMENT_UPDATE of the current FormElement for the attribute 'class' on the 'row'-div.
* Depending on $formElement[FE_MODE] set
* WRAP_SETUP_CLASS or
* WRAP_SETUP_CLASS . 'hidden'.
*
* @param array $json
* @param array $formElement
* @return array
*/
private function elementUpdateAttrClassOnRow(array $json, array $formElement) {
// Activate 'show' or 'hidden' on the current FormElement via JSON 'API_ELEMENT_UPDATE'
$class = $this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_CLASS];
if ($formElement[FE_MODE] == 'hidden') {
$class .= ' hidden';
}
$key = $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_ROW;
$json[][API_ELEMENT_UPDATE][$key][API_ELEMENT_ATTRIBUTE]['class'] = $class;
return $json;
}
/**
* Checks if LDAP search is requested.
* Yes: prepare configuration and fire the query.
......
......@@ -53,7 +53,8 @@ class BuildFormBootstrap extends AbstractBuildForm {
$this->wrap[WRAP_SETUP_TITLE][WRAP_SETUP_END] = "</h1></div></div>";
// Element: Label + Input + Note
$this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_START] = "<div class='form-group clearfix'>";
$this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_CLASS] = "form-group clearfix";
$this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_START] = "<div class='" . $this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_CLASS] . "'>";
$this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_END] = "</div>";
$this->wrap[WRAP_SETUP_SUBRECORD][WRAP_SETUP_START] = "<div class='col-md-12'>";
......
......@@ -79,6 +79,7 @@ const WRAP_SETUP_SUBRECORD = 'subrecord';
const WRAP_SETUP_IN_FIELDSET = 'inFieldset';
const WRAP_SETUP_IN_TEMPLATE_GROUP = 'inTemplateGroup';
const WRAP_SETUP_START = 'start';
const WRAP_SETUP_CLASS = 'class';
const WRAP_SETUP_END = 'end';
// dbQuerySimple
......
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