Entitlement registration.

The entitlement facet will show buttons according to the entitlement
status. If it's unregistered, the facet will show a Register button.
If it's registered, the facet will show a Consume button.
This commit is contained in:
Endi S. Dewata
2011-04-11 20:22:38 -05:00
committed by Endi Sukma Dewata
parent 805b94f22d
commit e3ec1fb7ef
10 changed files with 661 additions and 55 deletions

View File

@@ -252,6 +252,8 @@ IPA.command = function(spec) {
that.on_success = spec.on_success;
that.on_error = spec.on_error;
that.retry = typeof spec.retry == 'undefined' ? true : spec.retry;
that.get_command = function() {
return (that.entity ? that.entity+'_' : '') + that.method;
};
@@ -352,14 +354,19 @@ IPA.command = function(spec) {
if (!error_thrown.title) {
error_thrown.title = 'AJAX Error: '+error_thrown.name;
}
dialog_open.call(this, xhr, text_status, error_thrown);
if (that.retry) {
dialog_open.call(this, xhr, text_status, error_thrown);
} else if (that.on_error) {
that.on_error.call(this, xhr, text_status, error_thrown);
}
}
function success_handler(data, text_status, xhr) {
IPA.hide_activity_icon();
if (!data) {
IPA.hide_activity_icon();
var error_thrown = {
title: 'HTTP Error '+xhr.status,
url: this.url,
@@ -368,12 +375,14 @@ IPA.command = function(spec) {
dialog_open.call(this, xhr, text_status, error_thrown);
} else if (data.error) {
// error_handler() calls IPA.hide_activity_icon()
error_handler.call(this, xhr, text_status, /* error_thrown */ {
title: 'IPA Error '+data.error.code,
message: data.error.message
});
} else if (that.on_success) {
IPA.hide_activity_icon();
that.on_success.call(this, data, text_status, xhr);
}
}