aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2009-03-28 03:01:00 +0000
committerCash Costello <cash.costello@gmail.com>2009-03-28 03:01:00 +0000
commit09619e09ed4544a0529231bfc8dd81ec719f2810 (patch)
tree3e74b71b9682174770518f3e9b6781911d05b2e5
parent8275ddfe8ebe821f1062f280696d475940461ba9 (diff)
downloadelgg-09619e09ed4544a0529231bfc8dd81ec719f2810.tar.gz
elgg-09619e09ed4544a0529231bfc8dd81ec719f2810.tar.bz2
moved edit and delete to page handler - need to update links
-rw-r--r--actions/delete.php4
-rw-r--r--edit.php30
-rw-r--r--start.php59
-rw-r--r--viewalbum.php17
4 files changed, 70 insertions, 40 deletions
diff --git a/actions/delete.php b/actions/delete.php
index e142e9660..5c275003e 100644
--- a/actions/delete.php
+++ b/actions/delete.php
@@ -8,8 +8,8 @@
//if not logged in, see world pictures instead
if (!isloggedin()) forward('pg/photos/world');
- $guid = (int) get_input('file');
- $forward_url = 'pg/photos/world'; //forward to world pictures if there is an unknown error
+ $guid = (int) get_input('guid');
+ $forward_url = 'pg/photos/world'; //forward to world pictures if there is an unknown error
if ($photoObject = get_entity($guid)) {
if ($photoObject->canEdit()) {
diff --git a/edit.php b/edit.php
index 3e597cf05..b84d74724 100644
--- a/edit.php
+++ b/edit.php
@@ -1,39 +1,43 @@
<?php
/**
- * Tidypics Edit Single Photo Properties
+ * Tidypics Edit for Albums and Single Photos
*
*/
include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
gatekeeper();
- set_context('photos');
- $file = (int) get_input('file_guid');
+
+ set_context('photos');
+ $guid = (int) get_input('guid');
- if (!$file = get_entity($file))
+ if (!$entity = get_entity($guid))
forward();
- if (!$file->canEdit())
+ if (!$entity->canEdit())
forward();
- $subtype = $file->getSubtype();
+ $subtype = $entity->getSubtype();
if ($subtype == 'album') {
- if($container = $file->container_guid)
- set_page_owner($container);
-
$title = elgg_echo('album:edit');
+
+ if ($container = $entity->container_guid)
+ set_page_owner($container);
+
} else if ($subtype == 'image') {
- if ($container = get_entity($file->container_guid)->container_guid)
- set_page_owner($container);
-
$title = elgg_echo('image:edit');
+
+ if ($container = get_entity($entity->container_guid)->container_guid)
+ set_page_owner($container);
+
} else {
forward();
}
$area2 .= elgg_view_title($title);
- $area2 .= elgg_view('tidypics/forms/edit', array('entity' => $file, 'subtype' => $subtype));
+ $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);
?> \ No newline at end of file
diff --git a/start.php b/start.php
index 16923787e..798becce4 100644
--- a/start.php
+++ b/start.php
@@ -113,48 +113,57 @@
if (isset($page[0]))
{
- switch($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/index.php");
- break;
-
- case "view": //view an image individually
- set_input('guid',$page[1]);
+ break;
+
+ case "view": //view an image individually
+ if (isset($page[1])) set_input('guid',$page[1]);
include($CONFIG->pluginspath . "tidypics/viewimage.php");
break;
case "album": //view an album individually
- set_input('guid',$page[1]);
+ if (isset($page[1])) set_input('guid',$page[1]);
include($CONFIG->pluginspath . "tidypics/viewalbum.php");
break;
case "new": //create new album
if (isset($page[1])) set_input('username',$page[1]);
- include($CONFIG->pluginspath . "tidypics/newalbum.php");
- break;
-
- case "upload": //upload images to album
+ include($CONFIG->pluginspath . "tidypics/newalbum.php");
+ break;
+
+ case "upload": //upload images to album
if (isset($page[1])) set_input('container_guid',$page[1]);
- include($CONFIG->pluginspath . "tidypics/upload.php");
- break;
-
- case "friends":
+ include($CONFIG->pluginspath . "tidypics/upload.php");
+ break;
+
+ case "edit": //edit image or album
+ if (isset($page[1])) set_input('guid',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/edit.php");
+ break;
+
+ case "delete": //edit image or album
+ if (isset($page[1])) set_input('guid',$page[1]);
+ include($CONFIG->pluginspath . "tidypics/actions/delete.php");
+ break;
+
+ case "friends":
if (isset($page[1])) set_input('username',$page[1]);
- include($CONFIG->pluginspath . "tidypics/friends.php");
- break;
-
- case "world":
- include($CONFIG->pluginspath . "tidypics/world.php");
- break;
-
- }
+ include($CONFIG->pluginspath . "tidypics/friends.php");
+ break;
+
+ case "world":
+ include($CONFIG->pluginspath . "tidypics/world.php");
+ break;
+
+ }
}
else
{
- // Include the standard profile index
- if (isset($page[1])) set_input('username',$page[1]);
+ // going to the index because something is wrong with the page handler
include($CONFIG->pluginspath . "tidypics/index.php");
}
diff --git a/viewalbum.php b/viewalbum.php
index 092ad76a8..d80a3d8e6 100644
--- a/viewalbum.php
+++ b/viewalbum.php
@@ -21,6 +21,23 @@
$owner = page_owner_entity();
+ // setup group menu
+ if ($owner instanceof ElggGroup) {
+ add_submenu_item( elgg_echo('album:create'),
+ $CONFIG->wwwroot . 'pg/photos/new/' . $owner->username,
+ 'tidypics');
+ add_submenu_item( elgg_echo('album:addpix'),
+ $CONFIG->wwwroot . 'pg/photos/upload/' . $album_guid,
+ 'tidypics');
+ add_submenu_item( elgg_echo('album:edit'),
+ $CONFIG->wwwroot . 'pg/photos/edit/' . $album_guid,
+ 'tidypics');
+ add_submenu_item( elgg_echo('album:delete'),
+ $CONFIG->wwwroot . 'pg/photos/delete/' . $album_guid,
+ 'tidypics',
+ true);
+ }
+
// set title and body
$title = $album->title;
$area2 = elgg_view_title($title);