diff --git a/extension/Classes/Core/QuickFormQuery.php b/extension/Classes/Core/QuickFormQuery.php index 48594cb1ec5b0f681bbd369ede6cc7a67d6200fe..a76ecc9c548393e6085cb3ec2a9153fc997ea48e 100644 --- a/extension/Classes/Core/QuickFormQuery.php +++ b/extension/Classes/Core/QuickFormQuery.php @@ -1670,9 +1670,10 @@ class QuickFormQuery { $html = ''; $beUserLoggedIn = $this->store->getVar(TYPO3_BE_USER, STORE_TYPO3, SANITIZE_ALLOW_ALNUMX); + $pageTitle = $this->store->getVar(TYPO3_PAGE_TITLE,STORE_TYPO3,SANITIZE_ALLOW_ALNUMX); if ($beUserLoggedIn && $this->inlineReport) { $html .= $this->buildInlineReport($this->t3data[T3DATA_UID] ?? null, $this->t3data[T3DATA_REPORT_PATH_FILENAME] ?? null, - $this->t3data[T3DATA_BODYTEXT_RAW] ?? '', $this->t3data[T3DATA_HEADER] ?? ''); + $this->t3data[T3DATA_BODYTEXT_RAW] ?? '', $this->t3data[T3DATA_HEADER] ?? '', $pageTitle ?? ''); } $html .= $report->process($this->t3data[T3DATA_BODYTEXT]); @@ -1690,7 +1691,7 @@ class QuickFormQuery { * @throws \CodeException * @throws \UserFormException */ - public static function buildInlineReport(?int $uid, ?string $reportPathFileNameFull, string $bodytext, string $header): string { + public static function buildInlineReport(?int $uid, ?string $reportPathFileNameFull, string $bodytext, string $header, string $pageTitle = ''): string { if ($uid === null) { return ''; } @@ -1698,6 +1699,12 @@ class QuickFormQuery { $showFormJs = '$("#tt-content-edit-' . $uid . '").toggleClass("hidden")'; $toggleBtn = Support::wrapTag("<a href='#' class='targetEditReport btn-xs btn-info' onclick='$showFormJs' style='float:right;'>", $icon); + if($reportPathFileNameFull !== '' && $reportPathFileNameFull !== null){ + $reportPathFileNameFullHtml = "<small>File: '$reportPathFileNameFull'</small>"; + }else{ + $reportPathFileNameFullHtml = ' '; + } + $saveBtnAttributes = Support::doAttribute('class', 'btn btn-default') . Support::doAttribute('id', "tt-content-save-$uid") . Support::doAttribute('type', 'submit') . @@ -1705,8 +1712,8 @@ class QuickFormQuery { Support::doAttribute('title', 'Save & Reload'); $saveBtnIcon = Support::renderGlyphIcon(GLYPH_ICON_CHECK); $saveBtn = Support::wrapTag("<button $saveBtnAttributes>", $saveBtnIcon); - $header = "QFQ Page Content '$header'.<br><small>File: '$reportPathFileNameFull'</small>"; - $headerBar = Support::wrapTag("<div class='col-md-12 qfq-form-title'>", $header . $saveBtn); + $header = "Page: '$pageTitle' Content (ID): '$header ($uid)'<br>$reportPathFileNameFullHtml"; + $headerBar = Support::wrapTag("<div class='col-md-12 qfq-form-title' style='position: sticky;top: 0;z-index: 1000;'>", $header . $saveBtn); $ttContentCode = Support::htmlEntityEncodeDecode(MODE_ENCODE, $bodytext); @@ -1715,7 +1722,6 @@ class QuickFormQuery { Support::doAttribute('id', "tt-content-code-$uid") . Support::doAttribute('name', REPORT_INLINE_BODYTEXT) . Support::doAttribute('class', 'qfq-codemirror') . - Support::doAttribute('rows', 20) . Support::doAttribute('data-config', $json, true); $codeBox = Support::wrapTag("<textarea $codeBoxAttributes>", $ttContentCode); diff --git a/javascript/src/Helper/codemirror.js b/javascript/src/Helper/codemirror.js index 25ce935c9319dec8b193015f065587b12ee539f0..eb7bec348d11ee778b9b2c716417a7b21bbe7471 100644 --- a/javascript/src/Helper/codemirror.js +++ b/javascript/src/Helper/codemirror.js @@ -99,7 +99,7 @@ $(document).ready(function(){ // function to create new window with given content for editing function newWindow(windowName) { - var w = window.open('',windowName, 'width=900,height=700'); + var w = window.open('//' + location.host + location.pathname + '?tt-content=' + windowName,windowName, 'width=900,height=700'); w.document.write(htmlContent); w.document.close(); } @@ -107,12 +107,6 @@ $(document).ready(function(){ // Show same content editor with refreshed data again after save. Control it with the given get parameter. First fetch only needed html content again (form) and open it in same window. var urlParams = new URLSearchParams(window.location.search); var ttContentParam = urlParams.get('tt-content'); - var pageId = urlParams.get('id'); - if(pageId === null){ - pageId = ''; - }else{ - pageId = 'id='+pageId+'&'; - } if(ttContentParam !== null && $(targetEditReportButton).next("#"+ttContentParam)[0] !== undefined){ var formContent = $($(targetEditReportButton).next("#"+ttContentParam)[0].outerHTML); @@ -122,23 +116,15 @@ $(document).ready(function(){ // execute changes(post) and reload page with id of tt-content as get parameter. Staying in same window with new content. $(externWindow).submit(function() { $.post($(externWindow).attr('action'),$(externWindow).serializeArray()); - $('<div style="text-align: right; margin-top: 10px;"><span style="background-color: green;" class="badge badge-success">Saved</span></div>') - .insertAfter('.btn-default') + $('<span style="position:absolute; top:5px; right:5px; background-color: green;" class="badge badge-success">Saved</span>') + .insertBefore('.qfq-form-title>br') .delay(3000) .fadeOut(function() { $(this).remove(); }); - if(window.location.search !== '?'+pageId+"tt-content="+$('form').attr('id')){ - window.location.href = '//' + location.host + location.pathname + "?" +pageId+ "tt-content=" + $('form').attr('id'); - } return false; }); - // Refresh new window with correct url - if($(externWindow).length !== 0 && window.location.search !== '?'+pageId+"tt-content="+$('form').attr('id')){ - window.location.href = '//' + location.host + location.pathname + "?" +pageId+ "tt-content=" + $('form').attr('id'); - } - // enable CodeMirror for extern window $(externWindow).children("[class=qfq-codemirror]").each( function () {