aboutsummaryrefslogtreecommitdiff
path: root/mod/defaultwidgets
diff options
context:
space:
mode:
Diffstat (limited to 'mod/defaultwidgets')
-rw-r--r--mod/defaultwidgets/actions/update.php4
-rw-r--r--mod/defaultwidgets/dashboard.php31
-rw-r--r--mod/defaultwidgets/profile.php31
-rw-r--r--mod/defaultwidgets/start.php48
-rw-r--r--mod/defaultwidgets/views/default/admin/appearance/default_dashboard_widgets.php21
-rw-r--r--mod/defaultwidgets/views/default/admin/appearance/default_profile_widgets.php21
6 files changed, 47 insertions, 109 deletions
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 @@
-<?php
-/**
- * Elgg default_widgets plugin.
- *
- * @package DefaultWidgets
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU
- * @author Milan Magudia & Curverider
- * @copyright HedgeHogs.net & Curverider Ltd
- *
- **/
-
-// load Elgg engine
-require_once (dirname ( dirname ( dirname ( __FILE__ ) ) ) . "/engine/start.php");
-
-// make sure only admins can view this
-admin_gatekeeper ();
-set_context ( 'admin' );
-
-// Set admin user for user block
-set_page_owner ( $_SESSION ['guid'] );
-
-// vars required for action gatekeeper
-$ts = time ();
-$token = generate_action_token ( $ts );
-$context = 'dashboard';
-
-// create the view
-$content = elgg_view ( "defaultwidgets/editor", array ('token' => $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 @@
-<?php
-/**
- * Elgg default_widgets plugin.
- *
- * @package DefaultWidgets
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU
- * @author Milan Magudia & Curverider
- * @copyright HedgeHogs.net & Curverider Ltd
- *
- **/
-
-// load Elgg engine
-require_once (dirname ( dirname ( dirname ( __FILE__ ) ) ) . "/engine/start.php");
-
-// make sure only admins can view this
-admin_gatekeeper ();
-set_context ( 'admin' );
-
-// set admin user for user block
-set_page_owner ( $_SESSION ['guid'] );
-
-// vars required for action gatekeeper
-$ts = time ();
-$token = generate_action_token ( $ts );
-$context = 'profile';
-
-// create the view
-$content = elgg_view ( "defaultwidgets/editor", array ('token' => $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 @@
+<?php
+/**
+ * Elgg default_widgets plugin.
+ *
+ * @package DefaultWidgets
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU
+ * @author Milan Magudia & Curverider
+ * @copyright HedgeHogs.net & Curverider Ltd
+ *
+ **/
+
+// Set admin user for user block
+set_page_owner($_SESSION['guid']);
+
+// create the view
+$time = time();
+echo elgg_view('defaultwidgets/editor', array(
+ 'token' => 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 @@
+<?php
+/**
+ * Elgg default_widgets plugin.
+ *
+ * @package DefaultWidgets
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU
+ * @author Milan Magudia & Curverider
+ * @copyright HedgeHogs.net & Curverider Ltd
+ *
+ **/
+
+// set admin user for user block
+set_page_owner($_SESSION['guid']);
+
+// create the view
+$time = time();
+echo elgg_view('defaultwidgets/editor', array (
+ 'token' => generate_action_token($time),
+ 'ts' => $time,
+ 'context' => 'profile',
+));