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

@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ddportfolioservice 0.2\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2010-06-04 00:32+0200\n"
"POT-Creation-Date: 2010-06-12 00:22+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 ""
"scm.com/\">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.2\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:34+0200\n"
"PO-Revision-Date: 2010-06-12 00:23+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"
@ -254,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"
@ -282,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 "
@ -304,7 +304,7 @@ msgstr ""
"<a href=\"http://git-scm.com\">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"
@ -321,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(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();
});