Commit 36ec607d authored by Carsten  Rose's avatar Carsten Rose
Browse files

AbstractBuildForm: added array $symbol for plain/table/bs forms to visualize...

AbstractBuildForm: added array $symbol for plain/table/bs forms to visualize the buttons. Preparation for NEW Link in subrecords. Buttons with Tooltips.
BuildFormFormBootstrap: Buttons with Tooltips.
Constants: names for symbols
parent f4b213b9
......@@ -35,6 +35,7 @@ abstract class AbstractBuildForm {
protected $buildElementFunctionName = array();
protected $pattern = array();
protected $wrap = array();
protected $symbol = array();
// protected $feDivClass = array(); // Wrap FormElements in <div class="$feDivClass[type]">
private $formId = null;
......@@ -95,6 +96,9 @@ abstract class AbstractBuildForm {
'pill' => 'Pill'
];
$this->symbol['edit'] = "<span class='glyphicon glyphicon-pencil'></span>";
$this->symbol['new'] = "<span class='glyphicon glyphicon-plus'></span>";
$this->inputCheckPattern = OnArray::inputCheckPatternArray();
}
......@@ -999,12 +1003,17 @@ abstract class AbstractBuildForm {
// $html .= '<b>' . $formElement['label'] . '</b>';
// $html .= '<table border="1">';
$linkNew = $this->createFormLink($formElement, 0, array(), $this->symbol[SYMBOL_NEW], 'New');
$html .= '<p>' . $linkNew . '</p>';
$html .= '<table class="table">';
$html .= '<tr><th></th><th>' . implode('</th><th>', $control['title']) . '</th></tr>';
foreach ($formElement['sql1'] as $row) {
$html .= '<tr>';
$html .= '<td>' . $this->editLink($formElement, $row['id'], $primaryRecord) . '</td>';
$html .= '<td>' . $this->createFormLink($formElement, $row['id'], $primaryRecord, $this->symbol[SYMBOL_EDIT], 'Edit') . '</td>';
foreach ($row as $columnName => $value) {
$html .= '<td>' . $this->renderCell($control, $columnName, $value) . '</td>';
......@@ -1097,7 +1106,7 @@ abstract class AbstractBuildForm {
* @return string
* @throws UserException
*/
private function editLink($formElement, $targetRecordId, $record) {
private function createFormLink($formElement, $targetRecordId, $record, $symbol, $linkTitle) {
$queryStringArray = [
'form' => $formElement['form'],
......@@ -1132,7 +1141,7 @@ abstract class AbstractBuildForm {
$sip = $this->store->getSipInstance();
$url = $sip->queryStringToSip($queryString);
return "<a href='$url'><span class='glyphicon glyphicon-pencil'></span></a>";
return "<a href='$url' title='$linkTitle'>$symbol</a>";
}
/**
......
......@@ -185,14 +185,14 @@ class BuildFormBootstrap extends AbstractBuildForm {
$sipParamString = OnArray::toString($this->store->getStore(STORE_SIP), ':', ', ', "'");
$formEditUrl = $this->createFormEditUrl();
$tmp = <<<BUTTONS
$debugButtons = <<<BUTTONS
<div class="btn-group" role="group">
<button id="debug-button" type="button" class="btn btn-default navbar-btn"><span class="glyphicon glyphicon-eye-open"></span></button>
<a href="$formEditUrl" id="form-edit-button" class="btn btn-default navbar-btn"><span class="glyphicon glyphicon-wrench"></span></a>
<button id="debug-button" type="button" class="btn btn-default navbar-btn" title="not used at the moment"><span class="glyphicon glyphicon-eye-open"></span></button>
<a href="$formEditUrl" id="form-edit-button" class="btn btn-default navbar-btn" title="Edit form"><span class="glyphicon glyphicon-wrench"></span></a>
</div>
BUTTONS;
$formEditButton = ($this->store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM) === 'yes') ? $tmp : '';
$formEditButton = ($this->store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM) === 'yes') ? $debugButtons : '';
$html = <<<BUTTONS
......@@ -200,14 +200,14 @@ BUTTONS;
<div class="btn-toolbar pull-right" role="toolbar">
$formEditButton
<div class="btn-group" role="group">
<button id="save-button" type="button" class="btn btn-default navbar-btn"><span class="glyphicon glyphicon-ok"></span></button>
<button id="close-button" type="button" class="btn btn-default navbar-btn"><span class="glyphicon glyphicon-remove"></span></button>
<button id="save-button" type="button" class="btn btn-default navbar-btn" title="Save"><span class="glyphicon glyphicon-ok"></span></button>
<button id="close-button" type="button" class="btn btn-default navbar-btn" title="Close"><span class="glyphicon glyphicon-remove"></span></button>
</div>
<div class="btn-group" role="group">
<button id="delete-button" type="button" class="btn btn-default navbar-btn"><span class="glyphicon glyphicon-trash"></span></button>
<button id="delete-button" type="button" class="btn btn-default navbar-btn" title="Delete"><span class="glyphicon glyphicon-trash"></span></button>
</div>
<div class="btn-group" role="group">
<button id="new-button" type="button" class="btn btn-default navbar-btn"><span class="glyphicon glyphicon-plus"></span></button>
<button id="new-button" type="button" class="btn btn-default navbar-btn" title="New"><span class="glyphicon glyphicon-plus"></span></button>
</div>
</div>
</div>
......
......@@ -258,3 +258,5 @@ const API_ANSWER_REDIRECT_NO = 'no';
const API_ANSWER_REDIRECT_URL = 'url';
const SYMBOL_NEW = 'new';
const SYMBOL_EDIT = 'edit';
......@@ -165,12 +165,16 @@ VALUES
'{{!SELECT * FROM FormElement WHERE formId={{id:R0}}}}',
'', 'form=formElement', 5);
id, feIdContainer, enabled NAME label MODE class type checkType checkPattern onChange ord tabindex size maxLength note tooltip placeholder VALUE sql1 sql2 parameter clientJs feGroup debug deleted modified created
#
# FormEditor: FormElement
INSERT INTO Form (name, title, noteInternal, tableName, permitNew, permitEdit, render, multiSql, parameter) VALUES
('formElement', 'Form Element Editor : {{SELECT id, " / ", title FROM Form WHERE id = {{recordId:S0}}}}',
'Please secure the form',
'FormElement', 'always', 'always', 'bootstrap', '', 'maxVisiblePill=3');
'FormElement', 'always', 'always', 'bootstrap', '', 'maxVisiblePill=5');
# FormEditor: FormElements
INSERT INTO FormElement (id, formId, name, label, mode, type, class, ord, size, maxLength, note, clientJs, value, sql1, sql2, parameter, feIdContainer, debug)
......
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