summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xinstall/ui/certificate.js24
-rw-r--r--install/ui/dialog.js7
-rw-r--r--install/ui/entitle.js37
-rw-r--r--install/ui/entity.js37
-rw-r--r--install/ui/search.js13
-rw-r--r--install/ui/widget.js4
6 files changed, 81 insertions, 41 deletions
diff --git a/install/ui/certificate.js b/install/ui/certificate.js
index c52163629..30ac0d74a 100755
--- a/install/ui/certificate.js
+++ b/install/ui/certificate.js
@@ -74,7 +74,7 @@ IPA.cert.parse_dn = function(dn) {
return result;
};
-IPA.cert.get_dialog = function(spec) {
+IPA.cert.download_dialog = function(spec) {
spec = spec || {};
@@ -82,8 +82,9 @@ IPA.cert.get_dialog = function(spec) {
that.width = spec.width || 500;
that.height = spec.height || 400;
+ that.add_pem_delimiters = typeof spec.add_pem_delimiters == 'undefined' ? true : spec.add_pem_delimiters;
- that.usercertificate = spec.usercertificate || '';
+ that.certificate = spec.certificate || '';
that.add_button(IPA.messages.buttons.close, function() {
that.close();
@@ -95,10 +96,15 @@ IPA.cert.get_dialog = function(spec) {
style: 'width: 100%; height: 275px;'
}).appendTo(that.container);
- textarea.val(
- IPA.cert.BEGIN_CERTIFICATE+'\n'+
- that.usercertificate+'\n'+
- IPA.cert.END_CERTIFICATE);
+ var certificate = that.certificate;
+
+ if (that.add_pem_delimiters) {
+ certificate = IPA.cert.BEGIN_CERTIFICATE+'\n'+
+ that.certificate+'\n'+
+ IPA.cert.END_CERTIFICATE;
+ }
+
+ textarea.val(certificate);
};
return that;
@@ -675,9 +681,9 @@ IPA.cert.status_widget = function(spec) {
title = title.replace('${entity}', that.entity_label);
title = title.replace('${primary_key}', entity_name);
- var dialog = IPA.cert.get_dialog({
- 'title': title,
- 'usercertificate': entity_certificate
+ var dialog = IPA.cert.download_dialog({
+ title: title,
+ certificate: entity_certificate
});
dialog.init();
diff --git a/install/ui/dialog.js b/install/ui/dialog.js
index 08fba4580..cba5b1abf 100644
--- a/install/ui/dialog.js
+++ b/install/ui/dialog.js
@@ -274,11 +274,8 @@ IPA.dialog = function(spec) {
var field;
if (field_spec instanceof Object) {
- if (field_spec.factory) {
- field = field_spec.factory(field_spec);
- } else {
- field = IPA.text_widget(field_spec);
- }
+ var factory = field_spec.factory || IPA.text_widget;
+ field = factory(field_spec);
} else {
var field_name = field_spec;
field = IPA.text_widget({ name: field_name, undo: false });
diff --git a/install/ui/entitle.js b/install/ui/entitle.js
index 4c9cd13c6..17be45835 100644
--- a/install/ui/entitle.js
+++ b/install/ui/entitle.js
@@ -56,6 +56,11 @@ IPA.entity_factories.entitle = function() {
{
name: 'end',
label: 'End'
+ },
+ {
+ factory: IPA.entitle.certificate_column,
+ name: 'certificate',
+ label: 'Certificate'
}
]
}).
@@ -404,6 +409,36 @@ IPA.entitle.search_facet = function(spec) {
return that;
};
+IPA.entitle.certificate_column = function(spec) {
+
+ spec = spec || {};
+
+ var that = IPA.column(spec);
+
+ that.setup = function(container, record) {
+ container.empty();
+
+ var certificate = record[that.name];
+
+ $('<a/>', {
+ 'href': '#download',
+ 'html': 'Download',
+ 'click': function() {
+ var dialog = IPA.cert.download_dialog({
+ title: 'Download Certificate',
+ certificate: certificate,
+ add_pem_delimiters: false
+ });
+ dialog.init();
+ dialog.open();
+ return false;
+ }
+ }).appendTo(container);
+ };
+
+ return that;
+};
+
IPA.entitle.certificate_dialog = function(spec) {
spec = spec || {};
@@ -542,4 +577,4 @@ IPA.entitle.import_dialog = function(spec) {
});
return that;
-}; \ No newline at end of file
+};
diff --git a/install/ui/entity.js b/install/ui/entity.js
index 23f792d1e..2cbed5b6b 100644
--- a/install/ui/entity.js
+++ b/install/ui/entity.js
@@ -559,42 +559,43 @@ IPA.entity_builder = function(){
}
facet.add_section(current_section);
var fields = spec.fields;
- if (fields){
- var i;
- var field;
- for (i =0; i < fields.length; i += 1){
- field = fields[i];
- if (field instanceof Object){
- field.entity_name = entity.name;
- current_section.add_field(field.factory(field));
- }else{
+ if (fields) {
+ for (var i=0; i<fields.length; i++) {
+ var field_spec = fields[i];
+ var field;
+
+ if (field_spec instanceof Object) {
+ field_spec.entity_name = entity.name;
+ var factory = field_spec.factory || IPA.text_widget;
+ field = factory(field_spec);
+ } else {
field = IPA.text_widget({
- name:field,
- entity_name:entity.name
+ name: field_spec,
+ entity_name: entity.name
});
- current_section.add_field(field);
}
+ current_section.add_field(field);
}
}
}
that.entity = function(spec) {
- if (spec instanceof Object){
+ if (spec instanceof Object) {
var factory = spec.factory || IPA.entity;
entity = factory(spec);
} else {
- var name = spec;
- entity = IPA.entity({name: name});
+ entity = IPA.entity({ name: spec });
}
return that;
};
that.dialog = function(spec) {
var dialog;
- if (spec.factory) {
- dialog = spec.factory(spec);
+ if (spec instanceof Object){
+ var factory = spec.factory || IPA.dialog;
+ dialog = factory(spec);
} else {
- dialog = IPA.dialog(spec);
+ dialog = IPA.dialog({ name: spec });
}
entity.dialog(dialog);
return that;
diff --git a/install/ui/search.js b/install/ui/search.js
index f2789f62e..7f00ebfa2 100644
--- a/install/ui/search.js
+++ b/install/ui/search.js
@@ -414,13 +414,16 @@ IPA.search_facet = function(spec) {
var columns = spec.columns || [];
for (var i=0; i<columns.length; i++) {
- var column = columns[i];
- if (column instanceof Object) {
- var factory = column.factory || IPA.column;
- that.add_column(factory(column));
+ var column_spec = columns[i];
+ var column;
+
+ if (column_spec instanceof Object) {
+ var factory = column_spec.factory || IPA.column;
+ column = factory(column_spec);
} else {
- that.create_column({ name: column });
+ column = IPA.column({ name: column_spec });
}
+ that.add_column(column);
}
return that;
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 744e6ed4a..8680086ec 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -1007,14 +1007,12 @@ IPA.column = function (spec) {
var that = {};
- if (spec.format){
- that.format = spec.format;
- }
that.name = spec.name;
that.label = spec.label;
that.primary_key = spec.primary_key;
that.width = spec.width;
that.entity_name = spec.entity_name;
+ that.format = spec.format;
that.setup = spec.setup || setup;