bug# 114448, r=kaie, sr=hewitt removing the url type menu in crls

This commit is contained in:
rangansen%netscape.com 2001-12-11 05:59:49 +00:00
Родитель 6c7808bbc0
Коммит 432f3e947f
7 изменённых файлов: 13 добавлений и 114 удалений

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

@ -67,22 +67,10 @@ function onLoad()
try {
updateEnabled = prefs.GetBoolPref(autoupdateEnabledString);
if(updateEnabled) {
var autoupdateURLTypeString = "security.crl.autoupdate.urlType." + crl.nameInDb;
var autoupdateURLString = "security.crl.autoupdate.url." + crl.nameInDb;
//If this crl already has a download url preference defined, update it
var type = prefs.GetIntPref(autoupdateURLTypeString);
if(type == crl.AUTOUPDATE_USE_ADVERTISED_URL) {
if(crl.advertisedURL==null || crl.advertisedURL.length==0) {
prefs.SetCharPref(autoupdateURLString,bundle.GetStringFromName("undefinedValStr"));
} else {
prefs.SetCharPref(autoupdateURLString,crl.advertisedURL);
}
} else {
prefs.SetCharPref(autoupdateURLString,crl.lastFetchURL);
}
prefs.SetCharPref(autoupdateURLString,crl.lastFetchURL);
prefs.savePrefFile(null);
}
}
}catch(exception){}
var statement = document.getElementById("status");

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

