Merge branch 'improve_ui'

* improve_ui:
  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:19:23 +02:00
commit 7d9e26c89b
6 changed files with 147 additions and 49 deletions

View file

@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ddportfolioservice 0.1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2010-06-04 00:25+0200\n"
"POT-Creation-Date: 2010-06-12 00:15+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -240,8 +240,8 @@ msgstr ""
msgid "Alioth user name"
msgstr ""
#: ddportfolioservice/model/urlbuilder.py:95
#: ddportfolioservice/model/urlbuilder.py:99
#: ddportfolioservice/model/urlbuilder.py:96
#: ddportfolioservice/model/urlbuilder.py:100
#, python-format
msgid "Missing input: %s"
msgstr ""
@ -263,11 +263,11 @@ msgid ""
"Developer's or package maintainer's information regarding Debian."
msgstr ""
#: ddportfolioservice/templates/base.mako:41
#: ddportfolioservice/templates/base.mako:46
msgid "AGPL - Free Software"
msgstr ""
#: ddportfolioservice/templates/base.mako:43
#: ddportfolioservice/templates/base.mako:48
#, python-format
msgid ""
"The service is available under the terms of the <a "
@ -278,7 +278,7 @@ msgid ""
"href=\"http://git.or.cz\">git</a>."
msgstr ""
#: ddportfolioservice/templates/base.mako:44
#: ddportfolioservice/templates/base.mako:49
msgid "Copyright © 2009, 2010 Jan Dittberner"
msgstr ""
@ -295,39 +295,51 @@ msgstr ""
msgid "Email address:"
msgstr ""
#: ddportfolioservice/templates/showform.mako:50
#: ddportfolioservice/templates/showform.mako:47
msgid "Show all form fields"
msgstr ""
#: ddportfolioservice/templates/showform.mako:54
msgid "Name:"
msgstr ""
#: ddportfolioservice/templates/showform.mako:60
#: ddportfolioservice/templates/showform.mako:64
msgid "GPG fingerprint:"
msgstr ""
#: ddportfolioservice/templates/showform.mako:75
#: ddportfolioservice/templates/showform.mako:79
msgid "Debian user name:"
msgstr ""
#: ddportfolioservice/templates/showform.mako:90
#: ddportfolioservice/templates/showform.mako:94
msgid "Non DD email address:"
msgstr ""
#: ddportfolioservice/templates/showform.mako:105
#: ddportfolioservice/templates/showform.mako:109
msgid "Alioth user name:"
msgstr ""
#: ddportfolioservice/templates/showform.mako:117
#: ddportfolioservice/templates/showform.mako:125
msgid "Wiki user name:"
msgstr ""
#: ddportfolioservice/templates/showform.mako:140
msgid "Forum user id:"
msgstr ""
#: ddportfolioservice/templates/showform.mako:151
msgid "Output format:"
msgstr ""
#: ddportfolioservice/templates/showform.mako:123
#: ddportfolioservice/templates/showform.mako:157
msgid "HTML"
msgstr ""
#: ddportfolioservice/templates/showform.mako:125
#: ddportfolioservice/templates/showform.mako:159
msgid "JSON"
msgstr ""
#: ddportfolioservice/templates/showform.mako:127
#: ddportfolioservice/templates/showform.mako:161
msgid "Build DD Portfolio URLs"
msgstr ""

View file

