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'); $dateTitle = _t('BrokenLinksReport.ColumnDateLastPublished', 'Date last published');
} }
$linkBase = singleton('CMSPageEditController')->Link('show') . '/';
$fields = array( $fields = array(
"Title" => array( "Title" => array(
"title" => _t('BrokenLinksReport.PageName', 'Page name'), "title" => _t('BrokenLinksReport.PageName', 'Page name'),
'formatting' => sprintf( 'formatting' => sprintf(
'<a href=\"admin/show/$ID\" title=\"%s\">$value</a>', '<a href=\"' . $linkBase . '$ID\" title=\"%s\">$value</a>',
_t('BrokenLinksReport.HoverTitleEditPage', 'Edit page') _t('BrokenLinksReport.HoverTitleEditPage', 'Edit page')
) )
), ),
@ -97,7 +98,15 @@ class BrokenLinksReport extends SS_Report {
), ),
'AbsoluteLink' => array( 'AbsoluteLink' => array(
'title' => _t('BrokenLinksReport.ColumnURL', 'URL'), '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 // Add search fields is available
if($fields = $this->parameterFields()) { if($this->hasMethod('parameterFields') && $fields = $this->parameterFields()) {
foreach($fields as $field) { foreach($fields as $field) {
// Namespace fields for easier handling in form submissions // Namespace fields for easier handling in form submissions
$field->setName(sprintf('filters[%s]', $field->getName())); $field->setName(sprintf('filters[%s]', $field->getName()));

View File

@ -92,7 +92,8 @@ class SideReportView extends ViewableData {
} }
if(isset($info['link']) && $info['link']) { 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>"; return $prefix . "<a $classClause href=\"$link\">$val</a>";
} else { } else {
return $prefix . "<span $classClause>$val</span>"; return $prefix . "<span $classClause>$val</span>";