summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2011-06-30 17:38:59 -0400
committerAdam Young <ayoung@redhat.com>2011-07-01 16:49:49 -0400
commit7a25523d63559b19babd83c74223d2d0c4d75157 (patch)
tree3a6048b9c4c8bead5e9879e8edd4ba58f42226ae
parent58eec70884fba522fe5865355351e906f07d228e (diff)
downloadfreeipa-7a25523d63559b19babd83c74223d2d0c4d75157.zip
freeipa-7a25523d63559b19babd83c74223d2d0c4d75157.tar.gz
freeipa-7a25523d63559b19babd83c74223d2d0c4d75157.tar.xz
entity link for password policy
https://fedorahosted.org/freeipa/ticket/1111 reset() now hides both the link and the label calucalating should_link is now a function that can be overloaded.
-rw-r--r--install/ui/policy.js11
-rw-r--r--install/ui/widget.js56
2 files changed, 65 insertions, 2 deletions
diff --git a/install/ui/policy.js b/install/ui/policy.js
index d30abbf..cd0e499 100644
--- a/install/ui/policy.js
+++ b/install/ui/policy.js
@@ -33,8 +33,15 @@ IPA.entity_factories.pwpolicy = function() {
sections:[
{
name : 'identity',
- fields:['krbmaxpwdlife','krbminpwdlife','krbpwdhistorylength',
- 'krbpwdmindiffchars','krbpwdminlength']
+ fields:[
+ {
+ factory: IPA.entity_link_widget,
+ name: 'cn',
+ entity: 'group',
+ no_link_value: 'global_policy'
+ },
+ 'krbmaxpwdlife','krbminpwdlife','krbpwdhistorylength',
+ 'krbpwdmindiffchars','krbpwdminlength']
}]}).
standard_association_facets().
adder_dialog({
diff --git a/install/ui/widget.js b/install/ui/widget.js
index a56e552..2ea345d 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -1729,3 +1729,59 @@ IPA.entity_select_widget = function(spec) {
return that;
};
+
+IPA.entity_link_widget = function(spec) {
+ var that = IPA.widget(spec);
+ var no_link_value = spec.no_link_value || null;
+ var should_link = true;
+ var other_pkey = null;
+ var other_entity = spec.entity;
+
+ that.super_create = that.create;
+ that.create = function(container) {
+ that.super_create(container);
+ that.link =
+ $('<a/>', {
+ href: 'jslink',
+ title: '',
+ html: '',
+ click: function() {
+ if (should_link){
+ IPA.nav.show_page(other_entity, 'default', other_pkey);
+ }
+ return false;
+ }
+ }).appendTo(container);
+
+ that.label = $('<label/>').
+ appendTo(container);
+ };
+ that.should_link = function(){
+ return (other_pkey !== no_link_value);
+ };
+
+ that.reset = function(record) {
+ other_pkey = null;
+ if (that.values || that.values.length > 0){
+ other_pkey = that.values[0];
+ var should_link = that.should_link();
+ if (should_link){
+ that.link.html(other_pkey);
+ that.link.css('display','inline');
+ that.label.css('display','none');
+ }else{
+ that.label.html(other_pkey);
+ that.link.css('display','none');
+ that.label.css('display','inline');
+ }
+ }else{
+ should_link = false;
+ that.link.html('');
+ that.label.html('');
+ that.link.css('display','none');
+ that.label.css('display','none');
+ }
+ };
+
+ return that;
+}; \ No newline at end of file