Commit 05d5c676 authored by Carsten  Rose's avatar Carsten Rose
Browse files

#3447 / Icons das man im FrontEnd direkt das gewaehlte FormElement im...

#3447 / Icons das man im FrontEnd direkt das gewaehlte FormElement im Formulareditor bearbeiten kann
AbstractBuildForm.php, BuildFormBootstrap.php, BuildFormTable.php: Function createFormEditorUrl extended to accept parameter, to make it more generic (best would be to use the 'Link' class). Build the FormElement Edit symbol as together with debug stack symbols
parent 9c007b13
......@@ -206,11 +206,11 @@ abstract class AbstractBuildForm {
// Logged in BE User will see a FormEdit Link
$sipParamString = OnArray::toString($this->store->getStore(STORE_SIP), ':', ', ', "'");
$formEditUrl = $this->createFormEditUrl();
$formEditUrl = $this->createFormEditorUrl(FORM_NAME_FORM, $this->formSpec[F_ID]);
$html .= "<p><a " . Support::doAttribute('href', $formEditUrl) . ">Edit</a> <small>[$sipParamString]</small></p>";
$html .= $this->wrapItem(WRAP_SETUP_TITLE, $this->formSpec['title'], true);
$html .= $this->wrapItem(WRAP_SETUP_TITLE, $this->formSpec[F_TITLE], true);
$html .= $this->getFormTag();
......@@ -220,9 +220,13 @@ abstract class AbstractBuildForm {
/**
* If SHOW_DEBUG_INFO=yes: create a link (incl. SIP) to edit the current form. Show also the hidden content of the SIP.
*
* @param string $form FORM_NAME_FORM | FORM_NAME_FORM_ELEMENT
* @param int $recordId id of form or formElement
* @param array $param
* @return string String: <a href="?pageId&sip=....">Edit</a> <small>[sip:..., r:..., urlparam:..., ...]</small>
* @throws CodeException
*/
public function createFormEditUrl() {
public function createFormEditorUrl($form, $recordId, array $param = array()) {
if (!$this->showDebugInfo) {
return '';
......@@ -230,9 +234,10 @@ abstract class AbstractBuildForm {
$queryStringArray = [
'id' => $this->store->getVar(SYSTEM_EDIT_FORM_PAGE, STORE_SYSTEM),
'form' => 'form',
'r' => $this->formSpec['id']
'form' => $form,
'r' => $recordId
];
$queryStringArray = array_merge($queryStringArray, $param);
$queryString = Support::arrayToQueryString($queryStringArray);
......@@ -466,8 +471,16 @@ abstract class AbstractBuildForm {
if ($flagOutput) {
// debugStack as Tooltip
if ($this->showDebugInfo && count($debugStack) > 0) {
$elementHtml .= Support::doTooltip($formElement[FE_HTML_ID] . HTML_ID_EXTENSION_TOOLTIP, implode("\n", $debugStack));
if ($this->showDebugInfo) {
if (count($debugStack) > 0) {
$elementHtml .= Support::doTooltip($formElement[FE_HTML_ID] . HTML_ID_EXTENSION_TOOLTIP, implode("\n", $debugStack));
}
// Build 'FormElement' Edit symbol
$feEditUrl = $this->createFormEditorUrl(FORM_NAME_FORM_ELEMENT, $formElement[FE_ID], ['formId' => $formElement['formId']]);
$titleAttr = Support::doAttribute('title', $this->formSpec[FE_NAME] . ' / ' . $formElement[FE_NAME] . ' [' . $formElement[FE_ID] . ']');
$icon = Support::wrapTag('<span class="' . GLYPH_ICON . ' ' . GLYPH_ICON_EDIT . '">', '');
$elementHtml .= Support::wrapTag("<a href='$feEditUrl' $titleAttr>", $icon);
}
// Construct Marshaller Name: buildRow
......
......@@ -144,7 +144,7 @@ class BuildFormBootstrap extends AbstractBuildForm {
// Button: FormEdit
if ($this->showDebugInfo) {
$toolTip = "Edit form" . PHP_EOL . PHP_EOL . OnArray::toString($this->store->getStore(STORE_SIP), ' = ', PHP_EOL, "'");
$url = $this->createFormEditUrl();
$url = $this->createFormEditorUrl(FORM_NAME_FORM, $this->formSpec[F_ID]);
$buttonEditForm = $this->buildButtonAnchor('form-edit-button', $url, $toolTip, GLYPH_ICON_TOOL);
}
......
......@@ -76,13 +76,13 @@ class BuildFormTable extends AbstractBuildForm {
// Logged in BE User will see a FormEdit Link
$sipParamString = OnArray::toString($this->store->getStore(STORE_SIP), ':', ', ', "'");
$formEditUrl = $this->createFormEditUrl();
$formEditUrl = $this->createFormEditorUrl(FORM_NAME_FORM, $this->formSpec[F_ID]);
$html .= "<p><a " . Support::doAttribute('href', $formEditUrl) . ">Edit</a><small>[$sipParamString]</small></p>";
$deleteUrl = $this->createDeleteUrl($this->formSpec[F_FINAL_DELETE_FORM], '', $this->store->getVar(SIP_RECORD_ID, STORE_SIP));
$html .= "<p><a " . Support::doAttribute('href', $deleteUrl) . ">Delete</a>";
$html .= $this->wrapItem(WRAP_SETUP_TITLE, $this->formSpec['title'], true);
$html .= $this->wrapItem(WRAP_SETUP_TITLE, $this->formSpec[F_TITLE], true);
$html .= $this->getFormTag();
$html .= '<table>';
......
......@@ -525,6 +525,7 @@ const SUBRECORD_PARAMETER_FORM = CLIENT_FORM;
const SUBRECORD_PARAMETER_PAGE = 'page';
const SUBRECORD_PARAMETER_DETAIL = 'detail';
const GLYPH_ICON = 'glyphicon';
const GLYPH_ICON_EDIT = 'glyphicon-pencil';
const GLYPH_ICON_NEW = 'glyphicon-plus';
const GLYPH_ICON_DELETE = 'glyphicon-trash';
......@@ -787,3 +788,5 @@ const COLUMN_PAGEI = "pagei";
const COLUMN_PAGEN = "pagen";
const COLUMN_PAGES = "pages";
const FORM_NAME_FORM = 'form';
const FORM_NAME_FORM_ELEMENT = 'formElement';
\ No newline at end of file
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