Commit 3a864452 authored by Benni Mack's avatar Benni Mack Committed by Anja Leichsenring
Browse files

[TASK] Use Fluid within Linkvalidator backend module

This patch removes the marker-based template for Web=>Info=>Linkanalyzer
and replaces this with custom Fluid Views to move HTML generation out
of the PHP code as much as possible, and to remove the dependency
to DocumentTemplate.

Resolves: #90319
Releases: master
Change-Id: I700b6e07f0c7978bea2292d00698e3f659116406
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63173


Tested-by: Sybille Peters's avatarSybille Peters <sypets@gmx.de>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent 1590d581
......@@ -219,18 +219,6 @@ class LinkAnalyzer
}
}
/**
* Set that a recheck is necessary for recordUid / table combination in list
* of broken links.
*
* @param string $recordUid
* @param string $table
*/
public function setNeedsRecheck(string $recordUid, string $table): void
{
$this->brokenLinkRepository->setNeedsRecheckForRecord($table, (int)$recordUid);
}
/**
* Recheck for broken links for one field in table for record.
*
......@@ -475,13 +463,12 @@ class LinkAnalyzer
public function getLinkCounts()
{
$groupedResult = $this->brokenLinkRepository->getNumberOfBrokenLinksForRecordsOnPages($this->pids);
$markerArray = [];
$data = [];
foreach ($groupedResult as $linkType => $amount) {
$markerArray[$linkType] = $amount;
$markerArray['brokenlinkCount'] += $amount;
$data[$linkType] = $amount;
$data['brokenlinkCount'] += $amount;
}
return $markerArray;
return $data;
}
/**
......
<div class="linkvalidator-check-options">
<input type="hidden" name="id" value="{pageId}" />
<h4><f:render section="OptionsTitle" /></h4>
<div>
<table class="table table-striped table-hover" id="linkvalidator-statistics-table">
<thead>
<tr>
<th>{options.totalCountLabel -> f:format.raw()}</th>
<th class="number"><span class="badge">{options.totalCount}</span></th>
</tr>
</thead>
<tbody>
<f:for each="{options.optionsByType}" as="optionByType">
<tr>
<td>{optionByType.checkbox -> f:format.raw()}{optionByType.label -> f:format.raw()}</td>
<td class="number"><span class="badge">{optionByType.count}</span></td>
</tr>
</f:for>
</tbody>
</table>
<input type="hidden" name="{prefix}_values" value="1">
</div>
</div>
<div class="linkvalidator-function-menu">
<h4><f:render section="levelTitle" /></h4>
<div>
<select name="{prefix}_search_levels" class="form-control">
<option value="0"{f:if(condition: '{selectedLevel} == 0', then: 'selected')}><f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_0" /></option>
<option value="1"{f:if(condition: '{selectedLevel} == 1', then: 'selected')}><f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_0" /></option>
<option value="2"{f:if(condition: '{selectedLevel} == 2', then: 'selected')}><f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_0" /></option>
<option value="3"{f:if(condition: '{selectedLevel} == 3', then: 'selected')}><f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_0" /></option>
<option value="4"{f:if(condition: '{selectedLevel} == 4', then: 'selected')}><f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_0" /></option>
<option value="999"{f:if(condition: '{selectedLevel} == 999', then: 'selected')}><f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_infi" /></option>
</select>
</div>
</div>
<div class="linkvalidator-button"><f:render section="Button" /></div>
<f:render section="Main" optional="true" />
<f:layout name="TabContent" />
<f:section name="OptionsTitle">
<f:translate key="LLL:EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf:checklinks.statistics.header" />
</f:section>
<f:section name="levelTitle">
<f:translate key="LLL:EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf:checklinks.func.title" />
</f:section>
<f:section name="Button">
<input type="submit" class="btn btn-default t3js-update-button" name="updateLinkList" id="updateLinkList" value="{f:translate(key: 'LLL:EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf:label_update')}"
data-notification-message="{f:translate(key: 'LLL:EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf:label_update-link-list')}" />
</f:section>
<div id="linkvalidator-modfuncreport">
<f:if condition="{title}">
<h1>{title}</h1>
</f:if>
{content -> f:format.raw()}
</div>
<f:layout name="TabContent" />
<f:section name="OptionsTitle">
<f:translate key="LLL:EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf:report.statistics.header" />
</f:section>
<f:section name="levelTitle">
<f:translate key="LLL:EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf:report.func.title" />
</f:section>
<f:section name="Main">
<h3><f:translate key="LLL:EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf:list.header" /></h3>
<f:if condition="{brokenLinks -> f:count()}">
<f:then>
<table class="table table-striped table-hover" id="linkvalidator-broken-links-table">
<thead>
<tr>
<th>{tableheadElement -> f:format.raw()}</th>
<th>{tableheadPath -> f:format.raw()}</th>
<th>{tableheadHeadlink -> f:format.raw()}</th>
<th>{tableheadLinktarget -> f:format.raw()}</th>
<th>{tableheadLinkmessage -> f:format.raw()}</th>
<th>{tableheadLastcheck -> f:format.raw()}</th>
<th></th>
</tr>
</thead>
<tbody>
<f:for each="{brokenLinks}" as="item">
<tr>
<td><a href="{item.editUrl}" title="{f:translate(key: 'LLL:EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf:list.edit')}">{item.element -> f:format.raw()}</a></td>
<td>{item.path -> f:format.raw()}</td>
<td>{item.link_title -> f:format.raw()}</td>
<td><a href="{item.linktarget}" target="_blank" rel="noreferrer">{item.linktarget}</a></td>
<td>{item.linkmessage -> f:format.raw()}</td>
<td>{item.lastcheck -> f:format.raw()}<f:if condition="{item.needsRecheck}"><br /><span class="error"> ({f:translate(key: 'LLL:EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf:needs-recheck')})</span></f:if>
</td>
<td><a href="{item.editUrl}" title="{f:translate(key: 'LLL:EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf:list.edit')}"><core:icon identifier="actions-open" size="small" /></a></td>
</tr>
</f:for>
</tbody>
</table>
</f:then>
<f:else>
<f:flashMessages queueIdentifier="linkvalidator" />
</f:else>
</f:if>
</f:section>
<f:section name="Button">
<input type="submit" class="btn btn-default t3js-update-button" name="refreshLinkList" id="refreshLinkList" value="{f:translate(key: 'LLL:EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf:label_refresh')}"
data-notification-message="{f:translate(key: 'LLL:EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf:label_refresh-link-list')}" />
</f:section>
<!-- ###FULLDOC### begin -->
<div class="linkvalidator-check-options">
###ID###
<h4>###CHECKOPTIONS_TITLE###</h4>
<div>###CHECKOPTIONS###</div>
</div>
<div class="linkvalidator-function-menu"><h4>###FUNC_TITLE###</h4><div>###FUNC_MENU###</div></div>
<div class="linkvalidator-button">###REFRESH######UPDATE###</div>
###CONTENT###
<!-- ###FULLDOC### end -->
<!-- ###CHECKOPTIONS_SECTION### begin -->
<table class="table table-striped table-hover" id="linkvalidator-statistics-table">
<thead>
<tr>
<th>###TOTAL_COUNT_LABEL###</th>
<th class="number"><span class="badge">###TOTAL_COUNT###</span></th>
</tr>
</thead>
<tbody>
<!-- ###HOOK_SECTION### begin -->
<tr>
<td>###OPTION###</td>
<td class="number"><span class="badge">###COUNT###</span></td>
</tr>
<!-- ###HOOK_SECTION### end -->
</tbody>
</table>
<!-- ###CHECKOPTIONS_SECTION### end -->
<!-- ###BROKENLINKS_CONTENT### begin -->
###LIST_HEADER###
<table class="table table-striped table-hover" id="linkvalidator-broken-links-table">
<thead>
<tr>
<th>###TABLEHEAD_ELEMENT###</th>
<th>###TABLEHEAD_PATH###</th>
<th>###TABLEHEAD_HEADLINK###</th>
<th>###TABLEHEAD_LINKTARGET###</th>
<th>###TABLEHEAD_LINKMESSAGE###</th>
<th>###TABLEHEAD_LASTCHECK###</th>
<th></th>
</tr>
</thead>
<tbody>
<!-- ###BROKENLINKS_ITEM### begin -->
<tr>
<td>###ACTIONLINKOPEN######ELEMENT######ACTIONLINKCLOSE###</td>
<td>###PATH###</td>
<td>###HEADLINK###</td>
<td><a href="###LINKTARGET###" target="_blank" rel="noreferrer">###LINKTARGET###</a></td>
<td>###LINKMESSAGE###</td>
<td>###LASTCHECK###</td>
<td>###ACTIONLINKOPEN######ACTIONLINKICON######ACTIONLINKCLOSE###</td>
</tr>
<!-- ###BROKENLINKS_ITEM### end -->
</tbody>
</table>
<!-- ###BROKENLINKS_CONTENT### end -->
<!-- ###NOBROKENLINKS_CONTENT### begin -->
###LIST_HEADER###
###NO_BROKEN_LINKS###
<!-- ###NOBROKENLINKS_CONTENT### end -->
Supports Markdown
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