forked from mozilla/remo
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
719fc26
commit f045a7e
Showing
5 changed files
with
344 additions
and
288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { | ||
defaultHandlerOptions: { | ||
'single': true, | ||
'double': false, | ||
'pixelTolerance': 0, | ||
'stopSingle': false, | ||
'stopDouble': false | ||
}, | ||
|
||
initialize: function(options) { | ||
this.handlerOptions = OpenLayers.Util.extend( | ||
{}, this.defaultHandlerOptions | ||
); | ||
OpenLayers.Control.prototype.initialize.apply( | ||
this, arguments | ||
); | ||
this.handler = new OpenLayers.Handler.Click( | ||
this, { | ||
'click': this.trigger | ||
}, this.handlerOptions | ||
); | ||
}, | ||
|
||
trigger: function(e) { | ||
var lonlat = map.getLonLatFromViewPortPx(e.xy); | ||
$('input.point-lat-temp').val(Math.round(((lonlat.lat/100000)*1000000))/1000000); | ||
$('input.point-long-temp').val(Math.round(((lonlat.lon/100000)*1000000))/1000000); | ||
} | ||
|
||
}); | ||
var map; | ||
|
||
map = new OpenLayers.Map('map'); | ||
|
||
var osm = new OpenLayers.Layer.OSM(); | ||
|
||
map.addLayers([osm]); | ||
|
||
map.zoomToMaxExtent(); | ||
|
||
var click = new OpenLayers.Control.Click(); | ||
map.addControl(click); | ||
click.activate(); | ||
|
||
//Clicking "Use those" closes the modal and updates the hidden input fields | ||
$('.use-those').click(function() { | ||
$('input.point-lat').val($('input.point-lat-temp').val()); | ||
$('input.point-long').val($('input.point-long-temp').val()); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
COUNTRIES = [ | ||
"Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", | ||
"Anguilla", "Antigua & Barbuda", "Argentina", "Armenia", "Aruba", | ||
"Australia", | ||
"Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", | ||
"Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", | ||
"Bolivia", "Bonaire", "Bosnia & Herzegovina", "Botswana", "Brazil", | ||
"British Indian Ocean Ter", | ||
"Brunei", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", | ||
"Canada", "Canary Islands", "Cape Verde", "Cayman Islands", | ||
"Central African Republic", "Chad", | ||
"Channel Islands", "Chile", "China", "Christmas Island", "Cocos Island", | ||
"Colombia", | ||
"Comoros", "Congo", "Cook Islands", "Costa Rica", "Cote D'Ivoire", | ||
"Croatia", | ||
"Cuba", "Curacao", "Cyprus", "Czech Republic", "Denmark", "Djibouti", | ||
"Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", | ||
"El Salvador", | ||
"Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands", | ||
"Faroe Islands", | ||
"Fiji", "Finland", "France", "French Guiana", "French Polynesia", | ||
"French Southern Ter", | ||
"Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", | ||
"Great Britain", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", | ||
"Guatemala", "Guinea", "Guyana", "Haiti", "Hawaii", "Honduras", | ||
"Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran", | ||
"Iraq", "Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", | ||
"Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea North", | ||
"Korea South", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", | ||
"Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", | ||
"Macau", "Macedonia", "Madagascar", "Malaysia", "Malawi", "Maldives", | ||
"Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", | ||
"Mauritius", | ||
"Mayotte", "Mexico", "Midway Islands", "Moldova", "Monaco", "Mongolia", | ||
"Montserrat", "Morocco", "Mozambique", "Myanmar", "Nambia", "Nauru", | ||
"Nepal", "Netherland Antilles", "Netherlands (Holland, Europe)", "Nevis", | ||
"New Caledonia", "New Zealand", | ||
"Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Norway", | ||
"Oman", "Pakistan", "Palau Island", "Palestine", "Panama", | ||
"Papua New Guinea", | ||
"Paraguay", "Peru", "Philippines", "Pitcairn Island", "Poland", "Portugal", | ||
"Puerto Rico", "Qatar", "Republic of Montenegro", "Republic of Serbia", | ||
"Reunion", "Romania", | ||
"Russia", "Rwanda", "St Barthelemy", "St Eustatius", "St Helena", | ||
"St Kitts-Nevis", | ||
"St Lucia", "St Maarten", "St Pierre & Miquelon", | ||
"St Vincent & Grenadines", | ||
"Saipan", "Samoa", | ||
"Samoa American", "San Marino", "Sao Tome & Principe", "Saudi Arabia", | ||
"Senegal", "Seychelles", | ||
"Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", | ||
"Somalia", | ||
"South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", | ||
"Sweden", "Switzerland", "Syria", "Tahiti", "Taiwan", "Tajikistan", | ||
"Tanzania", "Thailand", "Togo", "Tokelau", "Tonga", "Trinidad & Tobago", | ||
"Tunisia", "Turkey", "Turkmenistan", "Turks & Caicos Is", "Tuvalu", | ||
"Uganda", | ||
"Ukraine", "United Arab Emirates", "United Kingdom", | ||
"United States of America", "Uruguay", "Uzbekistan", | ||
"Vanuatu", "Vatican City State", "Venezuela", "Vietnam", | ||
"Virgin Islands (Brit)", "Virgin Islands (USA)", | ||
"Wake Island", "Wallis & Futana Is", "Yemen", "Zaire", "Zambia", "Zimbabwe" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,50 @@ | ||
import re | ||
|
||
from django import forms | ||
from django.contrib.auth.models import User | ||
from django.core.exceptions import ValidationError | ||
|
||
from remo.profiles.models import UserProfile | ||
|
||
class InviteUserForm(forms.Form): | ||
email = forms.EmailField(label='Email') | ||
|
||
|
||
class ChangeUserForm(forms.ModelForm): | ||
class Meta: | ||
model = User | ||
fields = ('first_name', 'last_name', 'email') | ||
|
||
|
||
def clean_first_name(self): | ||
data = self.cleaned_data['first_name'] | ||
print data | ||
if not re.match(r'(^[A-Za-z\' ]+$)', data): | ||
raise ValidationError("Please use only latin characters.") | ||
|
||
return data | ||
|
||
def clean_last_name(self): | ||
data = self.cleaned_data['last_name'] | ||
if not re.match(r'(^[A-Za-z\' ]+)$', data): | ||
raise ValidationError("Please use only latin characters.") | ||
|
||
return data | ||
|
||
|
||
class ChangeProfileForm(forms.ModelForm): | ||
class Meta: | ||
model = UserProfile | ||
fields = ('local_name', 'birth_date', | ||
'city', 'region', 'country', | ||
'lon', 'lat', 'display_name', | ||
'private_email', 'mozillians_profile_url', | ||
'twitter_account', 'jabber_id', 'irc_name', | ||
'irc_channels', 'facebook_url', 'diaspora_url', | ||
'personal_website_url', 'personal_blog_feed', | ||
'bio', 'gender', 'mentor') | ||
|
||
|
||
def clean_twitter_account(self): | ||
twitter_account = self.cleaned_data['twitter_account'] | ||
return twitter_account.strip('@') |
Oops, something went wrong.