summaryrefslogtreecommitdiffstats
path: root/install/ui/entitle.js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-09-28 15:56:25 -0500
committerEndi S. Dewata <edewata@redhat.com>2011-09-29 16:58:20 +0000
commita60ee8b7810ed2dbe0affe91112c4d7c95394018 (patch)
tree0893fb094f3c250a24716e6e4aaa0f06b4d6c91f /install/ui/entitle.js
parent91de76f8b13d4c4d121d7bf2593fe941d265eb4e (diff)
downloadfreeipa-a60ee8b7810ed2dbe0affe91112c4d7c95394018.tar.gz
freeipa-a60ee8b7810ed2dbe0affe91112c4d7c95394018.tar.xz
freeipa-a60ee8b7810ed2dbe0affe91112c4d7c95394018.zip
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
Diffstat (limited to 'install/ui/entitle.js')
-rw-r--r--install/ui/entitle.js140
1 files changed, 86 insertions, 54 deletions
diff --git a/install/ui/entitle.js b/install/ui/entitle.js
index b8cff6ee2..eaa960693 100644
--- a/install/ui/entitle.js
+++ b/install/ui/entitle.js
@@ -569,24 +569,32 @@ IPA.entitle.register_online_dialog = function(spec) {
var that = IPA.dialog(spec);
- that.add_button(IPA.messages.objects.entitle.register, function() {
- var record = {};
- that.save(record);
-
- that.entity.register_online(
- record.username[0],
- record.password[0],
- record.ipaentitlementid[0],
- function() {
- var facet = that.entity.get_facet();
- facet.refresh();
- that.close();
- }
- );
+ that.create_button({
+ name: 'register',
+ label: IPA.messages.objects.entitle.register,
+ click: function() {
+ var record = {};
+ that.save(record);
+
+ that.entity.register_online(
+ record.username[0],
+ record.password[0],
+ record.ipaentitlementid[0],
+ function() {
+ var facet = that.entity.get_facet();
+ facet.refresh();
+ that.close();
+ }
+ );
+ }
});
- that.add_button(IPA.messages.buttons.cancel, function() {
- that.close();
+ that.create_button({
+ name: 'cancel',
+ label: IPA.messages.buttons.cancel,
+ click: function() {
+ that.close();
+ }
});
return that;
@@ -598,19 +606,27 @@ IPA.entitle.register_offline_dialog = function(spec) {
var that = IPA.entitle.certificate_dialog(spec);
- that.add_button(that.label, function() {
- that.entity.register_offline(
- that.get_certificate(),
- function() {
- var facet = that.entity.get_facet();
- facet.refresh();
- that.close();
- }
- );
+ that.create_button({
+ name: 'register',
+ label: that.label,
+ click: function() {
+ that.entity.register_offline(
+ that.get_certificate(),
+ function() {
+ var facet = that.entity.get_facet();
+ facet.refresh();
+ that.close();
+ }
+ );
+ }
});
- that.add_button(IPA.messages.buttons.cancel, function() {
- that.close();
+ that.create_button({
+ name: 'cancel',
+ label: IPA.messages.buttons.cancel,
+ click: function() {
+ that.close();
+ }
});
return that;
@@ -622,27 +638,35 @@ IPA.entitle.consume_dialog = function(spec) {
var that = IPA.dialog(spec);
- that.add_button(IPA.messages.objects.entitle.consume, function() {
+ that.create_button({
+ name: 'consume',
+ label: IPA.messages.objects.entitle.consume,
+ click: function() {
- if (!that.is_valid()) {
- return;
- }
+ if (!that.is_valid()) {
+ return;
+ }
- var record = {};
- that.save(record);
+ var record = {};
+ that.save(record);
- that.entity.consume(
- record.quantity[0],
- function() {
- var facet = that.entity.get_facet();
- facet.refresh();
- that.close();
- }
- );
+ that.entity.consume(
+ record.quantity[0],
+ function() {
+ var facet = that.entity.get_facet();
+ facet.refresh();
+ that.close();
+ }
+ );
+ }
});
- that.add_button(IPA.messages.buttons.cancel, function() {
- that.close();
+ that.create_button({
+ name: 'cancel',
+ label: IPA.messages.buttons.cancel,
+ click: function() {
+ that.close();
+ }
});
return that;
@@ -654,19 +678,27 @@ IPA.entitle.import_dialog = function(spec) {
var that = IPA.entitle.certificate_dialog(spec);
- that.add_button(IPA.messages.objects.entitle.import_button, function() {
- that.entity.import_certificate(
- that.get_certificate(),
- function() {
- var facet = that.entity.get_facet();
- facet.refresh();
- that.close();
- }
- );
+ that.create_button({
+ name: 'import',
+ label: IPA.messages.objects.entitle.import_button,
+ click: function() {
+ that.entity.import_certificate(
+ that.get_certificate(),
+ function() {
+ var facet = that.entity.get_facet();
+ facet.refresh();
+ that.close();
+ }
+ );
+ }
});
- that.add_button(IPA.messages.buttons.cancel, function() {
- that.close();
+ that.create_button({
+ name: 'cancel',
+ label: IPA.messages.buttons.cancel,
+ click: function() {
+ that.close();
+ }
});
return that;