# HG changeset patch # User Lennard de Rijk # Date 1234816715 0 # Node ID b2709805fafe63f30239565f6d73027a608163e4 # Parent 5667c29be1a3924c28dbcdcd564b7fe94f18be3c Update org bulk accept script. The script now: 1) leaves correctly control to the browser to update the GUI of the progress bar during ajax communication. 2) Displays an error if something went wrong (I've tried in my box stopping the server while doing the requests), and show a retry button to fetch again the list of the applications that are still not accepted and iterate over them again (seems to recover correctly restarting the server after the error in my box) 3) doesn't display any text at the beginning, and the button has the correct CSS class assigned 4) Check if there are applications to accept, if not displays a message stating that there are no orgs to accept. Patch by: Mario Ferraro Reviewed by: Lennard de Rijk diff -r 5667c29be1a3 -r b2709805fafe app/soc/content/js/org-accept.js --- a/app/soc/content/js/org-accept.js Mon Feb 16 19:30:33 2009 +0000 +++ b/app/soc/content/js/org-accept.js Mon Feb 16 20:38:35 2009 +0000 @@ -2,44 +2,93 @@ $("#applications_progress_bar").progressBar({showText: false}); }); -function acceptOrgInit() { - $("#acceptance_text").fadeOut("slow", - function() { - $("#applications_progress_bar").fadeIn("slow"); - } - ); - $.getJSON("{{ bulk_accept_link|safe }}", +function acceptOrgInit(bulk_accept_link) { + // get the JSON object with details of every application for bulk acceptance + $.getJSON(bulk_accept_link, function(data){ - setTimeout(function(){acceptOrg(data)}, 0); + // If there are applications to accept... + if (data.nr_applications!=0) { + //...then fade out the button, show the progress bar and call the function for acceptance + $("#button_accept").fadeOut("slow", + function() { + $("#applications_progress_bar").progressBar(0); + $("#button_accept").val("Bulk accept"); + $("#description_done").html(""); + $("#applications_progress_bar").fadeIn("slow", acceptOrgs(data)); + } + ); + }else { + $("#description_done").html("No organizations to accept"); + } } ); } -function acceptOrg(accepted_applications) { - var application_index = 0, max_applications=accepted_applications.applications.length; - for (application_index; application_index Error encountered, try again"); + }); } }); - } - // tell the user we are done - $("#description_done").html(" Done!"); - + // if there were no errors, continue the iteration + if (!error_happened) { + // prepare for new iteration and then recall this function + application_index++; + if (application_indexDone!"); + } + } + },0); } - diff -r 5667c29be1a3 -r b2709805fafe app/soc/templates/soc/org_app/review_overview.html --- a/app/soc/templates/soc/org_app/review_overview.html Mon Feb 16 19:30:33 2009 +0000 +++ b/app/soc/templates/soc/org_app/review_overview.html Mon Feb 16 20:38:35 2009 +0000 @@ -14,10 +14,7 @@ {% endcomment %} {% block body %} - - If you want to accept all pre-accepted organizations please - - +