aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2012-07-14 21:44:14 -0400
committerCash Costello <cash.costello@gmail.com>2012-07-14 21:44:14 -0400
commit2e0cc0343715adec8a0843750016f89acc3c2394 (patch)
tree9205cbf231ef9f2035a8d29b4834f44c7e86e7d0
parent1ed326672a833f020bdb15f0b9cb047ab57f0b5b (diff)
downloadelgg-2e0cc0343715adec8a0843750016f89acc3c2394.tar.gz
elgg-2e0cc0343715adec8a0843750016f89acc3c2394.tar.bz2
Fixes #4661 not showing access on widgets loaded through ajax if the layout does not show access
-rw-r--r--actions/widgets/add.php3
-rw-r--r--js/lib/ui.widgets.js1
-rw-r--r--views/default/page/layouts/widgets.php1
-rw-r--r--views/default/page/layouts/widgets/add_panel.php9
4 files changed, 10 insertions, 4 deletions
diff --git a/actions/widgets/add.php b/actions/widgets/add.php
index f65d11134..d7b2f291c 100644
--- a/actions/widgets/add.php
+++ b/actions/widgets/add.php
@@ -9,6 +9,7 @@
$owner_guid = get_input('owner_guid');
$handler = get_input('handler');
$context = get_input('context');
+$show_access = (bool)get_input('show_access', true);
$column = get_input('column', 1);
$default_widgets = get_input('default_widgets', 0);
@@ -29,7 +30,7 @@ if (!empty($owner_guid)) {
$widget->move($column, 0);
// send widget html for insertion
- echo elgg_view_entity($widget);
+ echo elgg_view_entity($widget, array('show_access' => $show_access));
//system_message(elgg_echo('widgets:add:success'));
forward(REFERER);
diff --git a/js/lib/ui.widgets.js b/js/lib/ui.widgets.js
index b7d4b2fe4..26020bb4b 100644
--- a/js/lib/ui.widgets.js
+++ b/js/lib/ui.widgets.js
@@ -58,6 +58,7 @@ elgg.ui.widgets.add = function(event) {
handler: type,
owner_guid: elgg.get_page_owner_guid(),
context: $("input[name='widget_context']").val(),
+ show_access: $("input[name='show_access']").val(),
default_widgets: $("input[name='default_widgets']").val() || 0
},
success: function(json) {
diff --git a/views/default/page/layouts/widgets.php b/views/default/page/layouts/widgets.php
index e3819cc20..c6b162516 100644
--- a/views/default/page/layouts/widgets.php
+++ b/views/default/page/layouts/widgets.php
@@ -31,6 +31,7 @@ if (elgg_can_edit_widget_layout($context)) {
'widgets' => $widgets,
'context' => $context,
'exact_match' => $exact_match,
+ 'show_access' => $show_access,
);
echo elgg_view('page/layouts/widgets/add_panel', $params);
}
diff --git a/views/default/page/layouts/widgets/add_panel.php b/views/default/page/layouts/widgets/add_panel.php
index 9eb78cdb6..d9b11342a 100644
--- a/views/default/page/layouts/widgets/add_panel.php
+++ b/views/default/page/layouts/widgets/add_panel.php
@@ -50,10 +50,13 @@ foreach ($widgets as $column_widgets) {
?>
</ul>
<?php
- $params = array(
+ echo elgg_view('input/hidden', array(
'name' => 'widget_context',
'value' => $context
- );
- echo elgg_view('input/hidden', $params);
+ ));
+ echo elgg_view('input/hidden', array(
+ 'name' => 'show_access',
+ 'value' => (int)$vars['show_access']
+ ));
?>
</div>