зеркало из https://github.com/mozilla/gecko-dev.git
Add license headers, set minVersion to 2.0
This commit is contained in:
Родитель
dfa6ab827a
Коммит
a10735d3fb
|
@ -16,25 +16,33 @@
|
|||
|
||||
<statusbar id="status-bar">
|
||||
<statusbarpanel class="statusbarpanel-iconic" id="qa-statusbar-overlay"
|
||||
src="chrome://qa/skin/qmo-16px.png" onclick="qaMain.openQATool(); qaNotifications.checkNotificationStatus();" />
|
||||
src="chrome://qa/skin/qmo-16px.png"
|
||||
onclick="qaMain.openQATool(); qaNotifications.checkNotificationStatus();" />
|
||||
</statusbar>
|
||||
|
||||
<window id="main-window">
|
||||
<vbox id="qa-notify" class="qa-notify" hidden="true">
|
||||
<vbox flex="1" class="qa-notify">
|
||||
<hbox pack="end" align="center">
|
||||
<toolbarbutton class="tabs-closebutton"
|
||||
<toolbarbutton class="tabs-closebutton" id="qa-notify-close"
|
||||
oncommand="qaNotifications.showHideNotify(false);" />
|
||||
</hbox>
|
||||
<vbox id="qa-notify-box">
|
||||
<vbox>
|
||||
<label id="qa-notify-inprogress" value="&qa.notification.inprogress;" />
|
||||
<hbox align="center" id="qa-notify-header-box" style="overflow: hidden">
|
||||
<label id="qa-notify-header" value="" />
|
||||
</hbox>
|
||||
<vbox>
|
||||
<description id="qa-notify-text"></description>
|
||||
<vbox id="qa-notify-event" style="display: none;">
|
||||
<label id="qa-notify-event-datetime" value="" />
|
||||
<label id="qa-notify-event-place" value="" />
|
||||
</vbox>
|
||||
<vbox id="qa-notify-content">
|
||||
<description id="qa-notify-text" />
|
||||
<label id="qa-notify-infolink" class="text-link" href=""
|
||||
value="" />
|
||||
value="" />
|
||||
<label id="qa-notify-getstartedlink" class="text-link" href=""
|
||||
value="" style="display: none;" />
|
||||
</vbox>
|
||||
</vbox>
|
||||
</vbox>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
document.addEventListener('load', function() {
|
||||
window.setTimeout();
|
||||
}, false)
|
||||
|
||||
var qaNotifications = {
|
||||
storageService : Components.classes["@mozilla.org/storage/service;1"]
|
||||
.getService(Ci.mozIStorageService),
|
||||
|
@ -28,18 +32,26 @@ var qaNotifications = {
|
|||
serializedJSData string)");
|
||||
},
|
||||
|
||||
checkNotificationStatus : function() {
|
||||
updateNotificationStore : function() {
|
||||
var req = new XMLHttpRequest();
|
||||
var url = qaPref.getPref('qa.extension.hermes.url', 'char');
|
||||
req.open('GET', url, true);
|
||||
req.onreadystatechange = function(evt) {
|
||||
if (req.readyState == 4 && req.status == 200) {
|
||||
var notif = new Notification('xml', req.responseXML);
|
||||
notif.serializeToDbIfNotExists();
|
||||
if (req.responseXML.getElementsByTagName('notifications') == null)
|
||||
return;
|
||||
var notifs = req.responseXML.getElementsByTagName('notification');
|
||||
for (var i=0; i<notifs.length; i++) {
|
||||
var notif = notifs[i];
|
||||
notif = new Notification('xml', notif);
|
||||
notif.serializeToDb();
|
||||
}
|
||||
}
|
||||
};
|
||||
req.send(null);
|
||||
},
|
||||
|
||||
checkNotificationStatus : function() {
|
||||
// see if we are elegible for notification:
|
||||
var time = qaPref.getPref(qaPref.prefBase+'.lastNotificationCheckTime', 'int');
|
||||
var interval = qaPref.getPref(qaPref.prefBase+'.minNotificationCheckInterval', 'int');
|
||||
|
@ -98,7 +110,7 @@ function Notification(type, data) {
|
|||
this.notificationClass = data.notificationClass;
|
||||
this.type = data.type;
|
||||
this.headline = data.headline;
|
||||
this.datetime = data.datetime;
|
||||
this.datetime = MochiKit.DateTime.isoTimestamp(data.datetime);
|
||||
this.place = data.place;
|
||||
this.infotext = data.infotext;
|
||||
this.infolinktext = data.infolinktext;
|
||||
|
@ -106,33 +118,27 @@ function Notification(type, data) {
|
|||
this.golinktext = data.golinktext;
|
||||
this.golinkhref = data.golinkhref;
|
||||
} else if (type == 'xml') {
|
||||
if (data.getElementsByTagName('notifications') == null)
|
||||
return;
|
||||
var notifs = data.getElementsByTagName('notification');
|
||||
for (var i=0; i<notifs.length; i++) {
|
||||
var notif = notifs[i];
|
||||
|
||||
this.id = notif.getAttribute('id');
|
||||
this.notificationClass = notif.getAttribute('class');
|
||||
this.type = notif.getAttribute('type');
|
||||
if (notif.getElementsByTagName('headline')[0] != null)
|
||||
this.headline = notif.getElementsByTagName('headline')[0].textContent;
|
||||
|
||||
// eventinfo
|
||||
if (this.notificationClass == 'event') {
|
||||
var eventInfo = notif.getElementsByTagName('eventinfo')[0];
|
||||
this.datetime = MochiKit.DateTime.isoTimestamp(
|
||||
eventInfo.getElementsByTagName('datetime')[0].textContent);
|
||||
this.place = eventInfo.getElementsByTagName('place')[0].textContent;
|
||||
}
|
||||
this.infotext = notif.getElementsByTagName('infotext')[0].textContent;
|
||||
this.infolinktext = notif.getElementsByTagName('infolink')[0].textContent;
|
||||
this.infolinkhref = notif.getElementsByTagName('infolink')[0]
|
||||
.getAttribute('href');
|
||||
this.golinktext = notif.getElementsByTagName('golink')[0].textContent;
|
||||
this.golinkhref = notif.getElementsByTagName('golink')[0]
|
||||
.getAttribute('href');
|
||||
var notif = data;
|
||||
this.id = notif.getAttribute('id');
|
||||
this.notificationClass = notif.getAttribute('class');
|
||||
this.type = notif.getAttribute('type');
|
||||
if (notif.getElementsByTagName('headline')[0] != null)
|
||||
this.headline = notif.getElementsByTagName('headline')[0].textContent;
|
||||
|
||||
// eventinfo
|
||||
if (this.notificationClass == 'event') {
|
||||
var eventInfo = notif.getElementsByTagName('eventinfo')[0];
|
||||
this.datetime = MochiKit.DateTime.isoTimestamp(
|
||||
eventInfo.getElementsByTagName('datetime')[0].textContent);
|
||||
this.place = eventInfo.getElementsByTagName('place')[0].textContent;
|
||||
}
|
||||
this.infotext = notif.getElementsByTagName('infotext')[0].textContent;
|
||||
this.infolinktext = notif.getElementsByTagName('infolink')[0].textContent;
|
||||
this.infolinkhref = notif.getElementsByTagName('infolink')[0]
|
||||
.getAttribute('href');
|
||||
this.golinktext = notif.getElementsByTagName('golink')[0].textContent;
|
||||
this.golinkhref = notif.getElementsByTagName('golink')[0]
|
||||
.getAttribute('href');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,7 +159,7 @@ Notification.prototype = {
|
|||
hasHadSecondNotification : false,
|
||||
serializedJSData : null,
|
||||
|
||||
serializeToDbIfNotExists : function() {
|
||||
serializeToDb: function() {
|
||||
var query = qaNotifications.db.createStatement("SELECT id FROM notifications \
|
||||
WHERE id = ?1");
|
||||
query.bindStringParameter(0, this.id);
|
||||
|
@ -162,8 +168,9 @@ Notification.prototype = {
|
|||
foundRow = 1;
|
||||
}
|
||||
query.reset();
|
||||
if (foundRow == 1) // it's already been inserted
|
||||
if (foundRow == 1) { // it's already been inserted, so update
|
||||
return;
|
||||
}
|
||||
|
||||
var sth = qaNotifications.db.createStatement("INSERT into notifications \
|
||||
values (?1, ?2, ?3, ?4, ?5)");
|
||||
|
@ -171,14 +178,41 @@ Notification.prototype = {
|
|||
sth.bindStringParameter(1, this.datetime);
|
||||
sth.bindStringParameter(2, this.hasHadFirstNotification);
|
||||
sth.bindStringParameter(3, this.hasHadSecondNotification);
|
||||
sth.bindStringParameter(4, MochiKit.Base.serializeJSON(this));
|
||||
|
||||
// avoid having serialized data inside serialized data:
|
||||
this.serializedJSData = null;
|
||||
var jsData = MochiKit.Base.serializeJSON(this);
|
||||
sth.bindStringParameter(4, jsData);
|
||||
|
||||
sth.execute();
|
||||
},
|
||||
displayToBox : function() {
|
||||
$('qa-notify-header').value=this.headline;
|
||||
$('qa-notify-text').value=this.infotext;
|
||||
|
||||
if ($('qa-notify-text').firstChild)
|
||||
$('qa-notify-text').removeChild($('qa-notify-text').firstChild);
|
||||
$('qa-notify-text').appendChild(document.createTextNode(this.infotext));
|
||||
|
||||
$('qa-notify-infolink').value=this.infolinktext;
|
||||
$('qa-notify-infolink').href=this.infolinkhref;
|
||||
$('qa-notify-infolink').style.display = '';
|
||||
|
||||
if (this.notificationClass == 'event') {
|
||||
var inprogress = 0;
|
||||
$('qa-notify-event-datetime').value=this.datetime;
|
||||
$('qa-notify-event-place').value=this.place;
|
||||
$('qa-notify-event').style.display = '';
|
||||
$('qa-notify-inprogress').style.display = 'none';
|
||||
|
||||
$('qa-notify-getstartedlink').value=this.golinktext;
|
||||
$('qa-notify-getstartedlink').href=this.golinkhref;
|
||||
|
||||
if (inprogress == 1) {
|
||||
$('qa-notify-inprogress').style.display = '';
|
||||
$('qa-notify-getstartedlink').style.display = '';
|
||||
$('qa-notify-infolink').style.display = 'none';
|
||||
}
|
||||
}
|
||||
},
|
||||
okToShow : function() {
|
||||
var prefs = qaNotifications.getNotificationSettings();
|
||||
|
|
|
@ -136,10 +136,9 @@ if (CC_passwordManager != null) { // old-fashioned password manager
|
|||
var nsLoginInfo = new Components.Constructor("@mozilla.org/login-manager/loginInfo;1",
|
||||
Components.interfaces.nsILoginInfo,
|
||||
"init");
|
||||
var newLogin = new nsLoginInfo();
|
||||
newLogin.init('chrome://qa', 'Litmus Login', litmus.baseURL,
|
||||
var newLogin = new nsLoginInfo('chrome://qa', 'Litmus Login', litmus.baseURL,
|
||||
username, password, null, null);
|
||||
this.manager().addLogin(newLogin);
|
||||
this.manager().addLogin(newLogin);
|
||||
},
|
||||
getPasswordObj: function() {
|
||||
try {
|
||||
|
|
|
@ -126,7 +126,12 @@ var qaSetup = {
|
|||
alert("create account page is missing");
|
||||
return false;
|
||||
}
|
||||
if (page.location == 'http://laptop.local/litmus/extension.cgi?createAccount=1'
|
||||
if (page.wrappedJSObject == null)
|
||||
page.wrappedJSObject = page;
|
||||
if (page.forms[0] && page.forms[0].wrappedJSObject == null)
|
||||
page.forms[0].wrappedJSObject = page.forms[0];
|
||||
|
||||
if (page.location == litmus.baseURL+'extension.cgi?createAccount=1'
|
||||
&& qaSetup.didSubmitForm==0) {
|
||||
document.getElementById('qa-setup-accountconfirmloading').value =
|
||||
document.getElementById("bundle_qa").getString("qa.extension.prefs.loadingMsg");
|
||||
|
@ -163,12 +168,12 @@ document.getElementById("bundle_qa").getString("qa.extension.prefs.loadingMsg");
|
|||
var passwd = document.getElementById('password').value;
|
||||
|
||||
var callback = function(resp) {
|
||||
if (resp.responseText == 0) {
|
||||
if (resp.responseText != 1) { // failure
|
||||
alert(document.getElementById("bundle_qa").
|
||||
getString("qa.extension.prefs.loginError"));
|
||||
document.getElementById('qa-setup-accountconfirmloading').value = null;
|
||||
return false;
|
||||
} else {
|
||||
} else { // all's well
|
||||
qaPref.litmus.setPassword(uname, passwd);
|
||||
document.getElementById('qa-setup-accountconfirmloading').value = null;
|
||||
document.getElementById('qa-setup').pageIndex++; // advance
|
||||
|
@ -229,6 +234,5 @@ document.getElementById("bundle_qa").getString("qa.extension.prefs.loadingMsg");
|
|||
|
||||
finish : function() {
|
||||
qaPref.setPref(qaPref.prefBase+'.isFirstTime', false, 'bool');
|
||||
qaPrefsWindow.loadPrefsWindow();
|
||||
},
|
||||
};
|
||||
};
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<script type="application/x-javascript" src="chrome://qa/content/common.js" />
|
||||
<script type="application/x-javascript" src="chrome://qa/content/tabs/selecttests.js" />
|
||||
|
||||
<dialogheader title="Select test group" />
|
||||
<dialogheader description="&qa.selecttests.header;" />
|
||||
<spacer height="20" />
|
||||
<vbox>
|
||||
<hbox>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<!ENTITY qa.testcase.comment "Comment (optional):">
|
||||
|
||||
<!ENTITY qa.selecttests.load "Loading...">
|
||||
<!ENTITY qa.selecttests.header "Select test group">
|
||||
|
||||
<!ENTITY qa.preferences.title "Settings">
|
||||
<!ENTITY qa.preferences.litmus.title "Litmus Settings">
|
||||
|
@ -143,4 +144,6 @@ possible, but please check the settings below and make any necessary changes.
|
|||
<!ENTITY qa.chat.howdoI.irchelpurl "http://www.irchelp.org">
|
||||
<!ENTITY qa.chat.howdoI.joinnow "Join IRC Now">
|
||||
|
||||
<!ENTITY qa.help.title "Help">
|
||||
<!ENTITY qa.help.title "Help">
|
||||
|
||||
<!ENTITY qa.notification.inprogress "Come Join! Event in Progress Now!">
|
||||
|
|
|
@ -42,7 +42,7 @@ html|a {
|
|||
|
||||
#qa-notify-box {
|
||||
padding: 0px 6px 6px 6px;
|
||||
display: table;
|
||||
display: table;
|
||||
}
|
||||
|
||||
#qa-notify-header {
|
||||
|
@ -50,6 +50,34 @@ html|a {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
#qa-notify-header-box {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
}
|
||||
|
||||
#qa-notify-content {
|
||||
position: absolute;
|
||||
left: 12px;
|
||||
}
|
||||
|
||||
#qa-notify description {
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
#qa-notify-event {
|
||||
border-style: dashed;
|
||||
border-width: 1px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
#qa-notify-inprogress {
|
||||
color: red;
|
||||
font-size: 1.25em;
|
||||
}
|
||||
|
||||
#qa-notify-text {
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
|
||||
/* general formatting */
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||
<em:minVersion>1.5</em:minVersion>
|
||||
<em:minVersion>2.0</em:minVersion>
|
||||
<em:maxVersion>*</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
|
Загрузка…
Ссылка в новой задаче