add input fields for wikihomepage and forumsid

This commit is contained in:
Jan Dittberner 2010-06-12 00:02:17 +02:00
parent fe0291d59e
commit 4450a7ccfd
2 changed files with 46 additions and 13 deletions

View file

@ -117,6 +117,36 @@ ${h.form(h.url_for(action='urllist'), method='get')}
h.escape(request.params.get('username', None)), h.escape(request.params.get('username', None)),
id='aliothusername')}<br /> id='aliothusername')}<br />
</div> </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"> <div id="modefield">
<label for="mode_html">${_('Output format:')} <label for="mode_html">${_('Output format:')}
% if 'mode' in c.messages['errors']: % if 'mode' in c.messages['errors']:

View file

@ -21,15 +21,16 @@ License along with this program. If not, see
</%doc> </%doc>
var defaulthiddendivs = new Array( var defaulthiddendivs = new Array(
'#gpgfpfield'); '#namefield', '#gpgfpfield', '#usernamefield', '#nonddemailfield',
'#aliothusernamefield', '#wikihomepagefield', '#forumsidfield');
var defaultreadonlydivs = new Array( var defaultreadonlydivs = new Array(
'#gpgfpfield'); '#gpgfpfield');
var maskedfielddivs = new Array( var maskedfielddivs = new Array(
'#namefield', '#gpgfpfield', '#usernamefield', '#nonddemailfield', '#namefield', '#gpgfpfield', '#usernamefield', '#nonddemailfield',
'#aliothusernamefield'); '#aliothusernamefield', '#wikihomepagefield', '#forumsidfield');
var allfielddivs = new Array( var allfielddivs = new Array(
'#namefield', '#gpgfpfield', '#usernamefield', '#nonddemailfield', '#namefield', '#gpgfpfield', '#usernamefield', '#nonddemailfield',
'#aliothusernamefield'); '#aliothusernamefield', '#wikihomepagefield', '#forumsidfield');
function updateFields(data, textStatus) { function updateFields(data, textStatus) {
if (data.type == 2) { // DD if (data.type == 2) { // DD
@ -39,12 +40,15 @@ function updateFields(data, textStatus) {
'readonly', 'readonly'); 'readonly', 'readonly');
$('#nonddemail').attr('value', data.email).focus(); $('#nonddemail').attr('value', data.email).focus();
$('#aliothusername').attr('value', data.username); $('#aliothusername').attr('value', data.username);
$('#wikihomepage').attr('value', data.wikihomepage);
$('#namefield').show(); $('#namefield').show();
$('#gpgfpfield').show(); $('#gpgfpfield').show();
$('#usernamefield').show(); $('#usernamefield').show();
$('#nonddemailfield').show(); $('#nonddemailfield').show();
$('#aliothusernamefield').show(); $('#aliothusernamefield').show();
$('#wikihomepagefield').show();
$('#forumsidfield').show();
$('#nonddemail').focus().select(); $('#nonddemail').focus().select();
} else if (data.type == 1) { // DM } else if (data.type == 1) { // DM
@ -52,12 +56,15 @@ function updateFields(data, textStatus) {
$('#gpgfp').attr('value', data.gpgfp); $('#gpgfp').attr('value', data.gpgfp);
$('#username').attr('value', ''); $('#username').attr('value', '');
$('#nonddemail').attr('value', data.email).focus(); $('#nonddemail').attr('value', data.email).focus();
$('#wikihomepage').attr('value', data.wikihomepage);
$('#namefield').show(); $('#namefield').show();
$('#gpgfpfield').show(); $('#gpgfpfield').show();
$('#usernamefield').hide(); $('#usernamefield').hide();
$('#nonddemailfield').hide(); $('#nonddemailfield').hide();
$('#aliothusernamefield').show(); $('#aliothusernamefield').show();
$('#wikihomepagefield').show();
$('#forumsidfield').show();
$('#aliothusername').focus().select(); $('#aliothusername').focus().select();
} else { } else {
@ -71,6 +78,8 @@ function updateFields(data, textStatus) {
$('#nonddemailfield').hide(); $('#nonddemailfield').hide();
$('#namefield').show(); $('#namefield').show();
$('#aliothusernamefield').show(); $('#aliothusernamefield').show();
$('#wikihomepagefield').show();
$('#forumsidfield').show();
$('#name').focus().select(); $('#name').focus().select();
} }
@ -103,19 +112,13 @@ function onBlurEmail() {
} }
$(document).ready(function() { $(document).ready(function() {
var fields = new Array( for (var index in defaulthiddendivs) {
'#namefield', '#usernamefield', if (!$(defaulthiddendivs[index]).hasClass('witherrors')) {
'#nonddemailfield', '#aliothusernamefield'); $(defaulthiddendivs[index]).hide();
for (var index in fields) {
if (!$(fields[index]).hasClass('witherrors')) {
$(fields[index]).hide();
} }
} }
for (var index in defaulthiddendivs) {
$(defaulthiddendivs[index]).hide();
}
for (var index in defaultreadonlydivs) { for (var index in defaultreadonlydivs) {
$(defaultreadonlydivs[index]).hide(); $(defaultreadonlydivs[index]).attr('readonly', 'readonly');
} }
$('#showall').attr('checked', false).change(onChangeShowAll); $('#showall').attr('checked', false).change(onChangeShowAll);