From 63f08f0b62e30fa4e99318a11ede8879021efc80 Mon Sep 17 00:00:00 2001 From: Git Date: Tue, 16 Jul 2013 08:00:49 +0000 Subject: [PATCH] Empty commit --- sections/collages/artist_collage.php | 2 +- sections/collages/collage.php | 4 ++-- sections/requests/new_edit.php | 2 +- static/functions/autocomplete.js | 2 +- static/functions/form_validate.js | 5 +++++ static/functions/script_start.js | 18 ++++++++++++++++++ 6 files changed, 28 insertions(+), 5 deletions(-) diff --git a/sections/collages/artist_collage.php b/sections/collages/artist_collage.php index ae033ae8..8e6066f0 100644 --- a/sections/collages/artist_collage.php +++ b/sections/collages/artist_collage.php @@ -176,7 +176,7 @@
- + />
diff --git a/sections/collages/collage.php b/sections/collages/collage.php index 40f34bf5..53dc195b 100644 --- a/sections/collages/collage.php +++ b/sections/collages/collage.php @@ -61,7 +61,7 @@ function compare($X, $Y) { $CollageSubscriptions = array(); } -if (in_array($CollageID, $CollageSubscriptions)) { +if (in_array($CollageID, $CollagepSubscriptions)) { $Cache->delete_value('collage_subs_user_new_'.$LoggedUser['ID']); } $DB->query(" @@ -70,7 +70,7 @@ function compare($X, $Y) { WHERE UserID = ".$LoggedUser['ID']." AND CollageID = $CollageID"); -if ($CollageCategoryID === array_search(ARTIST_COLLAGE, $CollageCats)) { +if ($CollageCategoryID == array_search(ARTIST_COLLAGE, $CollageCats)) { include(SERVER_ROOT.'/sections/collages/artist_collage.php'); } else { include(SERVER_ROOT.'/sections/collages/torrent_collage.php'); diff --git a/sections/requests/new_edit.php b/sections/requests/new_edit.php index fc2e73f1..3e579961 100644 --- a/sections/requests/new_edit.php +++ b/sections/requests/new_edit.php @@ -124,7 +124,7 @@ } } -View::show_header(($NewRequest ? 'Create a request' : 'Edit a request'), 'requests'); +View::show_header(($NewRequest ? 'Create a request' : 'Edit a request'), 'requests,form_validate'); ?>
diff --git a/static/functions/autocomplete.js b/static/functions/autocomplete.js index 017e72cb..a6e6efaf 100644 --- a/static/functions/autocomplete.js +++ b/static/functions/autocomplete.js @@ -11,7 +11,7 @@ $(document).ready(function() { }, }); - if (url.path == 'torrents' || url.path == 'upload' || url.path == 'artist' || (url.path == 'requests' && url.query['action'] == 'new')) { + if (url.path == 'torrents' || url.path == 'upload' || url.path == 'artist' || (url.path == 'requests' && url.query['action'] == 'new') || url.path == 'collages') { $("#artist" + SELECTOR).autocomplete({ serviceUrl : ARTIST_AUTOCOMPLETE_URL }); diff --git a/static/functions/form_validate.js b/static/functions/form_validate.js index c27dcb94..2410b493 100644 --- a/static/functions/form_validate.js +++ b/static/functions/form_validate.js @@ -22,6 +22,11 @@ $(document).ready(function() { $("#filter_form").validate(); } break; + case "requests": + if (query['action'] == "new") { + $("#request_form").preventDoubleSubmission(); + } + break; default: break; } diff --git a/static/functions/script_start.js b/static/functions/script_start.js index 4d963164..8f76d0c2 100644 --- a/static/functions/script_start.js +++ b/static/functions/script_start.js @@ -210,6 +210,24 @@ function URL() { return response; } +// jQuery plugin to prevent double submission of forms +jQuery.fn.preventDoubleSubmission = function() { + $(this).bind('submit',function(e){ + var $form = $(this); + + if ($form.data('submitted') === true) { + // Previously submitted - don't submit again + e.preventDefault(); + } else { + // Mark it so that the next submit can be ignored + $form.data('submitted', true); + } + }); + + // Keep chainability + return this; +}; + jQuery.extend(jQuery.prototype, { results: function () { return this.size();