summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2011-06-20 21:20:13 -0400
committerAdam Young <ayoung@redhat.com>2011-06-27 16:33:35 -0400
commitd2d5278c52650cb90f1d77ac748f0a73f401bf5a (patch)
treeeb78ade2f4e74517bb5f377fec80fb35fba02f0e
parent3aa371b30182ae2c0c2e824e9532ec1a7e9ce980 (diff)
downloadfreeipa-d2d5278c52650cb90f1d77ac748f0a73f401bf5a.zip
freeipa-d2d5278c52650cb90f1d77ac748f0a73f401bf5a.tar.gz
freeipa-d2d5278c52650cb90f1d77ac748f0a73f401bf5a.tar.xz
optional uid
Make the uid field optional
-rw-r--r--install/ui/dialog.js19
-rw-r--r--install/ui/test/data/ipa_init.json1
-rw-r--r--install/ui/user.js9
-rw-r--r--ipalib/plugins/internal.py1
4 files changed, 29 insertions, 1 deletions
diff --git a/install/ui/dialog.js b/install/ui/dialog.js
index efbf84e..f4aa718 100644
--- a/install/ui/dialog.js
+++ b/install/ui/dialog.js
@@ -188,6 +188,23 @@ IPA.dialog = function(spec) {
var span = $('<span/>', { 'name': field.name }).appendTo(td);
field.create(span);
+ field.field_span = span;
+
+ if (field.optional){
+ span.css('display','none');
+ td.append(
+ $('<a/>',{
+ text: IPA.messages.widget.optional,
+ href:'',
+ click: function(){
+ var span = $(this).prev();
+ span.css('display','inline');
+ $(this).css('display','none');
+ return false;
+ }
+ }));
+ }
+
}
var sections = that.sections.values;
@@ -327,6 +344,8 @@ IPA.dialog = function(spec) {
var factory = field_spec.factory || IPA.text_widget;
field = factory(field_spec);
+ field.optional = field_spec.optional || false;
+
/* This is a bit of a hack, and is here to support ACI
permissions. The target section is a group of several
widgets together. It makes more sense to do them as a
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 9142403..47ae571 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -15609,6 +15609,7 @@
"sudo": "Sudo"
},
"widget": {
+ "optional": "Optional field: click to show",
"validation_error": "Text does not match field pattern"
}
}
diff --git a/install/ui/user.js b/install/ui/user.js
index 0a13a54..ce925d8 100644
--- a/install/ui/user.js
+++ b/install/ui/user.js
@@ -119,7 +119,14 @@ IPA.entity_factories.user = function() {
link: link
}).
adder_dialog({
- fields: ['uid', 'givenname', 'sn']
+ fields: [
+ {
+ factory : IPA.text_widget,
+ undo: false,
+ optional: true,
+ name:'uid'
+ },
+ 'givenname', 'sn']
});
return builder.build();
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index 06f07db..5dde073 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -365,6 +365,7 @@ class i18n_messages(Command):
"remove":_("Remove ${other_entity} from ${entity} ${primary_key}"),
},
"widget":{
+ "optional":_("Optional field: click to show"),
"validation_error":_("Text does not match field pattern"),
},
"ajax":{