diff options
-rw-r--r-- | actions/ajax_upload_complete.php | 24 | ||||
-rw-r--r-- | start.php | 1 | ||||
-rw-r--r-- | views/default/tidypics/forms/ajax_upload.php | 16 |
3 files changed, 38 insertions, 3 deletions
diff --git a/actions/ajax_upload_complete.php b/actions/ajax_upload_complete.php new file mode 100644 index 000000000..4fc96061e --- /dev/null +++ b/actions/ajax_upload_complete.php @@ -0,0 +1,24 @@ +<?php +/** + * A batch is complete so check if this is first upload to album + * + */ + +$album_guid = (int) get_input('album_guid'); + +$album = get_entity($album_guid); +if (!$album) { + exit; +} + +if ($album->new_album == TP_NEW_ALBUM) { + $album->new_album = TP_OLD_ALBUM; + + // we throw the notification manually here so users are not told about the new album until there + // is at least a few photos in it + object_notifications('create', 'object', $album); + + add_to_river('river/object/album/create', 'create', $album->owner_guid, $album->guid); +} + +exit;
\ No newline at end of file @@ -464,6 +464,7 @@ register_elgg_event_handler('pagesetup', 'system', 'tidypics_adminmenu'); // Register actions register_action("tidypics/upload", false, $CONFIG->pluginspath . "tidypics/actions/upload.php"); register_action("tidypics/ajax_upload", true, $CONFIG->pluginspath . "tidypics/actions/ajax_upload.php"); +register_action("tidypics/ajax_upload_complete", true, $CONFIG->pluginspath . "tidypics/actions/ajax_upload_complete.php"); register_action("tidypics/addalbum", false, $CONFIG->pluginspath. "tidypics/actions/addalbum.php"); register_action("tidypics/edit", false, $CONFIG->pluginspath. "tidypics/actions/edit.php"); register_action("tidypics/delete", false, $CONFIG->pluginspath. "tidypics/actions/delete.php"); diff --git a/views/default/tidypics/forms/ajax_upload.php b/views/default/tidypics/forms/ajax_upload.php index fb9060a50..912d1c03e 100644 --- a/views/default/tidypics/forms/ajax_upload.php +++ b/views/default/tidypics/forms/ajax_upload.php @@ -10,6 +10,10 @@ $token = generate_action_token($ts); $batch = time(); +$basic_uploader_url = current_page_url() . '/basic'; + +$upload_endpoint_url = "{$vars['url']}action/tidypics/ajax_upload/"; +$upload_complete_url = "{$vars['url']}action/tidypics/ajax_upload_complete/"; $maxfilesize = (float) get_plugin_setting('maxfilesize','tidypics'); if (!$maxfilesize) { @@ -33,8 +37,6 @@ if ($quota) { } } -$basic_uploader_url = current_page_url() . '/basic'; - ?> <div class="contentWrapper"> @@ -69,7 +71,7 @@ $basic_uploader_url = current_page_url() . '/basic'; $("#uploadify").uploadify({ 'uploader' : '<?php echo $vars['url']; ?>mod/tidypics/vendors/uploadify/uploadify.swf', - 'script' : '<?php echo $vars['url']; ?>action/tidypics/ajax_upload/', + 'script' : '<?php echo $upload_endpoint_url; ?>', 'scriptData' : { 'album_guid' : '<?php echo $album->guid; ?>', '__elgg_token' : '<?php echo $token; ?>', @@ -101,6 +103,14 @@ $("#uploadify").uploadify({ }, 'onAllComplete' : function() { $("#tidypics_describe_button").removeClass('tidypics_disable'); + $.post( + '<?php echo $upload_complete_url; ?>', + { + album_guid : '<?php echo $album->guid; ?>', + __elgg_token : '<?php echo $token; ?>', + __elgg_ts : '<?php echo $ts; ?>' + } + ); }, 'onCancel' : function(event, queueID, fileObj, data) { if (data.fileCount == 0) { |