Merge branch 'master' into openstreetbugs2

This commit is contained in:
Kai Krueger 2011-04-19 22:00:30 -06:00
commit 001ff5764b
586 changed files with 17972 additions and 1261 deletions

View file

@ -46,7 +46,7 @@ class ApiController < ApplicationController
root = XML::Node.new 'gpx'
root['version'] = '1.0'
root['creator'] = 'OpenStreetMap.org'
root['xmlns'] = "http://www.topografix.com/GPX/1/0/"
root['xmlns'] = "http://www.topografix.com/GPX/1/0"
doc.root = root

View file

@ -15,6 +15,16 @@ class ApplicationController < ActionController::Base
session_expires_automatically
redirect_to :controller => "user", :action => "suspended"
# don't allow access to any auth-requiring part of the site unless
# the new CTs have been seen (and accept/decline chosen).
elsif !@user.terms_seen and flash[:showing_terms].nil?
flash[:notice] = t 'user.terms.you need to accept or decline'
if params[:referer]
redirect_to :controller => "user", :action => "terms", :referer => params[:referer]
else
redirect_to :controller => "user", :action => "terms", :referer => request.request_uri
end
end
elsif session[:token]
@user = User.authenticate(:token => session[:token])
@ -99,10 +109,21 @@ class ApplicationController < ActionController::Base
end
end
# check if the user has been banned
unless @user.nil? or @user.active_blocks.empty?
# NOTE: need slightly more helpful message than this.
render :text => t('application.setup_user_auth.blocked'), :status => :forbidden
# have we identified the user?
if @user
# check if the user has been banned
if not @user.active_blocks.empty?
# NOTE: need slightly more helpful message than this.
report_error t('application.setup_user_auth.blocked'), :forbidden
end
# if the user hasn't seen the contributor terms then don't
# allow editing - they have to go to the web site and see
# (but can decline) the CTs to continue.
if REQUIRE_TERMS_SEEN and not @user.terms_seen
set_locale
report_error t('application.setup_user_auth.need_to_see_terms'), :forbidden
end
end
end
@ -134,8 +155,7 @@ class ApplicationController < ActionController::Base
def check_api_readable
if STATUS == :database_offline or STATUS == :api_offline
response.headers['Error'] = "Database offline for maintenance"
render :nothing => true, :status => :service_unavailable
report_error "Database offline for maintenance", :service_unavailable
return false
end
end
@ -143,16 +163,14 @@ class ApplicationController < ActionController::Base
def check_api_writable
if STATUS == :database_offline or STATUS == :database_readonly or
STATUS == :api_offline or STATUS == :api_readonly
response.headers['Error'] = "Database offline for maintenance"
render :nothing => true, :status => :service_unavailable
report_error "Database offline for maintenance", :service_unavailable
return false
end
end
def require_public_data
unless @user.data_public?
response.headers['Error'] = "You must make your edits public to upload new data"
render :nothing => true, :status => :forbidden
report_error "You must make your edits public to upload new data", :forbidden
return false
end
end
@ -165,7 +183,18 @@ class ApplicationController < ActionController::Base
def report_error(message, status = :bad_request)
# Todo: some sort of escaping of problem characters in the message
response.headers['Error'] = message
render :text => message, :status => status
if request.headers['X-Error-Format'] and
request.headers['X-Error-Format'].downcase == "xml"
result = OSM::API.new.get_xml_doc
result.root.name = "osmError"
result.root << (XML::Node.new("status") << interpret_status(status))
result.root << (XML::Node.new("message") << message)
render :text => result.to_s, :content_type => "text/xml"
else
render :text => message, :status => status
end
end
def set_locale
@ -181,6 +210,24 @@ class ApplicationController < ActionController::Base
end
end
if request.compatible_language_from(I18n.available_locales).nil?
request.user_preferred_languages = request.user_preferred_languages.collect do |pl|
pls = [ pl ]
while pl.match(/^(.*)-[^-]+$/)
pls.push($1) if I18n.available_locales.include?($1.to_sym)
pl = $1
end
pls
end.flatten
if @user and not request.compatible_language_from(I18n.available_locales).nil?
@user.languages = request.user_preferred_languages
@user.save
end
end
I18n.locale = request.compatible_language_from(I18n.available_locales)
response.headers['Content-Language'] = I18n.locale.to_s

View file

@ -72,8 +72,10 @@ class BrowseController < ApplicationController
@next = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id", { :id => @changeset.id }] )
@prev = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id", { :id => @changeset.id }] )
@next_by_user = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id AND user_id = :user_id", {:id => @changeset.id, :user_id => @changeset.user_id }] )
@prev_by_user = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id AND user_id = :user_id", {:id => @changeset.id, :user_id => @changeset.user_id }] )
if @changeset.user.data_public?
@next_by_user = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id AND user_id = :user_id", { :id => @changeset.id, :user_id => @changeset.user_id }] )
@prev_by_user = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id AND user_id = :user_id", { :id => @changeset.id, :user_id => @changeset.user_id }] )
end
rescue ActiveRecord::RecordNotFound
render :action => "not_found", :status => :not_found
end

View file

