From 06e8499070dc81bb5409a39f1bdfa7b068e4fa0c Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Mon, 21 Jan 2013 16:53:19 +1300 Subject: [PATCH] Remove outdated ReportAdmin assets --- code/controllers/ReportAdmin.php | 185 ---------------------- css/ReportAdmin.css | 0 css/_old/ReportAdmin.css | 11 -- templates/Includes/ReportAdmin_Content.ss | 20 --- templates/Includes/ReportAdmin_Tools.ss | 0 templates/ReportAdminForm.ss | 41 ----- 6 files changed, 257 deletions(-) delete mode 100644 code/controllers/ReportAdmin.php delete mode 100644 css/ReportAdmin.css delete mode 100644 css/_old/ReportAdmin.css delete mode 100644 templates/Includes/ReportAdmin_Content.ss delete mode 100644 templates/Includes/ReportAdmin_Tools.ss delete mode 100644 templates/ReportAdminForm.ss diff --git a/code/controllers/ReportAdmin.php b/code/controllers/ReportAdmin.php deleted file mode 100644 index 21067b78..00000000 --- a/code/controllers/ReportAdmin.php +++ /dev/null @@ -1,185 +0,0 @@ - 'handleAction' - ); - - /** - * Variable that describes which report we are currently viewing based on the URL (gets set in init method) - * @var String - */ - protected $reportClass; - - protected $reportObject; - - public function init() { - parent::init(); - - //set the report we are currently viewing from the URL - $this->reportClass = (isset($this->urlParams['ReportClass'])) ? $this->urlParams['ReportClass'] : null; - $allReports = SS_Report::get_reports(); - $this->reportObject = (isset($allReports[$this->reportClass])) ? $allReports[$this->reportClass] : null; - - Requirements::css(CMS_DIR . '/css/screen.css'); - - // Set custom options for TinyMCE specific to ReportAdmin - HtmlEditorConfig::get('cms')->setOption('ContentCSS', project() . '/css/editor.css'); - HtmlEditorConfig::get('cms')->setOption('Lang', i18n::get_tinymce_lang()); - - // Always block the HtmlEditorField.js otherwise it will be sent with an ajax request - Requirements::block(FRAMEWORK_DIR . '/javascript/HtmlEditorField.js'); - Requirements::javascript(CMS_DIR . '/javascript/ReportAdmin.js'); - } - - /** - * Does the parent permission checks, but also - * makes sure that instantiatable subclasses of - * {@link Report} exist. By default, the CMS doesn't - * include any Reports, so there's no point in showing - * - * @param Member $member - * @return boolean - */ - public function canView($member = null) { - if(!$member && $member !== FALSE) $member = Member::currentUser(); - - if(!parent::canView($member)) return false; - - $hasViewableSubclasses = false; - foreach($this->Reports() as $report) { - if($report->canView($member)) return true; - } - - return false; - } - - /** - * Return a SS_List of SS_Report subclasses - * that are available for use. - * - * @return SS_List - */ - public function Reports() { - $output = new ArrayList(); - foreach(SS_Report::get_reports() as $report) { - if($report->canView()) $output->push($report); - } - return $output; - } - - /** - * Determine if we have reports and need - * to display the "Reports" main menu item - * in the CMS. - * - * The test for an existance of a report - * is done by checking for a subclass of - * "SS_Report" that exists. - * - * @return boolean - */ - static public function has_reports() { - return sizeof(SS_Report::get_reports()) > 0; - } - - /** - * Returns the Breadcrumbs for the ReportAdmin - * @return ArrayList - */ - public function Breadcrumbs($unlinked = false) { - $items = parent::Breadcrumbs($unlinked); - - // The root element should explicitly point to the root node. - // Uses session state for current record otherwise. - $items[0]->Link = singleton('ReportAdmin')->Link(); - - if ($this->reportObject) { - //build breadcrumb trail to the current report - $items->push(new ArrayData(array( - 'Title' => $this->reportObject->title(), - 'Link' => Controller::join_links($this->Link(), '?' . http_build_query(array('q' => $this->request->requestVar('q')))) - ))); - } - - return $items; - } - - /** - * Returns the link to the report admin section, or the specific report that is currently displayed - * @return String - */ - public function Link($action = null) { - $link = parent::Link($action); - if ($this->reportObject) $link = $this->reportObject->getLink($action); - return $link; - } - - public function providePermissions() { - $title = _t("ReportAdmin.MENUTITLE", LeftAndMain::menu_title_for_class($this->class)); - return array( - "CMS_ACCESS_ReportAdmin" => array( - 'name' => _t('CMSMain.ACCESS', "Access to '{title}' section", array('title' => $title)), - 'category' => _t('Permission.CMS_ACCESS_CATEGORY', 'CMS Access') - ) - ); - } - - public function getEditForm($id = null, $fields = null) { - $report = $this->reportObject; - if($report) { - $fields = $report->getCMSFields(); - } else { - // List all reports - $fields = new FieldList(); - $gridFieldConfig = GridFieldConfig::create()->addComponents( - new GridFieldToolbarHeader(), - new GridFieldSortableHeader(), - new GridFieldDataColumns(), - new GridFieldFooter() - ); - $gridField = new GridField('Reports',false, $this->Reports(), $gridFieldConfig); - $columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns'); - $columns->setDisplayFields(array( - 'title' => _t('ReportAdmin.ReportTitle', 'Title'), - )); - $columns->setFieldFormatting(array( - 'title' => '$value' - )); - $gridField->addExtraClass('all-reports-gridfield'); - $fields->push($gridField); - } - - $actions = new FieldList(); - $form = new Form($this, "EditForm", $fields, $actions); - $form->addExtraClass('cms-edit-form cms-panel-padded center ' . $this->BaseCSSClasses()); - $form->loadDataFrom($this->request->getVars()); - - $this->extend('updateEditForm', $form); - - return $form; - } -} - diff --git a/css/ReportAdmin.css b/css/ReportAdmin.css deleted file mode 100644 index e69de29b..00000000 diff --git a/css/_old/ReportAdmin.css b/css/_old/ReportAdmin.css deleted file mode 100644 index 0f6bbca6..00000000 --- a/css/_old/ReportAdmin.css +++ /dev/null @@ -1,11 +0,0 @@ -#ReportSelector_holder { - background-color: #EEE; - border-bottom: 1px #CCC solid; - margin: 0; - padding: 3px; -} - -#right iframe.AWStatsReport { - width: 98%; - height: 85%; -} \ No newline at end of file diff --git a/templates/Includes/ReportAdmin_Content.ss b/templates/Includes/ReportAdmin_Content.ss deleted file mode 100644 index ff6c2419..00000000 --- a/templates/Includes/ReportAdmin_Content.ss +++ /dev/null @@ -1,20 +0,0 @@ -
- -
- <% with EditForm %> -
- <% include BackLink_Button %> - <% with Controller %> - <% include CMSBreadcrumbs %> - <% end_with %> -
- <% end_with %> -
- -
- - $EditForm - -
- -
\ No newline at end of file diff --git a/templates/Includes/ReportAdmin_Tools.ss b/templates/Includes/ReportAdmin_Tools.ss deleted file mode 100644 index e69de29b..00000000 diff --git a/templates/ReportAdminForm.ss b/templates/ReportAdminForm.ss deleted file mode 100644 index bc8e262b..00000000 --- a/templates/ReportAdminForm.ss +++ /dev/null @@ -1,41 +0,0 @@ -
- - -
-
- $FieldMap.ReportTitle.FieldHolder - $FieldMap.ReportDescription.FieldHolder - - <% if FieldMap.Filters.Children %> -

<% _t('ReportAdminForm.FILTERBY', 'Filter by') %>

- -
- <% loop FieldMap.Filters %> - <% loop Children %> - $FieldHolder - <% end_loop %> - <% end_loop %> -
- -
- <% if FieldMap.action_updatereport %> - $FieldMap.action_updatereport.Field - <% end_if %> -
- -
 
- <% end_if %> - - $FieldMap.ReportContent.FieldHolder - - <% loop HiddenFields %>$Field<% end_loop %> - -
-
- - -
-
\ No newline at end of file