Disable enroll button if nothing selected.

A new IPA.dialog_button class has been added to encapsulate the
buttons in the dialog box so they can be managed more easily.

The adder dialog has been modified to disable the enroll button if
there is no entries selected.

Ticket #1856
This commit is contained in:
Endi S. Dewata
2011-09-28 15:56:25 -05:00
parent ecb58275e3
commit f99ab781ea
11 changed files with 520 additions and 259 deletions

View File

@@ -508,20 +508,28 @@ IPA.host_keytab_widget = function(spec) {
dialog.container.append(IPA.messages.objects.host.unprovision_confirmation);
};
dialog.add_button(IPA.messages.objects.host.unprovision, function() {
that.unprovision(
function(data, text_status, xhr) {
set_status('missing');
dialog.close();
},
function(xhr, text_status, error_thrown) {
dialog.close();
}
);
dialog.create_button({
name: 'unprovision',
label: IPA.messages.objects.host.unprovision,
click: function() {
that.unprovision(
function(data, text_status, xhr) {
set_status('missing');
dialog.close();
},
function(xhr, text_status, error_thrown) {
dialog.close();
}
);
}
});
dialog.add_button(IPA.messages.buttons.cancel, function() {
dialog.close();
dialog.create_button({
name: 'cancel',
label: IPA.messages.buttons.cancel,
click: function() {
dialog.close();
}
});
dialog.open(that.container);
@@ -637,34 +645,42 @@ IPA.host_password_widget = function(spec) {
type: 'password'
}));
dialog.add_button(label, function() {
dialog.create_button({
name: 'set_password',
label: label,
click: function() {
var record = {};
dialog.save(record);
var record = {};
dialog.save(record);
var new_password = record.password1[0];
var repeat_password = record.password2[0];
var new_password = record.password1[0];
var repeat_password = record.password2[0];
if (new_password != repeat_password) {
alert(IPA.messages.password.password_must_match);
return;
}
that.set_password(
new_password,
function(data, text_status, xhr) {
that.load(data.result.result);
dialog.close();
},
function(xhr, text_status, error_thrown) {
dialog.close();
if (new_password != repeat_password) {
alert(IPA.messages.password.password_must_match);
return;
}
);
dialog.close();
that.set_password(
new_password,
function(data, text_status, xhr) {
that.load(data.result.result);
dialog.close();
},
function(xhr, text_status, error_thrown) {
dialog.close();
}
);
dialog.close();
}
});
dialog.add_button(IPA.messages.buttons.cancel, function() {
dialog.close();
dialog.create_button({
name: 'cancel',
label: IPA.messages.buttons.cancel,
click: function() {
dialog.close();
}
});
dialog.open(that.container);