@ -436,7 +436,7 @@ private
# query changesets which are closed
# ('closed at' time has passed or changes limit is hit)
def conditions_closed(closed)
return closed.nil? ? nil : ['closed_at < ? or num_changes > ?',
return closed.nil? ? nil : ['(closed_at < ? or num_changes > ?)',
Time.now.getutc, Changeset::MAX_ELEMENTS]
end

View file

@ -234,7 +234,7 @@ class GeocoderController < ApplicationController
end
# ask nominatim
response = fetch_xml("http://nominatim.openstreetmap.org/search?format=xml&q=#{escape_query(query)}#{viewbox}#{exclude}&accept-language=#{request.user_preferred_languages.join(',')}")
response = fetch_xml("#{NOMINATIM_URL}search?format=xml&q=#{escape_query(query)}#{viewbox}#{exclude}&accept-language=#{request.user_preferred_languages.join(',')}")
# create result array
@results = Array.new
@ -355,7 +355,7 @@ class GeocoderController < ApplicationController
@results = Array.new
# ask OSM namefinder
response = fetch_xml("http://nominatim.openstreetmap.org/reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{request.user_preferred_languages.join(',')}")
response = fetch_xml("#{NOMINATIM_URL}reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{request.user_preferred_languages.join(',')}")
# parse the response
response.elements.each("reversegeocode/result") do |result|

View file

@ -1,5 +1,5 @@
class OauthController < ApplicationController
layout 'site'
layout 'slim'
before_filter :authorize_web, :only => [:oauthorize, :revoke]
before_filter :set_locale, :only => [:oauthorize, :revoke]

View file

@ -30,4 +30,41 @@ class SiteController < ApplicationController
def key
expires_in 7.days, :public => true
end
def edit
editor = params[:editor] || @user.preferred_editor || DEFAULT_EDITOR
if editor == "remote"
render :action => :index
else
# Decide on a lat lon to initialise potlatch with. Various ways of doing this
if params['lon'] and params['lat']
@lon = params['lon'].to_f
@lat = params['lat'].to_f
@zoom = params['zoom'].to_i
elsif params['mlon'] and params['mlat']
@lon = params['mlon'].to_f
@lat = params['mlat'].to_f
@zoom = params['zoom'].to_i
elsif params['gpx']
@lon = Trace.find(params['gpx']).longitude
@lat = Trace.find(params['gpx']).latitude
elsif cookies.key?("_osm_location")
@lon, @lat, @zoom, layers = cookies["_osm_location"].split("|")
elsif @user and !@user.home_lon.nil? and !@user.home_lat.nil?
@lon = @user.home_lon
@lat = @user.home_lat
else
#catch all. Do nothing. lat=nil, lon=nil
#Currently this results in potlatch starting up at 0,0 (Atlantic ocean).
end
@zoom = '14' if @zoom.nil?
end
end
end

View file

@ -1,6 +1,7 @@
class UserController < ApplicationController
layout 'site', :except => :api_details
layout :choose_layout
before_filter :disable_terms_redirect, :only => [:terms, :save, :logout]
before_filter :authorize, :only => [:api_details, :api_gpx_files]
before_filter :authorize_web, :except => [:api_details, :api_gpx_files]
before_filter :set_locale, :except => [:api_details, :api_gpx_files]
@ -24,7 +25,7 @@ class UserController < ApplicationController
if request.xhr?
render :update do |page|
page.replace_html "contributorTerms", :partial => "terms", :locals => { :has_decline => params[:has_decline] }
page.replace_html "contributorTerms", :partial => "terms"
end
else
@title = t 'user.terms.title'
@ -53,17 +54,36 @@ class UserController < ApplicationController
if Acl.find_by_address(request.remote_ip, :conditions => {:k => "no_account_creation"})
render :action => 'new'
elsif params[:decline]
redirect_to t('user.terms.declined')
if @user
@user.terms_seen = true
if @user.save
flash[:notice] = t 'user.new.terms declined', :url => t('user.new.terms declined url')
end
if params[:referer]
redirect_to params[:referer]
else
redirect_to :action => :account, :display_name => @user.display_name
end
else
redirect_to t('user.terms.declined')
end
elsif @user
if !@user.terms_agreed?
@user.consider_pd = params[:user][:consider_pd]
@user.terms_agreed = Time.now.getutc
@user.terms_seen = true
if @user.save
flash[:notice] = t 'user.new.terms accepted'
end
end
redirect_to :action => :account, :display_name => @user.display_name
if params[:referer]
redirect_to params[:referer]
else
redirect_to :action => :account, :display_name => @user.display_name
end
else
@user = User.new(params[:user])
@ -73,13 +93,15 @@ class UserController < ApplicationController
@user.creation_ip = request.remote_ip
@user.languages = request.user_preferred_languages
@user.terms_agreed = Time.now.getutc
@user.terms_seen = true
if @user.save
flash[:notice] = t 'user.new.flash create success message', :email => @user.email
Notifier.deliver_signup_confirm(@user, @user.tokens.create(:referer => params[:referer]))
redirect_to :action => 'login'
session[:token] = @user.tokens.create.token
redirect_to :action => 'login', :referer => params[:referer]
else
render :action => 'new'
render :action => 'new', :referer => params[:referer]
end
end
end
@ -108,6 +130,12 @@ class UserController < ApplicationController
@user.home_lat = params[:user][:home_lat]
@user.home_lon = params[:user][:home_lon]
if params[:user][:preferred_editor] == "default"
@user.preferred_editor = nil
else
@user.preferred_editor = params[:user][:preferred_editor]
end
if @user.save
set_locale
@ -207,15 +235,20 @@ class UserController < ApplicationController
session[:user] = user.id
session_expires_after 1.month if params[:remember_me]
# The user is logged in, if the referer param exists, redirect
# them to that unless they've also got a block on them, in
# which case redirect them to the block so they can clear it.
if user.blocked_on_view
redirect_to user.blocked_on_view, :referer => params[:referer]
elsif params[:referer]
redirect_to params[:referer]
target = params[:referer] || url_for(:controller => :site, :action => :index)
# The user is logged in, so decide where to send them:
#
# - If they haven't seen the contributor terms, send them there.
# - If they have a block on them, show them that.
# - If they were referred to the login, send them back there.
# - Otherwise, send them to the home page.
if REQUIRE_TERMS_SEEN and not user.terms_seen
redirect_to :controller => :user, :action => :terms, :referer => target
elsif user.blocked_on_view
redirect_to user.blocked_on_view, :referer => target
else
redirect_to :controller => 'site', :action => 'index'
redirect_to target
end
elsif user = User.authenticate(:username => email_or_display_name, :password => pass, :pending => true)
flash.now[:error] = t 'user.login.account not active', :reconfirm => url_for(:action => 'confirm_resend', :display_name => user.display_name)
@ -264,14 +297,29 @@ class UserController < ApplicationController
user.save!
referer = token.referer
token.destroy
session[:user] = user.id
unless referer.nil?
flash[:notice] = t('user.confirm.success')
redirect_to referer
if session[:token]
token = UserToken.find_by_token(session[:token])
session.delete(:token)
else
flash[:notice] = t('user.confirm.success') + "<br /><br />" + t('user.confirm.before you start')
redirect_to :action => 'account', :display_name => user.display_name
token = nil
end
if token.nil? or token.user != user
flash[:notice] = t('user.confirm.success')
redirect_to :action => :login, :referer => referer
else
token.destroy
session[:user] = user.id
if referer.nil?
flash[:notice] = t('user.confirm.success') + "<br /><br />" + t('user.confirm.before you start')
redirect_to :action => :account, :display_name => user.display_name
else
flash[:notice] = t('user.confirm.success')
redirect_to referer
end
end
end
else
@ -452,4 +500,28 @@ private
rescue ActiveRecord::RecordNotFound
redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name] unless @this_user
end
##
# Choose the layout to use. See
# https://rails.lighthouseapp.com/projects/8994/tickets/5371-layout-with-onlyexcept-options-makes-other-actions-render-without-layouts
def choose_layout
oauth_url = url_for(:controller => :oauth, :action => :oauthorize, :only_path => true)
if [ 'api_details' ].include? action_name
nil
elsif params[:referer] and URI.parse(params[:referer]).path == oauth_url
'slim'
else
'site'
end
end
##
#
def disable_terms_redirect
# this is necessary otherwise going to the user terms page, when
# having not agreed already would cause an infinite redirect loop.
# it's .now so that this doesn't propagate to other pages.
flash.now[:showing_terms] = true
end
end

View file

@ -119,6 +119,16 @@ module ApplicationHelper
end
end
def preferred_editor
if params[:editor]
params[:editor]
elsif @user and @user.preferred_editor
@user.preferred_editor
else
DEFAULT_EDITOR
end
end
private
def javascript_strings_for_key(key)

View file

@ -2,6 +2,7 @@ require 'oauth'
class ClientApplication < ActiveRecord::Base
belongs_to :user
has_many :tokens, :class_name => "OauthToken"
has_many :access_tokens
validates_presence_of :name, :url, :key, :secret
validates_uniqueness_of :key
before_validation_on_create :generate_keys
@ -53,6 +54,20 @@ class ClientApplication < ActiveRecord::Base
RequestToken.create :client_application => self, :callback_url => self.token_callback_url
end
def access_token_for_user(user)
unless token = access_tokens.find(:first, :conditions => { :user_id => user.id, :invalidated_at => nil })
params = { :user => user }
permissions.each do |p|
params[p] = true
end
token = access_tokens.create(params)
end
token
end
# the permissions that this client would like from the user
def permissions
ClientApplication.all_permissions.select { |p| self[p] }

