diff options
author | Greg Froese <greg.froese@gmail.com> | 2009-05-22 15:43:19 +0000 |
---|---|---|
committer | Greg Froese <greg.froese@gmail.com> | 2009-05-22 15:43:19 +0000 |
commit | 620be743083e3c7c53d71c7686175c8ad341c7cb (patch) | |
tree | 4fc410c0fe1696c5c45a506057cd4dd5fbb0ed6c | |
parent | 029ae9fcba086a1cce25e496c9de2593df212bdb (diff) | |
download | elgg-620be743083e3c7c53d71c7686175c8ad341c7cb.tar.gz elgg-620be743083e3c7c53d71c7686175c8ad341c7cb.tar.bz2 |
added river activity for uploaded images
-rw-r--r-- | actions/upload.php | 22 | ||||
-rw-r--r-- | languages/en.php | 3 | ||||
-rw-r--r-- | views/default/river/object/image/create.php | 26 | ||||
-rw-r--r-- | 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)) . '<br />';
@@ -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 @@ <?php
+if (function_exists('add_to_river')) { // Elgg 1.5
+ $performed_by = get_entity($vars['item']->subject_guid);
+ $image = get_entity($vars['item']->object_guid);
+ if($image->title) {
+ $title = $image->title;
+ } else {
+ $title = "untitled";
+ }
+
+ $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
+ $album = get_entity($image->container_guid);
+
+ $album_link = "<a href='". $album->getURL() . "'>" . $album->title . "</a>";
+ $image_link = "<a href=\"" . $image->getURL() . "\">" . $title . "</a>";
+
+ $string = sprintf(elgg_echo("image:river:created"),$performed_by->name, $image_link, $album_link);
+
+ $string .= "<div class=\"river_content\">";
+ $string .= "<a href=\"" . $album->getURL() . "\"> <img src=\"" . $CONFIG->wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $album->cover . '&size=thumb" border="0" class="tidypics_album_cover" alt="thumbnail"/> </a>';
+ $string .= "<a href=\"" . $image->getURL() . "\"> <img src=\"" . $CONFIG->wwwroot . 'mod/tidypics/thumbnail.php?file_guid=' . $image->guid . '&size=thumb" border="0" class="tidypics_album_cover" alt="thumbnail"/> </a>';
+ $string .= "</div>";
+
+ echo $string;
+
+} else {
$statement = $vars['statement'];
$performed_by = $statement->getSubject();
$object = $statement->getObject();
@@ -9,5 +34,6 @@ $string .= "<a href=\"" . $object->getURL() . "\">" . elgg_echo("image:river:item") . "</a>";
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)); ?> </p> +<p> + <?php + echo elgg_echo('tidypics:settings:river_view'); + $river_view = $vars['entity']->river_view; + if (!$river_view) $river_view = 'all'; + ?> + + <?php + echo elgg_view('input/pulldown', array( + 'internalname' => 'params[river_view]', + 'options_values' => array( + 'all' => 'all', + '1' => '1', + 'none' => 'none' + ), + 'value' => $river_view)); + ?> +</p> <?php $watermark_text = $vars['entity']->watermark_text; |