From 620be743083e3c7c53d71c7686175c8ad341c7cb Mon Sep 17 00:00:00 2001 From: Greg Froese Date: Fri, 22 May 2009 15:43:19 +0000 Subject: added river activity for uploaded images --- actions/upload.php | 22 +++++++++++++++++++--- languages/en.php | 3 ++- views/default/river/object/image/create.php | 26 ++++++++++++++++++++++++++ views/default/settings/tidypics/edit.php | 18 ++++++++++++++++++ 4 files changed, 65 insertions(+), 4 deletions(-) diff --git a/actions/upload.php b/actions/upload.php index 6e21fd7b0..6a941fa66 100644 --- a/actions/upload.php +++ b/actions/upload.php @@ -47,6 +47,9 @@ $uploaded_images = array(); $not_uploaded = array(); $error_msgs = array(); + + $river_view = get_plugin_setting('river_view', 'tidypics'); + foreach($_FILES as $key => $sent_file) { // skip empty entries @@ -155,18 +158,24 @@ tp_watermark($thumbs); + //keep one file handy so we can add a notice to the river + if(!$file_for_river) { + $file_for_river = $file; + } + } // end of image library selector //get and store the exif data td_get_exif($file); array_push($uploaded_images, $file->guid); + if($river_view == "all") { + add_to_river('river/object/image/create', 'create', $file->getObjectOwnerGUID(), $file->getGUID()); + } unset($file); // may not be needed but there seems to be a memory leak - } //end of for loop - - + if (count($not_uploaded) > 0) { if (count($uploaded_images) > 0) $error = sprintf(elgg_echo("tidypics:partialuploadfailure"), count($not_uploaded), count($not_uploaded) + count($uploaded_images)) . '
'; @@ -195,6 +204,13 @@ add_to_river('river/object/album/create', 'create', $album->owner_guid, $album->guid); $album->new_album = TP_OLD_ALBUM; } + + if(count($uploaded_images) && $river_view == "1") { + if (function_exists('add_to_river')) { + add_to_river('river/object/image/create', 'create', $file_for_river->getObjectOwnerGUID(), $file_for_river->getGUID()); + } + } + // plugins can register to be told when a Tidypics album has had images added trigger_elgg_event('upload', 'tp_album', $album); diff --git a/languages/en.php b/languages/en.php index 9edbc6be5..3d8216bb8 100644 --- a/languages/en.php +++ b/languages/en.php @@ -24,6 +24,7 @@ 'tidypics:settings:maxfilesize' => "Maximum file size in megabytes (MB):", 'tidypics:settings:watermark' => "Enter text to appear in the watermark - ImageMagick must be selected for the image library", 'tidypics:settings:im_path' => "Enter the path to your ImageMagick commands", + 'tidypics:settings:river_view' => "Show entries in river for each batch of uploaded images", 'tidypics:enablephotos' => 'Enable Group Photo Albums', 'tidypics:editprops' => 'Edit Image Properties', 'tidypics:mostviewed' => 'Most viewed images', @@ -89,7 +90,7 @@ // river //images - 'image:river:created' => "%s uploaded", + 'image:river:created' => "%s added %s to album %s", 'image:river:item' => "an image", 'image:river:annotate' => "a comment on the image", diff --git a/views/default/river/object/image/create.php b/views/default/river/object/image/create.php index 3f5bbb5e8..bf6d2acbb 100644 --- a/views/default/river/object/image/create.php +++ b/views/default/river/object/image/create.php @@ -1,5 +1,30 @@ subject_guid); + $image = get_entity($vars['item']->object_guid); + if($image->title) { + $title = $image->title; + } else { + $title = "untitled"; + } + + $url = "getURL()}\">{$performed_by->name}"; + $album = get_entity($image->container_guid); + + $album_link = "" . $album->title . ""; + $image_link = "getURL() . "\">" . $title . ""; + + $string = sprintf(elgg_echo("image:river:created"),$performed_by->name, $image_link, $album_link); + + $string .= "
"; + $string .= "getURL() . "\"> wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $album->cover . '&size=thumb" border="0" class="tidypics_album_cover" alt="thumbnail"/> '; + $string .= "getURL() . "\"> wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $image->guid . '&size=thumb" border="0" class="tidypics_album_cover" alt="thumbnail"/> '; + $string .= "
"; + + echo $string; + +} else { $statement = $vars['statement']; $performed_by = $statement->getSubject(); $object = $statement->getObject(); @@ -9,5 +34,6 @@ $string .= "getURL() . "\">" . elgg_echo("image:river:item") . ""; echo $string; +} ?> \ No newline at end of file diff --git a/views/default/settings/tidypics/edit.php b/views/default/settings/tidypics/edit.php index ecfee33bd..59ed912d1 100644 --- a/views/default/settings/tidypics/edit.php +++ b/views/default/settings/tidypics/edit.php @@ -64,6 +64,24 @@ 'value' => $download_link)); ?>

+

+ river_view; + if (!$river_view) $river_view = 'all'; + ?> + + 'params[river_view]', + 'options_values' => array( + 'all' => 'all', + '1' => '1', + 'none' => 'none' + ), + 'value' => $river_view)); + ?> +

watermark_text; -- cgit v1.2.3