diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-15 22:20:20 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-15 22:20:20 +0000 |
commit | 5922d93173db6353e3404c1c2a941842a9f166ed (patch) | |
tree | 00eff462ba782d5792795e2e69362b62c23dc423 /views/default/layout/shells | |
parent | 1c61bbef8f87c9bc96b7b265816f638899ea3e13 (diff) | |
download | elgg-5922d93173db6353e3404c1c2a941842a9f166ed.tar.gz elgg-5922d93173db6353e3404c1c2a941842a9f166ed.tar.bz2 |
moved widget into layout/objects as one of our core css objects
git-svn-id: http://code.elgg.org/elgg/trunk@7639 36083f99-b078-4883-b0ff-0f9b5a30f544
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> |