FIX Corrected page edit links in reports

This commit is contained in:
Ingo Schommer 2012-07-12 16:29:58 +02:00
parent 57c615d6b2
commit 8055fc2e7b
3 changed files with 14 additions and 4 deletions

View File

@ -80,11 +80,12 @@ class BrokenLinksReport extends SS_Report {
$dateTitle = _t('BrokenLinksReport.ColumnDateLastPublished', 'Date last published');
}
$linkBase = singleton('CMSPageEditController')->Link('show') . '/';
$fields = array(
"Title" => array(
"title" => _t('BrokenLinksReport.PageName', 'Page name'),
'formatting' => sprintf(
'<a href=\"admin/show/$ID\" title=\"%s\">$value</a>',
'<a href=\"' . $linkBase . '$ID\" title=\"%s\">$value</a>',
_t('BrokenLinksReport.HoverTitleEditPage', 'Edit page')
)
),
@ -97,7 +98,15 @@ class BrokenLinksReport extends SS_Report {
),
'AbsoluteLink' => array(
'title' => _t('BrokenLinksReport.ColumnURL', 'URL'),
'formatting' => '$value " . ($AbsoluteLiveLink ? "<a target=\"_blank\" href=\"$AbsoluteLiveLink\">(live)</a>" : "") . " <a target=\"_blank\" href=\"$value?stage=Stage\">(draft)</a>'
'formatting' => function($value, $item) {
$liveLink = $item->AbsoluteLiveLink;
$stageLink = $item->AbsoluteLink();
return sprintf('%s <a href="%s">%s</a>',
$stageLink,
$liveLink ? $liveLink : $stageLink . '?stage=Stage',
$liveLink ? '(live)' : '(draft)'
);
}
)
);

View File

@ -238,7 +238,7 @@ class SS_Report extends ViewableData {
}
// Add search fields is available
if($fields = $this->parameterFields()) {
if($this->hasMethod('parameterFields') && $fields = $this->parameterFields()) {
foreach($fields as $field) {
// Namespace fields for easier handling in form submissions
$field->setName(sprintf('filters[%s]', $field->getName()));

View File

@ -92,7 +92,8 @@ class SideReportView extends ViewableData {
}
if(isset($info['link']) && $info['link']) {
$link = ($info['link'] === true) ? "admin/show/$record->ID" : $info['link'];
$linkBase = singleton('CMSPageEditController')->Link('show') . '/';
$link = ($info['link'] === true) ? $linkBase . $record->ID : $info['link'];
return $prefix . "<a $classClause href=\"$link\">$val</a>";
} else {
return $prefix . "<span $classClause>$val</span>";