Permalink
Browse files

MINOR Changed ReportAdmin to new ReportAdmin_Content template, viewin…

…g available reports as unordered list instead of a tree (they can't be nested anyway)
  • Loading branch information...
1 parent d48f21a commit 1ae9a318afe337084f86a70bb755b343ca584932 @chillu chillu committed Apr 19, 2011
@@ -21,6 +21,8 @@ class ReportAdmin extends LeftAndMain {
static $template_path = null; // defaults to (project)/templates/email
+ static $tree_class = 'SS_Report';
+
public function init() {
parent::init();
@@ -32,7 +34,6 @@ public function init() {
// Always block the HtmlEditorField.js otherwise it will be sent with an ajax request
Requirements::block(SAPPHIRE_DIR . '/javascript/HtmlEditorField.js');
- Requirements::javascript(CMS_DIR . '/javascript/ReportAdmin.Tree.js');
}
/**
@@ -57,6 +58,12 @@ function canView($member = null) {
return false;
}
+ function currentPageID() {
+ $id = parent::currentPageID();
+ $reports = SS_Report::get_reports('ReportAdmin');
+ return (isset($reports[$id])) ? $reports[$id] : null;
+ }
+
/**
* Return a DataObjectSet of SS_Report subclasses
* that are available for use.
@@ -72,74 +79,6 @@ public function Reports() {
}
/**
- * Get EditForm for the class specified in request or in session variable
- *
- * @return Form
- */
- public function EditForm($request = null) {
- $className = Session::get('currentPage');
- $requestId = $request ? $request->requestVar('ID') : null;
-
- if ( $requestId )
- return $this->getEditForm($requestId);
-
- // $className can be null
- return $this->getEditForm($className);
-
- }
-
- /**
- * Return a Form instance with fields for the
- * particular report currently viewed.
- *
- * @param string $className Class of the report to fetch
- * @return Form
- */
- public function getEditForm($className = null) {
- if (!$className) {
- return $form = $this->EmptyForm();
- }
-
-
- if (!class_exists($className)) {
- die("$className does not exist");
- }
-
- Session::set('currentPage', $className);
-
- $obj = new $className();
- if(!$obj->canView()) return Security::permissionFailure($this);
-
- $fields = $obj->getCMSFields();
-
- $idField = new HiddenField('ID');
- $idField->setValue($className);
- $fields->push($idField);
-
- $actions = new FieldSet();
-
- $form = new Form($this, 'EditForm', $fields, $actions);
-
- return $form;
- }
-
- /**
- * Get the current report
- *
- * @return SS_Report
- */
- public function CurrentReport() {
- $id = isset($_REQUEST['ID']) ? $_REQUEST['ID'] : ($this->getRequest()->latestParam('Action') == 'EditForm') ? Session::get('currentReport') : null;
-
- if($id) {
- foreach($this->Reports() as $report) {
- if($id == $report->ID()) return $report;
- }
- }
- return false;
- }
-
- /**
* Determine if we have reports and need
* to display the "Reports" main menu item
* in the CMS.
@@ -160,8 +99,4 @@ public function updatereport() {
}
}
-
-
-
-
-?>
+?>
@@ -0,0 +1,24 @@
+<div class="cms-content center" data-layout="{type: 'border'}">
+
+ <div class="cms-content-header north">
+ <h2><% _t('REPORTS','Reports') %></h2>
+ </div>
+
+
+ <div class="cms-content-tools west">
+
+ <ul class="ui-widget-content">
+ <% control Reports %>
+ <li id="record-$ID">
+ <a href="admin/reports/show/$ID" title="$TreeDescription">$TreeTitle</a>
+ </li>
+ <% end_control %>
+ </ul>
+
+ </div>
+
+ <div class="cms-content-form center ui-widget-content">
+ $EditForm
+ </div>
+
+</div>
@@ -1,14 +0,0 @@
-<% if Reports %>
- <ul id="sitetree" class="tree unformatted">
- <li id="record-$ID" class="Root">
- <a><% _t('REPORTS','Reports') %></a>
- <ul>
- <% control Reports %>
- <li id="record-$ID">
- <a href="admin/reports/show/$ID" title="$TreeDescription">$TreeTitle</a>
- </li>
- <% end_control %>
- </ul>
- </li>
- </ul>
-<% end_if %>
@@ -1,16 +0,0 @@
-<style>
- ul.tree a{
- background-image: url(cms/images/treeicons/reports-file.png);
- }
-</style>
-
-<div id="treepanes">
- <h3>
- <a href="#"><% _t('REPORTS','Reports') %></a>
- </h3>
-
- <div id="sitetree" data-url-tree="$Link(getsubtree)" data-url-savetreenode="$Link(savetreenode)" class="jstree jstree-apple">
- <% include ReportAdmin_SiteTree %>
- </div>
-
-</div>

0 comments on commit 1ae9a31

Please sign in to comment.