MINOR categorized reports, fixed a few translations issues.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@90394 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Tom Rix 2009-10-29 02:50:47 +00:00
parent e3d678f8ad
commit bb59c48078
3 changed files with 52 additions and 9 deletions

View File

@ -670,11 +670,24 @@ JS;
function ReportSelector() {
$reports = ClassInfo::subclassesFor("SideReport");
$options[""] = _t('CMSMain.CHOOSEREPORT',"(Choose a report)");
// $options[""] = _t('CMSMain.CHOOSEREPORT',"(Choose a report)");
foreach($reports as $report) {
if($report != 'SideReport' && singleton($report)->canView()) $options[$report] = singleton($report)->title();
if($report != 'SideReport' && singleton($report)->canView()) {
$options[singleton($report)->group()][singleton($report)->sort()][$report] = singleton($report)->title();
}
return new DropdownField("ReportSelector", _t('CMSMain.REPORT', 'Report'),$options);
}
$finalOptions = array();
foreach($options as $group => $weights) {
ksort($weights);
foreach($weights as $weight => $reports) {
foreach($reports as $class => $report) {
$finalOptions[$group][$class] = $report;
}
}
}
return new GroupedDropdownField("ReportSelector", _t('CMSMain.REPORT', 'Report'),$finalOptions);
}
function ReportFormParameters() {
$reports = ClassInfo::subclassesFor("SideReport");

View File

@ -12,6 +12,14 @@ abstract class SideReport extends Object {
abstract function fieldsToShow();
abstract function title();
function group() {
return 'Other';
}
function sort() {
return 0;
}
function getHTML() {
$records = $this->records();
$fieldsToShow = $this->fieldsToShow();
@ -89,7 +97,13 @@ abstract class SideReport extends Object {
*/
class SideReport_EmptyPages extends SideReport {
function title() {
return _t('SideReport.EMPTYPAGES',"Empty pages");
return _t('SideReport.EMPTYPAGES',"Pages with no content");
}
function group() {
return "Content reports";
}
function sort() {
return 100;
}
function records($params = null) {
return DataObject::get("SiteTree", "\"Content\" = '' OR \"Content\" IS NULL OR \"Content\" LIKE '<p></p>' OR \"Content\" LIKE '<p>&nbsp;</p>'", '"Title"');
@ -110,6 +124,12 @@ class SideReport_RecentlyEdited extends SideReport {
function title() {
return _t('SideReport.LAST2WEEKS',"Pages edited in the last 2 weeks");
}
function group() {
return "Content reports";
}
function sort() {
return 200;
}
function records($params = null) {
$threshold = strtotime('-14 days', SS_Datetime::now()->Format('U'));
return DataObject::get("SiteTree", "\"SiteTree\".\"LastEdited\" > '".date("Y-m-d H:i:s", $threshold)."'", "\"SiteTree\".\"LastEdited\" DESC");
@ -123,7 +143,13 @@ class SideReport_RecentlyEdited extends SideReport {
class SideReport_ToDo extends SideReport {
function title() {
return _t('SideReport.TODO',"To do");
return _t('SideReport.TODO',"Pages with To Do items");
}
function group() {
return "Content reports";
}
function sort() {
return 0;
}
function records($params = null) {
return DataObject::get("SiteTree", "\"SiteTree\".\"ToDo\" IS NOT NULL AND \"SiteTree\".\"ToDo\" <> ''", "\"SiteTree\".\"LastEdited\" DESC");
@ -154,6 +180,10 @@ class SideReport_BrokenLinks extends SideReport {
return _t('SideReport.BROKENPAGEFILELINKS', 'Broken Page & File Links');
}
function group() {
return "Broken links reports";
}
public function records() {
return DataObject::get('SiteTree', '"HasBrokenLink" = 1 OR "HasBrokenFile" = 1');
}

View File

@ -67,9 +67,9 @@ $lang['en_US']['CMSBatchActions']['UNPUBLISHED_PAGES'] = 'Un-published %d pages'
$lang['en_US']['CMSBatchActions']['UNPUBLISHING_PAGES'] = 'Un-publishing pages';
$lang['en_US']['CMSBatchActions']['UNPUBLISH_PAGES'] = 'Un-publish';
$lang['en_US']['CMSMain']['ACCESS'] = array(
'Access to \'%s\'',
'Access to %s',
PR_MEDIUM,
'Item in permission selection identifying the admin section, with title and classname. Example: Access to \'Files & Images\' (AssetAdmin)'
'Item in permission selection identifying the admin section, with title and classname. Example: Access to Files & Images'
);
$lang['en_US']['CMSMain']['ACCESSALLINTERFACES'] = 'Access to all CMS sections';
$lang['en_US']['CMSMain']['CANCEL'] = 'Cancel';
@ -463,14 +463,14 @@ $lang['en_US']['SecurityAdmin_right.ss']['WELCOME2'] = array(
50
);
$lang['en_US']['SideReport']['BROKENPAGEFILELINKS'] = 'Broken Page & File Links';
$lang['en_US']['SideReport']['EMPTYPAGES'] = 'Empty pages';
$lang['en_US']['SideReport']['EMPTYPAGES'] = 'Pages with no content';
$lang['en_US']['SideReport']['LAST2WEEKS'] = 'Pages edited in the last 2 weeks';
$lang['en_US']['SideReport']['REPEMPTY'] = array(
'The %s report is empty.',
PR_MEDIUM,
'%s is a report title'
);
$lang['en_US']['SideReport']['TODO'] = 'To do';
$lang['en_US']['SideReport']['TODO'] = 'Pages with To Do items';
$lang['en_US']['StaticExporter']['BASEURL'] = 'Base URL';
$lang['en_US']['StaticExporter']['EXPORTTO'] = 'Export to that folder';
$lang['en_US']['StaticExporter']['FOLDEREXPORT'] = 'Folder to export to';