View file

@ -10,7 +10,7 @@ class User < ActiveRecord::Base
has_many :friends, :include => :befriendee, :conditions => "users.status IN ('active', 'confirmed')"
has_many :tokens, :class_name => "UserToken"
has_many :preferences, :class_name => "UserPreference"
has_many :changesets
has_many :changesets, :order => 'created_at DESC'
has_many :client_applications
has_many :oauth_tokens, :class_name => "OauthToken", :order => "authorized_at desc", :include => [:client_application]
@ -33,6 +33,7 @@ class User < ActiveRecord::Base
validates_numericality_of :home_lat, :allow_nil => true
validates_numericality_of :home_lon, :allow_nil => true
validates_numericality_of :home_zoom, :only_integer => true, :allow_nil => true
validates_inclusion_of :preferred_editor, :in => Editors::ALL_EDITORS, :allow_nil => true
before_save :encrypt_password
@ -106,7 +107,7 @@ class User < ActiveRecord::Base
(languages & array.collect { |i| i.to_s }).first
end
def nearby(radius = 50, num = 10)
def nearby(radius = NEARBY_RADIUS, num = NEARBY_USERS)
if self.home_lon and self.home_lat
gc = OSM::GreatCircle.new(self.home_lat, self.home_lon)
bounds = gc.bounds(radius)
@ -202,4 +203,10 @@ class User < ActiveRecord::Base
return score.to_i
end
##
# return an oauth access token for a specified application
def access_token(application_key)
return ClientApplication.find_by_key(application_key).access_token_for_user(self)
end
end

View file

@ -84,7 +84,7 @@
<td>
<table cellpadding="0">
<% @relations.each do |relation| %>
<tr><td><%= link_to h(printable_name(relation, true)), { :action => "relation", :id => relation.id.to_s }, :class => "relation " %></td></tr>
<tr><td><%= link_to h(printable_name(relation, true)), { :action => "relation", :id => relation.id.to_s }, :class => link_class('relation', relation), :title => link_title(relation) %></td></tr>
<% end %>
</table>
</td>

View file

