зеркало из https://github.com/mozilla/pjs.git
CCK only - not part of build Need to add a full check for extension ID format so invalid IDs are rejected - regex copied from nsExtensionManager.js I also had to change the error message to be more detailed - L10N impact
This commit is contained in:
Родитель
47768596d0
Коммит
a6f26550cf
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
<!ENTITY id.label "Unique ID:">
|
||||
<!ENTITY id.error "Unique ID is required">
|
||||
<!ENTITY id.error "Unique ID is required and is of the format extensionname@organization.tld. It can only contain the letters a-z, the numbers 0-9, and the following symbols: . _ - ">
|
||||
<!ENTITY id.format "Format: companyname-cck@extensions.domainname.tld">
|
||||
<!ENTITY name.label "Name:">
|
||||
<!ENTITY name.error "Name is required">
|
||||
|
|
|
@ -2353,11 +2353,22 @@ function CCKReadConfigFile(srcdir)
|
|||
|
||||
function Validate(field, message)
|
||||
{
|
||||
var gIDTest = /^(\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\}|[a-z0-9-\._]*\@[a-z0-9-\._]+)$/i;
|
||||
|
||||
for (var i=0; i < arguments.length; i+=2) {
|
||||
if (document.getElementById(arguments[i]).value == '') {
|
||||
var bundle = document.getElementById("bundle_cckwizard");
|
||||
gPromptService.alert(window, bundle.getString("windowTitle"), arguments[i+1]);
|
||||
return false;
|
||||
/* special case ID */
|
||||
if (document.getElementById(arguments[i] = "id")) {
|
||||
if (!gIDTest.test(document.getElementById(arguments[i]).value)) {
|
||||
var bundle = document.getElementById("bundle_cckwizard");
|
||||
gPromptService.alert(window, bundle.getString("windowTitle"), arguments[i+1]);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (document.getElementById(arguments[i]).value == '') {
|
||||
var bundle = document.getElementById("bundle_cckwizard");
|
||||
gPromptService.alert(window, bundle.getString("windowTitle"), arguments[i+1]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
Загрузка…
Ссылка в новой задаче