Merge branch 'master' into pylons0.10

* master:
  remove default readonly field support
  updated translations
  populate wikihomepage in dddatabuilder.py
  add input fields for wikihomepage and forumsid
  update translations
  hide showall field for non ECMAScript clients
  add checkbox and ECMAScript code to toggle display of all fields
  enable GPG fingerprint entry with disabled ECMAScript
  handle empty email field onBlur event correctly
This commit is contained in:
Jan Dittberner 2010-06-12 00:24:44 +02:00
commit 47ecf9b4ea
6 changed files with 145 additions and 47 deletions

View file

@ -42,6 +42,10 @@ ${h.form(h.url(action='urllist', controller='ddportfolio'), method='get')}
${h.text('email',
h.escape(request.params.get('email', None), True), id='email')}<br />
</div>
<div id="showallfield" class="hidden">
${h.checkbox('showall', value='1', checked=False, id='showall')}
<label for="showall">${_(u'Show all form fields')}</label><br />
</div>
<div id="namefield" \
% if 'name' in c.messages['errors']:
class="witherrors" \
@ -56,7 +60,7 @@ ${h.form(h.url(action='urllist', controller='ddportfolio'), method='get')}
${h.text('name',
h.escape(request.params.get('name', None)), id='name')}<br />
</div>
<div id="gpgfpfield" class="hidden">
<div id="gpgfpfield">
<label for="gpgfp">${_('GPG fingerprint:')}
% if 'gpgfp' in c.messages['errors']:
<br />
@ -65,7 +69,7 @@ ${h.form(h.url(action='urllist', controller='ddportfolio'), method='get')}
</label><br />
${h.text('gpgfp',
h.escape(request.params.get('gpgfp', None)),
id='gpgfp', readonly='readonly')}<br />
id='gpgfp')}<br />
</div>
<div id="usernamefield" \
% if 'username' in c.messages['errors']:
@ -113,6 +117,36 @@ ${h.form(h.url(action='urllist', controller='ddportfolio'), method='get')}
h.escape(request.params.get('username', None)),
id='aliothusername')}<br />
</div>
<div id="wikihomepagefield" \
% if 'wikihomepage' in c.messages['errors']:
class="witherrors"
% endif
>
<label for="wikihomepage">${_('Wiki user name:')}
% if 'wikihomepage' in c.messages['errors']:
<br />
<span class="errormsg">${c.messages['errors']['wikihomepage'] | h}</span>
% endif
</label><br />
${h.text('wikihomepage',
h.escape(request.params.get('wikihomepage', None)),
id='wikihomepage')}<br />
</div>
<div id="forumsidfield" \
% if 'forumsid' in c.messages['errors']:
class="witherrors"
% endif
>
<label for="forumsid">${_('Forum user id:')}
% if 'forumsid' in c.messages['errors']:
<br />
<span class="errormsg">${c.messages['errors']['forumsid'] | h}</span>
% endif
</label><br />
${h.text('forumsid',
h.escape(request.params.get('forumsid', None)),
id='forumsid')}<br />
</div>
<div id="modefield">
<label for="mode_html">${_('Output format:')}
% if 'mode' in c.messages['errors']:

View file

@ -19,6 +19,17 @@ You should have received a copy of the GNU Affero General Public
License along with this program. If not, see
<http://www.gnu.org/licenses/>.
</%doc>\
var defaulthiddendivs = new Array(
'#namefield', '#gpgfpfield', '#usernamefield', '#nonddemailfield',
'#aliothusernamefield', '#wikihomepagefield', '#forumsidfield');
var maskedfielddivs = new Array(
'#namefield', '#gpgfpfield', '#usernamefield', '#nonddemailfield',
'#aliothusernamefield', '#wikihomepagefield', '#forumsidfield');
var allfielddivs = new Array(
'#namefield', '#gpgfpfield', '#usernamefield', '#nonddemailfield',
'#aliothusernamefield', '#wikihomepagefield', '#forumsidfield');
function updateFields(data, textStatus) {
if (data.type == 2) { // DD
$('#name').attr('value', data.name).attr('readonly', 'readonly');
@ -27,12 +38,15 @@ function updateFields(data, textStatus) {
'readonly', 'readonly');
$('#nonddemail').attr('value', data.email).focus();
$('#aliothusername').attr('value', data.username);
$('#wikihomepage').attr('value', data.wikihomepage);
$('#namefield').show();
$('#gpgfpfield').show();
$('#usernamefield').show();
$('#nonddemailfield').show();
$('#aliothusernamefield').show();
$('#wikihomepagefield').show();
$('#forumsidfield').show();
$('#nonddemail').focus().select();
} else if (data.type == 1) { // DM
@ -40,12 +54,15 @@ function updateFields(data, textStatus) {
$('#gpgfp').attr('value', data.gpgfp);
$('#username').attr('value', '');
$('#nonddemail').attr('value', data.email).focus();
$('#wikihomepage').attr('value', data.wikihomepage);
$('#namefield').show();
$('#gpgfpfield').show();
$('#usernamefield').hide();
$('#nonddemailfield').hide();
$('#aliothusernamefield').show();
$('#wikihomepagefield').show();
$('#forumsidfield').show();
$('#aliothusername').focus().select();
} else {
@ -59,32 +76,47 @@ function updateFields(data, textStatus) {
$('#nonddemailfield').hide();
$('#namefield').show();
$('#aliothusernamefield').show();
$('#wikihomepagefield').show();
$('#forumsidfield').show();
$('#name').focus().select();
}
}
function onBlurEmail() {
$.ajax({
'url' : '${h.url(controller="showformscripts", action="fetchdddata")}',
'data' : {'email' : $('#email').attr('value')},
'dataType' : 'json',
'success' : updateFields,
'error' : function(request, textStatus, errorThrown) {
$('#email').focus();
function onChangeShowAll(event) {
if ($('#showall').attr('checked')) {
for (var fielddiv in allfielddivs) {
$(allfielddivs[fielddiv]).show();
}
});
} else {
for (var fielddiv in maskedfielddivs) {
$(maskedfielddivs[fielddiv]).hide();
}
}
}
function onBlurEmail() {
if ($.trim($('#email').attr('value')).length > 0) {
$.ajax({
'url' : '${h.url_for(action='fetchdddata')}',
'data' : {'email' : $('#email').attr('value')},
'dataType' : 'json',
'success' : updateFields,
'error' : function(request, textStatus, errorThrown) {
$('#email').focus();
}
});
}
}
$(document).ready(function() {
var fields = new Array(
'#namefield', '#usernamefield',
'#nonddemailfield', '#aliothusernamefield');
for (var index in fields) {
if (!$(fields[index]).hasClass('witherrors')) {
$(fields[index]).hide();
for (var index in defaulthiddendivs) {
if (!$(defaulthiddendivs[index]).hasClass('witherrors')) {
$(defaulthiddendivs[index]).hide();
}
}
$('#showall').attr('checked', false).change(onChangeShowAll);
$('#showallfield').show();
$('#email').blur(onBlurEmail).focus();
});