@ -2,7 +2,7 @@
<%= javascript_include_tag '/openlayers/OpenStreetMap.js' %>
<%= javascript_include_tag 'map.js' %>
<div id="browse_map">
<% if map.instance_of? Changeset or map.visible %>
<% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible %>
<div id="small_map">
</div>
<span id="loading"><%= t 'browse.map.loading' %></span>
@ -15,7 +15,7 @@
<%= t 'browse.map.deleted' %>
<% end %>
</div>
<% if map.instance_of? Changeset or map.visible %>
<% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible %>
<script type="text/javascript">
OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
@ -49,10 +49,15 @@
<% else %>
var obj_type = "<%= map.class.name.downcase %>";
var obj_id = <%= map.id %>;
var obj_version = <%= map.version %>;
var obj_visible = <%= map.visible %>;
var url = "/api/<%= "#{API_VERSION}" %>/<%= map.class.name.downcase %>/<%= map.id %>";
if (obj_type != "node") {
url += "/full";
} else if (!obj_visible) {
var previous_version = obj_version - 1;
url += "/" + previous_version;
}
addObjectToMap(url, true, function(extent) {

View file

@ -4,6 +4,8 @@
<a id="browse_select_view" href="#"><%= t'browse.start.view_data' %></a>
<br />
<a id="browse_select_box" href="#"><%= t'browse.start.manually_select' %></a>
<br />
<a id="browse_hide_areas_box" href="#"><%= t'browse.start.hide_areas' %></a>
</p>
</div>
<div id="browse_status" style="text-align: center; display: none">

View file

@ -10,7 +10,7 @@
<%= render :partial => "map", :object => @node %>
<%= render :partial => "node_details", :object => @node %>
<hr />
<%= t'browse.node.download', :download_xml_link => link_to(t('browse.node.download_xml'), :controller => "node", :action => "read"),
<%= t'browse.node.download', :download_xml_link => link_to(t('browse.node.download_xml'), :controller => "old_node", :action => "version", :version => @node.version),
:view_history_link => link_to(t('browse.node.view_history'), :action => "node_history"),
:edit_link => link_to(t('browse.node.edit'), :controller => "site", :action => "edit", :lat => @node.lat, :lon => @node.lon, :zoom => 18, :node => @node.id)
%>

View file

@ -9,6 +9,7 @@ page << <<EOJ
var browseDataLayer;
var browseSelectControl;
var browseObjectList;
var areasHidden = false;
OpenLayers.Feature.Vector.style['default'].strokeWidth = 3;
OpenLayers.Feature.Vector.style['default'].cursor = "pointer";
@ -33,12 +34,16 @@ page << <<EOJ
map.events.register("moveend", map, showData);
map.events.triggerEvent("moveend");
$("browse_hide_areas_box").innerHTML = "#{I18n.t('browse.start_rjs.hide_areas')}";
$("browse_hide_areas_box").style.display = "inline";
$("browse_hide_areas_box").onclick = hideAreas;
}
function showData() {
if (browseMode == "auto") {
if (map.getZoom() >= 15) {
useMap();
useMap(false);
} else {
setStatus("#{I18n.t('browse.start_rjs.zoom_or_select')}");
}
@ -56,7 +61,7 @@ page << <<EOJ
if (browseBoxControl) {
browseBoxControl.destroy();
browseBoxControl = null;
browseBoxControl = null;
}
if (browseActiveFeature) {
@ -84,7 +89,7 @@ page << <<EOJ
$("browse_select_box").onclick = startDrag;
function useMap() {
function useMap(reload) {
var bounds = map.getExtent();
var projected = bounds.clone().transform(map.getProjectionObject(), epsg4326);
@ -98,7 +103,7 @@ page << <<EOJ
center.lat + (tileHeight / 2));
browseBounds = tileBounds;
getData(tileBounds);
getData(tileBounds, reload);
browseMode = "auto";
@ -108,6 +113,26 @@ page << <<EOJ
return false;
}
function hideAreas() {
$("browse_hide_areas_box").innerHTML = "#{I18n.t('browse.start_rjs.show_areas')}";
$("browse_hide_areas_box").style.display = "inline";
$("browse_hide_areas_box").onclick = showAreas;
areasHidden = true;
useMap(true);
}
function showAreas() {
$("browse_hide_areas_box").innerHTML = "#{I18n.t('browse.start_rjs.hide_areas')}";
$("browse_hide_areas_box").style.display = "inline";
$("browse_hide_areas_box").onclick = hideAreas;
areasHidden = false;
useMap(true);
}
$("browse_select_view").onclick = useMap;
function endDrag(bbox) {
@ -181,22 +206,29 @@ page << <<EOJ
}
}
function getData(bounds) {
function getData(bounds, reload) {
var projected = bounds.clone().transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
var size = projected.getWidth() * projected.getHeight();
if (size > #{MAX_REQUEST_AREA}) {
setStatus(i18n("#{I18n.t('browse.start_rjs.unable_to_load_size', :max_bbox_size => MAX_REQUEST_AREA)}", { bbox_size: size }));
} else {
loadGML("/api/#{API_VERSION}/map?bbox=" + projected.toBBOX());
loadGML("/api/#{API_VERSION}/map?bbox=" + projected.toBBOX(), reload);
}
}
function loadGML(url) {
function loadGML(url, reload) {
setStatus("#{I18n.t('browse.start_rjs.loading')}");
$("browse_content").innerHTML = "";
if (!browseDataLayer) {
var formatOptions = {
checkTags: true,
interestingTagsExclude: ['source','source_ref','source:ref','history','attribution','created_by','tiger:county','tiger:tlid','tiger:upload_uuid']
};
if (areasHidden) formatOptions.areaTags = [];
if (!browseDataLayer || reload) {
var style = new OpenLayers.Style();
style.addRules([new OpenLayers.Rule({
@ -207,12 +239,11 @@ page << <<EOJ
}
})]);
if (browseDataLayer) browseDataLayer.destroyFeatures();
browseDataLayer = new OpenLayers.Layer.GML("Data", url, {
format: OpenLayers.Format.OSM,
formatOptions: {
checkTags: true,
interestingTagsExclude: ['source','source_ref','source:ref','history','attribution','created_by','tiger:county','tiger:tlid','tiger:upload_uuid']
},
formatOptions: formatOptions,
maxFeatures: 100,
requestSuccess: customDataLoader,
displayInLayerSwitcher: false,
@ -230,6 +261,8 @@ page << <<EOJ
map.addControl(browseSelectControl);
browseSelectControl.activate();
} else {
browseDataLayer.destroyFeatures();
browseDataLayer.format(formatOptions);
browseDataLayer.setUrl(url);
}

View file

@ -27,7 +27,7 @@
<% end %>
<td class="<%= cl %> comment">
<% if changeset.tags['comment'] %>
<% if changeset.tags['comment'].to_s != '' %>
<%= linkify(h(changeset.tags['comment'])) %>
<% else %>
<%= t'changeset.changeset.no_comment' %>

View file

@ -1,11 +1,9 @@
<%= t 'diary_entry.location.location' %>
<a href="<%= url_for :controller => 'site', :action => 'index', :lat => location.latitude, :lon => location.longitude, :zoom => 14 %>">
<abbr class="geo" title="<%= number_with_precision(location.latitude, :precision => 4) %>; <%= number_with_precision(location.longitude, :precision => 4) %>">
<% cache(:controller => 'diary_entry', :action => 'view', :display_name => location.user.display_name, :id => location.id, :part => "location") do %>
<%= describe_location location.latitude, location.longitude, 14, location.language_code %>
<% end %>
</abbr>
(<%=link_to t('diary_entry.location.view'), :controller => 'site', :action => 'index', :lat => location.latitude, :lon => location.longitude, :zoom => 14 %>
/
<%=link_to t('diary_entry.location.edit'), :controller => 'site', :action => 'edit', :lat => location.latitude, :lon => location.longitude, :zoom => 14 %>)
</a>

View file

@ -1,6 +1,6 @@
<%= user_image @entry.user, :style => "float: right" %>
<h2><%= t 'diary_entry.view.user_title', :user => h(@entry.user.display_name) %></h2>
<h2><%= link_to t('diary_entry.view.user_title', :user => h(@entry.user.display_name)), :action => :list %></h2>
<%= render :partial => 'diary_entry', :object => @entry %>

View file

@ -0,0 +1,11 @@
<% if flash[:error] %>
<div id="error"><%= flash[:error] %></div>
<% end %>
<% if flash[:warning] %>
<div id="warning"><%= flash[:warning] %></div>
<% end %>
<% if flash[:notice] %>
<div id="notice"><%= flash[:notice] %></div>
<% end %>

View file

@ -0,0 +1,18 @@
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"/>
<%= javascript_strings %>
<%= javascript_include_tag 'prototype' %>
<%= javascript_include_tag 'site' %>
<%= javascript_include_tag 'menu' %>
<!--[if lt IE 7]><%= javascript_include_tag 'pngfix' %><![endif]--> <!-- thanks, microsoft! -->
<%= stylesheet_link_tag 'common' %>
<!--[if IE]><%= stylesheet_link_tag 'large', :media => "screen" %><![endif]--> <!-- IE is totally broken with CSS media queries -->
<%= stylesheet_link_tag 'small', :media => "only screen and (max-width:641px)" %>
<%= stylesheet_link_tag 'large', :media => "screen and (min-width: 642px)" %>
<%= stylesheet_link_tag 'print', :media => "print" %>
<%= tag("link", { :rel => "search", :type => "application/opensearchdescription+xml", :title => "OpenStreetMap Search", :href => "/opensearch/osm.xml" }) %>
<%= tag("meta", { :name => "description", :content => "OpenStreetMap is the free wiki world map." }) %>
<%= style_rules %>
<%= yield :head %>
<title><%= t 'layouts.project_name.title' %><%= ' | '+ h(@title) if @title %></title>
</head>

View file

@ -1,33 +1,13 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= I18n.locale %>" lang="<%= I18n.locale %>" dir="<%= t'html.dir' %>">
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"/>
<%= javascript_strings %>
<%= javascript_include_tag 'prototype' %>
<%= javascript_include_tag 'site' %>
<!--[if lt IE 7]><%= javascript_include_tag 'pngfix' %><![endif]--> <!-- thanks, microsoft! -->
<%= stylesheet_link_tag 'common' %>
<!--[if IE]><%= stylesheet_link_tag 'large', :media => "screen" %><![endif]--> <!-- IE is totally broken with CSS media queries -->
<%= stylesheet_link_tag 'small', :media => "only screen and (max-width: 481px)" %>
<%= stylesheet_link_tag 'large', :media => "screen and (min-width: 482px)" %>
<%= stylesheet_link_tag 'print', :media => "print" %>
<%= tag("link", { :rel => "search", :type => "application/opensearchdescription+xml", :title => "OpenStreetMap Search", :href => "/opensearch/osm.xml" }) %>
<%= tag("meta", { :name => "description", :content => "OpenStreetMap is the free wiki world map." }) %>
<%= style_rules %>
<%= yield :head %>
<title><%= t 'layouts.project_name.title' %><%= ' | '+ h(@title) if @title %></title>
</head>
<%= render :partial => "layouts/head" %>
<body>
<div id="small-title">
<%= link_to(image_tag("osm_logo.png", :size => "16x16", :border => 0, :alt => t('layouts.logo.alt_text')), :controller => 'site', :action => 'index') %>
<h1><%= t 'layouts.project_name.h1' %></h1>
</div>
<div id="content">
<% if flash[:error] %>
<div id="error"><%= flash[:error] %></div>
<% end %>
<% if flash[:warning] %>
<div id="warning"><%= flash[:warning] %></div>
<% end %>
<% if flash[:notice] %>
<div id="notice"><%= flash[:notice] %></div>
<% end %>
<%= render :partial => "layouts/flash", :locals => { :flash => flash } %>
<%= yield %>
</div>
@ -61,7 +41,7 @@
diaryclass = 'active' if params['controller'] == 'diary_entry'
%>
<li><%= link_to t('layouts.view'), {:controller => 'site', :action => 'index'}, {:id => 'viewanchor', :title => t('layouts.view_tooltip'), :class => viewclass} %></li>
<li><%= link_to t('layouts.edit'), {:controller => 'site', :action => 'edit'}, {:id => 'editanchor', :title => t('javascripts.site.edit_tooltip'), :class => editclass} %></li>
<li><%= link_to t('layouts.edit') + '&nbsp;&#x25be;', {:controller => 'site', :action => 'edit'}, {:id => 'editanchor', :title => t('javascripts.site.edit_tooltip'), :class => editclass} %></li>
<li><%= link_to t('layouts.history'), {:controller => 'changeset', :action => 'list' }, {:id => 'historyanchor', :title => t('javascripts.site.history_tooltip'), :class => historyclass} %></li>
<% if params['controller'] == 'site' and (params['action'] == 'index' or params['action'] == 'export') %>
<li><%= link_to_remote t('layouts.export'), {:url => {:controller => 'export', :action => 'start'}}, {:id => 'exportanchor', :title => t('layouts.export_tooltip'), :class => exportclass, :href => url_for(:controller => 'site', :action => 'export')} %></li>
@ -73,6 +53,18 @@
</ul>
</div>
<div id="editmenu">
<ul>
<% Editors::ALL_EDITORS.each do |editor| %>
<li><%= link_to t('layouts.edit_with', :editor => t("editor.#{editor}.description")), {:controller => 'site', :action => 'edit', :editor => editor}, {:id => editor + 'anchor'} %></li>
<% end %>
</ul>
</div>
<script type="text/javascript">
createMenu("editanchor", "editmenu", 1000);
</script>
<div id="left">
<div id="logo">
@ -117,14 +109,18 @@
<% end %>
<div id="left_menu" class="left_menu">
<%= t 'layouts.help_and_wiki',
:help => link_to(t('layouts.help'), t('layouts.help_url'), :title => t('layouts.help_title')),
:wiki => link_to(t('layouts.wiki'), t('layouts.wiki_url'), :title => t('layouts.wiki_title'))
%><br />
<%= link_to t('layouts.copyright'), {:controller => 'site', :action => 'copyright'} %><br />
<a href="http://blogs.openstreetmap.org/" title="<%= t 'layouts.news_blog_tooltip' %>"><%= t 'layouts.news_blog' %></a><br />
<a href="<%= t 'layouts.shop_url' %>" title="<%= t 'layouts.shop_tooltip' %>"><%= t 'layouts.shop' %></a><br />
<%= yield :left_menu %>
<ul>
<li><%= link_to(t('layouts.help_centre'), t('layouts.help_url'), :title => t('layouts.help_title')) %></li>
<li><%= link_to(t('layouts.documentation'), t('layouts.wiki_url'), :title => t('layouts.documentation_title')) %></li>
<li><%= link_to t('layouts.copyright'), {:controller => 'site', :action => 'copyright'} %></li>
<li><a href="http://blogs.openstreetmap.org/" title="<%= t 'layouts.community_blogs_title' %>"><%= t 'layouts.community_blogs' %></a></li>
<li><a href="http://www.osmfoundation.org" title="<%= t 'layouts.foundation_title' %>"><%= t 'layouts.foundation' %></a></li>
<%= yield :left_menu %>
</ul>
</div>
<div id="sotm">
<%= link_to image_tag("sotm.png", :alt => t('layouts.sotm2011'), :title => t('layouts.sotm2011'), :border => "0"), "http://stateofthemap.org/register-now/" %>
</div>
<%= yield :optionals %>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= I18n.locale %>" lang="<%= I18n.locale %>" dir="<%= t'html.dir' %>">
<%= render :partial => "layouts/head" %>
<body class="slim">
<div id="slim_container">
<div id="slim_container_content">
<div id="slim_content">
<%= render :partial => "layouts/flash", :locals => { :flash => flash } %>
<%= yield %>
</div>
<div id="slim_header">
<h1><%= image_tag("osm_logo.png", :size => "60x60", :border => 0, :alt => t('layouts.logo.alt_text')) %><%= t 'layouts.project_name.h1' %></h1>
</div>
</div>
</div>
</body>
</html>

View file

@ -29,5 +29,5 @@
</script>
<% content_for :left_menu do %>
<%= link_to_function t('site.key.map_key'), "openMapKey()", :title => t('site.key.map_key_tooltip') %>
<li><%= link_to_function t('site.key.map_key'), "openMapKey()", :title => t('site.key.map_key_tooltip') %></li>
<% end %>

View file

@ -0,0 +1,43 @@
<div id="map">
<%= t 'site.edit.flash_player_required' %>
</div>
<%= javascript_include_tag 'swfobject.js' %>
<% session[:token] = @user.tokens.create.token unless session[:token] and UserToken.find_by_token(session[:token]) %>
<script type="text/javascript" defer="defer">
var brokenContentSize = $("content").offsetWidth == 0;
var fo = new SWFObject("<%= asset_path("/potlatch/potlatch.swf") %>", "potlatch", "100%", "100%", "6", "#FFFFFF");
// 700,600 for fixed size, 100%,100% for resizable
var changesaved=true;
var winie=false; if (document.all && window.print) { winie=true; }
window.onbeforeunload=function() {
if (!changesaved) {
return '<%= escape_javascript(t('site.edit.potlatch_unsaved_changes')) %>';
}
}
function markChanged(a) { changesaved=a; }
function doSWF(lat,lon,sc) {
if (sc < 11) sc = 11;
fo.addVariable('winie',winie);
fo.addVariable('scale',sc);
fo.addVariable('token','<%= session[:token] %>');
if (lat) { fo.addVariable('lat',lat); }
if (lon) { fo.addVariable('long',lon); }
<% if params['gpx'] %>fo.addVariable('gpx' ,'<%= h(params['gpx'] ) %>');<% end %>
<% if params['way'] %>fo.addVariable('way' ,'<%= h(params['way'] ) %>');<% end %>
<% if params['node'] %>fo.addVariable('node' ,'<%= h(params['node'] ) %>');<% end %>
<% if params['tileurl'] %>fo.addVariable('custombg','<%= h(params['tileurl']) %>');<% end %>
fo.write("map");
}
doSWF(<%= @lat || 'null' %>,<%= @lon || 'null' %>,<%= @zoom %>);
function setPosition(lat, lon, zoom) {
doSWF(lat, lon, zoom || 15);
}
</script>

View file

@ -0,0 +1,65 @@
<div id="map">
<%= t 'site.edit.flash_player_required' %>
</div>
<%= javascript_include_tag 'swfobject.js' %>
<% if defined? POTLATCH2_KEY %>
<% token = @user.access_token(POTLATCH2_KEY) %>
<% else%>
<script type="text/javascript">alert("<%= t 'site.edit.potlatch2_not_configured' %>")</script>
<% end %>
<% locale = request.compatible_language_from(Potlatch2::LOCALES.keys) || "en" %>
<script type="text/javascript" defer="defer">
var brokenContentSize = $("content").offsetWidth == 0;
var fo = new SWFObject("<%= asset_path("/potlatch2/potlatch2.swf") %>", "potlatch", "100%", "100%", "9", "#FFFFFF");
// 700,600 for fixed size, 100%,100% for resizable
var changesaved=true;
window.onbeforeunload=function() {
if (!changesaved) {
return '<%= escape_javascript(t('site.edit.potlatch2_unsaved_changes')) %>';
}
}
function markChanged(a) { changesaved=a; }
function doSWF(lat,lon,zoom) {
fo.addParam("base","/potlatch2");
if (lat) { fo.addVariable("lat",lat); }
if (lon) { fo.addVariable("lon",lon); }
fo.addVariable("locale", "<%= Potlatch2::LOCALES[locale] %>");
<% if params['gpx'] %>
fo.addVariable('gpx' ,'<%= h(params['gpx']) %>');
<% end %>
<% if params['tileurl'] %>
fo.addVariable('tileurl' ,'<%= h(params['tileurl']) %>');
<% end %>
fo.addVariable("zoom",zoom);
fo.addVariable("api","<%= request.protocol + request.host_with_port %>/api/<%= API_VERSION %>/");
fo.addVariable("policy","<%= request.protocol + request.host_with_port %>/api/crossdomain.xml");
fo.addVariable("connection","XML");
<% if token %>
fo.addVariable("oauth_token","<%= token.token %>");
fo.addVariable("oauth_token_secret","<%= token.secret %>");
fo.addVariable("oauth_consumer_key","<%= token.client_application.key %>");
fo.addVariable("oauth_consumer_secret","<%= token.client_application.secret %>");
<% end %>
fo.addVariable("maximise_function","maximiseMap");
fo.addVariable("minimise_function","minimiseMap");
fo.addVariable("move_function","mapMoved");
fo.write("map");
}
doSWF(<%= @lat || 'null' %>,<%= @lon || 'null' %>,<%= @zoom %>);
function setPosition(lat, lon, zoom) {
$("potlatch").setPosition(lat, lon, Math.max(zoom || 15, 13));
}
function mapMoved(lon, lat, zoom, minlon, minlat, maxlon, maxlat) {
updatelinks(lon, lat, zoom, null, minlon, minlat, maxlon, maxlat);
}
</script>

View file

@ -41,7 +41,7 @@
:complete => "endSearch()",
:url => { :controller => :geocoder, :action => :search },
:html => { :method => "get", :action => url_for(:action => "index") }) do %>
<%= text_field_tag :query, h(params[:query]) %>
<%= text_field_tag :query, h(params[:query]), :tabindex => "1" %>
<% if params[:action] == 'index' %>
<%= hidden_field_tag :minlon %>
<%= hidden_field_tag :minlat %>

View file

@ -19,78 +19,9 @@
<%= render :partial => 'sidebar', :locals => { :onopen => "resizeMap();", :onclose => "resizeMap();" } %>
<%= render :partial => 'search' %>
<%
session[:token] = @user.tokens.create.token unless session[:token] and UserToken.find_by_token(session[:token])
<%= render :partial => preferred_editor %>
# Decide on a lat lon to initialise potlatch with. Various ways of doing this
if params['lon'] and params['lat']
lon = h(params['lon'])
lat = h(params['lat'])
zoom = h(params['zoom'])
elsif params['mlon'] and params['mlat']
lon = h(params['mlon'])
lat = h(params['mlat'])
zoom = h(params['zoom'])
elsif params['gpx']
#use gpx id to locate (dealt with below)
elsif cookies.key?("_osm_location")
lon,lat,zoom,layers = cookies["_osm_location"].split("|")
elsif @user and !@user.home_lon.nil? and !@user.home_lat.nil?
lon = @user.home_lon
lat = @user.home_lat
else
#catch all. Do nothing. lat=nil, lon=nil
#Currently this results in potlatch starting up at 0,0 (Atlantic ocean).
end
zoom='14' if zoom.nil?
%>
<div id="map">
<%= t 'site.edit.flash_player_required' %>
</div>
<%= javascript_include_tag 'swfobject.js' %>
<script type="text/javascript" defer="defer">
var brokenContentSize = $("content").offsetWidth == 0;
var fo = new SWFObject("/potlatch/potlatch.swf?d="+Math.round(Math.random()*1000), "potlatch", "100%", "100%", "6", "#FFFFFF");
// 700,600 for fixed size, 100%,100% for resizable
var changesaved=true;
var winie=false; if (document.all && window.print) { winie=true; }
window.onbeforeunload=function() {
if (!changesaved) {
return '<%= escape_javascript(t('site.edit.potlatch_unsaved_changes')) %>';
}
}
function markChanged(a) { changesaved=a; }
function doSWF(lat,lon,sc) {
if (sc < 11) sc = 11;
fo.addVariable('winie',winie);
fo.addVariable('scale',sc);
fo.addVariable('token','<%= session[:token] %>');
if (lat) { fo.addVariable('lat',lat); }
if (lon) { fo.addVariable('long',lon); }
<% if params['gpx'] %>fo.addVariable('gpx' ,'<%= h(params['gpx'] ) %>');<% end %>
<% if params['way'] %>fo.addVariable('way' ,'<%= h(params['way'] ) %>');<% end %>
<% if params['node'] %>fo.addVariable('node' ,'<%= h(params['node'] ) %>');<% end %>
<% if params['tileurl'] %>fo.addVariable('custombg','<%= h(params['tileurl']) %>');<% end %>
fo.write("map");
}
doSWF(<%= lat || 'null' %>,<%= lon || 'null' %>,<%= zoom %>);
function setPosition(lat, lon, zoom) {
doSWF(lat, lon, zoom || 15);
}
function resizeContent() {
var content = $("content");
var rightMargin = parseInt(getStyle(content, "right"));

View file

@ -1,6 +1,6 @@
<% content_for :greeting do %>
<% if @user and !@user.home_lon.nil? and !@user.home_lat.nil? %>
<%= link_to_function t('layouts.home'), "setPosition(#{@user.home_lat}, #{@user.home_lon}, 10)", { :title => t('layouts.home_tooltip') } %> |
<%= link_to_function t('layouts.home'), "setPosition(#{@user.home_lat}, #{@user.home_lon}, 15)", { :title => t('layouts.home_tooltip') } %> |
<% end %>
<% end %>
@ -19,6 +19,9 @@
<div id="map">
</div>
<iframe id="linkloader" style="display: none">
</iframe>
<div id="permalink">
<a href="/" id="permalinkanchor"><%= t 'site.index.permalink' %></a><br/>
<a href="/" id="shortlinkanchor"><%= t 'site.index.shortlink' %></a><br/>
@ -64,18 +67,17 @@ if params['node'] or params['way'] or params['relation']
end
end
# Decide on a lat lon to initialise the map with. Various ways of doing this
if params['minlon'] and params['minlat'] and params['maxlon'] and params['maxlat']
bbox = true
minlon = h(params['minlon'])
minlat = h(params['minlat'])
maxlon = h(params['maxlon'])
maxlat = h(params['maxlat'])
layers = h(params['layers'])
box = true if params['box']=="yes"
object_zoom = false
end
# Decide on a lat lon to initialise the map with. Various ways of doing this
if params['lon'] and params['lat']
elsif params['lon'] and params['lat']
lon = h(params['lon'])
lat = h(params['lat'])
zoom = h(params['zoom'] || '5')
@ -299,10 +301,37 @@ end
resizeMap();
}
function remoteEditHandler(event) {
var extent = getMapExtent();
var loaded = false;
$("linkloader").observe("load", function () { loaded = true; });
$("linkloader").src = "http://127.0.0.1:8111/load_and_zoom?left=" + extent.left + "&top=" + extent.top + "&right=" + extent.right + "&bottom=" + extent.bottom;
setTimeout(function () {
if (!loaded) alert("<%= escape_javascript(t('site.index.remote_failed')) %>");
}, 1000);
event.stop();
}
function installEditHandler() {
$("remoteanchor").observe("click", remoteEditHandler);
<% if preferred_editor == "remote" %>
$("editanchor").observe("click", remoteEditHandler);
<% if params[:action] == "edit" %>
remoteEditHandler();
<% end %>
<% end %>
}
mapInit();
window.onload = handleResize;
window.onresize = handleResize;
Event.observe(window, "load", installEditHandler);
Event.observe(window, "load", handleResize);
Event.observe(window, "resize", handleResize);
<% if params['action'] == 'export' %>
<%= remote_function :url => { :controller => 'export', :action => 'start' } %>

View file

@ -1,5 +1,5 @@
<tr>
<td rowspan="2">
<td rowspan="3">
<%= user_thumbnail contact %>
</td>
<td>
@ -14,6 +14,20 @@
<% end %>
</td>
</tr>
<tr>
<td>
<% changeset = contact.changesets.first %>
<% if changeset %>
<%= t('user.view.latest edit', :ago => t('user.view.ago', :time_in_words_ago => time_ago_in_words(changeset.created_at))) %>
<% comment = changeset.tags['comment'].to_s != '' ? changeset.tags['comment'] : t('changeset.changeset.no_comment') %>
"<%= link_to(comment,
{:controller => 'browse', :action => 'changeset', :id => changeset.id},
{:title => t('changeset.changeset.view_changeset_details')})
%>"
<% else %>
<%= t'changeset.changeset.no_edits' %>
<% end %>
</td>
<tr>
<td>
<%= link_to t('user.view.send message'), :controller => 'message', :action => 'new', :display_name => contact.display_name %>

View file

@ -1,18 +1,17 @@
<% friends = @user.friends.collect { |f| f.befriendee }.select { |f| !f.home_lat.nil? and !f.home_lon.nil? } %>
<% nearest = @user.nearby - friends %>
<% if @user.home_lat.nil? or @user.home_lon.nil? %>
<% lon = h(params['lon'] || '-0.1') %>
<% lat = h(params['lat'] || '51.5') %>
<% zoom = h(params['zoom'] || '4') %>
<% else %>
<% marker = true %>
<% mlon = @user.home_lon %>
<% mlat = @user.home_lat %>
<% lon = @user.home_lon %>
<% lat = @user.home_lat %>
<% zoom = '12' %>
<% end %>
<%
if @user.home_lat.nil? or @user.home_lon.nil?
lon = h(params['lon'] || '0')
lat = h(params['lat'] || '20')
zoom = h(params['zoom'] || '1')
else
marker = true
mlon = @user.home_lon
mlat = @user.home_lat
lon = @user.home_lon
lat = @user.home_lat
zoom = '12'
end
%>
<%= javascript_include_tag '/openlayers/OpenLayers.js' %>
<%= javascript_include_tag '/openlayers/OpenStreetMap.js' %>
@ -38,34 +37,42 @@
<% if marker %>
marker = addMarkerToMap(
new OpenLayers.LonLat(<%= mlon %>, <%= mlat %>), null,
'<%= escape_javascript(render(:partial => "popup", :object => @user, :locals => { :type => "your location" })) %>'
new OpenLayers.LonLat(<%= mlon %>, <%= mlat %>)
<% if not setting_location %>
, null, '<%=escape_javascript(render(:partial => "popup", :object => @user, :locals => { :type => "your location" })) %>'
<% end %>
);
<% end %>
var near_icon = OpenLayers.Marker.defaultIcon();
near_icon.url = OpenLayers.Util.getImagesLocation() + "marker-green.png";
<% nearest.each do |u| %>
addMarkerToMap(new OpenLayers.LonLat(
<%= u.home_lon %>, <%= u.home_lat %>), near_icon.clone(),
'<%= escape_javascript(render(:partial => "popup", :object => u, :locals => { :type => "nearby mapper" })) %>'
);
<% if setting_location %>
map.events.register("click", map, setHome);
<% end %>
<% if show_other_users %>
<% friends = @user.friends.collect { |f| f.befriendee }.select { |f| !f.home_lat.nil? and !f.home_lon.nil? } %>
<% nearest = @user.nearby - friends %>
var friend_icon = OpenLayers.Marker.defaultIcon();
friend_icon.url = OpenLayers.Util.getImagesLocation() + "marker-blue.png";
<% friends.each do |u| %>
addMarkerToMap(new OpenLayers.LonLat(
<%= u.home_lon %>, <%= u.home_lat %>), friend_icon.clone(),
'<%= escape_javascript(render(:partial => "popup", :object => u, :locals => { :type => "friend" })) %>'
);
var near_icon = OpenLayers.Marker.defaultIcon();
near_icon.url = OpenLayers.Util.getImagesLocation() + "marker-green.png";
<% nearest.each do |u| %>
addMarkerToMap(new OpenLayers.LonLat(
<%= u.home_lon %>, <%= u.home_lat %>), near_icon.clone(),
'<%= escape_javascript(render(:partial => "popup", :object => u, :locals => { :type => "nearby mapper" })) %>'
);
<% end %>
var friend_icon = OpenLayers.Marker.defaultIcon();
friend_icon.url = OpenLayers.Util.getImagesLocation() + "marker-blue.png";
<% friends.each do |u| %>
addMarkerToMap(new OpenLayers.LonLat(
<%= u.home_lon %>, <%= u.home_lat %>), friend_icon.clone(),
'<%= escape_javascript(render(:partial => "popup", :object => u, :locals => { :type => "friend" })) %>'
);
<% end %>
<% end %>
if (document.getElementById('updatehome')) {
map.events.register("click", map, setHome);
}
}
<% if setting_location %>
function setHome( e ) {
closeMapPopup();
@ -80,12 +87,10 @@
removeMarkerFromMap(marker);
}
marker = addMarkerToMap(
lonlat, null,
'<%= escape_javascript(render(:partial => "popup", :object => @user, :locals => { :type => "your location" })) %>'
);
marker = addMarkerToMap(lonlat);
}
}
<% end %>
window.onload = init;
// -->

View file

@ -1,15 +1,21 @@
<p id="first">
<%= @text['intro'] %>
<% if has_decline %>
<%= @text['next_with_decline'] %>
<% else %>
<%= @text['next_without_decline'] %>
<% end %>
<%= @text['next_with_decline'] %>
</p>
<h3><%= @text['introduction'] %></h3>
<ol>
<li>
<p><%= @text['section_1'] %></p>
<% unless @text['section_1a'].nil? %>
<ol style="list-style-type: lower-alpha">
<li><%= @text['section_1a'] %></li>
<li><%= @text['section_1b'] %></li>
</ol>
<% end %>
</li>
</ol>
<h3><%= @text['rights_granted'] %></h3>
<ol start="2">
<li>
<p><%= @text['section_2'] %></p>
</li>
@ -17,6 +23,7 @@
<p><%= @text['section_3'] %></p>
<p><%= @text['active_defn_1'] %></p>
<p><%= @text['active_defn_2'] %></p>
</ul>
</li>
<li>
<p><%= @text['section_4'] %></p>
@ -24,14 +31,15 @@
<li>
<p><%= @text['section_5'] %></p>
</li>
</ol>
<h3><%= @text['limitation_of_liability'] %></h3>
<ol start="6">
<li><p><%= @text['section_6'] %></p></li>
<li><p><%= @text['section_7'] %></p></li>
</ol>
<h3><%= @text['miscellaneous'] %></h3>
<ol start="8">
<li>
<p><%= @text['section_6'] %></p>
<ol>
<li><p><%= @text['section_6_1'] %></p></li>
<li><p><%= @text['section_6_2'] %></p></li>
</ol>
</li>
<li>
<p id="last"><%= @text['section_7'] %></p>
<p id="last"><%= @text['section_8'] %></p>
</li>
</ol>

View file

@ -66,6 +66,11 @@
<td><%= f.text_field :languages %></td>
</tr>
<tr>
<td class="fieldName" valign="top"><%= t 'user.account.preferred editor' %></td>
<td><%= f.select :preferred_editor, [[t("editor.default", :name => t("editor.#{DEFAULT_EDITOR}.name")), 'default']] + Editors::ALL_EDITORS.collect { |e| [t("editor.#{e}.description"), e] } %></td>
</tr>
<tr>
<td class="fieldName" valign="top">
<%= t 'user.account.image' %>
@ -96,7 +101,7 @@
<tr id="homerow" <% unless @user.home_lat and @user.home_lon %> class="nohome" <%end%> >
<td class="fieldName"><%= t 'user.account.home location' %></td>
<td><em class="message"><%= t 'user.account.no home location' %></em><span class="location"><%= t 'user.account.latitude' %> <%= f.text_field :home_lat, :size => 20, :id => "home_lat" %><%= t 'user.account.longitude' %><%= f.text_field :home_lon, :size => 20, :id => "home_lon" %></span></td>
<td><em class="message"><%= t 'user.account.no home location' %></em><span class="location"><%= t 'user.account.latitude' %> <%= f.text_field :home_lat, :size => 20, :id => "home_lat" %> <%= t 'user.account.longitude' %><%= f.text_field :home_lon, :size => 20, :id => "home_lon" %></span></td>
</tr>
<tr>
@ -114,7 +119,7 @@
</table>
<% end %>
<%= render :partial => 'map' %>
<%= render :partial => 'map', :locals => { :setting_location => true, :show_other_users => false } %>
<% unless @user.data_public? %>
<a name="public"></a>

View file

@ -1,14 +1,25 @@
<h1><%= t 'user.login.heading' %></h1>
<div id="login_wrapper">
<div id="login_login">
<h1><%= t 'user.login.heading' %></h1>
<p><%= t 'user.login.please login', :create_user_link => link_to(t('user.login.create_account'), :controller => 'user', :action => 'new', :referer => params[:referer]) %></p>
<p><%= t 'user.login.already have' %></p>
<% form_tag :action => 'login' do %>
<%= hidden_field_tag('referer', h(params[:referer])) %>
<table id="loginForm">
<tr><td class="fieldName"><%= t 'user.login.email or username' %></td><td><%= text_field('user', 'email',{:value => "", :size => 28, :maxlength => 255, :tabindex => 1}) %></td></tr>
<tr><td class="fieldName"><%= t 'user.login.password' %></td><td><%= password_field('user', 'password',{:value => "", :size => 28, :maxlength => 255, :tabindex => 2}) %> <span class="minorNote">(<%= link_to t('user.login.lost password link'), :controller => 'user', :action => 'lost_password' %>)</span></td></tr>
<tr><td class="fieldName"><label for="remember_me"><%= t 'user.login.remember' %></label></td><td><%= check_box_tag "remember_me", "yes", false, :tabindex => 3 %></td></tr>
<tr><td colspan="2">&nbsp;<!--vertical spacer--></td></tr>
<tr><td></td><td align="right"><%= submit_tag t('user.login.login_button'), :tabindex => 3 %></td></tr>
</table>
<% end %>
<% form_tag :action => 'login' do %>
<%= hidden_field_tag('referer', h(params[:referer])) %>
<table id="loginForm">
<tr><td class="fieldName"><%= t 'user.login.email or username' %></td><td><%= text_field('user', 'email',{:value => "", :size => 28, :maxlength => 255, :tabindex => 1}) %></td></tr>
<tr><td class="fieldName"><%= t 'user.login.password' %></td><td><%= password_field('user', 'password',{:value => "", :size => 28, :maxlength => 255, :tabindex => 2}) %> <span class="minorNote">(<%= link_to t('user.login.lost password link'), :controller => 'user', :action => 'lost_password' %>)</span></td></tr>
<tr><td class="fieldName"><label for="remember_me"><%= t 'user.login.remember' %></label></td><td><%= check_box_tag "remember_me", "yes", false, :tabindex => 3 %></td></tr>
</table>
<%= submit_tag t('user.login.login_button'), :tabindex => 3 %>
<% end %>
<br clear="both">
</div>
<div id="login_signup">
<h2><%= t 'user.login.new to osm' %></h2>
<p><%= t 'user.login.to make changes' %></p>
<p><%= t 'user.login.create account minute' %></p></p>
<p><%= button_to t('user.login.register now'), :action => :new, :referer => params[:referer] %></p>
<br clear="both">
</div>
</div>

View file

@ -13,7 +13,7 @@
:before => update_page do |page|
page.replace_html 'contributorTerms', image_tag('searching.gif')
end,
:url => {:legale => legale, :has_decline => params.has_key?(:user)}
:url => {:legale => legale}
)
%>
<%= label_tag "legale_#{legale}", t('user.terms.legale_names.' + name) %>
@ -22,7 +22,7 @@
<% end %>
<div id="contributorTerms">
<%= render :partial => "terms", :locals => { :has_decline =>params.has_key?(:user) } %>
<%= render :partial => "terms" %>
</div>
<% form_tag({:action => "save"}, { :id => "termsForm" }) do %>
@ -41,9 +41,7 @@
<%= hidden_field('user', 'pass_crypt_confirmation') %>
<% end %>
<div id="buttons">
<% if params[:user] %>
<%= submit_tag(t('user.terms.decline'), :name => "decline", :id => "decline") %>
<% end %>
<%= submit_tag(t('user.terms.decline'), :name => "decline", :id => "decline") %>
<%= submit_tag(t('user.terms.agree'), :name => "agree", :id => "agree") %>
</div>
</p>

View file

@ -96,7 +96,7 @@
<%= t 'user.view.if set location', :settings_link => (link_to t('user.view.settings_link_text'), :controller => 'user', :action => 'account', :display_name => @user.display_name) %>
</p>
<% else %>
<%= render :partial => 'map' %>
<%= render :partial => 'map', :locals => { :setting_location => false, :show_other_users => true } %>
<% end %>
</div>