aboutsummaryrefslogtreecommitdiff
path: root/views/default
diff options
context:
space:
mode:
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-21 20:25:58 +0000
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-21 20:25:58 +0000
commiteb1f78b48658b9ffaac228652a390102ab886dea (patch)
tree985f28bd36fd4a0c64086cf6950d0f61272f175c /views/default
parent2160d5f11f95f81299ae44ece4819c144467d07f (diff)
downloadelgg-eb1f78b48658b9ffaac228652a390102ab886dea.tar.gz
elgg-eb1f78b48658b9ffaac228652a390102ab886dea.tar.bz2
Refs #2950: Moved widget code to object/widget/*
git-svn-id: http://code.elgg.org/elgg/trunk@8386 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default')
-rw-r--r--views/default/object/widget.php73
-rw-r--r--views/default/object/widget/elements/controls.php (renamed from views/default/layout/objects/widget/controls.php)0
-rw-r--r--views/default/object/widget/elements/settings.php (renamed from views/default/layout/objects/widget/settings.php)0
-rw-r--r--views/default/page/components/widget.php70
4 files changed, 69 insertions, 74 deletions
diff --git a/views/default/object/widget.php b/views/default/object/widget.php
index efc8ef9ae..ce2dc33da 100644
--- a/views/default/object/widget.php
+++ b/views/default/object/widget.php
@@ -1,9 +1,74 @@
<?php
/**
- * Elgg default widget view
+ * Widget object
*
- * @package Elgg
- * @subpackage Core
+ * @uses $vars['entity'] ElggWidget
+ * @uses $vars['show_access'] Show the access control in edit area? (true)
*/
-echo elgg_view('page/components/widget', $vars);
+$widget = $vars['entity'];
+if (!elgg_instanceof($widget, 'object', 'widget')) {
+ return true;
+}
+
+$show_access = elgg_extract('show_access', $vars, true);
+
+// @todo catch for disabled plugins
+$widget_types = elgg_get_widget_types('all');
+
+$handler = $widget->handler;
+
+$title = $widget->getTitle();
+
+$edit_area = '';
+$can_edit = $widget->canEdit();
+if ($can_edit) {
+ $edit_area = elgg_view('object/widget/elements/settings', array(
+ 'widget' => $widget,
+ 'show_access' => $show_access,
+ ));
+}
+$controls = elgg_view('object/widget/elements/controls', array(
+ 'widget' => $widget,
+ 'show_edit' => $edit_area != '',
+));
+
+// don't show content for default widgets
+if (elgg_in_context('default_widgets')) {
+ $content = '';
+} else {
+ if (elgg_view_exists("widgets/$handler/content")) {
+ $content = elgg_view("widgets/$handler/content", $vars);
+ } else {
+ elgg_deprecated_notice("widgets use content as the display view", 1.8);
+ $content = elgg_view("widgets/$handler/view", $vars);
+ }
+}
+
+$widget_id = "elgg-widget-$widget->guid";
+$widget_instance = "elgg-widget-instance-$handler";
+$widget_class = "elgg-module elgg-module-widget";
+if ($can_edit) {
+ $widget_class .= " elgg-state-draggable $widget_instance";
+} else {
+ $widget_class .= " elgg-state-fixed $widget_instance";
+}
+
+$widget_header = <<<HEADER
+ <h3>$title</h3>
+ $controls
+HEADER;
+
+$widget_body = <<<BODY
+ $edit_area
+ <div class="elgg-widget-content">
+ $content
+ </div>
+BODY;
+
+echo elgg_view('page/components/module', array(
+ 'class' => $widget_class,
+ 'id' => $widget_id,
+ 'body' => $widget_body,
+ 'header' => $widget_header,
+));
diff --git a/views/default/layout/objects/widget/controls.php b/views/default/object/widget/elements/controls.php
index 09f5fc947..09f5fc947 100644
--- a/views/default/layout/objects/widget/controls.php
+++ b/views/default/object/widget/elements/controls.php
diff --git a/views/default/layout/objects/widget/settings.php b/views/default/object/widget/elements/settings.php
index 05cc7b5ce..05cc7b5ce 100644
--- a/views/default/layout/objects/widget/settings.php
+++ b/views/default/object/widget/elements/settings.php
diff --git a/views/default/page/components/widget.php b/views/default/page/components/widget.php
deleted file mode 100644
index e7a16b318..000000000
--- a/views/default/page/components/widget.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/**
- * Widget object
- *
- * @uses $vars['entity'] ElggWidget
- * @uses $vars['show_access'] Show the access control in edit area? (true)
- */
-
-$widget = $vars['entity'];
-if (!elgg_instanceof($widget, 'object', 'widget')) {
- return true;
-}
-
-$show_access = elgg_extract('show_access', $vars, true);
-
-// @todo catch for disabled plugins
-$widget_types = elgg_get_widget_types('all');
-
-$handler = $widget->handler;
-
-$title = $widget->getTitle();
-
-$edit_area = '';
-$can_edit = $widget->canEdit();
-if ($can_edit) {
- $edit_area = elgg_view('layout/objects/widget/settings', array(
- 'widget' => $widget,
- 'show_access' => $show_access,
- ));
-}
-$controls = elgg_view('layout/objects/widget/controls', array(
- 'widget' => $widget,
- 'show_edit' => $edit_area != '',
-));
-
-// don't show content for default widgets
-if (elgg_in_context('default_widgets')) {
- $content = '';
-} else {
- if (elgg_view_exists("widgets/$handler/content")) {
- $content = elgg_view("widgets/$handler/content", $vars);
- } else {
- elgg_deprecated_notice("widgets use content as the display view", 1.8);
- $content = elgg_view("widgets/$handler/view", $vars);
- }
-}
-
-$widget_id = "elgg-widget-$widget->guid";
-$widget_instance = "elgg-widget-instance-$handler";
-$widget_class = "elgg-module elgg-module-widget";
-if ($can_edit) {
- $widget_class .= " elgg-state-draggable $widget_instance";
-} else {
- $widget_class .= " elgg-state-fixed $widget_instance";
-}
-
-echo <<<HTML
-<div class="$widget_class" id="$widget_id">
- <div class="elgg-head">
- <h3>$title</h3>
- $controls
- </div>
- <div class="elgg-body">
- $edit_area
- <div class="elgg-widget-content">
- $content
- </div>
- </div>
-</div>
-HTML;