aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-11-19 18:43:35 -0500
committercash <cash.costello@gmail.com>2011-11-19 18:43:35 -0500
commit98664daa72a390fe760b69116af8bfa9327826e3 (patch)
tree0c28594625cd810dcb2c22fc736191071c55b7fa /pages
parent4562cfbb1a630b14fd194271f99f1f8c098dc38d (diff)
downloadelgg-98664daa72a390fe760b69116af8bfa9327826e3.tar.gz
elgg-98664daa72a390fe760b69116af8bfa9327826e3.tar.bz2
album creation and editing is working
Diffstat (limited to 'pages')
-rw-r--r--pages/edit.php54
-rw-r--r--pages/newalbum.php30
-rw-r--r--pages/photos/album/add.php34
-rw-r--r--pages/photos/album/edit.php47
-rw-r--r--pages/photos/album/view.php3
-rw-r--r--pages/photos/image/upload.php (renamed from pages/upload.php)0
6 files changed, 83 insertions, 85 deletions
diff --git a/pages/edit.php b/pages/edit.php
deleted file mode 100644
index 06d3dd9c4..000000000
--- a/pages/edit.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-/**
- * Tidypics Edit for Albums and Single Photos
- *
- */
-
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-// make sure the user is logged_in
-gatekeeper();
-
-set_context('photos');
-$guid = (int) get_input('guid');
-
-if (!$entity = get_entity($guid)) {
- forward();
-}
-
-if (!$entity->canEdit()) {
- forward();
-}
-
-$subtype = $entity->getSubtype();
-
-if ($subtype == 'album') {
- $title = elgg_echo('album:edit');
-
- if ($container = $entity->container_guid) {
- set_page_owner($container);
- }
-
-} else if ($subtype == 'image') {
- $title = elgg_echo('image:edit');
-
- if ($container = get_entity($entity->container_guid)->container_guid) {
- set_page_owner($container);
- }
-
-} else {
- forward();
-}
-
-$page_owner = page_owner_entity();
-if ($page_owner instanceof ElggGroup) {
- add_submenu_item( sprintf(elgg_echo('album:group'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
-}
-
-
-$area2 .= elgg_view_title($title);
-$area2 .= elgg_view('tidypics/forms/edit', array('entity' => $entity, 'subtype' => $subtype));
-$body = elgg_view_layout('two_column_left_sidebar', $area1, $area2);
-
-page_draw($title, $body);
diff --git a/pages/newalbum.php b/pages/newalbum.php
deleted file mode 100644
index 535116237..000000000
--- a/pages/newalbum.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-/**
- * Tidypics Create New Album Page
- *
- */
-
-// Load Elgg engine
-include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
-
-// must be logged in to create a new album
-gatekeeper();
-
-// Get the current page's owner
-$page_owner = page_owner_entity();
-if ($page_owner === false || is_null($page_owner)) {
- $page_owner = get_loggedin_user();
- set_page_owner($page_owner->guid);
-}
-
-if ($page_owner instanceof ElggGroup) {
- add_submenu_item(sprintf(elgg_echo('album:group'), $page_owner->name),
- $CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
-}
-
-$area2 = elgg_view_title(elgg_echo('album:add'));
-$area2 .= elgg_view("tidypics/forms/edit");
-
-// Display page
-page_draw(elgg_echo('album:add'),elgg_view_layout("two_column_left_sidebar", '', $area2));
diff --git a/pages/photos/album/add.php b/pages/photos/album/add.php
new file mode 100644
index 000000000..d34d39177
--- /dev/null
+++ b/pages/photos/album/add.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Create new album page
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+$owner = elgg_get_page_owner_entity();
+
+gatekeeper();
+group_gatekeeper();
+
+$title = elgg_echo('photos:add');
+
+// set up breadcrumbs
+elgg_push_breadcrumb(elgg_echo('photos'), "photos/all");
+if (elgg_instanceof($owner, 'user')) {
+ elgg_push_breadcrumb($owner->name, "photos/owner/$owner->username");
+} else {
+ elgg_push_breadcrumb($owner->name, "photos/group/$owner->guid/all");
+}
+elgg_push_breadcrumb($title);
+
+$vars = tidypics_prepare_form_vars();
+$content = elgg_view_form('photos/album/save', array('method' => 'post'), $vars);
+
+$body = elgg_view_layout('content', array(
+ 'content' => $content,
+ 'title' => $title,
+ 'filter' => '',
+));
+
+echo elgg_view_page($title, $body);
diff --git a/pages/photos/album/edit.php b/pages/photos/album/edit.php
new file mode 100644
index 000000000..6fff50b29
--- /dev/null
+++ b/pages/photos/album/edit.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Edit an album
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+$guid = (int) get_input('guid');
+
+if (!$entity = get_entity($guid)) {
+ // @todo either deleted or do not have access
+ forward('photos/all');
+}
+
+if (!$entity->canEdit()) {
+ // @todo cannot change it
+ forward('photos/all');
+}
+
+elgg_set_page_owner_guid($entity->getContainerGUID());
+$owner = elgg_get_page_owner_entity();
+
+gatekeeper();
+group_gatekeeper();
+
+$title = elgg_echo('album:edit');
+
+// set up breadcrumbs
+elgg_push_breadcrumb(elgg_echo('photos'), "photos/all");
+if (elgg_instanceof($owner, 'user')) {
+ elgg_push_breadcrumb($owner->name, "photos/owner/$owner->username");
+} else {
+ elgg_push_breadcrumb($owner->name, "photos/group/$owner->guid/all");
+}
+elgg_push_breadcrumb($title);
+
+$vars = tidypics_prepare_form_vars($entity);
+$content = elgg_view_form('photos/album/save', array('method' => 'post'), $vars);
+
+$body = elgg_view_layout('content', array(
+ 'content' => $content,
+ 'title' => $title,
+ 'filter' => '',
+));
+
+echo elgg_view_page($title, $body);
diff --git a/pages/photos/album/view.php b/pages/photos/album/view.php
index adb5a1b51..aafcf14bc 100644
--- a/pages/photos/album/view.php
+++ b/pages/photos/album/view.php
@@ -12,7 +12,8 @@ group_gatekeeper();
$album_guid = (int) get_input('guid');
$album = get_entity($album_guid);
if (!$album) {
-
+ // @todo album deleted or don't have access
+ forward('photos/all');
}
elgg_set_page_owner_guid($album->getContainerGUID());
diff --git a/pages/upload.php b/pages/photos/image/upload.php
index 6580c6f52..6580c6f52 100644
--- a/pages/upload.php
+++ b/pages/photos/image/upload.php