Project

General

Profile

Feature #12447 » 12447_v2.diff

Steffen Kamper, 2011-01-25 11:58

View differences:

modfuncreport/class.tx_linkvalidator_modfuncreport.php (working copy)
/***************************************************************
* Copyright notice
*
* (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag)
* (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag)
* (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
* All rights reserved
*
......
$this->modTS = t3lib_BEfunc::getModTSconfig($this->pObj->id, 'mod.linkvalidator');
$this->modTS = $this->modTS['properties'];
}
$this->pObj->handleExternalFunctionValue();
$set = t3lib_div::_GP('SET');
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $linkType => $value) {
// Compile list of all available types. Used for checking with button "Check Links".
......
// Compile list of types currently selected by the checkboxes.
if ($this->pObj->MOD_SETTINGS[$linkType]) {
$this->checkOpt[$linkType] = 1;
$this->pObj->MOD_SETTINGS[$linkType] = 1;
}
if(is_array($set) && !$set[$linkType] ){
$this->pObj->MOD_SETTINGS[$linkType] = 0;
unset($this->checkOpt[$linkType]);
}
}
}
$GLOBALS['BE_USER']->pushModuleData('web_info', $this->pObj->MOD_SETTINGS);
$this->initialize();
// Setting up the context sensitive menu:
$this->resPath = $this->doc->backPath . t3lib_extMgm::extRelPath('linkvalidator') . 'res/';
$this->pageRenderer = $this->doc->getPageRenderer();
// Localization
$labels = tx_em_Tools::getArrayFromLocallang(t3lib_extMgm::extPath('linkvalidator', 'modfuncreport/locallang.xml'));
$this->pageRenderer->addInlineLanguageLabelArray($labels);
// Add JS
$this->pageRenderer->addJsFile($this->doc->backPath . '../t3lib/js/extjs/ux/Ext.ux.FitToParent.js');
$this->pageRenderer->addJsFile($this->doc->backPath . '../t3lib/js/extjs/ux/flashmessages.js');
$this->pageRenderer->addJsFile($this->doc->backPath . 'js/extjs/iframepanel.js');
if ($this->modTS['showUpdateButton'] == 1) {
$this->updateListHtml = '<input type="submit" name="updateLinkList" value="' . $GLOBALS['LANG']->getLL('label_update') . '"/>';
}
......
$brokenLinkOverView = $this->processor->getLinkCounts($this->pObj->id);
$this->checkOptHtml = $this->getCheckOptions($brokenLinkOverView);
$this->createTabs();
return '<div id="linkvalidator-modfuncreport"></div>';
}
/**
* Create TabPanel to split the report and the checklinks functions
*
* @return void
*/
protected function createTabs(){
$panelCheck = '';
if ($this->modTS['showUpdateButton'] == 1) {
$panelCheck = '{
title: TYPO3.lang.CheckLink,
html: ' . json_encode($this->flush()) . ',
}, ';
}
$this->render();
$js = 'var panel = new Ext.TabPanel( {
renderTo : "linkvalidator-modfuncreport",
id: "linkvalidator-main",
plain: true,
activeTab: 0,
autoScroll: true,
bodyStyle: "padding:10px;",
plugins: [new Ext.ux.plugins.FitToParent()],
items : [
{
title: TYPO3.lang.Report,
html: ' . json_encode($this->flush(TRUE)) . '
},
' . $panelCheck . '
]
return $this->flush();
});';
$this->pageRenderer->addExtOnReadyCode($js);
}
/**
* Initializes the menu array internally.
*
......
/**
* Flushes the rendered content to the browser.
*
* @param boolean $form
* @return void
*/
protected function flush() {
$content.= $this->doc->moduleBody(
protected function flush($form = FALSE) {
$content = $this->doc->moduleBody(
$this->pageRecord,
$this->getDocHeaderButtons(),
$this->getTemplateMarkers()
($form) ? $this->getTemplateMarkers(): $this->getTemplateMarkersCheck()
);
return $content;
......
* @return html Content of the table or of the note
*/
protected function renderBrokenLinksTable() {
$content = '';
$items = array();
$brokenLinkItems = '';
$items = $brokenLinksMarker = array();
$brokenLinkItems = $brokenLinksTemplate = '';
$keyOpt = array();
if (is_array($this->checkOpt)) {
......
* @return string Code of content
*/
protected function startTable() {
global $TYPO3_CONF_VARS;
// Listing head
$makerTableHead = array();
......
*
* @param string $table Name of database table
* @param array $row Record row to be processed
* @param string $brokenLinksItemTemplate Markup of the template to be used
* @param array $brokenLinksItemTemplate Markup of the template to be used
* @return string HTML of the rendered row
*/
protected function renderTableRow($table, array $row, $brokenLinksItemTemplate) {
......
$markerArray['actionlink'] = $actionLinks;
$markerArray['path'] = t3lib_BEfunc::getRecordPath($row['record_pid'], '', 0, 0);
$markerArray['element'] = $element;
$markerArray['element'] = $element;
$markerArray['headlink'] = $row['link_title'];
$markerArray['linktarget'] = $brokenUrl;
......
* @return string code content
*/
protected function getCheckOptions(array $brokenLinkOverView) {
$content = '';
$checkOptionsTemplate = '';
$markerArray = array();
$checkOptionsTemplate = t3lib_parsehtml::getSubpart($this->doc->moduleTemplate, '###CHECKOPTIONS_SECTION###');
$hookSectionContent = '';
$hookSectionTemplate = t3lib_parsehtml::getSubpart($checkOptionsTemplate, '###HOOK_SECTION###');
$markerArray['statistics_header'] = $this->doc->sectionHeader($GLOBALS['LANG']->getLL('overviews.statistics.header'));
$markerArray['statistics_header'] = $this->doc->sectionHeader($GLOBALS['LANG']->getLL('report.statistics.header'));
$totalCountLabel = $GLOBALS['LANG']->getLL('overviews.nbtotal');
$totalCountLabel = t3lib_BEfunc::wrapInHelp('linkvalidator', 'checkboxes', $totalCountLabel);
......
}
$translation = $GLOBALS['LANG']->getLL('hooks.' . $type);
$translation = $translation ? $translation : $type;
$option = t3lib_BEfunc::getFuncCheck(
array('id' => $this->pObj->id, 'search_levels' => $this->searchLevel),
'SET[' . $type . ']',
$this->pObj->MOD_SETTINGS[$type],
'',
'',
'id="SET[' . $type . ']"'
) . '<label for="SET[' . $type . ']">' . $translation . '</label>';
$option = '<input type="checkbox" id="SET[' . $type . ']" name="SET[' . $type . ']" value="1"' . ($this->pObj->MOD_SETTINGS[$type] ? ' checked="checked"' : '') .
'/>'.'<label for="SET[' . $type . ']">' . htmlspecialchars( $translation ) . '</label>' ;
$hookSectionMarker['option'] = $option;
$hookSectionContent .= t3lib_parsehtml::substituteMarkerArray($hookSectionTemplate, $hookSectionMarker, '###|###', TRUE, TRUE);
}
......
*/
protected function loadHeaderData() {
$this->doc->addStyleSheet('linkvalidator', $this->relativePath . 'res/linkvalidator.css', 'linkvalidator');
$this->doc->getPageRenderer()->addJsFile($this->doc->backPath . '../t3lib/js/wxtjs/ux/Ext.ux.FitToParent.js');
}
......
}
return $result;
}
/**
* construct the Hint message displayed on top of the module.
* Gets the filled markers that are used in the HTML template.
*
* @return string Hint message displayed on top of the module.
* @return array The filled marker array
*/
protected function getFirstSteps(){
$firstSteps = $GLOBALS['LANG']->getLL('first.steps');
protected function getTemplateMarkers() {
$markers = array(
'FUNC_TITLE' =>$GLOBALS['LANG']->getLL('report.func.title'),
'CHECKOPTIONS_TITLE' =>$GLOBALS['LANG']->getLL('report.statistics.header'),
'FUNC_MENU' => $this->getLevelSelector(),
'CONTENT' => $this->content,
'CHECKALLLINK' => $this->checkAllHtml,
'CHECKOPTIONS' => $this->checkOptHtml,
'ID' => '<input type="hidden" name="id" value="' . $this->pObj->id . '"/>',
'REFRESH' => $this->refreshListHtml,
'UPDATE' => ''
);
if ($this->modTS['showUpdateButton'] == 1) {
$firstSteps .= ' ' . $GLOBALS['LANG']->getLL('first.steps.info.update.button');
}
if (t3lib_extMgm::isLoaded('scheduler')) {
if ($GLOBALS['BE_USER']->isAdmin()) {
$firstSteps .= ' ' .
sprintf($GLOBALS['LANG']->getLL('first.steps.info.scheduler'),
'<a href="' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'typo3/mod.php?M=tools_txschedulerM1">', '</a>'
);
} else {
$firstSteps .= ' ' . $GLOBALS['LANG']->getLL('first.steps.info.scheduler.admin');
}
}
return $firstSteps;
return $markers;
}
/**
......
*
* @return array The filled marker array
*/
protected function getTemplateMarkers() {
protected function getTemplateMarkersCheck() {
$markers = array(
'FIRST_STEPS' => $this->getFirstSteps(),
'FUNC_TITLE' =>$GLOBALS['LANG']->getLL('checklinks.func.title'),
'CHECKOPTIONS_TITLE' =>$GLOBALS['LANG']->getLL('checklinks.statistics.header'),
'FUNC_MENU' => $this->getLevelSelector(),
'CONTENT' => $this->content,
'TITLE' => $GLOBALS['LANG']->getLL('title'),
'CONTENT' => '',
'CHECKALLLINK' => $this->checkAllHtml,
'CHECKOPTIONS' => $this->checkOptHtml,
'ID' => '<input type="hidden" name="id" value="' . $this->pObj->id . '"/>',
'REFRESH' => $this->refreshListHtml,
'REFRESH' => '',
'UPDATE' => $this->updateListHtml
);
modfuncreport/locallang.xml (working copy)
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="title">Check Links</label>
<label index="menu.introduction">Introduction</label>
<label index="menu.checkLinks">Check Links for validity</label>
<label index="menu.overview">Overview of links on website</label>
......
<label index="overview.branch.links">External links:</label>
<label index="overview.attention.header">Attention:</label>
<label index="overview.attention.text">Checking links may take up to several minutes. Checking ONE link can last up to 3 seconds.</label>
<label index="first.steps">Choose the level of pages to check and press "Refresh display" to show the results.</label>
<label index="first.steps.info.update.button">You can update the stored results by pressing "Check links". Note that this process can take some time.</label>
<label index="first.steps.info.scheduler">Alternatively you can also configure the %sTYPO3 Scheduler%s to update the stored results regularly.</label>
<label index="first.steps.info.scheduler.admin">Alternatively your administrator can also configure the TYPO3 Scheduler to update the stored results regularly.</label>
<label index="label_refresh">Refresh display</label>
<label index="label_update">Check links</label>
<label index="overviews.statistics.header">Statistics of broken Links</label>
<label index="report.statistics.header">Show those type of broken links</label>
<label index="checklinks.statistics.header">Check those type of broken links</label>
<label index="overviews.nbtotal">Broken links total:</label>
<label index="hooks.db">Internal Links:</label>
<label index="hooks.file">File Links:</label>
......
<label index="list.report.couldnotresolvehost">Could not resolve host. The given remote host was not resolved.</label>
<label index="list.report.errornetworkdata">Failure with receiving network data.</label>
<label index="list.msg.ok">Ok</label>
<label index="Report">Report</label>
<label index="CheckLink">Check Links</label>
<label index="report.func.title">Show this level</label>
<label index="checklinks.func.title">Check this level</label>
<label index="list.msg.lastRun">%1$s %2$s</label>
<label index="list.no.broken.links.title">No broken links to show!</label>
<label index="list.no.broken.links">There are no broken links to be displayed.</label>
modfuncreport/mod_template.html (working copy)
<!-- ###FULLDOC### begin -->
<h3>###TITLE###</h3>
<p id="linkvalidator_firstSteps">###FIRST_STEPS###</p>
<div class="linkvalidator_funcmenu">###FUNC_MENU######REFRESH######UPDATE###</div>
<div class="linkvalidator_checkoptions">
###ID###
###CHECKALLLINK###
###CHECKOPTIONS###
<div>###CHECKOPTIONS_TITLE###</div>
<div>###CHECKOPTIONS###</div>
</div>
<div class="linkvalidator_funcmenu"><div>###FUNC_TITLE###</div><div>###FUNC_MENU###</div></div>
<div class="linkvalidator_button">###REFRESH######UPDATE###</div>
###CONTENT###
<!-- ###FULLDOC### end -->
<!-- ###CHECKOPTIONS_SECTION### begin -->
###STATISTICS_HEADER###
<table class="typo3-dblist" id="linkvalidator_statsTable" cellspacing="0" cellpadding="0">
<tr class="t3-row-header">
<td>
res/linkvalidator.css (working copy)
#linkvalidator_firstSteps {
margin-bottom: 10px;
}
.linkvalidator_funcmenu {
margin-bottom: 25px;
margin-left:25px;
vertical-align:top;
float:left;
}
.linkvalidator_checkoptions div{
float:left;
}
.linkvalidator_checkoptions h4{
clear:both;
}
.linkvalidator_button{
clear:both;
}
.linkvalidator_funcmenu input {
margin-left: 5px;
}
.linkvalidator_checkoptions {
margin-bottom: 10px;
display:block;
margin-top:0px;
width:400px;
}
.linkvalidator_checkoptions .typo3-message {
(5-5/9)