diff options
Diffstat (limited to 'views/default/layout/shells')
-rw-r--r-- | views/default/layout/shells/widgets.php | 4 | ||||
-rw-r--r-- | views/default/layout/shells/widgets/add_button.php | 13 | ||||
-rw-r--r-- | views/default/layout/shells/widgets/add_panel.php | 51 |
3 files changed, 66 insertions, 2 deletions
diff --git a/views/default/layout/shells/widgets.php b/views/default/layout/shells/widgets.php index 130b2eaad..e5b63114b 100644 --- a/views/default/layout/shells/widgets.php +++ b/views/default/layout/shells/widgets.php @@ -19,13 +19,13 @@ $widgets = elgg_get_widgets($owner->guid, $context); if (elgg_can_edit_widget_layout($context)) { if ($show_add_widgets) { - echo elgg_view('widgets/add-button'); + echo elgg_view('layout/shells/widgets/add_button'); } $params = array( 'widgets' => $widgets, 'context' => $context, ); - echo elgg_view('widgets/add_panel', $params); + echo elgg_view('layout/shells/widgets/add_panel', $params); } echo $vars['box']; diff --git a/views/default/layout/shells/widgets/add_button.php b/views/default/layout/shells/widgets/add_button.php new file mode 100644 index 000000000..92de8a99f --- /dev/null +++ b/views/default/layout/shells/widgets/add_button.php @@ -0,0 +1,13 @@ +<?php + +?> +<div id="widget-add-button"> +<?php +$options = array( + 'href' => '#', + 'text' => elgg_echo('widgets:add'), + 'class' => 'action-button', +); +echo elgg_view('output/url', $options); +?> +</div> diff --git a/views/default/layout/shells/widgets/add_panel.php b/views/default/layout/shells/widgets/add_panel.php new file mode 100644 index 000000000..d9acc5518 --- /dev/null +++ b/views/default/layout/shells/widgets/add_panel.php @@ -0,0 +1,51 @@ +<?php + +$widgets = $vars['widgets']; +$context = $vars['context']; + +$widget_types = elgg_get_widget_types($context); + +$current_handlers = array(); +foreach ($widgets as $column_widgets) { + foreach ($column_widgets as $widget) { + $current_handlers[] = $widget->handler; + } +} + +?> +<div class="widgets-add-panel hidden"> + <p> + <?php echo elgg_echo('widgets:add:description'); ?> + </p> + <ul> +<?php + foreach ($widget_types as $handler => $widget_type) { + $id = "widget-type-$handler"; + // check if widget added and only one instance allowed + if ($widget_type->multiple == false && in_array($handler, $current_handlers)) { + $class = 'widget-unavailable'; + $tooltip = elgg_echo('widget:unavailable'); + } else { + $class = 'widget-available'; + $tooltip = $widget_type->description; + } + + if ($widget_type->multiple) { + $class .= ' widget-multiple'; + } else { + $class .= ' widget-single'; + } + + echo "<li title=\"$tooltip\" id=\"$id\" class=\"$class\">$widget_type->name</li>"; + } +?> + </ul> +<?php + $params = array( + 'internalname' => 'widget-context', + 'value' => $context + ); + echo elgg_view('input/hidden', $params); +?> + <div class="clearfloat"></div> +</div> |