2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-17 22:33:16 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
2000-01-03 07:09:55 +03:00
|
|
|
*
|
2004-04-17 22:33:16 +04:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
2000-01-03 07:09:55 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
2000-01-03 07:09:55 +03:00
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-17 22:33:16 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
2000-01-03 07:09:55 +03:00
|
|
|
*
|
|
|
|
* Contributor(s):
|
2004-04-17 22:33:16 +04:00
|
|
|
* Seth Spitzer <sspitzer@netscape.com>
|
|
|
|
* Ben Goodger <ben@netscape.com>
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-17 22:33:16 +04:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-29 00:14:13 +04:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-17 22:33:16 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-17 22:33:16 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2000-01-03 07:09:55 +03:00
|
|
|
|
|
|
|
var newmessages = "";
|
|
|
|
var newsgroupname = "";
|
2001-02-23 03:28:34 +03:00
|
|
|
var gNewsBundle;
|
2001-10-27 09:39:25 +04:00
|
|
|
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService();
|
|
|
|
prefs = prefs.QueryInterface(Components.interfaces.nsIPrefBranch);
|
2000-01-03 07:09:55 +03:00
|
|
|
|
2000-01-13 11:12:12 +03:00
|
|
|
var serverid = null;
|
|
|
|
var markreadElement = null;
|
|
|
|
var numberElement = null;
|
|
|
|
|
2000-01-13 11:51:53 +03:00
|
|
|
var server = null;
|
|
|
|
var nntpServer = null;
|
2001-01-25 08:31:57 +03:00
|
|
|
var args = null;
|
2000-01-13 11:37:26 +03:00
|
|
|
|
1999-12-29 02:08:33 +03:00
|
|
|
function OnLoad()
|
|
|
|
{
|
2001-02-23 03:28:34 +03:00
|
|
|
gNewsBundle = document.getElementById("bundle_news");
|
1999-12-29 06:48:46 +03:00
|
|
|
|
2001-02-23 03:28:34 +03:00
|
|
|
if ("arguments" in window && window.arguments[0]) {
|
2000-12-20 09:31:54 +03:00
|
|
|
args = window.arguments[0].QueryInterface( Components.interfaces.nsINewsDownloadDialogArgs);
|
|
|
|
args.hitOK = false; /* by default, act like the user hit cancel */
|
|
|
|
args.downloadAll = false; /* by default, act like the user did not select download all */
|
2000-01-03 07:09:55 +03:00
|
|
|
|
2001-02-23 03:28:34 +03:00
|
|
|
var accountManager = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
|
|
|
|
server = accountManager.getIncomingServer(args.serverKey);
|
|
|
|
nntpServer = server.QueryInterface(Components.interfaces.nsINntpIncomingServer);
|
2000-01-13 11:51:53 +03:00
|
|
|
|
2001-02-23 03:28:34 +03:00
|
|
|
var downloadHeadersTitlePrefix = gNewsBundle.getString("downloadHeadersTitlePrefix");
|
|
|
|
var okButtonText = gNewsBundle.getString("okButtonText");
|
2000-01-03 07:09:55 +03:00
|
|
|
|
2001-02-23 03:28:34 +03:00
|
|
|
window.title = downloadHeadersTitlePrefix;
|
2000-12-20 09:31:54 +03:00
|
|
|
|
2004-07-07 15:32:45 +04:00
|
|
|
var infotext = gNewsBundle.getFormattedString("downloadHeadersInfoText", [args.articleCount]);
|
|
|
|
setText('info', infotext);
|
|
|
|
var okbutton = document.documentElement.getButton("accept");
|
2001-03-22 03:59:29 +03:00
|
|
|
okbutton.setAttribute("label", okButtonText);
|
2000-12-20 09:31:54 +03:00
|
|
|
setText("newsgroupLabel", args.groupName);
|
2001-02-23 03:28:34 +03:00
|
|
|
}
|
2000-01-03 08:11:51 +03:00
|
|
|
|
2001-02-23 03:28:34 +03:00
|
|
|
numberElement = document.getElementById("number");
|
|
|
|
numberElement.value = nntpServer.maxArticles;
|
2000-01-03 08:11:51 +03:00
|
|
|
|
2001-02-23 03:28:34 +03:00
|
|
|
markreadElement = document.getElementById("markread");
|
|
|
|
markreadElement.checked = nntpServer.markOldRead;
|
2000-01-03 08:11:51 +03:00
|
|
|
|
2001-02-23 03:28:34 +03:00
|
|
|
return true;
|
1999-12-29 02:08:33 +03:00
|
|
|
}
|
2000-01-03 07:09:55 +03:00
|
|
|
|
2000-04-30 13:15:07 +04:00
|
|
|
function setText(id, value) {
|
|
|
|
var element = document.getElementById(id);
|
|
|
|
if (!element) return;
|
2001-03-22 03:59:29 +03:00
|
|
|
if (element.hasChildNodes())
|
2001-02-23 03:28:34 +03:00
|
|
|
element.removeChild(element.firstChild);
|
2000-06-17 07:26:47 +04:00
|
|
|
var textNode = document.createTextNode(value);
|
|
|
|
element.appendChild(textNode);
|
2000-01-03 07:09:55 +03:00
|
|
|
}
|
|
|
|
|
2000-01-13 11:12:12 +03:00
|
|
|
function OkButtonCallback() {
|
2001-02-23 03:28:34 +03:00
|
|
|
nntpServer.maxArticles = numberElement.value;
|
|
|
|
nntpServer.markOldRead = markreadElement.checked;
|
2000-01-13 11:51:53 +03:00
|
|
|
|
2000-03-05 02:13:00 +03:00
|
|
|
var radio = document.getElementById("all");
|
2001-11-05 03:29:39 +03:00
|
|
|
if (radio)
|
|
|
|
args.downloadAll = radio.selected;
|
2000-03-05 02:13:00 +03:00
|
|
|
|
2000-12-20 09:31:54 +03:00
|
|
|
args.hitOK = true;
|
2001-02-23 03:28:34 +03:00
|
|
|
return true;
|
2000-03-05 02:13:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function CancelButtonCallback() {
|
2000-12-20 09:31:54 +03:00
|
|
|
args.hitOK = false;
|
2001-02-23 03:28:34 +03:00
|
|
|
return true;
|
2000-01-13 11:12:12 +03:00
|
|
|
}
|
2000-06-17 07:26:47 +04:00
|
|
|
|
2001-01-06 09:28:19 +03:00
|
|
|
function setupDownloadUI(enable) {
|
2001-02-23 03:28:34 +03:00
|
|
|
var checkbox = document.getElementById("markread");
|
|
|
|
var numberFld = document.getElementById("number");
|
|
|
|
|
2004-07-07 15:32:45 +04:00
|
|
|
checkbox.disabled = !enable;
|
|
|
|
numberFld.disabled = !enable;
|
2000-09-14 03:57:52 +04:00
|
|
|
}
|