@ -9,7 +9,7 @@ msgstr ""
"Project-Id-Version: ddportfolioservice 0.1\n"
"Report-Msgid-Bugs-To: jan@dittberner.info\n"
"POT-Creation-Date: 2009-01-20 23:13+0100\n"
"PO-Revision-Date: 2010-06-04 00:27+0200\n"
"PO-Revision-Date: 2010-06-12 00:15+0200\n"
"Last-Translator: Jan Dittberner <jan@dittberner.info>\n"
"Language-Team: de <de@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
@ -214,10 +214,11 @@ msgstr "Besitz von debian.net-Domains"
msgid ""
"<a href=\"http://wiki.debian.org/qa.debian.org/MIATeam\">MIA</a> database"
" information"
msgstr "Informationen in der <a href=\"http://wiki.debian.org/qa.debian.org/MIATeam\">MIA</a>-Datenbank"
msgstr ""
"Informationen in der <a "
"href=\"http://wiki.debian.org/qa.debian.org/MIATeam\">MIA</a>-Datenbank"
#: ddportfolioservice/controllers/ddportfolio.py:107
#| msgid "Enter your personal information"
msgid "Group membership information"
msgstr "Information über Gruppenmitgliedschaften"
@ -253,8 +254,8 @@ msgstr "Nicht-DD E-Mailadresse:"
msgid "Alioth user name"
msgstr "Alioth-Benutzername"
#: ddportfolioservice/model/urlbuilder.py:95
#: ddportfolioservice/model/urlbuilder.py:99
#: ddportfolioservice/model/urlbuilder.py:96
#: ddportfolioservice/model/urlbuilder.py:100
#, python-format
msgid "Missing input: %s"
msgstr "Fehlende Eingabe: %s"
@ -281,11 +282,11 @@ msgstr ""
"Informationen im Bezug auf Debian für Debian-Entwickler und Paketbetreuer"
" erzeugt werden."
#: ddportfolioservice/templates/base.mako:41
#: ddportfolioservice/templates/base.mako:46
msgid "AGPL - Free Software"
msgstr "AGPL - Freie Software"
#: ddportfolioservice/templates/base.mako:43
#: ddportfolioservice/templates/base.mako:48
#, python-format
msgid ""
"The service is available under the terms of the <a "
@ -303,7 +304,7 @@ msgstr ""
"<a href=\"http://git.or.cz\">git</a> <a href=\"%s\">den Quelltext "
"herunterladen</a>."
#: ddportfolioservice/templates/base.mako:44
#: ddportfolioservice/templates/base.mako:49
msgid "Copyright © 2009, 2010 Jan Dittberner"
msgstr "Copyright © 2009, 2010 Jan Dittberner"
@ -320,39 +321,51 @@ msgstr "Debian-Entwicklerportfolio"
msgid "Email address:"
msgstr "E-Mailadresse:"
#: ddportfolioservice/templates/showform.mako:50
#: ddportfolioservice/templates/showform.mako:47
msgid "Show all form fields"
msgstr "Alle Formularfelder anzeigen"
#: ddportfolioservice/templates/showform.mako:54
msgid "Name:"
msgstr "Name:"
#: ddportfolioservice/templates/showform.mako:60
#: ddportfolioservice/templates/showform.mako:64
msgid "GPG fingerprint:"
msgstr "GPG-Fingerabdruck:"
#: ddportfolioservice/templates/showform.mako:75
#: ddportfolioservice/templates/showform.mako:79
msgid "Debian user name:"
msgstr "Debian-Benutzername:"
#: ddportfolioservice/templates/showform.mako:90
#: ddportfolioservice/templates/showform.mako:94
msgid "Non DD email address:"
msgstr "Nicht-DD-E-Mailadresse"
#: ddportfolioservice/templates/showform.mako:105
#: ddportfolioservice/templates/showform.mako:109
msgid "Alioth user name:"
msgstr "Alioth-Benutzername:"
#: ddportfolioservice/templates/showform.mako:117
#: ddportfolioservice/templates/showform.mako:125
msgid "Wiki user name:"
msgstr "Wiki-Benutzername:"
#: ddportfolioservice/templates/showform.mako:140
msgid "Forum user id:"
msgstr "Forumsbenutzernummer:"
#: ddportfolioservice/templates/showform.mako:151
msgid "Output format:"
msgstr "Ausgabeformat:"
#: ddportfolioservice/templates/showform.mako:123
#: ddportfolioservice/templates/showform.mako:157
msgid "HTML"
msgstr "HTML"
#: ddportfolioservice/templates/showform.mako:125
#: ddportfolioservice/templates/showform.mako:159
msgid "JSON"
msgstr "JSON"
#: ddportfolioservice/templates/showform.mako:127
#: ddportfolioservice/templates/showform.mako:161
msgid "Build DD Portfolio URLs"
msgstr "Debian-Entwicklerportfolio-URLs bauen"

View file

@ -22,12 +22,15 @@
#
"""This file contains code to build a representation of a person based
on keyring data associated to a given email address."""
import logging
from ddportfolioservice.model import keyfinder
TYPE_NO = 0
TYPE_DM = 1
TYPE_DD = 2
log = logging.getLogger(__name__)
def build_data(email_address):
"""Build a DD data structure from a given email address."""
@ -43,4 +46,9 @@ def build_data(email_address):
fields['type'] = TYPE_DM
else:
fields['type'] = TYPE_NO
if fields['name']:
log.debug('generate wikihomepage from name')
fields['wikihomepage'] = "".join(
[part.capitalize() for part in fields['name'].split()])
return fields

View file

@ -42,6 +42,10 @@ ${h.form(h.url_for(action='urllist'), 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_for(action='urllist'), 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_for(action='urllist'), 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_for(action='urllist'), 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

@ -20,6 +20,16 @@ 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');
@ -28,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
@ -41,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 {
@ -60,12 +76,27 @@ function updateFields(data, textStatus) {
$('#nonddemailfield').hide();
$('#namefield').show();
$('#aliothusernamefield').show();
$('#wikihomepagefield').show();
$('#forumsidfield').show();
$('#name').focus().select();
}
}
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')},
@ -75,17 +106,17 @@ function onBlurEmail() {
$('#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();
});