aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2009-03-28 18:44:25 +0000
committerCash Costello <cash.costello@gmail.com>2009-03-28 18:44:25 +0000
commit51bdec218af83488cd15a05c8d731e67fdd22264 (patch)
tree6e5c376b9ecccbc857a42644f2e3224f2ae97674
parent38335addc0fdcf3d798bfc783b0f159eb5c5c2d6 (diff)
downloadelgg-51bdec218af83488cd15a05c8d731e67fdd22264.tar.gz
elgg-51bdec218af83488cd15a05c8d731e67fdd22264.tar.bz2
fixed sticky form for album creation
-rw-r--r--actions/addalbum.php40
-rw-r--r--actions/edit.php10
-rw-r--r--views/default/tidypics/forms/edit.php18
3 files changed, 36 insertions, 32 deletions
diff --git a/actions/addalbum.php b/actions/addalbum.php
index 23fdfd22d..b9954f1c6 100644
--- a/actions/addalbum.php
+++ b/actions/addalbum.php
@@ -8,32 +8,30 @@
if (!isloggedin()) forward();
// Get input data
- $title = get_input('albumtitle');
- $body = get_input('albumbody');
- $tags = get_input('albumtags');
+ $title = get_input('tidypicstitle');
+ $body = get_input('tidypicsbody');
+ $tags = get_input('tidypicstags');
$access = get_input('access_id');
$container_guid = get_input('container_guid', $_SESSION['user']->getGUID());
- $back_url = 'pg/photos/new/' . get_entity($container_guid)->username;
-
+
// Cache to the session
- $_SESSION['albumtitle'] = $title;
- $_SESSION['albumbody'] = $body;
- $_SESSION['albumtags'] = $tags;
-
+ $_SESSION['tidypicstitle'] = $title;
+ $_SESSION['tidypicsbody'] = $body;
+ $_SESSION['tidypicstags'] = $tags;
+
// Convert string of tags into a preformatted array
- $tagarray = string_to_tag_array($tags);
- // Make sure the title / description aren't blank
- if (empty($title) || empty($body)) {
- register_error(elgg_echo("album:blank"));
- forward(get_input('forward_url', $_SERVER['HTTP_REFERER'])); //failed, so forward to previous page
-
+ $tagarray = string_to_tag_array($tags);
+ // Make sure the title isn't blank
+ if (empty($title)) {
+ register_error(elgg_echo("album:blank"));
+ forward($_SERVER['HTTP_REFERER']); //failed, so forward to previous page
// Otherwise, save the album
} else {
// Initialise a new ElggObject
$album = new ElggObject();
// Tell the system it's an album
- $album->subtype = "album";
+ $album->subtype = "album";
// Set its owner to the current user
$album->container_guid = $container_guid;
@@ -62,11 +60,11 @@
system_message(elgg_echo("album:created"));
// Remove the album post cache
- unset($_SESSION['albumtitle']);
- unset($_SESSION['albumbody']);
- unset($_SESSION['albumtags']);
+ unset($_SESSION['tidypicstitle']);
+ unset($_SESSION['tidypicsbody']);
+ unset($_SESSION['tidypicstags']);
- forward("pg/photos/upload/" . $album->guid);
+ forward("pg/photos/upload/" . $album->guid);
}
-
+
?> \ No newline at end of file
diff --git a/actions/edit.php b/actions/edit.php
index a5d84bc18..5eab8caff 100644
--- a/actions/edit.php
+++ b/actions/edit.php
@@ -10,14 +10,13 @@
// Get input data
$guid = (int) get_input('guid'); // guid of image or album
- $title = get_input('title');
- $body = get_input('descript');
+ $title = get_input('tidypicstitle');
+ $body = get_input('tidypicsbody');
$access = get_input('access_id');
- $tags = get_input('tags');
+ $tags = get_input('tidypicstags');
$subtype = get_input('subtype');
$container_guid = get_input('container_guid');
- error_log('container_guid is ' . $container_guid);
// Make sure we actually have permission to edit
$entity = get_entity($guid);
@@ -26,7 +25,6 @@
}
// Get owning user/group
- error_log("owning user is " . $entity->getOwner());
$owner = get_entity($entity->getOwner());
// change access only if access is different from current
@@ -73,4 +71,4 @@
system_message(elgg_echo('images:edited'));
forward($entity->getURL());
-?> \ No newline at end of file
+?>
diff --git a/views/default/tidypics/forms/edit.php b/views/default/tidypics/forms/edit.php
index 0ed8cffab..d7df138b4 100644
--- a/views/default/tidypics/forms/edit.php
+++ b/views/default/tidypics/forms/edit.php
@@ -22,12 +22,20 @@
$action = "tidypics/addalbum";
$tags = "";
$title = "";
- $description = "";
+ $body = "";
if (defined('ACCESS_DEFAULT'))
$access_id = ACCESS_DEFAULT;
else
$access_id = 0;
$subtype = 'album';
+
+ $title = $_SESSION['tidypicstitle'];
+ $body = $_SESSION['tidypicsbody'];
+ $tags = $_SESSION['tidypicstags'];
+
+ unset($_SESSION['tidypicstitle']);
+ unset($_SESSION['tidypicsbody']);
+ unset($_SESSION['tidypicstags']);
}
// group or individual
@@ -38,28 +46,28 @@
<form action="<?php echo $vars['url']; ?>action/<?php echo $action; ?>" method="post">
<p>
<label><?php echo elgg_echo('album:title'); ?></label>
- <?php echo elgg_view("input/text", array("internalname" => "title", "value" => $title,)); ?>
+ <?php echo elgg_view("input/text", array("internalname" => "tidypicstitle", "value" => $title,)); ?>
</p>
<?php
if ($subtype == 'album') {
?>
<p>
<label><?php echo elgg_echo('album:desc'); ?></label>
- <?php echo elgg_view("input/text",array("internalname" => "descript","value" => $body,)); ?>
+ <?php echo elgg_view("input/text",array("internalname" => "tidypicsbody","value" => $body,)); ?>
</p>
<?php
} else {
?>
<p>
<label><?php echo elgg_echo('caption'); ?></label>
- <?php echo elgg_view("input/text",array("internalname" => "descript","value" => $body,)); ?>
+ <?php echo elgg_view("input/text",array("internalname" => "tidypicsbody","value" => $body,)); ?>
</p>
<?php
}
?>
<p>
<label><?php echo elgg_echo("tags"); ?></label>
- <?php echo elgg_view("input/tags", array( "internalname" => "tags","value" => $tags,)); ?>
+ <?php echo elgg_view("input/tags", array( "internalname" => "tidypicstags","value" => $tags,)); ?>
</p>
<?php