From 94e82c781a9bc5a171193523cac50ea83e69dcfd Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 30 Oct 2010 14:49:14 +0000 Subject: handling new album in ajax upload code now --- actions/ajax_upload_complete.php | 24 ++++++++++++++++++++++++ start.php | 1 + views/default/tidypics/forms/ajax_upload.php | 16 +++++++++++++--- 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 actions/ajax_upload_complete.php 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 @@ +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 diff --git a/start.php b/start.php index a50f23c57..c44bc9f1e 100644 --- a/start.php +++ b/start.php @@ -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'; - ?>
@@ -69,7 +71,7 @@ $basic_uploader_url = current_page_url() . '/basic'; $("#uploadify").uploadify({ 'uploader' : 'mod/tidypics/vendors/uploadify/uploadify.swf', - 'script' : 'action/tidypics/ajax_upload/', + 'script' : '', 'scriptData' : { 'album_guid' : 'guid; ?>', '__elgg_token' : '', @@ -101,6 +103,14 @@ $("#uploadify").uploadify({ }, 'onAllComplete' : function() { $("#tidypics_describe_button").removeClass('tidypics_disable'); + $.post( + '', + { + album_guid : 'guid; ?>', + __elgg_token : '', + __elgg_ts : '' + } + ); }, 'onCancel' : function(event, queueID, fileObj, data) { if (data.fileCount == 0) { -- cgit v1.2.3