@ -30,7 +30,6 @@ const nsIPref = Components.interfaces.nsIPref;
var crl;
var bundle;
var prefs;
var menuList;
var updateTypeRadio;
var enabledCheckBox;
var timeBasedRadio;
@ -40,7 +39,6 @@ var certdb;
var autoupdateEnabledString = "security.crl.autoupdate.enable.";
var autoupdateTimeTypeString = "security.crl.autoupdate.timingType.";
var autoupdateTimeString = "security.crl.autoupdate.nextInstant.";
var autoupdateURLTypeString = "security.crl.autoupdate.urlType.";
var autoupdateURLString = "security.crl.autoupdate.url.";
var autoupdateErrCntString = "security.crl.autoupdate.errCount.";
var autoupdateErrDetailString = "security.crl.autoupdate.errDetail.";
@ -57,7 +55,6 @@ function onLoad()
autoupdateEnabledString = autoupdateEnabledString + crl.nameInDb;
autoupdateTimeTypeString = autoupdateTimeTypeString + crl.nameInDb;
autoupdateTimeString = autoupdateTimeString + crl.nameInDb;
autoupdateURLTypeString = autoupdateURLTypeString + crl.nameInDb;
autoupdateDayCntString = autoupdateDayCntString + crl.nameInDb;
autoupdateFreqCntString = autoupdateFreqCntString + crl.nameInDb;
autoupdateURLString = autoupdateURLString + crl.nameInDb;
@ -67,7 +64,6 @@ function onLoad()
bundle = srGetStrBundle("chrome://pippki/locale/pippki.properties");
prefs = Components.classes["@mozilla.org/preferences;1"].getService(nsIPref);
menuList = document.getElementById("urlTypes");
updateTypeRadio = document.getElementById("autoUpdateType");
enabledCheckBox = document.getElementById("enableCheckBox");
timeBasedRadio = document.getElementById("timeBasedRadio");
@ -93,24 +89,6 @@ function updateSelectedTimingControls()
}
}
function updateSelectedURLControls()
{
var selectedID = menuList.selectedItem.id;
var SelectedImportURL;
if( selectedID == "lastFetchURL") {
SelectedImportURL = crl.lastFetchURL ;
} else {
SelectedImportURL = crl.advertisedURL;
}
var URLDisplayed = document.getElementById("urlName");
if(SelectedImportURL==null || SelectedImportURL.length==0 ){
SelectedImportURL = bundle.GetStringFromName("undefinedValStr");
}
URLDisplayed.value = SelectedImportURL;
}
function initializeSelection()
{
var menuItemNode;
@ -127,25 +105,10 @@ function initializeSelection()
enabledCheckBox.checked = false;
}
//Now, populate the contents of the url menu list
//Note: fetch URL is always available, unless we have a db problem
lastFetchMenuNode = document.createElement("menuitem");
lastFetchMenuNode.setAttribute("label", bundle.GetStringFromName("lastFetchUrlLabel"));
lastFetchMenuNode.id = "lastFetchURL";
menuList.firstChild.appendChild(lastFetchMenuNode);
//Always the last fetch url, for now.
var URLDisplayed = document.getElementById("urlName");
URLDisplayed.value = crl.lastFetchURL;
/*
//This goes one once it is implemented in psm/nss
advertisedMenuNode = document.createElement("menuitem");
advertisedMenuNode.setAttribute("label",bundle.GetStringFromName("advertisedUrlLabel"));
advertisedMenuNode.id = "advertisedURL";
menuList.firstChild.appendChild(advertisedMenuNode);
*/
if( (crl.advertisedURL != null) && (crl.advertisedURL !="") ) {
hasAdvertisedURL = true;
}
//Decide how many update timing types to be shown
//If no next update specified, hide the first choice. Default shows both
if(crl.nextUpdateLocale == null || crl.nextUpdateLocale.length == 0) {
@ -155,18 +118,6 @@ function initializeSelection()
//Set up the initial selections based on defaults and prefs, if any
try{
var urlPref = prefs.GetIntPref(autoupdateURLTypeString);
if(urlPref != null){
if(urlPref == crl.AUTOUPDATE_USE_ADVERTISED_URL){
menuList.selectedItem = advertisedMenuNode;
}else {
menuList.selectedItem = lastFetchMenuNode;
}
}else {
//Default
menuList.selectedItem = lastFetchMenuNode;
}
var timingPref = prefs.GetIntPref(autoupdateTimeTypeString);
if(timingPref != null) {
if(timingPref == crl.TYPE_AUTOUPDATE_TIME_BASED) {
@ -185,7 +136,6 @@ function initializeSelection()
}
}catch(exception){
menuList.selectedItem = lastFetchMenuNode;
if(!hasNextUpdate) {
updateTypeRadio.selectedItem = freqBasedRadio;
} else {
@ -260,15 +210,8 @@ function onAccept()
//set enable pref
prefs.SetBoolPref(autoupdateEnabledString, enabledCheckBox.checked );
//set URL TYPE and value prefs
var urlTypeId = menuList.selectedItem.id;
if(urlTypeId == "lastFetchURL"){
prefs.SetIntPref(autoupdateURLTypeString,crl.AUTOUPDATE_USE_LASTFETCH_URL);
prefs.SetCharPref(autoupdateURLString,crl.lastFetchURL);
} else{
prefs.SetIntPref(autoupdateURLTypeString,crl.AUTOUPDATE_USE_ADVERTISED_URL);
prefs.SetCharPref(autoupdateURLString,crl.advertisedURL);
}
//set URL TYPE and value prefs - always to last fetch url - till we have anything else available
prefs.SetCharPref(autoupdateURLString,crl.lastFetchURL);
var timingTypeId = updateTypeRadio.selectedItem.id;
var updateTime;
@ -298,11 +241,6 @@ function onAccept()
function validatePrefs()
{
var URLDisplayed = document.getElementById("urlName");
if(URLDisplayed.value == bundle.GetStringFromName("undefinedValStr")) {
alert(bundle.GetStringFromName("undefinedURL"));
return false;
}
var dayCnt = (document.getElementById("nextUpdateDay")).value;
var freqCnt = (document.getElementById("nextUpdateFreq")).value;

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

@ -66,10 +66,6 @@
<vbox>
<text value="&validation.crl.autoupdate.url.label;" />
<menulist id="urlTypes" oncommand="updateSelectedURLControls();">
<menupopup/>
</menulist>
<textbox readonly="true" id="urlName" />
</vbox>
<separator/>

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

@ -41,7 +41,7 @@
<!ENTITY validation.crl.autoupdate.time.label2 "Day(s) before Next Update date">
<!ENTITY validation.crl.autoupdate.freq.label1 "Update every">
<!ENTITY validation.crl.autoupdate.freq.label2 "Day(s)">
<!ENTITY validation.crl.autoupdate.url.label "Import CRL From">
<!ENTITY validation.crl.autoupdate.url.label "CRL would be imported From:">
<!ENTITY crl.import.status.title "CRL Import Status">
<!ENTITY crl.import.success.message "The Certificate Revocation List (CRL) was successfully imported.">
<!ENTITY crl.issuer.label "CRL Issued By:">

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

@ -75,12 +75,9 @@ interface nsICrlEntry : nsISupports {
readonly attribute wstring nextUpdateLocale;
readonly attribute wstring nameInDb;
readonly attribute wstring lastFetchURL;
readonly attribute wstring advertisedURL;
const unsigned long TYPE_AUTOUPDATE_TIME_BASED = 1;
const unsigned long TYPE_AUTOUPDATE_FREQ_BASED = 2;
const unsigned long AUTOUPDATE_USE_LASTFETCH_URL = 1;
const unsigned long AUTOUPDATE_USE_ADVERTISED_URL = 2;
wstring ComputeNextAutoUpdateTime(in unsigned long autoUpdateType,
in double noOfDays);

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

@ -32,7 +32,7 @@
* may use your version of this file under either the MPL or the
* GPL.
*
* $Id: nsNSSCertificate.cpp,v 1.55 2001/12/06 22:36:43 rangansen%netscape.com Exp $
* $Id: nsNSSCertificate.cpp,v 1.56 2001/12/11 05:59:49 rangansen%netscape.com Exp $
*/
#include "prmem.h"
@ -3775,24 +3775,20 @@ done:
PRUnichar *updateURL;
nsCAutoString updateURLStr;
PRInt32 timingTypePref;
PRInt32 urlTypePref;
double dayCnt;
char *dayCntStr;
nsCAutoString updateTypePrefStr(CRL_AUTOUPDATE_TIMIINGTYPE_PREF);
nsCAutoString updateTimePrefStr(CRL_AUTOUPDATE_TIME_PREF);
nsCAutoString updateUrlPrefStr(CRL_AUTOUPDATE_URL_PREF);
nsCAutoString updateUrlTypePrefStr(CRL_AUTOUPDATE_URLTYPE_PREF);
nsCAutoString updateDayCntPrefStr(CRL_AUTOUPDATE_DAYCNT_PREF);
nsCAutoString updateFreqCntPrefStr(CRL_AUTOUPDATE_FREQCNT_PREF);
updateTypePrefStr.AppendWithConversion(crlKey);
updateTimePrefStr.AppendWithConversion(crlKey);
updateUrlPrefStr.AppendWithConversion(crlKey);
updateUrlTypePrefStr.AppendWithConversion(crlKey);
updateDayCntPrefStr.AppendWithConversion(crlKey);
updateFreqCntPrefStr.AppendWithConversion(crlKey);
pref->GetIntPref(updateTypePrefStr.get(),&timingTypePref);
pref->GetIntPref(updateUrlTypePrefStr.get(),&urlTypePref);
//Compute and update the next download instant
if(timingTypePref == nsCrlEntry::TYPE_AUTOUPDATE_TIME_BASED){
@ -3821,11 +3817,7 @@ done:
}
//Update the url to download from, next time
if(urlTypePref == nsCrlEntry::AUTOUPDATE_USE_LASTFETCH_URL){
crlEntry->GetLastFetchURL(&updateURL);
}else{
crlEntry->GetAdvertisedURL(&updateURL);
}
crlEntry->GetLastFetchURL(&updateURL);
updateURLStr.AssignWithConversion(updateURL);
nsMemory::Free(updateURL);
pref->SetCharPref(updateUrlPrefStr.get(),updateURLStr.get());
@ -3871,7 +3863,7 @@ nsCrlEntry::nsCrlEntry()
nsCrlEntry::nsCrlEntry(const PRUnichar * aOrg, const PRUnichar * aOrgUnit,
const PRUnichar * aLastUpdateLocale, const PRUnichar * aNextUpdateLocale,
PRTime aLastUpdate, PRTime aNextUpdate, const PRUnichar *aNameInDb,
const PRUnichar *aLastFetchURL, const PRUnichar *aAdvertisedURL)
const PRUnichar *aLastFetchURL)
{
NS_INIT_ISUPPORTS();
mOrg.Assign(aOrg);
@ -3882,8 +3874,6 @@ nsCrlEntry::nsCrlEntry(const PRUnichar * aOrg, const PRUnichar * aOrgUnit,
mNextUpdate = aNextUpdate;
mNameInDb.Assign(aNameInDb);
mLastFetchURL.Assign(aLastFetchURL);
mAdvertisedURL.Assign(aAdvertisedURL);
}
@ -4005,14 +3995,6 @@ NS_IMETHODIMP nsCrlEntry::GetLastFetchURL(PRUnichar** aLastFetchURL)
return NS_OK;
}
NS_IMETHODIMP nsCrlEntry::GetAdvertisedURL(PRUnichar** aAdvertisedURL)
{
NS_ENSURE_ARG(aAdvertisedURL);
*aAdvertisedURL = ToNewUnicode(mAdvertisedURL);
return NS_OK;
}
NS_IMETHODIMP nsCrlEntry::ComputeNextAutoUpdateTime(PRUint32 autoUpdateType, double dayCnt, PRUnichar **nextAutoUpdate)
{

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

@ -86,13 +86,12 @@ private:
#define CRL_AUTOUPDATE_TIMIINGTYPE_PREF "security.crl.autoupdate.timingType"
#define CRL_AUTOUPDATE_TIME_PREF "security.crl.autoupdate.nextInstant"
#define CRL_AUTOUPDATE_URL_PREF "security.crl.autoupdate.url"
#define CRL_AUTOUPDATE_URLTYPE_PREF "security.crl.autoupdate.urlType"
#define CRL_AUTOUPDATE_DAYCNT_PREF "security.crl.autoupdate.dayCnt"
#define CRL_AUTOUPDATE_FREQCNT_PREF "security.crl.autoupdate.freqCnt"
#define CRL_AUTOUPDATE_ERRCNT_PREF "security.crl.autoupdate.errCount"
#define CRL_AUTOUPDATE_ERRDETAIL_PREF "security.crl.autoupdate.errDetail"
#define CRL_AUTOUPDATE_ENABLED_PREF "security.crl.autoupdate.enable."
#define CRL_AUTOUPDATE_DEFAULT_DELAY 120000UL
#define CRL_AUTOUPDATE_DEFAULT_DELAY 30000UL
class nsCrlEntry : public nsICrlEntry
{
@ -102,7 +101,7 @@ public:
nsCrlEntry();
nsCrlEntry(CERTSignedCrl *);
nsCrlEntry(const PRUnichar*, const PRUnichar*, const PRUnichar*, const PRUnichar*, PRTime, PRTime, const PRUnichar*, const PRUnichar*, const PRUnichar*);
nsCrlEntry(const PRUnichar*, const PRUnichar*, const PRUnichar*, const PRUnichar*, PRTime, PRTime, const PRUnichar*, const PRUnichar*);
virtual ~nsCrlEntry();
/* additional members */
private:
@ -114,7 +113,6 @@ private:
PRTime mNextUpdate;
nsString mNameInDb;
nsString mLastFetchURL;
nsString mAdvertisedURL;
nsString mNextAutoUpdateDate;
};