From 6919f41e51cacaa8f6b4ae7bcdbd010c8d6aefe5 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 5 Mar 2013 02:49:50 +0800 Subject: Bug 834119: add the ability to force users into using a custom bug format --- extensions/GuidedBugEntry/web/js/guided.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'extensions/GuidedBugEntry/web/js') diff --git a/extensions/GuidedBugEntry/web/js/guided.js b/extensions/GuidedBugEntry/web/js/guided.js index 1883e4eb6..8eaf6b3b5 100644 --- a/extensions/GuidedBugEntry/web/js/guided.js +++ b/extensions/GuidedBugEntry/web/js/guided.js @@ -17,9 +17,11 @@ var guided = { detectedOpSys: '', currentUser: '', openStates: [], + updateStep: true, setStep: function(newStep, noSetHistory) { // initialise new step + this.updateStep = true; switch(newStep) { case 'product': product.onShow(); @@ -38,6 +40,9 @@ var guided = { return; } + if (!this.updateStep) + return; + // change visibility of _step div if (this._currentStep) Dom.addClass(this._currentStep + '_step', 'hidden'); @@ -586,6 +591,16 @@ var bugForm = { }, onShow: function() { + // check for a forced format + var productName = product.getName(); + if (products[productName] && products[productName].format) { + Dom.addClass('advanced', 'hidden'); + document.location.href = 'enter_bug.cgi?format=' + encodeURIComponent(products[productName].format) + + '&product=' + encodeURIComponent(productName) + + '&short_desc=' + encodeURIComponent(dupes.getSummary()); + guided.updateStep = false; + return; + } Dom.removeClass('advanced', 'hidden'); // default the summary to the dupes query Dom.get('short_desc').value = dupes.getSummary(); -- cgit v1.2.3-24-g4f1b