Skip to content

Instantly share code, notes, and snippets.

@imduffy15
Created July 22, 2013 13:50
Show Gist options
  • Select an option

  • Save imduffy15/6053967 to your computer and use it in GitHub Desktop.

Select an option

Save imduffy15/6053967 to your computer and use it in GitHub Desktop.
var form = cloudStack.dialog.createForm({
context: context,
noDialog: true,
form: {
title: '',
fields: args.manuallyInputtedAccountInformation
}
});
$wizard.click(function(event) {
var $target = $(event.target);
if($target.closest('div.button.next').size()) {
if($form.valid()) {
close();
return true;
} else {
return false;
}
}
if($target.closest('div.button.cancel').size()) {
close();
return false;
}
});
manuallyInputtedAccountInformation: {
domainid: {
label: 'label.domain',
docID: 'helpAccountDomain',
validation: {
required: true
},
select: function(args) {
var data = {};
if (args.context.users) { // In accounts section
data.listAll = true;
} else if (args.context.domains) { // In domain section (use specific domain)
data.id = args.context.domains[0].id;
}
$.ajax({
url: createURL("listDomains"),
data: data,
dataType: "json",
async: false,
success: function(json) {
var items = [];
domainObjs = json.listdomainsresponse.domain;
$(domainObjs).each(function() {
items.push({
id: this.id,
description: this.path
});
if (this.level == 0)
rootDomainId = this.id;
});
args.response.success({
data: items
});
}
});
}
},
account: {
label: 'label.account',
docID: 'helpAccountAccount',
validation: {
required: true
},
},
accounttype: {
label: 'label.type',
docID: 'helpAccountType',
validation: {
required: true
},
select: function(args) {
var items = [];
items.push({
id: 0,
description: "User"
}); //regular-user
items.push({
id: 1,
description: "Admin"
}); //root-admin
args.response.success({
data: items
});
}
},
timezone: {
label: 'label.timezone',
docID: 'helpAccountTimezone',
select: function(args) {
var items = [];
items.push({
id: "",
description: ""
});
for (var p in timezoneMap)
items.push({
id: p,
description: timezoneMap[p]
});
args.response.success({
data: items
});
}
},
networkdomain: {
label: 'label.network.domain',
docID: 'helpAccountNetworkDomain',
validation: {
required: false
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment