Merge branch 'master' into openstreetbugs

Conflicts:
	Gemfile
	Gemfile.lock
	lib/migrate.rb
This commit is contained in:
Tom Hughes 2012-03-08 18:23:27 +00:00
commit e660e60966
565 changed files with 10835 additions and 29494 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
log
public/assets
public/attachments
tmp
.DS_Store

24
Gemfile
View file

@ -2,7 +2,7 @@
source 'http://rubygems.org'
# Require rails
gem 'rails', '3.1.3'
gem 'rails', '3.2.2'
# Require the postgres database driver
gem 'pg'
@ -11,21 +11,24 @@ gem 'pg'
gem 'jquery-rails'
# Load rails plugins
gem 'rails-i18n-updater'
gem 'rails-i18n', ">= 0.5.1"
gem 'dynamic_form'
gem 'rinku', '>= 1.2.2', :require => 'rails_rinku'
gem 'oauth-plugin', '>= 0.4.0.pre7'
gem 'open_id_authentication', '>= 1.1.0'
gem 'validates_email_format_of', '>= 1.5.1'
gem 'composite_primary_keys', '>= 4.1.1'
gem 'composite_primary_keys', '>= 5.0.0'
gem 'http_accept_language', '>= 1.0.2'
gem 'paperclip', '~> 2.0'
gem 'deadlock_retry', '>= 1.2.0'
gem 'jsonify-rails'
# Character conversion support for ruby 1.8
gem 'iconv', :platforms => :ruby_18
# Load libxml support for XML parsing and generation
gem 'libxml-ruby', '>= 2.0.5', :require => 'libxml'
# Load ImageMagick support for user picture resizing
gem 'rmagick', :require => 'RMagick'
# Load HTML sanitizer
gem 'sanitize'
@ -36,8 +39,7 @@ gem 'SystemTimer', '>= 1.1.3', :require => 'system_timer', :platforms => :ruby_1
gem 'httpclient'
# Load memcache in case we are using it
gem 'memcache-client'
gem 'memcached'
gem 'memcached', '>= 1.4.1'
# Gems needed for running tests
group :test do
@ -46,8 +48,8 @@ end
# Gems needed for compiling assets
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'therubyracer'
end

View file

@ -2,76 +2,80 @@ GEM
remote: http://rubygems.org/
specs:
SystemTimer (1.2.3)
actionmailer (3.1.3)
actionpack (= 3.1.3)
mail (~> 2.3.0)
actionpack (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
actionmailer (3.2.2)
actionpack (= 3.2.2)
mail (~> 2.4.0)
actionpack (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.5)
journey (~> 1.0.1)
rack (~> 1.4.0)
rack-cache (~> 1.1)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.3)
activemodel (3.1.3)
activesupport (= 3.1.3)
sprockets (~> 2.1.2)
activemodel (3.2.2)
activesupport (= 3.2.2)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
arel (~> 2.2.1)
activerecord (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.1.3)
activemodel (= 3.1.3)
activesupport (= 3.1.3)
activesupport (3.1.3)
activeresource (3.2.2)
activemodel (= 3.2.2)
activesupport (= 3.2.2)
activesupport (3.2.2)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.2.6)
arel (2.2.1)
addressable (2.2.7)
arel (3.0.2)
builder (3.0.0)
coffee-rails (3.1.1)
cocaine (0.2.1)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.1.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.1.3)
composite_primary_keys (4.1.1)
activerecord (~> 3.1)
coffee-script-source (1.2.0)
composite_primary_keys (5.0.1)
activerecord (~> 3.2.0)
deadlock_retry (1.2.0)
dynamic_form (1.1.4)
erubis (2.7.0)
execjs (1.2.9)
execjs (1.3.0)
multi_json (~> 1.0)
faraday (0.7.5)
addressable (~> 2.2.6)
multipart-post (~> 1.1.3)
rack (< 2, >= 1.1.0)
faraday (0.7.6)
addressable (~> 2.2)
multipart-post (~> 1.1)
rack (~> 1.1)
hike (1.2.1)
httpclient (2.2.3)
http_accept_language (1.0.2)
httpclient (2.2.4)
i18n (0.6.0)
jquery-rails (1.0.18)
railties (~> 3.0)
iconv (0.1)
journey (1.0.3)
jquery-rails (2.0.1)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.6.1)
jsonify (0.2.0)
jsonify-rails (0.2.0)
json (1.6.5)
jsonify (0.3.1)
multi_json (~> 1.0)
jsonify-rails (0.3.1)
actionpack
jsonify (>= 0.2.0)
jsonify (>= 0.3.1)
libv8 (3.3.10.4)
libxml-ruby (2.2.2)
mail (2.3.0)
mail (2.4.3)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
memcache-client (1.8.5)
memcached (1.3.5)
memcached (1.4.1)
mime-types (1.17.2)
multi_json (1.0.3)
multipart-post (1.1.3)
multi_json (1.1.0)
multipart-post (1.1.5)
nokogiri (1.5.0)
oauth (0.4.5)
oauth-plugin (0.4.0.rc2)
@ -79,18 +83,21 @@ GEM
oauth (~> 0.4.4)
oauth2
rack
oauth2 (0.5.1)
faraday (~> 0.7.4)
multi_json (~> 1.0.3)
oauth2 (0.5.2)
faraday (~> 0.7)
multi_json (~> 1.0)
open_id_authentication (1.1.0)
rack-openid (~> 1.3)
pg (0.11.0)
paperclip (2.7.0)
activerecord (>= 2.3.0)
activesupport (>= 2.3.2)
cocaine (>= 0.0.2)
mime-types
pg (0.13.2)
polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.1)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-openid (1.3.1)
rack (>= 1.1.0)
ruby-openid (>= 2.1.8)
@ -98,44 +105,40 @@ GEM
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.1.3)
actionmailer (= 3.1.3)
actionpack (= 3.1.3)
activerecord (= 3.1.3)
activeresource (= 3.1.3)
activesupport (= 3.1.3)
rails (3.2.2)
actionmailer (= 3.2.2)
actionpack (= 3.2.2)
activerecord (= 3.2.2)
activeresource (= 3.2.2)
activesupport (= 3.2.2)
bundler (~> 1.0)
railties (= 3.1.3)
rails-i18n-updater (1.0.1)
actionpack
activesupport
rails
railties (3.1.3)
actionpack (= 3.1.3)
activesupport (= 3.1.3)
railties (= 3.2.2)
rails-i18n (0.5.1)
i18n (~> 0.5)
railties (3.2.2)
actionpack (= 3.2.2)
activesupport (= 3.2.2)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rdoc (3.11)
rdoc (3.12)
json (~> 1.4)
rinku (1.4.1)
rmagick (2.13.1)
rinku (1.5.1)
ruby-openid (2.1.8)
sanitize (2.0.3)
nokogiri (< 1.6, >= 1.4.4)
sass (3.1.10)
sass-rails (3.1.5)
actionpack (~> 3.1.0)
railties (~> 3.1.0)
sass (~> 3.1.10)
tilt (~> 1.3.2)
sprockets (2.0.3)
nokogiri (>= 1.4.4, < 1.6)
sass (3.1.15)
sass-rails (3.2.4)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
tilt (!= 1.3.0, ~> 1.1)
therubyracer (0.9.9)
tilt (~> 1.1, != 1.3.0)
therubyracer (0.9.10)
libv8 (~> 3.3.10)
thor (0.14.6)
tilt (1.3.3)
@ -143,8 +146,8 @@ GEM
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.31)
uglifier (1.1.0)
tzinfo (0.3.32)
uglifier (1.2.3)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
validates_email_format_of (1.5.3)
@ -154,25 +157,27 @@ PLATFORMS
DEPENDENCIES
SystemTimer (>= 1.1.3)
coffee-rails (~> 3.1.0)
composite_primary_keys (>= 4.1.1)
coffee-rails (~> 3.2.1)
composite_primary_keys (>= 5.0.0)
deadlock_retry (>= 1.2.0)
dynamic_form
http_accept_language (>= 1.0.2)
httpclient
iconv
jquery-rails
jsonify-rails
libxml-ruby (>= 2.0.5)
memcache-client
memcached
memcached (>= 1.4.1)
oauth-plugin (>= 0.4.0.pre7)
open_id_authentication (>= 1.1.0)
paperclip (~> 2.0)
pg
rails (= 3.1.3)
rails-i18n-updater
rails (= 3.2.2)
rails-i18n (>= 0.5.1)
rinku (>= 1.2.2)
rmagick
sanitize
sass-rails (~> 3.1.0)
sass-rails (~> 3.2.3)
therubyracer
timecop
uglifier
uglifier (>= 1.0.3)
validates_email_format_of (>= 1.5.1)

339
LICENSE Normal file
View file

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

132
README.md Normal file
View file

@ -0,0 +1,132 @@
# Description
This is the Rails port, the [Ruby on Rails](http://rubyonrails.org/)
application that powers [OpenStreetMap](http://www.openstreetmap.org).
The Rails port provides almost all the services which are available
on the OpenStreetMap site, including:
* The web site itself, including the edit pages.
* The editing [API](http://wiki.openstreetmap.org/wiki/API_v0.6).
* Browse pages - a web front-end to the OpenStreetMap data.
* The user system, including preferences, diary entries, friends and
user-to-user messaging.
* GPX uploads, browsing and API.
There are some non-Rails services which the site includes, for
example; tiles, geocoding, GPX file loading. There are also some
utilities which provide other services on the OpenStreetMap site,
or improve its function, but are not integrated with the Rails
port, for example; Osmosis, CGImap.
# License
This software is licensed under the [GNU General Public License 2.0](http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt),
a copy of which can be found in the LICENSE file.
# Running it
You can find documentation on [how to setup and
run](http://wiki.openstreetmap.org/wiki/The_Rails_Port) the software
on the OpenStreetMap wiki.
# Hacking it
The canonical Git repository for this software is hosted at
[git.openstreetmap.org](http://git.openstreetmap.org/?p=rails.git),
but much of the development is done on GitHub and for most people
[this repository on Github](https://github.com/openstreetmap/openstreetmap-website)
will be a better place to start.
Anybody hacking on the code is welcome to join the
[rails-dev](http://lists.openstreetmap.org/listinfo/rails-dev) mailing
list where other people hacking on the code hang out and will be happy
to help with any problems you may encounter.
There are also weekly IRC meetings, at 1800 GMT on Mondays in #osm-ewg on
the OFTC network where questions can be asked and ideas discussed. For more
information, please see [the EWG page]
(http://www.osmfoundation.org/wiki/Engineering_Working_Group#Meetings). You can
join the channel using your favourite IRC client or [irc.openstreetmap.org](http://irc.openstreetmap.org/).
## Rails
If you're not already familiar with Ruby on Rails then it's probably
worth having a look at [Rails Guides](http://guides.rubyonrails.org/) for an introduction.
While working with Rails you will probably find the [API documentation](http://api.rubyonrails.org/)
helpful as a reference.
## Coding style
When writing code it is generally a good idea to try and match your
formatting to hat of any existing code in the same file, or to other
similar files if you are writing new code. Consistency of layout is
far more important that the layout itself as it makes reading code
much easier.
One golden rule of formatting -- please don't use tabs in your code
as they will cause the file to be formatted differently for different
people depending on how they have their editor configured.
## Testing
Having a good suite of tests is very important to the stability and
maintainability of any code base. The tests in the Rails port code are
by no means complete, but they are extensive, and must continue to be
so with any new functionality which is written. Tests are also useful
in giving others confidence in the code you've written, and can
greatly speed up the process of merging in new code.
When hacking, you should:
* Write new tests to cover the new functionality you've added.
* Where appropriate, modify existing tests to reflect new or changed
functionality.
* Never comment out or remove a test just because it doesn't pass.
## Comments
Sometimes it's not apparent from the code itself what it does, or,
more importantly, **why** it does that. Good comments help your fellow
developers to read the code and satisfy themselves that it's doing the
right thing.
When hacking, you should:
* Comment your code - don't go overboard, but explain the bits which
might be difficult to understand what the code does, why it does it
and why it should be the way it is.
* Check existing comments to ensure that they are not misleading.
## Committing
When you submit patches, the project maintainer has to read them and
understand them. This is difficult enough at the best of times, and
misunderstanding patches can lead to them being more difficult to
merge. To help wit this, when submitting you should:
* Split up large patches into smaller units of functionality.
* Keep your commit messages relevant to the changes in each individual
unit.
When writing commit messages please try and stick to the same style as
other commits, namely:
* A one line summary, starting with a capital and with no full stop.
* A blank line.
* Full description, as proper sentences with capitals and full stops.
For simple commits the one line summary is often enough and the body
of the commit message can be left out.
## Sending the patches
If you have forked on GitHub then the best way to submit your patches is to
push your changes back to GitHub and then send a "pull request" on GitHub.
Otherwise you should either push your changes to a publicly visible git repository
and send the details to the [rails-dev](http://lists.openstreetmap.org/listinfo/rails-dev)
list or generate patches with `git format-patch` and send them to the
[rails-dev](http://lists.openstreetmap.org/listinfo/rails-dev) list.

View file

@ -1,24 +0,0 @@
# Description
This is the Rails port. The Ruby on Rails application that powers
http://www.openstreetmap.org.
# Running it
You can find documentation on how to setup and run the software on the
OpenStreetMap wiki:
* http://wiki.openstreetmap.org/wiki/The_Rails_Port
# Hacking it
The canonnical Git repository for this software is hosted at
git.openstreetmap.org:
* http://git.openstreetmap.org/?p=rails.git
See commiting to the rails port on the wiki for getting your patches
integrated:
* http://wiki.openstreetmap.org/wiki/Committing_to_the_rails_port

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 B

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 917 B

After

Width:  |  Height:  |  Size: 917 B

Before After
Before After

View file

@ -24,7 +24,7 @@ function createMap(divName, options) {
theme: "<%= asset_path 'theme/default/style.css' %>"
});
var mapnik = new OpenLayers.Layer.OSM.Mapnik(i18n("javascripts.map.base.mapnik"), {
var mapnik = new OpenLayers.Layer.OSM.Mapnik(i18n("javascripts.map.base.standard"), {
attribution: "",
keyid: "mapnik",
displayOutsideMaxExtent: true,
@ -33,15 +33,6 @@ function createMap(divName, options) {
});
map.addLayer(mapnik);
var osmarender = new OpenLayers.Layer.OSM.Osmarender(i18n("javascripts.map.base.osmarender"), {
attribution: "",
keyid: "osmarender",
displayOutsideMaxExtent: true,
wrapDateLine: true,
layerCode: "O"
});
map.addLayer(osmarender);
var cyclemap = new OpenLayers.Layer.OSM.CycleMap(i18n("javascripts.map.base.cycle_map"), {
attribution: "Tiles courtesy of <a href='http://www.opencyclemap.org/' target='_blank'>Andy Allan</a>",
keyid: "cyclemap",
@ -75,11 +66,9 @@ function createMap(divName, options) {
});
map.addLayer(mapquest);
var numZoomLevels = Math.max(mapnik.numZoomLevels, osmarender.numZoomLevels);
markers = new OpenLayers.Layer.Markers("Markers", {
displayInLayerSwitcher: false,
numZoomLevels: numZoomLevels,
numZoomLevels: 20,
maxExtent: new OpenLayers.Bounds(-20037508,-20037508,20037508,20037508),
maxResolution: 156543,
units: "m",

View file

@ -35,7 +35,7 @@ function enterMenuAnchor(event, anchor, menu, delay, align) {
clearTimeout(menu.timer);
if (delay > 0) {
menu.timer = setTimeout(function () { openMenu(anchor, menu, align) }, delay);
menu.timer = setTimeout(function () { openMenu(anchor, menu, align); }, delay);
} else {
openMenu(event, menu, align);
}
@ -48,7 +48,7 @@ function enterMenuAnchor(event, anchor, menu, delay, align) {
function leaveMenuAnchor(event, anchor, menu) {
var to = event.relatedTarget;
if (!menu.is(to) && menu.has(to).length == 0) {
if (!menu.is(to) && menu.has(to).length === 0) {
menu.hide();
}
@ -61,7 +61,7 @@ function leaveMenuAnchor(event, anchor, menu) {
function leaveMenu(event, anchor, menu) {
var to = event.relatedTarget;
if (!anchor.is(to) && menu.has(to).length == 0) {
if (!anchor.is(to) && menu.has(to).length === 0) {
menu.hide();
}
@ -75,9 +75,9 @@ function createMenu(anchorid, menuid, delay, align) {
var anchor = $("#" + anchorid);
var menu = $("#" + menuid);
anchor.mouseup(function (event) { closeMenu(menu) });
anchor.mouseover(function (event) { enterMenuAnchor(anchor, anchor, menu, delay, align) });
anchor.mouseout(function (event) { leaveMenuAnchor(event, anchor, menu) });
menu.mouseup(function (event) { closeMenu(menu) });
menu.mouseout(function (event) { leaveMenu(event, anchor, menu) });
anchor.mouseup(function (event) { closeMenu(menu); });
anchor.mouseover(function (event) { enterMenuAnchor(anchor, anchor, menu, delay, align); });
anchor.mouseout(function (event) { leaveMenuAnchor(event, anchor, menu); });
menu.mouseup(function (event) { closeMenu(menu); });
menu.mouseout(function (event) { leaveMenu(event, anchor, menu); });
}

View file

@ -45,12 +45,13 @@ function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,objtype,obj
var minzoom = match[1];
var name = link.id.replace(/anchor$/, "");
$(link).off("click.minzoom");
if (zoom >= minzoom) {
$(link).off("click");
$(link).attr("title", i18n("javascripts.site." + name + "_tooltip"));
$(link).removeClass("disabled");
} else {
$(link).click(function () { alert(i18n("javascripts.site." + name + "_zoom_alert")); return false; });
$(link).on("click.minzoom", function () { alert(i18n("javascripts.site." + name + "_zoom_alert")); return false; });
$(link).attr("title", i18n("javascripts.site." + name + "_disabled_tooltip"));
$(link).addClass("disabled");
}
@ -72,17 +73,17 @@ function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,objtype,obj
// This is a hack to omit the default mapnik layer from the shortlink.
if (layers && layers != "M") {
args["layers"] = layers;
args.layers = layers;
}
else {
delete args["layers"];
delete args.layers;
}
// Here we're assuming that all parameters but ?layers= and
// ?{node,way,relation}= can be safely omitted from the shortlink
// which encodes lat/lon/zoom. If new URL parameters are added to
// the main slippy map this needs to be changed.
if (args["layers"] || args[objtype]) {
if (args.layers || args[objtype]) {
this.href = setArgs(prefix + "/go/" + code, args);
} else {
this.href = prefix + "/go/" + code;
@ -105,7 +106,7 @@ function shortlinkPrefix() {
* Called to get the arguments from a URL as a hash.
*/
function getArgs(url) {
var args = new Object();
var args = {};
var querystart = url.indexOf("?");
if (querystart >= 0) {
@ -116,7 +117,7 @@ function getArgs(url) {
if (match = queryitems[i].match(/^(.*)=(.*)$/)) {
args[unescape(match[1])] = unescape(match[2]);
} else {
args[unescape(queryitems[i])] = null
args[unescape(queryitems[i])] = null;
}
}
}
@ -128,10 +129,9 @@ function getArgs(url) {
* Called to set the arguments on a URL from the given hash.
*/
function setArgs(url, args) {
var queryitems = new Array();
var queryitems = [];
for (arg in args)
{
for (arg in args) {
if (args[arg] == null) {
queryitems.push(escape(arg));
} else {
@ -167,7 +167,7 @@ function getStyle(el, property) {
* rails and then later by javascript.
*/
function i18n(string, keys) {
string = i18n_strings[string] || string
string = i18n_strings[string] || string;
for (var key in keys) {
var re_key = '\\[\\[' + key + '\\]\\]';

View file

@ -3,8 +3,10 @@
/* Default rules for the body of every page */
body {
font-family: Arial,sans-serif;
color: #000;
font-family: 'Helvetica Neue',Arial,sans-serif;
font-size: 14px;
line-height: 20px;
color: #222;
background-color: #fff;
margin: 0px;
padding: 0px;
@ -34,12 +36,22 @@ hr {
height: 1px;
}
/* Default rules for headings */
h2 {
margin: 5px 0;
font-size: 25px;
line-height: 30px;
}
/* Rules for the whole left sidebar, including the logo */
#left {
position: absolute;
top: 0px;
min-width: 170px;
width: 185px;
font-size: 11px;
line-height: 12px;
}
/* Rules for the OpenStreetMap logo in the top left corner */
@ -48,22 +60,20 @@ hr {
width: 170px;
min-width: 170px;
padding: 5px;
margin: 5px;
height: 150px;
background: #fff;
border: 1px solid #ccd;
border-radius: 5px;
-moz-border-radius: 5px;
text-align: center;
margin: 25px 0 5px 0;
}
#logo h1 {
font-size: 14px;
font-size: 18px;
line-height: 20px;
text-align: center;
margin: 0px;
}
#logo h2 {
font-size: 10px;
line-height: 15px;
margin: 0px;
}
@ -76,13 +86,7 @@ hr {
/* Rules for the introductory text displayed in the left sidebar to new users */
#intro {
width: 170px;
padding: 5px;
margin: 5px;
border: 1px solid #ccc;
font-size: 11px;
border-radius: 5px;
-moz-border-radius: 5px;
border-top: 1px solid #ccc;
}
#intro p {
@ -119,7 +123,7 @@ hr {
padding: 5px;
border: 1px solid #ccc;
background: #ea0;
line-height: 1.2em;
line-height: 20px;
font-size: 14px;
border-radius: 5px;
-moz-border-radius: 5px;
@ -128,21 +132,13 @@ hr {
/* Rules for the menu displayed in the left sidebar */
.left_menu {
width: 170px;
min-width: 170px;
margin: 5px;
padding: 5px;
border: 1px solid #ccc;
background: #ddd;
line-height: 1.2em;
margin: 4px 0;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
line-height: 20px;
font-size: 14px;
font-weight: bold;
border-radius: 5px;
-moz-border-radius: 5px;
}
.left_menu td {
font-size: 12px;
}
.left_menu h1 {
@ -182,22 +178,15 @@ hr {
*/
.optionalbox {
width: 170px;
min-width: 170px;
margin: 5px;
padding: 5px;
border: 1px solid #ccc;
line-height: 1.2em;
font-size: 12px;
background: #eee;
border-radius: 5px;
-moz-border-radius: 5px;
margin: 4px 0;
border-top: 1px solid #ccc;
}
.optionalbox h1 {
font-size: 14px;
font-weight: bold;
line-height: 22px;
line-height: 20px;
margin: 0px;
vertical-align: bottom;
}
@ -205,13 +194,13 @@ hr {
/* Rules for the search box */
.whereami {
line-height: 22px;
line-height: 20px;
vertical-align: bottom;
}
.search_container {
height: 16px;
padding-bottom: 6px;
height: 15px;
padding-bottom: 5px;
}
#search_field form {
@ -231,21 +220,19 @@ hr {
}
.search_help {
font-size: 10px;
line-height: 1em;
margin-top: 3px;
margin-top: 2px;
margin-bottom: 0px;
}
/* Rules for donation request box */
.donate {
width: 170px;
margin: 5px;
width: 155px;
margin: 10px 5px;
padding: 5px;
border: 1px solid #ccc;
background: #cbeea7;
line-height: 1.2em;
line-height: 20px;
text-align: center;
font-size: 14px;
border-radius: 5px;
@ -261,66 +248,58 @@ hr {
/* Rules for tabbed navigation bar */
#tabnav
{
height: 20px;
margin: 0px;
padding-top: 5px;
background: image-url('tab_bottom.gif') repeat-x bottom;
#top-bar {
border-bottom: 1px solid #ccc;
height: 29px;
}
#tabnav li
{
margin: 0px;
#tabnav {
padding: 0;
margin: 0;
overflow:hidden;
}
#tabnav li {
margin: 0px;
padding: 0px;
display: inline;
list-style-type: none;
}
#tabnav a, #tabnav a:link, #tabnav a:visited
{
background: #f3f3f3;
font-size: 13px;
line-height: 14px;
#tabnav a, #tabnav a:link, #tabnav a:visited {
background: #fff;
font-size: 14px;
line-height: 19px;
font-weight: bold;
padding: 2px 10px;
border: 1px solid #ccc;
padding: 5px 10px;
text-decoration: none;
color: #333;
border-top-right-radius: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
-moz-border-radius-topleft: 5px;
}
#tabnav a:link.active, #tabnav a:visited.active
{
border-bottom: 1px solid #fff;
background: #fff;
#tabnav a:link.active, #tabnav a:visited.active {
border-bottom: 1px solid #aaa;
background: #9ed485;
color: #000;
}
#tabnav a:link:hover, #tabnav a:visited:hover
{
background: #fff;
#tabnav a:link:hover, #tabnav a:visited:hover {
text-decoration:underline;
}
#tabnav a:link.disabled, #tabnav a:visited.disabled,
#tabnav a:link:hover.disabled, #tabnav a:visited:hover.disabled
{
background: #bbbbbb;
color: white
#tabnav a:link.disabled,
#tabnav a:visited.disabled,
#tabnav a:link:hover.disabled,
#tabnav a:visited:hover.disabled {
color: #888;
}
/* Rules for greeting bar in the top right corner */
#greeting {
height: 20px;
height: 28px;
margin: 0px;
padding-top: 5px;
font-size: 13px;
line-height: 14px;
background: image-url('tab_bottom.gif') repeat-x bottom;
line-height: 28px;
}
.greeting-bar-unread {
@ -338,8 +317,7 @@ hr {
/* Rules for OpenLayers maps */
#map {
border: 1px solid black;
margin: 0px;
margin: 0px;
padding: 0px;
}
@ -353,10 +331,16 @@ hr {
#permalink {
z-index: 10000;
position: absolute;
bottom: 15px;
right: 15px;
bottom: 0px;
right: 0px;
padding: 5px;
background:#fff;
text-align: right;
font-size: smaller;
font-size: 12px;
}
#permalink a {
padding: 5px;
}
/* Rules for edit menu */
@ -396,7 +380,6 @@ hr {
#sidebar {
display: none;
position: absolute;
border: 1px solid black;
margin: 0px;
padding: 0px;
width: 30%;
@ -408,7 +391,7 @@ hr {
overflow: auto;
position: absolute;
font-size: 13px;
line-height: 14px;
line-height: 15px;
top: 29px;
bottom: 0px;
left: 0px;
@ -417,11 +400,10 @@ hr {
#sidebar .sidebar_title {
margin: 0px;
padding: 3px 6px;
padding: 3px 6px 4px 6px;
height: 29px;
font-size: 14px;
line-height: 15px;
border-bottom: 1px solid black;
background: #bbb;
}
@ -454,14 +436,14 @@ hr {
.search_results_heading {
margin: 0px;
padding: 3px 6px;
border: 1px solid #ccc;
background: #ddd;
padding: 2px 5px;
border-bottom: 1px solid #ccc;
font-weight: bold;
}
.search_results_entry {
margin: 0px;
padding: 2px 6px;
padding: 2px 5px;
}
.search_results_error {
@ -488,9 +470,9 @@ hr {
.export_heading {
margin: 0px;
padding: 3px 6px;
border: 1px solid #ccc;
background: #ddd;
padding: 2px 5px;
border-bottom: 1px solid #ccc;
font-weight: bold;
}
.export_bounds {
@ -531,11 +513,17 @@ hr {
/* Rules for the main content area */
#content {
padding: 0px;
padding: 10px;
margin: 0px;
position: absolute;
bottom: 10px;
line-height: 1.2em;
position: absolute;
bottom: 0px;
}
#content.site_index,
#content.site_edit,
#content.site_export {
border: 0px;
padding: 0px;
}
#slim_container {
@ -744,6 +732,7 @@ td.browse_comments table td span.by {
position: relative;
width: 90%;
height: 400px;
border: 1px solid #ccc;
display: none;
}
@ -847,6 +836,7 @@ p#contributorGuidance {
position: relative;
width: 500px;
height: 400px;
border: 1px solid #ccc;
}
#accountImage td {
@ -875,6 +865,7 @@ p#contributorGuidance {
position: relative;
width: 400px;
height: 400px;
border: 1px solid #ccc;
}
.user_view .user_map p#no_home_location {
@ -993,18 +984,20 @@ p#contributorGuidance {
.fieldName {
vertical-align: top;
font-weight: bold;
font-size: 12px;
line-height: 20px;
}
.minorNote {
font-size: 0.8em;
}
input[type="text"], input[type="email"], input[type="url"], input[type="password"], textarea {
border: 1px solid black;
}
input[type="submit"] {
border: 1px solid black;
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
textarea {
border: 1px solid #888;
}
/* Rules for user images */
@ -1042,11 +1035,11 @@ abbr.geo {
/* Rules for doing distinct colour of alternate table rows */
.table0 {
.table0 {
background: #f6f6f6;
}
.table1 {
.table1 {
background: #fff;
}

View file

@ -9,7 +9,7 @@
/* Rules for the main content area */
#content {
top: 35px;
top: 30px;
}
/* Rules for OpenLayers maps */

View file

@ -68,15 +68,15 @@ html body {
/* Rules for tabbed navigation bar */
#tabnav
{
padding-left: 215px;
#top-bar {
margin-left: 185px;
}
#tabnav a, #tabnav a:link, #tabnav a:visited
{
#tabnav a,
#tabnav a:link,
#tabnav a:visited {
float: left;
margin-right: 4px;
margin-right: 1px;
}
/* Rules for greeting bar in the top right corner */
@ -92,6 +92,12 @@ html body {
left: 15px
}
/* Rules for OpenLayers maps */
#map {
border-left: 1px solid #ccc;
}
/* Rules for attribution text under the main map shown on printouts */
.attribution_license {
@ -106,7 +112,7 @@ html body {
#sidebar {
left: 0px;
margin-right: 3px;
border-left: 1px solid #ccc;
}
#sidebar #sidebar_title {
@ -120,8 +126,9 @@ html body {
/* Rules for the main content area */
#content {
left: 192px;
right: 10px;
border-left: 1px solid #ccc;
left: 185px;
right: 0px;
text-align: left;
}
@ -187,12 +194,6 @@ html body {
float: right;
}
/* Rules for the login page */
#login_wrapper input[type=submit] {
float: right;
}
/* Rules for the account confirmation page */
form#termsForm div#buttons {
@ -230,7 +231,7 @@ form#termsForm input#agree {
text-align: right;
}
input.openid_url {
input.openid_url {
background: image-url('openid_input.png') repeat-y left white;
padding-left: 16px;
}

View file

@ -68,16 +68,15 @@ html body {
/* Rules for tabbed navigation bar */
#tabnav
{
padding-right: 215px;
#top-bar {
margin-right: 185px
}
#tabnav a, #tabnav a:link, #tabnav a:visited
{
#tabnav a,
#tabnav a:link,
#tabnav a:visited {
float: right;
margin-left: 4px;
margin-left: 1px;
}
/* Rules for greeting bar in the top right corner */
@ -93,6 +92,12 @@ html body {
right: 15px
}
/* Rules for OpenLayers maps */
#map {
border-right: 1px solid #ccc;
}
/* Rules for attribution text under the main map shown on printouts */
.attribution_license {
@ -107,7 +112,7 @@ html body {
#sidebar {
right: 0px;
margin-left: 3px;
border-right: 1px solid #ccc;
}
#sidebar #sidebar_title {
@ -121,8 +126,9 @@ html body {
/* Rules for the main content area */
#content {
right: 192px;
left: 10px;
border-right: 1px solid #ccc;
right: 185px;
left: 0px;
text-align: right;
}
@ -188,12 +194,6 @@ html body {
float: left;
}
/* Rules for the login page */
#login_wrapper input[type=submit] {
float: left;
}
/* Rules for the account confirmation page */
form#termsForm div#buttons {
@ -231,7 +231,7 @@ form#termsForm input#agree {
text-align: left;
}
input.openid_url {
input.openid_url {
background: image-url('openid_input.png') repeat-y right white;
padding-right: 16px;
}

View file

@ -17,24 +17,23 @@ h1 {
}
/* Rules for tabbed navigation bar */
#top-bar {
margin: 0;
}
#tabnav
{
#tabnav {
height: 14px;
margin: 0px;
padding-left: 3px;
padding-top: 5px;
margin-top: 18px;
background: image-url('tab_bottom.gif') repeat-x bottom;
font-size: 10px;
line-height: 10px;
}
#tabnav a, #tabnav a:link, #tabnav a:visited
{
#tabnav a, #tabnav a:link, #tabnav a:visited {
font-size: 10px;
line-height: 10px;
padding: 1px 5px;
padding: 2px 5px;
margin-right: 1px;
}

View file

@ -128,7 +128,7 @@ class AmfController < ApplicationController
def amf_handle_error_with_timeout(call,rootobj,rootid)
amf_handle_error(call,rootobj,rootid) do
Timeout::timeout(API_TIMEOUT, OSM::APITimeoutError) do
OSM::Timer.timeout(API_TIMEOUT, OSM::APITimeoutError) do
yield
end
end

View file

@ -1,4 +1,5 @@
class ApplicationController < ActionController::Base
include SessionPersistence
protect_from_forgery
@ -266,7 +267,7 @@ class ApplicationController < ActionController::Base
report_error message, :bad_request
rescue OSM::APIError => ex
report_error ex.message, ex.status
rescue ActionController::UnknownAction => ex
rescue AbstractController::ActionNotFound => ex
raise
rescue Exception => ex
logger.info("API threw unexpected #{ex.class} exception: #{ex.message}")
@ -286,7 +287,7 @@ class ApplicationController < ActionController::Base
##
# wrap an api call in a timeout
def api_call_timeout
SystemTimer.timeout_after(API_TIMEOUT) do
OSM::Timer.timeout(API_TIMEOUT) do
yield
end
rescue Timeout::Error
@ -296,11 +297,17 @@ class ApplicationController < ActionController::Base
##
# wrap a web page in a timeout
def web_timeout
SystemTimer.timeout_after(WEB_TIMEOUT) do
OSM::Timer.timeout(WEB_TIMEOUT) do
yield
end
rescue ActionView::TemplateError => ex
if ex.original_exception.is_a?(Timeout::Error)
rescue ActionView::Template::Error => ex
ex = ex.original_exception
if ex.is_a?(ActiveRecord::StatementInvalid) and ex.message =~ /^Timeout::Error/
ex = Timeout::Error.new
end
if ex.is_a?(Timeout::Error)
render :action => "timeout"
else
raise
@ -327,7 +334,7 @@ class ApplicationController < ActionController::Base
end)
options[:cache_path] = Proc.new do |controller|
cache_path.merge(controller.params).merge(:locale => I18n.locale)
cache_path.merge(controller.params).merge(:host => SERVER_URL, :locale => I18n.locale)
end
actions.push(options)
@ -339,7 +346,7 @@ class ApplicationController < ActionController::Base
# extend expire_action to expire all variants
def expire_action(options = {})
I18n.available_locales.each do |locale|
super options.merge(:locale => locale)
super options.merge(:host => SERVER_URL, :locale => locale)
end
end

View file

@ -276,6 +276,15 @@ class ChangesetController < ApplicationController
end
end
if params[:nearby]
if @user
changesets = changesets.where(:user_id => @user.nearby)
elsif request.format == :html
require_user
return
end
end
if params[:bbox]
bbox = BoundingBox.from_bbox_params(params)
elsif params[:minlon] and params[:minlat] and params[:maxlon] and params[:maxlat]
@ -295,6 +304,10 @@ class ChangesetController < ApplicationController
@title = t 'changeset.list.title_friend'
@heading = t 'changeset.list.heading_friend'
@description = t 'changeset.list.description_friend'
elsif params[:nearby] and @user
@title = t 'changeset.list.title_nearby'
@heading = t 'changeset.list.heading_nearby'
@description = t 'changeset.list.description_nearby'
elsif user and bbox
@title = t 'changeset.list.title_user_bbox', :user => user.display_name, :bbox => bbox.to_s
@heading = t 'changeset.list.heading_user_bbox', :user => user.display_name, :bbox => bbox.to_s
@ -319,9 +332,9 @@ class ChangesetController < ApplicationController
@bbox = bbox
@edits = changesets.order("changesets.created_at DESC").offset((@page - 1) * @page_size).limit(@page_size).preload(:user, :changeset_tags)
end
render :action => :list
render :action => :list
end
end
##

View file

@ -8,8 +8,9 @@ class DiaryEntryController < ApplicationController
before_filter :check_database_writable, :only => [:new, :edit]
before_filter :require_administrator, :only => [:hide, :hidecomment]
caches_action :list, :view, :layout => false
caches_action :list, :layout => false, :unless => :user_specific_list?
caches_action :rss, :layout => true
caches_action :view, :layout => false
cache_sweeper :diary_sweeper, :only => [:new, :edit, :comment, :hide, :hidecomment]
def new
@ -98,6 +99,34 @@ class DiaryEntryController < ApplicationController
},
:order => 'created_at DESC',
:per_page => 20)
elsif params[:friends]
if @user
@title = t 'diary_entry.list.title_friends'
@entry_pages, @entries = paginate(:diary_entries, :include => :user,
:conditions => {
:user_id => @user.friend_users,
:visible => true
},
:order => 'created_at DESC',
:per_page => 20)
else
require_user
return
end
elsif params[:nearby]
if @user
@title = t 'diary_entry.list.title_nearby'
@entry_pages, @entries = paginate(:diary_entries, :include => :user,
:conditions => {
:user_id => @user.nearby,
:visible => true
},
:order => 'created_at DESC',
:per_page => 20)
else
require_user
return
end
else
@title = t 'diary_entry.list.title'
@entry_pages, @entries = paginate(:diary_entries, :include => :user,
@ -166,6 +195,22 @@ class DiaryEntryController < ApplicationController
comment.update_attributes(:visible => false)
redirect_to :action => "view", :display_name => comment.diary_entry.user.display_name, :id => comment.diary_entry.id
end
def comments
@this_user = User.active.find_by_display_name(params[:display_name])
if @this_user
@comment_pages, @comments = paginate(:diary_comments,
:conditions => { :user_id => @this_user },
:order => 'created_at DESC',
:per_page => 20)
@page = (params[:page] || 1).to_i
else
@title = t'diary_entry.no_such_user.title'
@not_found_user = params[:display_name]
render :action => 'no_such_user', :status => :not_found
end
end
private
##
# require that the user is a administrator, or fill out a helpful error message
@ -176,4 +221,10 @@ private
redirect_to :controller => 'diary_entry', :action => 'view', :display_name => params[:id]
end
end
##
# is this list user specific?
def user_specific_list?
params[:friends] or params[:nearby]
end
end

View file

@ -1,5 +1,6 @@
class SiteController < ApplicationController
layout 'site', :except => [:key, :permalink]
layout false, :only => [:key, :permalink]
before_filter :authorize_web
before_filter :set_locale
@ -80,4 +81,8 @@ class SiteController < ApplicationController
@zoom = '17' if @zoom.nil?
end
end
def copyright
@locale = params[:copyright_locale] || I18n.locale
end
end

View file

@ -153,7 +153,7 @@ class TraceController < ApplicationController
@trace.errors.add(:gpx_file, "can't be blank")
end
else
@trace = Trace.new(:visibility => default_visibility)
@trace = Trace.new({:visibility => default_visibility}, :without_protection => true)
end
@title = t 'trace.create.upload_trace'
@ -163,7 +163,9 @@ class TraceController < ApplicationController
trace = Trace.find(params[:id])
if trace.visible? and (trace.public? or (@user and @user == trace.user))
if request.format == Mime::XML
if Acl.no_trace_download(request.remote_ip)
render :nothing => true, :status => :forbidden
elsif request.format == Mime::XML
send_file(trace.xml_file, :filename => "#{trace.id}.xml", :type => Mime::XML.to_s, :disposition => 'attachment')
else
send_file(trace.trace_name, :filename => "#{trace.id}#{trace.extension_name}", :type => trace.mime_type, :disposition => 'attachment')
@ -222,7 +224,7 @@ class TraceController < ApplicationController
end
if params[:tag]
traces = traces.where("EXISTS (SELECT * FROM gpx_file_tags AS gft WHERE gft.gpx_id = gpx_files.id AND gft.tag = ?)")
traces = traces.where("EXISTS (SELECT * FROM gpx_file_tags AS gft WHERE gft.gpx_id = gpx_files.id AND gft.tag = ?)", params[:tag])
end
traces = traces.order("timestamp DESC")
@ -384,7 +386,7 @@ private
:inserted => true,
:user => @user,
:timestamp => Time.now.getutc
})
}, :without_protection => true)
Trace.transaction do
begin

View file

@ -38,6 +38,8 @@ class UserController < ApplicationController
else
render :action => 'terms'
end
elsif params[:user] and Acl.no_account_creation(request.remote_ip, params[:user][:email].split("@").last)
render :action => 'blocked'
else
session[:referer] = params[:referer]
@ -79,9 +81,7 @@ class UserController < ApplicationController
def save
@title = t 'user.new.title'
if Acl.address(request.remote_ip).where(:k => "no_account_creation").exists?
render :action => 'new'
elsif params[:decline]
if params[:decline]
if @user
@user.terms_seen = true
@ -112,6 +112,8 @@ class UserController < ApplicationController
else
redirect_to :action => :account, :display_name => @user.display_name
end
elsif Acl.no_account_creation(request.remote_ip, params[:user][:email].split("@").last)
render :action => 'blocked'
else
@user = User.new(params[:user])
@ -269,6 +271,8 @@ class UserController < ApplicationController
:openid_url => params[:openid])
flash.now[:notice] = t 'user.new.openid association'
elsif Acl.no_account_creation(request.remote_ip)
render :action => 'blocked'
end
end
@ -512,8 +516,7 @@ private
elsif user = User.authenticate(:username => username, :password => password, :pending => true)
failed_login t('user.login.account not active', :reconfirm => url_for(:action => 'confirm_resend', :display_name => user.display_name))
elsif User.authenticate(:username => username, :password => password, :suspended => true)
webmaster = link_to t('user.login.webmaster'), "mailto:webmaster@openstreetmap.org"
failed_login t('user.login.account suspended', :webmaster => webmaster)
failed_login t('user.login.account is suspended', :webmaster => "mailto:webmaster@openstreetmap.org")
else
failed_login t('user.login.auth failure')
end
@ -546,8 +549,7 @@ private
when "active", "confirmed" then
successful_login(user)
when "suspended" then
webmaster = link_to t('user.login.webmaster'), "mailto:webmaster@openstreetmap.org"
failed_login t('user.login.account suspended', :webmaster => webmaster)
failed_login t('user.login.account is suspended', :webmaster => "mailto:webmaster@openstreetmap.org")
else
failed_login t('user.login.auth failure')
end
@ -622,7 +624,7 @@ private
cookies.permanent["_osm_username"] = user.display_name
session[:user] = user.id
session_expires_after 1.month if session[:remember_me]
session_expires_after 28.days if session[:remember_me]
target = session[:referer] || url_for(:controller => :site, :action => :index)
@ -661,6 +663,8 @@ private
if user.save
set_locale
cookies.permanent["_osm_username"] = user.display_name
if user.new_email.blank?
flash.now[:notice] = t 'user.account.flash update success'
else

View file

@ -11,7 +11,9 @@ class UserRolesController < ApplicationController
around_filter :setup_nonce
def grant
@this_user.roles.create(:role => @role, :granter_id => @user.id)
@this_user.roles.create({
:role => @role, :granter_id => @user.id
}, :without_protection => true)
redirect_to :controller => 'user', :action => 'view', :display_name => @this_user.display_name
end

View file

@ -89,7 +89,7 @@ module ApplicationHelper
url = "http://nominatim.openstreetmap.org/reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{language}"
begin
response = Timeout::timeout(4) do
response = OSM::Timer.timeout(4) do
REXML::Document.new(Net::HTTP.get(URI.parse(url)))
end
rescue Exception
@ -106,21 +106,13 @@ module ApplicationHelper
def user_image(user, options = {})
options[:class] ||= "user_image"
if user.image
image_tag url_for_file_column(user, "image"), options
else
image_tag "anon_large.png", options
end
image_tag user.image.url(:large), options
end
def user_thumbnail(user, options = {})
options[:class] ||= "user_thumbnail"
if user.image
image_tag url_for_file_column(user, "image"), options
else
image_tag "anon_small.png", options
end
image_tag user.image.url(:small), options
end
def preferred_editor

View file

@ -78,7 +78,7 @@ private
def wikipedia_link(key, value)
# Some k/v's are wikipedia=http://en.wikipedia.org/wiki/Full%20URL
return nil if value =~ /^http:\/\//
return nil if value =~ /^https?:\/\//
if key == "wikipedia"
# This regex should match Wikipedia language codes, everything

View file

@ -1,13 +1,17 @@
class Acl < ActiveRecord::Base
scope :address, lambda { |address| where("#{inet_aton} & netmask = address", address) }
private
def self.inet_aton
if self.connection.adapter_name == "MySQL"
"inet_aton(?)"
def self.match(address, domain = nil)
if domain
condition = Acl.where("address >>= ? OR domain = ?", address, domain)
else
"?"
condition = Acl.where("address >>= ?", address)
end
end
def self.no_account_creation(address, domain = nil)
self.match(address, domain).where(:k => "no_account_creation").exists?
end
def self.no_trace_download(address, domain = nil)
self.match(address, domain).where(:k => "no_trace_download").exists?
end
end

View file

@ -1,5 +1,5 @@
class ChangesetTag < ActiveRecord::Base
set_primary_keys :changeset_id, :k
self.primary_keys = "changeset_id", "k"
belongs_to :changeset

View file

@ -13,6 +13,11 @@ class ClientApplication < ActiveRecord::Base
validates_format_of :support_url, :with => /\Ahttp(s?):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i, :allow_blank=>true
validates_format_of :callback_url, :with => /\A[a-z][a-z0-9.+-]*:\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i, :allow_blank=>true
attr_accessible :name, :url, :support_url, :callback_url,
:allow_read_prefs, :allow_write_prefs,
:allow_write_diary, :allow_write_api,
:allow_read_gpx, :allow_write_gpx
before_validation :generate_keys, :on => :create
attr_accessor :token_callback_url
@ -54,7 +59,7 @@ class ClientApplication < ActiveRecord::Base
permissions.each do |p|
params[p] = true
end
RequestToken.create(params)
RequestToken.create(params, :without_protection => true)
end
def access_token_for_user(user)
@ -65,7 +70,7 @@ class ClientApplication < ActiveRecord::Base
params[p] = true
end
token = access_tokens.create(params)
token = access_tokens.create(params, :without_protection => true)
end
token

View file

@ -5,6 +5,8 @@ class DiaryComment < ActiveRecord::Base
validates_presence_of :body
validates_associated :diary_entry
attr_accessible :body
def digest
md5 = Digest::MD5.new
md5 << diary_entry_id.to_s

View file

@ -23,4 +23,6 @@ class DiaryEntry < ActiveRecord::Base
validates_numericality_of :longitude, :allow_nil => true,
:greater_than_or_equal_to => -180, :less_than_or_equal_to => 180
validates_associated :language
attr_accessible :title, :body, :language_code, :latitude, :longitude
end

View file

@ -27,9 +27,9 @@ private
expire_action(:controller => 'diary_entry', :action => 'list', :language => entry.language_code, :display_name => nil)
expire_action(:controller => 'diary_entry', :action => 'list', :language => nil, :display_name => entry.user.display_name)
expire_action(:controller => 'diary_entry', :action => 'rss', :language => nil, :display_name => nil)
expire_action(:controller => 'diary_entry', :action => 'rss', :language => entry.language_code, :display_name => nil)
expire_action(:controller => 'diary_entry', :action => 'rss', :language => nil, :display_name => entry.user.display_name)
expire_action(:controller => 'diary_entry', :action => 'rss', :format => :rss, :language => nil, :display_name => nil)
expire_action(:controller => 'diary_entry', :action => 'rss', :format => :rss, :language => entry.language_code, :display_name => nil)
expire_action(:controller => 'diary_entry', :action => 'rss', :format => :rss, :language => nil, :display_name => entry.user.display_name)
if record.is_a?(DiaryEntry)
expire_fragment(:controller => 'diary_entry', :action => 'view', :display_name => entry.user.display_name, :id => entry.id, :part => "location")

View file

@ -1,5 +1,5 @@
class Language < ActiveRecord::Base
set_primary_key :code
self.primary_key = "code"
has_many :diary_entries, :foreign_key => 'language'

View file

@ -9,6 +9,8 @@ class Message < ActiveRecord::Base
validates_inclusion_of :message_read, :in => [ true, false ]
validates_as_utf8 :title
attr_accessible :title, :body
def digest
md5 = Digest::MD5.new
md5 << from_user_id.to_s

View file

@ -4,7 +4,7 @@ class Node < ActiveRecord::Base
include GeoRecord
include ConsistencyValidations
set_table_name 'current_nodes'
self.table_name = "current_nodes"
belongs_to :changeset
@ -106,6 +106,10 @@ class Node < ActiveRecord::Base
# and set manually before the actual delete
node.visible = true
# Start with no tags
node.tags = Hash.new
# Add in any tags from the XML
pt.find('tag').each do |tag|
raise OSM::APIBadXMLError.new("node", pt, "tag is missing key") if tag['k'].nil?
raise OSM::APIBadXMLError.new("node", pt, "tag is missing value") if tag['v'].nil?

View file

@ -1,6 +1,6 @@
class NodeTag < ActiveRecord::Base
set_table_name 'current_node_tags'
set_primary_keys :node_id, :k
self.table_name = "current_node_tags"
self.primary_keys = "node_id", "k"
belongs_to :node

View file

@ -3,7 +3,9 @@
class OauthNonce < ActiveRecord::Base
validates_presence_of :nonce, :timestamp
validates_uniqueness_of :nonce, :scope => :timestamp
attr_accessible :nonce, :timestamp
# Remembers a nonce and it's associated timestamp. It returns false if it has already been used
def self.remember(nonce, timestamp)
oauth_nonce = OauthNonce.create(:nonce => nonce, :timestamp => timestamp)

View file

@ -2,8 +2,8 @@ class OldNode < ActiveRecord::Base
include GeoRecord
include ConsistencyValidations
set_table_name 'nodes'
set_primary_keys :node_id, :version
self.table_name = "nodes"
self.primary_keys = "node_id", "version"
validates_presence_of :changeset_id, :timestamp
validates_inclusion_of :visible, :in => [ true, false ]

View file

@ -1,6 +1,6 @@
class OldNodeTag < ActiveRecord::Base
set_table_name 'node_tags'
set_primary_keys :node_id, :version, :k
self.table_name = "node_tags"
self.primary_keys = "node_id", "version", "k"
belongs_to :old_node, :foreign_key => [:node_id, :version]

View file

@ -1,8 +1,8 @@
class OldRelation < ActiveRecord::Base
include ConsistencyValidations
set_table_name 'relations'
set_primary_keys :relation_id, :version
self.table_name = "relations"
self.primary_keys = "relation_id", "version"
belongs_to :changeset

View file

@ -1,6 +1,6 @@
class OldRelationMember < ActiveRecord::Base
set_table_name 'relation_members'
set_primary_keys :relation_id, :version, :sequence_id
self.table_name = "relation_members"
self.primary_keys = "relation_id", "version", "sequence_id"
belongs_to :old_relation, :foreign_key => [:relation_id, :version]
# A bit messy, referring to the current tables, should do for the data browser for now

View file

@ -1,6 +1,6 @@
class OldRelationTag < ActiveRecord::Base
set_table_name 'relation_tags'
set_primary_keys :relation_id, :version, :k
self.table_name = "relation_tags"
self.primary_keys = "relation_id", "version", "k"
belongs_to :old_relation, :foreign_key => [:relation_id, :version]

View file

@ -1,8 +1,8 @@
class OldWay < ActiveRecord::Base
include ConsistencyValidations
set_table_name 'ways'
set_primary_keys :way_id, :version
self.table_name = "ways"
self.primary_keys = "way_id", "version"
belongs_to :changeset

View file

@ -1,6 +1,6 @@
class OldWayNode < ActiveRecord::Base
set_table_name 'way_nodes'
set_primary_keys :way_id, :version, :sequence_id
self.table_name = "way_nodes"
self.primary_keys = "way_id", "version", "sequence_id"
belongs_to :old_way, :foreign_key => [:way_id, :version]
# A bit messy, referring to current nodes and ways, should do for the data browser for now

View file

@ -1,6 +1,6 @@
class OldWayTag < ActiveRecord::Base
set_table_name 'way_tags'
set_primary_keys :way_id, :version, :k
self.table_name = "way_tags"
self.primary_keys = "way_id", "version", "k"
belongs_to :old_way, :foreign_key => [:way_id, :version]

View file

@ -3,7 +3,7 @@ class Relation < ActiveRecord::Base
include ConsistencyValidations
set_table_name 'current_relations'
self.table_name = "current_relations"
belongs_to :changeset
@ -66,6 +66,10 @@ class Relation < ActiveRecord::Base
# and manually set to false before the actual delete.
relation.visible = true
# Start with no tags
relation.tags = Hash.new
# Add in any tags from the XML
pt.find('tag').each do |tag|
raise OSM::APIBadXMLError.new("relation", pt, "tag is missing key") if tag['k'].nil?
raise OSM::APIBadXMLError.new("relation", pt, "tag is missing value") if tag['v'].nil?

View file

@ -1,26 +1,7 @@
class RelationMember < ActiveRecord::Base
set_table_name 'current_relation_members'
set_primary_keys :relation_id, :sequence_id
self.table_name = "current_relation_members"
self.primary_keys = "relation_id", "sequence_id"
belongs_to :relation
belongs_to :member, :polymorphic => true
after_find :set_class_from_type
after_initialize :set_class_from_type
before_save :set_type_from_class
def member_type=(type)
self[:member_type] = type
self[:member_class] = type.capitalize
end
private
def set_class_from_type
self[:member_class] = self.member_type.classify unless self.member_type.nil?
end
def set_type_from_class
self.member_type = self[:member_class].classify
end
end

View file

@ -1,6 +1,6 @@
class RelationTag < ActiveRecord::Base
set_table_name 'current_relation_tags'
set_primary_keys :relation_id, :k
self.table_name = "current_relation_tags"
self.primary_keys = "relation_id", "k"
belongs_to :relation

View file

@ -21,7 +21,7 @@ class RequestToken < OauthToken
params[p] = read_attribute(p)
}
access_token = AccessToken.create(params)
access_token = AccessToken.create(params, :without_protection => true)
invalidate!
access_token
end

View file

@ -1,5 +1,5 @@
class Trace < ActiveRecord::Base
set_table_name 'gpx_files'
self.table_name = "gpx_files"
belongs_to :user
has_many :tags, :class_name => 'Tracetag', :foreign_key => 'gpx_id', :dependent => :delete_all

View file

@ -1,7 +1,7 @@
class Tracepoint < ActiveRecord::Base
include GeoRecord
set_table_name 'gps_points'
self.table_name = "gps_points"
validates_numericality_of :trackid, :only_integer => true
validates_numericality_of :latitude, :only_integer => true

View file

@ -1,8 +1,10 @@
class Tracetag < ActiveRecord::Base
set_table_name 'gpx_file_tags'
self.table_name = "gpx_file_tags"
validates_format_of :tag, :with => /^[^\/;.,?]*$/
validates_length_of :tag, :within => 1..255
attr_accessible :tag
belongs_to :trace, :foreign_key => 'gpx_id'
end

View file

@ -41,10 +41,15 @@ class User < ActiveRecord::Base
validates_numericality_of :home_zoom, :only_integer => true, :allow_nil => true
validates_inclusion_of :preferred_editor, :in => Editors::ALL_EDITORS, :allow_nil => true
attr_accessible :display_name, :email, :email_confirmation, :openid_url,
:pass_crypt, :pass_crypt_confirmation, :consider_pd
after_initialize :set_creation_time
before_save :encrypt_password
file_column :image, :magick => { :geometry => "100x100>" }
has_attached_file :image,
:default_url => "/assets/:class/:attachment/:style.png",
:styles => { :large => "100x100>", :small => "50x50>" }
def self.authenticate(options)
if options[:username] and options[:password]
@ -198,7 +203,7 @@ class User < ActiveRecord::Base
diary_entry_score = self.diary_entries.inject(0) { |s,e| s += OSM.spam_score(e.body) }
diary_comment_score = self.diary_comments.inject(0) { |s,e| s += OSM.spam_score(e.body) }
score = OSM.spam_score(self.description) * 2
score = OSM.spam_score(self.description)
score += diary_entry_score / self.diary_entries.length if self.diary_entries.length > 0
score += diary_comment_score / self.diary_comments.length if self.diary_comments.length > 0
score -= changeset_score

View file

@ -18,9 +18,11 @@ class UserBlock < ActiveRecord::Base
# revokes the block, allowing the user to use the API again. the argument
# is the user object who is revoking the ban.
def revoke!(revoker)
update_attributes({ :ends_at => Time.now.getutc(),
:revoker_id => revoker.id,
:needs_view => false })
update_attributes({
:ends_at => Time.now.getutc(),
:revoker_id => revoker.id,
:needs_view => false
}, :without_protection => true)
end
private

View file

@ -1,5 +1,6 @@
class UserPreference < ActiveRecord::Base
set_primary_keys :user_id, :k
self.primary_keys = "user_id", "k"
belongs_to :user
validates_length_of :k, :within => 1..255

View file

@ -16,11 +16,11 @@ private
(new_record.nil? or
old_record.visible? != new_record.visible? or
old_record.display_name != new_record.display_name or
old_record.image != new_record.image)
old_record.image.fingerprint != new_record.image.fingerprint)
old_record.diary_entries.each do |entry|
expire_action(:controller => 'diary_entry', :action => 'view', :display_name => old_record.display_name, :id => entry.id)
expire_action(:controller => 'diary_entry', :action => 'list', :language => entry.language_code, :display_name => nil)
expire_action(:controller => 'diary_entry', :action => 'rss', :language => entry.language_code, :display_name => nil)
expire_action(:controller => 'diary_entry', :action => 'rss', :format => :rss, :language => entry.language_code, :display_name => nil)
end
old_record.diary_comments.each do |comment|
@ -30,8 +30,8 @@ private
expire_action(:controller => 'diary_entry', :action => 'list', :language => nil, :display_name => nil)
expire_action(:controller => 'diary_entry', :action => 'list', :language => nil, :display_name => old_record.display_name)
expire_action(:controller => 'diary_entry', :action => 'rss', :language => nil, :display_name => nil)
expire_action(:controller => 'diary_entry', :action => 'rss', :language => nil, :display_name => old_record.display_name)
expire_action(:controller => 'diary_entry', :action => 'rss', :format => :rss, :language => nil, :display_name => nil)
expire_action(:controller => 'diary_entry', :action => 'rss', :format => :rss, :language => nil, :display_name => old_record.display_name)
old_record.traces.each do |trace|
expire_action(:controller => 'trace', :action => 'view', :id => trace.id)

View file

@ -1,6 +1,8 @@
class UserToken < ActiveRecord::Base
belongs_to :user
attr_accessible :referer
after_initialize :set_defaults
private

View file

@ -3,7 +3,7 @@ class Way < ActiveRecord::Base
include ConsistencyValidations
set_table_name 'current_ways'
self.table_name = "current_ways"
belongs_to :changeset
@ -64,6 +64,10 @@ class Way < ActiveRecord::Base
# and manually set to false before the actual delete.
way.visible = true
# Start with no tags
way.tags = Hash.new
# Add in any tags from the XML
pt.find('tag').each do |tag|
raise OSM::APIBadXMLError.new("way", pt, "tag is missing key") if tag['k'].nil?
raise OSM::APIBadXMLError.new("way", pt, "tag is missing value") if tag['v'].nil?

View file

@ -1,6 +1,6 @@
class WayNode < ActiveRecord::Base
set_table_name 'current_way_nodes'
set_primary_keys :way_id, :sequence_id
self.table_name = "current_way_nodes"
self.primary_keys = "way_id", "sequence_id"
belongs_to :way
belongs_to :node

View file

@ -1,6 +1,6 @@
class WayTag < ActiveRecord::Base
set_table_name 'current_way_tags'
set_primary_keys :way_id, :k
self.table_name = "current_way_tags"
self.primary_keys = "way_id", "k"
belongs_to :way

View file

@ -33,8 +33,7 @@
</tr>
<tr>
<td><%=bbox.min_lon -%></td>
<td>(<a href='/?minlon=<%= bbox.min_lon %>&minlat=<%= bbox.min_lat %>&maxlon=<%= bbox.max_lon %>&maxlat=<%= bbox.max_lat %>
&box=yes' title='<%= t 'browse.changeset_details.show_area_box' %>'><%= t 'browse.changeset_details.box' %></a>)</td>
<td>(<%= link_to t('browse.changeset_details.box'), root_path(:minlon => bbox.min_lon, :minlat => bbox.min_lat, :maxlon => bbox.max_lon, :maxlat => bbox.max_lat, :box => 'yes'), :title => t('browse.changeset_details.show_area_box') %>)</td>
<td><%=bbox.max_lon -%></td>
</tr>
<tr>

View file

@ -6,7 +6,7 @@
<%= stylesheet_link_tag 'browse' %>
<% end %>
<%= render :partial => "navigation" %>
<h2><%= t'browse.node.node_title', :node_name => h(@name) %></h2>
<h2><%= t'browse.node.node_title', :node_name => @name %></h2>
<%= render :partial => "map", :object => @node %>
<%= render :partial => "node_details", :object => @node %>
<hr />

View file

@ -6,7 +6,7 @@
<%= stylesheet_link_tag 'browse' %>
<% end %>
<%= render :partial => "navigation" %>
<h2><%= t'browse.relation.relation_title', :relation_name => h(@name) %></h2>
<h2><%= t'browse.relation.relation_title', :relation_name => @name %></h2>
<%= render :partial => "map", :object => @relation %>
<%= render :partial => "relation_details", :object => @relation %>
<hr />

View file

@ -6,7 +6,7 @@
<%= stylesheet_link_tag 'browse' %>
<% end %>
<%= render :partial => "navigation" %>
<h2><%= t'browse.way.way_title', :way_name => h(@name) %></h2>
<h2><%= t'browse.way.way_title', :way_name => @name %></h2>
<%= render :partial => "map", :object => @way %>
<%= render :partial => "way_details", :object => @way %>
<hr />

View file

@ -10,8 +10,10 @@
<%= render :partial => 'changeset_paging_nav' %>
<% unless params[:friends] or params[:nearby] -%>
<%= atom_link_to params.merge({ :page => nil, :action => :feed }) %>
<% content_for :head do %>
<% content_for :head do -%>
<%= auto_discovery_link_tag :atom, params.merge({ :page => nil, :action => :feed }) %>
<% end %>
<% end -%>
<% end -%>

View file

@ -0,0 +1,23 @@
<h1><%= t('diary_entry.comments.has_commented_on', :display_name => @this_user.display_name) %></h1>
<table width="100%">
<tr>
<th><%= t 'diary_entry.comments.post' %></th>
<th><%= t 'diary_entry.comments.when' %></th>
<th><%= t 'diary_entry.comments.comment' %></th>
</tr>
<% @comments.each do |comment| -%>
<% cl = cycle('table0', 'table1') %>
<tr class="<%= cl %>">
<td><%= link_to comment.diary_entry.title, :action => :view, :display_name => comment.diary_entry.user.display_name, :id => comment.diary_entry.id %></td>
<td><span title="<%= l comment.created_at, :format => :friendly %>"><%= t 'diary_entry.comments.ago', :ago => time_ago_in_words(comment.created_at) %></span></td>
<td><%= htmlize(comment.body) %></td>
</tr>
<% end -%>
</table>
<%= link_to t('diary_entry.comments.older_comments') , { :page => @comment_pages.current.next} if @comment_pages.current.next %>
<% if @comment_pages.current.next and @comment_pages.current.previous %>
|
<% end %>
<%= link_to t('diary_entry.comments.newer_comments'), { :page => @comment_pages.current.previous } if @comment_pages.current.previous %>

View file

@ -34,8 +34,10 @@
<br />
<% end %>
<% unless params[:friends] or params[:nearby] -%>
<%= rss_link_to :action => 'rss', :language => params[:language] %>
<% content_for :head do %>
<% content_for :head do -%>
<%= auto_discovery_link_tag :atom, :action => 'rss', :language => params[:language] %>
<% end %>
<% end -%>
<% end -%>

View file

@ -20,9 +20,7 @@
<p>
<%= radio_button_tag("format", "osm") %> <%= t'export.start.osm_xml_data' %>
<br/>
<%= radio_button_tag("format", "mapnik") %> <%= t'export.start.mapnik_image' %>
<br/>
<%= radio_button_tag("format", "osmarender") %> <%= t'export.start.osmarender_image' %>
<%= radio_button_tag("format", "mapnik") %> <%= t'export.start.map_image' %>
<br/>
<%= radio_button_tag("format", "html") %> <%= t'export.start.embeddable_html' %>
</p>
@ -54,15 +52,6 @@
</div>
</div>
<div id="export_osmarender">
<p class="export_heading"><%= t'export.start.options' %></p>
<div class="export_details">
<p><%= t'export.start.format' %> <%= select_tag("osmarender_format", options_for_select([["PNG", "png"], ["JPEG", "jpeg"]], "png")) %></p>
<p><%= t'export.start.zoom' %> <%= select_tag("osmarender_zoom", options_for_select([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17])) %></p>
</div>
</div>
<div id="export_html">
<p class="export_heading"><%= t'export.start.options' %></p>

View file

@ -45,7 +45,6 @@ function startExport() {
$("#format_osm").click(formatChanged);
$("#format_mapnik").click(formatChanged);
$("#format_osmarender").click(formatChanged);
$("#format_html").click(formatChanged);
$("#mapnik_scale").change(mapnikSizeChanged);
@ -54,8 +53,6 @@ function startExport() {
if (map.baseLayer.name == "Mapnik") {
$("#format_mapnik").prop("checked", true);
} else if (map.baseLayer.name == "Osmarender") {
$("#format_osmarender").prop("checked", true);
}
formatChanged();
@ -227,20 +224,6 @@ function validateControls() {
}
$("#mapnik_max_scale").html(roundScale(max_scale));
var max_zoom = maxOsmarenderZoom();
$("#osmarender_zoom option").each(function () {
if ($(this).val() > max_zoom) {
$(this).prop("disabled", true);
} else {
$(this).prop("disabled", false);
}
});
if ($("#osmarender_zoom option").is(":disabled:selected")) {
$("#osmarender_zoom option").filter(":enabled").last().prop("selected", true);
}
}
function htmlUrlChanged() {
@ -291,15 +274,6 @@ function formatChanged() {
$("#export_mapnik").hide();
}
if ($("#format_osmarender").prop("checked")) {
var zoom = Math.min(map.getZoom(), maxOsmarenderZoom());
$("#osmarender_zoom option[value=" + zoom + "]").prop("selected", true);
$("#export_osmarender").show();
} else {
$("#export_osmarender").hide();
}
if ($("#format_html").prop("checked")) {
$("#export_html").show();
$("#export_commit").hide();
@ -334,16 +308,6 @@ function mapnikImageSize(scale) {
Math.round(bounds.getHeight() / scale / 0.00028));
}
function maxOsmarenderZoom() {
var bounds = new OpenLayers.Bounds($("#minlon").val(), $("#minlat").val(), $("#maxlon").val(), $("#maxlat").val());
var xzoom = Math.LOG2E * Math.log(2000 * 1.40625 / bounds.getWidth());
var ymin = bounds.bottom * Math.PI / 180;
var ymax = bounds.top * Math.PI / 180;
var yzoom = Math.LOG2E * (Math.log(2000 * 2 * Math.PI) - Math.log(Math.log((Math.tan(ymax) + 1 / Math.cos(ymax)) / (Math.tan(ymin) + 1 / Math.cos(ymin)))))
return Math.min(Math.floor(Math.min(xzoom, yzoom)), 17);
}
function roundScale(scale) {
var precision = 5 * Math.pow(10, Math.floor(Math.LOG10E * Math.log(scale)) - 2);

View file

@ -9,11 +9,12 @@
<%= stylesheet_link_tag "print-#{t 'html.dir'}", :media => "print" %>
<!--[if IE]><%= stylesheet_link_tag "large-#{t 'html.dir'}", :media => "screen" %><![endif]--> <!-- IE is totally broken with CSS media queries -->
<%= favicon_link_tag "favicon.ico" %>
<%= favicon_link_tag "osm_logo.png", :rel => "apple-touch-icon", :type => "image/png" %>
<%= tag("link", { :rel => "publisher", :href => "https://plus.google.com/111953119785824514010" }) %>
<%= tag("link", { :rel => "search", :type => "application/opensearchdescription+xml", :title => "OpenStreetMap Search", :href => asset_path("osm.xml") }) %>
<%= tag("meta", { :name => "description", :content => "OpenStreetMap is the free wiki world map." }) %>
<%= style_rules %>
<%= yield :head %>
<%= csrf_meta_tag %>
<title><%= t 'layouts.project_name.title' %><%= ' | '+ h(@title) if @title %></title>
<title><%= t 'layouts.project_name.title' %><%= ' | '+ @title if @title %></title>
</head>

View file

@ -1,7 +1,7 @@
<!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>
<body class="<%= params[:controller] %>">
<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>
@ -12,20 +12,19 @@
<%= yield %>
</div>
<span id="greeting">
<% if @user and @user.id %>
<span id="full-greeting"><%= raw(t 'layouts.welcome_user', :user_link => (link_to h(@user.display_name), {:controller => 'user', :action => 'view', :display_name => @user.display_name}, :title => t('layouts.welcome_user_link_tooltip'))) %></span>
<span id="small-greeting"><%= link_to t('layouts.welcome_user_link_tooltip'), {:controller => 'user', :action => 'view', :display_name => @user.display_name} %></span> |
<%= yield :greeting %>
<%= render :partial => "layouts/inbox" %> |
<%= link_to t('layouts.logout'), {:controller => 'user', :action => 'logout', :session => request.session_options[:id], :referer => request.fullpath}, {:id => 'logoutanchor', :title => t('layouts.logout_tooltip')}%>
<% else %>
<%= link_to t('layouts.log_in'), {:controller => 'user', :action => 'login', :referer => request.fullpath}, {:id => 'loginanchor', :title => t('layouts.log_in_tooltip')} %> |
<%= link_to t('layouts.sign_up'), {:controller => 'user', :action => 'new'}, {:id => 'registeranchor', :title => t('layouts.sign_up_tooltip')} %>
<% end %>
</span>
<div>
<div id='top-bar'>
<span id="greeting">
<% if @user and @user.id %>
<span id="full-greeting"><%= raw(t 'layouts.welcome_user', :user_link => (link_to h(@user.display_name), {:controller => 'user', :action => 'view', :display_name => @user.display_name}, :title => t('layouts.welcome_user_link_tooltip'))) %></span>
<span id="small-greeting"><%= link_to t('layouts.welcome_user_link_tooltip'), {:controller => 'user', :action => 'view', :display_name => @user.display_name} %></span> |
<%= yield :greeting %>
<%= render :partial => "layouts/inbox" %> |
<%= link_to t('layouts.logout'), {:controller => 'user', :action => 'logout', :session => request.session_options[:id], :referer => request.fullpath}, {:id => 'logoutanchor', :title => t('layouts.logout_tooltip')}%>
<% else %>
<%= link_to t('layouts.log_in'), {:controller => 'user', :action => 'login', :referer => request.fullpath}, {:id => 'loginanchor', :title => t('layouts.log_in_tooltip')} %> |
<%= link_to t('layouts.sign_up'), {:controller => 'user', :action => 'new'}, {:id => 'registeranchor', :title => t('layouts.sign_up_tooltip')} %>
<% end %>
</span>
<ul id="tabnav">
<%
viewclass = 'geolink llz layers'
@ -64,11 +63,9 @@
<div id="left">
<div id="logo">
<center>
<h1><%= t 'layouts.project_name.h1' %></h1>
<%= link_to(image_tag("osm_logo.png", :size => "120x120", :border => 0, :alt => t('layouts.logo.alt_text')), :controller => 'site', :action => 'index') %><br/>
<h2 class="nowrap"><%= t('layouts.tag_line') %></h2>
</center>
<%= link_to(image_tag("osm_logo.png", :size => "120x120", :border => 0, :alt => t('layouts.logo.alt_text')), :controller => 'site', :action => 'index') %><br/>
<h1><%= t 'layouts.project_name.h1' %></h1>
<h2 class="nowrap"><%= t('layouts.tag_line') %></h2>
</div>
<%= yield :optionals %>

View file

@ -1 +1,8 @@
<p id="inbox-count"><%= t'message.inbox.you_have', :new_count => @user.new_messages.size, :old_count => (@user.messages.size - @user.new_messages.size) %></p>
<p id="inbox-count">
<%= t "message.inbox.messages",
:new_messages => t("message.inbox.new_messages",
:count => @user.new_messages.size),
:old_messages => t("message.inbox.old_messages",
:count => @user.messages.size - @user.new_messages.size)
%>
</p>

View file

@ -1,6 +1,6 @@
<h2><%= raw(t'message.outbox.my_inbox', :inbox_link => link_to(t('message.outbox.inbox'), url_for(:controller => "user", :action => "inbox", :id => @user.display_name))) %>/<%= t'message.outbox.outbox' %></h2>
<p><%= t'message.outbox.you_have_sent_messages', :count => @user.sent_messages.size %>
<p><%= t'message.outbox.messages', :count => @user.sent_messages.size %>
<% if @user.sent_messages.size > 0 %>
<div id="messages">

View file

@ -16,6 +16,8 @@
}
function resizeMap() {
var content_width = $("#content").width();
var content_height = $("#content").height();
var sidebar_width = 0 + $("#sidebar:visible").outerWidth(true);
var left_border = parseFloat($("#map").css("border-left-width"));
var right_border = parseFloat($("#map").css("border-right-width"));
@ -27,8 +29,8 @@
<% else -%>
$("#map").css("right", (sidebar_width) + "px");
<% end -%>
$("#map").width($("#content").width() - sidebar_width - left_border - right_border);
$("#map").height($("#content").height() - top_border - bottom_border);
$("#map").width(content_width - sidebar_width - left_border - right_border);
$("#map").height(content_height - top_border - bottom_border);
<% if params[:controller] == "site" and params[:action] == "index" -%>
map.updateSize();

View file

@ -10,9 +10,9 @@
{ :rel => "license" }) %>
</p>
<% if I18n.locale == 'en' or params[:copyright_locale] == 'en' %>
<% if @locale == 'en' %>
<!-- Maybe ease foreigners back to their native page -->
<% if t('license_page.legal_babble') != t('license_page.legal_babble', :locale => :en) %>
<% if t('license_page.legal_babble', :locale => I18n.locale) != t('license_page.legal_babble', :locale => :en) %>
<h2><%= t 'license_page.native.title' %></h2>
<p>
<%= raw t 'license_page.native.text',
@ -25,11 +25,9 @@
</p>
<hr />
<% end %>
<%= raw t('license_page.legal_babble', :locale => :en) %>
<% else %>
<!-- Maybe note that this page has been translated -->
<% if t('license_page.legal_babble') != t('license_page.legal_babble', :locale => :en) %>
<% if t('license_page.legal_babble', :locale => @locale) != t('license_page.legal_babble', :locale => :en) %>
<h2><%= t 'license_page.foreign.title' %></h2>
<p>
<%= raw t 'license_page.foreign.text',
@ -40,6 +38,6 @@
</p>
<hr />
<% end %>
<%= raw t('license_page.legal_babble') %>
<% end %>
<%= raw t('license_page.legal_babble', :locale => @locale) %>

View file

@ -18,7 +18,7 @@
<div id="map">
<div id="permalink">
<a href="/" id="permalinkanchor" class="geolink llz layers object"><%= t 'site.index.permalink' %></a><br/>
<a href="/" id="permalinkanchor" class="geolink llz layers object"><%= t 'site.index.permalink' %></a>
<a href="/" id="shortlinkanchor"><%= t 'site.index.shortlink' %></a>
<a href="#" id="createnoteanchor">Report a problem</a>
</div>

View file

@ -81,13 +81,10 @@
<%= t 'user.account.image' %>
</td>
<td valign="top">
<% if @user.image.nil? %>
<%= hidden_field_tag "image_action", "new" %>
<%= t 'user.account.new image' %><br /><%= file_column_field "user", "image" %><br /><span class="minorNote"><%= t 'user.account.image size hint' %></span>
<% else %>
<% if @user.image.file? %>
<table id="accountImage">
<tr>
<td rowspan="3" valign="top"><%= image_tag url_for_file_column(@user, "image"), :class => "user_image" %></td>
<td rowspan="3" valign="top"><%= user_image @user %></td>
<td><%= radio_button_tag "image_action", "keep", true %></td>
<td><%= t 'user.account.keep image' %></td>
</tr>
@ -97,9 +94,12 @@
</tr>
<tr>
<td><%= radio_button_tag "image_action", "new" %></td>
<td><%= t 'user.account.replace image' %><br /><%= file_column_field "user", "image", :onchange => "$('image_action_new').checked = true" %><br /><span class="minorNote"><%= t 'user.account.image size hint' %></span></td>
<td><%= t 'user.account.replace image' %><br /><%= f.file_field :image, :onchange => "$('image_action_new').prop('checked', true)" %><br /><span class="minorNote"><%= t 'user.account.image size hint' %></span></td>
</tr>
</table>
<% else %>
<%= hidden_field_tag "image_action", "new" %>
<%= t 'user.account.new image' %><br /><%= f.file_field :image %><br /><span class="minorNote"><%= t 'user.account.image size hint' %></span>
<% end %>
</td>
</tr>

View file

@ -14,8 +14,8 @@ xml.osm("version" => API_VERSION, "generator" => GENERATOR) do
:lon => @user.home_lon,
:zoom => @user.home_zoom
end
if @user.image
xml.tag! "img", :href => (url_for_file_column(@user, "image", :absolute => true))
if @user.image.file?
xml.tag! "img", :href => "http://#{SERVER_URL}#{@user.image.url}"
end
if @user.languages
xml.tag! "languages" do

View file

@ -0,0 +1,5 @@
<h1><%= t 'user.new.heading' %></h1>
<p><%= t 'user.new.no_auto_account_create' %></p>
<p><%= raw t 'user.new.contact_webmaster' %></p>

View file

@ -18,7 +18,7 @@
:count => @user_pages.current_page.last_item - @user_pages.current_page.first_item + 1
%>
<% if @user_pages.page_count > 1 %>
| <%= pagination_links_each(@user_pages, {}) { |n| link_to n, params.merge(:page => n) } %>
| <%= raw pagination_links_each(@user_pages, {}) { |n| link_to n, params.merge(:page => n) } %>
<% end %>
</td>
<td>

View file

@ -6,14 +6,25 @@
<%= form_tag({ :action => "login" }, { :id => "login_form" }) do %>
<%= hidden_field_tag('referer', h(params[:referer])) %>
<p><%= t 'user.login.with username' %></p>
<p><%= t 'user.login.no account' %> <%= link_to t('user.login.register now'), :action => :new, :referer => params[:referer] %></p>
<table id="loginForm">
<tr><td class="fieldName"><%= t 'user.login.email or username' %></td><td><%= text_field_tag "username", params[:username], :size => 28, :maxlength => 255, :tabindex => 1 %></td></tr>
<tr><td class="fieldName"><%= t 'user.login.password' %></td><td><%= password_field_tag "password", "", :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></td>
<td><%= check_box_tag "remember_me", "yes", false, :tabindex => 3 %>
<label for="remember_me">
<%= t 'user.login.remember' %></label>
</td>
</tr>
<tr>
<td></td>
<td>
<%= submit_tag t('user.login.login_button'), :tabindex => 4 %>
</td>
</tr>
</table>
<%= submit_tag t('user.login.login_button'), :tabindex => 3 %>
<br clear="all" />
@ -51,16 +62,6 @@
<br clear="all" />
</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><%= button_to t('user.login.register now'), :action => :new, :referer => params[:referer] %></p>
<br clear="both">
</div>
</div>
<script type="text/javascript">

View file

@ -1,13 +1,5 @@
<h1><%= t 'user.new.heading' %></h1>
<% if Acl.address(request.remote_ip).where(:k => "no_account_creation").exists? %>
<p><%= t 'user.new.no_auto_account_create' %></p>
<p><%= t 'user.new.contact_webmaster' %></p>
<% else %>
<p><%= t 'user.new.fill_form' %></p>
<%= error_messages_for 'user' %>
@ -102,5 +94,3 @@ enableOpenID();
disableOpenID();
<% end -%>
</script>
<% end %>

View file

@ -21,6 +21,8 @@
|
<%= link_to t('user.view.new diary entry'), :controller => 'diary_entry', :action => 'new', :display_name => @user.display_name %>
|
<%= link_to t('user.view.my comments' ), :controller => 'diary_entry', :action => 'comments', :display_name => @this_user.display_name %>
|
<%= link_to t('user.view.my edits'), :controller => 'changeset', :action => 'list', :display_name => @user.display_name %>
|
<%= link_to t('user.view.my traces'), :controller => 'trace', :action=> 'mine' %>
@ -41,6 +43,8 @@
|
<%= link_to t('user.view.diary'), :controller => 'diary_entry', :action => 'list', :display_name => @this_user.display_name %>
|
<%= link_to t('user.view.comments'), :controller => 'diary_entry', :action => 'comments', :display_name => @this_user.display_name %>
|
<%= link_to t('user.view.edits'), :controller => 'changeset', :action => 'list', :display_name => @this_user.display_name %>
|
<%= link_to t('user.view.traces'), :controller => 'trace', :action => 'list', :display_name => @this_user.display_name %>
@ -122,7 +126,8 @@
<% if friends.empty? %>
<%= t 'user.view.no friends' %>
<% else %>
<%= link_to t('user.view.friends_changesets'), {:controller => 'browse', :action => 'friends'} %><br/><br/>
<%= link_to t('user.view.friends_changesets'), {:controller => 'browse', :action => 'friends'} %><br/>
<%= link_to t('user.view.friends_diaries'), {:controller => 'diary', :action => 'friends'} %><br/><br/>
<table id="friends">
<%= render :partial => "contact", :collection => friends %>
</table>
@ -133,6 +138,8 @@
<% if nearby.empty? %>
<%= t 'user.view.no nearby users' %>
<% else %>
<%= link_to t('user.view.nearby_changesets'), {:controller => 'browse', :action => 'nearby'} %><br/>
<%= link_to t('user.view.nearby_diaries'), {:controller => 'diary', :action => 'nearby'} %><br/><br/>
<table id="nearbyusers">
<%= render :partial => "contact", :collection => nearby %>
</table>

View file

@ -14,7 +14,7 @@ end
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require *Rails.groups(:assets => %w(development test))
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
@ -51,17 +51,28 @@ module OpenStreetMap
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password, :pass_crypt, :pass_crypt_confirmation]
# Use SQL instead of Active Record's schema dumper when creating the database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
unless STATUS == :database_offline
config.active_record.schema_format = :sql
end
# Enforce whitelist mode for mass assignment.
# This will create an empty whitelist of attributes available for mass-assignment for all models
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
# parameters by using an attr_accessible or attr_protected declaration.
config.active_record.whitelist_attributes = true
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
# Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
unless STATUS == :database_offline
config.active_record.schema_format = :sql
# Don't eager load models when the database is offline
if STATUS == :database_offline
config.paths["app/models"].skip_eager_load!
end
end
end

View file

@ -2,7 +2,7 @@ OpenStreetMap::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
@ -11,7 +11,6 @@ OpenStreetMap::Application.configure do
# Show full error reports and disable caching
config.consider_all_requests_local = true
# config.action_view.debug_rjs = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
@ -23,6 +22,13 @@ OpenStreetMap::Application.configure do
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
config.active_record.auto_explain_threshold_in_seconds = 0.5
# Do not compress assets
config.assets.compress = false

View file

@ -36,18 +36,20 @@ OpenStreetMap::Application.configure do
# See everything in the log (default is :info)
# config.log_level = :debug
# Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ]
# Use a different log path in production
if defined?(LOG_PATH)
config.paths["log"] = LOG_PATH
end
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
if defined?(MEMCACHE_SERVERS)
MEMCACHE = Memcached::Rails.new(MEMCACHE_SERVERS, :binary_protocol => true)
config.cache_store = :mem_cache_store, MEMCACHE
config.cache_store = :mem_cache_store, MemCache.new(:namespace => "rails:cache", :no_block => true, :buffer_requests => true, :noreply => true)
end
# Enable serving of images, stylesheets, and JavaScripts from an asset server
@ -72,4 +74,8 @@ OpenStreetMap::Application.configure do
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
end

View file

@ -2,9 +2,9 @@ OpenStreetMap::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Configure static asset server for tests with Cache-Control for performance
@ -29,9 +29,9 @@ OpenStreetMap::Application.configure do
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
# Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
config.assets.allow_debugging = true
end

View file

@ -57,8 +57,8 @@ defaults: &defaults
# Location of GPX traces and images
gpx_trace_dir: "/home/osm/traces"
gpx_image_dir: "/home/osm/images"
# Location of data for file columns
#file_column_root: ""
# Location of data for attachments
attachments_dir: ":rails_root/public/attachments"
# Log file to use
#log_path: ""
# List of memcache servers to use for caching

View file

@ -0,0 +1,19 @@
module ActionController
module Caching
module Actions
class ActionCachePath
def initialize(controller, options = {}, infer_extension = true)
if infer_extension
@extension = controller.params[:format]
options.reverse_merge!(:format => @extension) if options.is_a?(Hash)
else
@extension = options[:format]
end
path = controller.url_for(options).split(%r{://}).last
@path = normalize!(path)
end
end
end
end
end

View file

@ -9,10 +9,8 @@ ActionMailer::Base.smtp_settings = {
# Monkey patch to allow sending of messages in specific locales
module ActionMailer
class Base
adv_attr_accessor :locale
def mail_with_locale(*args)
old_locale= I18n.locale
old_locale = I18n.locale
begin
I18n.locale = @locale

View file

@ -7,7 +7,7 @@ module ActiveSupport
return if @level > severity
message = (message || (block && block.call) || progname).to_s
time = Time.now
message = "[%s.%06d #%d] %s\n" % [time.strftime("%Y-%m-%d %H:%M:%S"), time.usec, $$, message.sub(/^\n+/, "")]
message = "[%s.%06d #%d] %s" % [time.strftime("%Y-%m-%d %H:%M:%S"), time.usec, $$, message.sub(/^\n+/, "")]
old_add(severity, message)
end
end

View file

@ -21,8 +21,8 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
require 'pagination'
require 'pagination_helper'
require 'classic_pagination/pagination'
require 'classic_pagination/pagination_helper'
ActionController::Base.class_eval do
include ActionController::Pagination

View file

@ -1,80 +0,0 @@
module ActiveRecord
module Associations
class AssociationScope
def add_constraints(scope)
tables = construct_tables
chain.each_with_index do |reflection, i|
table, foreign_table = tables.shift, tables.first
if reflection.source_macro == :has_and_belongs_to_many
join_table = tables.shift
# CPK
# scope = scope.joins(join(
# join_table,
# table[reflection.active_record_primary_key].
# eq(join_table[reflection.association_foreign_key])
#))
predicate = cpk_join_predicate(table, reflection.association_primary_key,
join_table, reflection.association_foreign_key)
scope = scope.joins(join(join_table, predicate))
table, foreign_table = join_table, tables.first
end
if reflection.source_macro == :belongs_to
if reflection.options[:polymorphic]
key = reflection.association_primary_key(klass)
else
key = reflection.association_primary_key
end
foreign_key = reflection.foreign_key
else
key = reflection.foreign_key
foreign_key = reflection.active_record_primary_key
end
conditions = self.conditions[i]
if reflection == chain.last
# CPK
# scope = scope.where(table[key].eq(owner[foreign_key]))
predicate = cpk_join_predicate(table, key, owner, foreign_key)
scope = scope.where(predicate)
if reflection.type
scope = scope.where(table[reflection.type].eq(owner.class.base_class.name))
end
conditions.each do |condition|
if options[:through] && condition.is_a?(Hash)
condition = { table.name => condition }
end
scope = scope.where(interpolate(condition))
end
else
# CPK
# constraint = table[key].eq(foreign_table[foreign_key])
constraint = cpk_join_predicate(table, key, foreign_table, foreign_key)
if reflection.type
type = chain[i + 1].klass.base_class.name
constraint = constraint.and(table[reflection.type].eq(type))
end
scope = scope.joins(join(foreign_table, constraint))
unless conditions.empty?
scope = scope.where(sanitize(conditions, table))
end
end
end
scope
end
end
end
end

View file

@ -1,3 +0,0 @@
if defined?(FILE_COLUMN_ROOT)
FileColumn::ClassMethods::DEFAULT_OPTIONS[:root_path] = FILE_COLUMN_ROOT
end

View file

@ -0,0 +1,12 @@
#
# Monkey patch HttpAcceptLanguage pending integration of
# https://github.com/iain/http_accept_language/pull/6
#
module HttpAcceptLanguage
def compatible_language_from(available_languages)
user_preferred_languages.find do |x|
available_languages.find { |y| y.to_s == x.to_s } ||
available_languages.find { |y| y.to_s =~ /^#{Regexp.escape(x.to_s)}-/ }
end
end
end

View file

@ -1,5 +1,17 @@
module I18n
module Backend
class Simple
def init_translations_with_mn_cleanup
init_translations_without_mn_cleanup
translations[:mn][:errors][:template].delete(:body)
translations[:mn][:activemodel][:errors][:template].delete(:body)
translations[:mn][:activerecord][:errors][:template].delete(:body)
end
alias_method_chain :init_translations, :mn_cleanup
end
module Fallbacks
def find_first_string_or_lambda_default(defaults)
defaults.each_with_index { |default, ix| return ix if default && !default.is_a?(Symbol) }
@ -18,14 +30,7 @@ module I18n
end
end
I18n::Backend::Simple.include(I18n::Backend::Pluralization)
I18n::Backend::Simple.include(I18n::Backend::PluralizationFallback)
I18n.load_path << "#{Rails.root}/config/pluralizers.rb"
I18n::Backend::Simple.include(I18n::Backend::Fallbacks)
I18n.fallbacks.map("no" => "nb")
Rails.configuration.after_initialize do
I18n.reload!
end

View file

@ -8,3 +8,8 @@
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
#
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.acronym 'RESTful'
# end

View file

@ -0,0 +1,25 @@
module Mail
class Ruby18
def Ruby18.b_value_decode(str)
match = str.match(/\=\?(.+)?\?[Bb]\?(.+)?\?\=/m)
if match
encoding = match[1]
str = Ruby18.decode_base64(match[2])
require 'iconv'
str = Iconv.conv("UTF-8//TRANSLIT//IGNORE", encoding, str)
end
str
end
def Ruby18.q_value_decode(str)
match = str.match(/\=\?(.+)?\?[Qq]\?(.+)?\?\=/m)
if match
encoding = match[1]
str = Encodings::QuotedPrintable.decode(match[2].gsub(/_/, '=20'))
require 'iconv'
str = Iconv.conv("UTF-8//TRANSLIT//IGNORE", encoding, str)
end
str
end
end
end

Some files were not shown because too many files have changed in this diff Show more