Commit 34fe48b5 authored by Carsten  Rose's avatar Carsten Rose
Browse files

AbstractBuildForm: Subrecord Edit / New/ Delete are no longer renderer as links (blue)

BuildFormBootstrap: Top Button row moved on the same line as Title. Title will be dissappear on 'Extra Small Devices' (<768px). Class 'pull-right' for Button group removed. Some phpdoc created.
parent 5ecaa5d8
......@@ -38,7 +38,7 @@ class BuildFormBootstrap extends AbstractBuildForm {
$this->formSpec['class'] = 'container';
}
$this->formSpec['class'] = 'none';
// $this->formSpec['class'] = 'none';
}
/**
......@@ -96,12 +96,14 @@ class BuildFormBootstrap extends AbstractBuildForm {
$html .= '<div ' . $this->getAttribute('class', $this->formSpec['class'], TRUE) . '>'; // main <div class=...> around everything, Whole FORM; class="container" or class="container-fluid"
$html .= '<div class="row hidden-xs"><div class="col-md-12"><h2>' . $this->formSpec['title'] . '</h2></div></div>'; // Form Title
$title = Support::wrapTag('<div class="hidden-xs col-sm-6 col-md-8">', Support::wrapTag('<h3>', $this->formSpec['title']));
$button = Support::wrapTag('<div class="col-xs-12 col-sm-6 col-md-4">', $this->buildButtons());
// '<div class="row hidden-xs">
$html .= Support::wrapTag('<div class="row">', $title . $button);
$pill = $this->buildPillNavigation(OnArray::filter($this->feSpecNative, 'type', 'pill'));
$button = $this->buildButtons();
$html .= Support::wrapTag('<div class="row">', $pill . $button);
$pill = $this->buildPillNavigation(OnArray::filter($this->feSpecNative, 'type', 'pill'));
$html .= Support::wrapTag('<div class="row">', $pill);
$html .= $this->getFormTag();
......@@ -110,15 +112,76 @@ class BuildFormBootstrap extends AbstractBuildForm {
return $html;
}
/**
* Simlute Submit Button: http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml
*
* @return string
*/
private function buildButtons() {
$toolTipNew = 'New';
$toolTipDelete = 'Delete';
$buttonDelete = '';
$buttonNew = '';
if ($this->store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM) === 'yes') {
$toolTipNew .= PHP_EOL . "form = '" . $this->formSpec['name'] . "'" . PHP_EOL . "r = 0";
$toolTipDelete .= PHP_EOL . "table = '" . $this->formSpec['tableName'] . "'" . PHP_EOL . "r = '" . $this->store->getVar(SIP_RECORD_ID, STORE_SIP) . "'";
}
$sipParamString = OnArray::toString($this->store->getStore(STORE_SIP), ' = ', PHP_EOL, "'");
$formEditUrl = $this->createFormEditUrl();
$buttonDebug = <<<BUTTON
<div class="btn-group" role="group">
<button id="debug-button" type="button" class="btn btn-default navbar-btn" title="$sipParamString"><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>
BUTTON;
if (Support::findInSet(FORM_BUTTON_DELETE, $this->formSpec['showButton'])) {
$buttonDelete = <<<BUTTON
<div class="btn-group" role="group">
<button id="delete-button" type="button" class="btn btn-default navbar-btn" title="$toolTipDelete"><span class="glyphicon glyphicon-trash"></span></button>
</div>
BUTTON;
}
if (Support::findInSet(FORM_BUTTON_NEW, $this->formSpec['showButton'])) {
$buttonNew = <<<BUTTON
<div class="btn-group" role="group">
<button id="delete-button" type="button" class="btn btn-default navbar-btn" title="$toolTipNew"><span class="glyphicon glyphicon-plus"></span></button>
</div>
BUTTON;
}
$buttonFormEdit = ($this->store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM) === 'yes') ? $buttonDebug : '';
// <div class="btn-toolbar pull-right" role="toolbar">
$html = <<<BUTTON
<div class="btn-toolbar" role="toolbar">
$buttonFormEdit
<div class="btn-group" role="group">
<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>
$buttonDelete
$buttonNew
</div>
BUTTON;
return $html;
}
/**
* @param $pillArray
* @return string
* @throws UserException
*/
private function buildPillNavigation($pillArray) {
$htmlDropdown = '';
$pillButton = '';
$pillDropdown = '';
$htmlDropdown = '';
if ($pillArray == null)
return '';
......@@ -137,6 +200,7 @@ class BuildFormBootstrap extends AbstractBuildForm {
throw new UserException("Field 'name' and/or 'label' are empty", ERROR_NAME_LABEL_EMPTY);
}
// Anker for pill navigation
$a = '<a href="#' . $this->createAnker($formElement['id']) . '" data-toggle="tab">' . $formElement['label'] . '</a>';
if ($ii <= $maxVisiblePill) {
......@@ -155,7 +219,7 @@ class BuildFormBootstrap extends AbstractBuildForm {
}
$htmlDropdown = Support::wrapTag('<ul id="' . $this->getTabId() . '" class="nav nav-pills" role="tablist">', $pillButton . $htmlDropdown);
$htmlDropdown = Support::wrapTag('<div class="col-md-9">', $htmlDropdown);
$htmlDropdown = Support::wrapTag('<div class="col-md-12">', $htmlDropdown);
return $htmlDropdown;
}
......@@ -177,68 +241,6 @@ class BuildFormBootstrap extends AbstractBuildForm {
return 'qfqTabs';
}
/**
* Simlute Submit Button: http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml
*
* @return string
*/
private function buildButtons() {
$toolTipNew = 'New';
$toolTipDelete = 'Delete';
$buttonDelete = '';
$buttonNew = '';
if ($this->store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM) === 'yes') {
$toolTipNew .= PHP_EOL . "form = '" . $this->formSpec['name'] . "'" . PHP_EOL . "r = 0";
$toolTipDelete .= PHP_EOL . "table = '" . $this->formSpec['tableName'] . "'" . PHP_EOL . "r = '" . $this->store->getVar(SIP_RECORD_ID, STORE_SIP) . "'";
}
$sipParamString = OnArray::toString($this->store->getStore(STORE_SIP), ' = ', PHP_EOL, "'");
$formEditUrl = $this->createFormEditUrl();
$buttonDebug = <<<BUTTON
<div class="btn-group" role="group">
<button id="debug-button" type="button" class="btn btn-default navbar-btn" title="$sipParamString"><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>
BUTTON;
if (Support::findInSet(FORM_BUTTON_DELETE, $this->formSpec['showButton'])) {
$buttonDelete = <<<BUTTON
<div class="btn-group" role="group">
<button id="delete-button" type="button" class="btn btn-default navbar-btn" title="$toolTipDelete"><span class="glyphicon glyphicon-trash"></span></button>
</div>
BUTTON;
}
if (Support::findInSet(FORM_BUTTON_NEW, $this->formSpec['showButton'])) {
$buttonNew = <<<BUTTON
<div class="btn-group" role="group">
<button id="delete-button" type="button" class="btn btn-default navbar-btn" title="$toolTipNew"><span class="glyphicon glyphicon-plus"></span></button>
</div>
BUTTON;
}
$buttonFormEdit = ($this->store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM) === 'yes') ? $buttonDebug : '';
$html = <<<BUTTON
<div class="col-md-3 ">
<div class="btn-toolbar pull-right" role="toolbar">
$buttonFormEdit
<div class="btn-group" role="group">
<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>
$buttonDelete
$buttonNew
</div>
</div>
BUTTON;
return $html;
}
/**
* Builds the complete HTML '<form ...>'-tag
*
......@@ -319,6 +321,11 @@ EOF;
return $html;
}
/**
* @param $formElement
* @param $elementHtml
* @return string
*/
public function buildRowNative($formElement, $elementHtml) {
$html = '';
......@@ -331,6 +338,11 @@ EOF;
return $html;
}
/**
* @param $formElement
* @param $elementHtml
* @return string
*/
public function buildRowPill($formElement, $elementHtml) {
$html = '';
......@@ -345,10 +357,18 @@ EOF;
return $html;
}
/**
* @param $formElement
* @param $elementHtml
*/
public function buildRowFieldset($formElement, $elementHtml) {
}
/**
* @param $formElement
* @param $elementHtml
* @return string
*/
public function buildRowSubrecord($formElement, $elementHtml) {
$html = '';
$html .= $this->wrapItem(WRAP_SETUP_ELEMENT, $this->wrapItem(WRAP_SETUP_SUBRECORD, $formElement['label']));
......
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