diff options
author | Petr VobornÃk <pvoborni@redhat.com> | 2012-02-06 14:52:09 +0100 |
---|---|---|
committer | Petr VobornÃk <pvoborni@redhat.com> | 2012-02-15 09:23:05 +0100 |
commit | eb87b8c31931e682cbb927896d1d60a0266e1263 (patch) | |
tree | 0fc668d7d2c3304f64df005468834ca614712de1 /install/ui | |
parent | 651f9324735d0680c6a56246616932459e15b99d (diff) | |
download | freeipa-eb87b8c31931e682cbb927896d1d60a0266e1263.tar.gz freeipa-eb87b8c31931e682cbb927896d1d60a0266e1263.tar.xz freeipa-eb87b8c31931e682cbb927896d1d60a0266e1263.zip |
UI support for ssh keys
To user and host details pages was added ipasshpubkey attribute.
New widget for ssh public keys was created.
https://fedorahosted.org/freeipa/ticket/2340
Diffstat (limited to 'install/ui')
-rw-r--r-- | install/ui/field.js | 95 | ||||
-rw-r--r-- | install/ui/host.js | 7 | ||||
-rw-r--r-- | install/ui/ipa.css | 9 | ||||
-rw-r--r-- | install/ui/test/data/host_mod.json | 1 | ||||
-rw-r--r-- | install/ui/test/data/host_show.json | 1 | ||||
-rw-r--r-- | install/ui/test/data/host_show_dev.example.com.json | 1 | ||||
-rw-r--r-- | install/ui/test/data/host_show_test.example.com.json | 1 | ||||
-rw-r--r-- | install/ui/test/data/ipa_init.json | 11 | ||||
-rw-r--r-- | install/ui/test/data/user_details_refresh.json | 13 | ||||
-rw-r--r-- | install/ui/test/data/user_mod.json | 13 | ||||
-rw-r--r-- | install/ui/test/data/user_show.json | 13 | ||||
-rw-r--r-- | install/ui/test/widget_tests.js | 2 | ||||
-rw-r--r-- | install/ui/user.js | 9 | ||||
-rw-r--r-- | install/ui/widget.js | 208 |
14 files changed, 358 insertions, 26 deletions
diff --git a/install/ui/field.js b/install/ui/field.js index c79c59bb4..46802be6c 100644 --- a/install/ui/field.js +++ b/install/ui/field.js @@ -148,22 +148,28 @@ IPA.field = function(spec) { that.load = function(record) { that.record = record; - var value = record[that.name]; - if (value instanceof Array) { - that.values = value; - } else { - that.values = value !== undefined ? [value] : []; - } - - if (!that.values.length) { - that.values = ['']; - } + that.values = that.get_value(record, that.name); that.load_writable(record); that.reset(); }; + that.get_value = function(record, name) { + + var value = record[name]; + + if (!(value instanceof Array)) { + value = value !== undefined ? [value] : []; + } + + if (!value.length) { + value = ['']; + } + + return value; + }; + that.load_writable = function(record) { that.writable = true; @@ -272,16 +278,21 @@ IPA.field = function(spec) { //compare values in array if (values.length !== that.values.length) return true; - values.sort(); - that.values.sort(); + return !that.dirty_are_equal(that.values, values); + }; - for (var i=0; i<values.length; i++) { - if (values[i] != that.values[i]) { - return true; + that.dirty_are_equal = function(orig_vals, new_vals) { + + orig_vals.sort(); + new_vals.sort(); + + for (var i=0; i<orig_vals.length; i++) { + if (orig_vals[i] !== new_vals[i]) { + return false; } } - return false; + return true; }; that.is_empty = function(value) { @@ -382,6 +393,7 @@ IPA.field = function(spec) { init(); // methods that should be invoked by subclasses + that.field_dirty_are_equal = that.dirty_are_equal; that.field_load = that.load; that.field_reset = that.reset; that.field_save = that.save; @@ -567,6 +579,56 @@ IPA.multivalued_field = function(spec) { return that; }; +IPA.sshkeys_field = function(spec) { + + spec = spec || {}; + + var that = IPA.multivalued_field(spec); + + that.sshfp_attr = 'sshpubkeyfp' || spec.sshfp_attr; + + that.load = function(record) { + + var keys = that.get_value(record, that.name); + var fingerprints = that.get_value(record, that.sshfp_attr); + + var values = []; + + if (keys.length === fingerprints.length) { + for (var i=0; i<keys.length; i++) { + + if (keys[i] === '') continue; + + var value = { + key: keys[i].__base64__, + fingerprint: fingerprints[i] + }; + values.push(value); + } + } + + that.values = values; + + that.load_writable(record); + + that.reset(); + }; + + that.dirty_are_equal = function(orig_vals, new_vals) { + + var i; + var orig_keys = []; + + for (i=0; i<orig_vals.length; i++) { + orig_keys.push(orig_vals[i].key); + } + + return that.field_dirty_are_equal(orig_keys, new_vals); + }; + + return that; +}; + IPA.select_field = function(spec) { spec = spec || {}; @@ -805,3 +867,4 @@ IPA.field_factories['entity_select'] = IPA.combobox_field; IPA.field_factories['combobox'] = IPA.combobox_field; IPA.field_factories['link'] = IPA.link_field; IPA.field_factories['enable'] = IPA.enable_field; +IPA.field_factories['sshkeys'] = IPA.sshkeys_field;
\ No newline at end of file diff --git a/install/ui/host.js b/install/ui/host.js index 299d147a0..f2b845290 100644 --- a/install/ui/host.js +++ b/install/ui/host.js @@ -63,7 +63,12 @@ IPA.host.entity = function(spec) { 'l', 'nshostlocation', 'nshardwareplatform', - 'nsosversion' + 'nsosversion', + { + type: 'sshkeys', + name: 'ipasshpubkey', + label: IPA.messages.objects.sshkeystore.keys + } ] }, { diff --git a/install/ui/ipa.css b/install/ui/ipa.css index 94ae1f778..992e44d0a 100644 --- a/install/ui/ipa.css +++ b/install/ui/ipa.css @@ -1251,11 +1251,11 @@ table.scrollable tbody { width: 250px; } -.multivalued-text-widget [name=value] { +.multivalued-widget [name=value] { margin-bottom: 1em; } -.multivalued-text-widget input { +.multivalued-widget input { width: 250px; } @@ -1487,6 +1487,11 @@ div.entity[name=hbactest] div.facet[name=run_test] .hbac-test-content { font-weight: normal; } +/* --- SSH key store --- */ + +span.sshkey-status, a.sshkey-set { + padding-right: 5px; +} /* --- Automember --- */ .automember-header { diff --git a/install/ui/test/data/host_mod.json b/install/ui/test/data/host_mod.json index 7a0b36c25..00ccf2d48 100644 --- a/install/ui/test/data/host_mod.json +++ b/install/ui/test/data/host_mod.json @@ -10,6 +10,7 @@ "enrolledby": "rsc", "fqdn": "rscwo", "ipaclientversion": "rscwo", + "ipasshpubkey": "rscwo", "ipauniqueid": "rsc", "krbcanonicalname": "rscwo", "krbextradata": "rscwo", diff --git a/install/ui/test/data/host_show.json b/install/ui/test/data/host_show.json index 6edb060a2..b66bc08c7 100644 --- a/install/ui/test/data/host_show.json +++ b/install/ui/test/data/host_show.json @@ -10,6 +10,7 @@ "enrolledby": "rsc", "fqdn": "rscwo", "ipaclientversion": "rscwo", + "ipasshpubkey": "rscwo", "ipauniqueid": "rsc", "krbcanonicalname": "rsc", "krbextradata": "rsc", diff --git a/install/ui/test/data/host_show_dev.example.com.json b/install/ui/test/data/host_show_dev.example.com.json index 5547160b7..abb377ab4 100644 --- a/install/ui/test/data/host_show_dev.example.com.json +++ b/install/ui/test/data/host_show_dev.example.com.json @@ -10,6 +10,7 @@ "enrolledby": "rsc", "fqdn": "rscwo", "ipaclientversion": "rscwo", + "ipasshpubkey": "rscwo", "ipauniqueid": "rsc", "krbcanonicalname": "rsc", "krbextradata": "rsc", diff --git a/install/ui/test/data/host_show_test.example.com.json b/install/ui/test/data/host_show_test.example.com.json index 6edb060a2..b66bc08c7 100644 --- a/install/ui/test/data/host_show_test.example.com.json +++ b/install/ui/test/data/host_show_test.example.com.json @@ -10,6 +10,7 @@ "enrolledby": "rsc", "fqdn": "rscwo", "ipaclientversion": "rscwo", + "ipasshpubkey": "rscwo", "ipauniqueid": "rsc", "krbcanonicalname": "rsc", "krbextradata": "rsc", diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json index 9c5abb803..b755c4628 100644 --- a/install/ui/test/data/ipa_init.json +++ b/install/ui/test/data/ipa_init.json @@ -59,6 +59,7 @@ "restore": "Restore", "retry": "Retry", "revoke": "Revoke", + "set": "Set", "update": "Update", "view": "View" }, @@ -318,6 +319,16 @@ "unprovision_title": "Unprovisioning ${entity}", "valid": "Kerberos Key Present, Service Provisioned" }, + "sshkeystore": { + "keys": "SSH public keys", + "set_dialog_help": "Base-64 encoded SSH public key:", + "set_dialog_title": "Set SSH key", + "show_set_key": "Show/Set key", + "status_mod_ns": "Modified: key not set", + "status_mod_s": "Modified", + "status_new_ns": "New: key not set", + "status_new_s": "New: key set" + }, "sudocmd": { "groups": "Groups" }, diff --git a/install/ui/test/data/user_details_refresh.json b/install/ui/test/data/user_details_refresh.json index 07001d20c..900008270 100644 --- a/install/ui/test/data/user_details_refresh.json +++ b/install/ui/test/data/user_details_refresh.json @@ -30,6 +30,7 @@ "inetuserstatus": "rscwo", "initials": "rscwo", "internationalisdnnumber": "rscwo", + "ipasshpubkey": "rscwo", "ipauniqueid": "rsc", "jpegphoto": "rscwo", "krbcanonicalname": "rscwo", @@ -107,6 +108,14 @@ "homedirectory": [ "/home/kfrog" ], + "ipasshpubkey": [ + { + "__base64__": "AAAAB3NzaC1kc3MAAACBAJQdBmxjnYdDzpGPzAD2kkoRwGbPIqVsu6mR0eyLjMJafQPbOkrgFpIwxAhb519FHAr0olSOklwq5Pvkm7rSpnoXDAEoVlW5jNCj33NrYkVJTAmtsa4ihZIqz7KJYkYifQyBxy8nYScAlEu1a1k9xfbRT8ZAmiCqgd6klWaKZXHBAAAAFQCd2wJW3Rb7kclRPbKaRF1hhdW+hwAAAIBr9ZozKls1lAkqMZuhGgnvlFg5J7DXKRY6iju1VfMc5HiY1mq197Qq2PVi4iQ1Ach3Pvj/MZGLhz/SyIsH59Uugl21KeQjk2HHt/ZLL1PrJvm9LmX3Fv2E8lQNnEyPaA2Ngf6O0bbzii41lp1F6wo3xQLJCLldljcG+wskRf5RrgAAAIAKTDWct9ES5BZADb3TfBAng2aeeojg6rDhS6i0WYPtna2hjCdRaCnnXM079JVcYBq3IK7mFpINnqnn252Mr9OqGsu/92gglfpTpXq2Lzkvd2dbcyTPQmNBM7+KFlUOZ4hWb4c5CVLBwILccL7QakwSHRYlRhCsDyKbI+2qPGwrXg==" + }, + { + "__base64__": "AAAAB3NzaC1yc2EAAAADAQABAAABAQCaoWIiTBqTqsWnAHFUfOUNY65sk2KuEp798ESyDWmOuJbjQNHG0grl8d5D9/OMuDvSHAthkTR4rXn1QAMm+Geh63XhS+nnEpzinPKloMWyF8wsNEw117TX2mA8wzeea1HDcqd0v4YKyU5FAHm+6hOALB9mrAnRZ4WoTY6NWtm3aoRge1D26pOuLRyNFB5Etwa7cmJqaK8EeHN0XNPIbaAP1JNVe46wyYvMlE/yhGYS9qW36OJpQBJGk9nYqHT3/6ai2w3TQ8k5puvAwBcCe0wYhBE9o8c5PmImIfa8lZ3Oo2gHIiOyA9gyHv3MBqUxXBC6PmmYHEr6y/wnYnfSHF+N" + } + ], "ipauniqueid": [ "a2854798-e7d811df-b69ad8ca-cb44a24c" ], @@ -162,6 +171,10 @@ "sn": [ "Frog" ], + "sshpubkeyfp": [ + "6E:70:C6:8E:88:2F:F1:5D:63:B4:C5:D1:B8:A6:D6:0C (ssh-dss)", + "93:23:CD:AE:50:0F:BF:0A:EB:2C:0C:1A:0B:18:DF:0A (ssh-rsa)" + ], "uid": [ "kfrog" ], diff --git a/install/ui/test/data/user_mod.json b/install/ui/test/data/user_mod.json index cf0bf63f7..4c7bfa479 100644 --- a/install/ui/test/data/user_mod.json +++ b/install/ui/test/data/user_mod.json @@ -27,6 +27,7 @@ "inetuserstatus": "rscwo", "initials": "rscwo", "internationalisdnnumber": "rscwo", + "ipasshpubkey": "rscwo", "ipauniqueid": "rsc", "jpegphoto": "rscwo", "krbcanonicalname": "rscwo", @@ -103,6 +104,14 @@ "homedirectory": [ "/home/kfrog" ], + "ipasshpubkey": [ + { + "__base64__": "AAAAB3NzaC1kc3MAAACBAJQdBmxjnYdDzpGPzAD2kkoRwGbPIqVsu6mR0eyLjMJafQPbOkrgFpIwxAhb519FHAr0olSOklwq5Pvkm7rSpnoXDAEoVlW5jNCj33NrYkVJTAmtsa4ihZIqz7KJYkYifQyBxy8nYScAlEu1a1k9xfbRT8ZAmiCqgd6klWaKZXHBAAAAFQCd2wJW3Rb7kclRPbKaRF1hhdW+hwAAAIBr9ZozKls1lAkqMZuhGgnvlFg5J7DXKRY6iju1VfMc5HiY1mq197Qq2PVi4iQ1Ach3Pvj/MZGLhz/SyIsH59Uugl21KeQjk2HHt/ZLL1PrJvm9LmX3Fv2E8lQNnEyPaA2Ngf6O0bbzii41lp1F6wo3xQLJCLldljcG+wskRf5RrgAAAIAKTDWct9ES5BZADb3TfBAng2aeeojg6rDhS6i0WYPtna2hjCdRaCnnXM079JVcYBq3IK7mFpINnqnn252Mr9OqGsu/92gglfpTpXq2Lzkvd2dbcyTPQmNBM7+KFlUOZ4hWb4c5CVLBwILccL7QakwSHRYlRhCsDyKbI+2qPGwrXg==" + }, + { + "__base64__": "AAAAB3NzaC1yc2EAAAADAQABAAABAQCaoWIiTBqTqsWnAHFUfOUNY65sk2KuEp798ESyDWmOuJbjQNHG0grl8d5D9/OMuDvSHAthkTR4rXn1QAMm+Geh63XhS+nnEpzinPKloMWyF8wsNEw117TX2mA8wzeea1HDcqd0v4YKyU5FAHm+6hOALB9mrAnRZ4WoTY6NWtm3aoRge1D26pOuLRyNFB5Etwa7cmJqaK8EeHN0XNPIbaAP1JNVe46wyYvMlE/yhGYS9qW36OJpQBJGk9nYqHT3/6ai2w3TQ8k5puvAwBcCe0wYhBE9o8c5PmImIfa8lZ3Oo2gHIiOyA9gyHv3MBqUxXBC6PmmYHEr6y/wnYnfSHF+N" + } + ], "ipauniqueid": [ "a2854798-e7d811df-b69ad8ca-cb44a24c" ], @@ -149,6 +158,10 @@ "sn": [ "Frog" ], + "sshpubkeyfp": [ + "6E:70:C6:8E:88:2F:F1:5D:63:B4:C5:D1:B8:A6:D6:0C (ssh-dss)", + "93:23:CD:AE:50:0F:BF:0A:EB:2C:0C:1A:0B:18:DF:0A (ssh-rsa)" + ], "uid": [ "kfrog" ], diff --git a/install/ui/test/data/user_show.json b/install/ui/test/data/user_show.json index 703c793bf..85f7ad2e0 100644 --- a/install/ui/test/data/user_show.json +++ b/install/ui/test/data/user_show.json @@ -27,6 +27,7 @@ "inetuserstatus": "rscwo", "initials": "rscwo", "internationalisdnnumber": "rscwo", + "ipasshpubkey": "rscwo", "ipauniqueid": "rsc", "jpegphoto": "rscwo", "krbcanonicalname": "rscwo", @@ -104,6 +105,14 @@ "homedirectory": [ "/home/kfrog" ], + "ipasshpubkey": [ + { + "__base64__": "AAAAB3NzaC1kc3MAAACBAJQdBmxjnYdDzpGPzAD2kkoRwGbPIqVsu6mR0eyLjMJafQPbOkrgFpIwxAhb519FHAr0olSOklwq5Pvkm7rSpnoXDAEoVlW5jNCj33NrYkVJTAmtsa4ihZIqz7KJYkYifQyBxy8nYScAlEu1a1k9xfbRT8ZAmiCqgd6klWaKZXHBAAAAFQCd2wJW3Rb7kclRPbKaRF1hhdW+hwAAAIBr9ZozKls1lAkqMZuhGgnvlFg5J7DXKRY6iju1VfMc5HiY1mq197Qq2PVi4iQ1Ach3Pvj/MZGLhz/SyIsH59Uugl21KeQjk2HHt/ZLL1PrJvm9LmX3Fv2E8lQNnEyPaA2Ngf6O0bbzii41lp1F6wo3xQLJCLldljcG+wskRf5RrgAAAIAKTDWct9ES5BZADb3TfBAng2aeeojg6rDhS6i0WYPtna2hjCdRaCnnXM079JVcYBq3IK7mFpINnqnn252Mr9OqGsu/92gglfpTpXq2Lzkvd2dbcyTPQmNBM7+KFlUOZ4hWb4c5CVLBwILccL7QakwSHRYlRhCsDyKbI+2qPGwrXg==" + }, + { + "__base64__": "AAAAB3NzaC1yc2EAAAADAQABAAABAQCaoWIiTBqTqsWnAHFUfOUNY65sk2KuEp798ESyDWmOuJbjQNHG0grl8d5D9/OMuDvSHAthkTR4rXn1QAMm+Geh63XhS+nnEpzinPKloMWyF8wsNEw117TX2mA8wzeea1HDcqd0v4YKyU5FAHm+6hOALB9mrAnRZ4WoTY6NWtm3aoRge1D26pOuLRyNFB5Etwa7cmJqaK8EeHN0XNPIbaAP1JNVe46wyYvMlE/yhGYS9qW36OJpQBJGk9nYqHT3/6ai2w3TQ8k5puvAwBcCe0wYhBE9o8c5PmImIfa8lZ3Oo2gHIiOyA9gyHv3MBqUxXBC6PmmYHEr6y/wnYnfSHF+N" + } + ], "ipauniqueid": [ "a2854798-e7d811df-b69ad8ca-cb44a24c" ], @@ -159,6 +168,10 @@ "sn": [ "Frog" ], + "sshpubkeyfp": [ + "6E:70:C6:8E:88:2F:F1:5D:63:B4:C5:D1:B8:A6:D6:0C (ssh-dss)", + "93:23:CD:AE:50:0F:BF:0A:EB:2C:0C:1A:0B:18:DF:0A (ssh-rsa)" + ], "uid": [ "kfrog" ], diff --git a/install/ui/test/widget_tests.js b/install/ui/test/widget_tests.js index 7dce99243..951f943a1 100644 --- a/install/ui/test/widget_tests.js +++ b/install/ui/test/widget_tests.js @@ -211,7 +211,7 @@ test("Testing text widget.", function() { }); test("Testing multi-valued text widget.", function() { - factory = IPA.multivalued_text_widget; + factory = IPA.multivalued_widget; spec = {undo:true,name:'title'}; base_widget_test('test_value'); widget_string_test(); diff --git a/install/ui/user.js b/install/ui/user.js index b1dd8a613..804848947 100644 --- a/install/ui/user.js +++ b/install/ui/user.js @@ -91,7 +91,12 @@ IPA.user.entity = function(spec) { 'uidnumber', 'gidnumber', 'loginshell', - 'homedirectory' + 'homedirectory', + { + type: 'sshkeys', + name: 'ipasshpubkey', + label: IPA.messages.objects.sshkeystore.keys + } ] }, { @@ -670,4 +675,4 @@ IPA.user_password_widget = function(spec) { return that; }; -IPA.register('user', IPA.user.entity); +IPA.register('user', IPA.user.entity);
\ No newline at end of file diff --git a/install/ui/widget.js b/install/ui/widget.js index 2617487f7..3201dad7a 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -308,7 +308,7 @@ IPA.password_widget = function(spec) { return that; }; -IPA.multivalued_text_widget = function(spec) { +IPA.multivalued_widget = function(spec) { spec = spec || {}; @@ -322,9 +322,12 @@ IPA.multivalued_text_widget = function(spec) { that.rows = []; that.on_child_value_changed = function(row) { - if(that.test_dirty_row(row)) { + if (that.test_dirty_row(row)) { row.widget.show_undo(); row.remove_link.hide(); + } else { + row.widget.hide_undo(); + row.remove_link.show(); } that.value_changed.notify([], that); @@ -473,7 +476,7 @@ IPA.multivalued_text_widget = function(spec) { that.create = function(container) { - container.addClass('multivalued-text-widget'); + container.addClass('multivalued-widget'); that.widget_create(container); @@ -2813,6 +2816,202 @@ IPA.widget_builder = function(spec) { return that; }; +IPA.sshkeys_widget = function(spec) { + + spec = spec || {}; + spec.widget_factory = IPA.sshkey_widget; + + var that = IPA.multivalued_widget(spec); + + that.test_dirty_row = function(row) { + + if(row.deleted || row.is_new) return true; + + var values = row.widget.save(); + + var key = values[0]; + var original_key = row.original_values[0]; + + if (original_key && original_key.key && original_key.key !== key) { + return true; + } + + return false; + }; + + return that; +}; + +IPA.sshkey_widget = function(spec) { + + spec = spec || {}; + + var that = IPA.input_widget(spec); + + that.key = null; + that.originally_set = false; + + that.create = function(container) { + + that.widget_create(container); + + container.addClass('text-widget'); + + that.status_label = $('<span />', { + 'class': 'sshkey-status', + text: '' + }).appendTo(container); + + that.link = $('<a/>', { + type: that.type, + 'class': 'sshkey-set', + name: that.name, + href: '#show-certificate', + title: that.tooltip, + text: IPA.messages.objects.sshkeystore.show_set_key, + onclick: function() { + that.open_edit_dialog(); + return false; + } + }).appendTo(container); + + if (that.undo) { + that.create_undo(container); + } + + that.create_error_link(container); + }; + + that.update = function(values) { + + var key = values && values.length ? values[0] : null; + + if (!key || key === '') { + key = {}; + } + + that.key = $.extend({}, key); + + if (that.key.key && that.key.key !== '' && + that.key.fingerprint && that.key.fingerprint !== '') { + that.originally_set = true; + that.original_key = that.key.key; + } + that.update_link(); + }; + + that.set_deleted = function(deleted) { + if (deleted) { + that.status_label.addClass('strikethrough'); + } else { + that.status_label.removeClass('strikethrough'); + } + }; + + that.save = function() { + var value = that.key.key; + value = value ? [value] : ['']; + return value; + }; + + that.update_link = function() { + var text = that.get_status(); + that.status_label.text(text); + }; + + that.get_status = function() { + + var text = ''; + var value = that.key.key; + + if (that.original_key) { + + if (value !== that.original_key) { + if (value === '') { + text = IPA.messages.objects.sshkeystore.status_mod_ns; + } else { + text = IPA.messages.objects.sshkeystore.status_mod_s; + } + } else { + text = that.key.fingerprint; + } + + } else { + + if (!value || value === '') { + text = IPA.messages.objects.sshkeystore.status_new_ns; + } else { + text = IPA.messages.objects.sshkeystore.status_new_s; + } + } + + return text; + }; + + that.set_user_value = function(value) { + + var previous = that.key.key; + that.key.key = value; + that.update_link(); + + if (value !== previous) { + that.value_changed.notify([], that); + } + }; + + that.open_edit_dialog = function() { + + var dialog = that.create_edit_dialog(); + dialog.open(); + }; + + that.create_edit_dialog = function() { + + var dialog = IPA.dialog({ + title: IPA.messages.objects.sshkeystore.set_dialog_title, + width: 500, + height: 380 + }); + + dialog.message = IPA.messages.objects.sshkeystore.set_dialog_help; + + dialog.create_button({ + name: 'update', + label: IPA.messages.buttons.set, + click: function() { + var value = dialog.textarea.val(); + that.set_user_value(value); + dialog.close(); + } + }); + + dialog.create_button({ + name: 'cancel', + label: IPA.messages.buttons.cancel, + click: function() { + dialog.close(); + } + }); + + dialog.create = function() { + + dialog.container.append(dialog.message); + + dialog.textarea = $('<textarea/>', { + 'class': 'certificate', + readonly: that.read_only + }).appendTo(dialog.container); + + var key = that.key.key || ''; + dialog.textarea.val(key); + }; + + return dialog; + }; + + return that; +}; + IPA.widget_factories['attribute_table'] = IPA.attribute_table_widget; IPA.widget_factories['checkbox'] = IPA.checkbox_widget; @@ -2825,9 +3024,10 @@ IPA.widget_factories['enable'] = IPA.enable_widget; IPA.widget_factories['entity_select'] = IPA.entity_select_widget; IPA.widget_factories['header'] = IPA.header_widget; IPA.widget_factories['link'] = IPA.link_widget; -IPA.widget_factories['multivalued'] = IPA.multivalued_text_widget; +IPA.widget_factories['multivalued'] = IPA.multivalued_widget; IPA.widget_factories['password'] = IPA.password_widget; IPA.widget_factories['radio'] = IPA.radio_widget; IPA.widget_factories['select'] = IPA.select_widget; +IPA.widget_factories['sshkeys'] = IPA.sshkeys_widget; IPA.widget_factories['textarea'] = IPA.textarea_widget; IPA.widget_factories['text'] = IPA.text_widget; |