From 6c04383ebbd931120a8aeadea9b8dd7ac2f5dd7b Mon Sep 17 00:00:00 2001 From: Carsten Rose <carsten.rose@math.uzh.ch> Date: Sun, 21 May 2023 22:38:37 +0200 Subject: [PATCH] T3 V9 Updatewizard: add page uid an title to be reported. Inline Edit: add tt_content uid and header as tooltip. --- extension/Classes/Core/Database/DatabaseUpdate.php | 12 ++++++++---- extension/Classes/Core/QuickFormQuery.php | 9 +++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/extension/Classes/Core/Database/DatabaseUpdate.php b/extension/Classes/Core/Database/DatabaseUpdate.php index a6dcee7e4..105ba2221 100644 --- a/extension/Classes/Core/Database/DatabaseUpdate.php +++ b/extension/Classes/Core/Database/DatabaseUpdate.php @@ -498,11 +498,15 @@ class DatabaseUpdate { $KEY_SQL_UPDATE = 'sql_update'; // sql update statement for that blob // get reports from tt_content.bodytext - $reports = $this->db->sql("SELECT tt.`uid`, tt.`header`, tt.`bodytext`, tt.`hidden`, p.`hidden` AS pageHidden FROM `" . $dbT3 . "`.`tt_content` AS tt, `" . $dbT3 . "`.`pages` AS p WHERE tt.`CType`='qfq_qfq' AND tt.`deleted`=0 AND p.`deleted`=0 AND p.uid=tt.pid"); + $reports = $this->db->sql("SELECT tt.`uid`, tt.`header`, tt.`bodytext`, tt.`hidden`, p.`hidden` AS pageHidden," + . " p.`title` AS pageTitle, p.`uid` AS pageId FROM `" + . $dbT3 . "`.`tt_content` AS tt, `" . $dbT3 + . "`.`pages` AS p WHERE tt.`CType`='qfq_qfq' AND tt.`deleted`=0 AND p.`deleted`=0 AND p.uid=tt.pid"); $qfqCodeBlobs = array_map(function ($r) use ($dbT3, $KEY_SQL_UPDATE, $KEY_CONTENT, $KEY_TITLE) { $maybeHidden = (intval($r['hidden']) !== 0) || (intval($r['pageHidden']) !== 0); return [ - $KEY_TITLE => 'QFQ Report with uid=' . $r['uid'] . ' and header: ' . $r['header'] + $KEY_TITLE => 'QFQ Report with uid <u>' . $r['uid'] . '</u> and header <u>' . $r['header'] + . '</u> on page <u>' . $r['pageId'] . '/' . $r['pageTitle'] . '</u>' . ($maybeHidden ? '<br><small>Note: Content element is probably hidden / not in use.</small>' : ''), $KEY_CONTENT => $r['bodytext'], $KEY_SQL_UPDATE => "UPDATE `$dbT3`.`tt_content` SET `bodytext` = ? WHERE uid=" . $r['uid'] . ";" @@ -698,7 +702,7 @@ class DatabaseUpdate { . '<li>Use {{pageSlug:T}} instead of {{pageAlias:T}} or {{pageId:T}} in the _link columns. E.g. "p:{{pageSlug}}?foo=bar" AS link .</li>' . '<li>Use {{baseUrlLang:Y}}/{{pageSlug:T}} instead of {{pageAlias:T}} or {{pageId:T}} in hardcoded ' . htmlentities("<a>") . ' tags. E.g. href="{{baseUrlLang:Y}}/{{pageSlug:T}}?foo=bar".</li>' . '<li>Replace hardcoded aliases in QFQ code with the slugs of the pages. E.g. "p:/some/page?foo=bar" AS _link.</li>' - . '<li>Replace "U: ... &id=[alias]& ... " with "p:[slug]? ... " for all sepecial columns except _paged. I.e. "U: ... &id=[alias]& ... " becomes "p:[slug]? ... ". </li>' + . '<li>Replace "U: ... &id=[alias]& ... " with "p:[slug]? ... " for all special columns except _paged. I.e. "U: ... &id=[alias]& ... " becomes "p:[slug]? ... ". </li>' . '<li>Hint: Typo3 replaces "_" with "-" when converting an alias to a slug during the Typo3 version 9 upgrade.</li>' . '<li>Hint: A page slug always starts with a slash "/" and QFQ expects the slash to be there.</li>' . '<li>Note: After the page slug comes a "?" not a "&". E.g. "p:/some/page?foo=bar" AS _link. </li>' @@ -706,7 +710,7 @@ class DatabaseUpdate { . '<h2>AUTO SUGGESTIONS</h2>' - . 'In the report below the suggested changes are prominently marked with colour.' + . 'In the report below the suggested changes are prominently marked with color.' . "<br> If there is a $noSuggestionSymbol then there is no suggestion and you will have to fix it manually." . "<br> Tip: use ctrl+f and copy $noSuggestionSymbol into the search bar to quickly jump between matches." diff --git a/extension/Classes/Core/QuickFormQuery.php b/extension/Classes/Core/QuickFormQuery.php index 05eeb74e1..a1c4d3b89 100644 --- a/extension/Classes/Core/QuickFormQuery.php +++ b/extension/Classes/Core/QuickFormQuery.php @@ -1802,7 +1802,11 @@ class QuickFormQuery { if ($this->t3data[T3DATA_REPORT_PATH_FILENAME] !== '') { $bodytext = $this->t3data[T3DATA_BODYTEXT_RAW]; } - $html .= $this->buildInlineReport($this->t3data[T3DATA_UID] ?? null, $this->t3data[T3DATA_REPORT_PATH_FILENAME] ?? null, $this->dbArray[$this->dbIndexData], $bodytext ?? null); + + $tooltip = 'tt-content: uid=' . $this->t3data['uid'] . ', header=' . $this->t3data['header']; + $html .= $this->buildInlineReport($this->t3data[T3DATA_UID] ?? null, + $this->t3data[T3DATA_REPORT_PATH_FILENAME] ?? null, $this->dbArray[$this->dbIndexData], + $bodytext ?? null, null, null, $tooltip); } $html .= $report->process($this->t3data[T3DATA_BODYTEXT]); @@ -1827,7 +1831,8 @@ class QuickFormQuery { $t3vars = T3Info::getVars(); $icon = Support::renderGlyphIcon('glyphicon-edit'); $showFormJs = '$("#tt-content-edit-' . $uid . '").toggleClass("hidden")'; - $toggleBtn = Support::wrapTag("<a class='targetEditReport $btnClass' onclick='$showFormJs' style='float:right;' title='$btnTooltip'>", $icon . ' ' . $buttonText); + $toggleBtn = Support::wrapTag("<a class='targetEditReport $btnClass' onclick='$showFormJs' style='float:right;' title='" + . htmlentities($btnTooltip, ENT_QUOTES) . "'>", $icon . ' ' . $buttonText); $ttContentParam = $db->getBodyText($uid, false); $pageParam = $db->getPageParam($ttContentParam[COLUMN_PID], false); -- GitLab