aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-11-26 14:08:38 -0500
committerCash Costello <cash.costello@gmail.com>2011-11-26 14:08:38 -0500
commit22afb49f30fc9bcd6be84f734e89a9b644f2fb0f (patch)
tree1fba6c9db4b92e5fc9744ec82e8d218720c5de07
parent47bd8586910b1df3f29e2425572372e382b26f6a (diff)
downloadelgg-22afb49f30fc9bcd6be84f734e89a9b644f2fb0f.tar.gz
elgg-22afb49f30fc9bcd6be84f734e89a9b644f2fb0f.tar.bz2
updated widgets for 1.8
-rw-r--r--start.php12
-rw-r--r--views/default/object/album/gallery.php2
-rw-r--r--views/default/tidypics/css.php7
-rw-r--r--views/default/widgets/album_view/content.php14
-rw-r--r--views/default/widgets/album_view/edit.php39
-rw-r--r--views/default/widgets/album_view/view.php14
-rw-r--r--views/default/widgets/latest_photos/content.php15
-rw-r--r--views/default/widgets/latest_photos/edit.php29
-rw-r--r--views/default/widgets/latest_photos/view.php16
9 files changed, 77 insertions, 71 deletions
diff --git a/start.php b/start.php
index b57ffb73e..f58e26e8c 100644
--- a/start.php
+++ b/start.php
@@ -43,13 +43,15 @@ function tidypics_init() {
// Register for the entity menu
elgg_register_plugin_hook_handler('register', 'menu:entity', 'tidypics_entity_menu_setup');
- // Add group option
+ // Register group option
add_group_tool_option('photos', elgg_echo('tidypics:enablephotos'), true);
elgg_extend_view('groups/tool_latest', 'photos/group_module');
+ // Register widgets
+ elgg_register_widget_type('album_view', elgg_echo("tidypics:widget:albums"), elgg_echo("tidypics:widget:album_descr"), 'profile');
+ elgg_register_widget_type('latest_photos', elgg_echo("tidypics:widget:latest"), elgg_echo("tidypics:widget:latest_descr"), 'profile');
+
/*
- //group view ** psuedo widget view for group pages**
- elgg_extend_view('groups/right_column','tidypics/groupprofile_albums');
// rss extensions
elgg_extend_view('extensions/xmlns', 'extensions/tidypics/xmlns');
@@ -59,11 +61,7 @@ function tidypics_init() {
// register for menus
//register_elgg_event_handler('pagesetup', 'system', 'tidypics_submenus');
- // Add a new tidypics widget
- add_widget_type('album_view', elgg_echo("tidypics:widget:albums"), elgg_echo("tidypics:widget:album_descr"), 'profile');
- add_widget_type('latest_photos', elgg_echo("tidypics:widget:latest"), elgg_echo("tidypics:widget:latest_descr"), 'profile');
- add_group_tool_option('photos', elgg_echo('tidypics:enablephotos'), true);
if (get_plugin_setting('grp_perm_override', 'tidypics') != "disabled") {
register_plugin_hook('permissions_check', 'object', 'tidypics_permission_override');
diff --git a/views/default/object/album/gallery.php b/views/default/object/album/gallery.php
index 78eec3517..ee22f0436 100644
--- a/views/default/object/album/gallery.php
+++ b/views/default/object/album/gallery.php
@@ -1,6 +1,6 @@
<?php
/**
- * Summary of an album for lists/galleries
+ * Display an album in a gallery
*
* @uses $vars['entity'] TidypicsAlbum
*
diff --git a/views/default/tidypics/css.php b/views/default/tidypics/css.php
index e35b8e73f..542123bd0 100644
--- a/views/default/tidypics/css.php
+++ b/views/default/tidypics/css.php
@@ -10,6 +10,13 @@
text-align: center;
margin: 5px 10px;
}
+.elgg-module-tidypics-image {
+ margin: 5px auto;
+}
+.tidypics-gallery-widget > li {
+ width: 100%;
+}
+
.tidypics-input-thin {
width: 120px;
diff --git a/views/default/widgets/album_view/content.php b/views/default/widgets/album_view/content.php
new file mode 100644
index 000000000..d6476f075
--- /dev/null
+++ b/views/default/widgets/album_view/content.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ *
+ */
+
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'album',
+ 'container_guid' => elgg_get_page_owner_guid(),
+ 'limit' => $vars['entity']->num_display,
+ 'full_view' => false,
+ 'pagination' => false,
+);
+echo elgg_list_entities($options);
diff --git a/views/default/widgets/album_view/edit.php b/views/default/widgets/album_view/edit.php
index 9068ffe17..fde8b87b0 100644
--- a/views/default/widgets/album_view/edit.php
+++ b/views/default/widgets/album_view/edit.php
@@ -1,25 +1,22 @@
-<p>
-<?php
+<?php
+/**
+ * Widget settings for newest albums
+ */
-echo elgg_echo("tidypics:widget:num_albums") . ": ";
-
-
-if ($vars['entity']->num_display == '') {
+// set default value
+if (!isset($vars['entity']->num_display)) {
$vars['entity']->num_display = 5;
}
+
+$params = array(
+ 'name' => 'params[num_display]',
+ 'value' => $vars['entity']->num_display,
+ 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20),
+);
+$dropdown = elgg_view('input/dropdown', $params);
+
?>
- <select name="params[num_display]">
- <option value="1" <?php if($vars['entity']->num_display == 1) echo "SELECTED"; ?>>1</option>
- <option value="2" <?php if($vars['entity']->num_display == 2) echo "SELECTED"; ?>>2</option>
- <option value="3" <?php if($vars['entity']->num_display == 3) echo "SELECTED"; ?>>3</option>
- <option value="4" <?php if($vars['entity']->num_display == 4) echo "SELECTED"; ?>>4</option>
- <option value="5" <?php if($vars['entity']->num_display == 5) echo "SELECTED"; ?>>5</option>
- <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option>
- <option value="7" <?php if($vars['entity']->num_display == 7) echo "SELECTED"; ?>>7</option>
- <option value="8" <?php if($vars['entity']->num_display == 8) echo "SELECTED"; ?>>8</option>
- <option value="9" <?php if($vars['entity']->num_display == 9) echo "SELECTED"; ?>>9</option>
- <option value="10" <?php if($vars['entity']->num_display == 10) echo "SELECTED"; ?>>10</option>
- <option value="15" <?php if($vars['entity']->num_display == 15) echo "SELECTED"; ?>>15</option>
- <option value="20" <?php if($vars['entity']->num_display == 20) echo "SELECTED"; ?>>20</option>
- </select>
-</p> \ No newline at end of file
+<div>
+ <?php echo elgg_echo('tidypics:widget:num_albums'); ?>:
+ <?php echo $dropdown; ?>
+</div>
diff --git a/views/default/widgets/album_view/view.php b/views/default/widgets/album_view/view.php
deleted file mode 100644
index 1b980aa8b..000000000
--- a/views/default/widgets/album_view/view.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<div class="contentWrapper">
-<?php
-
-//the number of files to display
-$number = (int) $vars['entity']->num_display;
-//if no number has been set, default to 5
-if (!$number) {
- $number = 5;
-}
-
-echo elgg_view('tidypics/albums', array('num_albums' => $number));
-
-?>
-</div> \ No newline at end of file
diff --git a/views/default/widgets/latest_photos/content.php b/views/default/widgets/latest_photos/content.php
new file mode 100644
index 000000000..ecd72aec4
--- /dev/null
+++ b/views/default/widgets/latest_photos/content.php
@@ -0,0 +1,15 @@
+<?php
+/**
+ * Display the latest photos uploaded by an individual
+ */
+
+echo elgg_list_entities(array(
+ 'type' => 'object',
+ 'subtype' => 'image',
+ 'limit' => $vars['entity']->num_display,
+ 'owner_guid' => elgg_get_page_owner_guid(),
+ 'full_view' => false,
+ 'list_type' => 'gallery',
+ 'list_type_toggle' => false,
+ 'gallery_class' => 'tidypics-gallery-widget',
+));
diff --git a/views/default/widgets/latest_photos/edit.php b/views/default/widgets/latest_photos/edit.php
index 06693648d..ac870c9f8 100644
--- a/views/default/widgets/latest_photos/edit.php
+++ b/views/default/widgets/latest_photos/edit.php
@@ -1,17 +1,22 @@
-<p>
-<?php
-echo elgg_echo("tidypics:widget:num_latest") . ": ";
+<?php
+/**
+ * Widget settings for latest photos
+ */
-if ($vars['entity']->num_display == '') {
+// set default value
+if (!isset($vars['entity']->num_display)) {
$vars['entity']->num_display = 6;
}
+$params = array(
+ 'name' => 'params[num_display]',
+ 'value' => $vars['entity']->num_display,
+ 'options' => array(3, 6, 9, 12),
+);
+$dropdown = elgg_view('input/dropdown', $params);
+
?>
- <select name="params[num_display]">
- <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option>
- <option value="9" <?php if($vars['entity']->num_display == 9) echo "SELECTED"; ?>>9</option>
- <option value="12" <?php if($vars['entity']->num_display == 12) echo "SELECTED"; ?>>12</option>
- <option value="15" <?php if($vars['entity']->num_display == 15) echo "SELECTED"; ?>>15</option>
- <option value="18" <?php if($vars['entity']->num_display == 18) echo "SELECTED"; ?>>18</option>
- </select>
-</p> \ No newline at end of file
+<div>
+ <?php echo elgg_echo('tidypics:widget:num_latest'); ?>:
+ <?php echo $dropdown; ?>
+</div>
diff --git a/views/default/widgets/latest_photos/view.php b/views/default/widgets/latest_photos/view.php
deleted file mode 100644
index 108d070c9..000000000
--- a/views/default/widgets/latest_photos/view.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<div class="contentWrapper">
-<?php
-
-//the number of files to display
-$number = (int) $vars['entity']->num_display;
-//if no number has been set, default to 6
-if (!$number) {
- $number = 6;
-}
-
-echo '<div class="tidypics_widget_latest">';
-echo tp_get_latest_photos($number, page_owner(), 'widget');
-echo '</div>';
-
-?>
-</div> \ No newline at end of file