Make ssh_widget not-editable if attr is readonly Depends on patch pvoborni-428.
https://fedorahosted.org/freeipa/ticket/3800 -- Petr Vobornik
From df1d96dcd9996d6849521f0e36cdd6e04e8d3b14 Mon Sep 17 00:00:00 2001 From: Petr Vobornik <[email protected]> Date: Fri, 28 Jun 2013 16:50:52 +0200 Subject: [PATCH] Make ssh_widget not-editable if attr is readonly https://fedorahosted.org/freeipa/ticket/3800 --- install/ui/src/freeipa/widget.js | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index c25c79b0bfa8057b411bfb5918263916e1a856a2..6a590e4e16b51bd62712c8e0ef5e9bab7d25c55c 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -3764,6 +3764,8 @@ IPA.sshkey_widget = function(spec) { that.create_edit_dialog = function() { + var writable = that.is_writable(); + var dialog = IPA.dialog({ name: 'sshkey-edit-dialog', title: '@i18n:objects.sshkeystore.set_dialog_title', @@ -3773,19 +3775,26 @@ IPA.sshkey_widget = function(spec) { dialog.message = text.get('@i18n:objects.sshkeystore.set_dialog_help'); - dialog.create_button({ - name: 'update', - label: '@i18n:buttons.set', - click: function() { - var value = dialog.textarea.val(); - that.set_user_value(value); - dialog.close(); - } - }); + if (writable) { + dialog.create_button({ + name: 'update', + label: '@i18n:buttons.set', + click: function() { + var value = dialog.textarea.val(); + that.set_user_value(value); + dialog.close(); + } + }); + } + + var label = '@i18n:buttons.cancel'; + if (!writable) { + label = '@i18n:buttons.close'; + } dialog.create_button({ name: 'cancel', - label: '@i18n:buttons.cancel', + label: label, click: function() { dialog.close(); } @@ -3797,7 +3806,7 @@ IPA.sshkey_widget = function(spec) { dialog.textarea = $('<textarea/>', { 'class': 'certificate', - readonly: that.read_only + readonly: !writable }).appendTo(dialog.container); var key = that.key.key || ''; -- 1.8.3.1
_______________________________________________ Freeipa-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/freeipa-devel
