bug/bug.xhtml | 1 + bug/bug/bug.js | 17 +++++++++++++++++ bug/bug/test.js | 7 +++++++ 3 files changed, 25 insertions(+)
New commits: commit abaa1d52d080490ec04e881c1d3636ac2fa440f8 Author: Rob Snelders <[email protected]> Date: Mon Oct 1 23:02:08 2012 +0200 new bugzilla demands a token. That works now. diff --git a/bug/bug.xhtml b/bug/bug.xhtml index f4c4e05..fe365be 100644 --- a/bug/bug.xhtml +++ b/bug/bug.xhtml @@ -181,6 +181,7 @@ Platform (if different from the browser): <input type="hidden" name="rep_platform" value="Other"></input> <input type="hidden" name="status_whiteboard" value="BSA"></input> <input type="hidden" name="assigned_to" value="[email protected]"></input> + <input type="hidden" name="token" value=""></input> <input type="hidden" name="component" value=""></input> <input type="hidden" name="version" value=""></input> <input type="hidden" name="short_desc" value=""></input> diff --git a/bug/bug/bug.js b/bug/bug/bug.js index a0be19d..9a1ab1e 100644 --- a/bug/bug/bug.js +++ b/bug/bug/bug.js @@ -94,6 +94,7 @@ }, url: '', + token: '', state_signin_error_regexps: [/CLASS="THROW_ERROR">([^<]*)/i], state_signin_success_regexp: /LOG&NBSP;OUT<\/A>([^<]*)/i, @@ -232,8 +233,23 @@ state_submit_element: 'html', state_submit: function() { + $.bug.logged_in().done(function(status) { + if(status) { + $.bug.submit_bug(); + } else { + $.bug.error_set("You're not logged in. Please login first"); + $.bug.state_signin(); + } + }); + }, + + submit_bug: function() { var element = $('.state_submit'); if(!element.hasClass('initialized')) { + $.bug.ajax('GET', $.bug.url + '/enter_bug.cgi?product=LibreOffice&bug_status=UNCONFIRMED').pipe(function(data){ + $.bug.token = data.match(/<input type="hidden" name="token" value="([A-Za-z0-9]{10})">/)[1]; + }); + var form = $('.submission_form form'); $.bug.error_clear(); form.attr('action', $.bug.url + '/post_bug.cgi'); @@ -248,6 +264,7 @@ var short_desc = $('.state_subcomponent .active_subcomponent .chosen').attr('data') + ': ' + $('.state_description .short').val(); var comment = $('.state_description .long').val(); $("body").css("cursor", "progress"); + $('input[name="token"]', form).val($.bug.token); $('input[name="component"]', form).val(component); $('input[name="version"]', form).val(version); $('input[name="short_desc"]', form).val(short_desc); diff --git a/bug/bug/test.js b/bug/bug/test.js index defb842..1a36df2 100644 --- a/bug/bug/test.js +++ b/bug/bug/test.js @@ -241,6 +241,12 @@ test("state_submit", function() { equal(element.css('display'), 'none'); ok(!element.hasClass('initialized'), 'is not initialized'); $.bug.state_submit(); + + /*$.bug.ajax = function(type, url) { + return $.Deferred().resolve('logged in ok'); + }; + + $.bug.state_submit(); equal(element.css('display'), 'block'); ok(element.hasClass('initialized'), 'is initialized'); $.bug.state_component(); @@ -302,6 +308,7 @@ test("state_submit", function() { equal($('.error').text(), error, 'error is set'); $.bug.state_success = state_success; + $.bug.ajax = $.ajax;*/ }); test("state_success", function() { commit 633869eb45ed46a1b67c1b559499b55ac1b64d53 Merge: 1c1aa6c... 213529e... Author: Rob Snelders <[email protected]> Date: Fri Aug 17 17:29:56 2012 +0200 Merge branch 'master' of git://anongit.freedesktop.org/libreoffice/website commit 1c1aa6cff807d54b1ea42997ac74428289334503 Author: Rob Snelders <[email protected]> Date: Fri Aug 17 00:07:06 2012 +0200 Reset the error-message when submitting the bug diff --git a/bug/bug/bug.js b/bug/bug/bug.js index 0565d84..a0be19d 100644 --- a/bug/bug/bug.js +++ b/bug/bug/bug.js @@ -235,6 +235,7 @@ var element = $('.state_submit'); if(!element.hasClass('initialized')) { var form = $('.submission_form form'); + $.bug.error_clear(); form.attr('action', $.bug.url + '/post_bug.cgi'); form.submit(function() { if($(element).hasClass('inprogress')) { commit 70a0477efcaf401642db916cb76acccb00bb6246 Author: Rob Snelders <[email protected]> Date: Fri Aug 17 00:03:50 2012 +0200 Hides the username that is printed for testing diff --git a/bug/bug/bug.css b/bug/bug/bug.css index a932f2a..f81aa9b 100644 --- a/bug/bug/bug.css +++ b/bug/bug/bug.css @@ -610,3 +610,7 @@ body { background: url('images/select-right.png') repeat-y top right; padding-right: 12px; } + +.username { + display: hidden; +} commit 8bf699575bbb4c8231ec757a5a19550e97efb147 Author: Rob Snelders <[email protected]> Date: Wed Aug 15 22:30:39 2012 +0200 fdo#53082 - BUGZILLAASSISTANT: Improve exception handling for unavailable Bugzilla diff --git a/bug/bug/bug.js b/bug/bug/bug.js index fdd14ec..0565d84 100644 --- a/bug/bug/bug.js +++ b/bug/bug/bug.js @@ -32,15 +32,25 @@ } else { message = url + '(' + $.param(args) + ') XHR error. '; } - if('status' in error) { - message += 'status = ' + error.status + ' '; - } - if('responseText' in error) { - message += 'responseText = ' + error.responseText + ' '; - } - if('statusText' in error) { - message += 'statusText = ' + error.statusText + ' '; - } + + if (url == "/enter_bug.cgi" && 'status' in error && (error.status == 404 || error.status == 0)) { + message = "It seems there is a problem to connect with Bugzilla. Please try again later."; + } + else + { + if('status' in error) { + if(error.status == 404 || error.status == 0) { + message += "Cannot find the URL specified.\n\n"; + } + message += 'status = ' + error.status + ' '; + } + if('responseText' in error) { + message += 'responseText = ' + error.responseText + ' '; + } + if('statusText' in error) { + message += 'statusText = ' + error.statusText + ' '; + } + } $.bug.error_set(message); window.scrollTo(0,0); throw error; commit b027776d5a886e0c6a6209085ad2e3113f9a830e Author: Rob Snelders <[email protected]> Date: Wed Aug 15 22:08:00 2012 +0200 fdo#50851 - BUGZILLAASSISTANT: Error message should be in focus diff --git a/bug/bug/bug.js b/bug/bug/bug.js index 8e7cc0a..fdd14ec 100644 --- a/bug/bug/bug.js +++ b/bug/bug/bug.js @@ -42,6 +42,7 @@ message += 'statusText = ' + error.statusText + ' '; } $.bug.error_set(message); + window.scrollTo(0,0); throw error; }); }, commit 4383c528d1e8882cf68b0df4b0c0d564e5f5aea4 Author: Rob Snelders <[email protected]> Date: Wed Aug 15 21:07:48 2012 +0200 fdo#53084 - BUGZILLAASSISTANT: focus on page bottom instead on Bugzilla link after Bus Submission diff --git a/bug/bug/bug.js b/bug/bug/bug.js index 9947ff2..8e7cc0a 100644 --- a/bug/bug/bug.js +++ b/bug/bug/bug.js @@ -266,6 +266,7 @@ var bug = $('.state_submit .bug').text(); $('.bug', element).attr('href', $.bug.url + '/show_bug.cgi?id=' + bug); element.show(); + window.scrollTo(0,0); }, // if this string is found in the page returned when _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
