aboutsummaryrefslogtreecommitdiff
path: root/mod/developers/views/default/theme_preview/widgets.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-14 00:10:03 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-14 00:10:03 +0000
commitd3c49d7ee73a6f0bc680868147cc68cccba611a9 (patch)
treee598deec2b98faada3acc62477371e408499c6e1 /mod/developers/views/default/theme_preview/widgets.php
parent5a955c633c1ac314ccff3fe5a719ae730105c13a (diff)
downloadelgg-d3c49d7ee73a6f0bc680868147cc68cccba611a9.tar.gz
elgg-d3c49d7ee73a6f0bc680868147cc68cccba611a9.tar.bz2
Refs #2903 moving theme preview into developers plugin - navigation and titles are broken
git-svn-id: http://code.elgg.org/elgg/trunk@8214 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/developers/views/default/theme_preview/widgets.php')
-rw-r--r--mod/developers/views/default/theme_preview/widgets.php70
1 files changed, 70 insertions, 0 deletions
diff --git a/mod/developers/views/default/theme_preview/widgets.php b/mod/developers/views/default/theme_preview/widgets.php
new file mode 100644
index 000000000..7f3fc938c
--- /dev/null
+++ b/mod/developers/views/default/theme_preview/widgets.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * Widgets CSS
+ */
+
+$url = current_page_url();
+
+elgg_register_plugin_hook_handler('view', 'widgets/friends/content', 'css_widget_content');
+elgg_register_plugin_hook_handler('view', 'widgets/friends/edit', 'css_widget_content');
+elgg_register_plugin_hook_handler('permissions_check', 'all', 'css_permissions_override');
+
+function css_widget_content() {
+ global $ipsum;
+ return $ipsum;
+}
+
+function css_permissions_override() {
+ return true;
+}
+
+
+?>
+<div class="elgg-page mal">
+ <h1 class="mbs">
+ <a href="index.php">Index</a> > <a href="<?php echo $url; ?>"><?php echo $title; ?></a>
+ </h1>
+ <div class="mbl">
+ <a href="grid.php">< previous</a>&nbsp;&nbsp;<a href="icons.php">next ></a>
+ </div>
+<?php
+$w = array();
+for ($i=1; $i<=6; $i++) {
+ $obj = new ElggWidget();
+ $obj->handler = 'friends';
+ $obj->title = "Widget $i";
+ $w[] = $obj;
+}
+$column1 = array($w[0], $w[1]);
+$column2 = array($w[2], $w[3]);
+$column3 = array($w[4], $w[5]);
+$widgets = array(1 => $column1, 2 => $column2, 3 => $column3);
+$num_columns = 3;
+$widget_class = "elgg-col-1of{$num_columns}";
+for ($column_index = 1; $column_index <= $num_columns; $column_index++) {
+ $column_widgets = $widgets[$column_index];
+
+ echo "<div class=\"$widget_class elgg-widgets\" id=\"elgg-widget-col-$column_index\">";
+ if (is_array($column_widgets) && sizeof($column_widgets) > 0) {
+ foreach ($column_widgets as $widget) {
+ echo elgg_view_entity($widget);
+ }
+ }
+ echo '</div>';
+}
+?>
+</div>
+<script type="text/javascript">
+ // widgets do not have guids so we override the edit toggle and delete button
+ $(document).ready(function() {
+ $('.elgg-widget-edit-button').unbind('click');
+ $('.elgg-widget-edit-button').click(function() {
+ $(this).closest('.elgg-module-widget').find('.elgg-widget-edit').slideToggle('medium');
+ return false;
+ });
+ $('.elgg-widget-delete-button').click(function() {
+ $(this).closest('.elgg-module-widget').remove();
+ return false;
+ });
+ });
+</script>