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:57:19 +0000
commitf99ab781ea33f0d7ca6df26090cd99f9315454ac (patch)
tree548558b589a656503eeb50aa090eed3a45b6f8e4 /install/ui/entitle.js
parentecb58275e30f215143c57bdf96094103c8fda7ba (diff)
downloadfreeipa.git-f99ab781ea33f0d7ca6df26090cd99f9315454ac.tar.gz
freeipa.git-f99ab781ea33f0d7ca6df26090cd99f9315454ac.tar.xz
freeipa.git-f99ab781ea33f0d7ca6df26090cd99f9315454ac.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 b8cff6ee..eaa96069 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;