diff options
author | Endi S. Dewata <edewata@redhat.com> | 2011-02-03 21:42:50 -0600 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-02-07 11:31:17 -0500 |
commit | 348d734c59432a740b52924ac18ff47b30dad54e (patch) | |
tree | 7ed5d13f7a8f16dce89e6889366f9b661ef41cf1 /install/ui/user.js | |
parent | a6849ef2ba5611ac44b612b2c0552c685b22aa3a (diff) | |
download | freeipa-348d734c59432a740b52924ac18ff47b30dad54e.tar.gz freeipa-348d734c59432a740b52924ac18ff47b30dad54e.tar.xz freeipa-348d734c59432a740b52924ac18ff47b30dad54e.zip |
Restructuring details page.
Previously the IPA.details_list_section can only be used with widgets
that generates <dd> tag because it uses the following structure:
<dl>
<dt>Telephone Number:</dt>
<span name="teleponenumber">
<dd>111-1111</dd>
<dd>222-2222</dd>
</span>
</dl>
The <dd> tag was previously used to handle multi-valued attributes.
Since multi-valued attributes are now handled by the recently added
IPA.multivalued_text_widget, the structure can be changed as follows:
<dl>
<dt>Telephone Number:</dt>
<dd>
<span name="telephonenumber">
<div>111-1111</div>
<div>222-2222</div>
</span>
</dd>
</dl>
This allows IPA.details_list_section to be used with any widgets
without requiring the <dd> tag.
Diffstat (limited to 'install/ui/user.js')
-rw-r--r-- | install/ui/user.js | 141 |
1 files changed, 67 insertions, 74 deletions
diff --git a/install/ui/user.js b/install/ui/user.js index 663aab920..c30836c59 100644 --- a/install/ui/user.js +++ b/install/ui/user.js @@ -55,9 +55,9 @@ IPA.entity_factories.user = function (){ input({name:'initials'})). section( IPA.stanza({name: 'account', label: IPA.messages.details.account}). - custom_input(user_status_widget({name:'nsaccountlock'})). + custom_input(IPA.user_status_widget({name:'nsaccountlock'})). input({name:'uid'}). - input({name:'userpassword', load: user_password_load}). + custom_input(IPA.user_password_widget({name:'userpassword'})). input({name:'uidnumber'}). input({name:'gidnumber'}). input({name:'loginshell'}). @@ -96,7 +96,7 @@ IPA.entity_factories.user = function (){ /* ATTRIBUTE CALLBACKS */ -function user_status_widget(spec) { +IPA.user_status_widget = function(spec) { spec = spec || {}; @@ -106,10 +106,7 @@ function user_status_widget(spec) { if (!that.record) return; - $('dd', that.container).remove(); - - var dd = IPA.create_first_dd(this.name); - dd.appendTo(that.container); + that.container.empty(); var lock_field = 'nsaccountlock'; @@ -154,81 +151,77 @@ function user_status_widget(spec) { return (false); } }); - status_field.appendTo(dd); + status_field.appendTo(that.container); }; return that; -} - -function resetpwd_on_click(){ - - function reset_password(new_password){ - var dialog = resetpwd_dialog; - - var user_pkey = $.bbq.getState('user-pkey'); - var pw_pkey; - if (user_pkey === IPA.whoami.uid[0]){ - pw_pkey = []; - }else{ - pw_pkey = [user_pkey]; - } - - IPA.cmd('passwd', - pw_pkey, {"password":new_password}, - function(){ - alert("Password change complete"); - dialog.dialog("close"); - }, - function(){}); - } - - - var resetpwd_dialog = - $('<div ><dl class="modal">'+ - '<dt>New Password</dt>'+ - '<dd class="first" ><input id="password_1" type="password"/></dd>'+ - '<dt>Repeat Password</dt>'+ - '<dd class="first"><input id="password_2" type="password"/></dd>'+ - '</dl></div>'); - resetpwd_dialog.dialog( - { modal: true, - minWidth:400, - buttons: { - 'Reset Password': function(){ - var p1 = $("#password_1").val(); - var p2 = $("#password_2").val(); - if (p1 != p2){ - alert("passwords must match"); - return; - } - reset_password(p1); - }, - 'Cancel':function(){ - resetpwd_dialog.dialog('close'); - } - }}); - return false; -} +}; -function user_password_load(result) { +IPA.user_password_widget = function(spec) { - var that = this; + spec = spec || {}; - $('dd', that.container).remove(); + var that = IPA.widget(spec); - var dd = IPA.create_first_dd(this.name); - dd.appendTo(that.container); + that.create = function(container) { + $('<a/>', { + href: 'jslink', + title: 'userpassword', + text: 'reset password', + click: resetpwd_on_click + }).appendTo(container); + }; - var link = $('<a/>',{ - href:"jslink", - click:resetpwd_on_click, - title:'userpassword', - text: 'reset password' - }); - link.appendTo(dd); + function resetpwd_on_click() { + + function reset_password(new_password) { + + var user_pkey = $.bbq.getState('user-pkey'); + var pw_pkey; + if (user_pkey === IPA.whoami.uid[0]){ + pw_pkey = []; + }else{ + pw_pkey = [user_pkey]; + } + + IPA.cmd('passwd', + pw_pkey, {"password":new_password}, + function(){ + alert("Password change complete"); + dialog.dialog("close"); + }, + function(){}); + } -} + var dialog = + $('<div ><dl class="modal">'+ + '<dt>New Password</dt>'+ + '<dd class="first" ><input id="password_1" type="password"/></dd>'+ + '<dt>Repeat Password</dt>'+ + '<dd class="first"><input id="password_2" type="password"/></dd>'+ + '</dl></div>'); + + dialog.dialog({ + modal: true, + minWidth:400, + buttons: { + 'Reset Password': function(){ + var p1 = $("#password_1").val(); + var p2 = $("#password_2").val(); + if (p1 != p2){ + alert("passwords must match"); + return; + } + reset_password(p1); + }, + 'Cancel':function(){ + dialog.dialog('close'); + } + } + }); -var select_temp = '<select title="st"></select>'; -var option_temp = '<option value="V">V</option>'; + return false; + } + return that; +}; |