Index: help_controls.js =================================================================== --- help_controls.js (Revision 14857) +++ help_controls.js (Arbeitskopie) @@ -164,3 +164,109 @@ } } +/** + * Take the value of the calling input control + * and set default values to related fields: + * address + * `-> username + * `-> realname + * `-> (if present) firstname, lastname + */ +function split_name(that) { + var raw = that.value + var val = trim(raw) + if (val == '') { + return + } + var username='' + var realname='' + var address='' + switch (that.name) { + case 'address': + address=val + break + case 'username': + username=val + break + case 'realname': + realname=val + break + default: + alert('Ooops - unknown name field '+that.name+'!') + return + } + var the_form = document.itemSynopsis; + switch (that.name) { + case 'address': + var split1 = address.split('@') + if (change_field('username')) { + username = split1[0] + the_form.username.value = username + } + if (change_field('organisation')) { + the_form.organisation.value = default_organisation(split1[1]) + } + case 'username': + if (change_field('realname')) { + realname = Cap(username.split('.').join(' ')) + the_form.realname.value = realname + } + case 'realname': + if (change_field('username')) { + username = Cap(realname.split(' ').join('.')) + the_form.username.value = username + } + if (the_form.firstname && the_form.lastname) { + var split2 = realname.split(' ') + var firstname='', lastname='' + firstname = split2[0] + lastname = split2.slice(1).join(' ') + if (change_field('firstname')) { + the_form.firstname.value = firstname + } + if (change_field('lastname')) { + the_form.lastname.value = lastname + } + } + } +} + +function change_field(name) { + var field = document.itemSynopsis[name] + return ! (field.value || field.readonly) +} + +function Cap(str) { + var liz = str.split(' ') + for (var i=0; i Editing + +

You are not @@ -30,29 +32,36 @@

-
+ tal:define="required python:'username address'.split(); + th_label templates/page/macros/th_label" + tal:attributes="action context/designator; + onSubmit python:'return checkRequiredFields(\'%s\')'%'\',\''.join(required)"> - - - + + + - - - + + + - - + + + - - + + - - + + + + - - + + + - - + + - - + + - - + + - + @@ -96,9 +106,13 @@ - +
Namerealname
Namerealname
Login Nameusername
Login Nameusername
Login Password
Login Password password
Confirm Password
Confirm Password password
Roles
Roles @@ -62,16 +71,17 @@ enter a comma,separated,list)
Phone
Phone phone
Organisation
Organisation organisation
Timezone
Timezone (this is a numeric hour offset, the default is @@ -79,15 +89,15 @@ />)
E-mail address
E-mail address + />
Alternate E-mail addresses
One address per line
alternate_addresses
  - + submit button here + + +