diff --git a/extension/qfq/qfq/AbstractBuildForm.php b/extension/qfq/qfq/AbstractBuildForm.php index a526044dc9d3fdc275d5554f2946485744ed2bc9..cacbe4743f4f33c6994dc0ccabe2934bbb1c78ff 100644 --- a/extension/qfq/qfq/AbstractBuildForm.php +++ b/extension/qfq/qfq/AbstractBuildForm.php @@ -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 diff --git a/extension/qfq/qfq/BuildFormBootstrap.php b/extension/qfq/qfq/BuildFormBootstrap.php index c0430c690ccb4aab38378c92c2ab75c3c6f47323..2148fc14bf1222c755c3e01d309069eafedc7eb8 100644 --- a/extension/qfq/qfq/BuildFormBootstrap.php +++ b/extension/qfq/qfq/BuildFormBootstrap.php @@ -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); } diff --git a/extension/qfq/qfq/BuildFormTable.php b/extension/qfq/qfq/BuildFormTable.php index 559ab69f5394120efca3e46a3ef35d0443834058..4e14e8aa470dfe3bf229383029b86bff2da598aa 100644 --- a/extension/qfq/qfq/BuildFormTable.php +++ b/extension/qfq/qfq/BuildFormTable.php @@ -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>'; diff --git a/extension/qfq/qfq/Constants.php b/extension/qfq/qfq/Constants.php index f9c975d336b71c502d2f5a6ab5d79f6779bd4db8..e0def040b4f471e780b8a0bb82330387015e42e9 100644 --- a/extension/qfq/qfq/Constants.php +++ b/extension/qfq/qfq/Constants.php @@ -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