From a901f18fbd978d7203b705ccbef18be89491d97c Mon Sep 17 00:00:00 2001 From: Adam Young <[email protected]> Date: Thu, 30 Jun 2011 17:38:59 -0400 Subject: [PATCH] entity link for password policy
https://fedorahosted.org/freeipa/ticket/1111 --- install/ui/policy.js | 11 +++++++++-- install/ui/widget.js | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/install/ui/policy.js b/install/ui/policy.js index d30abbfdc8522362522fe287598ef9d7380cd2f9..cd0e499e14f4275c8f47806cc36aa9154ddf0c1b 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 c2b13778fca45e6fab6d441cb23dda02f3e2cd6d..d8cec867f0c211ea88e4a182136175720558e4f2 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -1722,3 +1722,53 @@ 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.reset = function(record) { + other_pkey = null; + if (that.values || that.values.length > 0){ + other_pkey = that.values[0]; + should_link = (other_pkey !== no_link_value); + 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(''); + } + }; + + return that; +}; \ No newline at end of file -- 1.7.5.2
_______________________________________________ Freeipa-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/freeipa-devel
