On 07/29/2013 11:15 AM, Ana Krivokapic wrote:
On 07/18/2013 12:12 PM, Petr Vobornik wrote:
Make ssh_widget not-editable if attr is readonly

Depends on patch pvoborni-428.

https://fedorahosted.org/freeipa/ticket/3800



This patch needs a rebase.


Rebased version attached.
--
Petr Vobornik
From d5a65fc1f55c06fec887e3d89f4c968017800709 Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
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 27e32e2b06f0cf30590036f7f7a4094127c5b7e1..d42b2008d61eff455843701b725ee1863b9cc01b 100644
--- a/install/ui/src/freeipa/widget.js
+++ b/install/ui/src/freeipa/widget.js
@@ -3803,6 +3803,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',
@@ -3812,19 +3814,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();
             }
@@ -3836,7 +3845,7 @@ IPA.sshkey_widget = function(spec) {
 
             dialog.textarea = $('<textarea/>', {
                 'class': 'certificate',
-                readonly: that.read_only,
+                readonly: !writable,
                 disabled: !that.enabled
             }).appendTo(dialog.container);
 
-- 
1.8.3.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to