Account page - Add Account dialog - change domain dropdown to input text field that has autoComplete function.

This commit is contained in:
Jessica Wang 2011-02-22 15:04:43 -08:00
parent 77fadf5c7f
commit c082425b16
7 changed files with 58 additions and 4 deletions

View File

@ -14,6 +14,7 @@ label.download.progress=Download Progress
label.total.cpu=Total CPU label.total.cpu=Total CPU
label.cpu.utilized=CPU Utilized label.cpu.utilized=CPU Utilized
label.cpu.allocated.for.VMs=CPU Allocated for VMs label.cpu.allocated.for.VMs=CPU Allocated for VMs
label.not.found=Not Found
#Labels #Labels
label.cpu.allocated=CPU Allocated label.cpu.allocated=CPU Allocated

View File

@ -14,6 +14,7 @@ label.download.progress=Progreso de la descarga
label.total.cpu=Total CPU label.total.cpu=Total CPU
label.cpu.utilized=CPU Utilizado label.cpu.utilized=CPU Utilizado
label.cpu.allocated.for.VMs=CPU asignado para máquinas virtuales label.cpu.allocated.for.VMs=CPU asignado para máquinas virtuales
label.not.found=No se ha encontrado
#Labels #Labels
label.cpu.allocated = CPU asignado label.cpu.allocated = CPU asignado

View File

@ -14,6 +14,7 @@ label.download.progress=ダウンロードの進捗状況
label.total.cpu=合計CPU label.total.cpu=合計CPU
label.cpu.utilized=CPUが活用さ label.cpu.utilized=CPUが活用さ
label.cpu.allocated.for.VMs=CPUはVMの割り当て label.cpu.allocated.for.VMs=CPUはVMの割り当て
label.not.found=が見つかりません
#Labels #Labels
label.cpu.allocated = CPU割り当て label.cpu.allocated = CPU割り当て

View File

@ -14,6 +14,7 @@ label.download.progress=下载进度
label.total.cpu=总的CPU label.total.cpu=总的CPU
label.cpu.utilized=CPU的利用率 label.cpu.utilized=CPU的利用率
label.cpu.allocated.for.VMs=分配给虚拟机的CPU label.cpu.allocated.for.VMs=分配给虚拟机的CPU
label.not.found=找不到
#Labels #Labels
label.cpu.allocated = 已分配CPU label.cpu.allocated = 已分配CPU

View File

@ -81,6 +81,7 @@
'label.maximum': '<fmt:message key="label.maximum"/>', 'label.maximum': '<fmt:message key="label.maximum"/>',
'label.character': '<fmt:message key="label.character"/>', 'label.character': '<fmt:message key="label.character"/>',
'label.double.quotes.are.not.allowed': '<fmt:message key="label.double.quotes.are.not.allowed"/>', 'label.double.quotes.are.not.allowed': '<fmt:message key="label.double.quotes.are.not.allowed"/>',
'label.not.found': '<fmt:message key="label.not.found"/>',
'label.example': '<fmt:message key="label.example"/>', 'label.example': '<fmt:message key="label.example"/>',
'label.by.zone': '<fmt:message key="label.by.zone"/>', 'label.by.zone': '<fmt:message key="label.by.zone"/>',
'label.by.pod': '<fmt:message key="label.by.pod"/>', 'label.by.pod': '<fmt:message key="label.by.pod"/>',

View File

@ -459,10 +459,17 @@ dictionary = {
</select> </select>
</li> </li>
<li> <li>
<label for="add_user_domain"> <label for="domain">
<fmt:message key="label.domain"/>:</label> <fmt:message key="label.domain"/>:</label>
<input class="text" type="text" id="domain" />
<div id="domain_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
<!--
<select class="select" id="domain_dropdown"> <select class="select" id="domain_dropdown">
</select> </select>
-->
</li> </li>
<li> <li>
<label for="add_user_timezone"> <label for="add_user_timezone">

View File

@ -133,7 +133,27 @@ function bindAddAccountButton() {
initDialog("dialog_add_account", 450); initDialog("dialog_add_account", 450);
var $dialogAddAccount = $("#dialog_add_account"); var $dialogAddAccount = $("#dialog_add_account");
var domainObjs = [];
$dialogAddAccount.find("#domain").autocomplete({
source: function(request, response) {
$.ajax({
data: createURL("command=listDomains&keyword=" + request.term),
dataType: "json",
success: function(json) {
domainObjs = json.listdomainsresponse.domain;
var array1 = [];
if(domainObjs != null && domainObjs.length > 0) {
for(var i=0; i < domainObjs.length; i++)
array1.push(fromdb(domainObjs[i].name));
}
response(array1);
}
});
}
});
/*
$.ajax({ $.ajax({
data: createURL("command=listDomains"), data: createURL("command=listDomains"),
dataType: "json", dataType: "json",
@ -146,6 +166,7 @@ function bindAddAccountButton() {
} }
} }
}); });
*/
$("#add_account_button").unbind("click").bind("click", function(event) { $("#add_account_button").unbind("click").bind("click", function(event) {
$dialogAddAccount $dialogAddAccount
@ -160,7 +181,26 @@ function bindAddAccountButton() {
isValid &= validateString("Email", $thisDialog.find("#add_user_email"), $thisDialog.find("#add_user_email_errormsg"), false); //required isValid &= validateString("Email", $thisDialog.find("#add_user_email"), $thisDialog.find("#add_user_email_errormsg"), false); //required
isValid &= validateString("First name", $thisDialog.find("#add_user_firstname"), $thisDialog.find("#add_user_firstname_errormsg"), false); //required isValid &= validateString("First name", $thisDialog.find("#add_user_firstname"), $thisDialog.find("#add_user_firstname_errormsg"), false); //required
isValid &= validateString("Last name", $thisDialog.find("#add_user_lastname"), $thisDialog.find("#add_user_lastname_errormsg"), false); //required isValid &= validateString("Last name", $thisDialog.find("#add_user_lastname"), $thisDialog.find("#add_user_lastname_errormsg"), false); //required
isValid &= validateString("Account", $thisDialog.find("#add_user_account"), $thisDialog.find("#add_user_account_errormsg"), true); //optional isValid &= validateString("Account", $thisDialog.find("#add_user_account"), $thisDialog.find("#add_user_account_errormsg"), true); //optional
isValid &= validateString("Domain", $thisDialog.find("#domain"), $thisDialog.find("#domain_errormsg"), false); //required
var domainName = $thisDialog.find("#domain").val();
var domainId;
if(domainName != null && domainName.length > 0) {
if(domainObjs != null && domainObjs.length > 0) {
for(var i=0; i < domainObjs.length; i++) {
if(fromdb(domainObjs[i].name) == domainName) {
domainId = domainObjs[i].id;
break;
}
}
}
if(domainId == null) {
showError(false, $thisDialog.find("#domain"), $thisDialog.find("#domain_errormsg"), g_dictionary["label.not.found"]);
isValid &= false;
}
}
if (!isValid) if (!isValid)
return; return;
@ -188,7 +228,9 @@ function bindAddAccountButton() {
array1.push("&account="+todb(account)); array1.push("&account="+todb(account));
var accountType = $thisDialog.find("#add_user_account_type").val(); var accountType = $thisDialog.find("#add_user_account_type").val();
var domainId = $thisDialog.find("#domain_dropdown").val();
//var domainId = $thisDialog.find("#domain_dropdown").val();
if (parseInt(domainId) != rootDomainId && accountType == "1") { if (parseInt(domainId) != rootDomainId && accountType == "1") {
accountType = "2"; // Change to domain admin accountType = "2"; // Change to domain admin
} }