diff options
author | Cash Costello <cash.costello@gmail.com> | 2011-11-23 18:46:41 -0500 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2011-11-23 18:46:41 -0500 |
commit | 47bd8586910b1df3f29e2425572372e382b26f6a (patch) | |
tree | 044b79b6d9ac1317837fe08f4359f2c291497c9d | |
parent | 0aa823656bf92ae472cb6780afb24f5a0390b880 (diff) | |
download | elgg-47bd8586910b1df3f29e2425572372e382b26f6a.tar.gz elgg-47bd8586910b1df3f29e2425572372e382b26f6a.tar.bz2 |
added support for group albums
-rw-r--r-- | pages/photos/album/view.php | 6 | ||||
-rw-r--r-- | start.php | 45 | ||||
-rw-r--r-- | views/default/object/album.php | 6 | ||||
-rw-r--r-- | views/default/object/album/gallery.php (renamed from views/default/object/album/summary.php) | 0 | ||||
-rw-r--r-- | views/default/object/album/list.php | 52 | ||||
-rw-r--r-- | views/default/photos/group_module.php | 45 |
6 files changed, 111 insertions, 43 deletions
diff --git a/pages/photos/album/view.php b/pages/photos/album/view.php index aafcf14bc..39816b299 100644 --- a/pages/photos/album/view.php +++ b/pages/photos/album/view.php @@ -23,7 +23,11 @@ $title = elgg_echo($album->getTitle()); // set up breadcrumbs elgg_push_breadcrumb(elgg_echo('photos'), 'photos/all'); -elgg_push_breadcrumb($owner->name, "photos/owner/$owner->username"); +if (elgg_instanceof($owner, 'group')) { + elgg_push_breadcrumb($owner->name, "photos/group/$owner->guid/all"); +} else { + elgg_push_breadcrumb($owner->name, "photos/owner/$owner->username"); +} elgg_push_breadcrumb($album->getTitle()); $content = elgg_view_entity($album, array('full_view' => true)); @@ -43,10 +43,11 @@ function tidypics_init() { // Register for the entity menu elgg_register_plugin_hook_handler('register', 'menu:entity', 'tidypics_entity_menu_setup'); -/* - // Extend hover-over and profile menu - elgg_extend_view('profile/menu/links','tidypics/hover_menu'); + // Add group option + add_group_tool_option('photos', elgg_echo('tidypics:enablephotos'), true); + elgg_extend_view('groups/tool_latest', 'photos/group_module'); +/* //group view ** psuedo widget view for group pages** elgg_extend_view('groups/right_column','tidypics/groupprofile_albums'); @@ -57,16 +58,11 @@ function tidypics_init() { // register for menus //register_elgg_event_handler('pagesetup', 'system', 'tidypics_submenus'); - register_elgg_event_handler('pagesetup', 'system', 'tidypics_adminmenu'); // 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'); - // Register a URL handler for files - register_entity_url_handler('tidypics_image_url', 'object', 'image'); - register_entity_url_handler('tidypics_album_url', 'object', 'album'); - add_group_tool_option('photos', elgg_echo('tidypics:enablephotos'), true); if (get_plugin_setting('grp_perm_override', 'tidypics') != "disabled") { @@ -225,17 +221,6 @@ function tidypics_submenus() { } /** - * Sets up tidypics admin menu. Triggered on pagesetup. - */ -function tidypics_adminmenu() { - global $CONFIG; - - if (get_context() == 'admin' && isadminloggedin()) { - add_submenu_item(elgg_echo('tidypics:administration'), $CONFIG->url . "pg/photos/admin/"); - } -} - -/** * Sets up submenus for tidypics most viewed pages */ function tidypics_mostviewed_submenus() { @@ -501,28 +486,6 @@ function tidypics_notify_message($hook, $type, $result, $params) { } /** - * Populates the ->getUrl() method for file objects - * Registered in the init function - * - * @param ElggEntity $entity album/image entity - * @return string File URL - */ -function tidypics_image_url($entity) { - global $CONFIG; - $title = $entity->title; - $title = friendly_title($title); - return $CONFIG->url . "pg/photos/view/" . $entity->getGUID() . "/" . $title; -} - -function tidypics_album_url($entity) { - global $CONFIG; - $title = $entity->title; - $title = friendly_title($title); - return $CONFIG->url . "pg/photos/album/" . $entity->getGUID() . "/" . $title; -} - - -/** * Catch the plugin hook and add the default album slideshow * * @param $hook - 'tidypics:slideshow' diff --git a/views/default/object/album.php b/views/default/object/album.php index 51b25b7da..bfcfd96d2 100644 --- a/views/default/object/album.php +++ b/views/default/object/album.php @@ -14,5 +14,9 @@ $full_view = elgg_extract('full_view', $vars, false); if ($full_view) { echo elgg_view('object/album/full', $vars); } else { - echo elgg_view('object/album/summary', $vars); + if (elgg_in_context('widgets')) { + echo elgg_view('object/album/list', $vars); + } else { + echo elgg_view('object/album/gallery', $vars); + } } diff --git a/views/default/object/album/summary.php b/views/default/object/album/gallery.php index 78eec3517..78eec3517 100644 --- a/views/default/object/album/summary.php +++ b/views/default/object/album/gallery.php diff --git a/views/default/object/album/list.php b/views/default/object/album/list.php new file mode 100644 index 000000000..ccbd01cd1 --- /dev/null +++ b/views/default/object/album/list.php @@ -0,0 +1,52 @@ +<?php +/** + * Display an album as an item in a list + * + * @uses $vars['entity'] TidypicsAlbum + * + * @author Cash Costello + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 + */ + +$album = elgg_extract('entity', $vars); +$owner = $album->getOwnerEntity(); + +$owner_link = elgg_view('output/url', array( + 'href' => "photos/owner/$owner->username", + 'text' => $owner->name, + 'is_trusted' => true, +)); +$author_text = elgg_echo('byline', array($owner_link)); +$date = elgg_view_friendly_time($album->time_created); +$categories = elgg_view('output/categories', $vars); + +$subtitle = "$author_text $date $categories"; + +$title = elgg_view('output/url', array( + 'text' => $album->getTitle(), + 'href' => $album->getURL(), +)); + +$params = array( + 'entity' => $album, + 'title' => $title, + 'metadata' => null, + 'subtitle' => $subtitle, + 'tags' => elgg_view('output/tags', array('tags' => $album->tags)), +); +$params = $params + $vars; +$summary = elgg_view('object/elements/summary', $params); + +$cover = elgg_view('output/img', array( + 'src' => $album->getCoverImageURL('thumb'), + 'alt' => $album->getTitle(), + 'class' => 'elgg-photo', +)); +$icon = elgg_view('output/url', array( + 'text' => $cover, + 'href' => $album->getURL(), + 'encode_text' => false, + 'is_trusted' => true, +)); + +echo $header = elgg_view_image_block($icon, $summary); diff --git a/views/default/photos/group_module.php b/views/default/photos/group_module.php new file mode 100644 index 000000000..aa0e7b3ff --- /dev/null +++ b/views/default/photos/group_module.php @@ -0,0 +1,45 @@ +<?php +/** + * Group blog module + */ + +$group = elgg_get_page_owner_entity(); + +if ($group->photos_enable == "no") { + return true; +} + +$all_link = elgg_view('output/url', array( + 'href' => "photos/group/$group->guid/all", + 'text' => elgg_echo('link:view:all'), + 'is_trusted' => true, +)); + +elgg_push_context('widgets'); +$options = array( + 'type' => 'object', + 'subtype' => 'album', + 'container_guid' => elgg_get_page_owner_guid(), + 'limit' => 6, + 'full_view' => false, + 'pagination' => false, +); +$content = elgg_list_entities($options); +elgg_pop_context(); + +if (!$content) { + $content = '<p>' . elgg_echo('tidypics:none') . '</p>'; +} + +$new_link = elgg_view('output/url', array( + 'href' => "photos/add/$group->guid", + 'text' => elgg_echo('photos:add'), + 'is_trusted' => true, +)); + +echo elgg_view('groups/profile/module', array( + 'title' => elgg_echo('photos:group'), + 'content' => $content, + 'all_link' => $all_link, + 'add_link' => $new_link, +)); |