aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
Diffstat (limited to 'pages')
-rw-r--r--pages/friends.php41
-rw-r--r--pages/ownedalbums.php67
-rw-r--r--pages/photos/album/view.php46
-rw-r--r--pages/photos/all.php37
-rw-r--r--pages/photos/friends.php33
-rw-r--r--pages/photos/owner.php45
-rw-r--r--pages/viewalbum.php75
-rw-r--r--pages/world.php32
8 files changed, 161 insertions, 215 deletions
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 @@
-<?php
-/**
- * Tidypics Friends Albums Listing
- *
- * List all the albums of someone's friends
- */
-
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-$username = get_input('username');
-
-// if no username, redirect to world photo albums
-if (!$username) {
- forward('pg/photos/world');
-}
-
-// setup title
-$user = get_user_by_username($username);
-if (!$user) {
- forward('pg/photos/world');
-}
-if ($user->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 @@
-<?php
-/**
- * tidypics photo gallery album listing page for a person/group
- *
- * Shows all the albums that belong to that person or group
- */
-
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-// if this page belongs to a closed group, prevent anyone outside group from seeing
-if (is_callable('group_gatekeeper')) {
- group_gatekeeper();
-}
-
-//get the owner of the current page
-$owner = page_owner_entity();
-
-
-//if page owner cannot be found, forward to world album list
-if (is_null($owner->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 @@
+<?php
+/**
+ * This displays the photos that belong to an album
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+group_gatekeeper();
+
+// get the album entity
+$album_guid = (int) get_input('guid');
+$album = get_entity($album_guid);
+if (!$album) {
+
+}
+
+elgg_set_page_owner_guid($album->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 @@
+<?php
+/**
+ * View all albums on the site
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+elgg_push_breadcrumb(elgg_echo('photos'));
+
+$num_albums = 16;
+
+elgg_push_context('tidypics:main');
+$offset = (int)get_input('offset', 0);
+$content = elgg_list_entities(array(
+ 'type' => '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 @@
+<?php
+/**
+ * List all the albums of someone's friends
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+$owner = elgg_get_page_owner_entity();
+
+elgg_push_breadcrumb(elgg_echo('photos'), "photos/all");
+elgg_push_breadcrumb($owner->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 @@
+<?php
+/**
+ * Show all the albums that belong to a user or group
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+group_gatekeeper();
+
+$owner = elgg_get_page_owner_entity();
+
+//set the title
+$title = elgg_echo('album:user', array($owner->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 @@
-<?php
-
-/**
- * Tidypics Album View Page
- *
- * This displays a listing of all the photos that belong to an album
- */
-
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-// if this page belongs to a closed group, prevent anyone outside group from seeing
-if (is_callable('group_gatekeeper')) {
- group_gatekeeper();
-}
-
-// get the album entity
-$album_guid = (int) get_input('guid');
-$album = get_entity($album_guid);
-
-// panic if we can't get it
-if (!$album) {
- forward();
-}
-
-// container should always be set, but just in case
-if ($album->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 . '&amp;__elgg_token=' . $token . '&amp;__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 @@
-<?php
-/**
- * Tidypics View All Albums on Site
- *
- */
-
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-// set page owner to logged in user
-if (isloggedin()) {
- set_page_owner(get_loggedin_userid());
-}
-
-$num_albums = 16;
-
-$title = elgg_echo('album:all');
-$area2 = elgg_view_title($title);
-
-set_context('search');
-set_input('search_viewtype', 'gallery');
-$content .= elgg_list_entities(array(
- 'type' => '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);