Commit 920f3ec3 authored by bbaer's avatar bbaer
Browse files

Merge remote-tracking branch 'origin/master'

parents 9995b00a 312ac1c6
This diff is collapsed.
......@@ -120,7 +120,11 @@ formDataMatchError = match error
# cat=form-config/config; type=string; label=Form data error message:Default is 'error'. Customizable error message used in validator.js. generic violation.
formDataError = error
# cat=form-config/config; type=boolean; label=Show record-id in form title:Default is off (0). If on (1), append the current record id on the title. New records get '(new)'.
showIdInFormTitle = 0
# cat=form-config/config; type=string; label=Wrap the subrecord column 'id|ID|Id' with the given class. E.g. 'text-muted' is rendered as ...<span class="text-muted">value</span>.
cssClassColumnId = text-muted
......
......@@ -88,6 +88,7 @@ abstract class AbstractBuildForm {
* @param array $db
* @throws CodeException
* @throws UserFormException
* @throws UserReportException
*/
public function __construct(array $formSpec, array $feSpecAction, array $feSpecNative, array $db = null) {
$this->formSpec = $formSpec;
......@@ -1793,6 +1794,7 @@ abstract class AbstractBuildForm {
* @param array $json
* @return string
* @throws CodeException
* @throws UserFormException
*/
public function buildCheckboxMulti(array $formElement, $htmlFormElementName, $attributeBase, $value, array $itemKey, array $itemValue, array &$json) {
......@@ -2376,6 +2378,7 @@ abstract class AbstractBuildForm {
$control = array();
$primaryRecord = $this->store->getStore(STORE_RECORD);
$cssClassColumnId = $this->store->getVar(SYSTEM_CSS_CLASS_COLUMN_ID, STORE_SYSTEM . STORE_EMPTY);
if (!$this->prepareSubrecord($formElement, $primaryRecord, $rcText, $nameColumnId)) {
return $rcText;
......@@ -2412,7 +2415,7 @@ abstract class AbstractBuildForm {
// All columns
foreach ($row as $columnName => $value) {
if (isset($control[SUBRECORD_COLUMN_TITLE][$columnName])) {
$rowHtml .= Support::wrapTag("<td>", $this->renderCell($control, $columnName, $value));
$rowHtml .= Support::wrapTag("<td>", $this->renderCell($control, $columnName, $value, $cssClassColumnId));
}
}
......@@ -2699,13 +2702,14 @@ abstract class AbstractBuildForm {
* @param array $control
* @param string $columnName
* @param string $columnValue
* @param string $cssClassColumnId
*
* @return string
* @throws CodeException
* @throws UserFormException
* @throws UserReportException
*/
private function renderCell(array $control, $columnName, $columnValue) {
private function renderCell(array $control, $columnName, $columnValue, $cssClassColumnId) {
$link = null;
switch ($columnName) {
......@@ -2751,6 +2755,9 @@ abstract class AbstractBuildForm {
$cell = $link->renderLink($columnValue);
}
if(strcasecmp($columnName, 'id')==0){
$cell = Support::wrapTag('<span class="'. $cssClassColumnId .'">', $cell,true);
}
return $cell;
}
......
......@@ -422,6 +422,8 @@ const SYSTEM_CSS_CLASS_QFQ_FORM = 'cssClassQfqForm';
const SYSTEM_CSS_CLASS_QFQ_FORM_PILL = 'cssClassQfqFormPill';
const SYSTEM_CSS_CLASS_QFQ_FORM_BODY = 'cssClassQfqFormBody';
const SYSTEM_CSS_CLASS_COLUMN_ID = 'cssClassColumnId';
// Textmessages used for Form validation.
const SYSTEM_FORM_DATA_PATTERN_ERROR = 'formDataPatternError';
const SYSTEM_FORM_DATA_REQUIRED_ERROR = 'formDataRequiredError';
......@@ -515,6 +517,7 @@ const SYSTEM_FORM_LANGUAGE_D_ID = 'formLanguageDId';
const SYSTEM_FORM_LANGUAGE_D_LABEL = 'formLanguageDLabel';
const SYSTEM_ENTER_AS_SUBMIT = 'enterAsSubmit';
const SYSTEM_SHOW_ID_IN_FORM_TITLE = 'showIdInFormTitle';
const SYSTEM_CMD_WKHTMLTOPDF = 'cmdWkhtmltopdf';
......@@ -864,6 +867,8 @@ const F_ORDER_INTERVAL = 'orderInterval';
const F_ORDER_COLUMN = 'orderColumn';
const F_ORDER_COLUMN_NAME = 'ord';
const F_SHOW_ID_IN_FORM_TITLE = SYSTEM_SHOW_ID_IN_FORM_TITLE;
// FORM_ELEMENT_STATI
const FE_MODE_SHOW = 'show';
const FE_MODE_READONLY = 'readonly';
......
......@@ -751,7 +751,7 @@ class QuickFormQuery {
$formSpec = HelperFormElement::setLanguage($formSpec, $parameterLanguageFieldName);
$formSpec = $this->syncSystemFormConfig($formSpec);
$formSpec = $this->initForm($formSpec);
$formSpec = $this->initForm($formSpec, $recordId);
$formSpec = array_merge($formSpec, $parseLater);
......@@ -980,7 +980,7 @@ class QuickFormQuery {
/**
* The named $keys will be synced between STORE_SYSTEM and $formSpec (both directions).
* The per form definition has precedence over STORE_SYSTEM.
* STORE_SYSTEM if filled with the default values (config.qfq.ini or if note exist than QFQ hardcoded)
* STORE_SYSTEM if filled with the default values (config.qfq.php or if note exist than QFQ hardcoded)
* Copying the 'Form' definition back to the system store helps to access the values
* by '{{ ...:Y}}' (system store). E.g. the value of bs-*-columns might be displayed as placeholder in the
* corresponding input field.
......@@ -1029,6 +1029,7 @@ class QuickFormQuery {
F_RECORD_LOCK_TIMEOUT_SECONDS,
FE_INPUT_EXTRA_BUTTON_INFO_CLASS,
F_SHOW_ID_IN_FORM_TITLE,
];
// By definition: existing vars which are empty, means: EMPTY - do not use any default!
......@@ -1056,12 +1057,13 @@ class QuickFormQuery {
* Set form parameter which are expected to exist.
*
* @param array $formSpec
* @param int $recordId
*
* @return array
* @throws CodeException
* @throws UserFormException
*/
private function initForm(array $formSpec) {
private function initForm(array $formSpec, $recordId) {
Support::setIfNotSet($formSpec, F_EXTRA_DELETE_FORM, '');
Support::setIfNotSet($formSpec, F_SUBMIT_BUTTON_TEXT, '');
......@@ -1088,6 +1090,11 @@ class QuickFormQuery {
$formSpec[F_ESCAPE_TYPE_DEFAULT] = $this->store->getVar(F_ESCAPE_TYPE_DEFAULT, STORE_SYSTEM);
}
// Append recordId to title
if($formSpec[F_SHOW_ID_IN_FORM_TITLE]=='1'){
$formSpec[F_TITLE] .= ($recordId==0) ? " (new)" : " ($recordId)";
}
return $formSpec;
}
......
......@@ -439,7 +439,7 @@ class Save {
}
if (!$requiredOff && $mode == FE_MODE_REQUIRED && empty($clientValues[$formElement[FE_NAME]])) {
throw new UserFormException("Missing required value.", ERROR_REQUIRED_VALUE_EMPTY);
throw new UserFormException("Missing required value: " . $formElement[FE_LABEL], ERROR_REQUIRED_VALUE_EMPTY);
}
if ($mode == FE_MODE_HIDDEN) {
......
......@@ -60,7 +60,7 @@ class Config {
if (!empty($arr[0]) && !empty($arr[1])) {
$arr[0] = trim($arr[0]);
$arr[1] = trim($arr[1]);
$arr[1] = OnString::trimQuote(trim($arr[1]));
if (isset($config[$arr[0]])) {
throw new UserReportException("Variable '$arr[0]' already defined", ERROR_INVALID_OR_MISSING_PARAMETER);
......
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