From 76d3b27335145459e1b9da4e07cf37ad8bd050c1 Mon Sep 17 00:00:00 2001
From: nickw
Date: Tue, 25 May 2010 22:18:22 +0000
Subject: Updating administration plugins with admin submenu views.
git-svn-id: http://code.elgg.org/elgg/trunk@6220 36083f99-b078-4883-b0ff-0f9b5a30f544
---
mod/defaultwidgets/actions/update.php | 4 +-
mod/defaultwidgets/dashboard.php | 31 ----------
mod/defaultwidgets/profile.php | 31 ----------
mod/defaultwidgets/start.php | 48 +--------------
.../admin/appearance/default_dashboard_widgets.php | 21 +++++++
.../admin/appearance/default_profile_widgets.php | 21 +++++++
mod/logbrowser/index.php | 64 --------------------
mod/logbrowser/start.php | 26 +--------
.../views/default/admin/overview/logbrowser.php | 68 ++++++++++++++++++++++
mod/logbrowser/views/default/logbrowser/form.php | 46 +++++++--------
mod/profile/defaultprofile.php | 55 -----------------
mod/profile/start.php | 25 +-------
.../default/admin/appearance/defaultprofile.php | 51 ++++++++++++++++
mod/reportedcontent/actions/archive.php | 63 +++++++++-----------
mod/reportedcontent/actions/delete.php | 68 ++++++++++------------
mod/reportedcontent/index.php | 27 ---------
mod/reportedcontent/start.php | 29 ++-------
.../default/admin/overview/reportedcontent.php | 27 +++++++++
18 files changed, 284 insertions(+), 421 deletions(-)
delete mode 100644 mod/defaultwidgets/dashboard.php
delete mode 100644 mod/defaultwidgets/profile.php
create mode 100644 mod/defaultwidgets/views/default/admin/appearance/default_dashboard_widgets.php
create mode 100644 mod/defaultwidgets/views/default/admin/appearance/default_profile_widgets.php
delete mode 100644 mod/logbrowser/index.php
create mode 100644 mod/logbrowser/views/default/admin/overview/logbrowser.php
delete mode 100644 mod/profile/defaultprofile.php
create mode 100644 mod/profile/views/default/admin/appearance/defaultprofile.php
delete mode 100644 mod/reportedcontent/index.php
create mode 100644 mod/reportedcontent/views/default/admin/overview/reportedcontent.php
diff --git a/mod/defaultwidgets/actions/update.php b/mod/defaultwidgets/actions/update.php
index aaf03430d..056ee6cec 100644
--- a/mod/defaultwidgets/actions/update.php
+++ b/mod/defaultwidgets/actions/update.php
@@ -49,13 +49,13 @@ if ($context && isset ( $leftbar ) && isset ( $middlebar ) && isset ( $rightbar
forward ( 'pg/admin' );
} else {
register_error ( elgg_echo ( 'defaultwidgets:update:failed' ) );
- forward ( 'pg/defaultwidgets/' . $context );
+ forward("pg/admin/appearance/default_{$context}_widgets");
}
} else {
// report incorrect parameters error
register_error ( elgg_echo ( 'defaultwidgets:update:noparams' ) );
- forward ( 'pg/defaultwidgets/' . $context );
+ forward("pg/admin/appearance/default_{$context}_widgets");
}
diff --git a/mod/defaultwidgets/dashboard.php b/mod/defaultwidgets/dashboard.php
deleted file mode 100644
index 86f96cb67..000000000
--- a/mod/defaultwidgets/dashboard.php
+++ /dev/null
@@ -1,31 +0,0 @@
- $token, 'ts' => $ts, 'context' => $context ) );
-
-// Display main admin menu
-page_draw('Default dashboard widgets for new users', elgg_view_layout('administration', $content));
diff --git a/mod/defaultwidgets/profile.php b/mod/defaultwidgets/profile.php
deleted file mode 100644
index 69640a845..000000000
--- a/mod/defaultwidgets/profile.php
+++ /dev/null
@@ -1,31 +0,0 @@
- $token, 'ts' => $ts, 'context' => $context ) );
-
-// Display main admin menu
-page_draw('Default profile widgets for new users', elgg_view_layout('administration', $content));
diff --git a/mod/defaultwidgets/start.php b/mod/defaultwidgets/start.php
index 1143cafa6..ceebbe285 100644
--- a/mod/defaultwidgets/start.php
+++ b/mod/defaultwidgets/start.php
@@ -30,11 +30,6 @@ global $CONFIG;
* @param unknown_type $object
*/
function defaultwidgets_init() {
- global $CONFIG;
-
- // Load system configuration
- register_page_handler ( 'defaultwidgets', 'defaultwidgets_page_handler' );
-
// register create user event hook
register_elgg_event_handler ( 'create', 'user', 'defaultwidgets_newusers' );
@@ -43,20 +38,9 @@ function defaultwidgets_init() {
register_elgg_event_handler('validate', 'user', 'defaultwidgets_reset_access');
}
- // Override metadata permissions
- //register_plugin_hook ( 'permissions_check:metadata', 'object', 'defaultwidgets_can_edit_metadata' );
-
- elgg_add_submenu_item(array(
- 'text' => elgg_echo('defaultwidgets:menu:profile'),
- 'href' => "{$CONFIG->wwwroot}pg/defaultwidgets/profile",
- 'parent_id' => 'appearance',
- ), 'admin', 'default');
-
- elgg_add_submenu_item(array(
- 'text' => elgg_echo('defaultwidgets:menu:dashboard'),
- 'href' => "{$CONFIG->wwwroot}pg/defaultwidgets/dashboard",
- 'parent_id' => 'appearance',
- ), 'admin', 'default');
+ // @todo These submenu pages should be DRYed up
+ elgg_add_admin_submenu_item('default_profile_widgets', elgg_echo('defaultwidgets:menu:profile'), 'appearance');
+ elgg_add_admin_submenu_item('default_dashboard_widgets', elgg_echo('defaultwidgets:menu:dashboard'), 'appearance');
}
/**
@@ -220,32 +204,6 @@ function defaultwidgets_reset_access($event, $object_type, $object) {
return true;
}
-/**
- * Default widgets page handler; allows the use of fancy URLs
- *
- * @param array $page From the page_handler function
- * @return true|false Depending on success
- */
-function defaultwidgets_page_handler($page) {
- global $CONFIG;
-
- if (isset ( $page [0] )) {
-
- switch ($page [0]) {
- case "profile" :
- include (dirname ( __FILE__ ) . "/profile.php");
- break;
- case "dashboard" :
- include (dirname ( __FILE__ ) . "/dashboard.php");
- break;
- }
- } else {
- register_error ( elgg_echo ( "defaultwidgets:admin:notfound" ) );
- forward ( $CONFIG->wwwroot );
- }
- return true;
-}
-
// Make sure the status initialisation function is called on initialisation
register_elgg_event_handler ( 'init', 'system', 'defaultwidgets_init' );
diff --git a/mod/defaultwidgets/views/default/admin/appearance/default_dashboard_widgets.php b/mod/defaultwidgets/views/default/admin/appearance/default_dashboard_widgets.php
new file mode 100644
index 000000000..e06f63f1d
--- /dev/null
+++ b/mod/defaultwidgets/views/default/admin/appearance/default_dashboard_widgets.php
@@ -0,0 +1,21 @@
+ generate_action_token($time),
+ 'ts' => $time,
+ 'context' => 'dashboard',
+));
diff --git a/mod/defaultwidgets/views/default/admin/appearance/default_profile_widgets.php b/mod/defaultwidgets/views/default/admin/appearance/default_profile_widgets.php
new file mode 100644
index 000000000..32350c6dd
--- /dev/null
+++ b/mod/defaultwidgets/views/default/admin/appearance/default_profile_widgets.php
@@ -0,0 +1,21 @@
+ generate_action_token($time),
+ 'ts' => $time,
+ 'context' => 'profile',
+));
diff --git a/mod/logbrowser/index.php b/mod/logbrowser/index.php
deleted file mode 100644
index c72e9fc23..000000000
--- a/mod/logbrowser/index.php
+++ /dev/null
@@ -1,64 +0,0 @@
-guid;
- }
- } else {
- $user_guid = get_input('user_guid',0);
- if ($user_guid) {
- $user = (int) $user_guid;
- } else {
- $user = "";
- }
- }
-
- $timelower = get_input('timelower');
- if ($timelower) $timelower = strtotime($timelower);
- $timeupper = get_input('timeupper');
- if ($timeupper) $timeupper = strtotime($timeupper);
-
- $title = elgg_view_title(elgg_echo('logbrowser'));
-
- // Get log entries
- $log = get_system_log($user, "", "", "","", $limit, $offset, false, $timeupper, $timelower);
- $count = get_system_log($user, "", "", "","", $limit, $offset, true, $timeupper, $timelower);
- $log_entries = array();
-
- foreach ($log as $l)
- {
- $tmp = new ElggObject();
- $tmp->subtype = 'logwrapper';
- $tmp->entry = $l;
- $log_entries[] = $tmp;
- }
-
- $form = elgg_view('logbrowser/form',array('user_guid' => $user, 'timeupper' => $timeupper, 'timelower' => $timelower));
-
- set_context('search');
- $result = elgg_view_entity_list($log_entries, $count, $offset, $limit, false, false);
- $result = "".$result."
";
- set_context('admin');
-
-// Display main admin menu
- page_draw(elgg_echo('logbrowser'),elgg_view_layout('administration', $title . $form . $result));
-
-?>
diff --git a/mod/logbrowser/start.php b/mod/logbrowser/start.php
index c8c830f00..378bab8f7 100644
--- a/mod/logbrowser/start.php
+++ b/mod/logbrowser/start.php
@@ -11,13 +11,9 @@
* Initialise the log browser and set up the menus.
*
*/
-function logbrowser_init()
-{
+function logbrowser_init() {
global $CONFIG;
- // Register a page handler, so we can have nice URLs
- register_page_handler('logbrowser','logbrowser_page_handler');
-
// Extend CSS
elgg_extend_view('css','logbrowser/css');
@@ -26,26 +22,8 @@ function logbrowser_init()
elgg_extend_view('profile/menu/adminlinks','logbrowser/adminlinks',10000);
}
- elgg_add_submenu_item(array(
- 'text' => elgg_echo('logbrowser'),
- 'href' => "{$CONFIG->wwwroot}pg/logbrowser",
- 'parent_id' => 'overview',
- ), 'admin', 'default');
+ elgg_add_admin_submenu_item('logbrowser', elgg_echo('logbrowser'), 'overview');
}
-/**
- * Log browser page handler
- *
- * @param array $page Array of page elements, forwarded by the page handling mechanism
- */
-function logbrowser_page_handler($page)
-{
- global $CONFIG;
-
- // only interested in one page for now
- include($CONFIG->pluginspath . "logbrowser/index.php");
-}
-
-
// Initialise log browser
register_elgg_event_handler('init','system','logbrowser_init');
diff --git a/mod/logbrowser/views/default/admin/overview/logbrowser.php b/mod/logbrowser/views/default/admin/overview/logbrowser.php
new file mode 100644
index 000000000..d82b1e00b
--- /dev/null
+++ b/mod/logbrowser/views/default/admin/overview/logbrowser.php
@@ -0,0 +1,68 @@
+guid;
+ }
+} else {
+ $user_guid = get_input('user_guid',0);
+ if ($user_guid) {
+ $user = (int) $user_guid;
+ } else {
+ $user = "";
+ }
+}
+
+$timelower = get_input('timelower');
+if ($timelower) {
+ $timelower = strtotime($timelower);
+}
+
+$timeupper = get_input('timeupper');
+if ($timeupper) {
+ $timeupper = strtotime($timeupper);
+}
+
+$title = elgg_view_title(elgg_echo('logbrowser'));
+
+$form = elgg_view('logbrowser/form', array(
+ 'user_guid' => $user,
+ 'timeupper' => $timeupper,
+ 'timelower' => $timelower,
+));
+
+// Get log entries
+$log = get_system_log($user, "", "", "","", $limit, $offset, false, $timeupper, $timelower);
+$count = get_system_log($user, "", "", "","", $limit, $offset, true, $timeupper, $timelower);
+$log_entries = array();
+
+foreach ($log as $l) {
+ $tmp = new ElggObject();
+ $tmp->subtype = 'logwrapper';
+ $tmp->entry = $l;
+ $log_entries[] = $tmp;
+}
+
+$list = elgg_view_entity_list($log_entries, $count, $offset, $limit, false, false);
+
+// display admin body
+$body = <<<__HTML
+$title
+$form
+
+ $list
+
+__HTML;
+
+echo $body;
diff --git a/mod/logbrowser/views/default/logbrowser/form.php b/mod/logbrowser/views/default/logbrowser/form.php
index d79e71d86..7c993e6a2 100644
--- a/mod/logbrowser/views/default/logbrowser/form.php
+++ b/mod/logbrowser/views/default/logbrowser/form.php
@@ -22,34 +22,32 @@
}
- $form = "";
-
- $form .= "" . elgg_echo('logbrowser:user');
- $form .= elgg_view('input/text',array(
- 'internalname' => 'search_username',
- 'value' => $userval
- )) . "
";
+ $form = "" . elgg_echo('logbrowser:user');
+ $form .= elgg_view('input/text', array(
+ 'internalname' => 'search_username',
+ 'value' => $userval,
+ )) . "
";
$form .= "" . elgg_echo('logbrowser:starttime');
- $form .= elgg_view('input/text',array(
- 'internalname' => 'timelower',
- 'value' => $lowerval
- )) . "
";
+ $form .= elgg_view('input/text', array(
+ 'internalname' => 'timelower',
+ 'value' => $lowerval,
+ )) . "
";
$form .= "" . elgg_echo('logbrowser:endtime');
- $form .= elgg_view('input/text',array(
- 'internalname' => 'timeupper',
- 'value' => $upperval
- )) . "
";
- $form .= elgg_view('input/submit',array(
- 'value' => elgg_echo('search')
- ));
-
- $wrappedform = elgg_view('input/form',array(
- 'body' => $form,
- 'method' => 'get',
- 'action' => $vars['url'] . "mod/logbrowser/"
- ));
+ $form .= elgg_view('input/text', array(
+ 'internalname' => 'timeupper',
+ 'value' => $upperval,
+ )) . "";
+ $form .= elgg_view('input/submit', array(
+ 'value' => elgg_echo('search'),
+ ));
+
+ $wrappedform = elgg_view('input/form', array(
+ 'body' => $form,
+ 'method' => 'get',
+ 'action' => "{$vars['url']}pg/admin/logbrowser",
+ ));
?>
diff --git a/mod/profile/defaultprofile.php b/mod/profile/defaultprofile.php
deleted file mode 100644
index 6d9a25832..000000000
--- a/mod/profile/defaultprofile.php
+++ /dev/null
@@ -1,55 +0,0 @@
-
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.com/
- */
-
-require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-admin_gatekeeper();
-set_context('admin');
-
-$title = elgg_view_title(elgg_echo('profile:edit:default'));
-$form = elgg_view('profile/editdefaultprofile');
-
-set_context('search');
-
-// List form elements
-$n = 0;
-$loaded_defaults = array();
-$items = array();
-if ($fieldlist = get_plugin_setting('user_defined_fields', 'profile')) {
- $fieldlistarray = explode(',', $fieldlist);
- foreach($fieldlistarray as $listitem) {
- if ($translation = get_plugin_setting("admin_defined_profile_{$listitem}", 'profile')) {
- $item = new stdClass;
- $item->translation = $translation;
- $item->shortname = $listitem;
- $item->name = "admin_defined_profile_{$listitem}";
- $item->type = get_plugin_setting("admin_defined_profile_type_{$listitem}", 'profile');
- $items[] = $item;
- }
- }
-}
-
-$listing = elgg_view('profile/editdefaultprofileitems',array('items' => $items, 'fieldlist' => $fieldlist));
-
-$resetlisting = elgg_view('input/form',
- array (
- 'body' => elgg_view('input/submit', array('value' => elgg_echo('profile:resetdefault'), 'class' => 'action_button disabled')),
- 'action' => $CONFIG->wwwroot . 'action/profile/editdefault/reset'
- )
- );
-
-$resetlisting = "{$resetlisting}
";
-
-set_context('admin');
-
-$body = elgg_view_layout("administration", $title . $form . $listing . $resetlisting);
-
-page_draw(elgg_echo('profile:edit:default'), $body);
\ No newline at end of file
diff --git a/mod/profile/start.php b/mod/profile/start.php
index 6263f4a54..90caa8f64 100644
--- a/mod/profile/start.php
+++ b/mod/profile/start.php
@@ -40,7 +40,6 @@ function profile_init() {
// Register a page handler, so we can have nice URLs
register_page_handler('profile', 'profile_page_handler');
- register_page_handler('defaultprofile', 'profileedit_page_handler');
register_page_handler('icon', 'profile_icon_handler');
register_page_handler('iconjs', 'profile_iconjs_handler');
@@ -52,11 +51,7 @@ function profile_init() {
// Now override icons
register_plugin_hook('entity:icon:url', 'user', 'profile_usericon_hook');
- elgg_add_submenu_item(array(
- 'text' => elgg_echo('profile:edit:default'),
- 'href' => "{$CONFIG->wwwroot}pg/defaultprofile/edit",
- 'parent_id' => 'appearance',
- ), 'admin', 'default');
+ elgg_add_admin_submenu_item('defaultprofile', elgg_echo('profile:edit:default'), 'appearance');
}
/**
@@ -169,24 +164,6 @@ function profile_page_handler($page) {
return;
}
-/**
- * Profile edit page handler
- *
- * @param array $page Array of page elements, forwarded by the page handling mechanism
- */
-function profileedit_page_handler($page) {
- global $CONFIG;
-
- // The username should be the file we're getting
- if (isset($page[0])) {
- switch ($page[0]) {
- default:
- include($CONFIG->pluginspath . "profile/defaultprofile.php");
- break;
- }
- }
-}
-
/**
* Pagesetup function
*
diff --git a/mod/profile/views/default/admin/appearance/defaultprofile.php b/mod/profile/views/default/admin/appearance/defaultprofile.php
new file mode 100644
index 000000000..7c498780b
--- /dev/null
+++ b/mod/profile/views/default/admin/appearance/defaultprofile.php
@@ -0,0 +1,51 @@
+
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+$title = elgg_view_title(elgg_echo('profile:edit:default'));
+$form = elgg_view('profile/editdefaultprofile');
+
+// List form elements
+$n = 0;
+$loaded_defaults = array();
+$items = array();
+if ($fieldlist = get_plugin_setting('user_defined_fields', 'profile')) {
+ $fieldlistarray = explode(',', $fieldlist);
+ foreach($fieldlistarray as $listitem) {
+ if ($translation = get_plugin_setting("admin_defined_profile_{$listitem}", 'profile')) {
+ $item = new stdClass;
+ $item->translation = $translation;
+ $item->shortname = $listitem;
+ $item->name = "admin_defined_profile_{$listitem}";
+ $item->type = get_plugin_setting("admin_defined_profile_type_{$listitem}", 'profile');
+ $items[] = $item;
+ }
+ }
+}
+
+$listing = elgg_view('profile/editdefaultprofileitems',array('items' => $items, 'fieldlist' => $fieldlist));
+
+$resetlisting = elgg_view('input/form',
+ array (
+ 'body' => elgg_view('input/submit', array('value' => elgg_echo('profile:resetdefault'), 'class' => 'action_button disabled')),
+ 'action' => $CONFIG->wwwroot . 'action/profile/editdefault/reset'
+ )
+ );
+
+$body = <<<__HTML
+$title
+$form
+$listing
+
+ $resetlisting
+
+__HTML;
+
+echo $body;
diff --git a/mod/reportedcontent/actions/archive.php b/mod/reportedcontent/actions/archive.php
index ca4ad2c41..c6cfe58bb 100644
--- a/mod/reportedcontent/actions/archive.php
+++ b/mod/reportedcontent/actions/archive.php
@@ -1,38 +1,33 @@
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.org/
+ */
- /**
- * Elgg reported content: archive action
- *
- * @package ElggReportedContent
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.org/
- */
+// Make sure we're logged in and are admin
+admin_gatekeeper();
- // Make sure we're logged in and are admin
- admin_gatekeeper();
+// Get input data
+$guid = (int) get_input('item');
- // Get input data
- $guid = (int) get_input('item');
-
- // Make sure we actually have permission to edit
- $report = get_entity($guid);
- if ($report->getSubtype() == "reported_content" && $report->canEdit()) {
-
- // change the state
- if (!trigger_plugin_hook('reportedcontent:archive', 'system', array('report'=>$report), true)) {
- system_message(elgg_echo("reportedcontent:notarchived"));
- forward("pg/reportedcontent/");
- }
- $report->state = "archived";
-
- // Success message
- system_message(elgg_echo("reportedcontent:archived"));
-
- // Forward back to the reported content page
- forward("pg/reportedcontent/");
-
- }
-
-?>
\ No newline at end of file
+// Make sure we actually have permission to edit
+$report = get_entity($guid);
+if ($report->getSubtype() == "reported_content" && $report->canEdit()) {
+ // change the state
+ if (!trigger_plugin_hook('reportedcontent:archive', 'system', array('report'=>$report), TRUE)) {
+ system_message(elgg_echo("reportedcontent:notarchived"));
+ forward('pg/admin/reportedcontent');
+ }
+ $report->state = "archived";
+
+ // Success message
+ system_message(elgg_echo("reportedcontent:archived"));
+
+ // Forward back to the reported content page
+ forward('pg/admin/reportedcontent');
+}
diff --git a/mod/reportedcontent/actions/delete.php b/mod/reportedcontent/actions/delete.php
index b2e9c7acd..d24000476 100644
--- a/mod/reportedcontent/actions/delete.php
+++ b/mod/reportedcontent/actions/delete.php
@@ -1,41 +1,37 @@
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.org/
+ */
- /**
- * Elgg reported content: delete action
- *
- * @package ElggReportedCOntent
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.org/
- */
+// Make sure we're logged in and are admin
+admin_gatekeeper();
- // Make sure we're logged in and are admin
- admin_gatekeeper();
+// Get input data
+$guid = (int) get_input('item');
- // Get input data
- $guid = (int) get_input('item');
-
- // Make sure we actually have permission to edit
- $report = get_entity($guid);
- if ($report->getSubtype() == "reported_content" && $report->canEdit()) {
-
- // Delete it!
- if (!trigger_plugin_hook('reportedcontent:delete', '$system', array('report'=>$report), true)) {
- register_error(elgg_echo("reportedcontent:notdeleted"));
- forward("pg/reportedcontent/");
- }
- $rowsaffected = $report->delete();
- if ($rowsaffected > 0) {
+// Make sure we actually have permission to edit
+$report = get_entity($guid);
+if ($report->getSubtype() == "reported_content" && $report->canEdit()) {
+ // Delete it!
+ if (!trigger_plugin_hook('reportedcontent:delete', '$system', array('report'=>$report), true)) {
+ register_error(elgg_echo("reportedcontent:notdeleted"));
+ forward('pg/admin/reportedcontent');
+ }
+
+ $rowsaffected = $report->delete();
+ if ($rowsaffected > 0) {
// Success message
- system_message(elgg_echo("reportedcontent:deleted"));
- } else {
- register_error(elgg_echo("reportedcontent:notdeleted"));
- }
-
- // Forward back to the reported content page
- forward("pg/reportedcontent/");
-
- }
-
-?>
\ No newline at end of file
+ system_message(elgg_echo("reportedcontent:deleted"));
+ } else {
+ register_error(elgg_echo("reportedcontent:notdeleted"));
+ }
+
+ // Forward back to the reported content page
+ forward('pg/admin/reportedcontent');
+}
diff --git a/mod/reportedcontent/index.php b/mod/reportedcontent/index.php
deleted file mode 100644
index bb969c343..000000000
--- a/mod/reportedcontent/index.php
+++ /dev/null
@@ -1,27 +0,0 @@
- 'object', 'subtypes' => 'reported_content', 'limit' => 9999));
-
-$area2 = elgg_view("reportedcontent/listing", array('entity' => $reported));
-
-// Display main admin menu
-page_draw(elgg_echo('reportedcontent'),elgg_view_layout("administration", $title . $area2));
\ No newline at end of file
diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php
index 22d93dbe1..b3266fcba 100644
--- a/mod/reportedcontent/start.php
+++ b/mod/reportedcontent/start.php
@@ -16,9 +16,6 @@
function reportedcontent_init() {
global $CONFIG;
- // Register a page handler, so we can have nice URLs
- register_page_handler('reportedcontent', 'reportedcontent_page_handler');
-
// Extend CSS
elgg_extend_view('css', 'reportedcontent/css');
@@ -28,29 +25,13 @@ function reportedcontent_init() {
elgg_extend_view('footer/links', 'reportedcontent/footer_link');
}
- elgg_add_submenu_item(array(
- 'text' => elgg_echo('reportedcontent'),
- 'href' => "{$CONFIG->wwwroot}pg/reportedcontent",
- 'parent_id' => 'overview',
- ), 'admin', 'default');
-}
-
-/**
- * Reported content page handler
- *
- * @param array $page Array of page elements, forwarded by the page handling mechanism
- */
-function reportedcontent_page_handler($page) {
- global $CONFIG;
+ elgg_add_admin_submenu_item('reportedcontent', elgg_echo('reportedcontent'), 'overview');
- // only interested in one page for now
- include($CONFIG->pluginspath . "reportedcontent/index.php");
+ //register action
+ register_action('reportedcontent/add', FALSE, "{$CONFIG->pluginspath}reportedcontent/actions/add.php");
+ register_action('reportedcontent/delete', FALSE, "{$CONFIG->pluginspath}reportedcontent/actions/delete.php");
+ register_action('reportedcontent/archive', FALSE, "{$CONFIG->pluginspath}reportedcontent/actions/archive.php");
}
// Initialise Reported Content
register_elgg_event_handler('init','system','reportedcontent_init');
-
-//register action
-register_action('reportedcontent/add',false,$CONFIG->pluginspath . "reportedcontent/actions/add.php");
-register_action('reportedcontent/delete',false,$CONFIG->pluginspath . "reportedcontent/actions/delete.php");
-register_action('reportedcontent/archive',false,$CONFIG->pluginspath . "reportedcontent/actions/archive.php");
\ No newline at end of file
diff --git a/mod/reportedcontent/views/default/admin/overview/reportedcontent.php b/mod/reportedcontent/views/default/admin/overview/reportedcontent.php
new file mode 100644
index 000000000..4207aacd2
--- /dev/null
+++ b/mod/reportedcontent/views/default/admin/overview/reportedcontent.php
@@ -0,0 +1,27 @@
+ 'object', 'subtypes' => 'reported_content', 'limit' => 9999));
+$list = elgg_view("reportedcontent/listing", array('entity' => $reported));
+
+// Display main admin menu
+$body = <<<__HTML
+$title
+$reported
+$list
+__HTML;
+
+echo $body;
\ No newline at end of file
--
cgit v1.2.3