From 4562cfbb1a630b14fd194271f99f1f8c098dc38d Mon Sep 17 00:00:00 2001
From: cash
Date: Sat, 19 Nov 2011 12:10:46 -0500
Subject: basic pages for viewing all/mine/friends and viewing an album
---
classes/TidypicsAlbum.php | 18 +++
classes/TidypicsImage.php | 13 ++
languages/en.php | 9 +-
pages/friends.php | 41 ------
pages/ownedalbums.php | 67 ---------
pages/photos/album/view.php | 46 ++++++
pages/photos/all.php | 37 +++++
pages/photos/friends.php | 33 +++++
pages/photos/owner.php | 45 ++++++
pages/viewalbum.php | 75 ----------
pages/world.php | 32 ----
start.php | 261 +++++++++++++++++----------------
views/default/object/album.php | 154 ++-----------------
views/default/object/album/full.php | 60 ++++++++
views/default/object/album/summary.php | 41 ++++++
views/default/object/image.php | 17 ++-
views/default/object/image/full.php | 2 +
views/default/object/image/summary.php | 43 ++++++
views/default/tidypics/css.php | 12 ++
19 files changed, 518 insertions(+), 488 deletions(-)
delete mode 100644 pages/friends.php
delete mode 100644 pages/ownedalbums.php
create mode 100644 pages/photos/album/view.php
create mode 100644 pages/photos/all.php
create mode 100644 pages/photos/friends.php
create mode 100644 pages/photos/owner.php
delete mode 100644 pages/viewalbum.php
delete mode 100644 pages/world.php
create mode 100644 views/default/object/album/full.php
create mode 100644 views/default/object/album/summary.php
create mode 100644 views/default/object/image/full.php
create mode 100644 views/default/object/image/summary.php
diff --git a/classes/TidypicsAlbum.php b/classes/TidypicsAlbum.php
index e178acd5d..1fbdb8ad8 100644
--- a/classes/TidypicsAlbum.php
+++ b/classes/TidypicsAlbum.php
@@ -17,6 +17,15 @@ class TidypicsAlbum extends ElggObject {
parent::__construct($guid);
}
+ /**
+ * Get the title of the photo album
+ *
+ * @return string
+ */
+ public function getTitle() {
+ return $this->title;
+ }
+
/**
* Delete album
*
@@ -70,6 +79,15 @@ class TidypicsAlbum extends ElggObject {
return elgg_view_entity_list($images, $count, $offset, $limit, false, false, true);
}
+ public function getCoverImageURL($size = 'small') {
+ if ($this->cover) {
+ $url = "pg/photos/thumbnail/$this->cover/$size/";
+ } else {
+ $url = "mod/tidypics/graphics/empty_album.png";
+ }
+ return elgg_normalize_url($url);
+ }
+
/**
* Get the GUID of the album cover
*
diff --git a/classes/TidypicsImage.php b/classes/TidypicsImage.php
index 531d54912..652cc9e9b 100644
--- a/classes/TidypicsImage.php
+++ b/classes/TidypicsImage.php
@@ -17,6 +17,19 @@ class TidypicsImage extends ElggFile {
parent::__construct($guid);
}
+ /**
+ * Get the title of the image
+ *
+ * @return string
+ */
+ public function getTitle() {
+ return $this->title;
+ }
+
+ public function getSrcUrl() {
+ return "pg/photos/thumbnail/$this->guid/small/";
+ }
+
/**
* delete image
*
diff --git a/languages/en.php b/languages/en.php
index 8bc66a5f6..d6d934c20 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -11,11 +11,15 @@ $english = array(
'photos' => "Photos",
'album' => "Photo Album",
'albums' => "Photo Albums",
+
+ 'photos:add' => "Create album",
+ 'images:upload' => "Upload photos",
+
'album:slideshow' => "View slideshow",
'album:yours' => "Your photo albums",
'album:yours:friends' => "Your friends' photo albums",
'album:user' => "%s's photo albums",
- 'album:friends' => "%s's friends' photo albums",
+ 'album:friends' => "Friends' photo albums",
'album:all' => "All site photo albums",
'album:group' => "Group albums",
'item:object:image' => "Photos",
@@ -104,6 +108,9 @@ $english = array(
'tidypics:uploader:basic' => 'You can upload up to 10 photos at a time (%s MB maximum per photo)',
'tidypics:sort:instruct' => 'Sort the album photos by dragging and dropping the images. Then click the save button.',
+ // albums
+ 'album:num' => '%s photos',
+
//views
'image:total' => "Images in album:",
'image:by' => "Image added by",
diff --git a/pages/friends.php b/pages/friends.php
deleted file mode 100644
index d5dfdba5c..000000000
--- a/pages/friends.php
+++ /dev/null
@@ -1,41 +0,0 @@
-guid == get_loggedin_userid()) {
- $title = elgg_echo('album:yours:friends');
-} else {
- $title = sprintf(elgg_echo('album:friends'), $user->name);
-}
-
-$area2 = elgg_view_title($title);
-
-$albums = get_user_friends_objects($user->guid, 'album', 12);
-
-// get html for viewing list of photo albums
-set_context('search');
-set_input('search_viewtype', 'gallery'); // need to force gallery view
-$content = tp_view_entity_list($albums, count($albums), 0, 12, false, false, true);
-
-$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,));
-
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
-page_draw($title, $body);
diff --git a/pages/ownedalbums.php b/pages/ownedalbums.php
deleted file mode 100644
index 9483512c6..000000000
--- a/pages/ownedalbums.php
+++ /dev/null
@@ -1,67 +0,0 @@
-username) || empty($owner->username)) {
- forward('pg/photos/world');
-}
-
-
-// setup group menu for album index
-if ($owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username);
- if (can_write_to_container(0, $owner->guid)) {
- add_submenu_item( elgg_echo('album:create'),
- $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username,
- 'tidypics');
- }
-}
-
-//set the title
-$title = sprintf(elgg_echo('album:user'), $owner->name);
-$area2 = elgg_view_title($title);
-
-// Get objects
-set_context('search');
-set_input('search_viewtype', 'gallery');
-if ($owner instanceof ElggGroup) {
- $content .= elgg_list_entities(array(
- "type" => "object",
- "subtype" => "album",
- "container_guid" => $owner->guid,
- "limit" => 12,
- "full_view" => false,
-));
-} else {
- $content .= elgg_list_entities(array(
- "type" => "object",
- "subtype" => "album",
- "container_guid" => $owner->guid,
- "limit" => 12,
- "full_view" => false,
-));
-}
-
-$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,));
-
-set_context('photos');
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
-// Finally draw the page
-page_draw($title, $body);
\ No newline at end of file
diff --git a/pages/photos/album/view.php b/pages/photos/album/view.php
new file mode 100644
index 000000000..adb5a1b51
--- /dev/null
+++ b/pages/photos/album/view.php
@@ -0,0 +1,46 @@
+getContainerGUID());
+$owner = elgg_get_page_owner_entity();
+
+$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");
+elgg_push_breadcrumb($album->getTitle());
+
+$content = elgg_view_entity($album, array('full_view' => true));
+
+if ($album->canWriteToContainer()) {
+ elgg_register_menu_item('title', array(
+ 'name' => 'upload',
+ 'href' => 'photos/upload/' . $album->getGUID(),
+ 'text' => elgg_echo('images:upload'),
+ 'link_class' => 'elgg-button elgg-button-action',
+ ));
+}
+
+$body = elgg_view_layout('content', array(
+ 'filter' => false,
+ 'content' => $content,
+ 'title' => $album->getTitle(),
+ 'sidebar' => elgg_view('tidypics/sidebar', array('page' => 'album')),
+));
+
+echo elgg_view_page($title, $body);
diff --git a/pages/photos/all.php b/pages/photos/all.php
new file mode 100644
index 000000000..edda65ce0
--- /dev/null
+++ b/pages/photos/all.php
@@ -0,0 +1,37 @@
+ 'object',
+ 'subtype' => 'album',
+ 'limit' => $num_albums,
+ 'full_view' => false,
+ 'list_type' => 'gallery',
+ 'list_type_toggle' => false,
+ 'gallery_class' => 'tidypics-gallery',
+));
+elgg_pop_context();
+
+$title = elgg_echo('album:all');
+
+elgg_register_title_button('photos');
+
+$body = elgg_view_layout('content', array(
+ 'filter_context' => 'all',
+ 'content' => $content,
+ 'title' => $title,
+ 'sidebar' => elgg_view('tidypics/sidebar', array('page' => 'all')),
+));
+
+echo elgg_view_page($title, $body);
diff --git a/pages/photos/friends.php b/pages/photos/friends.php
new file mode 100644
index 000000000..b7b6178c5
--- /dev/null
+++ b/pages/photos/friends.php
@@ -0,0 +1,33 @@
+name, "photos/friends/$owner->username");
+elgg_push_breadcrumb(elgg_echo('friends'));
+
+$title = elgg_echo('album:friends');
+
+
+$num_albums = 16;
+
+elgg_push_context('tidypics:main');
+set_input('list_type', 'gallery');
+$content = list_user_friends_objects($owner->guid, 'album', $num_albums, false);
+elgg_pop_context();
+
+elgg_register_title_button();
+
+$body = elgg_view_layout('content', array(
+ 'filter_context' => 'friends',
+ 'content' => $content,
+ 'title' => $title,
+));
+
+echo elgg_view_page($title, $body);
diff --git a/pages/photos/owner.php b/pages/photos/owner.php
new file mode 100644
index 000000000..f6582e326
--- /dev/null
+++ b/pages/photos/owner.php
@@ -0,0 +1,45 @@
+name));
+
+// set up breadcrumbs
+elgg_push_breadcrumb(elgg_echo('photos'), 'photos/all');
+elgg_push_breadcrumb($owner->name);
+
+
+$num_albums = 16;
+
+elgg_push_context('tidypics:main');
+$content = elgg_list_entities(array(
+ 'type' => 'object',
+ 'subtype' => 'album',
+ 'container_guid' => $owner->getGUID(),
+ 'limit' => $num_albums,
+ 'full_view' => false,
+ 'list_type' => 'gallery',
+ 'list_type_toggle' => false,
+ 'gallery_class' => 'tidypics-gallery',
+));
+elgg_pop_context();
+
+elgg_register_title_button();
+
+$body = elgg_view_layout('content', array(
+ 'filter_context' => 'mine',
+ 'content' => $content,
+ 'title' => $title,
+ 'sidebar' => elgg_view('tidypics/sidebar', array('page' => 'owner')),
+));
+
+echo elgg_view_page($title, $body);
diff --git a/pages/viewalbum.php b/pages/viewalbum.php
deleted file mode 100644
index 870596769..000000000
--- a/pages/viewalbum.php
+++ /dev/null
@@ -1,75 +0,0 @@
-container_guid) {
- set_page_owner($album->container_guid);
-} else {
- set_page_owner($album->owner_guid);
-}
-
-$owner = page_owner_entity();
-
-// setup group menu
-if ($owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $owner->username);
-}
-
-// allow other plugins to override the slideshow
-$slideshow_link = trigger_plugin_hook('tp_slideshow', 'album', array('album' => $album), null);
-if ($slideshow_link) {
- add_submenu_item(elgg_echo('album:slideshow'),
- $slideshow_link,
- 'photos' );
-}
-
-if (can_write_to_container(0, $album->container_guid)) {
- if ($owner instanceof ElggGroup) {
- add_submenu_item( elgg_echo('album:create'),
- $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username,
- 'photos');
- }
- add_submenu_item( elgg_echo('album:addpix'),
- $CONFIG->wwwroot . 'pg/photos/upload/' . $album_guid,
- 'photos');
- add_submenu_item( elgg_echo('album:sort'),
- $CONFIG->wwwroot . 'pg/photos/sort/' . $album_guid,
- 'photos');
- add_submenu_item( elgg_echo('album:edit'),
- $CONFIG->wwwroot . 'pg/photos/edit/' . $album_guid,
- 'photos');
- $ts = time();
- $token = generate_action_token($ts);
- add_submenu_item( elgg_echo('album:delete'),
- $CONFIG->wwwroot . 'action/tidypics/delete?guid=' . $album_guid . '&__elgg_token=' . $token . '&__elgg_ts=' . $ts,
- 'photos',
- true);
-}
-
-// create body
-$area2 = elgg_view_entity($album, true);
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
-page_draw($album->title, $body);
diff --git a/pages/world.php b/pages/world.php
deleted file mode 100644
index 4599f8209..000000000
--- a/pages/world.php
+++ /dev/null
@@ -1,32 +0,0 @@
- 'object',
- 'subtype' => 'album',
- 'limit' => $num_albums,
-));
-set_context('photos');
-
-$area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,));
-
-$body = elgg_view_layout('two_column_left_sidebar', '', $area2);
-
-page_draw($title, $body);
diff --git a/start.php b/start.php
index 167db651e..ae52e7098 100644
--- a/start.php
+++ b/start.php
@@ -1,8 +1,9 @@
wwwroot . "pg/photos/owned/" . $_SESSION['user']->username);
- }
+ // Set up site menu
+ elgg_register_menu_item('site', array(
+ 'name' => 'photos',
+ 'href' => 'photos/all',
+ 'text' => elgg_echo('photos'),
+ ));
// Extend CSS
- elgg_extend_view('css', 'tidypics/css');
+ elgg_extend_view('css/elgg', 'tidypics/css');
// Extend hover-over and profile menu
elgg_extend_view('profile/menu/links','tidypics/hover_menu');
@@ -42,11 +43,11 @@ function tidypics_init() {
elgg_extend_view('extensions/xmlns', 'extensions/tidypics/xmlns');
elgg_extend_view('extensions/channel', 'extensions/tidypics/channel');
- // Register a page handler, so we can have nice URLs
- register_page_handler('photos','tidypics_page_handler');
+ // Register a page handler so we can have nice URLs
+ elgg_register_page_handler('photos', 'tidypics_page_handler');
// register for menus
- register_elgg_event_handler('pagesetup', 'system', 'tidypics_submenus');
+ //register_elgg_event_handler('pagesetup', 'system', 'tidypics_submenus');
register_elgg_event_handler('pagesetup', 'system', 'tidypics_adminmenu');
// Add a new tidypics widget
@@ -248,145 +249,149 @@ function tidypics_mostviewed_submenus() {
/**
* tidypics page handler
*
- * @param array $page Array of page elements, forwarded by the page handling mechanism
+ * @param array $page Array of url segments
*/
function tidypics_page_handler($page) {
global $CONFIG;
- if (isset($page[0])) {
- switch($page[0]) {
- case "owned": //view list of albums owned by container
- if (isset($page[1])) {
- set_input('username', $page[1]);
- }
- include($CONFIG->pluginspath . "tidypics/pages/ownedalbums.php");
- break;
+ if (!isset($page[0])) {
+ return false;
+ }
- case "view": //view an image individually
- if (isset($page[1])) {
- set_input('guid', $page[1]);
- }
- include($CONFIG->pluginspath . "tidypics/pages/viewimage.php");
- break;
+ switch($page[0]) {
+ case "all": // all site albums
+ case "world":
+ include($CONFIG->pluginspath . "tidypics/pages/photos/all.php");
+ break;
- case "album": //view an album individually
- if (isset($page[1])) {
- set_input('guid', $page[1]);
- }
- include($CONFIG->pluginspath . "tidypics/pages/viewalbum.php");
- break;
+ case "owned": // albums owned by container entity
+ case "owner":
+ if (isset($page[1])) {
+ set_input('username', $page[1]);
+ }
+ include($CONFIG->pluginspath . "tidypics/pages/photos/owner.php");
+ break;
- case "sort": //sort a photo album
- if (isset($page[1])) {
- set_input('guid', $page[1]);
- }
- include($CONFIG->pluginspath . "tidypics/pages/sortalbum.php");
- break;
+ case "friends": // albums of friends
+ if (isset($page[1])) {
+ set_input('username', $page[1]);
+ }
+ include($CONFIG->pluginspath . "tidypics/pages/photos/friends.php");
+ break;
- case "new": //create new album
- if (isset($page[1])) {
- set_input('username', $page[1]);
- }
- include($CONFIG->pluginspath . "tidypics/pages/newalbum.php");
- break;
+ case "view": //view an image individually
+ if (isset($page[1])) {
+ set_input('guid', $page[1]);
+ }
+ include($CONFIG->pluginspath . "tidypics/pages/viewimage.php");
+ break;
- case "upload": //upload images to album
- if (isset($page[1])) {
- set_input('album_guid', $page[1]);
- }
- if (isset($page[2])) {
- set_input('uploader', 'basic');
- }
- include($CONFIG->pluginspath . "tidypics/pages/upload.php");
- break;
+ case "album": //view an album individually
+ if (isset($page[1])) {
+ set_input('guid', $page[1]);
+ }
+ include($CONFIG->pluginspath . "tidypics/pages/photos/album/view.php");
+ break;
- case "edit": //edit image or album
- if (isset($page[1])) {
- set_input('guid', $page[1]);
- }
- include($CONFIG->pluginspath . "tidypics/pages/edit.php");
- break;
+ case "sort": //sort a photo album
+ if (isset($page[1])) {
+ set_input('guid', $page[1]);
+ }
+ include($CONFIG->pluginspath . "tidypics/pages/sortalbum.php");
+ break;
- case "batch": //update titles and descriptions
- if (isset($page[1])) {
- set_input('batch', $page[1]);
- }
- include($CONFIG->pluginspath . "tidypics/pages/edit_multiple.php");
- break;
+ case "new": //create new album
+ case "add":
+ if (isset($page[1])) {
+ set_input('username', $page[1]);
+ }
+ include($CONFIG->pluginspath . "tidypics/pages/newalbum.php");
+ break;
- case "friends": // albums of friends
- if (isset($page[1])) {
- set_input('username', $page[1]);
- }
- include($CONFIG->pluginspath . "tidypics/pages/friends.php");
- break;
+ case "upload": //upload images to album
+ if (isset($page[1])) {
+ set_input('album_guid', $page[1]);
+ }
+ if (isset($page[2])) {
+ set_input('uploader', 'basic');
+ }
+ include($CONFIG->pluginspath . "tidypics/pages/upload.php");
+ break;
- case "world": // all site albums
- include($CONFIG->pluginspath . "tidypics/pages/world.php");
- break;
+ case "edit": //edit image or album
+ if (isset($page[1])) {
+ set_input('guid', $page[1]);
+ }
+ include($CONFIG->pluginspath . "tidypics/pages/edit.php");
+ break;
- case "download": // download an image
- if (isset($page[1])) {
- set_input('file_guid', $page[1]);
- }
- if (isset($page[2])) {
- set_input('type', $page[2]);
- }
- include($CONFIG->pluginspath . "tidypics/pages/download.php");
- break;
+ case "batch": //update titles and descriptions
+ if (isset($page[1])) {
+ set_input('batch', $page[1]);
+ }
+ include($CONFIG->pluginspath . "tidypics/pages/edit_multiple.php");
+ break;
- case "thumbnail": // tidypics thumbnail
- if (isset($page[1])) {
- set_input('file_guid', $page[1]);
- }
- if (isset($page[2])) {
- set_input('size', $page[2]);
- }
- include($CONFIG->pluginspath . "tidypics/pages/thumbnail.php");
- break;
+ case "download": // download an image
+ if (isset($page[1])) {
+ set_input('file_guid', $page[1]);
+ }
+ if (isset($page[2])) {
+ set_input('type', $page[2]);
+ }
+ include($CONFIG->pluginspath . "tidypics/pages/download.php");
+ break;
- case "tagged": // all photos tagged with user
- if (isset($page[1])) {
- set_input('guid', $page[1]);
- }
- include($CONFIG->pluginspath . "tidypics/pages/tagged.php");
- break;
+ case "thumbnail": // tidypics thumbnail
+ if (isset($page[1])) {
+ set_input('file_guid', $page[1]);
+ }
+ if (isset($page[2])) {
+ set_input('size', $page[2]);
+ }
+ include($CONFIG->pluginspath . "tidypics/pages/thumbnail.php");
+ break;
- case "mostviewed": // images with the most views
- if (isset($page[1])) {
- set_input('username', $page[1]);
- }
- include($CONFIG->pluginspath . "tidypics/pages/lists/mostviewedimages.php");
- break;
+ case "tagged": // all photos tagged with user
+ if (isset($page[1])) {
+ set_input('guid', $page[1]);
+ }
+ include($CONFIG->pluginspath . "tidypics/pages/tagged.php");
+ break;
- case "mostrecent": // images uploaded most recently
- if (isset($page[1])) {
- set_input('username', $page[1]);
- }
- include($CONFIG->pluginspath . "tidypics/pages/lists/mostrecentimages.php");
- break;
+ case "mostviewed": // images with the most views
+ if (isset($page[1])) {
+ set_input('username', $page[1]);
+ }
+ include($CONFIG->pluginspath . "tidypics/pages/lists/mostviewedimages.php");
+ break;
+
+ case "mostrecent": // images uploaded most recently
+ if (isset($page[1])) {
+ set_input('username', $page[1]);
+ }
+ include($CONFIG->pluginspath . "tidypics/pages/lists/mostrecentimages.php");
+ break;
- case "recentlyviewed": // images most recently viewed
- include($CONFIG->pluginspath . "tidypics/pages/lists/recentlyviewed.php");
- break;
+ case "recentlyviewed": // images most recently viewed
+ include($CONFIG->pluginspath . "tidypics/pages/lists/recentlyviewed.php");
+ break;
- case "recentlycommented": // images with the most recent comments
- include($CONFIG->pluginspath . "tidypics/pages/lists/recentlycommented.php");
- break;
+ case "recentlycommented": // images with the most recent comments
+ include($CONFIG->pluginspath . "tidypics/pages/lists/recentlycommented.php");
+ break;
- case "highestrated": // images with the highest average rating
- include($CONFIG->pluginspath . "tidypics/pages/lists/highestrated.php");
- break;
+ case "highestrated": // images with the highest average rating
+ include($CONFIG->pluginspath . "tidypics/pages/lists/highestrated.php");
+ break;
- case "admin":
- include ($CONFIG->pluginspath . "tidypics/pages/admin.php");
- break;
- }
- }
- else {
- // going to all site albums if something goes wrong with the page handler
- include($CONFIG->pluginspath . "tidypics/pages/world.php");
+ case "admin":
+ include ($CONFIG->pluginspath . "tidypics/pages/admin.php");
+ break;
+
+ default:
+ return false;
}
return true;
diff --git a/views/default/object/album.php b/views/default/object/album.php
index 13b94aed5..51b25b7da 100644
--- a/views/default/object/album.php
+++ b/views/default/object/album.php
@@ -1,150 +1,18 @@
getGUID();
-$owner = $album->getOwnerEntity();
-$tags = $album->tags;
-$title = $album->title;
-$desc = $album->description;
-$friendlytime = friendly_time($album->time_created);
-$mime = $album->mimetype;
-
-if (get_context() == "search") {
-
- if (get_input('search_viewtype') == "gallery") {
-
-/******************************************************************************
- *
- * Gallery view of an album object
+ * Album view
*
- * This is called when looking at page of albums
- *
- *
- *****************************************************************************/
-
- $album_cover_guid = $album->getCoverImageGuid();
- if ($album_cover_guid) {
- $album_cover = '';
- } else {
- $album_cover = '';
- }
-?>
-
-
-
-
name;?>
-
- getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")";
- }
-?>
-
-
-' . $title . '
';
- $info .= "username}\">{$owner->name} {$friendlytime}";
- $numcomments = elgg_count_comments($album);
- if ($numcomments) {
- $info .= ", getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")";
- }
- $info .= "
";
+$album = elgg_extract('entity', $vars);
+$full_view = elgg_extract('full_view', $vars, false);
- $album_cover_guid = $album->getCoverImageGuid();
- if ($album_cover_guid) {
- $icon = "getURL()}\">" . '';
- } else {
- $icon = "getURL()}\">" . '';
- }
- echo elgg_view_listing($icon, $info);
- }
+if ($full_view) {
+ echo elgg_view('object/album/full', $vars);
} else {
-
-/******************************************************************************
- *
- * Individual view of an album object
- *
- * This is called when getting a listing of the photos in an album
- *
- *
- *****************************************************************************/
-
- $page = get_input("page");
- list($album_placeholder, $album_id, $album_title) = split("/", $page);
-
- $photo_ratings = get_plugin_setting('photo_ratings', 'tidypics');
- if ($photo_ratings == "enabled") {
- add_submenu_item( elgg_echo("tidypics:highestrated"),
- $CONFIG->wwwroot . "pg/photos/highestrated/group:" . $album_id,
- 'photos');
- }
- echo elgg_view_title($title);
-?>
-
-
-
-
-' . autop($desc) . '
';
-
- $offset = (int)get_input('offset', 0);
- echo $album->viewImages(16, $offset);
- // echo '' . elgg_echo('image:none') . '
';
- // $num_images = 0;
- //}
-
-?>
-
-
-
-
$tags));?>
-
-
name; ?>
-
getSize(); ?>
-
-
-
:
-
-
-
-';
-} // end of individual album view
-
+ echo elgg_view('object/album/summary', $vars);
+}
diff --git a/views/default/object/album/full.php b/views/default/object/album/full.php
new file mode 100644
index 000000000..7484a48f3
--- /dev/null
+++ b/views/default/object/album/full.php
@@ -0,0 +1,60 @@
+getOwnerEntity();
+
+$owner_icon = elgg_view_entity_icon($owner, 'tiny');
+
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $album,
+ 'handler' => 'photos',
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
+));
+
+$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";
+
+$params = array(
+ 'entity' => $album,
+ 'title' => false,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => elgg_view('output/tags', array('tags' => $album->tags)),
+);
+$params = $params + $vars;
+$summary = elgg_view('object/elements/summary', $params);
+
+$body = elgg_list_entities(array(
+ 'type' => 'object',
+ 'subtype' => 'image',
+ 'container_guid' => $album->getGUID(),
+ 'limit' => 16,
+ 'full_view' => false,
+ 'list_type' => 'gallery',
+ 'list_type_toggle' => false,
+ 'gallery_class' => 'tidypics-gallery',
+));
+
+echo elgg_view('object/elements/full', array(
+ 'entity' => $album,
+ 'icon' => $owner_icon,
+ 'summary' => $summary,
+ 'body' => $body,
+));
diff --git a/views/default/object/album/summary.php b/views/default/object/album/summary.php
new file mode 100644
index 000000000..78eec3517
--- /dev/null
+++ b/views/default/object/album/summary.php
@@ -0,0 +1,41 @@
+ $album->getCoverImageURL(),
+ 'alt' => $album->getTitle(),
+ 'class' => 'elgg-photo',
+));
+
+$header = elgg_view('output/url', array(
+ 'text' => $album->getTitle(),
+ 'href' => $album->getURL(),
+));
+
+$body = elgg_view('output/url', array(
+ 'text' => $album_cover,
+ 'href' => $album->getURL(),
+ 'encode_text' => false,
+ 'is_trusted' => true,
+));
+
+$footer = elgg_view('output/url', array(
+ 'text' => $album->getContainerEntity()->name,
+ 'href' => $album->getContainerEntity()->getURL(),
+ 'is_trusted' => true,
+));
+$footer .= '' . elgg_echo('album:num', array($album->getSize())) . '
';
+
+$params = array(
+ 'footer' => $footer,
+);
+echo elgg_view_module('tidypics-album', $header, $body, $params);
diff --git a/views/default/object/image.php b/views/default/object/image.php
index 8c1f23ec2..12d58440d 100644
--- a/views/default/object/image.php
+++ b/views/default/object/image.php
@@ -1,9 +1,24 @@
$image->getSrcURL(),
+ 'alt' => $image->getTitle(),
+ 'class' => 'elgg-photo',
+));
+
+$header = elgg_view('output/url', array(
+ 'text' => $image->getTitle(),
+ 'href' => $image->getURL(),
+));
+
+$body = elgg_view('output/url', array(
+ 'text' => $img,
+ 'href' => $image->getURL(),
+ 'encode_text' => false,
+ 'is_trusted' => true,
+));
+
+/*
+$footer = elgg_view('output/url', array(
+ 'text' => $image->getContainerEntity()->name,
+ 'href' => $image->getContainerEntity()->getURL(),
+ 'is_trusted' => true,
+));
+$footer .= '' . elgg_echo('album:num', array($album->getSize())) . '
';
+*/
+
+$params = array(
+ 'footer' => $footer,
+);
+echo elgg_view_module('tidypics-image', $header, $body, $params);
diff --git a/views/default/tidypics/css.php b/views/default/tidypics/css.php
index 25a29fdc3..bf47d42b7 100644
--- a/views/default/tidypics/css.php
+++ b/views/default/tidypics/css.php
@@ -3,6 +3,18 @@
* tidypics CSS extender
*/
?>
+
+.elgg-module-tidypics-album,
+.elgg-module-tidypics-image {
+ width: 161px;
+ text-align: center;
+ margin: 5px 10px;
+}
+
+
+
/* ---- tidypics object views ---- */
.tidypics_wrapper > table.entity_gallery {
--
cgit v1.2.3