Changes to support new "prerelease" feedback newsgroups, and do UA sniffing to set the default product.

This commit is contained in:
gerv%gerv.net 2007-05-30 17:25:19 +00:00
Родитель 005c9cfcdb
Коммит 54c5cca6b9
2 изменённых файлов: 43 добавлений и 15 удалений

Просмотреть файл

@ -41,24 +41,26 @@ use Net::RBLClient;
# Map products to destination
my %product_destination_map = (
"Firefox" => "mozilla.feedback",
"Thunderbird" => "mozilla.feedback",
"Mozilla Suite" => "mozilla.feedback",
"SeaMonkey" => "mozilla.feedback",
"Sunbird" => "mozilla.feedback",
"Camino" => "caminofeedback\@mozilla.org",
"Bon Echo" => "mozilla.feedback",
"Gran Paradiso" => "mozilla.feedback",
"Minefield" => "mozilla.feedback",
"eBay Companion" => "mozilla.feedback.companion.ebay",
"Other" => "mozilla.feedback"
"Firefox" => "mozilla.feedback.firefox",
"Firefox Release Candidate" => "mozilla.feedback.firefox.prerelease",
"Gran Paradiso" => "mozilla.feedback.firefox.prerelease",
"Minefield" => "mozilla.feedback",
"Thunderbird" => "mozilla.feedback.thunderbird",
"Thunderbird Release Candidate" => "mozilla.feedback.thunderbird.prerelease",
"Mozilla Suite" => "mozilla.feedback",
"SeaMonkey" => "mozilla.feedback",
"Sunbird" => "mozilla.feedback",
"Camino" => "caminofeedback\@mozilla.org",
"eBay Companion" => "mozilla.feedback.companion.ebay",
"Other" => "mozilla.feedback"
);
# List of products to show on the main Hendrix page (in order)
my @products_list = (
"Firefox", "Thunderbird", "Mozilla Suite",
"SeaMonkey", "Sunbird", "Camino", "Bon Echo",
"Gran Paradiso", "Minefield", "Other"
"Firefox", "Firefox Release Candidate", "Thunderbird",
"Thunderbird Release Candidate", "Gran Paradiso", "Minefield",
"Camino", "SeaMonkey", "Mozilla Suite", "Sunbird",
"Other"
);
# The default newsgroup if the product isn't in the above map (NNTP only)

Просмотреть файл

@ -40,6 +40,31 @@ function checkSubmitEnable() {
document.getElementById("send-feedback").disabled = !enable;
}
function browserDetect() {
var userAgent = navigator.userAgent;
var matches = [
{ regexp: /SeaMonkey/, product: "SeaMonkey" },
{ regexp: /Camino/, product: "Camino" },
{ regexp: /\/3\.0[ab]\d+([^p]|$)/, product: "Gran Paradiso" },
{ regexp: /Minefield/, product: "Minefield" },
{ regexp: /GranParadiso/, product: "Gran Paradiso" },
];
for (var i = 0; i < matches.length; i++) {
if (userAgent.match(matches[i]["regexp"])) {
var prod = document.getElementById("product");
for (var j = 0; j < prod.options.length; j++) {
if (prod.options[j].text == matches[i].product) {
prod.selectedIndex = j;
}
}
break;
}
}
}
function onLoad() {
/* Add the event listeners, and disable the button initially */
for (var i = 0; i < ids.length; i++) {
@ -47,7 +72,8 @@ function onLoad() {
}
checkSubmitEnable();
}
browserDetect();
}
[% END %]
[% PROCESS header.html.tmpl