1
1
var ec2_ImageRegistrar = {
5
getTextBox : function() {
6
return document.getElementById("ec2ui.newimage.manifest");
9
registerImage : function() {
10
if (!this.validateManifest()) return false;
11
this.retVal.manifestPath = this.getTextBox().value;
12
this.retVal.ok = true;
16
validateManifest : function() {
17
var textbox = this.getTextBox();
18
if (textbox.value == "") {
19
alert("Please provide a path to an image manifest file");
23
var oldextre = new RegExp("\\.manifest$");
24
var newextre = new RegExp("\\.manifest\\.xml$");
25
if (textbox.value.match(oldextre) == null && textbox.value.match(newextre) == null) {
26
alert("Manifest files should end in .manifest or .manifest.xml");
30
var httppre = new RegExp("^http", "i");
31
if (textbox.value.match(httppre) != null) {
32
alert("Just specify the bucket and manifest path name, not the entire S3 URL.");
40
this.ec2ui_session = window.arguments[0];
41
this.retVal = window.arguments[1];
5
getTextBox : function() {
6
return document.getElementById("ec2ui.newimage.manifest");
9
registerImage : function() {
10
if (!this.validateManifest()) return false;
11
this.retVal.manifestPath = this.getTextBox().value;
12
this.retVal.ok = true;
16
validateManifest : function() {
17
var textbox = this.getTextBox();
18
var value = textbox.value;
20
alert("Please provide a path to an image manifest file");
24
var oldextre = new RegExp("\\.manifest$");
25
var newextre = new RegExp("\\.manifest\\.xml$");
26
if (value.match(oldextre) == null &&
27
value.match(newextre) == null) {
28
alert("Manifest files should end in .manifest or .manifest.xml");
32
var s3bucket = value.split('/')[0];
33
if (s3bucket.match(new RegExp("[A-Z]"))) {
34
alert("The S3 bucket must be all lower case");
38
var httppre = new RegExp("^http", "i");
39
if (value.match(httppre) != null) {
40
alert("Just specify the bucket and manifest path name, not the entire S3 URL.");
48
this.ec2ui_session = window.arguments[0];
49
this.retVal = window.arguments[1];