diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-19 02:12:32 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-19 02:12:32 +0000 |
commit | 373ff03a2b6315eea13a97065774972ad3713ab6 (patch) | |
tree | df051d2a4c1d150fd75b2f3db2d4647a5e1ebda9 /actions | |
parent | 06f0e7b1aa5f6fd393d9a0b580f94709e29e10df (diff) | |
download | elgg-373ff03a2b6315eea13a97065774972ad3713ab6.tar.gz elgg-373ff03a2b6315eea13a97065774972ad3713ab6.tar.bz2 |
Fixes #2753: Default widgets merged into core as extensible admin section and updated to work with new widgets. Will need an upgrade for users running the old default widgets in 1.7.
git-svn-id: http://code.elgg.org/elgg/trunk@8302 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'actions')
-rw-r--r-- | actions/widgets/add.php | 14 | ||||
-rw-r--r-- | actions/widgets/delete.php | 9 | ||||
-rw-r--r-- | actions/widgets/move.php | 10 | ||||
-rw-r--r-- | actions/widgets/save.php | 7 |
4 files changed, 25 insertions, 15 deletions
diff --git a/actions/widgets/add.php b/actions/widgets/add.php index 38686b36d..ac8983115 100644 --- a/actions/widgets/add.php +++ b/actions/widgets/add.php @@ -6,18 +6,22 @@ * @subpackage Widgets.Management */ -$user_guid = get_input('user_guid'); +$owner_guid = get_input('owner_guid'); $handler = get_input('handler'); $context = get_input('context'); $column = get_input('column', 1); +$default_widgets = get_input('default_widgets', 0); elgg_push_context($context); +if ($default_widgets) { + elgg_push_context('default_widgets'); +} elgg_push_context('widgets'); -if (!empty($user_guid)) { - $user = get_entity($user_guid); - if ($user && $user->canEdit()) { - $guid = elgg_create_widget($user->getGUID(), $handler, $context); +if (!empty($owner_guid)) { + $owner = get_entity($owner_guid); + if ($owner && $owner->canEdit()) { + $guid = elgg_create_widget($owner->getGUID(), $handler, $context); if ($guid) { $widget = get_entity($guid); diff --git a/actions/widgets/delete.php b/actions/widgets/delete.php index 5b8aaf75e..47920013d 100644 --- a/actions/widgets/delete.php +++ b/actions/widgets/delete.php @@ -6,12 +6,13 @@ * @subpackage Widgets.Management */ -$guid = get_input('guid'); +$widget_guid = get_input('widget_guid'); +$owner_guid = get_input('owner_guid', elgg_get_logged_in_user_guid()); -$user = elgg_get_logged_in_user_entity(); +$widget = get_entity($widget_guid); +$owner = get_entity($owner_guid); -$widget = get_entity($guid); -if ($widget && $user->canEdit() && $widget->delete()) { +if ($widget && $owner->canEdit() && $widget->delete()) { forward(REFERER); } diff --git a/actions/widgets/move.php b/actions/widgets/move.php index 2edc7912e..eab650c9c 100644 --- a/actions/widgets/move.php +++ b/actions/widgets/move.php @@ -6,14 +6,16 @@ * @subpackage Widgets.Management */ -$guid = get_input('guid'); +$widget_guid = get_input('widget_guid'); $column = get_input('column', 1); $position = get_input('position'); +$owner_guid = get_input('owner_guid', elgg_get_logged_in_user_guid()); -$user = elgg_get_logged_in_user_entity(); +$widget = get_entity($widget_guid); +$owner = get_entity($owner_guid); -$widget = get_entity($guid); -if ($widget && $user->canEdit()) { + +if ($widget && $owner->canEdit()) { $widget->move($column, $position); forward(REFERER); } diff --git a/actions/widgets/save.php b/actions/widgets/save.php index b1649cc17..0a2de0c4d 100644 --- a/actions/widgets/save.php +++ b/actions/widgets/save.php @@ -10,12 +10,15 @@ elgg_set_context('widgets'); $guid = get_input('guid'); $params = get_input('params'); +$default_widgets = get_input('default_widgets', 0); $widget = get_entity($guid); if ($widget && $widget->saveSettings($params)) { elgg_set_page_owner_guid($widget->getContainerGUID()); - $view = "widgets/$widget->handler/content"; - echo elgg_view($view, array('entity' => $widget)); + if (!$default_widgets) { + $view = "widgets/$widget->handler/content"; + echo elgg_view($view, array('entity' => $widget)); + } } else { register_error(elgg_echo('widgets:save:failure')); } |