Commit 0d8850de authored by Carsten  Rose's avatar Carsten Rose
Browse files

Bug #5031 / Missing details in DbException: New definition of...

Bug #5031 / Missing details in DbException: New definition of SYSTEM_SHOW_DEBUG_INFO: even after config.qfq.ini is parsed and SIP Infos has been read - if there is no BE User logged in, the value stays on 'auto' (earlier it has been replaced to 'no'). Staying on 'auto' keeps the information that replacing is still open and not replaced means 'no'-BE User logged in.
parent fcf60517
......@@ -117,8 +117,8 @@ class BuildFormBootstrap extends AbstractBuildForm {
$button = Support::wrapTag('<div class="col-xs-12 col-sm-6 col-md-4">', $this->buildButtons());
$html .= Support::wrapTag('<div class="row">', $title . $button);
$pill = $this->buildPillNavigation(OnArray::filter($this->feSpecNative, 'type', 'pill'));
$dummy = array();
$pill = $this->buildPillNavigation(OnArray::filter($this->feSpecNative, 'type', 'pill'), $dummy);
$html .= Support::wrapTag('<div class="row">', $pill);
$html .= $this->getFormTag();
......@@ -356,18 +356,22 @@ class BuildFormBootstrap extends AbstractBuildForm {
}
/**
* @param $pillArray
* @param array $pillArray
*
* @param array $json
* @return string
*
* @throws CodeException
* @throws UserFormException
*/
private function buildPillNavigation($pillArray) {
private function buildPillNavigation(array $pillArray, array &$json) {
$pillButton = '';
$pillDropdown = '';
$htmlDropdown = '';
if ($pillArray == null)
if ($pillArray == null) {
return '';
}
$maxVisiblePill = (isset($this->formSpec['maxVisiblePill']) && $this->formSpec['maxVisiblePill'] !== '') ? $this->formSpec['maxVisiblePill'] : 1000;
......@@ -377,6 +381,8 @@ class BuildFormBootstrap extends AbstractBuildForm {
$ii = 0;
$active = 'class="active"';
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;
$formElement = $this->evaluate->parseArray($formElement);
HelperFormElement::explodeParameter($formElement, F_PARAMETER);
......@@ -396,27 +402,38 @@ class BuildFormBootstrap extends AbstractBuildForm {
// Anker for pill navigation
// $a = '<a ' . Support::doAttribute('href', '#' . $this->createAnker($formElement[FE_ID])) . ' data-toggle="tab">' . $formElement[FE_LABEL] . '</a>';
$attributeA = 'data-toggle="tab" ';
$attributeLiA = 'data-toggle="tab" ';
$hrefTarget = '#' . $this->createAnker($formElement[FE_ID]);
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'] = '';
break;
case FE_MODE_READONLY:
$attributeLi = Support::doAttribute('class', 'disabled');
$json[API_ELEMENT_UPDATE][$htmlIdLi][API_ELEMENT_ATTRIBUTE]['class'] = 'disabled';
$hrefTarget = '#';
$attributeA .= Support::doAttribute('class', 'noclick');
$attributeLiA .= Support::doAttribute('class', 'noclick');
$json[API_ELEMENT_UPDATE][$htmlIdLiA][API_ELEMENT_ATTRIBUTE]['class'] = 'noclick';
break;
case FE_MODE_HIDDEN:
$attributeLi = Support::doAttribute('style', 'display: none');
// $attributeLi = Support::doAttribute('style', 'display: none');
$attributeLi = Support::doAttribute('class', 'hidden');
$json[API_ELEMENT_UPDATE][$htmlIdLi][API_ELEMENT_ATTRIBUTE]['class'] = 'hidden';
$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]);
$attributeLi .= Support::doAttribute('id', $htmlIdLi);
$attributeLiA .= Support::doAttribute('id', $htmlIdLiA);
$a = Support::wrapTag("<a $attributeLiA" . Support::doAttribute('href', $hrefTarget) . ">", $formElement[FE_LABEL]);
if ($ii <= $maxVisiblePill) {
$pillButton .= '<li role="presentation"' . $attributeLi . $active . ">" . $a . "</li>";
......@@ -735,4 +752,34 @@ EOF;
return Support::wrapTag("<span name='qfq-subrecord' $attribute>", $html);
}
/**
* Builds complete 'form'.
*
* @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
*
* @return string|array $mode=LOAD_FORM: The whole form as HTML, $mode=FORM_UPDATE /FORM_SAVE: array of all
* formElement.dynamicUpdate-yes values/states
* @throws CodeException
* @throws DbException
* @throws \qfq\UserFormException
*/
public function process($mode, $htmlElementNameIdZero = false, $latestFeSpecNative = array()) {
$json = array();
$data = parent::process($mode, $htmlElementNameIdZero = false, $latestFeSpecNative = array());
switch ($mode) {
case FORM_SAVE:
case FORM_UPDATE:
$pillArray = OnArray::filter($this->feSpecNative, 'type', 'pill');
$this->buildPillNavigation($pillArray, $json);
$data = array_merge($data, $json);
break;
default:
break;
}
return $data;
}
}
\ No newline at end of file
......@@ -55,7 +55,8 @@ const SQL_FORM_ELEMENT_ALL_CONTAINER = "SELECT *, ? AS 'nestedInFieldSet' FROM F
const SQL_FORM_ELEMENT_SIMPLE_ALL_CONTAINER = "SELECT fe.id, fe.feIdContainer, fe.name, fe.label, fe.type, fe.encode, fe.checkType, fe.checkPattern, fe.mode, fe.modeSql, fe.parameter, fe.dynamicUpdate FROM FormElement AS fe, Form AS f WHERE f.name = ? AND f.id = fe.formId AND fe.deleted = 'no' AND fe.class = 'native' AND fe.enabled='yes' ORDER BY fe.ord, fe.id";
const SQL_FORM_ELEMENT_CONTAINER_TEMPLATE_GROUP = "SELECT fe.id, fe.name, fe.label, fe.maxLength, fe.parameter FROM FormElement AS fe, Form AS f WHERE f.name = ? AND f.id = fe.formId AND fe.deleted = 'no' AND fe.class = 'container' AND fe.type='templateGroup' AND fe.enabled='yes' ORDER BY fe.ord, fe.id";
const SQL_FORM_ELEMENT_TEMPLATE_GROUP_FE_ID = "SELECT * FROM FormElement AS fe WHERE fe.id = ? AND fe.deleted = 'no' AND fe.class = 'container' AND fe.type='templateGroup' AND fe.enabled='yes' ";
const SQL_FORM_ELEMENT_NATIVE_TG_COUNT = "SELECT fe.*, IFNULL(feTg.maxLength,0) AS _tgCopies FROM FormElement AS fe LEFT JOIN FormElement AS feTg ON fe.feIdContainer=feTg.id AND feTg.deleted = 'no' AND feTg.class = 'container' AND feTg.type='templateGroup' AND feTg.enabled='yes' WHERE fe.formId = ? AND fe.deleted = 'no' AND fe.class = 'native' AND fe.enabled='yes'";
//const SQL_FORM_ELEMENT_NATIVE_TG_COUNT = "SELECT fe.*, IFNULL(feTg.maxLength,0) AS _tgCopies FROM FormElement AS fe LEFT JOIN FormElement AS feTg ON fe.feIdContainer=feTg.id AND feTg.deleted = 'no' AND feTg.class = 'container' AND feTg.type='templateGroup' AND feTg.enabled='yes' WHERE fe.formId = ? AND fe.deleted = 'no' AND fe.class = 'native' AND fe.enabled='yes'";
const SQL_FORM_ELEMENT_NATIVE_TG_COUNT = "SELECT fe.*, IFNULL(feTg.maxLength,0) AS _tgCopies FROM FormElement AS fe LEFT JOIN FormElement AS feTg ON fe.feIdContainer=feTg.id AND feTg.deleted = 'no' AND feTg.class = 'container' AND feTg.type='templateGroup' AND feTg.enabled='yes' WHERE fe.formId = ? AND fe.deleted = 'no' AND (fe.class = 'native' OR (fe.class = 'container' AND fe.type='pill')) AND fe.enabled='yes'";
const NAME_TG_COPIES = '_tgCopies'; // Number of templatesGroup copies to create on the fly. Also used in SQL_FORM_ELEMENT_NATIVE_TG_COUNT.
const FE_TG_INDEX = '_tgIndex'; // Index of the current copy of a templateGroup FE.
......@@ -381,7 +382,7 @@ const SYSTEM_MAIL_LOG_FILE = '../../mail.log';
const SYSTEM_SHOW_DEBUG_INFO = 'SHOW_DEBUG_INFO';
const SYSTEM_SHOW_DEBUG_INFO_YES = 'yes';
const SYSTEM_SHOW_DEBUG_INFO_NO = 'no';
const SYSTEM_SHOW_DEBUG_INFO_AUTO = 'auto';
const SYSTEM_SHOW_DEBUG_INFO_AUTO = 'auto'; // Remains on value 'auto' as long as there is no BE User logged in. In other words: 'auto'='no'. #5031
const SYSTEM_SHOW_DEBUG_INFO_DOWNLOAD = 'download';
const SYSTEM_CSS_LINK_CLASS_INTERNAL = 'CSS_LINK_CLASS_INTERNAL';
......@@ -621,6 +622,7 @@ const API_FORM_UPDATE_REQUIRED = 'required';
const API_ELEMENT_UPDATE = 'element-update';
const API_ELEMENT_ATTRIBUTE = 'attr';
const API_ELEMENT_CONTENT = 'content';
const API_SUBMIT_REASON = 'submit_reason';
const API_SUBMIT_REASON_SAVE = 'save';
const API_SUBMIT_REASON_SAVE_CLOSE = 'save,close';
......@@ -937,8 +939,6 @@ const RETYPE_FE_NAME_EXTENSION = 'RETYPE';
const TYPEAHEAD_PLACEHOLDER = '?';
const FE_HTML_ID = 'htmlId'; // Will be dynamically computed during runtime.
// Values
const FE_ENCODE_SPECIALCHAR = 'specialchar';
const FE_ENCODE_NONE = 'none';
......@@ -975,6 +975,20 @@ const FE_TYPE_PASTE = 'paste';
const FE_TYPE_TEMPLATE_GROUP = 'templateGroup';
const FE_HTML_ID = 'htmlId'; // Will be dynamically computed during runtime.
const HTML_DELIMITER_NAME = '-';
const HTML_DELIMITER_ID = HTML_DELIMITER_NAME;
const HTML_ID_EXTENSION_LABEL = '-l';
const HTML_ID_EXTENSION_INPUT = '-i';
const HTML_ID_EXTENSION_NOTE = '-n';
const HTML_ID_EXTENSION_TOOLTIP = '-t';
const HTML_ID_EXTENSION_ROW = '-r';
const HTML_ID_EXTENSION_CHARACTER_COUNT = '-cc';
const HTML_ID_EXTENSION_PILL_LI = '-pl';
const HTML_ID_EXTENSION_PILL_LI_A = '-pla';
const SHEBANG_REPORT = '#!report';
// SUPPORT
......@@ -987,16 +1001,6 @@ const ESCAPE_WITH_HTML_QUOTE = 'htmlquote';
const FLAG_ALL = 'flagAll';
const FLAG_DYNAMIC_UPDATE = 'flagDynamicUpdate';
const HTML_DELIMITER_NAME = '-';
const HTML_DELIMITER_ID = HTML_DELIMITER_NAME;
const HTML_ID_EXTENSION_LABEL = '-l';
const HTML_ID_EXTENSION_INPUT = '-i';
const HTML_ID_EXTENSION_NOTE = '-n';
const HTML_ID_EXTENSION_TOOLTIP = '-t';
const HTML_ID_EXTENSION_ROW = '-r';
const HTML_ID_EXTENSION_CHARACTER_COUNT = '-cc';
const QUERY_TYPE_SELECT = 'type: select,show,describe,explain';
const QUERY_TYPE_INSERT = 'type: insert';
const QUERY_TYPE_UPDATE = 'type: update,replace,delete';
......
......@@ -69,7 +69,7 @@ class QuickFormQuery {
protected $store = null;
/**
* @var Array of Database instantiated class
* @var \qfq\Database[] - Array of Database instantiated class
*/
protected $dbArray = array();
......@@ -723,6 +723,7 @@ class QuickFormQuery {
}
$this->feSpecNative = HelperFormElement::setLanguage($feSpecNative, $parameterLanguageFieldName);
$this->feSpecNative = HelperFormElement::setFeContainerFormElementId($this->feSpecNative, $this->formSpec[F_ID], $recordId);
return $formName;
}
......
......@@ -125,6 +125,32 @@ class HelperFormElement {
return "$formId" . HTML_DELIMITER_ID . "$formElementId" . HTML_DELIMITER_ID . "$recordId" . HTML_DELIMITER_ID . "$formElementCopy";
}
/**
* In an array for $feSpecNative, set FE_HTML_ID for all fe.class=FE_CONTAINER Elements.
*
* @param array $feSpecNative
* @param $formId
* @param $recordId
* @param int $formElementCopy
* @return array
*/
public static function setFeContainerFormElementId(array $feSpecNative, $formId, $recordId, $formElementCopy = 0) {
foreach ($feSpecNative as $key => $fe) {
switch ($fe[FE_CLASS]) {
case FE_CLASS_CONTAINER:
$feSpecNative[$key][FE_HTML_ID] = self::buildFormElementId($formId, $fe[FE_ID], $recordId, $formElementCopy);
break;
default:
break;
}
}
return $feSpecNative;
}
/**
* Checkboxen, belonging to one element, grouped together by name: <fe>_<field>_<index>
*
......
......@@ -170,10 +170,9 @@ class Store {
self::fillStoreTypo3($bodytext); // should be filled before fillStoreSystem() to offer T3 variables
self::fillStoreClient(); // should be filled before fillStoreSystem() to offer Client variables
self::fillStoreExtra(); // should be filled before fillStoreSystem() to restore variables like SYSTEM_SHOW_DEBUG_INFO
self::fillStoreSystem($fileConfigIni);
self::fillStoreSip();
self::fillStoreExtra();
}
/**
......@@ -273,10 +272,8 @@ class Store {
private static function adjustConfigShowDebugInfo($value, $flag) {
// Check if SHOW_DEBUG_INFO contains 'auto'. Replace with appropriate.
if (Support::findInSet(SYSTEM_SHOW_DEBUG_INFO_AUTO, $value)) {
$replace = $flag ? SYSTEM_SHOW_DEBUG_INFO_YES : SYSTEM_SHOW_DEBUG_INFO_NO;
$value = str_replace(SYSTEM_SHOW_DEBUG_INFO_AUTO, $replace, $value);
if (Support::findInSet(SYSTEM_SHOW_DEBUG_INFO_AUTO, $value) && $flag) {
$value = str_replace(SYSTEM_SHOW_DEBUG_INFO_AUTO, SYSTEM_SHOW_DEBUG_INFO_YES, $value);
}
return $value;
......@@ -514,8 +511,10 @@ class Store {
} else {
self::setStore($_SESSION[SESSION_NAME][STORE_EXTRA], STORE_EXTRA, true);
}
}
/**
* Returns a pointer to this Class.
*
......
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