This commit is contained in:
sspitzer%netscape.com 2000-03-21 03:16:39 +00:00
Родитель 48128c4e91
Коммит 48e2c3ad17
1 изменённых файлов: 24 добавлений и 9 удалений

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

@ -1,15 +1,16 @@
var gSubscribetree = null; var gSubscribeTree = null;
var gCurrentServer = null; var gCurrentServer = null;
var okCallback = null; var okCallback = null;
var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService(Components.interfaces.nsIRDFService); var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService(Components.interfaces.nsIRDFService);
var datasource = rdf.GetDataSource('rdf:newshostinfo'); var datasource = rdf.GetDataSource('rdf:newshostinfo');
var gChangeTable = {};
var gServerURI = null;
function SubscribeOnLoad() function SubscribeOnLoad()
{ {
dump("SubscribeOnLoad()\n"); dump("SubscribeOnLoad()\n");
gSubscribetree = document.getElementById('subscribetree'); gSubscribeTree = document.getElementById('subscribetree');
gCurrentServer = document.getElementById('currentserver'); gCurrentServer = document.getElementById('currentserver');
doSetOKCancel(subscribeOK,subscribeCancel); doSetOKCancel(subscribeOK,subscribeCancel);
@ -27,10 +28,11 @@ function SubscribeOnLoad()
// pre select the folderPicker, based on what they selected in the folder pane // pre select the folderPicker, based on what they selected in the folder pane
if (window.arguments[0].preselectedURI) { if (window.arguments[0].preselectedURI) {
gServerURI = window.arguments[0].preselectedURI;
var folder = GetMsgFolderFromUri(window.arguments[0].preselectedURI); var folder = GetMsgFolderFromUri(window.arguments[0].preselectedURI);
var server = folder.server; var server = folder.server;
gSubscribetree.setAttribute('ref','urn:' + server.hostName); gSubscribeTree.setAttribute('ref','urn:' + server.hostName);
gCurrentServer.value = server.hostName; // use gServer.prettyName? gCurrentServer.value = server.hostName; // use gServer.prettyName?
dump("for each child of news://" + server.hostName + " set subscribed to true in the datasource\n"); dump("for each child of news://" + server.hostName + " set subscribed to true in the datasource\n");
@ -61,10 +63,7 @@ function subscribeOK()
{ {
dump("in subscribeOK()\n") dump("in subscribeOK()\n")
if (top.okCallback) { if (top.okCallback) {
// we stored the uri as the ref, now get it back top.okCallback(top.gServerURI,top.gChangeTable);
var tree = document.getElementById('subscribetree');
//var uri = tree.getAttribute('ref');
//top.okCallback(uri);
} }
return true; return true;
} }
@ -98,16 +97,32 @@ function SetState(uri, state)
} }
} }
function StateChanged(uri,state)
{
if (!gChangeTable[uri]) {
gChangeTable[uri] = 0;
}
if (state == 'true') {
gChangeTable[uri] = gChangeTable[uri] + 1;
}
else {
gChangeTable[uri] = gChangeTable[uri] - 1;
}
dump(gChangeTable[uri] + "\n");
}
function SetSubscribeState(state) function SetSubscribeState(state)
{ {
dump("subscribe button clicked\n"); dump("subscribe button clicked\n");
var groupList = gSubscribetree.selectedItems; var groupList = gSubscribeTree.selectedItems;
for (i=0;i<groupList.length;i++) { for (i=0;i<groupList.length;i++) {
group = groupList[i]; group = groupList[i];
uri = group.getAttribute('id'); uri = group.getAttribute('id');
dump(uri + "\n"); dump(uri + "\n");
SetState(uri, state); SetState(uri, state);
StateChanged(uri,state);
} }
} }