From f4571eeb7cb4f920bb5d642c9e1c37c9495fc6ba Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 23 Jun 2009 02:48:38 +0000 Subject: [PATCH 01/20] Revert r16046. DO NOT COMMIT MAJOR ENHANCEMENTS TO TRUNK WITHOUT TALKING TO ME FIRST. --- app/controllers/application_controller.rb | 56 +--- app/controllers/changeset_controller.rb | 1 - app/controllers/node_controller.rb | 1 - app/controllers/oauth_clients_controller.rb | 53 --- app/controllers/oauth_controller.rb | 83 ----- app/controllers/relation_controller.rb | 1 - app/controllers/trace_controller.rb | 2 - app/controllers/user_controller.rb | 3 - app/controllers/user_preference_controller.rb | 2 - app/controllers/way_controller.rb | 1 - app/helpers/oauth_clients_helper.rb | 2 - app/helpers/oauth_helper.rb | 2 - app/models/access_token.rb | 10 - app/models/client_application.rb | 69 ---- app/models/oauth_nonce.rb | 13 - app/models/oauth_token.rb | 31 -- app/models/request_token.rb | 25 -- app/models/user.rb | 3 - app/views/oauth/authorize.html.erb | 14 - app/views/oauth/authorize_failure.html.erb | 1 - app/views/oauth/authorize_success.html.erb | 1 - app/views/oauth/oauthorize.html.erb | 17 - app/views/oauth_clients/_form.html.erb | 40 --- app/views/oauth_clients/edit.html.erb | 5 - app/views/oauth_clients/index.html.erb | 39 --- app/views/oauth_clients/new.html.erb | 6 - app/views/oauth_clients/not_found.erb | 1 - app/views/oauth_clients/show.html.erb | 20 -- app/views/user/account.html.erb | 35 +- config/environment.rb | 1 - config/locales/en.yml | 21 -- config/routes.rb | 9 +- db/migrate/036_create_oauth_tables.rb | 44 --- db/migrate/037_add_fine_o_auth_permissions.rb | 23 -- test/fixtures/client_applications.yml | 12 - test/integration/client_application_test.rb | 75 ----- test/test_helper.rb | 2 - test/unit/client_application_test.rb | 17 - test/unit/oauth_nonce_test.rb | 20 -- test/unit/oauth_token_test.rb | 26 -- vendor/plugins/oauth-plugin/.gitignore | 5 - vendor/plugins/oauth-plugin/CHANGELOG | 61 ---- vendor/plugins/oauth-plugin/MIT-LICENSE | 20 -- vendor/plugins/oauth-plugin/README.rdoc | 110 ------- vendor/plugins/oauth-plugin/Rakefile | 22 -- .../generators/oauth_provider/USAGE | 24 -- .../oauth_provider_generator.rb | 116 ------- .../oauth_provider/templates/_form.html.erb | 16 - .../oauth_provider/templates/access_token.rb | 10 - .../templates/authorize.html.erb | 14 - .../templates/authorize_failure.html.erb | 1 - .../templates/authorize_success.html.erb | 1 - .../templates/client_application.rb | 54 --- .../templates/client_application_spec.rb | 60 ---- .../templates/client_application_test.rb | 42 --- .../templates/client_applications.yml | 23 -- .../templates/clients_controller.rb | 47 --- .../templates/clients_controller_spec.rb | 239 -------------- .../templates/clients_controller_test.rb | 280 ---------------- .../templates/clients_helper.rb | 2 - .../oauth_provider/templates/controller.rb | 62 ---- .../templates/controller_spec.rb | 296 ----------------- .../templates/controller_spec_helper.rb | 74 ----- .../templates/controller_test.rb | 310 ------------------ .../templates/controller_test_helper.rb | 115 ------- .../oauth_provider/templates/edit.html.erb | 5 - .../oauth_provider/templates/helper.rb | 2 - .../oauth_provider/templates/index.html.erb | 40 --- .../oauth_provider/templates/migration.rb | 44 --- .../oauth_provider/templates/new.html.erb | 5 - .../oauth_provider/templates/oauth_nonce.rb | 13 - .../templates/oauth_nonce_spec.rb | 24 -- .../templates/oauth_nonce_test.rb | 26 -- .../oauth_provider/templates/oauth_nonces.yml | 13 - .../oauth_provider/templates/oauth_token.rb | 31 -- .../templates/oauth_token_spec.rb | 55 ---- .../templates/oauth_token_test.rb | 57 ---- .../oauth_provider/templates/oauth_tokens.yml | 17 - .../oauth_provider/templates/request_token.rb | 17 - .../oauth_provider/templates/show.html.erb | 20 -- vendor/plugins/oauth-plugin/init.rb | 6 - vendor/plugins/oauth-plugin/install.rb | 2 - .../lib/oauth/rails/controller_methods.rb | 114 ------- .../oauth-plugin/tasks/oauth_tasks.rake | 4 - vendor/plugins/oauth-plugin/uninstall.rb | 1 - 85 files changed, 9 insertions(+), 3278 deletions(-) delete mode 100644 app/controllers/oauth_clients_controller.rb delete mode 100644 app/controllers/oauth_controller.rb delete mode 100644 app/helpers/oauth_clients_helper.rb delete mode 100644 app/helpers/oauth_helper.rb delete mode 100644 app/models/access_token.rb delete mode 100644 app/models/client_application.rb delete mode 100644 app/models/oauth_nonce.rb delete mode 100644 app/models/oauth_token.rb delete mode 100644 app/models/request_token.rb delete mode 100644 app/views/oauth/authorize.html.erb delete mode 100644 app/views/oauth/authorize_failure.html.erb delete mode 100644 app/views/oauth/authorize_success.html.erb delete mode 100644 app/views/oauth/oauthorize.html.erb delete mode 100644 app/views/oauth_clients/_form.html.erb delete mode 100644 app/views/oauth_clients/edit.html.erb delete mode 100644 app/views/oauth_clients/index.html.erb delete mode 100644 app/views/oauth_clients/new.html.erb delete mode 100644 app/views/oauth_clients/not_found.erb delete mode 100644 app/views/oauth_clients/show.html.erb delete mode 100644 db/migrate/036_create_oauth_tables.rb delete mode 100644 db/migrate/037_add_fine_o_auth_permissions.rb delete mode 100644 test/fixtures/client_applications.yml delete mode 100644 test/integration/client_application_test.rb delete mode 100644 test/unit/client_application_test.rb delete mode 100644 test/unit/oauth_nonce_test.rb delete mode 100644 test/unit/oauth_token_test.rb delete mode 100644 vendor/plugins/oauth-plugin/.gitignore delete mode 100644 vendor/plugins/oauth-plugin/CHANGELOG delete mode 100644 vendor/plugins/oauth-plugin/MIT-LICENSE delete mode 100644 vendor/plugins/oauth-plugin/README.rdoc delete mode 100644 vendor/plugins/oauth-plugin/Rakefile delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/USAGE delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/oauth_provider_generator.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/_form.html.erb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/access_token.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/authorize.html.erb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/authorize_failure.html.erb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/authorize_success.html.erb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application_spec.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application_test.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_applications.yml delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/clients_controller.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/clients_controller_spec.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/clients_controller_test.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/clients_helper.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller_spec.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller_spec_helper.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller_test.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller_test_helper.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/edit.html.erb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/helper.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/index.html.erb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/migration.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/new.html.erb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce_spec.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce_test.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonces.yml delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_token.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_token_spec.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_token_test.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_tokens.yml delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/request_token.rb delete mode 100644 vendor/plugins/oauth-plugin/generators/oauth_provider/templates/show.html.erb delete mode 100644 vendor/plugins/oauth-plugin/init.rb delete mode 100644 vendor/plugins/oauth-plugin/install.rb delete mode 100644 vendor/plugins/oauth-plugin/lib/oauth/rails/controller_methods.rb delete mode 100644 vendor/plugins/oauth-plugin/tasks/oauth_tasks.rake delete mode 100644 vendor/plugins/oauth-plugin/uninstall.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 110682947..0d6cdea64 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -22,61 +22,19 @@ class ApplicationController < ActionController::Base redirect_to :controller => 'user', :action => 'login', :referer => request.request_uri unless @user end - ## - # requires the user to be logged in by the token or HTTP methods, or have an - # OAuth token with the right capability. this method is a bit of a pain to call - # directly, since it's cumbersome to call filters with arguments in rails. to - # make it easier to read and write the code, there are some utility methods - # below. - def require_capability(cap) - # when the current token is nil, it means the user logged in with a different - # method, otherwise an OAuth token was used, which has to be checked. - unless @current_token.nil? - unless @current_token.read_attribute(cap) - render :text => "OAuth token doesn't have that capability.", :status => :forbidden - return false - end - end - end - - # Utility methods to make the controller filter methods easier to read and write. - def require_allow_read_prefs - require_capability(:allow_read_prefs) - end - def require_allow_write_prefs - require_capability(:allow_write_prefs) - end - def require_allow_write_diary - require_capability(:allow_write_diary) - end - def require_allow_write_api - require_capability(:allow_write_api) - end - def require_allow_read_gpx - require_capability(:allow_read_gpx) - end - def require_allow_write_gpx - require_capability(:allow_write_gpx) - end - ## # sets up the @user object for use by other methods. this is mostly called # from the authorize method, but can be called elsewhere if authorisation # is optional. def setup_user_auth - # try and setup using OAuth - if oauthenticate - @user = @current_token.user + username, passwd = get_auth_data # parse from headers + # authenticate per-scheme + if username.nil? + @user = nil # no authentication provided - perhaps first connect (client should retry after 401) + elsif username == 'token' + @user = User.authenticate(:token => passwd) # preferred - random token for user from db, passed in basic auth else - username, passwd = get_auth_data # parse from headers - # authenticate per-scheme - if username.nil? - @user = nil # no authentication provided - perhaps first connect (client should retry after 401) - elsif username == 'token' - @user = User.authenticate(:token => passwd) # preferred - random token for user from db, passed in basic auth - else - @user = User.authenticate(:username => username, :password => passwd) # basic auth - end + @user = User.authenticate(:username => username, :password => passwd) # basic auth end end diff --git a/app/controllers/changeset_controller.rb b/app/controllers/changeset_controller.rb index 40c619e13..ca42751d3 100644 --- a/app/controllers/changeset_controller.rb +++ b/app/controllers/changeset_controller.rb @@ -7,7 +7,6 @@ class ChangesetController < ApplicationController before_filter :authorize_web, :only => [:list, :list_user, :list_bbox] before_filter :set_locale, :only => [:list, :list_user, :list_bbox] before_filter :authorize, :only => [:create, :update, :delete, :upload, :include, :close] - before_filter :require_allow_write_api, :only => [:create, :update, :delete, :upload, :include, :close] before_filter :require_public_data, :only => [:create, :update, :delete, :upload, :include, :close] before_filter :check_api_writable, :only => [:create, :update, :delete, :upload, :include] before_filter :check_api_readable, :except => [:create, :update, :delete, :upload, :download, :query] diff --git a/app/controllers/node_controller.rb b/app/controllers/node_controller.rb index 416ae28eb..8eb698920 100644 --- a/app/controllers/node_controller.rb +++ b/app/controllers/node_controller.rb @@ -4,7 +4,6 @@ class NodeController < ApplicationController require 'xml/libxml' before_filter :authorize, :only => [:create, :update, :delete] - before_filter :require_allow_write_api, :only => [:create, :update, :delete] before_filter :require_public_data, :only => [:create, :update, :delete] before_filter :check_api_writable, :only => [:create, :update, :delete] before_filter :check_api_readable, :except => [:create, :update, :delete] diff --git a/app/controllers/oauth_clients_controller.rb b/app/controllers/oauth_clients_controller.rb deleted file mode 100644 index 00606c1ec..000000000 --- a/app/controllers/oauth_clients_controller.rb +++ /dev/null @@ -1,53 +0,0 @@ -class OauthClientsController < ApplicationController - layout 'site' - - before_filter :authorize_web - before_filter :require_user - - def index - @client_applications = @user.client_applications - @tokens = @user.oauth_tokens.find :all, :conditions => 'oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null' - end - - def new - @client_application = ClientApplication.new - end - - def create - @client_application = @user.client_applications.build(params[:client_application]) - if @client_application.save - flash[:notice] = "Registered the information successfully" - redirect_to :action => "show", :id => @client_application.id - else - render :action => "new" - end - end - - def show - @client_application = @user.client_applications.find(params[:id]) - rescue ActiveRecord::RecordNotFound - @type = "client application" - render :action => "not_found", :status => :not_found - end - - def edit - @client_application = @user.client_applications.find(params[:id]) - end - - def update - @client_application = @user.client_applications.find(params[:id]) - if @client_application.update_attributes(params[:client_application]) - flash[:notice] = "Updated the client information successfully" - redirect_to :action => "show", :id => @client_application.id - else - render :action => "edit" - end - end - - def destroy - @client_application = @user.client_applications.find(params[:id]) - @client_application.destroy - flash[:notice] = "Destroyed the client application registration" - redirect_to :action => "index" - end -end diff --git a/app/controllers/oauth_controller.rb b/app/controllers/oauth_controller.rb deleted file mode 100644 index f8959beae..000000000 --- a/app/controllers/oauth_controller.rb +++ /dev/null @@ -1,83 +0,0 @@ -class OauthController < ApplicationController - layout 'site' - - before_filter :authorize_web, :except => [:request_token, :access_token] - before_filter :require_user, :only => [:oauthorize] - before_filter :verify_oauth_consumer_signature, :only => [:request_token] - before_filter :verify_oauth_request_token, :only => [:access_token] - # Uncomment the following if you are using restful_open_id_authentication - # skip_before_filter :verify_authenticity_token - - def request_token - @token = current_client_application.create_request_token - - logger.info "in REQUEST TOKEN" - if @token - logger.info "request token params: #{params.inspect}" - # request tokens indicate what permissions the client *wants*, not - # necessarily the same as those which the user allows. - current_client_application.permissions.each do |pref| - logger.info "PARAMS found #{pref}" - @token.write_attribute(pref, true) - end - @token.save! - - render :text => @token.to_query - else - render :nothing => true, :status => 401 - end - end - - def access_token - @token = current_token && current_token.exchange! - if @token - render :text => @token.to_query - else - render :nothing => true, :status => 401 - end - end - - def oauthorize - @token = RequestToken.find_by_token params[:oauth_token] - unless @token.invalidated? - if request.post? - any_auth = false - @token.client_application.permissions.each do |pref| - if params[pref] - logger.info "OAUTHORIZE PARAMS found #{pref}" - @token.write_attribute(pref, true) - any_auth ||= true - else - @token.write_attribute(pref, false) - end - end - - if any_auth - @token.authorize!(@user) - redirect_url = params[:oauth_callback] || @token.client_application.callback_url - if redirect_url - redirect_to "#{redirect_url}?oauth_token=#{@token.token}" - else - render :action => "authorize_success" - end - else - @token.invalidate! - render :action => "authorize_failure" - end - end - else - render :action => "authorize_failure" - end - end - - def revoke - @token = @user.oauth_tokens.find_by_token params[:token] - if @token - @token.invalidate! - flash[:notice] = "You've revoked the token for #{@token.client_application.name}" - end - logger.info "about to redirect" - redirect_to :controller => 'oauth_clients', :action => 'index' - end - -end diff --git a/app/controllers/relation_controller.rb b/app/controllers/relation_controller.rb index 390806f80..4f8e2d0b5 100644 --- a/app/controllers/relation_controller.rb +++ b/app/controllers/relation_controller.rb @@ -2,7 +2,6 @@ class RelationController < ApplicationController require 'xml/libxml' before_filter :authorize, :only => [:create, :update, :delete] - before_filter :require_allow_write_api, :only => [:create, :update, :delete] before_filter :require_public_data, :only => [:create, :update, :delete] before_filter :check_api_writable, :only => [:create, :update, :delete] before_filter :check_api_readable, :except => [:create, :update, :delete] diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index 17b667969..d0e3a853c 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -9,8 +9,6 @@ class TraceController < ApplicationController before_filter :check_database_writable, :only => [:create, :edit, :delete, :make_public] before_filter :check_api_readable, :only => [:api_details, :api_data] before_filter :check_api_writable, :only => [:api_create] - before_filter :require_allow_read_gpx, :only => [:api_details, :api_data] - before_filter :require_allow_write_gpx, :only => [:api_create] # Counts and selects pages of GPX traces for various criteria (by user, tags, public etc.). # target_user - if set, specifies the user to fetch traces for. if not set will fetch all traces diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 1e70fe08f..c3ab012e3 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -8,8 +8,6 @@ class UserController < ApplicationController before_filter :check_database_readable, :except => [:api_details, :api_gpx_files] before_filter :check_database_writable, :only => [:login, :new, :set_home, :account, :go_public, :make_friend, :remove_friend, :upload_image, :delete_image] before_filter :check_api_readable, :only => [:api_details, :api_gpx_files] - before_filter :require_allow_read_prefs, :only => [:api_details] - before_filter :require_allow_read_gpx, :only => [:api_gpx_files] filter_parameter_logging :password, :pass_crypt, :pass_crypt_confirmation @@ -39,7 +37,6 @@ class UserController < ApplicationController def account @title = t 'user.account.title' - @tokens = @user.oauth_tokens.find :all, :conditions => 'oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null' if params[:user] and params[:user][:display_name] and params[:user][:description] if params[:user][:email] != @user.email diff --git a/app/controllers/user_preference_controller.rb b/app/controllers/user_preference_controller.rb index d02313497..59573047a 100644 --- a/app/controllers/user_preference_controller.rb +++ b/app/controllers/user_preference_controller.rb @@ -1,8 +1,6 @@ # Update and read user preferences, which are arbitrayr key/val pairs class UserPreferenceController < ApplicationController before_filter :authorize - before_filter :require_allow_read_prefs, :only => [:read_one, :read] - before_filter :require_allow_write_prefs, :except => [:read_one, :read] def read_one pref = UserPreference.find(@user.id, params[:preference_key]) diff --git a/app/controllers/way_controller.rb b/app/controllers/way_controller.rb index 1f301e9fb..4d345e063 100644 --- a/app/controllers/way_controller.rb +++ b/app/controllers/way_controller.rb @@ -2,7 +2,6 @@ class WayController < ApplicationController require 'xml/libxml' before_filter :authorize, :only => [:create, :update, :delete] - before_filter :require_allow_write_api, :only => [:create, :update, :delete] before_filter :require_public_data, :only => [:create, :update, :delete] before_filter :check_api_writable, :only => [:create, :update, :delete] before_filter :check_api_readable, :except => [:create, :update, :delete] diff --git a/app/helpers/oauth_clients_helper.rb b/app/helpers/oauth_clients_helper.rb deleted file mode 100644 index 3b909aaf3..000000000 --- a/app/helpers/oauth_clients_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module OauthClientsHelper -end \ No newline at end of file diff --git a/app/helpers/oauth_helper.rb b/app/helpers/oauth_helper.rb deleted file mode 100644 index 010cf9f5a..000000000 --- a/app/helpers/oauth_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module OauthHelper -end diff --git a/app/models/access_token.rb b/app/models/access_token.rb deleted file mode 100644 index b773310ce..000000000 --- a/app/models/access_token.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AccessToken "OauthToken" - validates_presence_of :name, :url, :key, :secret - validates_uniqueness_of :key - before_validation_on_create :generate_keys - - def self.find_token(token_key) - token = OauthToken.find_by_token(token_key, :include => :client_application) - if token && token.authorized? - logger.info "Loaded #{token.token} which was authorized by (user_id=#{token.user_id}) on the #{token.authorized_at}" - token - else - nil - end - end - - def self.verify_request(request, options = {}, &block) - begin - signature = OAuth::Signature.build(request, options, &block) - logger.info "Signature Base String: #{signature.signature_base_string}" - logger.info "Consumer: #{signature.send :consumer_key}" - logger.info "Token: #{signature.send :token}" - return false unless OauthNonce.remember(signature.request.nonce, signature.request.timestamp) - value = signature.verify - logger.info "Signature verification returned: #{value.to_s}" - value - rescue OAuth::Signature::UnknownSignatureMethod => e - logger.info "ERROR"+e.to_s - false - end - end - - def self.all_permissions - PERMISSIONS - end - - def oauth_server - @oauth_server ||= OAuth::Server.new("http://" + SERVER_URL) - end - - def credentials - @oauth_client ||= OAuth::Consumer.new(key, secret) - end - - def create_request_token - RequestToken.create :client_application => self - end - - # the permissions that this client would like from the user - def permissions - ClientApplication.all_permissions.select { |p| self[p] } - end - -protected - - # this is the set of permissions that the client can ask for. clients - # have to say up-front what permissions they want and when users sign up they - # can agree or not agree to each of them. - PERMISSIONS = [:allow_read_prefs, :allow_write_prefs, :allow_write_diary, - :allow_write_api, :allow_read_gpx, :allow_write_gpx ] - - def generate_keys - @oauth_client = oauth_server.generate_consumer_credentials - self.key = @oauth_client.key - self.secret = @oauth_client.secret - end -end diff --git a/app/models/oauth_nonce.rb b/app/models/oauth_nonce.rb deleted file mode 100644 index 075351b91..000000000 --- a/app/models/oauth_nonce.rb +++ /dev/null @@ -1,13 +0,0 @@ -# Simple store of nonces. The OAuth Spec requires that any given pair of nonce and timestamps are unique. -# Thus you can use the same nonce with a different timestamp and viceversa. -class OauthNonce < ActiveRecord::Base - validates_presence_of :nonce, :timestamp - validates_uniqueness_of :nonce, :scope => :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) - return false if oauth_nonce.new_record? - oauth_nonce - end -end diff --git a/app/models/oauth_token.rb b/app/models/oauth_token.rb deleted file mode 100644 index 5fca40ce2..000000000 --- a/app/models/oauth_token.rb +++ /dev/null @@ -1,31 +0,0 @@ -class OauthToken < ActiveRecord::Base - belongs_to :client_application - belongs_to :user - validates_uniqueness_of :token - validates_presence_of :client_application, :token, :secret - before_validation_on_create :generate_keys - - def invalidated? - invalidated_at != nil - end - - def invalidate! - update_attribute(:invalidated_at, Time.now) - end - - def authorized? - authorized_at != nil && !invalidated? - end - - def to_query - "oauth_token=#{token}&oauth_token_secret=#{secret}" - end - -protected - - def generate_keys - @oauth_token = client_application.oauth_server.generate_credentials - self.token = @oauth_token[0] - self.secret = @oauth_token[1] - end -end diff --git a/app/models/request_token.rb b/app/models/request_token.rb deleted file mode 100644 index 1be8c6902..000000000 --- a/app/models/request_token.rb +++ /dev/null @@ -1,25 +0,0 @@ -class RequestToken < OauthToken - def authorize!(user) - return false if authorized? - self.user = user - self.authorized_at = Time.now - self.save - end - - def exchange! - return false unless authorized? - RequestToken.transaction do - logger.info("£££ In exchange!") - params = { :user => user, :client_application => client_application } - # copy the permissions from the authorised request token to the access token - client_application.permissions.each { |p| - logger.info("£££ copying permission #{p} = #{read_attribute(p).inspect}") - params[p] = read_attribute(p) - } - - access_token = AccessToken.create(params) - invalidate! - access_token - end - end -end diff --git a/app/models/user.rb b/app/models/user.rb index 90d3835ac..241c1396f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -11,9 +11,6 @@ class User < ActiveRecord::Base has_many :preferences, :class_name => "UserPreference" has_many :changesets - has_many :client_applications - has_many :oauth_tokens, :class_name => "OauthToken", :order => "authorized_at desc", :include => [:client_application] - validates_presence_of :email, :display_name validates_confirmation_of :email#, :message => ' addresses must match' validates_confirmation_of :pass_crypt#, :message => ' must match the confirmation password' diff --git a/app/views/oauth/authorize.html.erb b/app/views/oauth/authorize.html.erb deleted file mode 100644 index 987997de2..000000000 --- a/app/views/oauth/authorize.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -

Authorize access to your account

-

Would you like to authorize <%= link_to @token.client_application.name,@token.client_application.url %> (<%= link_to @token.client_application.url,@token.client_application.url %>) to access your account?

-<% form_tag authorize_url do %> - <%= hidden_field_tag "oauth_token", @token.token %> - <%- if params[:oauth_callback] -%> - <%= hidden_field_tag "oauth_callback", params[:oauth_callback] %> -<%- end -%> -

- <%= check_box_tag 'authorize' %> authorize access -

-

- <%= submit_tag %> -

-<% end %> \ No newline at end of file diff --git a/app/views/oauth/authorize_failure.html.erb b/app/views/oauth/authorize_failure.html.erb deleted file mode 100644 index d8110c94f..000000000 --- a/app/views/oauth/authorize_failure.html.erb +++ /dev/null @@ -1 +0,0 @@ -

You have disallowed this request

diff --git a/app/views/oauth/authorize_success.html.erb b/app/views/oauth/authorize_success.html.erb deleted file mode 100644 index effe24a79..000000000 --- a/app/views/oauth/authorize_success.html.erb +++ /dev/null @@ -1 +0,0 @@ -

You have allowed this request

\ No newline at end of file diff --git a/app/views/oauth/oauthorize.html.erb b/app/views/oauth/oauthorize.html.erb deleted file mode 100644 index 0b9d321fe..000000000 --- a/app/views/oauth/oauthorize.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -

Authorize access to your account

-

<%= t('oauth.client_application.request_access', :app_name => link_to(@token.client_application.name,@token.client_application.url)) %>

-<% form_tag authorize_url do %> - <%= hidden_field_tag "oauth_token", @token.token %> - <%- if params[:oauth_callback] -%> - <%= hidden_field_tag "oauth_callback", params[:oauth_callback] %> -<%- end -%> -

<%= t 'oauth.client_application.allow_to' %>

- -

- <%= submit_tag %> -

-<% end %> diff --git a/app/views/oauth_clients/_form.html.erb b/app/views/oauth_clients/_form.html.erb deleted file mode 100644 index e55b016e9..000000000 --- a/app/views/oauth_clients/_form.html.erb +++ /dev/null @@ -1,40 +0,0 @@ -
-
- <%= f.text_field :name %> -
-
-
- <%= f.text_field :url %> -
-
-
- <%= f.text_field :callback_url %> -
-
-
- <%= f.text_field :support_url %> -
-
- <%= f.check_box :allow_read_prefs %> -
-
-
- <%= f.check_box :allow_write_prefs %> -
-
-
- <%= f.check_box :allow_write_diary %> -
-
-
- <%= f.check_box :allow_write_api %> -
-
-
- <%= f.check_box :allow_read_gpx %> -
-
-
- <%= f.check_box :allow_write_gpx %> -
-
diff --git a/app/views/oauth_clients/edit.html.erb b/app/views/oauth_clients/edit.html.erb deleted file mode 100644 index 3ff72fee3..000000000 --- a/app/views/oauth_clients/edit.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

Edit your application

-<% form_for :client_application do |f| %> - <%= render :partial => "form", :locals => { :f => f } %> - <%= submit_tag "Edit" %> -<% end %> \ No newline at end of file diff --git a/app/views/oauth_clients/index.html.erb b/app/views/oauth_clients/index.html.erb deleted file mode 100644 index 8f9e0a0b1..000000000 --- a/app/views/oauth_clients/index.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -
<%= flash[:notice] %>
-

OAuth Client Applications

-<% unless @tokens.empty? %> -

The following tokens have been issued to applications in your name

- - - <% @tokens.each do |token|%> - <% content_tag_for :tr, token do %> - - - - <% end %> - <% end %> -
ApplicationIssued 
<%= link_to token.client_application.name, token.client_application.url %><%= token.authorized_at %> - <% form_tag :controller => 'oauth', :action => 'revoke' do %> - <%= hidden_field_tag 'token', token.token %> - <%= submit_tag "Revoke!" %> - <% end %> -
-<% end %> -

Application Developers

-<% if @client_applications.empty? %> -

- Do you have an application you would like to register for use with us using the OAuth standard? -

-

- You must register your web application before it can make OAuth requests to this service -

-<% else %> -

- You have the following client applications registered: -

- <% @client_applications.each do |client|%> - <% div_for client do %> - <%= link_to client.name, :action => :show, :id => client.id %> - <% end %> - <% end %> -<% end %> -

<%= link_to "Register your application", :action => :new %>

diff --git a/app/views/oauth_clients/new.html.erb b/app/views/oauth_clients/new.html.erb deleted file mode 100644 index 34b2d2b29..000000000 --- a/app/views/oauth_clients/new.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Register a new application

-<% form_for :client_application, :url => { :action => :create } do |f| %> - <%= render :partial => "form", :locals => { :f => f } %> -
- <%= submit_tag "Register" %> -<% end %> diff --git a/app/views/oauth_clients/not_found.erb b/app/views/oauth_clients/not_found.erb deleted file mode 100644 index c47ffc712..000000000 --- a/app/views/oauth_clients/not_found.erb +++ /dev/null @@ -1 +0,0 @@ -

Sorry, that <%= @type -%> could not be found.

diff --git a/app/views/oauth_clients/show.html.erb b/app/views/oauth_clients/show.html.erb deleted file mode 100644 index 5ec45aef5..000000000 --- a/app/views/oauth_clients/show.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -

OAuth details for <%=@client_application.name %>

-

- Consumer Key: <%=@client_application.key %> -

-

- Consumer Secret: <%=@client_application.secret %> -

-

- Request Token URL http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.request_token_path %> -

-

- Access Token URL http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.access_token_path %> -

-

- Authorize URL http<%='s' if request.ssl? %>://<%= request.host_with_port %><%=@client_application.oauth_server.authorize_path %> -

- -

- We support hmac-sha1 (recommended) as well as plain text in ssl mode. -

\ No newline at end of file diff --git a/app/views/user/account.html.erb b/app/views/user/account.html.erb index 1cc6b4a29..15a8f6827 100644 --- a/app/views/user/account.html.erb +++ b/app/views/user/account.html.erb @@ -29,7 +29,7 @@
-
<%= submit_tag t('user.account.save changes button') %> +

<%= submit_tag t('user.account.save changes button') %>
@@ -46,39 +46,6 @@

<%= button_to t('user.account.make all my edits public button'), :action => :go_public %> <% end %> -

<%= t 'user.account.my apps' %>

-<% if @tokens.empty? %> -

<%= t 'oauth.token.none' %>

-<% else %> - - - <% @tokens.each do |token|%> - <% content_tag_for :tr, token do %> - - - - <% end %> - <% end %> -
<%= t 'oauth.token.application' %><%= t 'oauth.token.issued' %> 
<%= link_to token.client_application.name, token.client_application.url %><%= token.authorized_at %> - <% form_tag :controller => 'oauth', :action => 'revoke' do %> - <%= hidden_field_tag 'token', token.token %> - <%= submit_tag t('oauth.token.revoke') %> - <% end %> -
-<% end %> -

<%= t 'user.account.developers' %>

-<% if @user.client_applications.empty? %> -

<%= t 'user.account.dev_intro', :link => "OAuth" %>

-

<%= link_to t('user.account.register_app'), :controller => 'oauth_clients', :action => :new %>

-<% else %> -

<%= t 'user.account.apps_registered' %>

- -

<%= link_to t('user.account.register_another_app'), :controller => 'oauth_clients', :action => :new %>

-<% end %>

<%= link_to t('user.account.return to profile'), :controller => 'user', :action => @user.display_name %> diff --git a/config/environment.rb b/config/environment.rb index f105d5a7e..c7fa3c483 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -49,7 +49,6 @@ Rails::Initializer.run do |config| config.gem 'composite_primary_keys', :version => '2.2.2' config.gem 'libxml-ruby', :version => '>= 1.1.1', :lib => 'libxml' config.gem 'rmagick', :lib => 'RMagick' - config.gem 'oauth', :version => '0.3.5' # Only load the plugins named here, in the order given. By default, all plugins # in vendor/plugins are loaded in alphabetical order. diff --git a/config/locales/en.yml b/config/locales/en.yml index 3196531f1..9b9069dc2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -652,21 +652,6 @@ en: scheduled_for_deletion: "Track scheduled for deletion" make_public: made_public: "Track made public" - oauth: - client_application: - request_access: "The application {{app_name}} is requesting access to your account. Please check whether you would like the application to have the following capabilities. You may choose as many or as few as you like." - allow_to: "Allow the client application to:" - allow_read_prefs: "read your user preferences." - allow_write_prefs: "modify your user preferences." - allow_write_diary: "create diary entries, comments and make friends." - allow_write_api: "modify the map." - allow_read_gpx: "read your private GPS traces." - allow_write_gpx: "upload GPS traces." - token: - none: "You have not authorised any clients to act on your behalf. You do not have to do anything now to authorise them, as they will ask for authorisation when they need it. After that time you can return here to revoke those permissions if you do not want the clients to have your authorisation any more." - application: "Application" - issued: "Issued" - revoke: "Revoke!" user: login: title: "Login" @@ -764,12 +749,6 @@ en: return to profile: Return to profile flash update success confirm needed: "User information updated successfully. Check your email for a note to confirm your new email address." flash update success: "User information updated successfully." - my apps: "My client applications" - developers: "Application Developers" - dev_intro: "Have you written an application which you would like to register to make {{link}} requests to the OpenStreetMap server?" - register_app: "Register your application" - apps_registered: "You have the following client applications registered:" - register_another_app: "Register another application" confirm: heading: Confirm a user account press confirm button: "Press the confirm button below to activate your account." diff --git a/config/routes.rb b/config/routes.rb index 8789c8437..92bc493e1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -172,6 +172,7 @@ ActionController::Routing::Routes.draw do |map| map.connect '/export/finish', :controller => 'export', :action => 'finish' # messages + map.connect '/user/:display_name/inbox', :controller => 'message', :action => 'inbox' map.connect '/user/:display_name/outbox', :controller => 'message', :action => 'outbox' map.connect '/message/new/:display_name', :controller => 'message', :action => 'new' @@ -179,14 +180,6 @@ ActionController::Routing::Routes.draw do |map| map.connect '/message/mark/:message_id', :controller => 'message', :action => 'mark' map.connect '/message/reply/:message_id', :controller => 'message', :action => 'reply' - # oauth admin pages (i.e: for setting up new clients, etc...) - map.resources :oauth_clients - map.connect '/oauth/revoke', :controller => 'oauth', :action => 'revoke' - map.authorize '/oauth/authorize', :controller => 'oauth', :action => 'oauthorize' - map.request_token '/oauth/request_token', :controller => 'oauth', :action => 'request_token' - map.access_token '/oauth/access_token', :controller => 'oauth', :action => 'access_token' - map.test_request '/oauth/test_request', :controller => 'oauth', :action => 'test_request' - # fall through map.connect ':controller/:id/:action' map.connect ':controller/:action' diff --git a/db/migrate/036_create_oauth_tables.rb b/db/migrate/036_create_oauth_tables.rb deleted file mode 100644 index 95d690512..000000000 --- a/db/migrate/036_create_oauth_tables.rb +++ /dev/null @@ -1,44 +0,0 @@ -class CreateOauthTables < ActiveRecord::Migration - def self.up - create_table :client_applications do |t| - t.string :name - t.string :url - t.string :support_url - t.string :callback_url - t.string :key, :limit => 50 - t.string :secret, :limit => 50 - t.integer :user_id - - t.timestamps - end - add_index :client_applications, :key, :unique => true - - create_table :oauth_tokens do |t| - t.integer :user_id - t.string :type, :limit => 20 - t.integer :client_application_id - t.string :token, :limit => 50 - t.string :secret, :limit => 50 - t.timestamp :authorized_at, :invalidated_at - t.timestamps - end - - add_index :oauth_tokens, :token, :unique => true - - create_table :oauth_nonces do |t| - t.string :nonce - t.integer :timestamp - - t.timestamps - end - add_index :oauth_nonces, [:nonce, :timestamp], :unique => true - - end - - def self.down - drop_table :client_applications - drop_table :oauth_tokens - drop_table :oauth_nonces - end - -end diff --git a/db/migrate/037_add_fine_o_auth_permissions.rb b/db/migrate/037_add_fine_o_auth_permissions.rb deleted file mode 100644 index ad4c7a8a4..000000000 --- a/db/migrate/037_add_fine_o_auth_permissions.rb +++ /dev/null @@ -1,23 +0,0 @@ -class AddFineOAuthPermissions < ActiveRecord::Migration - PERMISSIONS = [:allow_read_prefs, :allow_write_prefs, :allow_write_diary, - :allow_write_api, :allow_read_gpx, :allow_write_gpx ] - - def self.up - PERMISSIONS.each do |perm| - # add fine-grained permissions columns for OAuth tokens, allowing people to - # give permissions to parts of the site only. - add_column :oauth_tokens, perm, :boolean, :null => false, :default => false - - # add fine-grained permissions columns for client applications, allowing the - # client applications to request particular privileges. - add_column :client_applications, perm, :boolean, :null => false, :default => false - end - end - - def self.down - PERMISSIONS.each do |perm| - remove_column :oauth_tokens, perm - remove_column :client_applications, perm - end - end -end diff --git a/test/fixtures/client_applications.yml b/test/fixtures/client_applications.yml deleted file mode 100644 index 9fe0889ac..000000000 --- a/test/fixtures/client_applications.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html - -oauth_web_app: - name: Some OAuth Web App - created_at: "2009-04-21 00:00:00" - support_url: http://some.web.app.org/support - updated_at: "2009-04-21 00:00:00" - callback_url: http://some.web.app.org/callback - url: http://some.web.app.org/ - user_id: 2 - secret: Ur1s9LWWJJuYBiV9cDi3za3OV8TGCoRgUvVXJ5zp7pc - key: ewvENqsaTXFnZbMWmGDX2g diff --git a/test/integration/client_application_test.rb b/test/integration/client_application_test.rb deleted file mode 100644 index 0af226085..000000000 --- a/test/integration/client_application_test.rb +++ /dev/null @@ -1,75 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class ClientApplicationTest < ActionController::IntegrationTest - fixtures :users, :client_applications - - ## - # run through the procedure of creating a client application and checking - # that it shows up on the user's account page. - def test_create_application - post '/login', {'user[email]' => "test@example.com", 'user[password]' => "test", :referer => '/user/test/account'} - assert_response :redirect - follow_redirect! - assert_response :success - assert_template 'user/account' - - # check that the form to allow new client application creations exists - assert_in_body do - assert_select "h2", "Application Developers" - assert_select "a[href='/oauth_clients/new']" - end - - # now we follow the link to the new oauth client page - get '/oauth_clients/new' - assert_response :success - assert_in_body do - assert_select "h1", "Register a new application" - assert_select "form[action='/oauth_clients']" do - [ :name, :url, :callback_url, :support_url ].each do |inp| - assert_select "input[name=?]", "client_application[#{inp}]" - end - ClientApplication.all_permissions.each do |perm| - assert_select "input[name=?]", "client_application[#{perm}]" - end - end - end - - post '/oauth_clients', { - 'client_application[name]' => 'My New App', - 'client_application[url]' => 'http://my.new.app.org/', - 'client_application[callback_url]' => 'http://my.new.app.org/callback', - 'client_application[support_url]' => 'http://my.new.app.org/support'} - assert_response :redirect - follow_redirect! - assert_response :success - assert_template 'oauth_clients/show' - assert_equal 'Registered the information successfully', flash[:notice] - - # now go back to the account page and check its listed under this user - get '/user/test/account' - assert_response :success - assert_template 'user/account' - assert_in_body { assert_select "li>div>a", "My New App" } - end - - ## - # fake client workflow. - # this acts like a 3rd party client trying to access the site. - def test_3rd_party_token - # apparently the oauth gem doesn't really support being used inside integration - # tests, as its too tied into the HTTP headers and stuff that it signs. - end - - ## - # utility method to make the HTML screening easier to read. - def assert_in_body - assert_select "html:root" do - assert_select "body" do - assert_select "div#content" do - yield - end - end - end - end - -end diff --git a/test/test_helper.rb b/test/test_helper.rb index 4972ee6d6..97c749000 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -71,8 +71,6 @@ class ActiveSupport::TestCase set_fixture_class :gpx_files => 'Trace' set_fixture_class :gps_points => 'Tracepoint' set_fixture_class :gpx_file_tags => 'Tracetag' - - fixtures :client_applications end ## diff --git a/test/unit/client_application_test.rb b/test/unit/client_application_test.rb deleted file mode 100644 index 213d4d28c..000000000 --- a/test/unit/client_application_test.rb +++ /dev/null @@ -1,17 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class ClientApplicationTest < ActiveSupport::TestCase - api_fixtures - - ## - # test that tokens can't be found unless they're authorised - def test_find_token - tok = client_applications(:oauth_web_app).create_request_token - assert_equal false, tok.authorized?, "Token should be created unauthorised." - assert_equal nil, ClientApplication.find_token(tok.token), "Shouldn't be able to find unauthorised token" - tok.authorize!(users(:public_user)) - assert_equal true, tok.authorized?, "Token should now be authorised." - assert_not_equal nil, ClientApplication.find_token(tok.token), "Should be able to find authorised token" - end - -end diff --git a/test/unit/oauth_nonce_test.rb b/test/unit/oauth_nonce_test.rb deleted file mode 100644 index def869a05..000000000 --- a/test/unit/oauth_nonce_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class OauthNonceTest < ActiveSupport::TestCase - api_fixtures - - ## - # the nonce has only one property, that it is a unique pair of - # string and timestamp. - def test_nonce_uniqueness - string = "0123456789ABCDEF" - timestamp = Time.now - - nonce1 = OauthNonce.remember(string, timestamp) - assert_not_equal false, nonce1, "First nonce should be unique. Check your test database is empty." - - nonce2 = OauthNonce.remember(string, timestamp) - assert_equal false, nonce2, "Shouldn't be able to remember the same nonce twice." - end - -end diff --git a/test/unit/oauth_token_test.rb b/test/unit/oauth_token_test.rb deleted file mode 100644 index eb8219c57..000000000 --- a/test/unit/oauth_token_test.rb +++ /dev/null @@ -1,26 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class OauthTokenTest < ActiveSupport::TestCase - api_fixtures - - ## - # check that after calling invalidate! on a token, it is invalid. - def test_token_invalidation - tok = OauthToken.new - assert_equal false, tok.invalidated?, "Token should be created valid." - tok.invalidate! - assert_equal true, tok.invalidated?, "Token should now be invalid." - end - - ## - # check that an authorized token is authorised and can be invalidated - def test_token_authorisation - tok = RequestToken.create :client_application => client_applications(:oauth_web_app) - assert_equal false, tok.authorized?, "Token should be created unauthorised." - tok.authorize!(users(:public_user)) - assert_equal true, tok.authorized?, "Token should now be authorised." - tok.invalidate! - assert_equal false, tok.authorized?, "Token should now be invalid." - end - -end diff --git a/vendor/plugins/oauth-plugin/.gitignore b/vendor/plugins/oauth-plugin/.gitignore deleted file mode 100644 index 56cb2dcd8..000000000 --- a/vendor/plugins/oauth-plugin/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -doc -pkg -*.log -.DS_Store -.svn diff --git a/vendor/plugins/oauth-plugin/CHANGELOG b/vendor/plugins/oauth-plugin/CHANGELOG deleted file mode 100644 index a4006aa59..000000000 --- a/vendor/plugins/oauth-plugin/CHANGELOG +++ /dev/null @@ -1,61 +0,0 @@ -2/11/2009 -- Fixed escaping error and file path error in the generator simultaneously reported and fixed by Ivan Valdes and Mike Demers thanks - -2/9/2009 -- Fixed compatibility issue with OAuth Gem 3.1 (wr0ngway and aeden) -- Added Test:Unit tests to generator (Ed Hickey) -- added missing oauth_clients/edit.html.erb view template (Ed Hickey) -- added missing :oauth_clients resource route in USAGE (Ed Hickey) -- Don't throw NPE it token is not in db (Haruska) -- Cleaned up whitespace (bricolage, Nicholas Nam) -- Fixed bug in default verify_oauth_signature (igrigorik) -- Doc fixes (skippy) - -6/23/2008 - -- Split OAuth controller into two parts: OAuth and OAuth clients. [jcrosby] - -revision 31 - -- patch that fixes a problem in oauth_required from Hannes Tyden and Sean Treadway from SoundCloud. Thanks. - -revision 30 - -- updated to use oauth gem 0.2.1 - - -revision 23 - -- removed all core libraries from plugin. They are now in the oauth gem. - -# oauth-plugin-pre-gem Branch created - -revision 18 -- added a generator for creation oauth_providers - -revision 12 -- the bug with post and put has now been fixed. -- better documentation - -revision 9 -- added a test helper. Include OAuth::TestHelper in your tests or specs to mock incoming requests - -revision: 8 -- moved tests into oauth folder and renamed them to make them work with autotest by default -- Refactored the request methods to make them more flexible and ready for integrating with ActiveResource -- There are a few tests that fail. All of them to do with put and post requests with payload data. I decided to commit anyway, to get the new api out. - -revision: 7 - -- Done a lot of work on the Server side of things. The Server class has changed a lot and is likely to be incompatible with previous versions - -revision: 6 - -- Throws InsecureSignatureMethod exception if attempting to use straight sha1 or md5. -- Disables plaintext signature over http (throws an InsecureSignatureMethod) -- Better testing of signature methods - the prior tests were seriously flawed. - -revision: 5 - -- Removed support for sha1 and md5 -- Implemented draft 6 support of OAuth removing secrets from base string \ No newline at end of file diff --git a/vendor/plugins/oauth-plugin/MIT-LICENSE b/vendor/plugins/oauth-plugin/MIT-LICENSE deleted file mode 100644 index 570ecf870..000000000 --- a/vendor/plugins/oauth-plugin/MIT-LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2007 [name of plugin creator] - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/plugins/oauth-plugin/README.rdoc b/vendor/plugins/oauth-plugin/README.rdoc deleted file mode 100644 index e2e68b7a6..000000000 --- a/vendor/plugins/oauth-plugin/README.rdoc +++ /dev/null @@ -1,110 +0,0 @@ -= OAuth Plugin - -This is the beginning of a plugin for implementing OAuth Providers in Rails applications. - -See the OAuth specs at: - -http://oauth.net/core/1.0/ - -and the OAuth site at: - -http://oauth.net - -== Requirements - -You need to install the oauth gem (0.2.1) which is the core OAuth ruby library. It will NOT work on any previous version of the gem. - - sudo gem install oauth - -The Generator currently creates code (in particular views) that only work in Rails 2. - -It should not be difficult to manually modify the code to work on Rails 1.2.x - -I think the only real issue is that the views have .html.erb extensions. So these could theoretically just be renamed to .rhtml. - -Please let me know if this works and I will see if I can make the generator conditionally create .rhtml for pre 2.0 versions of RAILS. - -== OAuth Provider generator - -While it isn't very flexible at the moment there is an oauth_provider generator which you can use like this: - -./script/generate oauth_provider - -This generates OAuth and OAuth client controllers as well as the required models. - -It requires an authentication framework such as acts_as_authenticated, restful_authentication or restful_open_id_authentication. It also requires Rails 2.0. - -=== Routes - -You need to add the following to your routes (config/routes.rb) - - map.resources :oauth_clients - map.authorize '/oauth/authorize',:controller=>'oauth',:action=>'authorize' - map.request_token '/oauth/request_token',:controller=>'oauth',:action=>'request_token' - map.access_token '/oauth/access_token',:controller=>'oauth',:action=>'access_token' - map.test_request '/oauth/test_request',:controller=>'oauth',:action=>'test_request' - -=== User Model - -Add the following lines to your user model: - - has_many :client_applications - has_many :tokens, :class_name=>"OauthToken",:order=>"authorized_at desc",:include=>[:client_application] - -=== Migrate database - -The database is defined in: - - db/migrate/XXX_create_oauth_tables.rb - -Run them as any other normal migration in rails with: - - rake db:migrate - -=== RSpec - -The generator installs a collection of RSpec (http://rspec.info) specs instead of normal unit_tests. If you don't use RSpec (and really why aren't you?) feel free to remove the spec folder. - -If you would like to contribute regular unit tests I will accept them with a smile. - -== Protecting your actions - -I recommend that you think about what your users would want to provide access to and limit oauth for those only. For example in a CRUD controller you may think about if you want to let consumer applications do the create, update or delete actions. For your application this might make sense, but for others maybe not. - -If you want to give oauth access to everything a registered user can do, just replace the filter you have in your controllers with: - - before_filter :login_or_oauth_required - -If you want to restrict consumers to the index and show methods of your controller do the following: - - before_filter :login_required,:except=>[:show,:index] - before_filter :login_or_oauth_required,:only=>[:show,:index] - -If you have an action you only want used via oauth: - - before_filter :oauth_required - -All of these places the tokens user in current_user as you would expect. It also exposes the following methods: - -* current_token - for accessing the token used to authorize the current request -* current_client_application - for accessing information about which consumer is currently accessing your request - -You could add application specific information to the OauthToken and ClientApplication model for such things as object level access control, billing, expiry etc. Be creative and you can create some really cool applications here. - -== More - -The Google Code project is http://code.google.com/p/oauth-plugin/ - -The Mailing List for all things OAuth in Ruby is: - -http://groups.google.com/group/oauth-ruby - -The Mailing list for everything else OAuth is: - -http://groups.google.com/group/oauth - -The OAuth Ruby Gem home page is http://oauth.rubyforge.org - -Please help documentation, patches and testing. - -Copyright (c) 2007-2008 Pelle Braendgaard, released under the MIT license \ No newline at end of file diff --git a/vendor/plugins/oauth-plugin/Rakefile b/vendor/plugins/oauth-plugin/Rakefile deleted file mode 100644 index 16a9769a2..000000000 --- a/vendor/plugins/oauth-plugin/Rakefile +++ /dev/null @@ -1,22 +0,0 @@ -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' - -desc 'Default: run unit tests.' -task :default => :test - -desc 'Test the oauth plugin.' -Rake::TestTask.new(:test) do |t| - t.libs << 'lib' - t.pattern = 'test/**/*_test.rb' - t.verbose = true -end - -desc 'Generate documentation for the oauth plugin.' -Rake::RDocTask.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'Oauth' - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.rdoc_files.include('README') - rdoc.rdoc_files.include('lib/**/*.rb') -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/USAGE b/vendor/plugins/oauth-plugin/generators/oauth_provider/USAGE deleted file mode 100644 index ded11acfc..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/USAGE +++ /dev/null @@ -1,24 +0,0 @@ -./script/generate oauth_provider - -This creates an OAuth Provider controller as well as the requisite models. - -It requires an authentication framework such as acts_as_authenticated, restful_authentication or restful_open_id_authentication. - -If you generated the migration file (true by default), make sure you run -rake db:migrate - -You need to add the following routes to your config/routes.rb file: - -map.resources :oauth_clients -map.oauth '/oauth',:controller=>'oauth',:action=>'index' -map.authorize '/oauth/authorize',:controller=>'oauth',:action=>'authorize' -map.request_token '/oauth/request_token',:controller=>'oauth',:action=>'request_token' -map.access_token '/oauth/access_token',:controller=>'oauth',:action=>'access_token' -map.test_request '/oauth/test_request',:controller=>'oauth',:action=>'test_request' - -include the following in your user.rb - -has_many :client_applications -has_many :tokens, :class_name=>"OauthToken",:order=>"authorized_at desc",:include=>[:client_application] - - diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/oauth_provider_generator.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/oauth_provider_generator.rb deleted file mode 100644 index 57059e220..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/oauth_provider_generator.rb +++ /dev/null @@ -1,116 +0,0 @@ -class OauthProviderGenerator < Rails::Generator::Base - default_options :skip_migration => false - attr_reader :class_path, - :controller_name, - :controller_class_path, - :controller_file_path, - :controller_class_name, - :controller_singular_name, - :controller_plural_name - alias_method :controller_file_name, :controller_singular_name - - def initialize(runtime_args, runtime_options = {}) - super - - @controller_name = args.shift || 'oauth' - @controller_singular_name = 'oauth' - @controller_plural_name = 'oauth' - @controller_file_name = 'oauth' - @controller_class_name="Oauth" - @class_path='' - @controller_class_path='' - end - - def manifest - record do |m| - - # Check for class naming collisions. - # Check for class naming collisions. - m.class_collisions controller_class_path, "#{controller_class_name}Controller", # Oauth Controller - "#{controller_class_name}Helper", - "#{controller_class_name}ClientsController", - "#{controller_class_name}ClientsHelper" - m.class_collisions class_path, "ClientApplication","OauthNonce","RequestToken","AccessToken","OauthToken" - - # Controller, helper, views, and test directories. - m.directory File.join('app/models', class_path) - m.directory File.join('app/controllers', controller_class_path) - m.directory File.join('app/helpers', controller_class_path) - m.directory File.join('app/views', controller_class_path, controller_file_name) - m.directory File.join('app/views', controller_class_path, 'oauth_clients') - - m.template 'client_application.rb',File.join('app/models',"client_application.rb") - m.template 'oauth_token.rb', File.join('app/models',"oauth_token.rb") - m.template 'request_token.rb', File.join('app/models',"request_token.rb") - m.template 'access_token.rb', File.join('app/models',"access_token.rb") - m.template 'oauth_nonce.rb', File.join('app/models',"oauth_nonce.rb") - - m.template 'controller.rb',File.join('app/controllers',controller_class_path,"#{controller_file_name}_controller.rb") - m.template 'helper.rb',File.join('app/helpers',controller_class_path,"#{controller_file_name}_helper.rb") - - m.template 'clients_controller.rb',File.join('app/controllers',controller_class_path,"#{controller_file_name}_clients_controller.rb") - m.template 'clients_helper.rb',File.join('app/helpers',controller_class_path,"#{controller_file_name}_clients_helper.rb") - - if !options[:test_unit] - m.directory File.join('spec') - m.directory File.join('spec/models') - m.directory File.join('spec/fixtures', class_path) - m.directory File.join('spec/controllers', controller_class_path) - - m.template 'client_application_spec.rb',File.join('spec/models',"client_application_spec.rb") - m.template 'oauth_token_spec.rb', File.join('spec/models',"oauth_token_spec.rb") - m.template 'oauth_nonce_spec.rb', File.join('spec/models',"oauth_nonce_spec.rb") - m.template 'client_applications.yml',File.join('spec/fixtures',"client_applications.yml") - m.template 'oauth_tokens.yml', File.join('spec/fixtures',"oauth_tokens.yml") - m.template 'oauth_nonces.yml', File.join('spec/fixtures',"oauth_nonces.yml") - m.template 'controller_spec_helper.rb', File.join('spec/controllers', controller_class_path,"#{controller_file_name}_controller_spec_helper.rb") - m.template 'controller_spec.rb',File.join('spec/controllers',controller_class_path,"#{controller_file_name}_controller_spec.rb") - m.template 'clients_controller_spec.rb',File.join('spec/controllers',controller_class_path,"#{controller_file_name}_clients_controller_spec.rb") - else - m.directory File.join('test') - m.directory File.join('test/unit') - m.directory File.join('test/fixtures', class_path) - m.directory File.join('test/functional', controller_class_path) - m.template 'client_application_test.rb',File.join('test/unit',"client_application_test.rb") - m.template 'oauth_token_test.rb', File.join('test/unit',"oauth_token_test.rb") - m.template 'oauth_nonce_test.rb', File.join('test/unit',"oauth_nonce_test.rb") - m.template 'client_applications.yml',File.join('test/fixtures',"client_applications.yml") - m.template 'oauth_tokens.yml', File.join('test/fixtures',"oauth_tokens.yml") - m.template 'oauth_nonces.yml', File.join('test/fixtures',"oauth_nonces.yml") - m.template 'controller_test_helper.rb', File.join('test', controller_class_path,"#{controller_file_name}_controller_test_helper.rb") - m.template 'controller_test.rb',File.join('test/functional',controller_class_path,"#{controller_file_name}_controller_test.rb") - m.template 'clients_controller_test.rb',File.join('test/functional',controller_class_path,"#{controller_file_name}_clients_controller_test.rb") - end - - m.template '_form.html.erb', File.join('app/views', controller_class_path, 'oauth_clients', "_form.html.erb") - m.template 'new.html.erb', File.join('app/views', controller_class_path, 'oauth_clients', "new.html.erb") - m.template 'index.html.erb', File.join('app/views', controller_class_path, 'oauth_clients', "index.html.erb") - m.template 'show.html.erb', File.join('app/views', controller_class_path, 'oauth_clients', "show.html.erb") - m.template 'edit.html.erb', File.join('app/views', controller_class_path, 'oauth_clients', "edit.html.erb") - m.template 'authorize.html.erb', File.join('app/views', controller_class_path, controller_file_name, "authorize.html.erb") - m.template 'authorize_success.html.erb', File.join('app/views', controller_class_path, controller_file_name, "authorize_success.html.erb") - m.template 'authorize_failure.html.erb', File.join('app/views', controller_class_path, controller_file_name, "authorize_failure.html.erb") - - - unless options[:skip_migration] - m.migration_template 'migration.rb', 'db/migrate', :assigns => { - :migration_name => "CreateOauthTables" - }, :migration_file_name => "create_oauth_tables" - end - end - end - - protected - def banner - "Usage: #{$0} #{spec.name}" - end - - def add_options!(opt) - opt.separator '' - opt.separator 'Options:' - opt.on("--skip-migration", - "Don't generate a migration file") { |v| options[:skip_migration] = v } - opt.on("--test-unit", - "Generate the Test::Unit compatible tests instead of RSpec") { |v| options[:test_unit] = v } - end -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/_form.html.erb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/_form.html.erb deleted file mode 100644 index ee3f5b8a6..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/_form.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -
-
- <%%= f.text_field :name %> -
-
-
- <%%= f.text_field :url %> -
-
-
- <%%= f.text_field :callback_url %> -
-
-
- <%%= f.text_field :support_url %> -
diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/access_token.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/access_token.rb deleted file mode 100644 index b773310ce..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/access_token.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AccessTokenAuthorize access to your account -

Would you like to authorize <%%= link_to @token.client_application.name,@token.client_application.url %> (<%%= link_to @token.client_application.url,@token.client_application.url %>) to access your account?

-<%% form_tag authorize_url do %> - <%%= hidden_field_tag "oauth_token", @token.token %> - <%%- if params[:oauth_callback] -%> - <%%= hidden_field_tag "oauth_callback", params[:oauth_callback] %> -<%%- end -%> -

- <%%= check_box_tag 'authorize' %> authorize access -

-

- <%%= submit_tag %> -

-<%% end %> \ No newline at end of file diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/authorize_failure.html.erb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/authorize_failure.html.erb deleted file mode 100644 index d8110c94f..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/authorize_failure.html.erb +++ /dev/null @@ -1 +0,0 @@ -

You have disallowed this request

diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/authorize_success.html.erb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/authorize_success.html.erb deleted file mode 100644 index effe24a79..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/authorize_success.html.erb +++ /dev/null @@ -1 +0,0 @@ -

You have allowed this request

\ No newline at end of file diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application.rb deleted file mode 100644 index b7ca97d64..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application.rb +++ /dev/null @@ -1,54 +0,0 @@ -require 'oauth' -class ClientApplication < ActiveRecord::Base - belongs_to :user - has_many :tokens, :class_name => "OauthToken" - validates_presence_of :name, :url, :key, :secret - validates_uniqueness_of :key - before_validation_on_create :generate_keys - - def self.find_token(token_key) - token = OauthToken.find_by_token(token_key, :include => :client_application) - if token && token.authorized? - logger.info "Loaded #{token.token} which was authorized by (user_id=#{token.user_id}) on the #{token.authorized_at}" - token - else - nil - end - end - - def self.verify_request(request, options = {}, &block) - begin - signature = OAuth::Signature.build(request, options, &block) - logger.info "Signature Base String: #{signature.signature_base_string}" - logger.info "Consumer: #{signature.send :consumer_key}" - logger.info "Token: #{signature.send :token}" - return false unless OauthNonce.remember(signature.request.nonce, signature.request.timestamp) - value = signature.verify - logger.info "Signature verification returned: #{value.to_s}" - value - rescue OAuth::Signature::UnknownSignatureMethod => e - logger.info "ERROR"+e.to_s - false - end - end - - def oauth_server - @oauth_server ||= OAuth::Server.new("http://your.site") - end - - def credentials - @oauth_client ||= OAuth::Consumer.new(key, secret) - end - - def create_request_token - RequestToken.create :client_application => self - end - -protected - - def generate_keys - @oauth_client = oauth_server.generate_consumer_credentials - self.key = @oauth_client.key - self.secret = @oauth_client.secret - end -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application_spec.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application_spec.rb deleted file mode 100644 index 14f3887b9..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -require File.dirname(__FILE__) + '/../spec_helper' -module OAuthSpecHelpers - - def create_consumer - @consumer = OAuth::Consumer.new(@application.key,@application.secret, - { - :site => @application.oauth_server.base_url - }) - end - - def create_test_request - - end - - def create_oauth_request - @token = AccessToken.create :client_application => @application, :user => users(:quentin) - @request = @consumer.create_signed_request(:get, "/hello", @token) - end - - def create_request_token_request - @request = @consumer.create_signed_request(:get, @application.oauth_server.request_token_path, @token) - end - - def create_access_token_request - @token = RequestToken.create :client_application => @application - @request = @consumer.create_signed_request(:get, @application.oauth_server.request_token_path, @token) - end - -end - -describe ClientApplication do #, :shared => true do - include OAuthSpecHelpers - fixtures :users, :client_applications, :oauth_tokens - before(:each) do - @application = ClientApplication.create :name => "Agree2", :url => "http://agree2.com", :user => users(:quentin) - create_consumer - end - - it "should be valid" do - @application.should be_valid - end - - - it "should not have errors" do - @application.errors.full_messages.should == [] - end - - it "should have key and secret" do - @application.key.should_not be_nil - @application.secret.should_not be_nil - end - - it "should have credentials" do - @application.credentials.should_not be_nil - @application.credentials.key.should == @application.key - @application.credentials.secret.should == @application.secret - end - -end - diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application_test.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application_test.rb deleted file mode 100644 index 3ba2cf7d9..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_application_test.rb +++ /dev/null @@ -1,42 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' -module OAuthHelpers - - def create_consumer - @consumer=OAuth::Consumer.new(@application.key,@application.secret, - { - :site=>@application.oauth_server.base_url - }) - end - -end - -class ClientApplicationTest < ActiveSupport::TestCase - include OAuthHelpers - fixtures :users,:client_applications,:oauth_tokens - - def setup - @application = ClientApplication.create :name=>"Agree2",:url=>"http://agree2.com",:user=>users(:quentin) - create_consumer - end - - def test_should_be_valid - assert @application.valid? - end - - - def test_should_not_have_errors - assert_equal [], @application.errors.full_messages - end - - def test_should_have_key_and_secret - assert_not_nil @application.key - assert_not_nil @application.secret - end - - def test_should_have_credentials - assert_not_nil @application.credentials - assert_equal @application.key, @application.credentials.key - assert_equal @application.secret, @application.credentials.secret - end - -end \ No newline at end of file diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_applications.yml b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_applications.yml deleted file mode 100644 index 4bbf37069..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/client_applications.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html -one: - id: 1 - name: MyString - url: MyString - support_url: MyString - callback_url: MyString - key: one_key - secret: MyString - user_id: 1 - created_at: 2007-11-17 16:56:51 - updated_at: 2007-11-17 16:56:51 -two: - id: 2 - name: MyString - url: MyString - support_url: MyString - callback_url: MyString - key: two_key - secret: MyString - user_id: 1 - created_at: 2007-11-17 16:56:51 - updated_at: 2007-11-17 16:56:51 diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/clients_controller.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/clients_controller.rb deleted file mode 100644 index 5f7827431..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/clients_controller.rb +++ /dev/null @@ -1,47 +0,0 @@ -class OauthClientsController < ApplicationController - before_filter :login_required - - def index - @client_applications = current_user.client_applications - @tokens = current_user.tokens.find :all, :conditions => 'oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null' - end - - def new - @client_application = ClientApplication.new - end - - def create - @client_application = current_user.client_applications.build(params[:client_application]) - if @client_application.save - flash[:notice] = "Registered the information successfully" - redirect_to :action => "show", :id => @client_application.id - else - render :action => "new" - end - end - - def show - @client_application = current_user.client_applications.find(params[:id]) - end - - def edit - @client_application = current_user.client_applications.find(params[:id]) - end - - def update - @client_application = current_user.client_applications.find(params[:id]) - if @client_application.update_attributes(params[:client_application]) - flash[:notice] = "Updated the client information successfully" - redirect_to :action => "show", :id => @client_application.id - else - render :action => "edit" - end - end - - def destroy - @client_application = current_user.client_applications.find(params[:id]) - @client_application.destroy - flash[:notice] = "Destroyed the client application registration" - redirect_to :action => "index" - end -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/clients_controller_spec.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/clients_controller_spec.rb deleted file mode 100644 index d617b5669..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/clients_controller_spec.rb +++ /dev/null @@ -1,239 +0,0 @@ -require File.dirname(__FILE__) + '/../spec_helper' -require File.dirname(__FILE__) + '/oauth_controller_spec_helper' -require 'oauth/client/action_controller_request' - -describe OauthClientsController, "index" do - include OAuthControllerSpecHelper - before(:each) do - login_as_application_owner - end - - def do_get - get :index - end - - it "should be successful" do - do_get - response.should be_success - end - - it "should query current_users client applications" do - @user.should_receive(:client_applications).and_return(@client_applications) - do_get - end - - it "should assign client_applications" do - do_get - assigns[:client_applications].should equal(@client_applications) - end - - it "should render index template" do - do_get - response.should render_template('index') - end -end - -describe OauthClientsController, "show" do - include OAuthControllerSpecHelper - before(:each) do - login_as_application_owner - end - - def do_get - get :show, :id => '3' - end - - it "should be successful" do - do_get - response.should be_success - end - - it "should query current_users client applications" do - @user.should_receive(:client_applications).and_return(@client_applications) - @client_applications.should_receive(:find).with('3').and_return(@client_application) - do_get - end - - it "should assign client_applications" do - do_get - assigns[:client_application].should equal(@client_application) - end - - it "should render show template" do - do_get - response.should render_template('show') - end - -end - -describe OauthClientsController, "new" do - include OAuthControllerSpecHelper - before(:each) do - login_as_application_owner - ClientApplication.stub!(:new).and_return(@client_application) - end - - def do_get - get :new - end - - it "should be successful" do - do_get - response.should be_success - end - - it "should assign client_applications" do - do_get - assigns[:client_application].should equal(@client_application) - end - - it "should render show template" do - do_get - response.should render_template('new') - end - -end - -describe OauthClientsController, "edit" do - include OAuthControllerSpecHelper - before(:each) do - login_as_application_owner - end - - def do_get - get :edit, :id => '3' - end - - it "should be successful" do - do_get - response.should be_success - end - - it "should query current_users client applications" do - @user.should_receive(:client_applications).and_return(@client_applications) - @client_applications.should_receive(:find).with('3').and_return(@client_application) - do_get - end - - it "should assign client_applications" do - do_get - assigns[:client_application].should equal(@client_application) - end - - it "should render edit template" do - do_get - response.should render_template('edit') - end - -end - -describe OauthClientsController, "create" do - include OAuthControllerSpecHelper - - before(:each) do - login_as_application_owner - @client_applications.stub!(:build).and_return(@client_application) - @client_application.stub!(:save).and_return(true) - end - - def do_valid_post - @client_application.should_receive(:save).and_return(true) - post :create, 'client_application'=>{'name' => 'my site'} - end - - def do_invalid_post - @client_application.should_receive(:save).and_return(false) - post :create, :client_application=>{:name => 'my site'} - end - - it "should query current_users client applications" do - @client_applications.should_receive(:build).and_return(@client_application) - do_valid_post - end - - it "should redirect to new client_application" do - do_valid_post - response.should be_redirect - response.should redirect_to(:action => "show", :id => @client_application.id) - end - - it "should assign client_applications" do - do_invalid_post - assigns[:client_application].should equal(@client_application) - end - - it "should render show template" do - do_invalid_post - response.should render_template('new') - end -end - -describe OauthClientsController, "destroy" do - include OAuthControllerSpecHelper - before(:each) do - login_as_application_owner - @client_application.stub!(:destroy) - end - - def do_delete - delete :destroy, :id => '3' - end - - it "should query current_users client applications" do - @user.should_receive(:client_applications).and_return(@client_applications) - @client_applications.should_receive(:find).with('3').and_return(@client_application) - do_delete - end - - it "should destroy client applications" do - @client_application.should_receive(:destroy) - do_delete - end - - it "should redirect to list" do - do_delete - response.should be_redirect - response.should redirect_to(:action => 'index') - end - -end - -describe OauthClientsController, "update" do - include OAuthControllerSpecHelper - - before(:each) do - login_as_application_owner - end - - def do_valid_update - @client_application.should_receive(:update_attributes).and_return(true) - put :update, :id => '1', 'client_application'=>{'name' => 'my site'} - end - - def do_invalid_update - @client_application.should_receive(:update_attributes).and_return(false) - put :update, :id => '1', 'client_application'=>{'name' => 'my site'} - end - - it "should query current_users client applications" do - @user.should_receive(:client_applications).and_return(@client_applications) - @client_applications.should_receive(:find).with('1').and_return(@client_application) - do_valid_update - end - - it "should redirect to new client_application" do - do_valid_update - response.should be_redirect - response.should redirect_to(:action => "show", :id => @client_application.id) - end - - it "should assign client_applications" do - do_invalid_update - assigns[:client_application].should equal(@client_application) - end - - it "should render show template" do - do_invalid_update - response.should render_template('edit') - end -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/clients_controller_test.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/clients_controller_test.rb deleted file mode 100644 index 47585a2ca..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/clients_controller_test.rb +++ /dev/null @@ -1,280 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' -require File.dirname(__FILE__) + '/../oauth_controller_test_helper' -require 'oauth/client/action_controller_request' - -class OauthClientsController; def rescue_action(e) raise e end; end - -class OauthClientsControllerIndexTest < ActionController::TestCase - include OAuthControllerTestHelper - tests OauthClientsController - - def setup - @controller = OauthClientsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - - login_as_application_owner - end - - def do_get - get :index - end - - def test_should_be_successful - do_get - assert @response.success? - end - - def test_should_query_current_users_client_applications - @user.expects(:client_applications).returns(@client_applications) - do_get - end - - def test_should_assign_client_applications - do_get - assert_equal @client_applications, assigns(:client_applications) - end - - def test_should_render_index_template - do_get - assert_template 'index' - end -end - -class OauthClientsControllerShowTest < ActionController::TestCase - include OAuthControllerTestHelper - tests OauthClientsController - - def setup - @controller = OauthClientsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - - login_as_application_owner - end - - def do_get - get :show, :id=>'3' - end - - def test_should_be_successful - do_get - assert @response.success? - end - - def test_should_query_current_users_client_applications - @user.expects(:client_applications).returns(@client_applications) - @client_applications.expects(:find).with('3').returns(@client_application) - do_get - end - - def test_should_assign_client_applications - do_get - assert_equal @client_application, assigns(:client_application) - end - - def test_should_render_show_template - do_get - assert_template 'show' - end - -end - -class OauthClientsControllerNewTest < ActionController::TestCase - include OAuthControllerTestHelper - tests OauthClientsController - - def setup - @controller = OauthClientsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - - login_as_application_owner - ClientApplication.stubs(:new).returns(@client_application) - end - - def do_get - get :new - end - - def test_should_be_successful - do_get - assert @response.success? - end - - def test_should_assign_client_applications - do_get - assert_equal @client_application, assigns(:client_application) - end - - def test_should_render_show_template - do_get - assert_template 'new' - end - -end - -class OauthClientsControllerEditTest < ActionController::TestCase - include OAuthControllerTestHelper - tests OauthClientsController - - def setup - @controller = OauthClientsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - - login_as_application_owner - end - - def do_get - get :edit, :id=>'3' - end - - def test_should_be_successful - do_get - assert @response.success? - end - - def test_should_query_current_users_client_applications - @user.expects(:client_applications).returns(@client_applications) - @client_applications.expects(:find).with('3').returns(@client_application) - do_get - end - - def test_should_assign_client_applications - do_get - assert_equal @client_application, assigns(:client_application) - end - - def test_should_render_edit_template - do_get - assert_template 'edit' - end - -end - -class OauthClientsControllerCreateTest < ActionController::TestCase - include OAuthControllerTestHelper - tests OauthClientsController - - def setup - @controller = OauthClientsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - - login_as_application_owner - @client_applications.stubs(:build).returns(@client_application) - @client_application.stubs(:save).returns(true) - end - - def do_valid_post - @client_application.expects(:save).returns(true) - post :create,'client_application'=>{'name'=>'my site'} - end - - def do_invalid_post - @client_application.expects(:save).returns(false) - post :create,:client_application=>{:name=>'my site'} - end - - def test_should_query_current_users_client_applications - @client_applications.expects(:build).returns(@client_application) - do_valid_post - end - - def test_should_redirect_to_new_client_application - do_valid_post - assert_response :redirect - assert_redirected_to(:action => "show", :id => @client_application.id) - end - - def test_should_assign_client_applications - do_invalid_post - assert_equal @client_application, assigns(:client_application) - end - - def test_should_render_show_template - do_invalid_post - assert_template('new') - end -end - -class OauthClientsControllerDestroyTest < ActionController::TestCase - include OAuthControllerTestHelper - tests OauthClientsController - - def setup - @controller = OauthClientsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - - login_as_application_owner - @client_application.stubs(:destroy) - end - - def do_delete - delete :destroy,:id=>'3' - end - - def test_should_query_current_users_client_applications - @user.expects(:client_applications).returns(@client_applications) - @client_applications.expects(:find).with('3').returns(@client_application) - do_delete - end - - def test_should_destroy_client_applications - @client_application.expects(:destroy) - do_delete - end - - def test_should_redirect_to_list - do_delete - assert_response :redirect - assert_redirected_to :action => 'index' - end - -end - -class OauthClientsControllerUpdateTest < ActionController::TestCase - include OAuthControllerTestHelper - tests OauthClientsController - - def setup - @controller = OauthClientsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - login_as_application_owner - end - - def do_valid_update - @client_application.expects(:update_attributes).returns(true) - put :update, :id => '1', 'client_application' => {'name'=>'my site'} - end - - def do_invalid_update - @client_application.expects(:update_attributes).returns(false) - put :update, :id=>'1', 'client_application' => {'name'=>'my site'} - end - - def test_should_query_current_users_client_applications - @user.expects(:client_applications).returns(@client_applications) - @client_applications.expects(:find).with('1').returns(@client_application) - do_valid_update - end - - def test_should_redirect_to_new_client_application - do_valid_update - assert_response :redirect - assert_redirected_to :action => "show", :id => @client_application.id - end - - def test_should_assign_client_applications - do_invalid_update - assert_equal @client_application, assigns(:client_application) - end - - def test_should_render_show_template - do_invalid_update - assert_template('edit') - end -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/clients_helper.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/clients_helper.rb deleted file mode 100644 index 3b909aaf3..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/clients_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module OauthClientsHelper -end \ No newline at end of file diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller.rb deleted file mode 100644 index 58ac21391..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller.rb +++ /dev/null @@ -1,62 +0,0 @@ -class OauthController < ApplicationController - before_filter :login_required, :except => [:request_token, :access_token, :test_request] - before_filter :login_or_oauth_required, :only => [:test_request] - before_filter :verify_oauth_consumer_signature, :only => [:request_token] - before_filter :verify_oauth_request_token, :only => [:access_token] - # Uncomment the following if you are using restful_open_id_authentication - # skip_before_filter :verify_authenticity_token - - def request_token - @token = current_client_application.create_request_token - if @token - render :text => @token.to_query - else - render :nothing => true, :status => 401 - end - end - - def access_token - @token = current_token && current_token.exchange! - if @token - render :text => @token.to_query - else - render :nothing => true, :status => 401 - end - end - - def test_request - render :text => params.collect{|k,v|"#{k}=#{v}"}.join("&") - end - - def authorize - @token = RequestToken.find_by_token params[:oauth_token] - unless @token.invalidated? - if request.post? - if params[:authorize] == '1' - @token.authorize!(current_user) - redirect_url = params[:oauth_callback] || @token.client_application.callback_url - if redirect_url - redirect_to "#{redirect_url}?oauth_token=#{@token.token}" - else - render :action => "authorize_success" - end - elsif params[:authorize] == "0" - @token.invalidate! - render :action => "authorize_failure" - end - end - else - render :action => "authorize_failure" - end - end - - def revoke - @token = current_user.tokens.find_by_token params[:token] - if @token - @token.invalidate! - flash[:notice] = "You've revoked the token for #{@token.client_application.name}" - end - redirect_to oauth_clients_url - end - -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller_spec.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller_spec.rb deleted file mode 100644 index f3479ab37..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller_spec.rb +++ /dev/null @@ -1,296 +0,0 @@ -require File.dirname(__FILE__) + '/../spec_helper' -require File.dirname(__FILE__) + '/oauth_controller_spec_helper' -require 'oauth/client/action_controller_request' - -describe OauthController, "getting a request token" do - include OAuthControllerSpecHelper - before(:each) do - setup_oauth - sign_request_with_oauth - @client_application.stub!(:create_request_token).and_return(@request_token) - end - - def do_get - get :request_token - end - - it "should be successful" do - do_get - response.should be_success - end - - it "should query for client_application" do - ClientApplication.should_receive(:find_by_key).with('key').and_return(@client_application) - do_get - end - - it "should request token from client_application" do - @client_application.should_receive(:create_request_token).and_return(@request_token) - do_get - end - - it "should return token string" do - do_get - response.body.should == @request_token_string - end -end - -describe OauthController, "token authorization" do - include OAuthControllerSpecHelper - before(:each) do - login - setup_oauth - RequestToken.stub!(:find_by_token).and_return(@request_token) - end - - def do_get - get :authorize, :oauth_token => @request_token.token - end - - def do_post - @request_token.should_receive(:authorize!).with(@user) - post :authorize, :oauth_token => @request_token.token, :authorize => "1" - end - - def do_post_without_user_authorization - @request_token.should_receive(:invalidate!) - post :authorize, :oauth_token => @request_token.token, :authorize => "0" - end - - def do_post_with_callback - @request_token.should_receive(:authorize!).with(@user) - post :authorize, :oauth_token => @request_token.token, :oauth_callback => "http://application/alternative", :authorize => "1" - end - - def do_post_with_no_application_callback - @request_token.should_receive(:authorize!).with(@user) - @client_application.stub!(:callback_url).and_return(nil) - post :authorize, :oauth_token => @request_token.token, :authorize => "1" - end - - it "should be successful" do - do_get - response.should be_success - end - - it "should query for client_application" do - RequestToken.should_receive(:find_by_token).and_return(@request_token) - do_get - end - - it "should assign token" do - do_get - assigns[:token].should equal(@request_token) - end - - it "should render authorize template" do - do_get - response.should render_template('authorize') - end - - it "should redirect to default callback" do - do_post - response.should be_redirect - response.should redirect_to("http://application/callback?oauth_token=#{@request_token.token}") - end - - it "should redirect to callback in query" do - do_post_with_callback - response.should be_redirect - response.should redirect_to("http://application/alternative?oauth_token=#{@request_token.token}") - end - - it "should be successful on authorize without any application callback" do - do_post_with_no_application_callback - response.should be_success - end - - it "should be successful on authorize without any application callback" do - do_post_with_no_application_callback - response.should render_template('authorize_success') - end - - it "should render failure screen on user invalidation" do - do_post_without_user_authorization - response.should render_template('authorize_failure') - end - - it "should render failure screen if token is invalidated" do - @request_token.should_receive(:invalidated?).and_return(true) - do_get - response.should render_template('authorize_failure') - end - - -end - - -describe OauthController, "getting an access token" do - include OAuthControllerSpecHelper - before(:each) do - setup_oauth - sign_request_with_oauth @request_token - @request_token.stub!(:exchange!).and_return(@access_token) - end - - def do_get - get :access_token - end - - it "should be successful" do - do_get - response.should be_success - end - - it "should query for client_application" do - ClientApplication.should_receive(:find_token).with(@request_token.token).and_return(@request_token) - do_get - end - - it "should request token from client_application" do - @request_token.should_receive(:exchange!).and_return(@access_token) - do_get - end - - it "should return token string" do - do_get - response.body.should == @access_token_string - end -end - -class OauthorizedController :both - before_filter :login_required, :only => :interactive - before_filter :oauth_required, :only => :token_only - - def interactive - end - - def token_only - end - - def both - end -end - -describe OauthorizedController, " access control" do - include OAuthControllerSpecHelper - - before(:each) do - end - - it "should have access_token set up correctly" do - setup_to_authorize_request - @access_token.is_a?(AccessToken).should == true - @access_token.should be_authorized - @access_token.should_not be_invalidated - @access_token.user.should == @user - @access_token.client_application.should == @client_application - end - - it "should return false for oauth? by default" do - controller.send(:oauth?).should == false - end - - it "should return nil for current_token by default" do - controller.send(:current_token).should be_nil - end - - it "should allow oauth when using login_or_oauth_required" do - setup_to_authorize_request - sign_request_with_oauth(@access_token) - ClientApplication.should_receive(:find_token).with(@access_token.token).and_return(@access_token) - get :both - controller.send(:current_token).should == @access_token - controller.send(:current_token).is_a?(AccessToken).should == true - controller.send(:current_user).should == @user - controller.send(:current_client_application).should == @client_application - response.code.should == '200' - response.should be_success - end - - it "should allow interactive when using login_or_oauth_required" do - login - get :both - response.should be_success - controller.send(:current_user).should == @user - controller.send(:current_token).should be_nil - end - - - it "should allow oauth when using oauth_required" do - setup_to_authorize_request - sign_request_with_oauth(@access_token) - ClientApplication.should_receive(:find_token).with(@access_token.token).and_return(@access_token) - get :token_only - controller.send(:current_token).should == @access_token - controller.send(:current_client_application).should == @client_application - controller.send(:current_user).should == @user - response.code.should == '200' - response.should be_success - end - - it "should disallow oauth using RequestToken when using oauth_required" do - setup_to_authorize_request - ClientApplication.should_receive(:find_token).with(@request_token.token).and_return(@request_token) - sign_request_with_oauth(@request_token) - get :token_only - response.code.should == '401' - end - - it "should disallow interactive when using oauth_required" do - login - get :token_only - response.code.should == '401' - - controller.send(:current_user).should == @user - controller.send(:current_token).should be_nil - end - - it "should disallow oauth when using login_required" do - setup_to_authorize_request - sign_request_with_oauth(@access_token) - get :interactive - response.code.should == "302" - controller.send(:current_user).should be_nil - controller.send(:current_token).should be_nil - end - - it "should allow interactive when using login_required" do - login - get :interactive - response.should be_success - controller.send(:current_user).should == @user - controller.send(:current_token).should be_nil - end - -end - -describe OauthController, "revoke" do - include OAuthControllerSpecHelper - before(:each) do - setup_oauth_for_user - @request_token.stub!(:invalidate!) - end - - def do_post - post :revoke, :token => "TOKEN STRING" - end - - it "should redirect to index" do - do_post - response.should be_redirect - response.should redirect_to('http://test.host/oauth_clients') - end - - it "should query current_users tokens" do - @tokens.should_receive(:find_by_token).and_return(@request_token) - do_post - end - - it "should call invalidate on token" do - @request_token.should_receive(:invalidate!) - do_post - end - -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller_spec_helper.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller_spec_helper.rb deleted file mode 100644 index 9e7128436..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller_spec_helper.rb +++ /dev/null @@ -1,74 +0,0 @@ -module OAuthControllerSpecHelper - def login - controller.stub!(:local_request?).and_return(true) - @user = mock_model(User) - controller.stub!(:current_user).and_return(@user) - @tokens = [] - @tokens.stub!(:find).and_return(@tokens) - @user.stub!(:tokens).and_return(@tokens) - User.stub!(:find_by_id).and_return(@user) - end - - def login_as_application_owner - login - @client_application = mock_model(ClientApplication) - @client_applications = [@client_application] - - @user.stub!(:client_applications).and_return(@client_applications) - @client_applications.stub!(:find).and_return(@client_application) - end - - def setup_oauth - controller.stub!(:local_request?).and_return(true) - @user||=mock_model(User) - - User.stub!(:find_by_id).and_return(@user) - - @server = OAuth::Server.new "http://test.host" - @consumer = OAuth::Consumer.new('key', 'secret',{:site => "http://test.host"}) - - @client_application = mock_model(ClientApplication) - controller.stub!(:current_client_application).and_return(@client_application) - ClientApplication.stub!(:find_by_key).and_return(@client_application) - @client_application.stub!(:key).and_return(@consumer.key) - @client_application.stub!(:secret).and_return(@consumer.secret) - @client_application.stub!(:name).and_return("Client Application name") - @client_application.stub!(:callback_url).and_return("http://application/callback") - @request_token = mock_model(RequestToken, :token => 'request_token', :client_application => @client_application, :secret => "request_secret", :user => @user) - @request_token.stub!(:invalidated?).and_return(false) - ClientApplication.stub!(:find_token).and_return(@request_token) - - @request_token_string = "oauth_token = request_token&oauth_token_secret = request_secret" - @request_token.stub!(:to_query).and_return(@request_token_string) - - @access_token = mock_model(AccessToken, :token => 'access_token', :client_application => @client_application, :secret => "access_secret", :user => @user) - @access_token.stub!(:invalidated?).and_return(false) - @access_token.stub!(:authorized?).and_return(true) - @access_token_string = "oauth_token = access_token&oauth_token_secret = access_secret" - @access_token.stub!(:to_query).and_return(@access_token_string) - - @client_application.stub!(:authorize_request?).and_return(true) -# @client_application.stub!(:sign_request_with_oauth_token).and_return(@request_token) - @client_application.stub!(:exchange_for_access_token).and_return(@access_token) - end - - def setup_oauth_for_user - login - setup_oauth - @tokens = [@request_token] - @tokens.stub!(:find).and_return(@tokens) - @tokens.stub!(:find_by_token).and_return(@request_token) - @user.stub!(:tokens).and_return(@tokens) - end - - def sign_request_with_oauth(token = nil) - ActionController::TestRequest.use_oauth = true - @request.configure_oauth(@consumer,token) - end - - def setup_to_authorize_request - setup_oauth - OauthToken.stub!(:find_by_token).with( @access_token.token).and_return(@access_token) - @access_token.stub!(:is_a?).and_return(true) - end -end \ No newline at end of file diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller_test.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller_test.rb deleted file mode 100644 index f75eaeec3..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller_test.rb +++ /dev/null @@ -1,310 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' -require File.dirname(__FILE__) + '/../oauth_controller_test_helper' -require 'oauth/client/action_controller_request' - -class OauthController; def rescue_action(e) raise e end; end - -class OauthControllerRequestTokenTest < ActionController::TestCase - include OAuthControllerTestHelper - tests OauthController - - def setup - @controller = OauthController.new - setup_oauth - sign_request_with_oauth - @client_application.stubs(:create_request_token).returns(@request_token) - end - - def do_get - get :request_token - end - - def test_should_be_successful - do_get - assert @response.success? - end - - def test_should_query_for_client_application - ClientApplication.expects(:find_by_key).with('key').returns(@client_application) - do_get - end - - def test_should_request_token_from_client_application - @client_application.expects(:create_request_token).returns(@request_token) - do_get - end - - def test_should_return_token_string - do_get - assert_equal @request_token_string, @response.body - end -end - -class OauthControllerTokenAuthorizationTest < ActionController::TestCase - include OAuthControllerTestHelper - tests OauthController - - def setup - @controller = OauthController.new - login - setup_oauth - RequestToken.stubs(:find_by_token).returns(@request_token) - end - - def do_get - get :authorize, :oauth_token => @request_token.token - end - - def do_post - @request_token.expects(:authorize!).with(@user) - post :authorize,:oauth_token=>@request_token.token,:authorize=>"1" - end - - def do_post_without_user_authorization - @request_token.expects(:invalidate!) - post :authorize,:oauth_token=>@request_token.token,:authorize=>"0" - end - - def do_post_with_callback - @request_token.expects(:authorize!).with(@user) - post :authorize,:oauth_token=>@request_token.token,:oauth_callback=>"http://application/alternative",:authorize=>"1" - end - - def do_post_with_no_application_callback - @request_token.expects(:authorize!).with(@user) - @client_application.stubs(:callback_url).returns(nil) - post :authorize, :oauth_token => @request_token.token, :authorize=>"1" - end - - def test_should_be_successful - do_get - assert @response.success? - end - - def test_should_query_for_client_application - RequestToken.expects(:find_by_token).returns(@request_token) - do_get - end - - def test_should_assign_token - do_get - assert_equal @request_token, assigns(:token) - end - - def test_should_render_authorize_template - do_get - assert_template('authorize') - end - - def test_should_redirect_to_default_callback - do_post - assert_response :redirect - assert_redirected_to("http://application/callback?oauth_token=#{@request_token.token}") - end - - def test_should_redirect_to_callback_in_query - do_post_with_callback - assert_response :redirect - assert_redirected_to("http://application/alternative?oauth_token=#{@request_token.token}") - end - - def test_should_be_successful_on_authorize_without_any_application_callback - do_post_with_no_application_callback - assert @response.success? - assert_template('authorize_success') - end - - def test_should_render_failure_screen_on_user_invalidation - do_post_without_user_authorization - assert_template('authorize_failure') - end - - def test_should_render_failure_screen_if_token_is_invalidated - @request_token.expects(:invalidated?).returns(true) - do_get - assert_template('authorize_failure') - end - - -end - -class OauthControllerGetAccessTokenTest < ActionController::TestCase - include OAuthControllerTestHelper - tests OauthController - - def setup - @controller = OauthController.new - setup_oauth - sign_request_with_oauth @request_token - @request_token.stubs(:exchange!).returns(@access_token) - end - - def do_get - get :access_token - end - - def test_should_be_successful - do_get - assert @response.success? - end - - def test_should_query_for_client_application - ClientApplication.expects(:find_token).with(@request_token.token).returns(@request_token) - do_get - end - - def test_should_request_token_from_client_application - @request_token.expects(:exchange!).returns(@access_token) - do_get - end - - def test_should__return_token_string - do_get - assert_equal @access_token_string, @response.body - end -end - -class OauthorizedController < ApplicationController - before_filter :login_or_oauth_required,:only=>:both - before_filter :login_required,:only=>:interactive - before_filter :oauth_required,:only=>:token_only - - def interactive - render :text => "interactive" - end - - def token_only - render :text => "token" - end - - def both - render :text => "both" - end -end - - -class OauthControllerAccessControlTest < ActionController::TestCase - include OAuthControllerTestHelper - tests OauthorizedController - - def setup - @controller = OauthorizedController.new - end - - def test_should__have_access_token_set_up_correctly - setup_to_authorize_request - assert @access_token.is_a?(AccessToken) - assert @access_token.authorized? - assert !@access_token.invalidated? - assert_equal @user, @access_token.user - assert_equal @client_application, @access_token.client_application - end - - def test_should_return_false_for_oauth_by_default - assert_equal false, @controller.send(:oauth?) - end - - def test_should_return_nil_for_current_token_by_default - assert_nil @controller.send(:current_token) - end - - def test_should_allow_oauth_when_using_login_or_oauth_required - setup_to_authorize_request - sign_request_with_oauth(@access_token) - ClientApplication.expects(:find_token).with(@access_token.token).returns(@access_token) - get :both - assert_equal @access_token, @controller.send(:current_token) - assert @controller.send(:current_token).is_a?(AccessToken) - assert_equal @user, @controller.send(:current_user) - assert_equal @client_application, @controller.send(:current_client_application) - assert_equal '200', @response.code - assert @response.success? - end - - def test_should_allow_interactive_when_using_login_or_oauth_required - login - get :both - assert @response.success? - assert_equal @user, @controller.send(:current_user) - assert_nil @controller.send(:current_token) - end - - def test_should_allow_oauth_when_using_oauth_required - setup_to_authorize_request - sign_request_with_oauth(@access_token) - ClientApplication.expects(:find_token).with(@access_token.token).returns(@access_token) - get :token_only - assert_equal @access_token, @controller.send(:current_token) - assert_equal @client_application, @controller.send(:current_client_application) - assert_equal @user, @controller.send(:current_user) - assert_equal '200', @response.code - assert @response.success? - end - - def test_should_disallow_oauth_using_request_token_when_using_oauth_required - setup_to_authorize_request - ClientApplication.expects(:find_token).with(@request_token.token).returns(@request_token) - sign_request_with_oauth(@request_token) - get :token_only - assert_equal '401', @response.code - end - - def test_should_disallow_interactive_when_using_oauth_required - login - get :token_only - assert_equal '401', @response.code - - assert_equal @user, @controller.send(:current_user) - assert_nil @controller.send(:current_token) - end - - def test_should_disallow_oauth_when_using_login_required - setup_to_authorize_request - sign_request_with_oauth(@access_token) - get :interactive - assert_equal "302",@response.code - assert_nil @controller.send(:current_user) - assert_nil @controller.send(:current_token) - end - - def test_should_allow_interactive_when_using_login_required - login - get :interactive - assert @response.success? - assert_equal @user, @controller.send(:current_user) - assert_nil @controller.send(:current_token) - end - -end - -class OauthControllerRevokeTest < ActionController::TestCase - include OAuthControllerTestHelper - tests OauthController - - def setup - @controller = OauthController.new - setup_oauth_for_user - @request_token.stubs(:invalidate!) - end - - def do_post - post :revoke, :token => "TOKEN STRING" - end - - def test_should_redirect_to_index - do_post - assert_response :redirect - assert_redirected_to('http://test.host/oauth_clients') - end - - def test_should_query_current_users_tokens - @tokens.expects(:find_by_token).returns(@request_token) - do_post - end - - def test_should_call_invalidate_on_token - @request_token.expects(:invalidate!) - do_post - end - -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller_test_helper.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller_test_helper.rb deleted file mode 100644 index 2827252ca..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/controller_test_helper.rb +++ /dev/null @@ -1,115 +0,0 @@ -require "mocha" -module OAuthControllerTestHelper - - # Some custom stuff since we're using Mocha - def mock_model(model_class, options_and_stubs = {}) - id = rand(10000) - options_and_stubs.reverse_merge! :id => id, - :to_param => id.to_s, - :new_record? => false, - :errors => stub("errors", :count => 0) - - m = stub("#{model_class.name}_#{options_and_stubs[:id]}", options_and_stubs) - m.instance_eval <<-CODE - def is_a?(other) - #{model_class}.ancestors.include?(other) - end - def kind_of?(other) - #{model_class}.ancestors.include?(other) - end - def instance_of?(other) - other == #{model_class} - end - def class - #{model_class} - end - CODE - yield m if block_given? - m - end - - def mock_full_client_application - mock_model(ClientApplication, - :name => "App1", - :url => "http://app.com", - :callback_url => "http://app.com/callback", - :support_url => "http://app.com/support", - :key => "asd23423yy", - :secret => "secret", - :oauth_server => OAuth::Server.new("http://kowabunga.com") - ) - end - - def login - @controller.stubs(:local_request?).returns(true) - @user = mock_model(User, :login => "ron") - @controller.stubs(:current_user).returns(@user) - @tokens=[] - @tokens.stubs(:find).returns(@tokens) - @user.stubs(:tokens).returns(@tokens) - User.stubs(:find_by_id).returns(@user) - end - - def login_as_application_owner - login - @client_application = mock_full_client_application - @client_applications = [@client_application] - - @user.stubs(:client_applications).returns(@client_applications) - @client_applications.stubs(:find).returns(@client_application) - end - - def setup_oauth - @controller.stubs(:local_request?).returns(true) - @user||=mock_model(User) - - User.stubs(:find_by_id).returns(@user) - - @server=OAuth::Server.new "http://test.host" - @consumer=OAuth::Consumer.new('key','secret',{:site=>"http://test.host"}) - - @client_application = mock_full_client_application - @controller.stubs(:current_client_application).returns(@client_application) - ClientApplication.stubs(:find_by_key).returns(@client_application) - @client_application.stubs(:key).returns(@consumer.key) - @client_application.stubs(:secret).returns(@consumer.secret) - @client_application.stubs(:name).returns("Client Application name") - @client_application.stubs(:callback_url).returns("http://application/callback") - @request_token=mock_model(RequestToken,:token=>'request_token',:client_application=>@client_application,:secret=>"request_secret",:user=>@user) - @request_token.stubs(:invalidated?).returns(false) - ClientApplication.stubs(:find_token).returns(@request_token) - - @request_token_string="oauth_token=request_token&oauth_token_secret=request_secret" - @request_token.stubs(:to_query).returns(@request_token_string) - - @access_token=mock_model(AccessToken,:token=>'access_token',:client_application=>@client_application,:secret=>"access_secret",:user=>@user) - @access_token.stubs(:invalidated?).returns(false) - @access_token.stubs(:authorized?).returns(true) - @access_token_string="oauth_token=access_token&oauth_token_secret=access_secret" - @access_token.stubs(:to_query).returns(@access_token_string) - - @client_application.stubs(:authorize_request?).returns(true) -# @client_application.stubs(:sign_request_with_oauth_token).returns(@request_token) - @client_application.stubs(:exchange_for_access_token).returns(@access_token) - end - - def setup_oauth_for_user - login - setup_oauth - @tokens=[@request_token] - @tokens.stubs(:find).returns(@tokens) - @tokens.stubs(:find_by_token).returns(@request_token) - @user.stubs(:tokens).returns(@tokens) - end - - def sign_request_with_oauth(token=nil) - ActionController::TestRequest.use_oauth=true - @request.configure_oauth(@consumer, token) - end - - def setup_to_authorize_request - setup_oauth - OauthToken.stubs(:find_by_token).with( @access_token.token).returns(@access_token) - @access_token.stubs(:is_a?).returns(true) - end -end \ No newline at end of file diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/edit.html.erb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/edit.html.erb deleted file mode 100644 index 6c4f5cef9..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/edit.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

Edit your application

-<%% form_for :client_application do |f| %> - <%%= render :partial => "form", :locals => { :f => f } %> - <%%= submit_tag "Edit" %> -<%% end %> \ No newline at end of file diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/helper.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/helper.rb deleted file mode 100644 index 010cf9f5a..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module OauthHelper -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/index.html.erb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/index.html.erb deleted file mode 100644 index fcb3a0314..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/index.html.erb +++ /dev/null @@ -1,40 +0,0 @@ -
<%%= flash[:notice] %>
-

OAuth Client Applications

-<%% unless @tokens.empty? %> -

The following tokens have been issued to applications in your name

- - - <%% @tokens.each do |token|%> - <%% content_tag_for :tr, token do %> - - - - <%% end %> - <%% end %> - -
ApplicationIssued 
<%%= link_to token.client_application.name, token.client_application.url %><%%= token.authorized_at %> - <%% form_tag :controller => 'oauth', :action => 'revoke' do %> - <%%= hidden_field_tag 'token', token.token %> - <%%= submit_tag "Revoke!" %> - <%% end %> -
-<%% end %> -

Application Developers

-<%% if @client_applications.empty? %> -

- Do you have an application you would like to register for use with us using the OAuth standard? -

-

- You must register your web application before it can make OAuth requests to this service -

-<%% else %> -

- You have the following client applications registered: -

- <%% @client_applications.each do |client|%> - <%% div_for client do %> - <%%= link_to client.name, :action => :show, :id => client.id %> - <%% end %> - <%% end %> -<%% end %> -

<%%= link_to "Register your application", :action => :new %>

diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/migration.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/migration.rb deleted file mode 100644 index c1b6b02c7..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/migration.rb +++ /dev/null @@ -1,44 +0,0 @@ -class CreateOauthTables < ActiveRecord::Migration - def self.up - create_table :client_applications do |t| - t.string :name - t.string :url - t.string :support_url - t.string :callback_url - t.string :key, :limit => 50 - t.string :secret, :limit => 50 - t.integer :user_id - - t.timestamps - end - add_index :client_applications, :key, :unique - - create_table :oauth_tokens do |t| - t.integer :user_id - t.string :type, :limit => 20 - t.integer :client_application_id - t.string :token, :limit => 50 - t.string :secret, :limit => 50 - t.timestamp :authorized_at, :invalidated_at - t.timestamps - end - - add_index :oauth_tokens, :token, :unique - - create_table :oauth_nonces do |t| - t.string :nonce - t.integer :timestamp - - t.timestamps - end - add_index :oauth_nonces,[:nonce, :timestamp], :unique - - end - - def self.down - drop_table :client_applications - drop_table :oauth_tokens - drop_table :oauth_nonces - end - -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/new.html.erb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/new.html.erb deleted file mode 100644 index be541da66..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

Register a new application

-<%% form_for :client_application, :url => { :action => :create } do |f| %> - <%%= render :partial => "form", :locals => { :f => f } %> - <%%= submit_tag "Register" %> -<%% end %> \ No newline at end of file diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce.rb deleted file mode 100644 index 075351b91..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce.rb +++ /dev/null @@ -1,13 +0,0 @@ -# Simple store of nonces. The OAuth Spec requires that any given pair of nonce and timestamps are unique. -# Thus you can use the same nonce with a different timestamp and viceversa. -class OauthNonce < ActiveRecord::Base - validates_presence_of :nonce, :timestamp - validates_uniqueness_of :nonce, :scope => :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) - return false if oauth_nonce.new_record? - oauth_nonce - end -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce_spec.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce_spec.rb deleted file mode 100644 index 7829bdc74..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -require File.dirname(__FILE__) + '/../spec_helper' -require 'oauth/helper' -describe OauthNonce do - include OAuth::Helper - before(:each) do - @oauth_nonce = OauthNonce.remember(generate_key, Time.now.to_i) - end - - it "should be valid" do - @oauth_nonce.should be_valid - end - - it "should not have errors" do - @oauth_nonce.errors.full_messages.should == [] - end - - it "should not be a new record" do - @oauth_nonce.should_not be_new_record - end - - it "should not allow a second one with the same values" do - OauthNonce.remember(@oauth_nonce.nonce,@oauth_nonce.timestamp).should == false - end -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce_test.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce_test.rb deleted file mode 100644 index 2fd6a755a..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce_test.rb +++ /dev/null @@ -1,26 +0,0 @@ -require 'oauth/helper' -require File.dirname(__FILE__) + '/../test_helper' - -class ClientNoneTest < ActiveSupport::TestCase - include OAuth::Helper - - def setup - @oauth_nonce = OauthNonce.remember(generate_key,Time.now.to_i) - end - - def test_should_be_valid - assert @oauth_nonce.valid? - end - - def test_should_not_have_errors - assert_equal [], @oauth_nonce.errors.full_messages - end - - def test_should_not_be_a_new_record - assert !@oauth_nonce.new_record? - end - - def test_shuold_not_allow_a_second_one_with_the_same_values - assert_equal false, OauthNonce.remember(@oauth_nonce.nonce, @oauth_nonce.timestamp) - end -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonces.yml b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonces.yml deleted file mode 100644 index 4e0b3062a..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonces.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html -one: - id: 1 - nonce: a_nonce - timestamp: 1 - created_at: 2007-11-25 17:27:04 - updated_at: 2007-11-25 17:27:04 -two: - id: 2 - nonce: b_nonce - timestamp: 2 - created_at: 2007-11-25 17:27:04 - updated_at: 2007-11-25 17:27:04 diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_token.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_token.rb deleted file mode 100644 index 5fca40ce2..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_token.rb +++ /dev/null @@ -1,31 +0,0 @@ -class OauthToken < ActiveRecord::Base - belongs_to :client_application - belongs_to :user - validates_uniqueness_of :token - validates_presence_of :client_application, :token, :secret - before_validation_on_create :generate_keys - - def invalidated? - invalidated_at != nil - end - - def invalidate! - update_attribute(:invalidated_at, Time.now) - end - - def authorized? - authorized_at != nil && !invalidated? - end - - def to_query - "oauth_token=#{token}&oauth_token_secret=#{secret}" - end - -protected - - def generate_keys - @oauth_token = client_application.oauth_server.generate_credentials - self.token = @oauth_token[0] - self.secret = @oauth_token[1] - end -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_token_spec.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_token_spec.rb deleted file mode 100644 index 594c204af..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_token_spec.rb +++ /dev/null @@ -1,55 +0,0 @@ -require File.dirname(__FILE__) + '/../spec_helper' - -describe RequestToken do - fixtures :client_applications, :users, :oauth_tokens - before(:each) do - @token = RequestToken.create :client_application => client_applications(:one) - end - - it "should be valid" do - @token.should be_valid - end - - it "should not have errors" do - @token.errors.should_not == [] - end - - it "should have a token" do - @token.token.should_not be_nil - end - - it "should have a secret" do - @token.secret.should_not be_nil - end - - it "should not be authorized" do - @token.should_not be_authorized - end - - it "should not be invalidated" do - @token.should_not be_invalidated - end - - it "should authorize request" do - @token.authorize!(users(:quentin)) - @token.should be_authorized - @token.authorized_at.should_not be_nil - @token.user.should == users(:quentin) - end - - it "should not exchange without approval" do - @token.exchange!.should == false - @token.should_not be_invalidated - end - - it "should not exchange without approval" do - @token.authorize!(users(:quentin)) - @access = @token.exchange! - @access.should_not == false - @token.should be_invalidated - - @access.user.should == users(:quentin) - @access.should be_authorized - end - -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_token_test.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_token_test.rb deleted file mode 100644 index dc7f5cb22..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_token_test.rb +++ /dev/null @@ -1,57 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class RequestTokenTest < ActiveSupport::TestCase - - fixtures :client_applications, :users, :oauth_tokens - - def setup - @token = RequestToken.create :client_application=>client_applications(:one) - end - - def test_should_be_valid - assert @token.valid? - end - - def test_should_not_have_errors - assert @token.errors.empty? - end - - def test_should_have_a_token - assert_not_nil @token.token - end - - def test_should_have_a_secret - assert_not_nil @token.secret - end - - def test_should_not_be_authorized - assert !@token.authorized? - end - - def test_should_not_be_invalidated - assert !@token.invalidated? - end - - def test_should_authorize_request - @token.authorize!(users(:quentin)) - assert @token.authorized? - assert_not_nil @token.authorized_at - assert_equal users(:quentin), @token.user - end - - def test_should_not_exchange_without_approval - assert_equal false, @token.exchange! - assert_equal false, @token.invalidated? - end - - def test_should_not_exchange_without_approval - @token.authorize!(users(:quentin)) - @access = @token.exchange! - assert_not_equal false, @access - assert @token.invalidated? - - assert_equal users(:quentin), @access.user - assert @access.authorized? - end - -end diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_tokens.yml b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_tokens.yml deleted file mode 100644 index 1c8006efd..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_tokens.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html -one: - id: 1 - user_id: 1 - client_application_id: 1 - token: one - secret: MyString - created_at: 2007-11-19 07:31:46 - updated_at: 2007-11-19 07:31:46 -two: - id: 2 - user_id: 1 - client_application_id: 1 - token: two - secret: MyString - created_at: 2007-11-19 07:31:46 - updated_at: 2007-11-19 07:31:46 diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/request_token.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/request_token.rb deleted file mode 100644 index b6047fe51..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/request_token.rb +++ /dev/null @@ -1,17 +0,0 @@ -class RequestToken < OauthToken - def authorize!(user) - return false if authorized? - self.user = user - self.authorized_at = Time.now - self.save - end - - def exchange! - return false unless authorized? - RequestToken.transaction do - access_token = AccessToken.create(:user => user, :client_application => client_application) - invalidate! - access_token - end - end -end \ No newline at end of file diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/show.html.erb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/show.html.erb deleted file mode 100644 index a997e2f73..000000000 --- a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/show.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -

OAuth details for <%%=@client_application.name %>

-

- Consumer Key: <%%=@client_application.key %> -

-

- Consumer Secret: <%%=@client_application.secret %> -

-

- Request Token URL http<%%='s' if request.ssl? %>://<%%= request.host_with_port %><%%=@client_application.oauth_server.request_token_path %> -

-

- Access Token URL http<%%='s' if request.ssl? %>://<%%= request.host_with_port %><%%=@client_application.oauth_server.access_token_path %> -

-

- Authorize URL http<%%='s' if request.ssl? %>://<%%= request.host_with_port %><%%=@client_application.oauth_server.authorize_path %> -

- -

- We support hmac-sha1 (recommended) as well as plain text in ssl mode. -

\ No newline at end of file diff --git a/vendor/plugins/oauth-plugin/init.rb b/vendor/plugins/oauth-plugin/init.rb deleted file mode 100644 index 28e25563c..000000000 --- a/vendor/plugins/oauth-plugin/init.rb +++ /dev/null @@ -1,6 +0,0 @@ -gem 'oauth', '>=0.2.1' -require 'oauth/signature/hmac/sha1' -require 'oauth/request_proxy/action_controller_request' -require 'oauth/server' -require 'oauth/rails/controller_methods' -ActionController::Base.send :include, OAuth::Rails::ControllerMethods diff --git a/vendor/plugins/oauth-plugin/install.rb b/vendor/plugins/oauth-plugin/install.rb deleted file mode 100644 index f1531bd89..000000000 --- a/vendor/plugins/oauth-plugin/install.rb +++ /dev/null @@ -1,2 +0,0 @@ -#should we do any text formatting? -puts IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) \ No newline at end of file diff --git a/vendor/plugins/oauth-plugin/lib/oauth/rails/controller_methods.rb b/vendor/plugins/oauth-plugin/lib/oauth/rails/controller_methods.rb deleted file mode 100644 index 668328b7e..000000000 --- a/vendor/plugins/oauth-plugin/lib/oauth/rails/controller_methods.rb +++ /dev/null @@ -1,114 +0,0 @@ -require 'oauth/signature' -module OAuth - module Rails - - module ControllerMethods - protected - - def current_token - @current_token - end - - def current_client_application - @current_client_application - end - - def oauthenticate - logger.info "entering oauthenticate" - verified=verify_oauth_signature - logger.info "verified=#{verified.to_s}" - return verified && current_token.is_a?(::AccessToken) - end - - def oauth? - current_token!=nil - end - - # use in a before_filter - def oauth_required - logger.info "Current_token=#{@current_token.inspect}" - if oauthenticate - logger.info "passed oauthenticate" - if authorized? - logger.info "passed authorized" - return true - else - logger.info "failed authorized" - invalid_oauth_response - end - else - logger.info "failed oauthenticate" - - invalid_oauth_response - end - end - - # This requies that you have an acts_as_authenticated compatible authentication plugin installed - def login_or_oauth_required - if oauthenticate - if authorized? - return true - else - invalid_oauth_response - end - else - login_required - end - end - - - # verifies a request token request - def verify_oauth_consumer_signature - begin - valid = ClientApplication.verify_request(request) do |token, consumer_key| - @current_client_application = ClientApplication.find_by_key(consumer_key) - - # return the token secret and the consumer secret - [nil, @current_client_application.secret] - end - rescue - valid=false - end - - invalid_oauth_response unless valid - end - - def verify_oauth_request_token - verify_oauth_signature && current_token.is_a?(RequestToken) - end - - def invalid_oauth_response(code=401,message="Invalid OAuth Request") - render :text => message, :status => code - end - - private - - def current_token=(token) - @current_token=token - if @current_token - @current_user=@current_token.user - @current_client_application=@current_token.client_application - end - @current_token - end - - # Implement this for your own application using app-specific models - def verify_oauth_signature - begin - valid = ClientApplication.verify_request(request) do |request| - self.current_token = ClientApplication.find_token(request.token) - logger.info "self=#{self.class.to_s}" - logger.info "token=#{self.current_token}" - # return the token secret and the consumer secret - [(current_token.nil? ? nil : current_token.secret), (current_client_application.nil? ? nil : current_client_application.secret)] - end - # reset @current_user to clear state for restful_...._authentication - @current_user = nil if (!valid) - valid - rescue - false - end - end - end - end -end \ No newline at end of file diff --git a/vendor/plugins/oauth-plugin/tasks/oauth_tasks.rake b/vendor/plugins/oauth-plugin/tasks/oauth_tasks.rake deleted file mode 100644 index fd2b0e14f..000000000 --- a/vendor/plugins/oauth-plugin/tasks/oauth_tasks.rake +++ /dev/null @@ -1,4 +0,0 @@ -# desc "Explaining what the task does" -# task :oauth do -# # Task goes here -# end diff --git a/vendor/plugins/oauth-plugin/uninstall.rb b/vendor/plugins/oauth-plugin/uninstall.rb deleted file mode 100644 index 973833346..000000000 --- a/vendor/plugins/oauth-plugin/uninstall.rb +++ /dev/null @@ -1 +0,0 @@ -# Uninstall hook code here From 079b9fed845b429436c5e84c221154b64c500103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 23 Jun 2009 12:04:06 +0000 Subject: [PATCH 02/20] Change the map key from a static PNG image to a generated HTML table that can be translated. Solves ticket:1916 --- app/views/site/_key.html.erb | 174 +++++++++++++++++++++++- config/locales/en.yml | 51 +++++++ public/images/keymapnik10.png | Bin 18370 -> 0 bytes public/images/keymapnik11.png | Bin 23839 -> 0 bytes public/images/keymapnik12.png | Bin 35737 -> 0 bytes public/images/keymapnik13.png | Bin 42602 -> 0 bytes public/images/keymapnik15.png | Bin 45890 -> 0 bytes public/images/keymapnik6.png | Bin 5394 -> 0 bytes public/images/keymapnik7.png | Bin 6190 -> 0 bytes public/images/keymapnik8.png | Bin 8669 -> 0 bytes public/images/keymapnik9.png | Bin 10158 -> 0 bytes public/images/mapkey/admin.png | Bin 0 -> 148 bytes public/images/mapkey/allotments.png | Bin 0 -> 173 bytes public/images/mapkey/apron.png | Bin 0 -> 229 bytes public/images/mapkey/bridge.png | Bin 0 -> 167 bytes public/images/mapkey/bridleway.png | Bin 0 -> 268 bytes public/images/mapkey/brownfield.png | Bin 0 -> 195 bytes public/images/mapkey/building.png | Bin 0 -> 185 bytes public/images/mapkey/byway.png | Bin 0 -> 234 bytes public/images/mapkey/cable.png | Bin 0 -> 323 bytes public/images/mapkey/cemetery.png | Bin 0 -> 163 bytes public/images/mapkey/centre.png | Bin 0 -> 178 bytes public/images/mapkey/commercial.png | Bin 0 -> 195 bytes public/images/mapkey/common.png | Bin 0 -> 195 bytes public/images/mapkey/construction.png | Bin 0 -> 427 bytes public/images/mapkey/cycleway.png | Bin 0 -> 292 bytes public/images/mapkey/destination.png | Bin 0 -> 285 bytes public/images/mapkey/farm.png | Bin 0 -> 195 bytes public/images/mapkey/footway.png | Bin 0 -> 168 bytes public/images/mapkey/forest.png | Bin 0 -> 178 bytes public/images/mapkey/golf.png | Bin 0 -> 182 bytes public/images/mapkey/heathland.png | Bin 0 -> 183 bytes public/images/mapkey/industrial.png | Bin 0 -> 193 bytes public/images/mapkey/lake.png | Bin 0 -> 182 bytes public/images/mapkey/military.png | Bin 0 -> 183 bytes public/images/mapkey/motorway.png | Bin 0 -> 182 bytes public/images/mapkey/park.png | Bin 0 -> 176 bytes public/images/mapkey/permissive.png | Bin 0 -> 284 bytes public/images/mapkey/pitch.png | Bin 0 -> 182 bytes public/images/mapkey/primary.png | Bin 0 -> 180 bytes public/images/mapkey/primary12.png | Bin 0 -> 222 bytes public/images/mapkey/private.png | Bin 0 -> 282 bytes public/images/mapkey/rail.png | Bin 0 -> 167 bytes public/images/mapkey/rail13.png | Bin 0 -> 203 bytes public/images/mapkey/reserve.png | Bin 0 -> 183 bytes public/images/mapkey/resident.png | Bin 0 -> 176 bytes public/images/mapkey/retail.png | Bin 0 -> 192 bytes public/images/mapkey/runway.png | Bin 0 -> 236 bytes public/images/mapkey/school.png | Bin 0 -> 227 bytes public/images/mapkey/secondary.png | Bin 0 -> 171 bytes public/images/mapkey/secondary12.png | Bin 0 -> 216 bytes public/images/mapkey/station.png | Bin 0 -> 197 bytes public/images/mapkey/subway.png | Bin 0 -> 172 bytes public/images/mapkey/summit.png | Bin 0 -> 245 bytes public/images/mapkey/tourist.png | Bin 0 -> 180 bytes public/images/mapkey/track.png | Bin 0 -> 247 bytes public/images/mapkey/tram.png | Bin 0 -> 198 bytes public/images/mapkey/trunk.png | Bin 0 -> 182 bytes public/images/mapkey/trunk12.png | Bin 0 -> 226 bytes public/images/mapkey/tunnel.png | Bin 0 -> 256 bytes public/images/mapkey/unclassified.png | Bin 0 -> 156 bytes public/images/mapkey/unclassified13.png | Bin 0 -> 194 bytes public/images/mapkey/unsurfaced.png | Bin 0 -> 323 bytes public/images/mapkey/wood.png | Bin 0 -> 182 bytes public/stylesheets/site.css | 19 +++ 65 files changed, 239 insertions(+), 5 deletions(-) delete mode 100644 public/images/keymapnik10.png delete mode 100644 public/images/keymapnik11.png delete mode 100644 public/images/keymapnik12.png delete mode 100644 public/images/keymapnik13.png delete mode 100644 public/images/keymapnik15.png delete mode 100644 public/images/keymapnik6.png delete mode 100644 public/images/keymapnik7.png delete mode 100644 public/images/keymapnik8.png delete mode 100644 public/images/keymapnik9.png create mode 100644 public/images/mapkey/admin.png create mode 100644 public/images/mapkey/allotments.png create mode 100644 public/images/mapkey/apron.png create mode 100644 public/images/mapkey/bridge.png create mode 100644 public/images/mapkey/bridleway.png create mode 100644 public/images/mapkey/brownfield.png create mode 100644 public/images/mapkey/building.png create mode 100644 public/images/mapkey/byway.png create mode 100644 public/images/mapkey/cable.png create mode 100644 public/images/mapkey/cemetery.png create mode 100644 public/images/mapkey/centre.png create mode 100644 public/images/mapkey/commercial.png create mode 100644 public/images/mapkey/common.png create mode 100644 public/images/mapkey/construction.png create mode 100644 public/images/mapkey/cycleway.png create mode 100644 public/images/mapkey/destination.png create mode 100644 public/images/mapkey/farm.png create mode 100644 public/images/mapkey/footway.png create mode 100644 public/images/mapkey/forest.png create mode 100644 public/images/mapkey/golf.png create mode 100644 public/images/mapkey/heathland.png create mode 100644 public/images/mapkey/industrial.png create mode 100644 public/images/mapkey/lake.png create mode 100644 public/images/mapkey/military.png create mode 100644 public/images/mapkey/motorway.png create mode 100644 public/images/mapkey/park.png create mode 100644 public/images/mapkey/permissive.png create mode 100644 public/images/mapkey/pitch.png create mode 100644 public/images/mapkey/primary.png create mode 100644 public/images/mapkey/primary12.png create mode 100644 public/images/mapkey/private.png create mode 100644 public/images/mapkey/rail.png create mode 100644 public/images/mapkey/rail13.png create mode 100644 public/images/mapkey/reserve.png create mode 100644 public/images/mapkey/resident.png create mode 100644 public/images/mapkey/retail.png create mode 100644 public/images/mapkey/runway.png create mode 100644 public/images/mapkey/school.png create mode 100644 public/images/mapkey/secondary.png create mode 100644 public/images/mapkey/secondary12.png create mode 100644 public/images/mapkey/station.png create mode 100644 public/images/mapkey/subway.png create mode 100644 public/images/mapkey/summit.png create mode 100644 public/images/mapkey/tourist.png create mode 100644 public/images/mapkey/track.png create mode 100644 public/images/mapkey/tram.png create mode 100644 public/images/mapkey/trunk.png create mode 100644 public/images/mapkey/trunk12.png create mode 100644 public/images/mapkey/tunnel.png create mode 100644 public/images/mapkey/unclassified.png create mode 100644 public/images/mapkey/unclassified13.png create mode 100644 public/images/mapkey/unsurfaced.png create mode 100644 public/images/mapkey/wood.png diff --git a/app/views/site/_key.html.erb b/app/views/site/_key.html.erb index f01cb67dd..5a623c10b 100644 --- a/app/views/site/_key.html.erb +++ b/app/views/site/_key.html.erb @@ -4,15 +4,179 @@ + +<% content_for :left_menu do %> + <%= link_to_function t('site.key.map_key'), "openMapKey()", :title => t('site.key.map_key_tooltip') %> +<% end %> diff --git a/app/views/site/_sidebar.html.erb b/app/views/site/_sidebar.html.erb index dd15ef7ba..2dbcef432 100644 --- a/app/views/site/_sidebar.html.erb +++ b/app/views/site/_sidebar.html.erb @@ -21,6 +21,8 @@ onclose = null; } + if (options.title) { $("sidebar_title").innerHTML = options.title; } + if (options.width) { $("sidebar").style.width = options.width; } else { $("sidebar").style.width = "30%"; } @@ -46,10 +48,5 @@ $("sidebar_title").innerHTML = title; $("sidebar_content").innerHTML = content; } - - function sidebarOpen(title) { - return $("sidebar").style.display == "block" && - $("sidebar_title").innerHTML == title; - } // --> diff --git a/app/views/site/index.html.erb b/app/views/site/index.html.erb index a69a6b4ee..ecb732c9b 100644 --- a/app/views/site/index.html.erb +++ b/app/views/site/index.html.erb @@ -139,8 +139,6 @@ end marker = addMarkerToMap(new OpenLayers.LonLat(<%= mlon %>, <%= mlat %>)); <% end %> - map.events.register("zoomend", map, updateKey); - map.events.register("moveend", map, updateLocation); map.events.register("changelayer", map, updateLocation); updateLocation(); diff --git a/app/views/site/key.html.erb b/app/views/site/key.html.erb new file mode 100644 index 000000000..975442426 --- /dev/null +++ b/app/views/site/key.html.erb @@ -0,0 +1,21 @@ +
+

<%= t "site.key.table.heading", :zoom_level => params[:zoom] %>

+ + <% YAML.load_file("#{RAILS_ROOT}/config/key.yml").each do |name,data| %> + <% if params[:layer] == name %> + <% data.each do |entry| %> + <% if params[:zoom].to_i >= entry['min_zoom'] && params[:zoom].to_i <= entry['max_zoom'] %> + + + + + <% end %> + <% end %> + <% end %> + <% end %> +
+ <%= image_tag "key/#{name}/#{entry['image']}" %> + + <%= t "site.key.table.entry.#{entry['name']}" %> +
+
diff --git a/config/key.yml b/config/key.yml new file mode 100644 index 000000000..bd775a18a --- /dev/null +++ b/config/key.yml @@ -0,0 +1,52 @@ +mapnik: + - { min_zoom: 0, max_zoom: 18, name: motorway, image: motorway.png } + - { min_zoom: 0, max_zoom: 11, name: trunk, image: trunk.png } + - { min_zoom: 12, max_zoom: 18, name: trunk, image: trunk12.png } + - { min_zoom: 7, max_zoom: 11, name: primary, image: primary.png } + - { min_zoom: 12, max_zoom: 18, name: primary, image: primary12.png } + - { min_zoom: 9, max_zoom: 11, name: secondary, image: secondary.png } + - { min_zoom: 12, max_zoom: 18, name: secondary, image: secondary12.png } + - { min_zoom: 13, max_zoom: 18, name: unsurfaced, image: unsurfaced.png } + - { min_zoom: 13, max_zoom: 18, name: track, image: track.png } + - { min_zoom: 13, max_zoom: 18, name: byway, image: byway.png } + - { min_zoom: 13, max_zoom: 18, name: bridleway, image: bridleway.png } + - { min_zoom: 13, max_zoom: 18, name: cycleway, image: cycleway.png } + - { min_zoom: 13, max_zoom: 18, name: footway, image: footway.png } + - { min_zoom: 8, max_zoom: 12, name: rail, image: rail.png } + - { min_zoom: 13, max_zoom: 18, name: rail, image: rail13.png } + - { min_zoom: 13, max_zoom: 18, name: subway, image: subway.png } + - { min_zoom: 13, max_zoom: 18, name: tram, image: tram.png } + - { min_zoom: 12, max_zoom: 18, name: cable, image: cable.png } + - { min_zoom: 11, max_zoom: 18, name: runway, image: runway.png } + - { min_zoom: 12, max_zoom: 18, name: apron, image: apron.png } + - { min_zoom: 0, max_zoom: 18, name: admin, image: admin.png } + - { min_zoom: 9, max_zoom: 18, name: forest, image: forest.png } + - { min_zoom: 10, max_zoom: 18, name: wood, image: wood.png } + - { min_zoom: 10, max_zoom: 18, name: golf, image: golf.png } + - { min_zoom: 10, max_zoom: 18, name: park, image: park.png } + - { min_zoom: 8, max_zoom: 18, name: resident, image: resident.png } + - { min_zoom: 10, max_zoom: 18, name: tourist, image: tourist.png } + - { min_zoom: 10, max_zoom: 18, name: common, image: common.png } + - { min_zoom: 10, max_zoom: 18, name: retail, image: retail.png } + - { min_zoom: 10, max_zoom: 18, name: industrial, image: industrial.png } + - { min_zoom: 10, max_zoom: 18, name: commercial, image: commercial.png } + - { min_zoom: 10, max_zoom: 18, name: heathland, image: heathland.png } + - { min_zoom: 8, max_zoom: 18, name: lake, image: lake.png } + - { min_zoom: 10, max_zoom: 18, name: farm, image: farm.png } + - { min_zoom: 10, max_zoom: 18, name: brownfield, image: brownfield.png } + - { min_zoom: 11, max_zoom: 18, name: cemetery, image: cemetery.png } + - { min_zoom: 11, max_zoom: 18, name: allotments, image: allotments.png } + - { min_zoom: 11, max_zoom: 18, name: pitch, image: pitch.png } + - { min_zoom: 11, max_zoom: 18, name: centre, image: centre.png } + - { min_zoom: 11, max_zoom: 18, name: reserve, image: reserve.png } + - { min_zoom: 11, max_zoom: 18, name: military, image: military.png } + - { min_zoom: 12, max_zoom: 18, name: school, image: school.png } + - { min_zoom: 12, max_zoom: 18, name: building, image: building.png } + - { min_zoom: 12, max_zoom: 18, name: station, image: station.png } + - { min_zoom: 12, max_zoom: 18, name: summit, image: summit.png } + - { min_zoom: 12, max_zoom: 18, name: tunnel, image: tunnel.png } + - { min_zoom: 13, max_zoom: 18, name: bridge, image: bridge.png } + - { min_zoom: 15, max_zoom: 18, name: private, image: private.png } + - { min_zoom: 15, max_zoom: 18, name: permissive, image: permissive.png } + - { min_zoom: 15, max_zoom: 18, name: destination, image: destination.png } + - { min_zoom: 12, max_zoom: 18, name: construction, image: construction.png } diff --git a/config/locales/de.yml b/config/locales/de.yml index b2b02fe1f..fb2804bef 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -569,7 +569,7 @@ de: map_key: "Legende" map_key_tooltip: "Legende für die Mapnik-Karte bei diesem Zoom-Level" table: - heading: "Legende für Zoomstufe [[zoom_level]]" + heading: "Legende für Zoomstufe {{zoom_level}}" entry: motorway: "Autobahn" trunk: "Schnellstraße" diff --git a/config/locales/en.yml b/config/locales/en.yml index 4b90f9c7f..ad24fa16c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -569,7 +569,7 @@ en: map_key: "Map key" map_key_tooltip: "Map key for the mapnik rendering at this zoom level" table: - heading: "Legend for z[[zoom_level]]" + heading: "Legend for z{{zoom_level}}" entry: motorway: "Motorway" trunk: "Trunk road" diff --git a/public/images/mapkey/admin.png b/public/images/key/mapnik/admin.png similarity index 100% rename from public/images/mapkey/admin.png rename to public/images/key/mapnik/admin.png diff --git a/public/images/mapkey/allotments.png b/public/images/key/mapnik/allotments.png similarity index 100% rename from public/images/mapkey/allotments.png rename to public/images/key/mapnik/allotments.png diff --git a/public/images/mapkey/apron.png b/public/images/key/mapnik/apron.png similarity index 100% rename from public/images/mapkey/apron.png rename to public/images/key/mapnik/apron.png diff --git a/public/images/mapkey/bridge.png b/public/images/key/mapnik/bridge.png similarity index 100% rename from public/images/mapkey/bridge.png rename to public/images/key/mapnik/bridge.png diff --git a/public/images/mapkey/bridleway.png b/public/images/key/mapnik/bridleway.png similarity index 100% rename from public/images/mapkey/bridleway.png rename to public/images/key/mapnik/bridleway.png diff --git a/public/images/mapkey/brownfield.png b/public/images/key/mapnik/brownfield.png similarity index 100% rename from public/images/mapkey/brownfield.png rename to public/images/key/mapnik/brownfield.png diff --git a/public/images/mapkey/building.png b/public/images/key/mapnik/building.png similarity index 100% rename from public/images/mapkey/building.png rename to public/images/key/mapnik/building.png diff --git a/public/images/mapkey/byway.png b/public/images/key/mapnik/byway.png similarity index 100% rename from public/images/mapkey/byway.png rename to public/images/key/mapnik/byway.png diff --git a/public/images/mapkey/cable.png b/public/images/key/mapnik/cable.png similarity index 100% rename from public/images/mapkey/cable.png rename to public/images/key/mapnik/cable.png diff --git a/public/images/mapkey/cemetery.png b/public/images/key/mapnik/cemetery.png similarity index 100% rename from public/images/mapkey/cemetery.png rename to public/images/key/mapnik/cemetery.png diff --git a/public/images/mapkey/centre.png b/public/images/key/mapnik/centre.png similarity index 100% rename from public/images/mapkey/centre.png rename to public/images/key/mapnik/centre.png diff --git a/public/images/mapkey/commercial.png b/public/images/key/mapnik/commercial.png similarity index 100% rename from public/images/mapkey/commercial.png rename to public/images/key/mapnik/commercial.png diff --git a/public/images/mapkey/common.png b/public/images/key/mapnik/common.png similarity index 100% rename from public/images/mapkey/common.png rename to public/images/key/mapnik/common.png diff --git a/public/images/mapkey/construction.png b/public/images/key/mapnik/construction.png similarity index 100% rename from public/images/mapkey/construction.png rename to public/images/key/mapnik/construction.png diff --git a/public/images/mapkey/cycleway.png b/public/images/key/mapnik/cycleway.png similarity index 100% rename from public/images/mapkey/cycleway.png rename to public/images/key/mapnik/cycleway.png diff --git a/public/images/mapkey/destination.png b/public/images/key/mapnik/destination.png similarity index 100% rename from public/images/mapkey/destination.png rename to public/images/key/mapnik/destination.png diff --git a/public/images/mapkey/farm.png b/public/images/key/mapnik/farm.png similarity index 100% rename from public/images/mapkey/farm.png rename to public/images/key/mapnik/farm.png diff --git a/public/images/mapkey/footway.png b/public/images/key/mapnik/footway.png similarity index 100% rename from public/images/mapkey/footway.png rename to public/images/key/mapnik/footway.png diff --git a/public/images/mapkey/forest.png b/public/images/key/mapnik/forest.png similarity index 100% rename from public/images/mapkey/forest.png rename to public/images/key/mapnik/forest.png diff --git a/public/images/mapkey/golf.png b/public/images/key/mapnik/golf.png similarity index 100% rename from public/images/mapkey/golf.png rename to public/images/key/mapnik/golf.png diff --git a/public/images/mapkey/heathland.png b/public/images/key/mapnik/heathland.png similarity index 100% rename from public/images/mapkey/heathland.png rename to public/images/key/mapnik/heathland.png diff --git a/public/images/mapkey/industrial.png b/public/images/key/mapnik/industrial.png similarity index 100% rename from public/images/mapkey/industrial.png rename to public/images/key/mapnik/industrial.png diff --git a/public/images/mapkey/lake.png b/public/images/key/mapnik/lake.png similarity index 100% rename from public/images/mapkey/lake.png rename to public/images/key/mapnik/lake.png diff --git a/public/images/mapkey/military.png b/public/images/key/mapnik/military.png similarity index 100% rename from public/images/mapkey/military.png rename to public/images/key/mapnik/military.png diff --git a/public/images/mapkey/motorway.png b/public/images/key/mapnik/motorway.png similarity index 100% rename from public/images/mapkey/motorway.png rename to public/images/key/mapnik/motorway.png diff --git a/public/images/mapkey/park.png b/public/images/key/mapnik/park.png similarity index 100% rename from public/images/mapkey/park.png rename to public/images/key/mapnik/park.png diff --git a/public/images/mapkey/permissive.png b/public/images/key/mapnik/permissive.png similarity index 100% rename from public/images/mapkey/permissive.png rename to public/images/key/mapnik/permissive.png diff --git a/public/images/mapkey/pitch.png b/public/images/key/mapnik/pitch.png similarity index 100% rename from public/images/mapkey/pitch.png rename to public/images/key/mapnik/pitch.png diff --git a/public/images/mapkey/primary.png b/public/images/key/mapnik/primary.png similarity index 100% rename from public/images/mapkey/primary.png rename to public/images/key/mapnik/primary.png diff --git a/public/images/mapkey/primary12.png b/public/images/key/mapnik/primary12.png similarity index 100% rename from public/images/mapkey/primary12.png rename to public/images/key/mapnik/primary12.png diff --git a/public/images/mapkey/private.png b/public/images/key/mapnik/private.png similarity index 100% rename from public/images/mapkey/private.png rename to public/images/key/mapnik/private.png diff --git a/public/images/mapkey/rail.png b/public/images/key/mapnik/rail.png similarity index 100% rename from public/images/mapkey/rail.png rename to public/images/key/mapnik/rail.png diff --git a/public/images/mapkey/rail13.png b/public/images/key/mapnik/rail13.png similarity index 100% rename from public/images/mapkey/rail13.png rename to public/images/key/mapnik/rail13.png diff --git a/public/images/mapkey/reserve.png b/public/images/key/mapnik/reserve.png similarity index 100% rename from public/images/mapkey/reserve.png rename to public/images/key/mapnik/reserve.png diff --git a/public/images/mapkey/resident.png b/public/images/key/mapnik/resident.png similarity index 100% rename from public/images/mapkey/resident.png rename to public/images/key/mapnik/resident.png diff --git a/public/images/mapkey/retail.png b/public/images/key/mapnik/retail.png similarity index 100% rename from public/images/mapkey/retail.png rename to public/images/key/mapnik/retail.png diff --git a/public/images/mapkey/runway.png b/public/images/key/mapnik/runway.png similarity index 100% rename from public/images/mapkey/runway.png rename to public/images/key/mapnik/runway.png diff --git a/public/images/mapkey/school.png b/public/images/key/mapnik/school.png similarity index 100% rename from public/images/mapkey/school.png rename to public/images/key/mapnik/school.png diff --git a/public/images/mapkey/secondary.png b/public/images/key/mapnik/secondary.png similarity index 100% rename from public/images/mapkey/secondary.png rename to public/images/key/mapnik/secondary.png diff --git a/public/images/mapkey/secondary12.png b/public/images/key/mapnik/secondary12.png similarity index 100% rename from public/images/mapkey/secondary12.png rename to public/images/key/mapnik/secondary12.png diff --git a/public/images/mapkey/station.png b/public/images/key/mapnik/station.png similarity index 100% rename from public/images/mapkey/station.png rename to public/images/key/mapnik/station.png diff --git a/public/images/mapkey/subway.png b/public/images/key/mapnik/subway.png similarity index 100% rename from public/images/mapkey/subway.png rename to public/images/key/mapnik/subway.png diff --git a/public/images/mapkey/summit.png b/public/images/key/mapnik/summit.png similarity index 100% rename from public/images/mapkey/summit.png rename to public/images/key/mapnik/summit.png diff --git a/public/images/mapkey/tourist.png b/public/images/key/mapnik/tourist.png similarity index 100% rename from public/images/mapkey/tourist.png rename to public/images/key/mapnik/tourist.png diff --git a/public/images/mapkey/track.png b/public/images/key/mapnik/track.png similarity index 100% rename from public/images/mapkey/track.png rename to public/images/key/mapnik/track.png diff --git a/public/images/mapkey/tram.png b/public/images/key/mapnik/tram.png similarity index 100% rename from public/images/mapkey/tram.png rename to public/images/key/mapnik/tram.png diff --git a/public/images/mapkey/trunk.png b/public/images/key/mapnik/trunk.png similarity index 100% rename from public/images/mapkey/trunk.png rename to public/images/key/mapnik/trunk.png diff --git a/public/images/mapkey/trunk12.png b/public/images/key/mapnik/trunk12.png similarity index 100% rename from public/images/mapkey/trunk12.png rename to public/images/key/mapnik/trunk12.png diff --git a/public/images/mapkey/tunnel.png b/public/images/key/mapnik/tunnel.png similarity index 100% rename from public/images/mapkey/tunnel.png rename to public/images/key/mapnik/tunnel.png diff --git a/public/images/mapkey/unclassified.png b/public/images/key/mapnik/unclassified.png similarity index 100% rename from public/images/mapkey/unclassified.png rename to public/images/key/mapnik/unclassified.png diff --git a/public/images/mapkey/unclassified13.png b/public/images/key/mapnik/unclassified13.png similarity index 100% rename from public/images/mapkey/unclassified13.png rename to public/images/key/mapnik/unclassified13.png diff --git a/public/images/mapkey/unsurfaced.png b/public/images/key/mapnik/unsurfaced.png similarity index 100% rename from public/images/mapkey/unsurfaced.png rename to public/images/key/mapnik/unsurfaced.png diff --git a/public/images/mapkey/wood.png b/public/images/key/mapnik/wood.png similarity index 100% rename from public/images/mapkey/wood.png rename to public/images/key/mapnik/wood.png From e3f37d98722af2dfb6cc121f3232c16be9eb65fd Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 24 Jun 2009 23:39:25 +0000 Subject: [PATCH 14/20] Add new route for AJAX call to get map key. --- config/routes.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/routes.rb b/config/routes.rb index 92bc493e1..b410c2b90 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -93,6 +93,7 @@ ActionController::Routing::Routes.draw do |map| map.connect '/login', :controller => 'user', :action => 'login' map.connect '/logout', :controller => 'user', :action => 'logout' map.connect '/offline', :controller => 'site', :action => 'offline' + map.connect '/key', :controller => 'site', :action => 'key' map.connect '/user/new', :controller => 'user', :action => 'new' map.connect '/user/save', :controller => 'user', :action => 'save' map.connect '/user/confirm', :controller => 'user', :action => 'confirm' From 0676477794c8b0c92dc2f91bbc1bcd016107b148 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 24 Jun 2009 23:39:46 +0000 Subject: [PATCH 15/20] Add some more languages to the OpenLayers build. --- config/openlayers.cfg | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/openlayers.cfg b/config/openlayers.cfg index d3799e0cb..7b7e66326 100644 --- a/config/openlayers.cfg +++ b/config/openlayers.cfg @@ -42,11 +42,15 @@ OpenLayers/Popup/AnchoredBuddle.js OpenLayers/Projection.js OpenLayers/Console.js OpenLayers/Lang.js +OpenLayers/Lang/ca.js OpenLayers/Lang/de.js OpenLayers/Lang/en.js +OpenLayers/Lang/es.js OpenLayers/Lang/fr.js OpenLayers/Lang/it.js OpenLayers/Lang/nl.js +OpenLayers/Lang/pt-BR.js OpenLayers/Lang/zh-CN.js +OpenLayers/Lang/zh-TW.js [exclude] From 5b0174a3b651c55c521aafe06dabd3ddf51b6e98 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 24 Jun 2009 23:40:31 +0000 Subject: [PATCH 16/20] Update to 2.8 release of OpenLayers. --- public/openlayers/OpenLayers.js | 1293 +++++++++-------- .../openlayers/theme/default/framedCloud.css | 5 - public/openlayers/theme/default/google.css | 9 + public/openlayers/theme/default/img/ruler.png | Bin 0 -> 1211 bytes public/openlayers/theme/default/style.css | 26 + 5 files changed, 748 insertions(+), 585 deletions(-) create mode 100644 public/openlayers/theme/default/google.css create mode 100644 public/openlayers/theme/default/img/ruler.png diff --git a/public/openlayers/OpenLayers.js b/public/openlayers/OpenLayers.js index 8d59c1114..6145fa994 100644 --- a/public/openlayers/OpenLayers.js +++ b/public/openlayers/OpenLayers.js @@ -90,15 +90,15 @@ * issues. Applications that use the code below will continue to work seamlessly * when that happens. */ -var OpenLayers={singleFile:true};(function(){var singleFile=(typeof OpenLayers=="object"&&OpenLayers.singleFile);window.OpenLayers={_scriptName:(!singleFile)?"lib/OpenLayers.js":"OpenLayers.js",_getScriptLocation:function(){var scriptLocation="";var scriptName=OpenLayers._scriptName;var scripts=document.getElementsByTagName('script');for(var i=0,len=scripts.length;i-1)&&(index+scriptName.length==pathLength)){scriptLocation=src.slice(0,pathLength-scriptName.length);break;}}} -return scriptLocation;}};if(!singleFile){var jsfiles=new Array("OpenLayers/Util.js","OpenLayers/BaseTypes.js","OpenLayers/BaseTypes/Class.js","OpenLayers/BaseTypes/Bounds.js","OpenLayers/BaseTypes/Element.js","OpenLayers/BaseTypes/LonLat.js","OpenLayers/BaseTypes/Pixel.js","OpenLayers/BaseTypes/Size.js","OpenLayers/Console.js","OpenLayers/Tween.js","Rico/Corner.js","Rico/Color.js","Gears/gears_init.js","OpenLayers/Ajax.js","OpenLayers/Request.js","OpenLayers/Request/XMLHttpRequest.js","OpenLayers/Events.js","OpenLayers/Projection.js","OpenLayers/Map.js","OpenLayers/Layer.js","OpenLayers/Icon.js","OpenLayers/Marker.js","OpenLayers/Marker/Box.js","OpenLayers/Popup.js","OpenLayers/Tile.js","OpenLayers/Tile/Image.js","OpenLayers/Tile/WFS.js","OpenLayers/Layer/Image.js","OpenLayers/Layer/SphericalMercator.js","OpenLayers/Layer/EventPane.js","OpenLayers/Layer/FixedZoomLevels.js","OpenLayers/Layer/Google.js","OpenLayers/Layer/VirtualEarth.js","OpenLayers/Layer/Yahoo.js","OpenLayers/Layer/HTTPRequest.js","OpenLayers/Layer/Grid.js","OpenLayers/Layer/MapGuide.js","OpenLayers/Layer/MapServer.js","OpenLayers/Layer/MapServer/Untiled.js","OpenLayers/Layer/KaMap.js","OpenLayers/Layer/KaMapCache.js","OpenLayers/Layer/MultiMap.js","OpenLayers/Layer/Markers.js","OpenLayers/Layer/Text.js","OpenLayers/Layer/WorldWind.js","OpenLayers/Layer/WMS.js","OpenLayers/Layer/WMS/Untiled.js","OpenLayers/Layer/GeoRSS.js","OpenLayers/Layer/Boxes.js","OpenLayers/Layer/TMS.js","OpenLayers/Layer/TileCache.js","OpenLayers/Popup/Anchored.js","OpenLayers/Popup/AnchoredBubble.js","OpenLayers/Popup/Framed.js","OpenLayers/Popup/FramedCloud.js","OpenLayers/Feature.js","OpenLayers/Feature/Vector.js","OpenLayers/Feature/WFS.js","OpenLayers/Handler.js","OpenLayers/Handler/Click.js","OpenLayers/Handler/Hover.js","OpenLayers/Handler/Point.js","OpenLayers/Handler/Path.js","OpenLayers/Handler/Polygon.js","OpenLayers/Handler/Feature.js","OpenLayers/Handler/Drag.js","OpenLayers/Handler/RegularPolygon.js","OpenLayers/Handler/Box.js","OpenLayers/Handler/MouseWheel.js","OpenLayers/Handler/Keyboard.js","OpenLayers/Control.js","OpenLayers/Control/Attribution.js","OpenLayers/Control/Button.js","OpenLayers/Control/ZoomBox.js","OpenLayers/Control/ZoomToMaxExtent.js","OpenLayers/Control/DragPan.js","OpenLayers/Control/Navigation.js","OpenLayers/Control/MouseDefaults.js","OpenLayers/Control/MousePosition.js","OpenLayers/Control/OverviewMap.js","OpenLayers/Control/KeyboardDefaults.js","OpenLayers/Control/PanZoom.js","OpenLayers/Control/PanZoomBar.js","OpenLayers/Control/ArgParser.js","OpenLayers/Control/Permalink.js","OpenLayers/Control/Scale.js","OpenLayers/Control/ScaleLine.js","OpenLayers/Control/LayerSwitcher.js","OpenLayers/Control/DrawFeature.js","OpenLayers/Control/DragFeature.js","OpenLayers/Control/ModifyFeature.js","OpenLayers/Control/Panel.js","OpenLayers/Control/SelectFeature.js","OpenLayers/Control/NavigationHistory.js","OpenLayers/Control/Measure.js","OpenLayers/Geometry.js","OpenLayers/Geometry/Rectangle.js","OpenLayers/Geometry/Collection.js","OpenLayers/Geometry/Point.js","OpenLayers/Geometry/MultiPoint.js","OpenLayers/Geometry/Curve.js","OpenLayers/Geometry/LineString.js","OpenLayers/Geometry/LinearRing.js","OpenLayers/Geometry/Polygon.js","OpenLayers/Geometry/MultiLineString.js","OpenLayers/Geometry/MultiPolygon.js","OpenLayers/Geometry/Surface.js","OpenLayers/Renderer.js","OpenLayers/Renderer/Elements.js","OpenLayers/Renderer/SVG.js","OpenLayers/Renderer/Canvas.js","OpenLayers/Renderer/VML.js","OpenLayers/Layer/Vector.js","OpenLayers/Strategy.js","OpenLayers/Strategy/Fixed.js","OpenLayers/Strategy/Cluster.js","OpenLayers/Strategy/Paging.js","OpenLayers/Strategy/BBOX.js","OpenLayers/Protocol.js","OpenLayers/Protocol/HTTP.js","OpenLayers/Protocol/SQL.js","OpenLayers/Protocol/SQL/Gears.js","OpenLayers/Layer/PointTrack.js","OpenLayers/Layer/GML.js","OpenLayers/Style.js","OpenLayers/StyleMap.js","OpenLayers/Rule.js","OpenLayers/Filter.js","OpenLayers/Filter/FeatureId.js","OpenLayers/Filter/Logical.js","OpenLayers/Filter/Comparison.js","OpenLayers/Filter/Spatial.js","OpenLayers/Format.js","OpenLayers/Format/XML.js","OpenLayers/Format/GML.js","OpenLayers/Format/GML/Base.js","OpenLayers/Format/GML/v2.js","OpenLayers/Format/GML/v3.js","OpenLayers/Format/KML.js","OpenLayers/Format/GeoRSS.js","OpenLayers/Format/WFS.js","OpenLayers/Format/WKT.js","OpenLayers/Format/OSM.js","OpenLayers/Format/GPX.js","OpenLayers/Format/SLD.js","OpenLayers/Format/SLD/v1.js","OpenLayers/Format/SLD/v1_0_0.js","OpenLayers/Format/SLD/v1.js","OpenLayers/Format/Filter.js","OpenLayers/Format/Filter/v1.js","OpenLayers/Format/Filter/v1_0_0.js","OpenLayers/Format/Text.js","OpenLayers/Format/JSON.js","OpenLayers/Format/GeoJSON.js","OpenLayers/Format/WMC.js","OpenLayers/Format/WMC/v1.js","OpenLayers/Format/WMC/v1_0_0.js","OpenLayers/Format/WMC/v1_1_0.js","OpenLayers/Layer/WFS.js","OpenLayers/Control/MouseToolbar.js","OpenLayers/Control/NavToolbar.js","OpenLayers/Control/PanPanel.js","OpenLayers/Control/Pan.js","OpenLayers/Control/ZoomIn.js","OpenLayers/Control/ZoomOut.js","OpenLayers/Control/ZoomPanel.js","OpenLayers/Control/EditingToolbar.js","OpenLayers/Lang.js","OpenLayers/Lang/en.js");var agent=navigator.userAgent;var docWrite=(agent.match("MSIE")||agent.match("Safari"));if(docWrite){var allScriptTags=new Array(jsfiles.length);} +var OpenLayers={singleFile:true};(function(){var singleFile=(typeof OpenLayers=="object"&&OpenLayers.singleFile);window.OpenLayers={_scriptName:(!singleFile)?"lib/OpenLayers.js":"OpenLayers.js",_getScriptLocation:function(){var scriptLocation="";var isOL=new RegExp("(^|(.*?\\/))("+OpenLayers._scriptName+")(\\?|$)");var scripts=document.getElementsByTagName('script');for(var i=0,len=scripts.length;i";}else{var s=document.createElement("script");s.src=host+jsfiles[i];var h=document.getElementsByTagName("head").length?document.getElementsByTagName("head")[0]:document.body;h.appendChild(s);}} -if(docWrite){document.write(allScriptTags.join(""));}}})();OpenLayers.VERSION_NUMBER="$Revision: 8012 $";OpenLayers.String={startsWith:function(str,sub){return(str.indexOf(sub)==0);},contains:function(str,sub){return(str.indexOf(sub)!=-1);},trim:function(str){return str.replace(/^\s*(.*?)\s*$/,"$1");},camelize:function(str){var oStringList=str.split('-');var camelizedString=oStringList[0];for(var i=1,len=oStringList.length;i0){replacement=context[item.substring(0,last)];if(typeof replacement=="function"){replacement=args?replacement.apply(null,args):replacement();} -tokens[i]=replacement+item.substring(++last);}else{tokens[i]="${"+item;}} -return tokens.join("");},numberRegEx:/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,isNumeric:function(value){return OpenLayers.String.numberRegEx.test(value);}};if(!String.prototype.startsWith){String.prototype.startsWith=function(sStart){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.String.startsWith'}));return OpenLayers.String.startsWith(this,sStart);};} +var replacer=function(str,match){var replacement;var subs=match.split(/\.+/);for(var i=0;i1){initialize=arguments[i].prototype.initialize;arguments[i].prototype.initialize=function(){};extended=new arguments[i];if(initialize===undefined){delete arguments[i].prototype.initialize;}else{arguments[i].prototype.initialize=initialize;}} +parent=arguments[i].prototype;}else{parent=arguments[i];} OpenLayers.Util.extend(extended,parent);} Class.prototype=extended;return Class;};OpenLayers.Class.isPrototype=function(){};OpenLayers.Class.create=function(){return function(){if(arguments&&arguments[0]!=OpenLayers.Class.isPrototype){this.initialize.apply(this,arguments);}};};OpenLayers.Class.inherit=function(){var superClass=arguments[0];var proto=new superClass(OpenLayers.Class.isPrototype);for(var i=1,len=arguments.length;i=0;i--){if(array[i]==item){array.splice(i,1);}} @@ -138,11 +139,12 @@ OpenLayers.Util.modifyDOMElement(dom,id,px,sz,position,border,overflow,opacity); if(!position){position="relative";} OpenLayers.Util.modifyDOMElement(image,id,px,sz,position,border,null,opacity);if(delayDisplay){image.style.display="none";OpenLayers.Event.observe(image,"load",OpenLayers.Function.bind(OpenLayers.Util.onImageLoad,image));OpenLayers.Event.observe(image,"error",OpenLayers.Function.bind(OpenLayers.Util.onImageLoadError,image));} image.style.alt=id;image.galleryImg="no";if(imgURL){image.src=imgURL;} -return image;};OpenLayers.Util.setOpacity=function(element,opacity){OpenLayers.Util.modifyDOMElement(element,null,null,null,null,null,null,opacity);};OpenLayers.Util.onImageLoad=function(){if(!this.viewRequestID||(this.map&&this.viewRequestID==this.map.viewRequestID)){this.style.backgroundColor=null;this.style.display="";}};OpenLayers.Util.onImageLoadErrorColor="pink";OpenLayers.IMAGE_RELOAD_ATTEMPTS=0;OpenLayers.Util.onImageLoadError=function(){this._attempts=(this._attempts)?(this._attempts+1):1;if(this._attempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS){var urls=this.urls;if(urls&&urls instanceof Array&&urls.length>1){var src=this.src.toString();var current_url,k;for(k=0;current_url=urls[k];k++){if(src.indexOf(current_url)!=-1){break;}} +return image;};OpenLayers.Util.setOpacity=function(element,opacity){OpenLayers.Util.modifyDOMElement(element,null,null,null,null,null,null,opacity);};OpenLayers.Util.onImageLoad=function(){if(!this.viewRequestID||(this.map&&this.viewRequestID==this.map.viewRequestID)){this.style.backgroundColor="transparent";this.style.display="";}};OpenLayers.Util.onImageLoadErrorColor="pink";OpenLayers.IMAGE_RELOAD_ATTEMPTS=0;OpenLayers.Util.onImageLoadError=function(){this._attempts=(this._attempts)?(this._attempts+1):1;if(this._attempts<=OpenLayers.IMAGE_RELOAD_ATTEMPTS){var urls=this.urls;if(urls&&urls instanceof Array&&urls.length>1){var src=this.src.toString();var current_url,k;for(k=0;current_url=urls[k];k++){if(src.indexOf(current_url)!=-1){break;}} var guess=Math.floor(urls.length*Math.random());var new_url=urls[guess];k=0;while(new_url==current_url&&k++<4){guess=Math.floor(urls.length*Math.random());new_url=urls[guess];} this.src=src.replace(current_url,new_url);}else{this.src=this.src;}}else{this.style.backgroundColor=OpenLayers.Util.onImageLoadErrorColor;} -this.style.display="";};OpenLayers.Util.alphaHack=function(){var arVersion=navigator.appVersion.split("MSIE");var version=parseFloat(arVersion[1]);var filter=false;try{filter=!!(document.body.filters);}catch(e){} -return(filter&&(version>=5.5)&&(version<7));};OpenLayers.Util.modifyAlphaImageDiv=function(div,id,px,sz,imgURL,position,border,sizing,opacity){OpenLayers.Util.modifyDOMElement(div,id,px,sz,position,null,null,opacity);var img=div.childNodes[0];if(imgURL){img.src=imgURL;} +this.style.display="";};OpenLayers.Util.alphaHackNeeded=null;OpenLayers.Util.alphaHack=function(){if(OpenLayers.Util.alphaHackNeeded==null){var arVersion=navigator.appVersion.split("MSIE");var version=parseFloat(arVersion[1]);var filter=false;try{filter=!!(document.body.filters);}catch(e){} +OpenLayers.Util.alphaHackNeeded=(filter&&(version>=5.5)&&(version<7));} +return OpenLayers.Util.alphaHackNeeded;};OpenLayers.Util.modifyAlphaImageDiv=function(div,id,px,sz,imgURL,position,border,sizing,opacity){OpenLayers.Util.modifyDOMElement(div,id,px,sz,position,null,null,opacity);var img=div.childNodes[0];if(imgURL){img.src=imgURL;} OpenLayers.Util.modifyDOMElement(img,div.id+"_innerImage",null,sz,"relative",border);if(OpenLayers.Util.alphaHack()){if(div.style.display!="none"){div.style.display="inline-block";} if(sizing==null){sizing="scale";} div.style.filter="progid:DXImageTransform.Microsoft"+".AlphaImageLoader(src='"+img.src+"', "+"sizingMethod='"+sizing+"')";if(parseFloat(div.style.opacity)>=0.0&&parseFloat(div.style.opacity)<1.0){div.style.filter+=" alpha(opacity="+div.style.opacity*100+")";} @@ -161,7 +163,9 @@ return retArray;};OpenLayers.Util.getTagText=function(parent,item,index){var res if(result[index].childNodes.length>1){return result.childNodes[1].nodeValue;} else if(result[index].childNodes.length==1){return result[index].firstChild.nodeValue;}}else{return"";}};OpenLayers.Util.getXmlNodeValue=function(node){var val=null;OpenLayers.Util.Try(function(){val=node.text;if(!val){val=node.textContent;} if(!val){val=node.firstChild.nodeValue;}},function(){val=node.textContent;});return val;};OpenLayers.Util.mouseLeft=function(evt,div){var target=(evt.relatedTarget)?evt.relatedTarget:evt.toElement;while(target!=div&&target!=null){target=target.parentNode;} -return(target!=div);};OpenLayers.Util.rad=function(x){return x*Math.PI/180;};OpenLayers.Util.distVincenty=function(p1,p2){var a=6378137,b=6356752.3142,f=1/298.257223563;var L=OpenLayers.Util.rad(p2.lon-p1.lon);var U1=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(p1.lat)));var U2=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(p2.lat)));var sinU1=Math.sin(U1),cosU1=Math.cos(U1);var sinU2=Math.sin(U2),cosU2=Math.cos(U2);var lambda=L,lambdaP=2*Math.PI;var iterLimit=20;while(Math.abs(lambda-lambdaP)>1e-12&&--iterLimit>0){var sinLambda=Math.sin(lambda),cosLambda=Math.cos(lambda);var sinSigma=Math.sqrt((cosU2*sinLambda)*(cosU2*sinLambda)+ +return(target!=div);};OpenLayers.Util.DEFAULT_PRECISION=14;OpenLayers.Util.toFloat=function(number,precision){if(precision==null){precision=OpenLayers.Util.DEFAULT_PRECISION;} +var number;if(precision==0){number=parseFloat(number);}else{number=parseFloat(parseFloat(number).toPrecision(precision));} +return number;};OpenLayers.Util.rad=function(x){return x*Math.PI/180;};OpenLayers.Util.distVincenty=function(p1,p2){var a=6378137,b=6356752.3142,f=1/298.257223563;var L=OpenLayers.Util.rad(p2.lon-p1.lon);var U1=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(p1.lat)));var U2=Math.atan((1-f)*Math.tan(OpenLayers.Util.rad(p2.lat)));var sinU1=Math.sin(U1),cosU1=Math.cos(U1);var sinU2=Math.sin(U2),cosU2=Math.cos(U2);var lambda=L,lambdaP=2*Math.PI;var iterLimit=20;while(Math.abs(lambda-lambdaP)>1e-12&&--iterLimit>0){var sinLambda=Math.sin(lambda),cosLambda=Math.cos(lambda);var sinSigma=Math.sqrt((cosU2*sinLambda)*(cosU2*sinLambda)+ (cosU1*sinU2-sinU1*cosU2*cosLambda)*(cosU1*sinU2-sinU1*cosU2*cosLambda));if(sinSigma==0){return 0;} var cosSigma=sinU1*sinU2+cosU1*cosU2*cosLambda;var sigma=Math.atan2(sinSigma,cosSigma);var alpha=Math.asin(cosU1*cosU2*sinLambda/sinSigma);var cosSqAlpha=Math.cos(alpha)*Math.cos(alpha);var cos2SigmaM=cosSigma-2*sinU1*sinU2/cosSqAlpha;var C=f/16*cosSqAlpha*(4+f*(4-3*cosSqAlpha));lambdaP=lambda;lambda=L+(1-C)*f*Math.sin(alpha)*(sigma+C*sinSigma*(cos2SigmaM+C*cosSigma*(-1+2*cos2SigmaM*cos2SigmaM)));} if(iterLimit==0){return NaN;} @@ -171,33 +175,30 @@ var parameters={};var pairs=paramsString.split(/[&;]/);for(var i=0,len=pairs.len if(value.length==1){value=value[0];} parameters[key]=value;}} return parameters;};OpenLayers.Util.getArgs=function(url){OpenLayers.Console.warn(OpenLayers.i18n("methodDeprecated",{'newMethod':'OpenLayers.Util.getParameters'}));return OpenLayers.Util.getParameters(url);};OpenLayers.Util.lastSeqID=0;OpenLayers.Util.createUniqueID=function(prefix){if(prefix==null){prefix="id_";} -OpenLayers.Util.lastSeqID+=1;return prefix+OpenLayers.Util.lastSeqID;};OpenLayers.INCHES_PER_UNIT={'inches':1.0,'ft':12.0,'mi':63360.0,'m':39.3701,'km':39370.1,'dd':4374754,'yd':36};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;OpenLayers.INCHES_PER_UNIT["degrees"]=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.INCHES_PER_UNIT["nmi"]=1852*OpenLayers.INCHES_PER_UNIT.m;OpenLayers.DOTS_PER_INCH=72;OpenLayers.Util.normalizeScale=function(scale){var normScale=(scale>1.0)?(1.0/scale):scale;return normScale;};OpenLayers.Util.getResolutionFromScale=function(scale,units){if(units==null){units="degrees";} +OpenLayers.Util.lastSeqID+=1;return prefix+OpenLayers.Util.lastSeqID;};OpenLayers.INCHES_PER_UNIT={'inches':1.0,'ft':12.0,'mi':63360.0,'m':39.3701,'km':39370.1,'dd':4374754,'yd':36};OpenLayers.INCHES_PER_UNIT["in"]=OpenLayers.INCHES_PER_UNIT.inches;OpenLayers.INCHES_PER_UNIT["degrees"]=OpenLayers.INCHES_PER_UNIT.dd;OpenLayers.INCHES_PER_UNIT["nmi"]=1852*OpenLayers.INCHES_PER_UNIT.m;OpenLayers.METERS_PER_INCH=0.02540005080010160020;OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{"Inch":OpenLayers.INCHES_PER_UNIT.inches,"Meter":1.0/OpenLayers.METERS_PER_INCH,"Foot":0.30480060960121920243/OpenLayers.METERS_PER_INCH,"IFoot":0.30480000000000000000/OpenLayers.METERS_PER_INCH,"ClarkeFoot":0.3047972651151/OpenLayers.METERS_PER_INCH,"SearsFoot":0.30479947153867624624/OpenLayers.METERS_PER_INCH,"GoldCoastFoot":0.30479971018150881758/OpenLayers.METERS_PER_INCH,"IInch":0.02540000000000000000/OpenLayers.METERS_PER_INCH,"MicroInch":0.00002540000000000000/OpenLayers.METERS_PER_INCH,"Mil":0.00000002540000000000/OpenLayers.METERS_PER_INCH,"Centimeter":0.01000000000000000000/OpenLayers.METERS_PER_INCH,"Kilometer":1000.00000000000000000000/OpenLayers.METERS_PER_INCH,"Yard":0.91440182880365760731/OpenLayers.METERS_PER_INCH,"SearsYard":0.914398414616029/OpenLayers.METERS_PER_INCH,"IndianYard":0.91439853074444079983/OpenLayers.METERS_PER_INCH,"IndianYd37":0.91439523/OpenLayers.METERS_PER_INCH,"IndianYd62":0.9143988/OpenLayers.METERS_PER_INCH,"IndianYd75":0.9143985/OpenLayers.METERS_PER_INCH,"IndianFoot":0.30479951/OpenLayers.METERS_PER_INCH,"IndianFt37":0.30479841/OpenLayers.METERS_PER_INCH,"IndianFt62":0.3047996/OpenLayers.METERS_PER_INCH,"IndianFt75":0.3047995/OpenLayers.METERS_PER_INCH,"Mile":1609.34721869443738887477/OpenLayers.METERS_PER_INCH,"IYard":0.91440000000000000000/OpenLayers.METERS_PER_INCH,"IMile":1609.34400000000000000000/OpenLayers.METERS_PER_INCH,"NautM":1852.00000000000000000000/OpenLayers.METERS_PER_INCH,"Lat-66":110943.316488932731/OpenLayers.METERS_PER_INCH,"Lat-83":110946.25736872234125/OpenLayers.METERS_PER_INCH,"Decimeter":0.10000000000000000000/OpenLayers.METERS_PER_INCH,"Millimeter":0.00100000000000000000/OpenLayers.METERS_PER_INCH,"Dekameter":10.00000000000000000000/OpenLayers.METERS_PER_INCH,"Decameter":10.00000000000000000000/OpenLayers.METERS_PER_INCH,"Hectometer":100.00000000000000000000/OpenLayers.METERS_PER_INCH,"GermanMeter":1.0000135965/OpenLayers.METERS_PER_INCH,"CaGrid":0.999738/OpenLayers.METERS_PER_INCH,"ClarkeChain":20.1166194976/OpenLayers.METERS_PER_INCH,"GunterChain":20.11684023368047/OpenLayers.METERS_PER_INCH,"BenoitChain":20.116782494375872/OpenLayers.METERS_PER_INCH,"SearsChain":20.11676512155/OpenLayers.METERS_PER_INCH,"ClarkeLink":0.201166194976/OpenLayers.METERS_PER_INCH,"GunterLink":0.2011684023368047/OpenLayers.METERS_PER_INCH,"BenoitLink":0.20116782494375872/OpenLayers.METERS_PER_INCH,"SearsLink":0.2011676512155/OpenLayers.METERS_PER_INCH,"Rod":5.02921005842012/OpenLayers.METERS_PER_INCH,"IntnlChain":20.1168/OpenLayers.METERS_PER_INCH,"IntnlLink":0.201168/OpenLayers.METERS_PER_INCH,"Perch":5.02921005842012/OpenLayers.METERS_PER_INCH,"Pole":5.02921005842012/OpenLayers.METERS_PER_INCH,"Furlong":201.1684023368046/OpenLayers.METERS_PER_INCH,"Rood":3.778266898/OpenLayers.METERS_PER_INCH,"CapeFoot":0.3047972615/OpenLayers.METERS_PER_INCH,"Brealey":375.00000000000000000000/OpenLayers.METERS_PER_INCH,"ModAmFt":0.304812252984505969011938/OpenLayers.METERS_PER_INCH,"Fathom":1.8288/OpenLayers.METERS_PER_INCH,"NautM-UK":1853.184/OpenLayers.METERS_PER_INCH,"50kilometers":50000.0/OpenLayers.METERS_PER_INCH,"150kilometers":150000.0/OpenLayers.METERS_PER_INCH});OpenLayers.Util.extend(OpenLayers.INCHES_PER_UNIT,{"mm":OpenLayers.INCHES_PER_UNIT["Meter"]/1000.0,"cm":OpenLayers.INCHES_PER_UNIT["Meter"]/100.0,"dm":OpenLayers.INCHES_PER_UNIT["Meter"]*100.0,"km":OpenLayers.INCHES_PER_UNIT["Meter"]*1000.0,"kmi":OpenLayers.INCHES_PER_UNIT["nmi"],"fath":OpenLayers.INCHES_PER_UNIT["Fathom"],"ch":OpenLayers.INCHES_PER_UNIT["IntnlChain"],"link":OpenLayers.INCHES_PER_UNIT["IntnlLink"],"us-in":OpenLayers.INCHES_PER_UNIT["inches"],"us-ft":OpenLayers.INCHES_PER_UNIT["Foot"],"us-yd":OpenLayers.INCHES_PER_UNIT["Yard"],"us-ch":OpenLayers.INCHES_PER_UNIT["GunterChain"],"us-mi":OpenLayers.INCHES_PER_UNIT["Mile"],"ind-yd":OpenLayers.INCHES_PER_UNIT["IndianYd37"],"ind-ft":OpenLayers.INCHES_PER_UNIT["IndianFt37"],"ind-ch":20.11669506/OpenLayers.METERS_PER_INCH});OpenLayers.DOTS_PER_INCH=72;OpenLayers.Util.normalizeScale=function(scale){var normScale=(scale>1.0)?(1.0/scale):scale;return normScale;};OpenLayers.Util.getResolutionFromScale=function(scale,units){if(units==null){units="degrees";} var normScale=OpenLayers.Util.normalizeScale(scale);var resolution=1/(normScale*OpenLayers.INCHES_PER_UNIT[units]*OpenLayers.DOTS_PER_INCH);return resolution;};OpenLayers.Util.getScaleFromResolution=function(resolution,units){if(units==null){units="degrees";} var scale=resolution*OpenLayers.INCHES_PER_UNIT[units]*OpenLayers.DOTS_PER_INCH;return scale;};OpenLayers.Util.safeStopPropagation=function(evt){OpenLayers.Event.stop(evt,true);};OpenLayers.Util.pagePosition=function(forElement){var valueT=0,valueL=0;var element=forElement;var child=forElement;while(element){if(element==document.body){if(OpenLayers.Element.getStyle(child,'position')=='absolute'){break;}} valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;child=element;try{element=element.offsetParent;}catch(e){OpenLayers.Console.error(OpenLayers.i18n("pagePositionFailed",{'elemId':element.id}));break;}} element=forElement;while(element){valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0;element=element.parentNode;} -return[valueL,valueT];};OpenLayers.Util.isEquivalentUrl=function(url1,url2,options){options=options||{};OpenLayers.Util.applyDefaults(options,{ignoreCase:true,ignorePort80:true,ignoreHash:true});var urlObj1=OpenLayers.Util.createUrlObject(url1,options);var urlObj2=OpenLayers.Util.createUrlObject(url2,options);for(var key in urlObj1){if(options.test){OpenLayers.Console.userError(key+"\n1:"+urlObj1[key]+"\n2:"+urlObj2[key]);} -var val1=urlObj1[key];var val2=urlObj2[key];switch(key){case"args":break;case"host":case"port":case"protocol":if((val1=="")||(val2=="")){break;} -default:if((key!="args")&&(urlObj1[key]!=urlObj2[key])){return false;} -break;}} +return[valueL,valueT];};OpenLayers.Util.isEquivalentUrl=function(url1,url2,options){options=options||{};OpenLayers.Util.applyDefaults(options,{ignoreCase:true,ignorePort80:true,ignoreHash:true});var urlObj1=OpenLayers.Util.createUrlObject(url1,options);var urlObj2=OpenLayers.Util.createUrlObject(url2,options);for(var key in urlObj1){if(key!=="args"){if(urlObj1[key]!=urlObj2[key]){return false;}}} for(var key in urlObj1.args){if(urlObj1.args[key]!=urlObj2.args[key]){return false;} delete urlObj2.args[key];} for(var key in urlObj2.args){return false;} -return true;};OpenLayers.Util.createUrlObject=function(url,options){options=options||{};var urlObject={};if(options.ignoreCase){url=url.toLowerCase();} -var a=document.createElement('a');a.href=url;urlObject.host=a.host;var port=a.port;if(port.length<=0){var newHostLength=urlObject.host.length-(port.length);urlObject.host=urlObject.host.substring(0,newHostLength);} -urlObject.protocol=a.protocol;urlObject.port=((port=="80")&&(options.ignorePort80))?"":port;urlObject.hash=(options.ignoreHash)?"":a.hash;var queryString=a.search;if(!queryString){var qMark=url.indexOf("?");queryString=(qMark!=-1)?url.substr(qMark):"";} -urlObject.args=OpenLayers.Util.getParameters(queryString);if(((urlObject.protocol=="file:")&&(url.indexOf("file:")!=-1))||((urlObject.protocol!="file:")&&(urlObject.host!=""))){urlObject.pathname=a.pathname;var qIndex=urlObject.pathname.indexOf("?");if(qIndex!=-1){urlObject.pathname=urlObject.pathname.substring(0,qIndex);}}else{var relStr=OpenLayers.Util.removeTail(url);var backs=0;do{var index=relStr.indexOf("../");if(index==0){backs++;relStr=relStr.substr(3);}else if(index>=0){var prevChunk=relStr.substr(0,index-1);var slash=prevChunk.indexOf("/");prevChunk=(slash!=-1)?prevChunk.substr(0,slash+1):"";var postChunk=relStr.substr(index+3);relStr=prevChunk+postChunk;}}while(index!=-1) -var windowAnchor=document.createElement("a");var windowUrl=window.location.href;if(options.ignoreCase){windowUrl=windowUrl.toLowerCase();} -windowAnchor.href=windowUrl;urlObject.protocol=windowAnchor.protocol;var splitter=(windowAnchor.pathname.indexOf("/")!=-1)?"/":"\\";var dirs=windowAnchor.pathname.split(splitter);dirs.pop();while((backs>0)&&(dirs.length>0)){dirs.pop();backs--;} -relStr=dirs.join("/")+"/"+relStr;urlObject.pathname=relStr;} -if((urlObject.protocol=="file:")||(urlObject.protocol=="")){urlObject.host="localhost";} -return urlObject;};OpenLayers.Util.removeTail=function(url){var head=null;var qMark=url.indexOf("?");var hashMark=url.indexOf("#");if(qMark==-1){head=(hashMark!=-1)?url.substr(0,hashMark):url;}else{head=(hashMark!=-1)?url.substr(0,Math.min(qMark,hashMark)):url.substr(0,qMark);} +return true;};OpenLayers.Util.createUrlObject=function(url,options){options=options||{};if(!(/^\w+:\/\//).test(url)){var loc=window.location;var port=loc.port?":"+loc.port:"";var fullUrl=loc.protocol+"//"+loc.host.split(":").shift()+port;if(url.indexOf("/")===0){url=fullUrl+url;}else{var parts=loc.pathname.split("/");parts.pop();url=fullUrl+parts.join("/")+"/"+url;}} +if(options.ignoreCase){url=url.toLowerCase();} +var a=document.createElement('a');a.href=url;var urlObject={};urlObject.host=a.host.split(":").shift();urlObject.protocol=a.protocol;if(options.ignorePort80){urlObject.port=(a.port=="80"||a.port=="0")?"":a.port;}else{urlObject.port=(a.port==""||a.port=="0")?"80":a.port;} +urlObject.hash=(options.ignoreHash||a.hash==="#")?"":a.hash;var queryString=a.search;if(!queryString){var qMark=url.indexOf("?");queryString=(qMark!=-1)?url.substr(qMark):"";} +urlObject.args=OpenLayers.Util.getParameters(queryString);urlObject.pathname=(a.pathname.charAt(0)=="/")?a.pathname:"/"+a.pathname;return urlObject;};OpenLayers.Util.removeTail=function(url){var head=null;var qMark=url.indexOf("?");var hashMark=url.indexOf("#");if(qMark==-1){head=(hashMark!=-1)?url.substr(0,hashMark):url;}else{head=(hashMark!=-1)?url.substr(0,Math.min(qMark,hashMark)):url.substr(0,qMark);} return head;};OpenLayers.Util.getBrowserName=function(){var browserName="";var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("opera")!=-1){browserName="opera";}else if(ua.indexOf("msie")!=-1){browserName="msie";}else if(ua.indexOf("safari")!=-1){browserName="safari";}else if(ua.indexOf("mozilla")!=-1){if(ua.indexOf("firefox")!=-1){browserName="firefox";}else{browserName="mozilla";}} -return browserName;};OpenLayers.Util.getRenderedDimensions=function(contentHTML,size,options){var w,h;var container=document.createElement("div");container.style.overflow="";container.style.position="absolute";container.style.left="-9999px";if(size){if(size.w){w=size.w;container.style.width=w+"px";}else if(size.h){h=size.h;container.style.height=h+"px";}} +return browserName;};OpenLayers.Util.getRenderedDimensions=function(contentHTML,size,options){var w,h;var container=document.createElement("div");container.style.visibility="hidden";var containerElement=(options&&options.containerElement)?options.containerElement:document.body;if(size){if(size.w){w=size.w;container.style.width=w+"px";}else if(size.h){h=size.h;container.style.height=h+"px";}} if(options&&options.displayClass){container.className=options.displayClass;} -var content=document.createElement("div");content.innerHTML=contentHTML;container.appendChild(content);document.body.appendChild(container);if(!w){w=parseInt(content.scrollWidth);container.style.width=w+"px";} +var content=document.createElement("div");content.innerHTML=contentHTML;content.style.overflow="visible";if(content.childNodes){for(var i=0,l=content.childNodes.length;i=0){return true;}return false;},_blend:function(c1,c2){var cc1=OpenLayers.Rico.Color.createFromHex(c1);cc1.blend(OpenLayers.Rico.Color.createFromHex(c2));return cc1;},_background:function(el){try{return OpenLayers.Rico.Color.createColorFromBackground(el).asHex();}catch(err){return"#ffffff";}},_isTransparent:function(){return this.options.color=="transparent";},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr");},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br");},_hasSingleTextChild:function(el){return el.childNodes.length==1&&el.childNodes[0].nodeType==3;}};OpenLayers.Bounds=OpenLayers.Class({left:null,bottom:null,right:null,top:null,initialize:function(left,bottom,right,top){if(left!=null){this.left=parseFloat(left);} -if(bottom!=null){this.bottom=parseFloat(bottom);} -if(right!=null){this.right=parseFloat(right);} -if(top!=null){this.top=parseFloat(top);}},clone:function(){return new OpenLayers.Bounds(this.left,this.bottom,this.right,this.top);},equals:function(bounds){var equals=false;if(bounds!=null){equals=((this.left==bounds.left)&&(this.right==bounds.right)&&(this.top==bounds.top)&&(this.bottom==bounds.bottom));} -return equals;},toString:function(){return("left-bottom=("+this.left+","+this.bottom+")" -+" right-top=("+this.right+","+this.top+")");},toArray:function(){return[this.left,this.bottom,this.right,this.top];},toBBOX:function(decimal){if(decimal==null){decimal=6;} -var mult=Math.pow(10,decimal);var bbox=Math.round(this.left*mult)/mult+","+ -Math.round(this.bottom*mult)/mult+","+ -Math.round(this.right*mult)/mult+","+ -Math.round(this.top*mult)/mult;return bbox;},toGeometry:function(){return new OpenLayers.Geometry.Polygon([new OpenLayers.Geometry.LinearRing([new OpenLayers.Geometry.Point(this.left,this.bottom),new OpenLayers.Geometry.Point(this.right,this.bottom),new OpenLayers.Geometry.Point(this.right,this.top),new OpenLayers.Geometry.Point(this.left,this.top)])]);},getWidth:function(){return(this.right-this.left);},getHeight:function(){return(this.top-this.bottom);},getSize:function(){return new OpenLayers.Size(this.getWidth(),this.getHeight());},getCenterPixel:function(){return new OpenLayers.Pixel((this.left+this.right)/2,(this.bottom+this.top)/2);},getCenterLonLat:function(){return new OpenLayers.LonLat((this.left+this.right)/2,(this.bottom+this.top)/2);},scale:function(ratio,origin){if(origin==null){origin=this.getCenterLonLat();} -var bounds=[];var origx,origy;if(origin.CLASS_NAME=="OpenLayers.LonLat"){origx=origin.lon;origy=origin.lat;}else{origx=origin.x;origy=origin.y;} -var left=(this.left-origx)*ratio+origx;var bottom=(this.bottom-origy)*ratio+origy;var right=(this.right-origx)*ratio+origx;var top=(this.top-origy)*ratio+origy;return new OpenLayers.Bounds(left,bottom,right,top);},add:function(x,y){if((x==null)||(y==null)){var msg=OpenLayers.i18n("boundsAddError");OpenLayers.Console.error(msg);return null;} -return new OpenLayers.Bounds(this.left+x,this.bottom+y,this.right+x,this.top+y);},extend:function(object){var bounds=null;if(object){switch(object.CLASS_NAME){case"OpenLayers.LonLat":bounds=new OpenLayers.Bounds(object.lon,object.lat,object.lon,object.lat);break;case"OpenLayers.Geometry.Point":bounds=new OpenLayers.Bounds(object.x,object.y,object.x,object.y);break;case"OpenLayers.Bounds":bounds=object;break;} -if(bounds){if((this.left==null)||(bounds.leftthis.right)){this.right=bounds.right;} -if((this.top==null)||(bounds.top>this.top)){this.top=bounds.top;}}}},containsLonLat:function(ll,inclusive){return this.contains(ll.lon,ll.lat,inclusive);},containsPixel:function(px,inclusive){return this.contains(px.x,px.y,inclusive);},contains:function(x,y,inclusive){if(inclusive==null){inclusive=true;} -var contains=false;if(inclusive){contains=((x>=this.left)&&(x<=this.right)&&(y>=this.bottom)&&(y<=this.top));}else{contains=((x>this.left)&&(xthis.bottom)&&(ythis.bottom)&&(bounds.bottombounds.bottom)&&(this.bottomthis.bottom)&&(bounds.topbounds.bottom)&&(this.topthis.left)&&(bounds.rightbounds.left)&&(this.rightthis.left)&&(bounds.leftbounds.left)&&(this.left=this.left)&&(bounds.left<=this.right);inTop=(bounds.top>=this.bottom)&&(bounds.top<=this.top);inRight=(bounds.right>=this.left)&&(bounds.right<=this.right);inBottom=(bounds.bottom>=this.bottom)&&(bounds.bottom<=this.top);}else{inLeft=(bounds.left>this.left)&&(bounds.leftthis.bottom)&&(bounds.topthis.left)&&(bounds.rightthis.bottom)&&(bounds.bottom=maxExtent.right&&newBounds.right>maxExtent.right){newBounds=newBounds.add(-maxExtent.getWidth(),0);}} -return newBounds;},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(str){var bounds=str.split(",");return OpenLayers.Bounds.fromArray(bounds);};OpenLayers.Bounds.fromArray=function(bbox){return new OpenLayers.Bounds(parseFloat(bbox[0]),parseFloat(bbox[1]),parseFloat(bbox[2]),parseFloat(bbox[3]));};OpenLayers.Bounds.fromSize=function(size){return new OpenLayers.Bounds(0,size.h,size.w,0);};OpenLayers.Bounds.oppositeQuadrant=function(quadrant){var opp="";opp+=(quadrant.charAt(0)=='t')?'b':'t';opp+=(quadrant.charAt(1)=='l')?'r':'l';return opp;};OpenLayers.Element={visible:function(element){return OpenLayers.Util.getElement(element).style.display!='none';},toggle:function(){for(var i=0,len=arguments.length;i=0){return true;}return false;},_blend:function(c1,c2){var cc1=OpenLayers.Rico.Color.createFromHex(c1);cc1.blend(OpenLayers.Rico.Color.createFromHex(c2));return cc1;},_background:function(el){try{return OpenLayers.Rico.Color.createColorFromBackground(el).asHex();}catch(err){return"#ffffff";}},_isTransparent:function(){return this.options.color=="transparent";},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr");},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br");},_hasSingleTextChild:function(el){return el.childNodes.length==1&&el.childNodes[0].nodeType==3;}};OpenLayers.Element={visible:function(element){return OpenLayers.Util.getElement(element).style.display!='none';},toggle:function(){for(var i=0,len=arguments.length;i"+ +this.contentDiv.innerHTML+"";var containerElement=(this.map)?this.map.layerContainerDiv:document.body;var realSize=OpenLayers.Util.getRenderedDimensions(preparedHTML,null,{displayClass:this.displayClass,containerElement:containerElement});var safeSize=this.getSafeContentSize(realSize);var newSize=null;if(safeSize.equals(realSize)){newSize=realSize;}else{var fixedSize=new OpenLayers.Size();fixedSize.w=(safeSize.w(mapSize.w-this.map.paddingForPopups.right)){newTL.x=mapSize.w-this.map.paddingForPopups.right-this.size.w;} +if(origTL.y(mapSize.h-this.map.paddingForPopups.bottom)){newTL.y=mapSize.h-this.map.paddingForPopups.bottom-this.size.h;} +var dx=origTL.x-newTL.x;var dy=origTL.y-newTL.y;this.map.pan(dx,dy);},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,null,true);this.events.on({"mousedown":this.onmousedown,"mousemove":this.onmousemove,"mouseup":this.onmouseup,"click":this.onclick,"mouseout":this.onmouseout,"dblclick":this.ondblclick,scope:this});},onmousedown:function(evt){this.mousedown=true;OpenLayers.Event.stop(evt,true);},onmousemove:function(evt){if(this.mousedown){OpenLayers.Event.stop(evt,true);}},onmouseup:function(evt){if(this.mousedown){this.mousedown=false;OpenLayers.Event.stop(evt,true);}},onclick:function(evt){OpenLayers.Event.stop(evt,true);},onmouseout:function(evt){this.mousedown=false;},ondblclick:function(evt){OpenLayers.Event.stop(evt,true);},CLASS_NAME:"OpenLayers.Popup"});OpenLayers.Popup.WIDTH=200;OpenLayers.Popup.HEIGHT=200;OpenLayers.Popup.COLOR="white";OpenLayers.Popup.OPACITY=1;OpenLayers.Popup.BORDER="0px";OpenLayers.Renderer=OpenLayers.Class({container:null,root:null,extent:null,locked:false,size:null,resolution:null,map:null,initialize:function(containerID,options){this.container=OpenLayers.Util.getElement(containerID);},destroy:function(){this.container=null;this.extent=null;this.size=null;this.resolution=null;this.map=null;},supported:function(){return false;},setExtent:function(extent,resolutionChanged){this.extent=extent.clone();if(resolutionChanged){this.resolution=null;}},setSize:function(size){this.size=size.clone();this.resolution=null;},getResolution:function(){this.resolution=this.resolution||this.map.getResolution();return this.resolution;},drawFeature:function(feature,style){if(style==null){style=feature.style;} +if(feature.geometry){var bounds=feature.geometry.getBounds();if(bounds){if(!bounds.intersectsBounds(this.extent)){style={display:"none"};} +var rendered=this.drawGeometry(feature.geometry,style,feature.id);if(style.display!="none"&&style.label&&rendered!==false){this.drawText(feature.id,style,feature.geometry.getCentroid());}else{this.removeText(feature.id);} +return rendered;}}},drawGeometry:function(geometry,style,featureId){},drawText:function(featureId,style,location){},removeText:function(featureId){},clear:function(){},getFeatureIdFromEvent:function(evt){},eraseFeatures:function(features){if(!(features instanceof Array)){features=[features];} +for(var i=0,len=features.length;ithis.right)){this.right=bounds.right;} +if((this.top==null)||(bounds.top>this.top)){this.top=bounds.top;}}}},containsLonLat:function(ll,inclusive){return this.contains(ll.lon,ll.lat,inclusive);},containsPixel:function(px,inclusive){return this.contains(px.x,px.y,inclusive);},contains:function(x,y,inclusive){if(inclusive==null){inclusive=true;} +if(x==null||y==null){return false;} +x=OpenLayers.Util.toFloat(x);y=OpenLayers.Util.toFloat(y);var contains=false;if(inclusive){contains=((x>=this.left)&&(x<=this.right)&&(y>=this.bottom)&&(y<=this.top));}else{contains=((x>this.left)&&(xthis.bottom)&&(y=this.bottom)&&(bounds.bottom<=this.top))||((this.bottom>=bounds.bottom)&&(this.bottom<=bounds.top)));var inTop=(((bounds.top>=this.bottom)&&(bounds.top<=this.top))||((this.top>bounds.bottom)&&(this.top=this.left)&&(bounds.left<=this.right))||((this.left>=bounds.left)&&(this.left<=bounds.right)));var inRight=(((bounds.right>=this.left)&&(bounds.right<=this.right))||((this.right>=bounds.left)&&(this.right<=bounds.right)));intersects=((inBottom||inTop)&&(inLeft||inRight));} +return intersects;},containsBounds:function(bounds,partial,inclusive){if(partial==null){partial=false;} +if(inclusive==null){inclusive=true;} +var bottomLeft=this.contains(bounds.left,bounds.bottom,inclusive);var bottomRight=this.contains(bounds.right,bounds.bottom,inclusive);var topLeft=this.contains(bounds.left,bounds.top,inclusive);var topRight=this.contains(bounds.right,bounds.top,inclusive);return(partial)?(bottomLeft||bottomRight||topLeft||topRight):(bottomLeft&&bottomRight&&topLeft&&topRight);},determineQuadrant:function(lonlat){var quadrant="";var center=this.getCenterLonLat();quadrant+=(lonlat.lat=maxExtent.right&&newBounds.right>maxExtent.right){newBounds=newBounds.add(-maxExtent.getWidth(),0);}} +return newBounds;},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(str){var bounds=str.split(",");return OpenLayers.Bounds.fromArray(bounds);};OpenLayers.Bounds.fromArray=function(bbox){return new OpenLayers.Bounds(parseFloat(bbox[0]),parseFloat(bbox[1]),parseFloat(bbox[2]),parseFloat(bbox[3]));};OpenLayers.Bounds.fromSize=function(size){return new OpenLayers.Bounds(0,size.h,size.w,0);};OpenLayers.Bounds.oppositeQuadrant=function(quadrant){var opp="";opp+=(quadrant.charAt(0)=='t')?'b':'t';opp+=(quadrant.charAt(1)=='l')?'r':'l';return opp;};OpenLayers.LonLat=OpenLayers.Class({lon:0.0,lat:0.0,initialize:function(lon,lat){this.lon=OpenLayers.Util.toFloat(lon);this.lat=OpenLayers.Util.toFloat(lat);},toString:function(){return("lon="+this.lon+",lat="+this.lat);},toShortString:function(){return(this.lon+", "+this.lat);},clone:function(){return new OpenLayers.LonLat(this.lon,this.lat);},add:function(lon,lat){if((lon==null)||(lat==null)){var msg=OpenLayers.i18n("lonlatAddError");OpenLayers.Console.error(msg);return null;} return new OpenLayers.LonLat(this.lon+lon,this.lat+lat);},equals:function(ll){var equals=false;if(ll!=null){equals=((this.lon==ll.lon&&this.lat==ll.lat)||(isNaN(this.lon)&&isNaN(this.lat)&&isNaN(ll.lon)&&isNaN(ll.lat)));} return equals;},transform:function(source,dest){var point=OpenLayers.Projection.transform({'x':this.lon,'y':this.lat},source,dest);this.lon=point.x;this.lat=point.y;return this;},wrapDateLine:function(maxExtent){var newLonLat=this.clone();if(maxExtent){while(newLonLat.lonmaxExtent.right){newLonLat.lon-=maxExtent.getWidth();}} return newLonLat;},CLASS_NAME:"OpenLayers.LonLat"});OpenLayers.LonLat.fromString=function(str){var pair=str.split(",");return new OpenLayers.LonLat(parseFloat(pair[0]),parseFloat(pair[1]));};OpenLayers.Pixel=OpenLayers.Class({x:0.0,y:0.0,initialize:function(x,y){this.x=parseFloat(x);this.y=parseFloat(y);},toString:function(){return("x="+this.x+",y="+this.y);},clone:function(){return new OpenLayers.Pixel(this.x,this.y);},equals:function(px){var equals=false;if(px!=null){equals=((this.x==px.x&&this.y==px.y)||(isNaN(this.x)&&isNaN(this.y)&&isNaN(px.x)&&isNaN(px.y)));} return equals;},add:function(x,y){if((x==null)||(y==null)){var msg=OpenLayers.i18n("pixelAddError");OpenLayers.Console.error(msg);return null;} return new OpenLayers.Pixel(this.x+x,this.y+y);},offset:function(px){var newPx=this.clone();if(px){newPx=this.add(px.x,px.y);} -return newPx;},CLASS_NAME:"OpenLayers.Pixel"});OpenLayers.Size=OpenLayers.Class({w:0.0,h:0.0,initialize:function(w,h){this.w=parseFloat(w);this.h=parseFloat(h);},toString:function(){return("w="+this.w+",h="+this.h);},clone:function(){return new OpenLayers.Size(this.w,this.h);},equals:function(sz){var equals=false;if(sz!=null){equals=((this.w==sz.w&&this.h==sz.h)||(isNaN(this.w)&&isNaN(this.h)&&isNaN(sz.w)&&isNaN(sz.h)));} -return equals;},CLASS_NAME:"OpenLayers.Size"});OpenLayers.Console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},userError:function(error){alert(error);},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){},CLASS_NAME:"OpenLayers.Console"};(function(){var scripts=document.getElementsByTagName("script");for(var i=0,len=scripts.length;i"+ -this.contentDiv.innerHTML+"
";var realSize=OpenLayers.Util.getRenderedDimensions(preparedHTML,null,{displayClass:this.displayClass});var safeSize=this.getSafeContentSize(realSize);var newSize=null;if(safeSize.equals(realSize)){newSize=realSize;}else{var fixedSize=new OpenLayers.Size();fixedSize.w=(safeSize.w(mapSize.w-this.map.paddingForPopups.right)){newTL.x=mapSize.w-this.map.paddingForPopups.right-this.size.w;} -if(origTL.y(mapSize.h-this.map.paddingForPopups.bottom)){newTL.y=mapSize.h-this.map.paddingForPopups.bottom-this.size.h;} -var dx=origTL.x-newTL.x;var dy=origTL.y-newTL.y;this.map.pan(dx,dy);},registerEvents:function(){this.events=new OpenLayers.Events(this,this.div,null,true);this.events.on({"mousedown":this.onmousedown,"mousemove":this.onmousemove,"mouseup":this.onmouseup,"click":this.onclick,"mouseout":this.onmouseout,"dblclick":this.ondblclick,scope:this});},onmousedown:function(evt){this.mousedown=true;OpenLayers.Event.stop(evt,true);},onmousemove:function(evt){if(this.mousedown){OpenLayers.Event.stop(evt,true);}},onmouseup:function(evt){if(this.mousedown){this.mousedown=false;OpenLayers.Event.stop(evt,true);}},onclick:function(evt){OpenLayers.Event.stop(evt,true);},onmouseout:function(evt){this.mousedown=false;},ondblclick:function(evt){OpenLayers.Event.stop(evt,true);},CLASS_NAME:"OpenLayers.Popup"});OpenLayers.Popup.WIDTH=200;OpenLayers.Popup.HEIGHT=200;OpenLayers.Popup.COLOR="white";OpenLayers.Popup.OPACITY=1;OpenLayers.Popup.BORDER="0px";OpenLayers.Renderer=OpenLayers.Class({container:null,extent:null,locked:false,size:null,resolution:null,map:null,initialize:function(containerID,options){this.container=OpenLayers.Util.getElement(containerID);},destroy:function(){this.container=null;this.extent=null;this.size=null;this.resolution=null;this.map=null;},supported:function(){return false;},setExtent:function(extent,resolutionChanged){this.extent=extent.clone();if(resolutionChanged){this.resolution=null;}},setSize:function(size){this.size=size.clone();this.resolution=null;},getResolution:function(){this.resolution=this.resolution||this.map.getResolution();return this.resolution;},drawFeature:function(feature,style){if(style==null){style=feature.style;} -if(feature.geometry){var bounds=feature.geometry.getBounds();if(bounds){if(!bounds.intersectsBounds(this.extent)){style={display:"none"};} -return this.drawGeometry(feature.geometry,style,feature.id);}}},drawGeometry:function(geometry,style,featureId){},clear:function(){},getFeatureIdFromEvent:function(evt){},eraseFeatures:function(features){if(!(features instanceof Array)){features=[features];} -for(var i=0,len=features.length;i0){var separator=(url.indexOf('?')>-1)?'&':'?';url+=separator+paramString;}} -if(config.proxy&&(url.indexOf("http")==0)){url=config.proxy+encodeURIComponent(url);} -request.open(config.method,url,config.async,config.user,config.password);for(var header in config.headers){request.setRequestHeader(header,config.headers[header]);} -var complete=(config.scope)?OpenLayers.Function.bind(config.callback,config.scope):config.callback;var success;if(config.success){success=(config.scope)?OpenLayers.Function.bind(config.success,config.scope):config.success;} -var failure;if(config.failure){failure=(config.scope)?OpenLayers.Function.bind(config.failure,config.scope):config.failure;} -request.onreadystatechange=function(){if(request.readyState==OpenLayers.Request.XMLHttpRequest.DONE){complete(request);if(success&&(!request.status||(request.status>=200&&request.status<300))){success(request);} -if(failure&&(request.status&&(request.status<200||request.status>=300))){failure(request);}}};request.send(config.data);return request;},GET:function(config){config=OpenLayers.Util.extend(config,{method:"GET"});return OpenLayers.Request.issue(config);},POST:function(config){config=OpenLayers.Util.extend(config,{method:"POST"});config.headers=config.headers?config.headers:{};if(!("CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(config.headers))){config.headers["Content-Type"]="application/xml";} -return OpenLayers.Request.issue(config);},PUT:function(config){config=OpenLayers.Util.extend(config,{method:"PUT"});config.headers=config.headers?config.headers:{};if(!("CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(config.headers))){config.headers["Content-Type"]="application/xml";} -return OpenLayers.Request.issue(config);},DELETE:function(config){config=OpenLayers.Util.extend(config,{method:"DELETE"});return OpenLayers.Request.issue(config);},HEAD:function(config){config=OpenLayers.Util.extend(config,{method:"HEAD"});return OpenLayers.Request.issue(config);},OPTIONS:function(config){config=OpenLayers.Util.extend(config,{method:"OPTIONS"});return OpenLayers.Request.issue(config);}};OpenLayers.Tween=OpenLayers.Class({INTERVAL:10,easing:null,begin:null,finish:null,duration:null,callbacks:null,time:null,interval:null,playing:false,initialize:function(easing){this.easing=(easing)?easing:OpenLayers.Easing.Expo.easeOut;},start:function(begin,finish,duration,options){this.playing=true;this.begin=begin;this.finish=finish;this.duration=duration;this.callbacks=options.callbacks;this.time=0;if(this.interval){window.clearInterval(this.interval);this.interval=null;} +return message;}};OpenLayers.i18n=OpenLayers.Lang.translate;OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,keepInMap:true,anchor:null,initialize:function(id,lonlat,contentSize,contentHTML,anchor,closeBox,closeBoxCallback){var newArguments=[id,lonlat,contentSize,contentHTML,closeBox,closeBoxCallback];OpenLayers.Popup.prototype.initialize.apply(this,newArguments);this.anchor=(anchor!=null)?anchor:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)};},destroy:function(){this.anchor=null;this.relativePosition=null;OpenLayers.Popup.prototype.destroy.apply(this,arguments);},show:function(){this.updatePosition();OpenLayers.Popup.prototype.show.apply(this,arguments);},moveTo:function(px){var oldRelativePosition=this.relativePosition;this.relativePosition=this.calculateRelativePosition(px);var newPx=this.calculateNewPx(px);var newArguments=new Array(newPx);OpenLayers.Popup.prototype.moveTo.apply(this,newArguments);if(this.relativePosition!=oldRelativePosition){this.updateRelativePosition();}},setSize:function(contentSize){OpenLayers.Popup.prototype.setSize.apply(this,arguments);if((this.lonlat)&&(this.map)){var px=this.map.getLayerPxFromLonLat(this.lonlat);this.moveTo(px);}},calculateRelativePosition:function(px){var lonlat=this.map.getLonLatFromLayerPx(px);var extent=this.map.getExtent();var quadrant=extent.determineQuadrant(lonlat);return OpenLayers.Bounds.oppositeQuadrant(quadrant);},updateRelativePosition:function(){},calculateNewPx:function(px){var newPx=px.offset(this.anchor.offset);var size=this.size||this.contentSize;var top=(this.relativePosition.charAt(0)=='t');newPx.y+=(top)?-size.h:this.anchor.size.h;var left=(this.relativePosition.charAt(1)=='l');newPx.x+=(left)?-size.w:this.anchor.size.w;return newPx;},CLASS_NAME:"OpenLayers.Popup.Anchored"});OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{canvas:null,features:null,geometryMap:null,initialize:function(containerID){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.root=document.createElement("canvas");this.container.appendChild(this.root);this.canvas=this.root.getContext("2d");this.features={};this.geometryMap={};},eraseGeometry:function(geometry){this.eraseFeatures(this.features[this.geometryMap[geometry.id]][0]);},supported:function(){var canvas=document.createElement("canvas");return!!canvas.getContext;},setExtent:function(extent){this.extent=extent.clone();this.resolution=null;this.redraw();},setSize:function(size){this.size=size.clone();this.root.style.width=size.w+"px";this.root.style.height=size.h+"px";this.root.width=size.w;this.root.height=size.h;this.resolution=null;},drawFeature:function(feature,style){if(style==null){style=feature.style;} +style=OpenLayers.Util.extend({'fillColor':'#000000','strokeColor':'#000000','strokeWidth':2,'fillOpacity':1,'strokeOpacity':1},style);this.features[feature.id]=[feature,style];if(feature.geometry){this.geometryMap[feature.geometry.id]=feature.id;} +this.redraw();},drawGeometry:function(geometry,style){var className=geometry.CLASS_NAME;if((className=="OpenLayers.Geometry.Collection")||(className=="OpenLayers.Geometry.MultiPoint")||(className=="OpenLayers.Geometry.MultiLineString")||(className=="OpenLayers.Geometry.MultiPolygon")){for(var i=0;i1){middle=parseInt((leftIndex+rightIndex)/2);var placement=this.compare(this,newNode,OpenLayers.Util.getElement(this.order[middle]));if(placement>0){leftIndex=middle;}else{rightIndex=middle;}} +this.order.splice(rightIndex,0,nodeId);this.indices[nodeId]=this.getZIndex(newNode);return this.getNextElement(rightIndex);},remove:function(node){var nodeId=node.id;var arrayIndex=OpenLayers.Util.indexOf(this.order,nodeId);if(arrayIndex>=0){this.order.splice(arrayIndex,1);delete this.indices[nodeId];if(this.order.length>0){var lastId=this.order[this.order.length-1];this.maxZIndex=this.indices[lastId];}else{this.maxZIndex=0;}}},clear:function(){this.order=[];this.indices={};this.maxZIndex=0;},exists:function(node){return(this.indices[node.id]!=null);},getZIndex:function(node){return node._style.graphicZIndex;},determineZIndex:function(node){var zIndex=node._style.graphicZIndex;if(zIndex==null){zIndex=this.maxZIndex;node._style.graphicZIndex=zIndex;}else if(zIndex>this.maxZIndex){this.maxZIndex=zIndex;}},getNextElement:function(index){var nextIndex=index+1;if(nextIndex0){this.vectorRoot.removeChild(this.vectorRoot.firstChild);}} +if(this.textRoot){while(this.textRoot.childNodes.length>0){this.textRoot.removeChild(this.textRoot.firstChild);}} +if(this.indexer){this.indexer.clear();}},getNodeType:function(geometry,style){},drawGeometry:function(geometry,style,featureId){var className=geometry.CLASS_NAME;var rendered=true;if((className=="OpenLayers.Geometry.Collection")||(className=="OpenLayers.Geometry.MultiPoint")||(className=="OpenLayers.Geometry.MultiLineString")||(className=="OpenLayers.Geometry.MultiPolygon")){for(var i=0,len=geometry.components.length;i=0;--i){this._removeButton(this.buttons[i]);}},doubleClick:function(evt){OpenLayers.Event.stop(evt);return false;},buttonDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;} +switch(this.action){case"panup":this.map.pan(0,-this.getSlideFactor("h"));break;case"pandown":this.map.pan(0,this.getSlideFactor("h"));break;case"panleft":this.map.pan(-this.getSlideFactor("w"),0);break;case"panright":this.map.pan(this.getSlideFactor("w"),0);break;case"zoomin":this.map.zoomIn();break;case"zoomout":this.map.zoomOut();break;case"zoomworld":this.map.zoomToMaxExtent();break;} OpenLayers.Event.stop(evt);},CLASS_NAME:"OpenLayers.Control.PanZoom"});OpenLayers.Control.PanZoom.X=4;OpenLayers.Control.PanZoom.Y=4;OpenLayers.Control.ScaleLine=OpenLayers.Class(OpenLayers.Control,{maxWidth:100,topOutUnits:"km",topInUnits:"m",bottomOutUnits:"mi",bottomInUnits:"ft",eTop:null,eBottom:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!this.eTop){this.div.style.display="block";this.div.style.position="absolute";this.eTop=document.createElement("div");this.eTop.className=this.displayClass+"Top";var theLen=this.topInUnits.length;this.div.appendChild(this.eTop);if((this.topOutUnits=="")||(this.topInUnits=="")){this.eTop.style.visibility="hidden";}else{this.eTop.style.visibility="visible";} this.eBottom=document.createElement("div");this.eBottom.className=this.displayClass+"Bottom";this.div.appendChild(this.eBottom);if((this.bottomOutUnits=="")||(this.bottomInUnits=="")){this.eBottom.style.visibility="hidden";}else{this.eBottom.style.visibility="visible";}} this.map.events.register('moveend',this,this.update);this.update();return this.div;},getBarLen:function(maxLen){var digits=parseInt(Math.log(maxLen)/Math.log(10));var pow10=Math.pow(10,digits);var firstChar=parseInt(maxLen/pow10);var barLen;if(firstChar>5){barLen=5;}else if(firstChar>2){barLen=2;}else{barLen=1;} return barLen*pow10;},update:function(){var res=this.map.getResolution();if(!res){return;} var curMapUnits=this.map.getUnits();var inches=OpenLayers.INCHES_PER_UNIT;var maxSizeData=this.maxWidth*res*inches[curMapUnits];var topUnits;var bottomUnits;if(maxSizeData>100000){topUnits=this.topOutUnits;bottomUnits=this.bottomOutUnits;}else{topUnits=this.topInUnits;bottomUnits=this.bottomInUnits;} -var topMax=maxSizeData/inches[topUnits];var bottomMax=maxSizeData/inches[bottomUnits];var topRounded=this.getBarLen(topMax);var bottomRounded=this.getBarLen(bottomMax);topMax=topRounded/inches[curMapUnits]*inches[topUnits];bottomMax=bottomRounded/inches[curMapUnits]*inches[bottomUnits];var topPx=topMax/res;var bottomPx=bottomMax/res;this.eTop.style.width=Math.round(topPx)+"px";this.eBottom.style.width=Math.round(bottomPx)+"px";this.eTop.innerHTML=topRounded+" "+topUnits;this.eBottom.innerHTML=bottomRounded+" "+bottomUnits;},CLASS_NAME:"OpenLayers.Control.ScaleLine"});OpenLayers.Event={observers:false,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(event){return event.target||event.srcElement;},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)));},isRightClick:function(event){return(((event.which)&&(event.which==3))||((event.button)&&(event.button==2)));},stop:function(event,allowDefault){if(!allowDefault){if(event.preventDefault){event.preventDefault();}else{event.returnValue=false;}} +var topMax=maxSizeData/inches[topUnits];var bottomMax=maxSizeData/inches[bottomUnits];var topRounded=this.getBarLen(topMax);var bottomRounded=this.getBarLen(bottomMax);topMax=topRounded/inches[curMapUnits]*inches[topUnits];bottomMax=bottomRounded/inches[curMapUnits]*inches[bottomUnits];var topPx=topMax/res;var bottomPx=bottomMax/res;if(this.eBottom.style.visibility=="visible"){this.eBottom.style.width=Math.round(bottomPx)+"px";this.eBottom.innerHTML=bottomRounded+" "+bottomUnits;} +if(this.eTop.style.visibility=="visible"){this.eTop.style.width=Math.round(topPx)+"px";this.eTop.innerHTML=topRounded+" "+topUnits;}},CLASS_NAME:"OpenLayers.Control.ScaleLine"});OpenLayers.Event={observers:false,KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,element:function(event){return event.target||event.srcElement;},isLeftClick:function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)));},isRightClick:function(event){return(((event.which)&&(event.which==3))||((event.button)&&(event.button==2)));},stop:function(event,allowDefault){if(!allowDefault){if(event.preventDefault){event.preventDefault();}else{event.returnValue=false;}} if(event.stopPropagation){event.stopPropagation();}else{event.cancelBubble=true;}},findElement:function(event,tagName){var element=OpenLayers.Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase()))){element=element.parentNode;} return element;},observe:function(elementParam,name,observer,useCapture){var element=OpenLayers.Util.getElement(elementParam);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent)){name='keydown';} if(!this.observers){this.observers={};} @@ -377,54 +421,379 @@ i++;}} if(foundEntry){if(element.removeEventListener){element.removeEventListener(name,observer,useCapture);}else if(element&&element.detachEvent){element.detachEvent('on'+name,observer);}} return foundEntry;},unloadCache:function(){if(OpenLayers.Event&&OpenLayers.Event.observers){for(var cacheID in OpenLayers.Event.observers){var elementObservers=OpenLayers.Event.observers[cacheID];OpenLayers.Event._removeElementObservers.apply(this,[elementObservers]);} OpenLayers.Event.observers=false;}},CLASS_NAME:"OpenLayers.Event"};OpenLayers.Event.observe(window,'unload',OpenLayers.Event.unloadCache,false);if(window.Event){OpenLayers.Util.applyDefaults(window.Event,OpenLayers.Event);}else{var Event=OpenLayers.Event;} -OpenLayers.Events=OpenLayers.Class({BROWSER_EVENTS:["mouseover","mouseout","mousedown","mouseup","mousemove","click","dblclick","rightclick","dblrightclick","resize","focus","blur"],listeners:null,object:null,element:null,eventTypes:null,eventHandler:null,fallThrough:null,includeXY:false,initialize:function(object,element,eventTypes,fallThrough,options){OpenLayers.Util.extend(this,options);this.object=object;this.element=element;this.fallThrough=fallThrough;this.listeners={};this.eventHandler=OpenLayers.Function.bindAsEventListener(this.handleBrowserEvent,this);this.eventTypes=[];if(eventTypes!=null){for(var i=0,len=eventTypes.length;i0)){var continueChain;for(var i=0,len=listeners.length;i
"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.

"+"Most likely, this is because the Google Maps library "+"script was either not included, or does not contain the "+"correct API key for your site.

"+"Developers: For help getting this working correctly, "+"click here",'getLayerWarning':"The ${layerType} Layer was unable to load correctly.

"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.

"+"Most likely, this is because the ${layerLib} library "+"script was not correctly included.

"+"Developers: For help getting this working correctly, "+"click here",'scale':"Scale = 1 : ${scaleDenom}",'layerAlreadyAdded':"You tried to add the layer: ${layerName} to the map, but it has already been added",'reprojectDeprecated':"You are using the 'reproject' option "+"on the ${layerName} layer. This option is deprecated: "+"its use was designed to support displaying data over commercial "+"basemaps, but that functionality should now be achieved by using "+"Spherical Mercator support. More information is available from "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"This method has been deprecated and will be removed in 3.0. "+"Please use ${newMethod} instead.",'boundsAddError':"You must pass both x and y values to the add function.",'lonlatAddError':"You must pass both lon and lat values to the add function.",'pixelAddError':"You must pass both x and y values to the add function.",'unsupportedGeometryType':"Unsupported geometry type: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition failed: element with id ${elemId} may be misplaced.",'end':'','filterEvaluateNotImplemented':"evaluate is not implemented for this filter type."};OpenLayers.Lang.fr={'unhandledRequest':"Requête non gérée, retournant ${statusText}",'permalink':"Permalien",'overlays':"Calques",'baseLayer':"Calque de base",'sameProjection':"La carte de situation ne fonctionne que lorsque sa projection est la même que celle de la carte principale",'readNotImplemented':"Lecture non implémentée.",'writeNotImplemented':"Ecriture non implémentée.",'noFID':"Impossible de mettre à jour un objet sans identifiant (fid).",'errorLoadingGML':"Erreur au chargement du fichier GML ${url}",'browserNotSupported':"Votre navigateur ne supporte pas le rendu vectoriel. Les renderers actuellement supportés sont : \n${renderers}",'componentShouldBe':"addFeatures : le composant devrait être de type ${geomType}",'getFeatureError':"getFeatureFromEvent a été appelé sur un calque sans renderer. Cela signifie généralement que vous "+"avez détruit cette couche, mais que vous avez conservé un handler qui lui était associé.",'minZoomLevelError':"La propriété minZoomLevel doit seulement être utilisée "+"pour des couches FixedZoomLevels-descendent. Le fait que "+"cette couche WFS vérifie la présence de minZoomLevel "+"est une relique du passé. Nous ne pouvons toutefois la "+"supprimer sans casser des applications qui pourraient en dépendre."+" C'est pourquoi nous la déprécions -- la vérification du minZoomLevel "+"sera supprimée en version 3.0. A la place, merci d'utiliser "+"les paramètres de résolutions min/max tel que décrit sur : "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transaction WFS : SUCCES ${response}",'commitFailed':"Transaction WFS : ECHEC ${response}",'googleWarning':"La couche Google n'a pas été en mesure de se charger correctement.

"+"Pour supprimer ce message, choisissez une nouvelle BaseLayer "+"dans le sélecteur de couche en haut à droite.

"+"Cela est possiblement causé par la non-inclusion de la "+"librairie Google Maps, ou alors parce que la clé de l'API "+"ne correspond pas à votre site.

"+"Développeurs : pour savoir comment corriger ceci, "+"cliquez ici",'getLayerWarning':"La couche ${layerType} n'est pas en mesure de se charger correctement.

"+"Pour supprimer ce message, choisissez une nouvelle BaseLayer "+"dans le sélecteur de couche en haut à droite.

"+"Cela est possiblement causé par la non-inclusion de la "+"librairie ${layerLib}.

"+"Développeurs : pour savoir comment corriger ceci, "+"cliquez ici",'scale':"Echelle ~ 1 : ${scaleDenom}",'layerAlreadyAdded':"Vous avez essayé d'ajouter à la carte le calque : ${layerName}, mais il est déjà présent",'reprojectDeprecated':"Vous utilisez l'option 'reproject' "+"sur la couche ${layerName}. Cette option est dépréciée : "+"Son usage permettait d'afficher des données au dessus de couches raster commerciales."+"Cette fonctionalité est maintenant supportée en utilisant le support de la projection "+"Mercator Sphérique. Plus d'information est disponible sur "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Cette méthode est dépréciée, et sera supprimée à la version 3.0. "+"Merci d'utiliser ${newMethod} à la place.",'boundsAddError':"Vous devez passer les deux valeurs x et y à la fonction add.",'lonlatAddError':"Vous devez passer les deux valeurs lon et lat à la fonction add.",'pixelAddError':"Vous devez passer les deux valeurs x et y à la fonction add.",'unsupportedGeometryType':"Type de géométrie non supporté : ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition a échoué: l'élément d'id ${elemId} pourrait être mal positionné.",'end':''};OpenLayers.Lang.it={'unhandledRequest':"Codice di ritorno della richiesta ${statusText}",'permalink':"Permalink",'overlays':"Overlays",'baseLayer':"Livello base",'sameProjection':"La mini mappa funziona solamente se ha la stessa proiezione della mappa principale",'readNotImplemented':"Lettura non implementata.",'writeNotImplemented':"Scrittura non implementata.",'noFID':"Impossibile aggiornare un elemento grafico che non abbia il FID.",'errorLoadingGML':"Errore nel caricamento del file GML ${url}",'browserNotSupported':"Il tuo browser non supporta il rendering vettoriale. I renderizzatore attualemnte supportati sono:\n${renderers}",'componentShouldBe':"addFeatures : il componente dovrebbe essere di tipo ${geomType}",'getFeatureError':"getFeatureFromEvent chiamata su di un livello senza renderizzatore. Ciò significa che "+"il livello è stato cancellato, ma non i gestori associati ad esso.",'minZoomLevelError':"La proprietà minZoomLevel è da utilizzare solamente "+"con livelli che abbiano FixedZoomLevels. Il fatto che "+"questo livello wfs controlli la proprietà minZoomLevel è "+"un retaggio del passato. Non possiamo comunque rimuoverla "+"senza rompere le vecchie applicazioni che dipendono su di essa."+"Quindi siamo costretti a deprecarla -- minZoomLevel "+"e sarà rimossa dalla vesione 3.0. Si prega di utilizzare i "+"settaggi di risoluzione min/max come descritto qui: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transazione WFS: SUCCESS ${response}",'commitFailed':"Transazione WFS: FAILED ${response}",'googleWarning':"Il livello Google non è riuscito a caricare correttamente.

"+"Per evitare questo messaggio, seleziona un nuovo BaseLayer "+"nel selettore di livelli nell'angolo in alto a destra.

"+"Più precisamente, ciò accade perchè la libreria Google Maps "+"non è stata inclusa nella pagina, oppure non contiene la "+"corretta API key per il tuo sito.

"+"Sviluppatori: Per aiuto su come farlo funzionare correttamente, "+"clicca qui",'getLayerWarning':"Il livello ${layerType} non è riuscito a caricare correttamente.

"+"Per evitare questo messaggio, seleziona un nuovo BaseLayer "+"nel selettore di livelli nell'angolo in alto a destra.

"+"Più precisamente, ciò accade perchè la libreria ${layerLib} "+"non è stata inclusa nella pagina.

"+"Sviluppatori: Per aiuto su come farlo funzionare correttamente, "+"clicca qui",'scale':"Scala = 1 : ${scaleDenom}",'layerAlreadyAdded':"Stai cercando di aggiungere il livello: ${layerName} alla mappa, ma tale livello è già stato aggiunto.",'reprojectDeprecated':"Stai utilizzando l'opzione 'reproject' sul livello ${layerName}. "+"Questa opzione è deprecata: il suo utilizzo è stato introdotto per"+"supportare il disegno dei dati sopra mappe commerciali, ma tale "+"funzionalità dovrebbe essere ottenuta tramite l'utilizzo della proiezione "+"Spherical Mercator. Per maggiori informazioni consultare qui "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Questo metodo è stato deprecato e sarà rimosso dalla versione 3.0. "+"Si prega di utilizzare il metodo ${newMethod} in alternativa.",'boundsAddError':"Devi specificare i valori di x e y alla funzione add.",'lonlatAddError':"Devi specificare i valori di lon e lat alla funzione add.",'pixelAddError':"Devi specificare i valori di x e y alla funzione add.",'unsupportedGeometryType':"Tipo di geometria non supportata: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition fallita: l'elemento con id ${elemId} è posizionato in modo errato.",'end':''};OpenLayers.Lang["zh-CN"]={'unhandledRequest':"未处理的请求,返回值为 ${statusText}",'permalink':"永久链接",'overlays':"叠加层",'baseLayer':"基础图层",'sameProjection':"鹰眼地图只有在和主地图使用相同的投影的时候才能正常共工作",'readNotImplemented':"读取功能没有实现。",'writeNotImplemented':"写入功能没有实现。",'noFID':"无法更新feature,缺少FID。",'errorLoadingGML':"加载GML文件 ${url} 出现错误。",'browserNotSupported':"你使用的浏览器不支持矢量渲染。当前支持的渲染方式包括:\n${renderers}",'componentShouldBe':"addFeatures : 组件类型应该是 ${geomType}",'getFeatureError':"getFeatureFromEvent方法在一个没有渲染器的图层上被调用。 这通常意味着您"+"销毁了一个图层,但并未销毁其关联的handler。",'minZoomLevelError':"minZoomLevel属性仅适合用于"+"使用了固定缩放级别的图层。这个 "+"wfs 图层检查 minZoomLevel 是过去遗留下来的。"+"然而,我们不能移除它,"+"而破坏依赖于它的基于OL的应用程序。"+"因此,我们废除了它 -- minZoomLevel "+"将会在3.0中被移除。请改用 "+"min/max resolution 设置,参考:"+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS Transaction: 成功。 ${response}",'commitFailed':"WFS Transaction: 失败。 ${response}",'googleWarning':"Google图层不能正确加载。

"+"要消除这个信息,请在右上角的"+"图层控制面板中选择其他的基础图层。

"+"这种情况很可能是没有正确的包含Google地图脚本库,"+"或者是没有包含在你的站点上"+"使用的正确的Google Maps API密匙。

"+"开发者:获取使其正确工作的帮助信息,"+"点击这里",'getLayerWarning':"${layerType} 图层不能正确加载。

"+"要消除这个信息,请在右上角的"+"图层控制面板中选择其他的基础图层。

"+"这种情况很可能是没有正确的包含"+"${layerLib} 脚本库。

"+"开发者:获取使其正确工作的帮助信息,"+"点击这里",'scale':"比例尺 = 1 : ${scaleDenom}",'layerAlreadyAdded':"你尝试添加图层: ${layerName} 到地图中,但是它之前就已经被添加。",'reprojectDeprecated':"你正在使用 ${layerName} 图层上的'reproject'选项。"+"这个选项已经不再使用:"+"它是被设计用来支持显示商业的地图数据,"+"不过现在该功能可以通过使用Spherical Mercator来实现。"+"更多信息可以参阅"+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"该方法已经不再被支持,并且将在3.0中被移除。"+"请使用 ${newMethod} 方法来替代。",'boundsAddError':"您必须传递 x 和 y 两个参数值到 add 方法。",'lonlatAddError':"您必须传递 lon 和 lat 两个参数值到 add 方法。",'pixelAddError':"您必须传递 x and y 两个参数值到 add 方法。",'unsupportedGeometryType':"不支持的几何体类型: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition 失败:id 为 ${elemId} 的元素可能被错置。",'end':''};OpenLayers.Popup.Anchored=OpenLayers.Class(OpenLayers.Popup,{relativePosition:null,anchor:null,initialize:function(id,lonlat,contentSize,contentHTML,anchor,closeBox,closeBoxCallback){var newArguments=[id,lonlat,contentSize,contentHTML,closeBox,closeBoxCallback];OpenLayers.Popup.prototype.initialize.apply(this,newArguments);this.anchor=(anchor!=null)?anchor:{size:new OpenLayers.Size(0,0),offset:new OpenLayers.Pixel(0,0)};},destroy:function(){this.anchor=null;this.relativePosition=null;OpenLayers.Popup.prototype.destroy.apply(this,arguments);},show:function(){this.updatePosition();OpenLayers.Popup.prototype.show.apply(this,arguments);},moveTo:function(px){var oldRelativePosition=this.relativePosition;this.relativePosition=this.calculateRelativePosition(px);var newPx=this.calculateNewPx(px);var newArguments=new Array(newPx);OpenLayers.Popup.prototype.moveTo.apply(this,newArguments);if(this.relativePosition!=oldRelativePosition){this.updateRelativePosition();}},setSize:function(contentSize){OpenLayers.Popup.prototype.setSize.apply(this,arguments);if((this.lonlat)&&(this.map)){var px=this.map.getLayerPxFromLonLat(this.lonlat);this.moveTo(px);}},calculateRelativePosition:function(px){var lonlat=this.map.getLonLatFromLayerPx(px);var extent=this.map.getExtent();var quadrant=extent.determineQuadrant(lonlat);return OpenLayers.Bounds.oppositeQuadrant(quadrant);},updateRelativePosition:function(){},calculateNewPx:function(px){var newPx=px.offset(this.anchor.offset);var size=this.size||this.contentSize;var top=(this.relativePosition.charAt(0)=='t');newPx.y+=(top)?-size.h:this.anchor.size.h;var left=(this.relativePosition.charAt(1)=='l');newPx.x+=(left)?-size.w:this.anchor.size.w;return newPx;},CLASS_NAME:"OpenLayers.Popup.Anchored"});OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,initialize:function(projCode,options){OpenLayers.Util.extend(this,options);this.projCode=projCode;if(window.Proj4js){this.proj=new Proj4js.Proj(projCode);}},getCode:function(){return this.proj?this.proj.srsCode:this.projCode;},getUnits:function(){return this.proj?this.proj.units:null;},toString:function(){return this.getCode();},equals:function(projection){if(projection&&projection.getCode){return this.getCode()==projection.getCode();}else{return false;}},destroy:function(){delete this.proj;delete this.projCode;},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={};OpenLayers.Projection.addTransform=function(from,to,method){if(!OpenLayers.Projection.transforms[from]){OpenLayers.Projection.transforms[from]={};} +-this.element.lefttop[1]);},CLASS_NAME:"OpenLayers.Events"});OpenLayers.Format=OpenLayers.Class({options:null,externalProjection:null,internalProjection:null,data:null,keepData:false,initialize:function(options){OpenLayers.Util.extend(this,options);this.options=options;},destroy:function(){},read:function(data){OpenLayers.Console.userError(OpenLayers.i18n("readNotImplemented"));},write:function(object){OpenLayers.Console.userError(OpenLayers.i18n("writeNotImplemented"));},CLASS_NAME:"OpenLayers.Format"});OpenLayers.Lang.ca={'unhandledRequest':"Resposta a petici no gestionada ${statusText}",'permalink':"Enlla permanent",'overlays':"Capes addicionals",'baseLayer':"Capa Base",'sameProjection':"El mapa de referncia noms funciona si t la mateixa projecci que el mapa principal",'readNotImplemented':"Lectura no implementada.",'writeNotImplemented':"Escriptura no implementada.",'noFID':"No es pot actualitzar un element per al que no existeix FID.",'errorLoadingGML':"Error caregant el fitxer GML ${url}",'browserNotSupported':"El seu navegador no suporta renderitzaci vectorial. Els renderitzadors suportats actualmente sn:\n${renderers}",'componentShouldBe':"addFeatures : el component ha de ser de tipus ${geomType}",'getFeatureError':"getFeatureFromEvent ha estat cridat a una capa sense renderizador. Aix normalment vol dir que "+"s'ha eliminat una capa, per no el handler associat a ella.",'minZoomLevelError':"La propietat minZoomLevel s'ha d'utilitzar noms "+"amb les capes que tenen FixedZoomLevels. El fet que "+"una capa wfs comprovi minZoomLevel s una reliquia del "+"passat. No podem, per, eliminar-la sense trencar "+"les aplicacions d'OpenLayers que en puguin dependre. "+"Aix doncs estem fent-la obsoleta -- la comprovaci "+"minZoomLevel s'eliminar a la versi 3.0. Feu servir "+"els parmetres min/max resolution en substituci, tal com es descriu aqu: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transacci WFS: CORRECTA ${response}",'commitFailed':"Transacci WFS: HA FALLAT ${response}",'googleWarning':"La capa Google no s'ha pogut carregar correctament.

"+"Per evitar aquest missatge, selleccioneu una nova Capa Base "+"al gestor de capes de la cantonada superior dreta.

"+"Probablement aix s degut a que l'script de la biblioteca de "+"Google Maps no ha estat incls a la vostra pgina, o no "+"cont la clau de l'API correcta per a la vostra adrea.

"+"Desenvolupadors: Per obtenir consells sobre com fer anar aix, "+"fu clic aqu",'getLayerWarning':"Per evitar aquest missatge, selleccioneu una nova Capa Base "+"al gestor de capes de la cantonada superior dreta.

"+"Probablement aix s degut a que l'script de la biblioteca "+"${layerLib} "+"no ha estat incls a la vostra pgina.

"+"Desenvolupadors: Per obtenir consells sobre com fer anar aix, "+"fu clic aqu",'scale':"Escala = 1 : ${scaleDenom}",'layerAlreadyAdded':"Heu intentat afegir la capa: ${layerName} al mapa, pero ja ha estat afegida anteriorment",'reprojectDeprecated':"Esteu fent servir l'opci 'reproject' a la capa "+"${layerName}. Aquesta opci s obsoleta: el seu s fou concebut "+"per suportar la visualitzaci de dades sobre mapes base comercials, "+"per aquesta funcionalitat s'hauria d'assolir ara mitjanant el suport "+"de la projecci Spherical Mercator. Ms informaci disponible a "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Aquest mtode s obsolet i s'eliminar a la versi 3.0. "+"Si us plau feu servir em mtode alternatiu ${newMethod}.",'boundsAddError':"Ha de proporcionar els valors x i y a la funci add.",'lonlatAddError':"Ha de proporcionar els valors lon i lat a la funci add.",'pixelAddError':"Ha de proporcionar els valors x i y a la funci add.",'unsupportedGeometryType':"Tipus de geometria no suportada: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition ha fallat: l'element amb id ${elemId} pot estar fora de lloc.",'filterEvaluateNotImplemented':"evaluate no est implementat per aquest tipus de filtre.",'end':''};OpenLayers.Lang.en={'unhandledRequest':"Unhandled request return ${statusText}",'permalink':"Permalink",'overlays':"Overlays",'baseLayer':"Base Layer",'sameProjection':"The overview map only works when it is in the same projection as the main map",'readNotImplemented':"Read not implemented.",'writeNotImplemented':"Write not implemented.",'noFID':"Can't update a feature for which there is no FID.",'errorLoadingGML':"Error in loading GML file ${url}",'browserNotSupported':"Your browser does not support vector rendering. Currently supported renderers are:\n${renderers}",'componentShouldBe':"addFeatures : component should be an ${geomType}",'getFeatureError':"getFeatureFromEvent called on layer with no renderer. This usually means you "+"destroyed a layer, but not some handler which is associated with it.",'minZoomLevelError':"The minZoomLevel property is only intended for use "+"with the FixedZoomLevels-descendent layers. That this "+"wfs layer checks for minZoomLevel is a relic of the"+"past. We cannot, however, remove it without possibly "+"breaking OL based applications that may depend on it."+" Therefore we are deprecating it -- the minZoomLevel "+"check below will be removed at 3.0. Please instead "+"use min/max resolution setting as described here: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS Transaction: SUCCESS ${response}",'commitFailed':"WFS Transaction: FAILED ${response}",'googleWarning':"The Google Layer was unable to load correctly.

"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.

"+"Most likely, this is because the Google Maps library "+"script was either not included, or does not contain the "+"correct API key for your site.

"+"Developers: For help getting this working correctly, "+"click here",'getLayerWarning':"The ${layerType} Layer was unable to load correctly.

"+"To get rid of this message, select a new BaseLayer "+"in the layer switcher in the upper-right corner.

"+"Most likely, this is because the ${layerLib} library "+"script was not correctly included.

"+"Developers: For help getting this working correctly, "+"click here",'scale':"Scale = 1 : ${scaleDenom}",'layerAlreadyAdded':"You tried to add the layer: ${layerName} to the map, but it has already been added",'reprojectDeprecated':"You are using the 'reproject' option "+"on the ${layerName} layer. This option is deprecated: "+"its use was designed to support displaying data over commercial "+"basemaps, but that functionality should now be achieved by using "+"Spherical Mercator support. More information is available from "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"This method has been deprecated and will be removed in 3.0. "+"Please use ${newMethod} instead.",'boundsAddError':"You must pass both x and y values to the add function.",'lonlatAddError':"You must pass both lon and lat values to the add function.",'pixelAddError':"You must pass both x and y values to the add function.",'unsupportedGeometryType':"Unsupported geometry type: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition failed: element with id ${elemId} may be misplaced.",'end':'','filterEvaluateNotImplemented':"evaluate is not implemented for this filter type."};OpenLayers.Lang.es={'unhandledRequest':"Respuesta a petición no gestionada ${statusText}",'permalink':"Enlace permanente",'overlays':"Capas superpuestas",'baseLayer':"Capa Base",'sameProjection':"El mini mapa sólo funciona si está en la misma proyección que el mapa principal",'readNotImplemented':"Lectura no implementada.",'writeNotImplemented':"Escritura no implementada.",'noFID':"No se puede actualizar un elemento para el que no existe FID.",'errorLoadingGML':"Error cargando el fichero GML ${url}",'browserNotSupported':"Su navegador no soporta renderización vectorial. Los renderizadores soportados actualmente son:\n${renderers}",'componentShouldBe':"addFeatures : el componente debe ser del tipo ${geomType}",'getFeatureError':"getFeatureFromEvent llamado en una capa sin renderizador. Esto normalmente quiere decir que "+"se ha destruido una capa, pero no el manejador asociado a ella.",'minZoomLevelError':"La propiedad minZoomLevel debe sólo utilizarse "+"con las capas que tienen FixedZoomLevels. El hecho de que "+"una capa wfs compruebe minZoomLevel is una reliquia del "+"pasado. Sin embargo, no podemos eliminarla sin discontinuar "+"probablemente las aplicaciones OL que puedan depender de ello. "+"Así pues estamos haciéndolo obsoleto --la comprobación "+"minZoomLevel se eliminará en la versión 3.0. Utilice el ajuste "+"de resolution min/max en su lugar, tal como se describe aquí: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transacción WFS: ÉXITO ${response}",'commitFailed':"Transacción WFS: FALLÓ ${response}",'googleWarning':"La capa Google no pudo ser cargada correctamente.

"+"Para evitar este mensaje, seleccione una nueva Capa Base "+"en el selector de capas en la esquina superior derecha.

"+"Probablemente, esto se debe a que el script de la biblioteca de "+"Google Maps no fue correctamente incluido en su página, o no "+"contiene la clave del API correcta para su sitio.

"+"Desarrolladores: Para ayudar a hacer funcionar esto correctamente, "+"haga clic aquí",'getLayerWarning':"La capa ${layerType} no pudo ser cargada correctamente.

"+"Para evitar este mensaje, seleccione una nueva Capa Base "+"en el selector de capas en la esquina superior derecha.

"+"Probablemente, esto se debe a que el script de "+"la biblioteca ${layerLib} "+"no fue correctamente incluido en su página.

"+"Desarrolladores: Para ayudar a hacer funcionar esto correctamente, "+"haga clic aquí",'scale':"Escala = 1 : ${scaleDenom}",'layerAlreadyAdded':"Intentó añadir la capa: ${layerName} al mapa, pero ya había sido añadida previamente",'reprojectDeprecated':"Está usando la opción 'reproject' en la capa "+"${layerName}. Esta opción está obsoleta: su uso fue diseñado "+"para soportar la visualización de datos sobre mapas base comerciales, "+"pero esa funcionalidad debería conseguirse ahora mediante el soporte "+"de la proyección Spherical Mercator. Más información disponible en "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Este método está obsoleto y se eliminará en la versión 3.0. "+"Por favor utilice el método ${newMethod} en su lugar.",'boundsAddError':"Debe proporcionar los valores x e y a la función add.",'lonlatAddError':"Debe proporcionar los valores lon y lat a la función add.",'pixelAddError':"Debe proporcionar los valores x e y a la función add.",'unsupportedGeometryType':"Tipo de geometría no soportada: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition falló: el elemento con id ${elemId} puede haberse colocado de manera errónea.",'filterEvaluateNotImplemented':"evaluate no está implementado para este tipo de filtro.",'end':''};OpenLayers.Lang.fr={'unhandledRequest':"Requête non gérée, retournant ${statusText}",'permalink':"Permalien",'overlays':"Calques",'baseLayer':"Calque de base",'sameProjection':"La carte de situation ne fonctionne que lorsque sa projection est la même que celle de la carte principale",'readNotImplemented':"Lecture non implémentée.",'writeNotImplemented':"Ecriture non implémentée.",'noFID':"Impossible de mettre à jour un objet sans identifiant (fid).",'errorLoadingGML':"Erreur au chargement du fichier GML ${url}",'browserNotSupported':"Votre navigateur ne supporte pas le rendu vectoriel. Les renderers actuellement supportés sont : \n${renderers}",'componentShouldBe':"addFeatures : le composant devrait être de type ${geomType}",'getFeatureError':"getFeatureFromEvent a été appelé sur un calque sans renderer. Cela signifie généralement que vous "+"avez détruit cette couche, mais que vous avez conservé un handler qui lui était associé.",'minZoomLevelError':"La propriété minZoomLevel doit seulement être utilisée "+"pour des couches FixedZoomLevels-descendent. Le fait que "+"cette couche WFS vérifie la présence de minZoomLevel "+"est une relique du passé. Nous ne pouvons toutefois la "+"supprimer sans casser des applications qui pourraient en dépendre."+" C'est pourquoi nous la déprécions -- la vérification du minZoomLevel "+"sera supprimée en version 3.0. A la place, merci d'utiliser "+"les paramètres de résolutions min/max tel que décrit sur : "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transaction WFS : SUCCES ${response}",'commitFailed':"Transaction WFS : ECHEC ${response}",'googleWarning':"La couche Google n'a pas été en mesure de se charger correctement.

"+"Pour supprimer ce message, choisissez une nouvelle BaseLayer "+"dans le sélecteur de couche en haut à droite.

"+"Cela est possiblement causé par la non-inclusion de la "+"librairie Google Maps, ou alors parce que la clé de l'API "+"ne correspond pas à votre site.

"+"Développeurs : pour savoir comment corriger ceci, "+"cliquez ici",'getLayerWarning':"La couche ${layerType} n'est pas en mesure de se charger correctement.

"+"Pour supprimer ce message, choisissez une nouvelle BaseLayer "+"dans le sélecteur de couche en haut à droite.

"+"Cela est possiblement causé par la non-inclusion de la "+"librairie ${layerLib}.

"+"Développeurs : pour savoir comment corriger ceci, "+"cliquez ici",'scale':"Echelle ~ 1 : ${scaleDenom}",'layerAlreadyAdded':"Vous avez essayé d'ajouter à la carte le calque : ${layerName}, mais il est déjà présent",'reprojectDeprecated':"Vous utilisez l'option 'reproject' "+"sur la couche ${layerName}. Cette option est dépréciée : "+"Son usage permettait d'afficher des données au dessus de couches raster commerciales."+"Cette fonctionalité est maintenant supportée en utilisant le support de la projection "+"Mercator Sphérique. Plus d'information est disponible sur "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Cette méthode est dépréciée, et sera supprimée à la version 3.0. "+"Merci d'utiliser ${newMethod} à la place.",'boundsAddError':"Vous devez passer les deux valeurs x et y à la fonction add.",'lonlatAddError':"Vous devez passer les deux valeurs lon et lat à la fonction add.",'pixelAddError':"Vous devez passer les deux valeurs x et y à la fonction add.",'unsupportedGeometryType':"Type de géométrie non supporté : ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition a échoué: l'élément d'id ${elemId} pourrait être mal positionné.",'end':''};OpenLayers.Lang.it={'unhandledRequest':"Codice di ritorno della richiesta ${statusText}",'permalink':"Permalink",'overlays':"Overlays",'baseLayer':"Livello base",'sameProjection':"La mini mappa funziona solamente se ha la stessa proiezione della mappa principale",'readNotImplemented':"Lettura non implementata.",'writeNotImplemented':"Scrittura non implementata.",'noFID':"Impossibile aggiornare un elemento grafico che non abbia il FID.",'errorLoadingGML':"Errore nel caricamento del file GML ${url}",'browserNotSupported':"Il tuo browser non supporta il rendering vettoriale. I renderizzatore attualemnte supportati sono:\n${renderers}",'componentShouldBe':"addFeatures : il componente dovrebbe essere di tipo ${geomType}",'getFeatureError':"getFeatureFromEvent chiamata su di un livello senza renderizzatore. Ciò significa che "+"il livello è stato cancellato, ma non i gestori associati ad esso.",'minZoomLevelError':"La proprietà minZoomLevel è da utilizzare solamente "+"con livelli che abbiano FixedZoomLevels. Il fatto che "+"questo livello wfs controlli la proprietà minZoomLevel è "+"un retaggio del passato. Non possiamo comunque rimuoverla "+"senza rompere le vecchie applicazioni che dipendono su di essa."+"Quindi siamo costretti a deprecarla -- minZoomLevel "+"e sarà rimossa dalla vesione 3.0. Si prega di utilizzare i "+"settaggi di risoluzione min/max come descritto qui: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transazione WFS: SUCCESS ${response}",'commitFailed':"Transazione WFS: FAILED ${response}",'googleWarning':"Il livello Google non è riuscito a caricare correttamente.

"+"Per evitare questo messaggio, seleziona un nuovo BaseLayer "+"nel selettore di livelli nell'angolo in alto a destra.

"+"Più precisamente, ciò accade perchè la libreria Google Maps "+"non è stata inclusa nella pagina, oppure non contiene la "+"corretta API key per il tuo sito.

"+"Sviluppatori: Per aiuto su come farlo funzionare correttamente, "+"clicca qui",'getLayerWarning':"Il livello ${layerType} non è riuscito a caricare correttamente.

"+"Per evitare questo messaggio, seleziona un nuovo BaseLayer "+"nel selettore di livelli nell'angolo in alto a destra.

"+"Più precisamente, ciò accade perchè la libreria ${layerLib} "+"non è stata inclusa nella pagina.

"+"Sviluppatori: Per aiuto su come farlo funzionare correttamente, "+"clicca qui",'scale':"Scala = 1 : ${scaleDenom}",'layerAlreadyAdded':"Stai cercando di aggiungere il livello: ${layerName} alla mappa, ma tale livello è già stato aggiunto.",'reprojectDeprecated':"Stai utilizzando l'opzione 'reproject' sul livello ${layerName}. "+"Questa opzione è deprecata: il suo utilizzo è stato introdotto per"+"supportare il disegno dei dati sopra mappe commerciali, ma tale "+"funzionalità dovrebbe essere ottenuta tramite l'utilizzo della proiezione "+"Spherical Mercator. Per maggiori informazioni consultare qui "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Questo metodo è stato deprecato e sarà rimosso dalla versione 3.0. "+"Si prega di utilizzare il metodo ${newMethod} in alternativa.",'boundsAddError':"Devi specificare i valori di x e y alla funzione add.",'lonlatAddError':"Devi specificare i valori di lon e lat alla funzione add.",'pixelAddError':"Devi specificare i valori di x e y alla funzione add.",'unsupportedGeometryType':"Tipo di geometria non supportata: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition fallita: l'elemento con id ${elemId} è posizionato in modo errato.",'end':''};OpenLayers.Lang["pt-BR"]={'unhandledRequest':"A requisição retornou um erro não tratado: ${statusText}",'permalink':"Link para essa página",'overlays':"Camadas de Sobreposição",'baseLayer':"Camada Base",'sameProjection':"O mapa de referência só funciona quando ele está na mesma projeção do mapa principal",'readNotImplemented':"Leitura não implementada.",'writeNotImplemented':"Escrita não implementada.",'noFID':"Não é possível atualizar uma feição que não tenha um FID.",'errorLoadingGML':"Erro ao carregar o arquivo GML ${url}",'browserNotSupported':"Seu navegador não suporta renderização de vetores. Os renderizadores suportados atualmente são:\n${renderers}",'componentShouldBe':"addFeatures: o componente deve ser do tipo ${geomType}",'getFeatureError':"getFeatureFromEvent foi executado mas nenhum renderizador foi encontrado. "+"Isso pode indicar que você destruiu uma camana, mas não o handler associado a ela.",'minZoomLevelError':"A propriedade minZoomLevel é de uso restrito das camadas "+"descendentes de FixedZoomLevels. A verificação dessa propriedade "+"pelas camadas wfs é um resíduo do passado. Não podemos, entretanto "+"não é possível removê-la sem possívelmente quebrar o funcionamento "+"de aplicações OL que possuem depência com ela. Portanto estamos "+"tornando seu uso obsoleto -- a verificação desse atributo será "+"removida na versão 3.0. Ao invés, use as opções de resolução "+"min/max como descrito em: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"Transação WFS : SUCESSO ${response}",'commitFailed':"Transação WFS : ERRO ${response}",'googleWarning':"Não foi possível carregar a camada Google corretamente.

"+"Para se livrar dessa mensagem, selecione uma nova Camada Base, "+"na ferramenta de alternação de camadas localização do canto "+"superior direito.

"+"Muito provavelmente, isso foi causado porque o script da "+"biblioteca do Google Maps não foi incluído, ou porque ele não "+"contém a chave correta da API para o seu site.

"+"Desenvolvedores: Para obter ajuda em solucionar esse problema "+"cliquem aqui",'getLayerWarning':"Não foi possível carregar a camada ${layerType} corretamente.

"+"Para se livrar dessa mensagem, selecione uma nova Camada Base, "+"na ferramenta de alternação de camadas localização do canto "+"superior direito.

"+"Muito provavelmente, isso foi causado porque o script da "+"biblioteca ${layerLib} não foi incluído corretamente.

"+"Desenvolvedores: Para obter ajuda em solucionar esse problema "+"cliquem aqui",'scale':"Escala = 1 : ${scaleDenom}",'layerAlreadyAdded':"Você tentou adicionar a camada: ${layerName} ao mapa, mas ela já foi adicionada",'reprojectDeprecated':"Você está usando a opção 'reproject' na camada ${layerName}. "+"Essa opção está obsoleta: seu uso foi projetado para suportar "+"a visualização de dados sobre bases de mapas comerciais, "+"entretanto essa funcionalidade deve agora ser alcançada usando "+"o suporte à projeção Mercator. Mais informação está disponível em: "+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"Esse método está obsoleto e será removido na versão 3.0. "+"Ao invés, por favor use ${newMethod}.",'boundsAddError':"Você deve informar ambos os valores x e y para a função add.",'lonlatAddError':"Você deve informar ambos os valores lon e lat para a função add.",'pixelAddError':"Você deve informar ambos os valores x e y para a função add.",'unsupportedGeometryType':"Tipo geométrico não suportado: ${geomType}.",'pagePositionFailed':"OpenLayers.Util.pagePosition falhou: o elemento de id ${elemId} deve estar fora do lugar.",'end':''};OpenLayers.Lang["zh-CN"]={'unhandledRequest':"未处理的请求,返回值为 ${statusText}",'permalink':"永久链接",'overlays':"叠加层",'baseLayer':"基础图层",'sameProjection':"鹰眼地图只有在和主地图使用相同的投影的时候才能正常共工作",'readNotImplemented':"读取功能没有实现。",'writeNotImplemented':"写入功能没有实现。",'noFID':"无法更新feature,缺少FID。",'errorLoadingGML':"加载GML文件 ${url} 出现错误。",'browserNotSupported':"你使用的浏览器不支持矢量渲染。当前支持的渲染方式包括:\n${renderers}",'componentShouldBe':"addFeatures : 组件类型应该是 ${geomType}",'getFeatureError':"getFeatureFromEvent方法在一个没有渲染器的图层上被调用。 这通常意味着您"+"销毁了一个图层,但并未销毁其关联的handler。",'minZoomLevelError':"minZoomLevel属性仅适合用于"+"使用了固定缩放级别的图层。这个 "+"wfs 图层检查 minZoomLevel 是过去遗留下来的。"+"然而,我们不能移除它,"+"而破坏依赖于它的基于OL的应用程序。"+"因此,我们废除了它 -- minZoomLevel "+"将会在3.0中被移除。请改用 "+"min/max resolution 设置,参考:"+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS Transaction: 成功。 ${response}",'commitFailed':"WFS Transaction: 失败。 ${response}",'googleWarning':"Google图层不能正确加载。

"+"要消除这个信息,请在右上角的"+"图层控制面板中选择其他的基础图层。

"+"这种情况很可能是没有正确的包含Google地图脚本库,"+"或者是没有包含在你的站点上"+"使用的正确的Google Maps API密匙。

"+"开发者:获取使其正确工作的帮助信息,"+"点击这里",'getLayerWarning':"${layerType} 图层不能正确加载。

"+"要消除这个信息,请在右上角的"+"图层控制面板中选择其他的基础图层。

"+"这种情况很可能是没有正确的包含"+"${layerLib} 脚本库。

"+"开发者:获取使其正确工作的帮助信息,"+"点击这里",'scale':"比例尺 = 1 : ${scaleDenom}",'layerAlreadyAdded':"你尝试添加图层: ${layerName} 到地图中,但是它之前就已经被添加。",'reprojectDeprecated':"你正在使用 ${layerName} 图层上的'reproject'选项。"+"这个选项已经不再使用:"+"它是被设计用来支持显示商业的地图数据,"+"不过现在该功能可以通过使用Spherical Mercator来实现。"+"更多信息可以参阅"+"http://trac.openlayers.org/wiki/SphericalMercator.",'methodDeprecated':"该方法已经不再被支持,并且将在3.0中被移除。"+"请使用 ${newMethod} 方法来替代。",'boundsAddError':"您必须传递 x 和 y 两个参数值到 add 方法。",'lonlatAddError':"您必须传递 lon 和 lat 两个参数值到 add 方法。",'pixelAddError':"您必须传递 x and y 两个参数值到 add 方法。",'unsupportedGeometryType':"不支持的几何体类型: ${geomType}",'pagePositionFailed':"OpenLayers.Util.pagePosition 失败:id 为 ${elemId} 的元素可能被错置。",'end':''};OpenLayers.Lang["zh-TW"]={'unhandledRequest':"未處理的請求,傳回值為 ${statusText}。",'permalink':"永久連結",'overlays':"額外圖層",'baseLayer':"基礎圖層",'sameProjection':"地圖縮覽(OverviewMap)只能在跟主地圖相同投影時起作用。",'readNotImplemented':"沒有實作讀取的功能。",'writeNotImplemented':"沒有實作寫入的功能。",'noFID':"因為沒有 FID 所以無法更新 feature。",'errorLoadingGML':"讀取GML檔案 ${url} 錯誤。",'browserNotSupported':"您的瀏覽器未支援向量渲染. 目前支援的渲染方式是:\n${renderers}",'componentShouldBe':"addFeatures : 元件應該為 ${geomType}",'getFeatureError':"getFeatureFromEvent 在一個沒有被渲染的圖層裡被呼叫。這通常意味著您 "+"摧毀了一個圖層,但並未摧毀相關的handler。",'minZoomLevelError':"minZoomLevel 屬性僅適合用在 "+"FixedZoomLevels-descendent 類型的圖層. 這個"+"wfs layer 的 minZoomLevel 是過去所遺留下來的,"+"然而我們不能移除它而不讓它將"+"過去的程式相容性給破壞掉。"+"因此我們將會迴避使用它 -- minZoomLevel "+"會在3.0被移除,請改"+"用在這邊描述的 min/max resolution 設定: "+"http://trac.openlayers.org/wiki/SettingZoomLevels",'commitSuccess':"WFS Transaction: 成功 ${response}",'commitFailed':"WFS Transaction: 失敗 ${response}",'googleWarning':"The Google Layer 圖層無法被正確的載入。

"+"要迴避這個訊息, 請在右上角的圖層改變器裡,"+"選一個新的基礎圖層。

"+"很有可能是因為 Google Maps 的函式庫"+"腳本沒有被正確的置入,或沒有包含 "+"您網站上正確的 API key

"+"開發者: 要幫助這個行為正確完成,"+"請按這裡",'getLayerWarning':"${layerType} 圖層無法被正確的載入。

"+"要迴避這個訊息, 請在右上角的圖層改變器裡,"+"選一個新的基礎圖層。

"+"很有可能是因為 ${layerLib} 的函式庫"+"腳本沒有被正確的置入。

"+"開發者: 要幫助這個行為正確完成,"+"請按這裡",'scale':"Scale = 1 : ${scaleDenom}",'layerAlreadyAdded':"你試著新增圖層: ${layerName} 到地圖上,但圖層之前就已經被新增了。",'reprojectDeprecated':"你正使用 'reproject' 這個選項 "+"在 ${layerName} 層。這個選項已經不再使用:"+"它的使用原本是設計用來支援在商業地圖上秀出資料,"+"但這個功能已經被"+"Spherical Mercator所取代。更多的資訊可以在 "+"http://trac.openlayers.org/wiki/SphericalMercator 找到。",'methodDeprecated':"這個方法已經不再使用且在3.0將會被移除,"+"請使用 ${newMethod} 來代替。",'boundsAddError':"您必須傳入 x 跟 y 兩者的值進 add 函數。",'lonlatAddError':"您必須傳入 lon 跟 lat 兩者的值進 add 函數。",'pixelAddError':"您必須傳入 x 跟 y 兩者的值進 add 函數。",'unsupportedGeometryType':"未支援的幾何型別: ${geomType}。",'pagePositionFailed':"OpenLayers.Util.pagePosition 失敗: id ${elemId} 的 element 可能被錯置。",'end':''};OpenLayers.Popup.AnchoredBubble=OpenLayers.Class(OpenLayers.Popup.Anchored,{rounded:false,initialize:function(id,lonlat,contentSize,contentHTML,anchor,closeBox,closeBoxCallback){this.padding=new OpenLayers.Bounds(0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE,0,OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);OpenLayers.Popup.Anchored.prototype.initialize.apply(this,arguments);},draw:function(px){OpenLayers.Popup.Anchored.prototype.draw.apply(this,arguments);this.setContentHTML();this.setBackgroundColor();this.setOpacity();return this.div;},updateRelativePosition:function(){this.setRicoCorners();},setSize:function(contentSize){OpenLayers.Popup.Anchored.prototype.setSize.apply(this,arguments);this.setRicoCorners();},setBackgroundColor:function(color){if(color!=undefined){this.backgroundColor=color;} +if(this.div!=null){if(this.contentDiv!=null){this.div.style.background="transparent";OpenLayers.Rico.Corner.changeColor(this.groupDiv,this.backgroundColor);}}},setOpacity:function(opacity){OpenLayers.Popup.Anchored.prototype.setOpacity.call(this,opacity);if(this.div!=null){if(this.groupDiv!=null){OpenLayers.Rico.Corner.changeOpacity(this.groupDiv,this.opacity);}}},setBorder:function(border){this.border=0;},setRicoCorners:function(){var corners=this.getCornersToRound(this.relativePosition);var options={corners:corners,color:this.backgroundColor,bgColor:"transparent",blend:false};if(!this.rounded){OpenLayers.Rico.Corner.round(this.div,options);this.rounded=true;}else{OpenLayers.Rico.Corner.reRound(this.groupDiv,options);this.setBackgroundColor();this.setOpacity();}},getCornersToRound:function(){var corners=['tl','tr','bl','br'];var corner=OpenLayers.Bounds.oppositeQuadrant(this.relativePosition);OpenLayers.Util.removeItem(corners,corner);return corners.join(" ");},CLASS_NAME:"OpenLayers.Popup.AnchoredBubble"});OpenLayers.Popup.AnchoredBubble.CORNER_SIZE=5;OpenLayers.Projection=OpenLayers.Class({proj:null,projCode:null,initialize:function(projCode,options){OpenLayers.Util.extend(this,options);this.projCode=projCode;if(window.Proj4js){this.proj=new Proj4js.Proj(projCode);}},getCode:function(){return this.proj?this.proj.srsCode:this.projCode;},getUnits:function(){return this.proj?this.proj.units:null;},toString:function(){return this.getCode();},equals:function(projection){if(projection&&projection.getCode){return this.getCode()==projection.getCode();}else{return false;}},destroy:function(){delete this.proj;delete this.projCode;},CLASS_NAME:"OpenLayers.Projection"});OpenLayers.Projection.transforms={};OpenLayers.Projection.addTransform=function(from,to,method){if(!OpenLayers.Projection.transforms[from]){OpenLayers.Projection.transforms[from]={};} OpenLayers.Projection.transforms[from][to]=method;};OpenLayers.Projection.transform=function(point,source,dest){if(source.proj&&dest.proj){point=Proj4js.transform(source.proj,dest.proj,point);}else if(source&&dest&&OpenLayers.Projection.transforms[source.getCode()]&&OpenLayers.Projection.transforms[source.getCode()][dest.getCode()]){OpenLayers.Projection.transforms[source.getCode()][dest.getCode()](point);} -return point;};OpenLayers.Renderer.Canvas=OpenLayers.Class(OpenLayers.Renderer,{root:null,canvas:null,features:null,geometryMap:null,initialize:function(containerID){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.root=document.createElement("canvas");this.container.appendChild(this.root);this.canvas=this.root.getContext("2d");this.features={};this.geometryMap={};},eraseGeometry:function(geometry){this.eraseFeatures(this.features[this.geometryMap[geometry.id]][0]);},supported:function(){var canvas=document.createElement("canvas");return!!canvas.getContext;},setExtent:function(extent){this.extent=extent.clone();this.resolution=null;this.redraw();},setSize:function(size){this.size=size.clone();this.root.style.width=size.w+"px";this.root.style.height=size.h+"px";this.root.width=size.w;this.root.height=size.h;this.resolution=null;},drawFeature:function(feature,style){if(style==null){style=feature.style;} -style=OpenLayers.Util.extend({'fillColor':'#000000','strokeColor':'#000000','strokeWidth':2,'fillOpacity':1,'strokeOpacity':1},style);this.features[feature.id]=[feature,style];this.geometryMap[feature.geometry.id]=feature.id;this.redraw();},drawGeometry:function(geometry,style){var className=geometry.CLASS_NAME;if((className=="OpenLayers.Geometry.Collection")||(className=="OpenLayers.Geometry.MultiPoint")||(className=="OpenLayers.Geometry.MultiLineString")||(className=="OpenLayers.Geometry.MultiPolygon")){for(var i=0;i1){middle=parseInt((leftIndex+rightIndex)/2);var placement=this.compare(this,newNode,OpenLayers.Util.getElement(this.order[middle]));if(placement>0){leftIndex=middle;}else{rightIndex=middle;}} -this.order.splice(rightIndex,0,nodeId);this.indices[nodeId]=this.getZIndex(newNode);var nextIndex=rightIndex+1;return nextIndex=0){this.order.splice(arrayIndex,1);delete this.indices[nodeId];if(this.order.length>0){var lastId=this.order[this.order.length-1];this.maxZIndex=this.indices[lastId];}else{this.maxZIndex=0;}}},clear:function(){this.order=[];this.indices={};this.maxZIndex=0;},exists:function(node){return(this.indices[node.id]!=null);},getZIndex:function(node){return node._style.graphicZIndex;},determineZIndex:function(node){var zIndex=node._style.graphicZIndex;if(zIndex==null){zIndex=this.maxZIndex;node._style.graphicZIndex=zIndex;}else if(zIndex>this.maxZIndex){this.maxZIndex=zIndex;}},CLASS_NAME:"OpenLayers.ElementsIndexer"});OpenLayers.ElementsIndexer.IndexingMethods={Z_ORDER:function(indexer,newNode,nextNode){var newZIndex=indexer.getZIndex(newNode);var returnVal=0;if(nextNode){var nextZIndex=indexer.getZIndex(nextNode);returnVal=newZIndex-nextZIndex;} -return returnVal;},Z_ORDER_DRAWING_ORDER:function(indexer,newNode,nextNode){var returnVal=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(indexer,newNode,nextNode);if(nextNode&&returnVal==0){returnVal=1;} -return returnVal;},Z_ORDER_Y_ORDER:function(indexer,newNode,nextNode){var returnVal=OpenLayers.ElementsIndexer.IndexingMethods.Z_ORDER(indexer,newNode,nextNode);if(nextNode&&returnVal==0){var newLat=newNode._geometry.getBounds().bottom;var nextLat=nextNode._geometry.getBounds().bottom;var result=nextLat-newLat;returnVal=(result==0)?1:result;} -return returnVal;}};OpenLayers.Renderer.Elements=OpenLayers.Class(OpenLayers.Renderer,{rendererRoot:null,root:null,xmlns:null,indexer:null,BACKGROUND_ID_SUFFIX:"_background",minimumSymbolizer:{strokeLinecap:"round",strokeOpacity:1,strokeDashstyle:"solid",fillOpacity:1,pointRadius:0},initialize:function(containerID,options){OpenLayers.Renderer.prototype.initialize.apply(this,arguments);this.rendererRoot=this.createRenderRoot();this.root=this.createRoot();this.rendererRoot.appendChild(this.root);this.container.appendChild(this.rendererRoot);if(options&&(options.zIndexing||options.yOrdering)){this.indexer=new OpenLayers.ElementsIndexer(options.yOrdering);}},destroy:function(){this.clear();this.rendererRoot=null;this.root=null;this.xmlns=null;OpenLayers.Renderer.prototype.destroy.apply(this,arguments);},clear:function(){if(this.root){while(this.root.childNodes.length>0){this.root.removeChild(this.root.firstChild);}} -if(this.indexer){this.indexer.clear();}},getNodeType:function(geometry,style){},drawGeometry:function(geometry,style,featureId){var className=geometry.CLASS_NAME;var rendered=true;if((className=="OpenLayers.Geometry.Collection")||(className=="OpenLayers.Geometry.MultiPoint")||(className=="OpenLayers.Geometry.MultiLineString")||(className=="OpenLayers.Geometry.MultiPolygon")){for(var i=0,len=geometry.components.length;i=-this.MAX_PIXEL&&left<=this.MAX_PIXEL&&top>=-this.MAX_PIXEL&&top<=this.MAX_PIXEL);},setExtent:function(extent,resolutionChanged){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var resolution=this.getResolution();var left=-extent.left/resolution;var top=extent.top/resolution;if(resolutionChanged){this.left=left;this.top=top;var extentString="0 0 "+this.size.w+" "+this.size.h;this.rendererRoot.setAttributeNS(null,"viewBox",extentString);this.translate(0,0);return true;}else{var inRange=this.translate(left-this.left,top-this.top);if(!inRange){this.setExtent(extent,true);} +return inRange;}},translate:function(x,y){if(!this.inValidRange(x,y,true)){return false;}else{var transformString="";if(x||y){transformString="translate("+x+","+y+")";} +this.root.setAttributeNS(null,"transform",transformString);this.translationParameters={x:x,y:y};return true;}},setSize:function(size){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);this.rendererRoot.setAttributeNS(null,"height",this.size.h);},getNodeType:function(geometry,style){var nodeType=null;switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(style.externalGraphic){nodeType="image";}else if(this.isComplexSymbol(style.graphicName)){nodeType="use";}else{nodeType="circle";} +break;case"OpenLayers.Geometry.Rectangle":nodeType="rect";break;case"OpenLayers.Geometry.LineString":nodeType="polyline";break;case"OpenLayers.Geometry.LinearRing":nodeType="polygon";break;case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":case"OpenLayers.Geometry.Surface":nodeType="path";break;default:break;} +return nodeType;},setStyle:function(node,style,options){style=style||node._style;options=options||node._options;var r=parseFloat(node.getAttributeNS(null,"r"));var widthFactor=1;var pos;if(node._geometryClass=="OpenLayers.Geometry.Point"&&r){node.style.visibility="";if(style.graphic===false){node.style.visibility="hidden";}else if(style.externalGraphic){pos=this.getPosition(node);if(style.graphicTitle){node.setAttributeNS(null,"title",style.graphicTitle);} +if(style.graphicWidth&&style.graphicHeight){node.setAttributeNS(null,"preserveAspectRatio","none");} +var width=style.graphicWidth||style.graphicHeight;var height=style.graphicHeight||style.graphicWidth;width=width?width:style.pointRadius*2;height=height?height:style.pointRadius*2;var xOffset=(style.graphicXOffset!=undefined)?style.graphicXOffset:-(0.5*width);var yOffset=(style.graphicYOffset!=undefined)?style.graphicYOffset:-(0.5*height);var opacity=style.graphicOpacity||style.fillOpacity;node.setAttributeNS(null,"x",(pos.x+xOffset).toFixed());node.setAttributeNS(null,"y",(pos.y+yOffset).toFixed());node.setAttributeNS(null,"width",width);node.setAttributeNS(null,"height",height);node.setAttributeNS(this.xlinkns,"href",style.externalGraphic);node.setAttributeNS(null,"style","opacity: "+opacity);}else if(this.isComplexSymbol(style.graphicName)){var offset=style.pointRadius*3;var size=offset*2;var id=this.importSymbol(style.graphicName);var href="#"+id;pos=this.getPosition(node);widthFactor=this.symbolSize[id]/size;var parent=node.parentNode;var nextSibling=node.nextSibling;if(parent){parent.removeChild(node);} +node.setAttributeNS(this.xlinkns,"href",href);node.setAttributeNS(null,"width",size);node.setAttributeNS(null,"height",size);node.setAttributeNS(null,"x",pos.x-offset);node.setAttributeNS(null,"y",pos.y-offset);if(nextSibling){parent.insertBefore(node,nextSibling);}else if(parent){parent.appendChild(node);}}else{node.setAttributeNS(null,"r",style.pointRadius);} +if(typeof style.rotation!="undefined"&&pos){var rotation=OpenLayers.String.format("rotate(${0} ${1} ${2})",[style.rotation,pos.x,pos.y]);node.setAttributeNS(null,"transform",rotation);}} +if(options.isFilled){node.setAttributeNS(null,"fill",style.fillColor);node.setAttributeNS(null,"fill-opacity",style.fillOpacity);}else{node.setAttributeNS(null,"fill","none");} +if(options.isStroked){node.setAttributeNS(null,"stroke",style.strokeColor);node.setAttributeNS(null,"stroke-opacity",style.strokeOpacity);node.setAttributeNS(null,"stroke-width",style.strokeWidth*widthFactor);node.setAttributeNS(null,"stroke-linecap",style.strokeLinecap);node.setAttributeNS(null,"stroke-linejoin","round");node.setAttributeNS(null,"stroke-dasharray",this.dashStyle(style,widthFactor));}else{node.setAttributeNS(null,"stroke","none");} +if(style.pointerEvents){node.setAttributeNS(null,"pointer-events",style.pointerEvents);} +if(style.cursor!=null){node.setAttributeNS(null,"cursor",style.cursor);} +return node;},dashStyle:function(style,widthFactor){var w=style.strokeWidth*widthFactor;switch(style.strokeDashstyle){case'solid':return'none';case'dot':return[1,4*w].join();case'dash':return[4*w,4*w].join();case'dashdot':return[4*w,4*w,1,4*w].join();case'longdash':return[8*w,4*w].join();case'longdashdot':return[8*w,4*w,1,4*w].join();default:return style.strokeDashstyle.replace(/ /g,",");}},createNode:function(type,id){var node=document.createElementNS(this.xmlns,type);if(id){node.setAttributeNS(null,"id",id);} +return node;},nodeTypeCompare:function(node,type){return(type==node.nodeName);},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_svgRoot","svg");},createRoot:function(suffix){return this.nodeFactory(this.container.id+suffix,"g");},createDefs:function(){var defs=this.nodeFactory(this.container.id+"_defs","defs");this.rendererRoot.appendChild(defs);return defs;},drawPoint:function(node,geometry){return this.drawCircle(node,geometry,1);},drawCircle:function(node,geometry,radius){var resolution=this.getResolution();var x=(geometry.x/resolution+this.left);var y=(this.top-geometry.y/resolution);if(this.inValidRange(x,y)){node.setAttributeNS(null,"cx",x);node.setAttributeNS(null,"cy",y);node.setAttributeNS(null,"r",radius);return node;}else{return false;}},drawLineString:function(node,geometry){var componentsResult=this.getComponentsString(geometry.components);if(componentsResult.path){node.setAttributeNS(null,"points",componentsResult.path);return(componentsResult.complete?node:null);}else{return false;}},drawLinearRing:function(node,geometry){var componentsResult=this.getComponentsString(geometry.components);if(componentsResult.path){node.setAttributeNS(null,"points",componentsResult.path);return(componentsResult.complete?node:null);}else{return false;}},drawPolygon:function(node,geometry){var d="";var draw=true;var complete=true;var linearRingResult,path;for(var j=0,len=geometry.components.length;j0){if(this.getShortString(components[i-1])){strings.push(this.clipLine(components[i],components[i-1]));}} +if(imaxX){k=(y2-y1)/(x2-x1);x2=x2<0?-maxX:maxX;y2=y1+(x2-x1)*k;} +if(y2<-maxY||y2>maxY){k=(x2-x1)/(y2-y1);y2=y2<0?-maxY:maxY;x2=x1+(y2-y1)*k;} +return x2+","+y2;},getShortString:function(point){var resolution=this.getResolution();var x=(point.x/resolution+this.left);var y=(this.top-point.y/resolution);if(this.inValidRange(x,y)){return x+","+y;}else{return false;}},getPosition:function(node){return({x:parseFloat(node.getAttributeNS(null,"cx")),y:parseFloat(node.getAttributeNS(null,"cy"))});},importSymbol:function(graphicName){if(!this.defs){this.defs=this.createDefs();} +var id=this.container.id+"-"+graphicName;if(document.getElementById(id)!=null){return id;} +var symbol=OpenLayers.Renderer.symbol[graphicName];if(!symbol){throw new Error(graphicName+' is not a valid symbol name');return;} +var symbolNode=this.nodeFactory(id,"symbol");var node=this.nodeFactory(null,"polygon");symbolNode.appendChild(node);var symbolExtent=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var points="";var x,y;for(var i=0;i=2*parts[1]){return"longdash";} +return(parts[0]==1||parts[1]==1)?"dot":"dash";}else if(parts.length==4){return(1*parts[0]>=2*parts[1])?"longdashdot":"dashdot";} +return"solid";}},createNode:function(type,id){var node=document.createElement(type);if(id){node.id=id;} +node.unselectable='on';node.onselectstart=function(){return(false);};return node;},nodeTypeCompare:function(node,type){var subType=type;var splitIndex=subType.indexOf(":");if(splitIndex!=-1){subType=subType.substr(splitIndex+1);} +var nodeName=node.nodeName;splitIndex=nodeName.indexOf(":");if(splitIndex!=-1){nodeName=nodeName.substr(splitIndex+1);} +return(subType==nodeName);},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div");},createRoot:function(suffix){return this.nodeFactory(this.container.id+suffix,"olv:group");},drawPoint:function(node,geometry){return this.drawCircle(node,geometry,1);},drawCircle:function(node,geometry,radius){if(!isNaN(geometry.x)&&!isNaN(geometry.y)){var resolution=this.getResolution();node.style.left=((geometry.x/resolution-this.offset.x).toFixed()-radius)+"px";node.style.top=((geometry.y/resolution-this.offset.y).toFixed()-radius)+"px";var diameter=radius*2;node.style.width=diameter+"px";node.style.height=diameter+"px";return node;} +return false;},drawLineString:function(node,geometry){return this.drawLine(node,geometry,false);},drawLinearRing:function(node,geometry){return this.drawLine(node,geometry,true);},drawLine:function(node,geometry,closeLine){this.setNodeDimension(node,geometry);var resolution=this.getResolution();var numComponents=geometry.components.length;var parts=new Array(numComponents);var comp,x,y;for(var i=0;i0){symbolExtent.bottom=symbolExtent.bottom-diff;symbolExtent.top=symbolExtent.top+diff;}else{symbolExtent.left=symbolExtent.left-diff;symbolExtent.right=symbolExtent.right+diff;} +cache={path:path,size:symbolExtent.getWidth(),left:symbolExtent.left,bottom:symbolExtent.bottom};this.symbolCache[id]=cache;return cache;},CLASS_NAME:"OpenLayers.Renderer.VML"});OpenLayers.Renderer.VML.LABEL_SHIFT={"l":0,"c":.5,"r":1,"t":0,"m":.5,"b":1};OpenLayers.Tile=OpenLayers.Class({EVENT_TYPES:["loadstart","loadend","reload","unload"],events:null,id:null,layer:null,url:null,bounds:null,size:null,position:null,isLoading:false,initialize:function(layer,position,bounds,url,size){this.layer=layer;this.position=position.clone();this.bounds=bounds.clone();this.url=url;this.size=size.clone();this.id=OpenLayers.Util.createUniqueID("Tile_");this.events=new OpenLayers.Events(this,null,this.EVENT_TYPES);},unload:function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("unload");}},destroy:function(){this.layer=null;this.bounds=null;this.size=null;this.position=null;this.events.destroy();this.events=null;},clone:function(obj){if(obj==null){obj=new OpenLayers.Tile(this.layer,this.position,this.bounds,this.url,this.size);} +OpenLayers.Util.applyDefaults(obj,this);return obj;},draw:function(){var maxExtent=this.layer.maxExtent;var withinMaxExtent=(maxExtent&&this.bounds.intersectsBounds(maxExtent,false));this.shouldDraw=(withinMaxExtent||this.layer.displayOutsideMaxExtent);this.clear();return this.shouldDraw;},moveTo:function(bounds,position,redraw){if(redraw==null){redraw=true;} +this.bounds=bounds.clone();this.position=position.clone();if(redraw){this.draw();}},clear:function(){},getBoundsFromBaseLayer:function(position){var msg=OpenLayers.i18n('reprojectDeprecated',{'layerName':this.layer.name});OpenLayers.Console.warn(msg);var topLeft=this.layer.map.getLonLatFromLayerPx(position);var bottomRightPx=position.clone();bottomRightPx.x+=this.size.w;bottomRightPx.y+=this.size.h;var bottomRight=this.layer.map.getLonLatFromLayerPx(bottomRightPx);if(topLeft.lon>bottomRight.lon){if(topLeft.lon<0){topLeft.lon=-180-(topLeft.lon+180);}else{bottomRight.lon=180+bottomRight.lon+180;}} +var bounds=new OpenLayers.Bounds(topLeft.lon,bottomRight.lat,bottomRight.lon,topLeft.lat);return bounds;},showTile:function(){if(this.shouldDraw){this.show();}},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Control.PanZoomBar=OpenLayers.Class(OpenLayers.Control.PanZoom,{zoomStopWidth:18,zoomStopHeight:11,slider:null,sliderEvents:null,zoomBarDiv:null,divEvents:null,zoomWorldIcon:false,initialize:function(){OpenLayers.Control.PanZoom.prototype.initialize.apply(this,arguments);},destroy:function(){this._removeZoomBar();this.map.events.un({"changebaselayer":this.redraw,scope:this});OpenLayers.Control.PanZoom.prototype.destroy.apply(this,arguments);},setMap:function(map){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments);this.map.events.register("changebaselayer",this,this.redraw);},redraw:function(){if(this.div!=null){this.removeButtons();this._removeZoomBar();} +this.draw();},draw:function(px){OpenLayers.Control.prototype.draw.apply(this,arguments);px=this.position.clone();this.buttons=[];var sz=new OpenLayers.Size(18,18);var centered=new OpenLayers.Pixel(px.x+sz.w/2,px.y);var wposition=sz.w;if(this.zoomWorldIcon){centered=new OpenLayers.Pixel(px.x+sz.w,px.y);} +this._addButton("panup","north-mini.png",centered,sz);px.y=centered.y+sz.h;this._addButton("panleft","west-mini.png",px,sz);if(this.zoomWorldIcon){this._addButton("zoomworld","zoom-world-mini.png",px.add(sz.w,0),sz);wposition*=2;} +this._addButton("panright","east-mini.png",px.add(wposition,0),sz);this._addButton("pandown","south-mini.png",centered.add(0,sz.h*2),sz);this._addButton("zoomin","zoom-plus-mini.png",centered.add(0,sz.h*3+5),sz);centered=this._addZoomBar(centered.add(0,sz.h*4+5));this._addButton("zoomout","zoom-minus-mini.png",centered,sz);return this.div;},_addZoomBar:function(centered){var imgLocation=OpenLayers.Util.getImagesLocation();var id=this.id+"_"+this.map.id;var zoomsToEnd=this.map.getNumZoomLevels()-1-this.map.getZoom();var slider=OpenLayers.Util.createAlphaImageDiv(id,centered.add(-1,zoomsToEnd*this.zoomStopHeight),new OpenLayers.Size(20,9),imgLocation+"slider.png","absolute");this.slider=slider;this.sliderEvents=new OpenLayers.Events(this,slider,null,true,{includeXY:true});this.sliderEvents.on({"mousedown":this.zoomBarDown,"mousemove":this.zoomBarDrag,"mouseup":this.zoomBarUp,"dblclick":this.doubleClick,"click":this.doubleClick});var sz=new OpenLayers.Size();sz.h=this.zoomStopHeight*this.map.getNumZoomLevels();sz.w=this.zoomStopWidth;var div=null;if(OpenLayers.Util.alphaHack()){var id=this.id+"_"+this.map.id;div=OpenLayers.Util.createAlphaImageDiv(id,centered,new OpenLayers.Size(sz.w,this.zoomStopHeight),imgLocation+"zoombar.png","absolute",null,"crop");div.style.height=sz.h+"px";}else{div=OpenLayers.Util.createDiv('OpenLayers_Control_PanZoomBar_Zoombar'+this.map.id,centered,sz,imgLocation+"zoombar.png");} +this.zoombarDiv=div;this.divEvents=new OpenLayers.Events(this,div,null,true,{includeXY:true});this.divEvents.on({"mousedown":this.divClick,"mousemove":this.passEventToSlider,"dblclick":this.doubleClick,"click":this.doubleClick});this.div.appendChild(div);this.startTop=parseInt(div.style.top);this.div.appendChild(slider);this.map.events.register("zoomend",this,this.moveZoomBar);centered=centered.add(0,this.zoomStopHeight*this.map.getNumZoomLevels());return centered;},_removeZoomBar:function(){this.sliderEvents.un({"mousedown":this.zoomBarDown,"mousemove":this.zoomBarDrag,"mouseup":this.zoomBarUp,"dblclick":this.doubleClick,"click":this.doubleClick});this.sliderEvents.destroy();this.divEvents.un({"mousedown":this.divClick,"mousemove":this.passEventToSlider,"dblclick":this.doubleClick,"click":this.doubleClick});this.divEvents.destroy();this.div.removeChild(this.zoombarDiv);this.zoombarDiv=null;this.div.removeChild(this.slider);this.slider=null;this.map.events.unregister("zoomend",this,this.moveZoomBar);},passEventToSlider:function(evt){this.sliderEvents.handleBrowserEvent(evt);},divClick:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;} +var y=evt.xy.y;var top=OpenLayers.Util.pagePosition(evt.object)[1];var levels=(y-top)/this.zoomStopHeight;if(!this.map.fractionalZoom){levels=Math.floor(levels);} +var zoom=(this.map.getNumZoomLevels()-1)-levels;zoom=Math.min(Math.max(zoom,0),this.map.getNumZoomLevels()-1);this.map.zoomTo(zoom);OpenLayers.Event.stop(evt);},zoomBarDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;} +this.map.events.on({"mousemove":this.passEventToSlider,"mouseup":this.passEventToSlider,scope:this});this.mouseDragStart=evt.xy.clone();this.zoomStart=evt.xy.clone();this.div.style.cursor="move";this.zoombarDiv.offsets=null;OpenLayers.Event.stop(evt);},zoomBarDrag:function(evt){if(this.mouseDragStart!=null){var deltaY=this.mouseDragStart.y-evt.xy.y;var offsets=OpenLayers.Util.pagePosition(this.zoombarDiv);if((evt.clientY-offsets[1])>0&&(evt.clientY-offsets[1])0){text=text.substring(index);} +var node=OpenLayers.Util.Try(OpenLayers.Function.bind((function(){var xmldom;if(window.ActiveXObject&&!this.xmldom){xmldom=new ActiveXObject("Microsoft.XMLDOM");}else{xmldom=this.xmldom;} +xmldom.loadXML(text);return xmldom;}),this),function(){return new DOMParser().parseFromString(text,'text/xml');},function(){var req=new XMLHttpRequest();req.open("GET","data:"+"text/xml"+";charset=utf-8,"+encodeURIComponent(text),false);if(req.overrideMimeType){req.overrideMimeType("text/xml");} +req.send(null);return req.responseXML;});if(this.keepData){this.data=node;} +return node;},write:function(node){var data;if(this.xmldom){data=node.xml;}else{var serializer=new XMLSerializer();if(node.nodeType==1){var doc=document.implementation.createDocument("","",null);if(doc.importNode){node=doc.importNode(node,true);} +doc.appendChild(node);data=serializer.serializeToString(doc);}else{data=serializer.serializeToString(node);}} +return data;},createElementNS:function(uri,name){var element;if(this.xmldom){if(typeof uri=="string"){element=this.xmldom.createNode(1,name,uri);}else{element=this.xmldom.createNode(1,name,"");}}else{element=document.createElementNS(uri,name);} +return element;},createTextNode:function(text){var node;if(this.xmldom){node=this.xmldom.createTextNode(text);}else{node=document.createTextNode(text);} +return node;},getElementsByTagNameNS:function(node,uri,name){var elements=[];if(node.getElementsByTagNameNS){elements=node.getElementsByTagNameNS(uri,name);}else{var allNodes=node.getElementsByTagName("*");var potentialNode,fullName;for(var i=0,len=allNodes.length;i0){prefix=name.substring(0,split);local=name.substring(split+1);}else{if(parent){prefix=this.namespaceAlias[parent.namespaceURI];}else{prefix=this.defaultPrefix;} +local=name;} +var child=this.writers[prefix][local].apply(this,[obj]);if(parent){parent.appendChild(child);} +return child;},getChildEl:function(node,name,uri){return node&&this.getThisOrNextEl(node.firstChild,name,uri);},getNextEl:function(node,name,uri){return node&&this.getThisOrNextEl(node.nextSibling,name,uri);},getThisOrNextEl:function(node,name,uri){outer:for(var sibling=node;sibling;sibling=sibling.nextSibling){switch(sibling.nodeType){case 1:if((!name||name===(sibling.localName||sibling.nodeName.split(":").pop()))&&(!uri||uri===sibling.namespaceURI)){break outer;} +sibling=null;break outer;case 3:if(/^\s*$/.test(sibling.nodeValue)){break;} +case 4:case 6:case 12:case 10:case 11:sibling=null;break outer;}} +return sibling||null;},lookupNamespaceURI:function(node,prefix){var uri=null;if(node){if(node.lookupNamespaceURI){uri=node.lookupNamespaceURI(prefix);}else{outer:switch(node.nodeType){case 1:if(node.namespaceURI!==null&&node.prefix===prefix){uri=node.namespaceURI;break outer;} +var len=node.attributes.length;if(len){var attr;for(var i=0;i
"+"Um diese Meldung nicht mehr zu erhalten, wählen Sie einen anderen "+"Hintergrundlayer aus dem LayerSwitcher in der rechten oberen Ecke.

"+"Sehr wahrscheinlich tritt dieser Fehler auf, weil das Skript der "+"Google-Maps-Bibliothek nicht eingebunden wurde oder keinen gültigen "+"API-Schlüssel für Ihre URL enthält.

"+"Entwickler: Für Hilfe zum korrekten Einbinden des Google-Layers "+"hier klicken",'getLayerWarning':"Der ${layerType}-Layer konnte nicht korrekt geladen werden.

"+"Um diese Meldung nicht mehr zu erhalten, wählen Sie einen anderen "+"Hintergrundlayer aus dem LayerSwitcher in der rechten oberen Ecke.

"+"Sehr wahrscheinlich tritt dieser Fehler auf, weil das Skript der "+'"${layerLib}"-Bibliothek nicht eingebunden wurde.

'+"Entwickler: Für Hilfe zum korrekten Einbinden von Layern "+"hier klicken",'scale':"Maßstab = 1 : ${scaleDenom}",'end':''},OpenLayers.Lang["en"]);OpenLayers.Lang.nl=OpenLayers.Util.applyDefaults({'unhandledRequest':"Niet afgehandeld request met als terugmelding ${statusText}",'permalink':"Permalink",'overlays':"Overlays",'baseLayer':"Achtergrondkaart",'sameProjection':"De overzichtskaart werkt alleen als de projectie gelijk is aan de projectie van de hoofdkaart",'readNotImplemented':"Lezen niet geïmplementeerd.",'writeNotImplemented':"Schrijven niet geïmplementeerd.",'noFID':"Een feature welke geen FID heeft kan niet bijgewerkt worden.",'errorLoadingGML':"Fout bij het laden van GML bestand ${url}",'browserNotSupported':"Uw browser ondersteunt het weergeven van vector niet. Momenteel ondersteunde weergave engines:\n${renderers}",'componentShouldBe':"addFeatures : component zou van het type ${geomType} moeten zijn",'commitSuccess':"WFS-transactie: SUCCESVOL ${response}",'commitFailed':"WFS-transactie: MISLUKT ${response}",'googleWarning':"De Google-Layer kon niet correct geladen worden.

"+"Om deze melding niet meer te krijgen, moet u een andere "+"achtergrondkaart kiezen in de LayerSwitcher in de rechterbovenhoek.

"+"Dit is waarschijnlijk omdat de ${layerLib} bilbiotheek "+"niet correct ingevoegd is.

"+"Ontwikkelaars: om dit werkend te krijgen, "+"klik hier",'getLayerWarning':"De ${layerType} Layer kon niet goed geladen worden.

"+"Om deze melding niet meer te krijgen, moet u een andere "+"achtergrondkaart kiezen in de LayerSwitcher in de rechterbovenhoek.

"+"Dit is waarschijnlijk omdat de ${layerLib} bilbiotheek "+"niet correct ingevoegd is.

"+"Ontwikkelaars: om dit werkend te krijgen, "+"klik hier",'scale':"Schaal = 1 : ${scaleDenom}",'end':''},OpenLayers.Lang["en"]);OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1000},EVENT_TYPES:["preaddlayer","addlayer","removelayer","changelayer","movestart","move","moveend","zoomend","popupopen","popupclose","addmarker","removemarker","clearmarkers","mouseover","mouseout","mousemove","dragstart","drag","dragend","changebaselayer"],id:null,fractionalZoom:false,events:null,allOverlays:false,div:null,dragging:false,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,layers:null,controls:null,popups:null,baseLayer:null,center:null,resolution:null,zoom:0,panRatio:1.5,viewRequestID:0,tileSize:null,projection:"EPSG:4326",units:'degrees',resolutions:null,maxResolution:1.40625,minResolution:null,maxScale:null,minScale:null,maxExtent:null,minExtent:null,restrictedExtent:null,numZoomLevels:16,theme:null,displayProjection:null,fallThrough:true,panTween:null,eventListeners:null,panMethod:OpenLayers.Easing.Expo.easeOut,panDuration:50,paddingForPopups:null,initialize:function(div,options){if(arguments.length===1&&typeof div==="object"){options=div;div=options&&options.div;} +this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.maxExtent=new OpenLayers.Bounds(-180,-90,180,90);this.paddingForPopups=new OpenLayers.Bounds(15,15,15,15);this.theme=OpenLayers._getScriptLocation()+'theme/default/style.css';OpenLayers.Util.extend(this,options);this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(div);if(!this.div){this.div=document.createElement("div");this.div.style.height="1px";this.div.style.width="1px";} +OpenLayers.Element.addClass(this.div,'olMap');var id=this.div.id+"_OpenLayers_ViewPort";this.viewPortDiv=OpenLayers.Util.createDiv(id,null,null,null,"relative",null,"hidden");this.viewPortDiv.style.width="100%";this.viewPortDiv.style.height="100%";this.viewPortDiv.className="olMapViewport";this.div.appendChild(this.viewPortDiv);id=this.div.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(id);this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE['Popup']-1;this.viewPortDiv.appendChild(this.layerContainerDiv);this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES,this.fallThrough,{includeXY:true});this.updateSize();if(this.eventListeners instanceof Object){this.events.on(this.eventListeners);} +this.events.register("movestart",this,this.updateSize);if(OpenLayers.String.contains(navigator.appName,"Microsoft")){this.events.register("resize",this,this.updateSize);}else{this.updateSizeDestroy=OpenLayers.Function.bind(this.updateSize,this);OpenLayers.Event.observe(window,'resize',this.updateSizeDestroy);} +if(this.theme){var addNode=true;var nodes=document.getElementsByTagName('link');for(var i=0,len=nodes.length;i=0;--i){this.controls[i].destroy();} +this.controls=null;} +if(this.layers!=null){for(var i=this.layers.length-1;i>=0;--i){this.layers[i].destroy(false);} +this.layers=null;} +if(this.viewPortDiv){this.div.removeChild(this.viewPortDiv);} +this.viewPortDiv=null;if(this.eventListeners){this.events.un(this.eventListeners);this.eventListeners=null;} +this.events.destroy();this.events=null;},setOptions:function(options){OpenLayers.Util.extend(this,options);},getTileSize:function(){return this.tileSize;},getBy:function(array,property,match){var test=(typeof match.test=="function");var found=OpenLayers.Array.filter(this[array],function(item){return item[property]==match||(test&&match.test(item[property]));});return found;},getLayersBy:function(property,match){return this.getBy("layers",property,match);},getLayersByName:function(match){return this.getLayersBy("name",match);},getLayersByClass:function(match){return this.getLayersBy("CLASS_NAME",match);},getControlsBy:function(property,match){return this.getBy("controls",property,match);},getControlsByClass:function(match){return this.getControlsBy("CLASS_NAME",match);},getLayer:function(id){var foundLayer=null;for(var i=0,len=this.layers.length;ithis.layers.length){idx=this.layers.length;} +if(base!=idx){this.layers.splice(base,1);this.layers.splice(idx,0,layer);for(var i=0,len=this.layers.length;i=0;--i){this.removePopup(this.popups[i]);}} +popup.map=this;this.popups.push(popup);var popupDiv=popup.draw();if(popupDiv){popupDiv.style.zIndex=this.Z_INDEX_BASE['Popup']+ +this.popups.length;this.layerContainerDiv.appendChild(popupDiv);}},removePopup:function(popup){OpenLayers.Util.removeItem(this.popups,popup);if(popup.div){try{this.layerContainerDiv.removeChild(popup.div);} +catch(e){}} +popup.map=null;},getSize:function(){var size=null;if(this.size!=null){size=this.size.clone();} +return size;},updateSize:function(){this.events.clearMouseCache();var newSize=this.getCurrentSize();var oldSize=this.getSize();if(oldSize==null){this.size=oldSize=newSize;} +if(!newSize.equals(oldSize)){this.size=newSize;for(var i=0,len=this.layers.length;ithis.restrictedExtent.getWidth()){lonlat=new OpenLayers.LonLat(maxCenter.lon,lonlat.lat);}else if(extent.leftthis.restrictedExtent.right){lonlat=lonlat.add(this.restrictedExtent.right- +extent.right,0);} +if(extent.getHeight()>this.restrictedExtent.getHeight()){lonlat=new OpenLayers.LonLat(lonlat.lon,maxCenter.lat);}else if(extent.bottomthis.restrictedExtent.top){lonlat=lonlat.add(0,this.restrictedExtent.top- +extent.top);}}} +var zoomChanged=forceZoomChange||((this.isValidZoomLevel(zoom))&&(zoom!=this.getZoom()));var centerChanged=(this.isValidLonLat(lonlat))&&(!lonlat.equals(this.center));if(zoomChanged||centerChanged||!dragging){if(!this.dragging&&!noEvent){this.events.triggerEvent("movestart");} +if(centerChanged){if((!zoomChanged)&&(this.center)){this.centerLayerContainer(lonlat);} +this.center=lonlat.clone();} +if((zoomChanged)||(this.layerContainerOrigin==null)){this.layerContainerOrigin=this.center.clone();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px";} +if(zoomChanged){this.zoom=zoom;this.resolution=this.getResolutionForZoom(zoom);this.viewRequestID++;} +var bounds=this.getExtent();if(this.baseLayer.visibility){this.baseLayer.moveTo(bounds,zoomChanged,dragging);if(dragging){this.baseLayer.events.triggerEvent("move");}else{this.baseLayer.events.triggerEvent("moveend",{"zoomChanged":zoomChanged});}} +bounds=this.baseLayer.getExtent();for(var i=0,len=this.layers.length;i=0)&&(zoomLevel0){var separator=(url.indexOf('?')>-1)?'&':'?';url+=separator+paramString;}} +if(config.proxy&&(url.indexOf("http")==0)){url=config.proxy+encodeURIComponent(url);} +request.open(config.method,url,config.async,config.user,config.password);for(var header in config.headers){request.setRequestHeader(header,config.headers[header]);} +var complete=(config.scope)?OpenLayers.Function.bind(config.callback,config.scope):config.callback;var success;if(config.success){success=(config.scope)?OpenLayers.Function.bind(config.success,config.scope):config.success;} +var failure;if(config.failure){failure=(config.scope)?OpenLayers.Function.bind(config.failure,config.scope):config.failure;} +var events=this.events;request.onreadystatechange=function(){if(request.readyState==OpenLayers.Request.XMLHttpRequest.DONE){var proceed=events.triggerEvent("complete",{request:request,config:config,requestUrl:url});if(proceed!==false){complete(request);if(!request.status||(request.status>=200&&request.status<300)){events.triggerEvent("success",{request:request,config:config,requestUrl:url});if(success){success(request);}} +if(request.status&&(request.status<200||request.status>=300)){events.triggerEvent("failure",{request:request,config:config,requestUrl:url});if(failure){failure(request);}}}}};if(config.async===false){request.send(config.data);}else{window.setTimeout(function(){request.send(config.data);},0);} +return request;},GET:function(config){config=OpenLayers.Util.extend(config,{method:"GET"});return OpenLayers.Request.issue(config);},POST:function(config){config=OpenLayers.Util.extend(config,{method:"POST"});config.headers=config.headers?config.headers:{};if(!("CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(config.headers))){config.headers["Content-Type"]="application/xml";} +return OpenLayers.Request.issue(config);},PUT:function(config){config=OpenLayers.Util.extend(config,{method:"PUT"});config.headers=config.headers?config.headers:{};if(!("CONTENT-TYPE"in OpenLayers.Util.upperCaseObject(config.headers))){config.headers["Content-Type"]="application/xml";} +return OpenLayers.Request.issue(config);},DELETE:function(config){config=OpenLayers.Util.extend(config,{method:"DELETE"});return OpenLayers.Request.issue(config);},HEAD:function(config){config=OpenLayers.Util.extend(config,{method:"HEAD"});return OpenLayers.Request.issue(config);},OPTIONS:function(config){config=OpenLayers.Util.extend(config,{method:"OPTIONS"});return OpenLayers.Request.issue(config);}};OpenLayers.Tile.Image=OpenLayers.Class(OpenLayers.Tile,{url:null,imgDiv:null,frame:null,layerAlphaHack:null,isBackBuffer:false,lastRatio:1,isFirstDraw:true,backBufferTile:null,initialize:function(layer,position,bounds,url,size){OpenLayers.Tile.prototype.initialize.apply(this,arguments);this.url=url;this.frame=document.createElement('div');this.frame.style.overflow='hidden';this.frame.style.position='absolute';this.layerAlphaHack=this.layer.alpha&&OpenLayers.Util.alphaHack();},destroy:function(){if(this.imgDiv!=null){if(this.layerAlphaHack){OpenLayers.Event.stopObservingElement(this.imgDiv.childNodes[0].id);} +OpenLayers.Event.stopObservingElement(this.imgDiv.id);if(this.imgDiv.parentNode==this.frame){this.frame.removeChild(this.imgDiv);this.imgDiv.map=null;} +this.imgDiv.urls=null;this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif";} +this.imgDiv=null;if((this.frame!=null)&&(this.frame.parentNode==this.layer.div)){this.layer.div.removeChild(this.frame);} +this.frame=null;if(this.backBufferTile){this.backBufferTile.destroy();this.backBufferTile=null;} +this.layer.events.unregister("loadend",this,this.resetBackBuffer);OpenLayers.Tile.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Tile.Image(this.layer,this.position,this.bounds,this.url,this.size);} +obj=OpenLayers.Tile.prototype.clone.apply(this,[obj]);obj.imgDiv=null;return obj;},draw:function(){if(this.layer!=this.layer.map.baseLayer&&this.layer.reproject){this.bounds=this.getBoundsFromBaseLayer(this.position);} +var drawTile=OpenLayers.Tile.prototype.draw.apply(this,arguments);if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(drawTile){if(!this.backBufferTile){this.backBufferTile=this.clone();this.backBufferTile.hide();this.backBufferTile.isBackBuffer=true;this.events.register('loadend',this,this.resetBackBuffer);this.layer.events.register("loadend",this,this.resetBackBuffer);} +this.startTransition();}else{if(this.backBufferTile){this.backBufferTile.clear();}}}else{if(drawTile&&this.isFirstDraw){this.events.register('loadend',this,this.showTile);this.isFirstDraw=false;}} +if(!drawTile){return false;} +if(this.isLoading){this.events.triggerEvent("reload");}else{this.isLoading=true;this.events.triggerEvent("loadstart");} +return this.renderTile();},resetBackBuffer:function(){this.showTile();if(this.backBufferTile&&(this.isFirstDraw||!this.layer.numLoadingTiles)){this.isFirstDraw=false;var maxExtent=this.layer.maxExtent;var withinMaxExtent=(maxExtent&&this.bounds.intersectsBounds(maxExtent,false));if(withinMaxExtent){this.backBufferTile.position=this.position;this.backBufferTile.bounds=this.bounds;this.backBufferTile.size=this.size;this.backBufferTile.imageSize=this.layer.imageSize||this.size;this.backBufferTile.imageOffset=this.layer.imageOffset;this.backBufferTile.resolution=this.layer.getResolution();this.backBufferTile.renderTile();} +this.backBufferTile.hide();}},renderTile:function(){if(this.imgDiv==null){this.initImgDiv();} +this.imgDiv.viewRequestID=this.layer.map.viewRequestID;if(this.layer.async){this.layer.getURLasync(this.bounds,this,"url",this.positionImage);}else{if(this.layer.url instanceof Array){this.imgDiv.urls=this.layer.url.slice();} +this.url=this.layer.getURL(this.bounds);this.positionImage();} +return true;},positionImage:function(){if(this.layer==null) +return;OpenLayers.Util.modifyDOMElement(this.frame,null,this.position,this.size);var imageSize=this.layer.getImageSize();if(this.layerAlphaHack){OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv,null,null,imageSize,this.url);}else{OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,imageSize);this.imgDiv.src=this.url;}},clear:function(){if(this.imgDiv){this.hide();if(OpenLayers.Tile.Image.useBlankTile){this.imgDiv.src=OpenLayers.Util.getImagesLocation()+"blank.gif";}}},initImgDiv:function(){var offset=this.layer.imageOffset;var size=this.layer.getImageSize();if(this.layerAlphaHack){this.imgDiv=OpenLayers.Util.createAlphaImageDiv(null,offset,size,null,"relative",null,null,null,true);}else{this.imgDiv=OpenLayers.Util.createImage(null,offset,size,null,"relative",null,null,true);} +this.imgDiv.className='olTileImage';this.frame.style.zIndex=this.isBackBuffer?0:1;this.frame.appendChild(this.imgDiv);this.layer.div.appendChild(this.frame);if(this.layer.opacity!=null){OpenLayers.Util.modifyDOMElement(this.imgDiv,null,null,null,null,null,null,this.layer.opacity);} +this.imgDiv.map=this.layer.map;var onload=function(){if(this.isLoading){this.isLoading=false;this.events.triggerEvent("loadend");}};if(this.layerAlphaHack){OpenLayers.Event.observe(this.imgDiv.childNodes[0],'load',OpenLayers.Function.bind(onload,this));}else{OpenLayers.Event.observe(this.imgDiv,'load',OpenLayers.Function.bind(onload,this));} +var onerror=function(){if(this.imgDiv._attempts>OpenLayers.IMAGE_RELOAD_ATTEMPTS){onload.call(this);}};OpenLayers.Event.observe(this.imgDiv,"error",OpenLayers.Function.bind(onerror,this));},checkImgURL:function(){if(this.layer){var loaded=this.layerAlphaHack?this.imgDiv.firstChild.src:this.imgDiv.src;if(!OpenLayers.Util.isEquivalentUrl(loaded,this.url)){this.hide();}}},startTransition:function(){if(!this.backBufferTile||!this.backBufferTile.imgDiv){return;} +var ratio=1;if(this.backBufferTile.resolution){ratio=this.backBufferTile.resolution/this.layer.getResolution();} +if(ratio!=this.lastRatio){if(this.layer.transitionEffect=='resize'){var upperLeft=new OpenLayers.LonLat(this.backBufferTile.bounds.left,this.backBufferTile.bounds.top);var size=new OpenLayers.Size(this.backBufferTile.size.w*ratio,this.backBufferTile.size.h*ratio);var px=this.layer.map.getLayerPxFromLonLat(upperLeft);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,px,size);var imageSize=this.backBufferTile.imageSize;imageSize=new OpenLayers.Size(imageSize.w*ratio,imageSize.h*ratio);var imageOffset=this.backBufferTile.imageOffset;if(imageOffset){imageOffset=new OpenLayers.Pixel(imageOffset.x*ratio,imageOffset.y*ratio);} +OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,imageOffset,imageSize);this.backBufferTile.show();}}else{if(this.layer.singleTile){this.backBufferTile.show();}else{this.backBufferTile.hide();}} +this.lastRatio=ratio;},show:function(){this.frame.style.display='';if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1){this.frame.scrollLeft=this.frame.scrollLeft;}}},hide:function(){this.frame.style.display='none';},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.Image.useBlankTile=(OpenLayers.Util.getBrowserName()=="safari"||OpenLayers.Util.getBrowserName()=="opera");OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:OpenLayers.Popup.AnchoredBubble,popup:null,initialize:function(layer,lonlat,data){this.layer=layer;this.lonlat=lonlat;this.data=(data!=null)?data:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){if((this.layer!=null)&&(this.layer.map!=null)){if(this.popup!=null){this.layer.map.removePopup(this.popup);}} +this.layer=null;this.id=null;this.lonlat=null;this.data=null;if(this.marker!=null){this.destroyMarker(this.marker);this.marker=null;} +if(this.popup!=null){this.destroyPopup(this.popup);this.popup=null;}},onScreen:function(){var onScreen=false;if((this.layer!=null)&&(this.layer.map!=null)){var screenBounds=this.layer.map.getExtent();onScreen=screenBounds.containsLonLat(this.lonlat);} +return onScreen;},createMarker:function(){if(this.lonlat!=null){this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon);} +return this.marker;},destroyMarker:function(){this.marker.destroy();},createPopup:function(closeBox){if(this.lonlat!=null){var id=this.id+"_popup";var anchor=(this.marker)?this.marker.icon:null;if(!this.popup){this.popup=new this.popupClass(id,this.lonlat,this.data.popupSize,this.data.popupContentHTML,anchor,closeBox);} +if(this.data.overflow!=null){this.popup.contentDiv.style.overflow=this.data.overflow;} +this.popup.feature=this;} +return this.popup;},destroyPopup:function(){if(this.popup){this.popup.feature=null;this.popup.destroy();this.popup=null;}},CLASS_NAME:"OpenLayers.Feature"});OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:true,'double':false,pixelTolerance:0,stopSingle:false,stopDouble:false,timerId:null,down:null,rightclickTimerId:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(this.pixelTolerance!=null){this.mousedown=function(evt){this.down=evt.xy;return true;};}},mousedown:null,mouseup:function(evt){var propagate=true;if(this.checkModifiers(evt)&&this.control.handleRightClicks&&OpenLayers.Event.isRightClick(evt)){propagate=this.rightclick(evt);} +return propagate;},rightclick:function(evt){if(this.passesTolerance(evt)){if(this.rightclickTimerId!=null){this.clearTimer();this.callback('dblrightclick',[evt]);return!this.stopDouble;}else{var clickEvent=this['double']?OpenLayers.Util.extend({},evt):this.callback('rightclick',[evt]);var delayedRightCall=OpenLayers.Function.bind(this.delayedRightCall,this,clickEvent);this.rightclickTimerId=window.setTimeout(delayedRightCall,this.delay);}} +return!this.stopSingle;},delayedRightCall:function(evt){this.rightclickTimerId=null;if(evt){this.callback('rightclick',[evt]);} +return!this.stopSingle;},dblclick:function(evt){if(this.passesTolerance(evt)){if(this["double"]){this.callback('dblclick',[evt]);} +this.clearTimer();} +return!this.stopDouble;},click:function(evt){if(this.passesTolerance(evt)){if(this.timerId!=null){this.clearTimer();}else{var clickEvent=this.single?OpenLayers.Util.extend({},evt):null;this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,clickEvent),this.delay);}} +return!this.stopSingle;},passesTolerance:function(evt){var passes=true;if(this.pixelTolerance!=null&&this.down){var dpx=Math.sqrt(Math.pow(this.down.x-evt.xy.x,2)+ +Math.pow(this.down.y-evt.xy.y,2));if(dpx>this.pixelTolerance){passes=false;}} +return passes;},clearTimer:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null;} +if(this.rightclickTimerId!=null){window.clearTimeout(this.rightclickTimerId);this.rightclickTimerId=null;}},delayedCall:function(evt){this.timerId=null;if(evt){this.callback('click',[evt]);}},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();this.down=null;deactivated=true;} +return deactivated;},CLASS_NAME:"OpenLayers.Handler.Click"});OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:true,dragging:false,last:null,start:null,oldOnselectstart:null,interval:0,timeoutId:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);},down:function(evt){},move:function(evt){},up:function(evt){},out:function(evt){},mousedown:function(evt){var propagate=true;this.dragging=false;if(this.checkModifiers(evt)&&OpenLayers.Event.isLeftClick(evt)){this.started=true;this.start=evt.xy;this.last=evt.xy;OpenLayers.Element.addClass(this.map.viewPortDiv,"olDragDown");this.down(evt);this.callback("down",[evt.xy]);OpenLayers.Event.stop(evt);if(!this.oldOnselectstart){this.oldOnselectstart=(document.onselectstart)?document.onselectstart:function(){return true;};document.onselectstart=function(){return false;};} +propagate=!this.stopDown;}else{this.started=false;this.start=null;this.last=null;} +return propagate;},mousemove:function(evt){if(this.started&&!this.timeoutId&&(evt.xy.x!=this.last.x||evt.xy.y!=this.last.y)){if(this.interval>0){this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval);} +this.dragging=true;this.move(evt);this.callback("move",[evt.xy]);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=function(){return false;};} +this.last=this.evt.xy;} +return true;},removeTimeout:function(){this.timeoutId=null;},mouseup:function(evt){if(this.started){var dragged=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.up(evt);this.callback("up",[evt.xy]);if(dragged){this.callback("done",[evt.xy]);} +document.onselectstart=this.oldOnselectstart;} +return true;},mouseout:function(evt){if(this.started&&OpenLayers.Util.mouseLeft(evt,this.map.div)){var dragged=(this.start!=this.last);this.started=false;this.dragging=false;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");this.out(evt);this.callback("out",[]);if(dragged){this.callback("done",[evt.xy]);} +if(document.onselectstart){document.onselectstart=this.oldOnselectstart;}} +return true;},click:function(evt){return(this.start==this.last);},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragging=false;activated=true;} +return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.started=false;this.dragging=false;this.start=null;this.last=null;deactivated=true;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDragDown");} +return deactivated;},CLASS_NAME:"OpenLayers.Handler.Drag"});OpenLayers.Handler.Feature=OpenLayers.Class(OpenLayers.Handler,{EVENTMAP:{'click':{'in':'click','out':'clickout'},'mousemove':{'in':'over','out':'out'},'dblclick':{'in':'dblclick','out':null},'mousedown':{'in':null,'out':null},'mouseup':{'in':null,'out':null}},feature:null,lastFeature:null,down:null,up:null,clickTolerance:4,geometryTypes:null,stopClick:true,stopDown:true,stopUp:false,initialize:function(control,layer,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,[control,callbacks,options]);this.layer=layer;},mousedown:function(evt){this.down=evt.xy;return this.handle(evt)?!this.stopDown:true;},mouseup:function(evt){this.up=evt.xy;return this.handle(evt)?!this.stopUp:true;},click:function(evt){return this.handle(evt)?!this.stopClick:true;},mousemove:function(evt){if(!this.callbacks['over']&&!this.callbacks['out']){return true;} +this.handle(evt);return true;},dblclick:function(evt){return!this.handle(evt);},geometryTypeMatches:function(feature){return this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,feature.geometry.CLASS_NAME)>-1;},handle:function(evt){if(this.feature&&!this.feature.layer){this.feature=null;} +var type=evt.type;var handled=false;var previouslyIn=!!(this.feature);var click=(type=="click"||type=="dblclick");this.feature=this.layer.getFeatureFromEvent(evt);if(this.feature&&!this.feature.layer){this.feature=null;} +if(this.lastFeature&&!this.lastFeature.layer){this.lastFeature=null;} +if(this.feature){var inNew=(this.feature!=this.lastFeature);if(this.geometryTypeMatches(this.feature)){if(previouslyIn&&inNew){if(this.lastFeature){this.triggerCallback(type,'out',[this.lastFeature]);} +this.triggerCallback(type,'in',[this.feature]);}else if(!previouslyIn||click){this.triggerCallback(type,'in',[this.feature]);} +this.lastFeature=this.feature;handled=true;}else{if(this.lastFeature&&(previouslyIn&&inNew||click)){this.triggerCallback(type,'out',[this.lastFeature]);} +this.feature=null;}}else{if(this.lastFeature&&(previouslyIn||click)){this.triggerCallback(type,'out',[this.lastFeature]);}} +return handled;},triggerCallback:function(type,mode,args){var key=this.EVENTMAP[type][mode];if(key){if(type=='click'&&this.up&&this.down){var dpx=Math.sqrt(Math.pow(this.up.x-this.down.x,2)+ +Math.pow(this.up.y-this.down.y,2));if(dpx<=this.clickTolerance){this.callback(key,args);}}else{this.callback(key,args);}}},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.moveLayerToTop();this.map.events.on({"removelayer":this.handleMapEvents,"changelayer":this.handleMapEvents,scope:this});activated=true;} +return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.moveLayerBack();this.feature=null;this.lastFeature=null;this.down=null;this.up=null;this.map.events.un({"removelayer":this.handleMapEvents,"changelayer":this.handleMapEvents,scope:this});deactivated=true;} +return deactivated;},handleMapEvents:function(evt){if(!evt.property||evt.property=="order"){this.moveLayerToTop();}},moveLayerToTop:function(){var index=Math.max(this.map.Z_INDEX_BASE['Feature']-1,this.layer.getZIndex())+1;this.layer.setZIndex(index);},moveLayerBack:function(){var index=this.layer.getZIndex()-1;if(index>=this.map.Z_INDEX_BASE['Feature']){this.layer.setZIndex(index);}else{this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer));}},CLASS_NAME:"OpenLayers.Handler.Feature"});OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.wheelListener=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this);},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);this.wheelListener=null;},onWheelEvent:function(e){if(!this.map||!this.checkModifiers(e)){return;} +var overScrollableDiv=false;var overLayerDiv=false;var overMapDiv=false;var elem=OpenLayers.Event.element(e);while((elem!=null)&&!overMapDiv&&!overScrollableDiv){if(!overScrollableDiv){try{if(elem.currentStyle){overflow=elem.currentStyle["overflow"];}else{var style=document.defaultView.getComputedStyle(elem,null);var overflow=style.getPropertyValue("overflow");} +overScrollableDiv=(overflow&&(overflow=="auto")||(overflow=="scroll"));}catch(err){}} +if(!overLayerDiv){for(var i=0,len=this.map.layers.length;i=this.minResolution)&&(resolution<=this.maxResolution));}} +return inRange;},setIsBaseLayer:function(isBaseLayer){if(isBaseLayer!=this.isBaseLayer){this.isBaseLayer=isBaseLayer;if(this.map!=null){this.map.events.triggerEvent("changebaselayer",{layer:this});}}},initResolutions:function(){var props=new Array('projection','units','scales','resolutions','maxScale','minScale','maxResolution','minResolution','minExtent','maxExtent','numZoomLevels','maxZoomLevel');var notScaleProps=['projection','units'];var useInRange=false;var confProps={};for(var i=0,len=props.length;i1){base=Math.pow((confProps.maxResolution/confProps.minResolution),(1/(confProps.numZoomLevels-1)));} +for(var i=0;i=resolution){highRes=res;lowZoom=i;} +if(res<=resolution){lowRes=res;highZoom=i;break;}} +var dRes=highRes-lowRes;if(dRes>0){zoom=lowZoom+((highRes-resolution)/dRes);}else{zoom=lowZoom;}}else{var diff;var minDiff=Number.POSITIVE_INFINITY;for(var i=0,len=this.resolutions.length;iminDiff){break;} +minDiff=diff;}else{if(this.resolutions[i]bottomRight.lon){if(topLeft.lon<0){topLeft.lon=-180-(topLeft.lon+180);}else{bottomRight.lon=180+bottomRight.lon+180;}} -var bounds=new OpenLayers.Bounds(topLeft.lon,bottomRight.lat,bottomRight.lon,topLeft.lat);return bounds;},showTile:function(){if(this.shouldDraw){this.show();}},show:function(){},hide:function(){},CLASS_NAME:"OpenLayers.Tile"});OpenLayers.Control.PanZoomBar=OpenLayers.Class(OpenLayers.Control.PanZoom,{zoomStopWidth:18,zoomStopHeight:11,slider:null,sliderEvents:null,zoomBarDiv:null,divEvents:null,zoomWorldIcon:false,initialize:function(){OpenLayers.Control.PanZoom.prototype.initialize.apply(this,arguments);},destroy:function(){this.div.removeChild(this.slider);this.slider=null;this.sliderEvents.destroy();this.sliderEvents=null;this.div.removeChild(this.zoombarDiv);this.zoomBarDiv=null;this.divEvents.destroy();this.divEvents=null;this.map.events.un({"zoomend":this.moveZoomBar,"changebaselayer":this.redraw,scope:this});OpenLayers.Control.PanZoom.prototype.destroy.apply(this,arguments);},setMap:function(map){OpenLayers.Control.PanZoom.prototype.setMap.apply(this,arguments);this.map.events.register("changebaselayer",this,this.redraw);},redraw:function(){if(this.div!=null){this.div.innerHTML="";} -this.draw();},draw:function(px){OpenLayers.Control.prototype.draw.apply(this,arguments);px=this.position.clone();this.buttons=[];var sz=new OpenLayers.Size(18,18);var centered=new OpenLayers.Pixel(px.x+sz.w/2,px.y);var wposition=sz.w;if(this.zoomWorldIcon){centered=new OpenLayers.Pixel(px.x+sz.w,px.y);} -this._addButton("panup","north-mini.png",centered,sz);px.y=centered.y+sz.h;this._addButton("panleft","west-mini.png",px,sz);if(this.zoomWorldIcon){this._addButton("zoomworld","zoom-world-mini.png",px.add(sz.w,0),sz);wposition*=2;} -this._addButton("panright","east-mini.png",px.add(wposition,0),sz);this._addButton("pandown","south-mini.png",centered.add(0,sz.h*2),sz);this._addButton("zoomin","zoom-plus-mini.png",centered.add(0,sz.h*3+5),sz);centered=this._addZoomBar(centered.add(0,sz.h*4+5));this._addButton("zoomout","zoom-minus-mini.png",centered,sz);return this.div;},_addZoomBar:function(centered){var imgLocation=OpenLayers.Util.getImagesLocation();var id=this.id+"_"+this.map.id;var zoomsToEnd=this.map.getNumZoomLevels()-1-this.map.getZoom();var slider=OpenLayers.Util.createAlphaImageDiv(id,centered.add(-1,zoomsToEnd*this.zoomStopHeight),new OpenLayers.Size(20,9),imgLocation+"slider.png","absolute");this.slider=slider;this.sliderEvents=new OpenLayers.Events(this,slider,null,true,{includeXY:true});this.sliderEvents.on({"mousedown":this.zoomBarDown,"mousemove":this.zoomBarDrag,"mouseup":this.zoomBarUp,"dblclick":this.doubleClick,"click":this.doubleClick});var sz=new OpenLayers.Size();sz.h=this.zoomStopHeight*this.map.getNumZoomLevels();sz.w=this.zoomStopWidth;var div=null;if(OpenLayers.Util.alphaHack()){var id=this.id+"_"+this.map.id;div=OpenLayers.Util.createAlphaImageDiv(id,centered,new OpenLayers.Size(sz.w,this.zoomStopHeight),imgLocation+"zoombar.png","absolute",null,"crop");div.style.height=sz.h+"px";}else{div=OpenLayers.Util.createDiv('OpenLayers_Control_PanZoomBar_Zoombar'+this.map.id,centered,sz,imgLocation+"zoombar.png");} -this.zoombarDiv=div;this.divEvents=new OpenLayers.Events(this,div,null,true,{includeXY:true});this.divEvents.on({"mousedown":this.divClick,"mousemove":this.passEventToSlider,"dblclick":this.doubleClick,"click":this.doubleClick});this.div.appendChild(div);this.startTop=parseInt(div.style.top);this.div.appendChild(slider);this.map.events.register("zoomend",this,this.moveZoomBar);centered=centered.add(0,this.zoomStopHeight*this.map.getNumZoomLevels());return centered;},passEventToSlider:function(evt){this.sliderEvents.handleBrowserEvent(evt);},divClick:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;} -var y=evt.xy.y;var top=OpenLayers.Util.pagePosition(evt.object)[1];var levels=(y-top)/this.zoomStopHeight;if(!this.map.fractionalZoom){levels=Math.floor(levels);} -var zoom=(this.map.getNumZoomLevels()-1)-levels;zoom=Math.min(Math.max(zoom,0),this.map.getNumZoomLevels()-1);this.map.zoomTo(zoom);OpenLayers.Event.stop(evt);},zoomBarDown:function(evt){if(!OpenLayers.Event.isLeftClick(evt)){return;} -this.map.events.on({"mousemove":this.passEventToSlider,"mouseup":this.passEventToSlider,scope:this});this.mouseDragStart=evt.xy.clone();this.zoomStart=evt.xy.clone();this.div.style.cursor="move";this.zoombarDiv.offsets=null;OpenLayers.Event.stop(evt);},zoomBarDrag:function(evt){if(this.mouseDragStart!=null){var deltaY=this.mouseDragStart.y-evt.xy.y;var offsets=OpenLayers.Util.pagePosition(this.zoombarDiv);if((evt.clientY-offsets[1])>0&&(evt.clientY-offsets[1])0){text=text.substring(index);} -var node=OpenLayers.Util.Try(OpenLayers.Function.bind((function(){var xmldom;if(window.ActiveXObject&&!this.xmldom){xmldom=new ActiveXObject("Microsoft.XMLDOM");}else{xmldom=this.xmldom;} -xmldom.loadXML(text);return xmldom;}),this),function(){return new DOMParser().parseFromString(text,'text/xml');},function(){var req=new XMLHttpRequest();req.open("GET","data:"+"text/xml"+";charset=utf-8,"+encodeURIComponent(text),false);if(req.overrideMimeType){req.overrideMimeType("text/xml");} -req.send(null);return req.responseXML;});return node;},write:function(node){var data;if(this.xmldom){data=node.xml;}else{var serializer=new XMLSerializer();if(node.nodeType==1){var doc=document.implementation.createDocument("","",null);if(doc.importNode){node=doc.importNode(node,true);} -doc.appendChild(node);data=serializer.serializeToString(doc);}else{data=serializer.serializeToString(node);}} -return data;},createElementNS:function(uri,name){var element;if(this.xmldom){if(typeof uri=="string"){element=this.xmldom.createNode(1,name,uri);}else{element=this.xmldom.createNode(1,name,"");}}else{element=document.createElementNS(uri,name);} -return element;},createTextNode:function(text){var node;if(this.xmldom){node=this.xmldom.createTextNode(text);}else{node=document.createTextNode(text);} -return node;},getElementsByTagNameNS:function(node,uri,name){var elements=[];if(node.getElementsByTagNameNS){elements=node.getElementsByTagNameNS(uri,name);}else{var allNodes=node.getElementsByTagName("*");var potentialNode,fullName;for(var i=0,len=allNodes.length;i0){prefix=name.substring(0,split);local=name.substring(split+1);}else{if(parent){prefix=this.namespaceAlias[parent.namespaceURI];}else{prefix=this.defaultPrefix;} -local=name;} -var child=this.writers[prefix][local].apply(this,[obj]);if(parent){parent.appendChild(child);} -return child;},CLASS_NAME:"OpenLayers.Format.XML"});OpenLayers.Handler=OpenLayers.Class({id:null,control:null,map:null,keyMask:null,active:false,evt:null,initialize:function(control,callbacks,options){OpenLayers.Util.extend(this,options);this.control=control;this.callbacks=callbacks;if(control.map){this.setMap(control.map);} -OpenLayers.Util.extend(this,options);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},setMap:function(map){this.map=map;},checkModifiers:function(evt){if(this.keyMask==null){return true;} -var keyModifiers=(evt.shiftKey?OpenLayers.Handler.MOD_SHIFT:0)|(evt.ctrlKey?OpenLayers.Handler.MOD_CTRL:0)|(evt.altKey?OpenLayers.Handler.MOD_ALT:0);return(keyModifiers==this.keyMask);},activate:function(){if(this.active){return false;} -var events=OpenLayers.Events.prototype.BROWSER_EVENTS;for(var i=0,len=events.length;i
"+"Um diese Meldung nicht mehr zu erhalten, wählen Sie einen anderen "+"Hintergrundlayer aus dem LayerSwitcher in der rechten oberen Ecke.

"+"Sehr wahrscheinlich tritt dieser Fehler auf, weil das Skript der "+"Google-Maps-Bibliothek nicht eingebunden wurde oder keinen gültigen "+"API-Schlüssel für Ihre URL enthält.

"+"Entwickler: Für Hilfe zum korrekten Einbinden des Google-Layers "+"hier klicken",'getLayerWarning':"Der ${layerType}-Layer konnte nicht korrekt geladen werden.

"+"Um diese Meldung nicht mehr zu erhalten, wählen Sie einen anderen "+"Hintergrundlayer aus dem LayerSwitcher in der rechten oberen Ecke.

"+"Sehr wahrscheinlich tritt dieser Fehler auf, weil das Skript der "+'"${layerLib}"-Bibliothek nicht eingebunden wurde.

'+"Entwickler: Für Hilfe zum korrekten Einbinden von Layern "+"hier klicken",'scale':"Maßstab = 1 : ${scaleDenom}",'end':''},OpenLayers.Lang["en"]);OpenLayers.Lang.nl=OpenLayers.Util.applyDefaults({'unhandledRequest':"Niet afgehandeld request met als terugmelding ${statusText}",'permalink':"Permalink",'overlays':"Overlays",'baseLayer':"Achtergrondkaart",'sameProjection':"De overzichtskaart werkt alleen als de projectie gelijk is aan de projectie van de hoofdkaart",'readNotImplemented':"Lezen niet geïmplementeerd.",'writeNotImplemented':"Schrijven niet geïmplementeerd.",'noFID':"Een feature welke geen FID heeft kan niet bijgewerkt worden.",'errorLoadingGML':"Fout bij het laden van GML bestand ${url}",'browserNotSupported':"Uw browser ondersteunt het weergeven van vector niet. Momenteel ondersteunde weergave engines:\n${renderers}",'componentShouldBe':"addFeatures : component zou van het type ${geomType} moeten zijn",'commitSuccess':"WFS-transactie: SUCCESVOL ${response}",'commitFailed':"WFS-transactie: MISLUKT ${response}",'googleWarning':"De Google-Layer kon niet correct geladen worden.

"+"Om deze melding niet meer te krijgen, moet u een andere "+"achtergrondkaart kiezen in de LayerSwitcher in de rechterbovenhoek.

"+"Dit is waarschijnlijk omdat de ${layerLib} bilbiotheek "+"niet correct ingevoegd is.

"+"Ontwikkelaars: om dit werkend te krijgen, "+"klik hier",'getLayerWarning':"De ${layerType} Layer kon niet goed geladen worden.

"+"Om deze melding niet meer te krijgen, moet u een andere "+"achtergrondkaart kiezen in de LayerSwitcher in de rechterbovenhoek.

"+"Dit is waarschijnlijk omdat de ${layerLib} bilbiotheek "+"niet correct ingevoegd is.

"+"Ontwikkelaars: om dit werkend te krijgen, "+"klik hier",'scale':"Schaal = 1 : ${scaleDenom}",'end':''},OpenLayers.Lang["en"]);OpenLayers.Map=OpenLayers.Class({Z_INDEX_BASE:{BaseLayer:100,Overlay:325,Feature:725,Popup:750,Control:1000},EVENT_TYPES:["preaddlayer","addlayer","removelayer","changelayer","movestart","move","moveend","zoomend","popupopen","popupclose","addmarker","removemarker","clearmarkers","mouseover","mouseout","mousemove","dragstart","drag","dragend","changebaselayer"],id:null,fractionalZoom:false,events:null,div:null,dragging:false,size:null,viewPortDiv:null,layerContainerOrigin:null,layerContainerDiv:null,layers:null,controls:null,popups:null,baseLayer:null,center:null,resolution:null,zoom:0,panRatio:1.5,viewRequestID:0,tileSize:null,projection:"EPSG:4326",units:'degrees',resolutions:null,maxResolution:1.40625,minResolution:null,maxScale:null,minScale:null,maxExtent:null,minExtent:null,restrictedExtent:null,numZoomLevels:16,theme:null,displayProjection:null,fallThrough:true,panTween:null,eventListeners:null,panMethod:OpenLayers.Easing.Expo.easeOut,paddingForPopups:null,initialize:function(div,options){this.tileSize=new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,OpenLayers.Map.TILE_HEIGHT);this.maxExtent=new OpenLayers.Bounds(-180,-90,180,90);this.paddingForPopups=new OpenLayers.Bounds(15,15,15,15);this.theme=OpenLayers._getScriptLocation()+'theme/default/style.css';OpenLayers.Util.extend(this,options);this.id=OpenLayers.Util.createUniqueID("OpenLayers.Map_");this.div=OpenLayers.Util.getElement(div);OpenLayers.Element.addClass(this.div,'olMap');var id=this.div.id+"_OpenLayers_ViewPort";this.viewPortDiv=OpenLayers.Util.createDiv(id,null,null,null,"relative",null,"hidden");this.viewPortDiv.style.width="100%";this.viewPortDiv.style.height="100%";this.viewPortDiv.className="olMapViewport";this.div.appendChild(this.viewPortDiv);id=this.div.id+"_OpenLayers_Container";this.layerContainerDiv=OpenLayers.Util.createDiv(id);this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE['Popup']-1;this.viewPortDiv.appendChild(this.layerContainerDiv);this.events=new OpenLayers.Events(this,this.div,this.EVENT_TYPES,this.fallThrough,{includeXY:true});this.updateSize();if(this.eventListeners instanceof Object){this.events.on(this.eventListeners);} -this.events.register("movestart",this,this.updateSize);if(OpenLayers.String.contains(navigator.appName,"Microsoft")){this.events.register("resize",this,this.updateSize);}else{this.updateSizeDestroy=OpenLayers.Function.bind(this.updateSize,this);OpenLayers.Event.observe(window,'resize',this.updateSizeDestroy);} -if(this.theme){var addNode=true;var nodes=document.getElementsByTagName('link');for(var i=0,len=nodes.length;i=0;--i){this.controls[i].destroy();} -this.controls=null;} -if(this.layers!=null){for(var i=this.layers.length-1;i>=0;--i){this.layers[i].destroy(false);} -this.layers=null;} -if(this.viewPortDiv){this.div.removeChild(this.viewPortDiv);} -this.viewPortDiv=null;if(this.eventListeners){this.events.un(this.eventListeners);this.eventListeners=null;} -this.events.destroy();this.events=null;},setOptions:function(options){OpenLayers.Util.extend(this,options);},getTileSize:function(){return this.tileSize;},getBy:function(array,property,match){var test=(typeof match.test=="function");var found=OpenLayers.Array.filter(this[array],function(item){return item[property]==match||(test&&match.test(item[property]));});return found;},getLayersBy:function(property,match){return this.getBy("layers",property,match);},getLayersByName:function(match){return this.getLayersBy("name",match);},getLayersByClass:function(match){return this.getLayersBy("CLASS_NAME",match);},getControlsBy:function(property,match){return this.getBy("controls",property,match);},getControlsByClass:function(match){return this.getControlsBy("CLASS_NAME",match);},getLayer:function(id){var foundLayer=null;for(var i=0,len=this.layers.length;ithis.layers.length){idx=this.layers.length;} -if(base!=idx){this.layers.splice(base,1);this.layers.splice(idx,0,layer);for(var i=0,len=this.layers.length;i=0;--i){this.removePopup(this.popups[i]);}} -popup.map=this;this.popups.push(popup);var popupDiv=popup.draw();if(popupDiv){popupDiv.style.zIndex=this.Z_INDEX_BASE['Popup']+ -this.popups.length;this.layerContainerDiv.appendChild(popupDiv);}},removePopup:function(popup){OpenLayers.Util.removeItem(this.popups,popup);if(popup.div){try{this.layerContainerDiv.removeChild(popup.div);} -catch(e){}} -popup.map=null;},getSize:function(){var size=null;if(this.size!=null){size=this.size.clone();} -return size;},updateSize:function(){this.events.clearMouseCache();var newSize=this.getCurrentSize();var oldSize=this.getSize();if(oldSize==null){this.size=oldSize=newSize;} -if(!newSize.equals(oldSize)){this.size=newSize;for(var i=0,len=this.layers.length;ithis.restrictedExtent.getWidth()){lonlat=new OpenLayers.LonLat(maxCenter.lon,lonlat.lat);}else if(extent.leftthis.restrictedExtent.right){lonlat=lonlat.add(this.restrictedExtent.right- -extent.right,0);} -if(extent.getHeight()>this.restrictedExtent.getHeight()){lonlat=new OpenLayers.LonLat(lonlat.lon,maxCenter.lat);}else if(extent.bottomthis.restrictedExtent.top){lonlat=lonlat.add(0,this.restrictedExtent.top- -extent.top);}}} -var zoomChanged=forceZoomChange||((this.isValidZoomLevel(zoom))&&(zoom!=this.getZoom()));var centerChanged=(this.isValidLonLat(lonlat))&&(!lonlat.equals(this.center));if(zoomChanged||centerChanged||!dragging){if(!this.dragging&&!noEvent){this.events.triggerEvent("movestart");} -if(centerChanged){if((!zoomChanged)&&(this.center)){this.centerLayerContainer(lonlat);} -this.center=lonlat.clone();} -if((zoomChanged)||(this.layerContainerOrigin==null)){this.layerContainerOrigin=this.center.clone();this.layerContainerDiv.style.left="0px";this.layerContainerDiv.style.top="0px";} -if(zoomChanged){this.zoom=zoom;this.resolution=this.getResolutionForZoom(zoom);this.viewRequestID++;} -var bounds=this.getExtent();this.baseLayer.moveTo(bounds,zoomChanged,dragging);bounds=this.baseLayer.getExtent();for(var i=0,len=this.layers.length;i=0)&&(zoomLevel=-this.MAX_PIXEL&&left<=this.MAX_PIXEL&&top>=-this.MAX_PIXEL&&top<=this.MAX_PIXEL);},setExtent:function(extent,resolutionChanged){OpenLayers.Renderer.Elements.prototype.setExtent.apply(this,arguments);var resolution=this.getResolution();var left=-extent.left/resolution;var top=extent.top/resolution;if(resolutionChanged){this.left=left;this.top=top;var extentString="0 0 "+this.size.w+" "+this.size.h;this.rendererRoot.setAttributeNS(null,"viewBox",extentString);this.translate(0,0);return true;}else{var inRange=this.translate(left-this.left,top-this.top);if(!inRange){this.setExtent(extent,true);} -return inRange;}},translate:function(x,y){if(!this.inValidRange(x,y,true)){return false;}else{var transformString="";if(x||y){transformString="translate("+x+","+y+")";} -this.root.setAttributeNS(null,"transform",transformString);this.translationParameters={x:x,y:y};return true;}},setSize:function(size){OpenLayers.Renderer.prototype.setSize.apply(this,arguments);this.rendererRoot.setAttributeNS(null,"width",this.size.w);this.rendererRoot.setAttributeNS(null,"height",this.size.h);},getNodeType:function(geometry,style){var nodeType=null;switch(geometry.CLASS_NAME){case"OpenLayers.Geometry.Point":if(style.externalGraphic){nodeType="image";}else if(this.isComplexSymbol(style.graphicName)){nodeType="use";}else{nodeType="circle";} -break;case"OpenLayers.Geometry.Rectangle":nodeType="rect";break;case"OpenLayers.Geometry.LineString":nodeType="polyline";break;case"OpenLayers.Geometry.LinearRing":nodeType="polygon";break;case"OpenLayers.Geometry.Polygon":case"OpenLayers.Geometry.Curve":case"OpenLayers.Geometry.Surface":nodeType="path";break;default:break;} -return nodeType;},setStyle:function(node,style,options){style=style||node._style;options=options||node._options;var r=parseFloat(node.getAttributeNS(null,"r"));var widthFactor=1;var pos;if(node._geometryClass=="OpenLayers.Geometry.Point"&&r){if(style.externalGraphic){pos=this.getPosition(node);if(style.graphicWidth&&style.graphicHeight){node.setAttributeNS(null,"preserveAspectRatio","none");} -var width=style.graphicWidth||style.graphicHeight;var height=style.graphicHeight||style.graphicWidth;width=width?width:style.pointRadius*2;height=height?height:style.pointRadius*2;var xOffset=(style.graphicXOffset!=undefined)?style.graphicXOffset:-(0.5*width);var yOffset=(style.graphicYOffset!=undefined)?style.graphicYOffset:-(0.5*height);var opacity=style.graphicOpacity||style.fillOpacity;node.setAttributeNS(null,"x",(pos.x+xOffset).toFixed());node.setAttributeNS(null,"y",(pos.y+yOffset).toFixed());node.setAttributeNS(null,"width",width);node.setAttributeNS(null,"height",height);node.setAttributeNS(this.xlinkns,"href",style.externalGraphic);node.setAttributeNS(null,"style","opacity: "+opacity);}else if(this.isComplexSymbol(style.graphicName)){var offset=style.pointRadius*3;var size=offset*2;var id=this.importSymbol(style.graphicName);var href="#"+id;pos=this.getPosition(node);widthFactor=this.symbolSize[id]/size;if(node.getAttributeNS(this.xlinkns,"href")!=href){node.setAttributeNS(this.xlinkns,"href",href);}else if(size!=parseFloat(node.getAttributeNS(null,"width"))){node.style.visibility="hidden";this.container.scrollLeft=this.container.scrollLeft;} -node.setAttributeNS(null,"width",size);node.setAttributeNS(null,"height",size);node.setAttributeNS(null,"x",pos.x-offset);node.setAttributeNS(null,"y",pos.y-offset);node.style.visibility="";}else{node.setAttributeNS(null,"r",style.pointRadius);} -if(typeof style.rotation!="undefined"&&pos){var rotation=OpenLayers.String.format("rotate(${0} ${1} ${2})",[style.rotation,pos.x,pos.y]);node.setAttributeNS(null,"transform",rotation);}} -if(options.isFilled){node.setAttributeNS(null,"fill",style.fillColor);node.setAttributeNS(null,"fill-opacity",style.fillOpacity);}else{node.setAttributeNS(null,"fill","none");} -if(options.isStroked){node.setAttributeNS(null,"stroke",style.strokeColor);node.setAttributeNS(null,"stroke-opacity",style.strokeOpacity);node.setAttributeNS(null,"stroke-width",style.strokeWidth*widthFactor);node.setAttributeNS(null,"stroke-linecap",style.strokeLinecap);node.setAttributeNS(null,"stroke-linejoin","round");node.setAttributeNS(null,"stroke-dasharray",this.dashStyle(style,widthFactor));}else{node.setAttributeNS(null,"stroke","none");} -if(style.pointerEvents){node.setAttributeNS(null,"pointer-events",style.pointerEvents);} -if(style.cursor!=null){node.setAttributeNS(null,"cursor",style.cursor);} -return node;},dashStyle:function(style,widthFactor){var w=style.strokeWidth*widthFactor;switch(style.strokeDashstyle){case'solid':return'none';case'dot':return[1,4*w].join();case'dash':return[4*w,4*w].join();case'dashdot':return[4*w,4*w,1,4*w].join();case'longdash':return[8*w,4*w].join();case'longdashdot':return[8*w,4*w,1,4*w].join();default:return style.strokeDashstyle.replace(/ /g,",");}},createNode:function(type,id){var node=document.createElementNS(this.xmlns,type);if(id){node.setAttributeNS(null,"id",id);} -return node;},nodeTypeCompare:function(node,type){return(type==node.nodeName);},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_svgRoot","svg");},createRoot:function(){return this.nodeFactory(this.container.id+"_root","g");},createDefs:function(){var defs=this.nodeFactory("ol-renderer-defs","defs");this.rendererRoot.appendChild(defs);return defs;},drawPoint:function(node,geometry){return this.drawCircle(node,geometry,1);},drawCircle:function(node,geometry,radius){var resolution=this.getResolution();var x=(geometry.x/resolution+this.left);var y=(this.top-geometry.y/resolution);if(this.inValidRange(x,y)){node.setAttributeNS(null,"cx",x);node.setAttributeNS(null,"cy",y);node.setAttributeNS(null,"r",radius);return node;}else{return false;}},drawLineString:function(node,geometry){var componentsResult=this.getComponentsString(geometry.components);if(componentsResult.path){node.setAttributeNS(null,"points",componentsResult.path);return(componentsResult.complete?node:null);}else{return false;}},drawLinearRing:function(node,geometry){var componentsResult=this.getComponentsString(geometry.components);if(componentsResult.path){node.setAttributeNS(null,"points",componentsResult.path);return(componentsResult.complete?node:null);}else{return false;}},drawPolygon:function(node,geometry){var d="";var draw=true;var complete=true;var linearRingResult,path;for(var j=0,len=geometry.components.length;j0){if(this.getShortString(components[i-1])){strings.push(this.clipLine(components[i],components[i-1]));}} -if(imaxX){k=(y2-y1)/(x2-x1);x2=x2<0?-maxX:maxX;y2=y1+(x2-x1)*k;} -if(y2<-maxY||y2>maxY){k=(x2-x1)/(y2-y1);y2=y2<0?-maxY:maxY;x2=x1+(y2-y1)*k;} -return x2+","+y2;},getShortString:function(point){var resolution=this.getResolution();var x=(point.x/resolution+this.left);var y=(this.top-point.y/resolution);if(this.inValidRange(x,y)){return x+","+y;}else{return false;}},getPosition:function(node){return({x:parseFloat(node.getAttributeNS(null,"cx")),y:parseFloat(node.getAttributeNS(null,"cy"))});},importSymbol:function(graphicName){if(!this.defs){this.defs=this.createDefs();} -var id=this.container.id+"-"+graphicName;if(document.getElementById(id)!=null){return id;} -var symbol=OpenLayers.Renderer.symbol[graphicName];if(!symbol){throw new Error(graphicName+' is not a valid symbol name');return;} -var symbolNode=this.nodeFactory(id,"symbol");var node=this.nodeFactory(null,"polygon");symbolNode.appendChild(node);var symbolExtent=new OpenLayers.Bounds(Number.MAX_VALUE,Number.MAX_VALUE,0,0);var points="";var x,y;for(var i=0;i=2*parts[1]){return"longdash";} -return(parts[0]==1||parts[1]==1)?"dot":"dash";}else if(parts.length==4){return(1*parts[0]>=2*parts[1])?"longdashdot":"dashdot";} -return"solid";}},createNode:function(type,id){var node=document.createElement(type);if(id){node.setAttribute('id',id);} -node.setAttribute('unselectable','on',0);node.onselectstart=function(){return(false);};return node;},nodeTypeCompare:function(node,type){var subType=type;var splitIndex=subType.indexOf(":");if(splitIndex!=-1){subType=subType.substr(splitIndex+1);} -var nodeName=node.nodeName;splitIndex=nodeName.indexOf(":");if(splitIndex!=-1){nodeName=nodeName.substr(splitIndex+1);} -return(subType==nodeName);},createRenderRoot:function(){return this.nodeFactory(this.container.id+"_vmlRoot","div");},createRoot:function(){return this.nodeFactory(this.container.id+"_root","olv:group");},drawPoint:function(node,geometry){return this.drawCircle(node,geometry,1);},drawCircle:function(node,geometry,radius){if(!isNaN(geometry.x)&&!isNaN(geometry.y)){var resolution=this.getResolution();node.style.left=((geometry.x/resolution-this.offset.x).toFixed()-radius)+"px";node.style.top=((geometry.y/resolution-this.offset.y).toFixed()-radius)+"px";var diameter=radius*2;node.style.width=diameter+"px";node.style.height=diameter+"px";return node;} -return false;},drawLineString:function(node,geometry){return this.drawLine(node,geometry,false);},drawLinearRing:function(node,geometry){return this.drawLine(node,geometry,true);},drawLine:function(node,geometry,closeLine){this.setNodeDimension(node,geometry);var resolution=this.getResolution();var numComponents=geometry.components.length;var parts=new Array(numComponents);var comp,x,y;for(var i=0;iOpenLayers.IMAGE_RELOAD_ATTEMPTS){onload.call(this);}};OpenLayers.Event.observe(this.imgDiv,"error",OpenLayers.Function.bind(onerror,this));},checkImgURL:function(){if(this.layer){var loaded=this.layerAlphaHack?this.imgDiv.firstChild.src:this.imgDiv.src;if(!OpenLayers.Util.isEquivalentUrl(loaded,this.url)){this.hide();}}},startTransition:function(){if(!this.backBufferTile||!this.backBufferTile.imgDiv){return;} -var ratio=1;if(this.backBufferTile.resolution){ratio=this.backBufferTile.resolution/this.layer.getResolution();} -if(ratio!=this.lastRatio){if(this.layer.transitionEffect=='resize'){var upperLeft=new OpenLayers.LonLat(this.backBufferTile.bounds.left,this.backBufferTile.bounds.top);var size=new OpenLayers.Size(this.backBufferTile.size.w*ratio,this.backBufferTile.size.h*ratio);var px=this.layer.map.getLayerPxFromLonLat(upperLeft);OpenLayers.Util.modifyDOMElement(this.backBufferTile.frame,null,px,size);var imageSize=this.backBufferTile.imageSize;imageSize=new OpenLayers.Size(imageSize.w*ratio,imageSize.h*ratio);var imageOffset=this.backBufferTile.imageOffset;if(imageOffset){imageOffset=new OpenLayers.Pixel(imageOffset.x*ratio,imageOffset.y*ratio);} -OpenLayers.Util.modifyDOMElement(this.backBufferTile.imgDiv,null,imageOffset,imageSize);this.backBufferTile.show();}}else{if(this.layer.singleTile){this.backBufferTile.show();}else{this.backBufferTile.hide();}} -this.lastRatio=ratio;},show:function(){this.frame.style.display='';if(OpenLayers.Util.indexOf(this.layer.SUPPORTED_TRANSITIONS,this.layer.transitionEffect)!=-1){if(navigator.userAgent.toLowerCase().indexOf("gecko")!=-1){this.frame.scrollLeft=this.frame.scrollLeft;}}},hide:function(){this.frame.style.display='none';},CLASS_NAME:"OpenLayers.Tile.Image"});OpenLayers.Tile.Image.useBlankTile=(OpenLayers.Util.getBrowserName()=="safari"||OpenLayers.Util.getBrowserName()=="opera");OpenLayers.Feature=OpenLayers.Class({layer:null,id:null,lonlat:null,data:null,marker:null,popupClass:OpenLayers.Popup.AnchoredBubble,popup:null,initialize:function(layer,lonlat,data){this.layer=layer;this.lonlat=lonlat;this.data=(data!=null)?data:{};this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){if((this.layer!=null)&&(this.layer.map!=null)){if(this.popup!=null){this.layer.map.removePopup(this.popup);}} -this.layer=null;this.id=null;this.lonlat=null;this.data=null;if(this.marker!=null){this.destroyMarker(this.marker);this.marker=null;} -if(this.popup!=null){this.destroyPopup(this.popup);this.popup=null;}},onScreen:function(){var onScreen=false;if((this.layer!=null)&&(this.layer.map!=null)){var screenBounds=this.layer.map.getExtent();onScreen=screenBounds.containsLonLat(this.lonlat);} -return onScreen;},createMarker:function(){if(this.lonlat!=null){this.marker=new OpenLayers.Marker(this.lonlat,this.data.icon);} -return this.marker;},destroyMarker:function(){this.marker.destroy();},createPopup:function(closeBox){if(this.lonlat!=null){var id=this.id+"_popup";var anchor=(this.marker)?this.marker.icon:null;if(!this.popup){this.popup=new this.popupClass(id,this.lonlat,this.data.popupSize,this.data.popupContentHTML,anchor,closeBox);} -if(this.data.overflow!=null){this.popup.contentDiv.style.overflow=this.data.overflow;} -this.popup.feature=this;} -return this.popup;},destroyPopup:function(){if(this.popup){this.popup.feature=null;this.popup.destroy();this.popup=null;}},CLASS_NAME:"OpenLayers.Feature"});OpenLayers.Handler.Click=OpenLayers.Class(OpenLayers.Handler,{delay:300,single:true,'double':false,pixelTolerance:0,stopSingle:false,stopDouble:false,timerId:null,down:null,rightclickTimerId:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);if(this.pixelTolerance!=null){this.mousedown=function(evt){this.down=evt.xy;return true;};}},mousedown:null,mouseup:function(evt){var propagate=true;if(this.checkModifiers(evt)&&this.control.handleRightClicks&&OpenLayers.Event.isRightClick(evt)){propogate=this.rightclick(evt);} -return propagate;},rightclick:function(evt){if(this.passesTolerance(evt)){if(this.rightclickTimerId!=null){this.clearTimer();this.callback('dblrightclick',[evt]);return!this.stopDouble;}else{var clickEvent=this['double']?OpenLayers.Util.extend({},evt):this.callback('rightclick',[evt]);var delayedRightCall=OpenLayers.Function.bind(this.delayedRightCall,this,clickEvent);this.rightclickTimerId=window.setTimeout(delayedRightCall,this.delay);}} -return!this.stopSingle;},delayedRightCall:function(evt){this.rightclickTimerId=null;if(evt){this.callback('rightclick',[evt]);} -return!this.stopSingle;},dblclick:function(evt){if(this.passesTolerance(evt)){if(this["double"]){this.callback('dblclick',[evt]);} -this.clearTimer();} -return!this.stopDouble;},click:function(evt){if(this.passesTolerance(evt)){if(this.timerId!=null){this.clearTimer();}else{var clickEvent=this.single?OpenLayers.Util.extend({},evt):null;this.timerId=window.setTimeout(OpenLayers.Function.bind(this.delayedCall,this,clickEvent),this.delay);}} -return!this.stopSingle;},passesTolerance:function(evt){var passes=true;if(this.pixelTolerance!=null&&this.down){var dpx=Math.sqrt(Math.pow(this.down.x-evt.xy.x,2)+ -Math.pow(this.down.y-evt.xy.y,2));if(dpx>this.pixelTolerance){passes=false;}} -return passes;},clearTimer:function(){if(this.timerId!=null){window.clearTimeout(this.timerId);this.timerId=null;}},delayedCall:function(evt){this.timerId=null;if(evt){this.callback('click',[evt]);}},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.clearTimer();this.down=null;deactivated=true;} -return deactivated;},CLASS_NAME:"OpenLayers.Handler.Click"});OpenLayers.Handler.Drag=OpenLayers.Class(OpenLayers.Handler,{started:false,stopDown:true,dragging:false,last:null,start:null,oldOnselectstart:null,interval:0,timeoutId:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);},down:function(evt){},move:function(evt){},up:function(evt){},out:function(evt){},mousedown:function(evt){var propagate=true;this.dragging=false;if(this.checkModifiers(evt)&&OpenLayers.Event.isLeftClick(evt)){this.started=true;this.start=evt.xy;this.last=evt.xy;this.map.div.style.cursor="move";this.down(evt);this.callback("down",[evt.xy]);OpenLayers.Event.stop(evt);if(!this.oldOnselectstart){this.oldOnselectstart=(document.onselectstart)?document.onselectstart:function(){return true;};document.onselectstart=function(){return false;};} -propagate=!this.stopDown;}else{this.started=false;this.start=null;this.last=null;} -return propagate;},mousemove:function(evt){if(this.started&&!this.timeoutId&&(evt.xy.x!=this.last.x||evt.xy.y!=this.last.y)){if(this.interval>0){this.timeoutId=setTimeout(OpenLayers.Function.bind(this.removeTimeout,this),this.interval);} -this.dragging=true;this.move(evt);this.callback("move",[evt.xy]);if(!this.oldOnselectstart){this.oldOnselectstart=document.onselectstart;document.onselectstart=function(){return false;};} -this.last=this.evt.xy;} -return true;},removeTimeout:function(){this.timeoutId=null;},mouseup:function(evt){if(this.started){var dragged=(this.start!=this.last);this.started=false;this.dragging=false;this.map.div.style.cursor="";this.up(evt);this.callback("up",[evt.xy]);if(dragged){this.callback("done",[evt.xy]);} -document.onselectstart=this.oldOnselectstart;} -return true;},mouseout:function(evt){if(this.started&&OpenLayers.Util.mouseLeft(evt,this.map.div)){var dragged=(this.start!=this.last);this.started=false;this.dragging=false;this.map.div.style.cursor="";this.out(evt);this.callback("out",[]);if(dragged){this.callback("done",[evt.xy]);} -if(document.onselectstart){document.onselectstart=this.oldOnselectstart;}} -return true;},click:function(evt){return(this.start==this.last);},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragging=false;activated=true;} -return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.started=false;this.dragging=false;this.start=null;this.last=null;deactivated=true;} -return deactivated;},CLASS_NAME:"OpenLayers.Handler.Drag"});OpenLayers.Handler.Feature=OpenLayers.Class(OpenLayers.Handler,{EVENTMAP:{'click':{'in':'click','out':'clickout'},'mousemove':{'in':'over','out':'out'},'dblclick':{'in':'dblclick','out':null},'mousedown':{'in':null,'out':null},'mouseup':{'in':null,'out':null}},feature:null,lastFeature:null,down:null,up:null,clickoutTolerance:4,geometryTypes:null,stopClick:true,stopDown:true,stopUp:false,initialize:function(control,layer,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,[control,callbacks,options]);this.layer=layer;},mousedown:function(evt){this.down=evt.xy;return this.handle(evt)?!this.stopDown:true;},mouseup:function(evt){this.up=evt.xy;return this.handle(evt)?!this.stopUp:true;},click:function(evt){return this.handle(evt)?!this.stopClick:true;},mousemove:function(evt){if(!this.callbacks['over']&&!this.callbacks['out']){return true;} -this.handle(evt);return true;},dblclick:function(evt){return!this.handle(evt);},geometryTypeMatches:function(feature){return this.geometryTypes==null||OpenLayers.Util.indexOf(this.geometryTypes,feature.geometry.CLASS_NAME)>-1;},handle:function(evt){var type=evt.type;var handled=false;var previouslyIn=!!(this.feature);var click=(type=="click"||type=="dblclick");this.feature=this.layer.getFeatureFromEvent(evt);if(this.feature){var inNew=(this.feature!=this.lastFeature);if(this.geometryTypeMatches(this.feature)){if(previouslyIn&&inNew){this.triggerCallback(type,'out',[this.lastFeature]);this.triggerCallback(type,'in',[this.feature]);}else if(!previouslyIn||click){this.triggerCallback(type,'in',[this.feature]);} -this.lastFeature=this.feature;handled=true;}else{if(previouslyIn&&inNew||(click&&this.lastFeature)){this.triggerCallback(type,'out',[this.lastFeature]);} -this.feature=null;}}else{if(previouslyIn||(click&&this.lastFeature)){this.triggerCallback(type,'out',[this.lastFeature]);}} -return handled;},triggerCallback:function(type,mode,args){var key=this.EVENTMAP[type][mode];if(key){if(type=='click'&&mode=='out'&&this.up&&this.down){var dpx=Math.sqrt(Math.pow(this.up.x-this.down.x,2)+ -Math.pow(this.up.y-this.down.y,2));if(dpx<=this.clickoutTolerance){this.callback(key,args);}}else{this.callback(key,args);}}},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.moveLayerToTop();this.map.events.on({"removelayer":this.handleMapEvents,"changelayer":this.handleMapEvents,scope:this});activated=true;} -return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.moveLayerBack();this.feature=null;this.lastFeature=null;this.down=null;this.up=null;this.map.events.un({"removelayer":this.handleMapEvents,"changelayer":this.handleMapEvents,scope:this});deactivated=true;} -return deactivated;},handleMapEvents:function(evt){if(!evt.property||evt.property=="order"){this.moveLayerToTop();}},moveLayerToTop:function(){var index=Math.max(this.map.Z_INDEX_BASE['Feature']-1,this.layer.getZIndex())+1;this.layer.setZIndex(index);},moveLayerBack:function(){var index=this.layer.getZIndex()-1;if(index>=this.map.Z_INDEX_BASE['Feature']){this.layer.setZIndex(index);}else{this.map.setLayerZIndex(this.layer,this.map.getLayerIndex(this.layer));}},CLASS_NAME:"OpenLayers.Handler.Feature"});OpenLayers.Handler.MouseWheel=OpenLayers.Class(OpenLayers.Handler,{wheelListener:null,mousePosition:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);this.wheelListener=OpenLayers.Function.bindAsEventListener(this.onWheelEvent,this);},destroy:function(){OpenLayers.Handler.prototype.destroy.apply(this,arguments);this.wheelListener=null;},onWheelEvent:function(e){if(!this.map||!this.checkModifiers(e)){return;} -var overScrollableDiv=false;var overLayerDiv=false;var overMapDiv=false;var elem=OpenLayers.Event.element(e);while((elem!=null)&&!overMapDiv&&!overScrollableDiv){if(!overScrollableDiv){try{if(elem.currentStyle){overflow=elem.currentStyle["overflow"];}else{var style=document.defaultView.getComputedStyle(elem,null);var overflow=style.getPropertyValue("overflow");} -overScrollableDiv=(overflow&&(overflow=="auto")||(overflow=="scroll"));}catch(err){}} -if(!overLayerDiv){for(var i=0,len=this.map.layers.length;i=this.minResolution)&&(resolution<=this.maxResolution));}} -return inRange;},setIsBaseLayer:function(isBaseLayer){if(isBaseLayer!=this.isBaseLayer){this.isBaseLayer=isBaseLayer;if(this.map!=null){this.map.events.triggerEvent("changebaselayer",{layer:this});}}},initResolutions:function(){var props=new Array('projection','units','scales','resolutions','maxScale','minScale','maxResolution','minResolution','minExtent','maxExtent','numZoomLevels','maxZoomLevel');var notScaleProps=['projection','units'];var useInRange=false;var confProps={};for(var i=0,len=props.length;i1){base=Math.pow((confProps.maxResolution/confProps.minResolution),(1/(confProps.numZoomLevels-1)));} -for(var i=0;i=resolution){highRes=res;lowZoom=i;} -if(res<=resolution){lowRes=res;highZoom=i;break;}} -var dRes=highRes-lowRes;if(dRes>0){zoom=lowZoom+((resolution-lowRes)/dRes);}else{zoom=lowZoom;}}else{var diff;var minDiff=Number.POSITIVE_INFINITY;for(var i=0,len=this.resolutions.length;iminDiff){break;} -minDiff=diff;}else{if(this.resolutions[i]startX){this.zoomBox.style.width=Math.max(1,deltaX-box.xOffset)+"px";} +var lastPixel=this.layer.getViewPortPxFromLonLat(this.geometry.getBounds().getCenterLonLat());var res=this.layer.map.getResolution();this.geometry.move(res*(pixel.x-lastPixel.x),res*(lastPixel.y-pixel.y));this.layer.drawFeature(this);return lastPixel;},toState:function(state){if(state==OpenLayers.State.UPDATE){switch(this.state){case OpenLayers.State.UNKNOWN:case OpenLayers.State.DELETE:this.state=state;break;case OpenLayers.State.UPDATE:case OpenLayers.State.INSERT:break;}}else if(state==OpenLayers.State.INSERT){switch(this.state){case OpenLayers.State.UNKNOWN:break;default:this.state=state;break;}}else if(state==OpenLayers.State.DELETE){switch(this.state){case OpenLayers.State.INSERT:break;case OpenLayers.State.DELETE:break;case OpenLayers.State.UNKNOWN:case OpenLayers.State.UPDATE:this.state=state;break;}}else if(state==OpenLayers.State.UNKNOWN){this.state=state;}},CLASS_NAME:"OpenLayers.Feature.Vector"});OpenLayers.Feature.Vector.style={'default':{fillColor:"#ee9900",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#ee9900",strokeOpacity:1,strokeWidth:1,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},'select':{fillColor:"blue",fillOpacity:0.4,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"blue",strokeOpacity:1,strokeWidth:2,strokeLinecap:"round",strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"pointer"},'temporary':{fillColor:"#66cccc",fillOpacity:0.2,hoverFillColor:"white",hoverFillOpacity:0.8,strokeColor:"#66cccc",strokeOpacity:1,strokeLinecap:"round",strokeWidth:2,strokeDashstyle:"solid",hoverStrokeColor:"red",hoverStrokeOpacity:1,hoverStrokeWidth:0.2,pointRadius:6,hoverPointRadius:1,hoverPointUnit:"%",pointerEvents:"visiblePainted",cursor:"inherit"},'delete':{display:"none"}};OpenLayers.Handler.Box=OpenLayers.Class(OpenLayers.Handler,{dragHandler:null,boxDivClassName:'olHandlerBoxZoomBox',boxCharacteristics:null,initialize:function(control,callbacks,options){OpenLayers.Handler.prototype.initialize.apply(this,arguments);var callbacks={"down":this.startBox,"move":this.moveBox,"out":this.removeBox,"up":this.endBox};this.dragHandler=new OpenLayers.Handler.Drag(this,callbacks,{keyMask:this.keyMask});},setMap:function(map){OpenLayers.Handler.prototype.setMap.apply(this,arguments);if(this.dragHandler){this.dragHandler.setMap(map);}},startBox:function(xy){this.zoomBox=OpenLayers.Util.createDiv('zoomBox',this.dragHandler.start);this.zoomBox.className=this.boxDivClassName;this.zoomBox.style.zIndex=this.map.Z_INDEX_BASE["Popup"]-1;this.map.viewPortDiv.appendChild(this.zoomBox);OpenLayers.Element.addClass(this.map.viewPortDiv,"olDrawBox");},moveBox:function(xy){var startX=this.dragHandler.start.x;var startY=this.dragHandler.start.y;var deltaX=Math.abs(startX-xy.x);var deltaY=Math.abs(startY-xy.y);this.zoomBox.style.width=Math.max(1,deltaX)+"px";this.zoomBox.style.height=Math.max(1,deltaY)+"px";this.zoomBox.style.left=xy.xstartX){this.zoomBox.style.width=Math.max(1,deltaX-box.xOffset)+"px";} if(xy.y>startY){this.zoomBox.style.height=Math.max(1,deltaY-box.yOffset)+"px";}}},endBox:function(end){var result;if(Math.abs(this.dragHandler.start.x-end.x)>5||Math.abs(this.dragHandler.start.y-end.y)>5){var start=this.dragHandler.start;var top=Math.min(start.y,end.y);var bottom=Math.max(start.y,end.y);var left=Math.min(start.x,end.x);var right=Math.max(start.x,end.x);result=new OpenLayers.Bounds(left,bottom,right,top);}else{result=this.dragHandler.start.clone();} -this.removeBox();this.map.div.style.cursor="";this.callback("done",[result]);},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null;this.boxCharacteristics=null;},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragHandler.activate();return true;}else{return false;}},deactivate:function(){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.dragHandler.deactivate();return true;}else{return false;}},getBoxCharacteristics:function(dx,dy){if(!this.boxCharacteristics){var xOffset=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width"))+1;var yOffset=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"))+1;var newBoxModel=OpenLayers.Util.getBrowserName()=="msie"?document.compatMode!="BackCompat":true;this.boxCharacteristics={xOffset:xOffset,yOffset:yOffset,newBoxModel:newBoxModel};} +this.removeBox();this.callback("done",[result]);},removeBox:function(){this.map.viewPortDiv.removeChild(this.zoomBox);this.zoomBox=null;this.boxCharacteristics=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,"olDrawBox");},activate:function(){if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){this.dragHandler.activate();return true;}else{return false;}},deactivate:function(){if(OpenLayers.Handler.prototype.deactivate.apply(this,arguments)){this.dragHandler.deactivate();return true;}else{return false;}},getBoxCharacteristics:function(){if(!this.boxCharacteristics){var xOffset=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-left-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-right-width"))+1;var yOffset=parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-top-width"))+parseInt(OpenLayers.Element.getStyle(this.zoomBox,"border-bottom-width"))+1;var newBoxModel=OpenLayers.Util.getBrowserName()=="msie"?document.compatMode!="BackCompat":true;this.boxCharacteristics={xOffset:xOffset,yOffset:yOffset,newBoxModel:newBoxModel};} return this.boxCharacteristics;},CLASS_NAME:"OpenLayers.Handler.Box"});OpenLayers.Handler.RegularPolygon=OpenLayers.Class(OpenLayers.Handler.Drag,{sides:4,radius:null,snapAngle:null,snapToggle:'shiftKey',persist:false,irregular:false,angle:null,fixedRadius:false,feature:null,layer:null,origin:null,initialize:function(control,callbacks,options){this.style=OpenLayers.Util.extend(OpenLayers.Feature.Vector.style['default'],{});OpenLayers.Handler.prototype.initialize.apply(this,[control,callbacks,options]);this.options=(options)?options:new Object();},setOptions:function(newOptions){OpenLayers.Util.extend(this.options,newOptions);OpenLayers.Util.extend(this,newOptions);},activate:function(){var activated=false;if(OpenLayers.Handler.prototype.activate.apply(this,arguments)){var options={displayInLayerSwitcher:false,calculateInRange:function(){return true;}};this.layer=new OpenLayers.Layer.Vector(this.CLASS_NAME,options);this.map.addLayer(this.layer);activated=true;} return activated;},deactivate:function(){var deactivated=false;if(OpenLayers.Handler.Drag.prototype.deactivate.apply(this,arguments)){if(this.dragging){this.cancel();} if(this.layer.map!=null){this.layer.destroy(false);if(this.feature){this.feature.destroy();}} this.layer=null;this.feature=null;deactivated=true;} return deactivated;},down:function(evt){this.fixedRadius=!!(this.radius);var maploc=this.map.getLonLatFromPixel(evt.xy);this.origin=new OpenLayers.Geometry.Point(maploc.lon,maploc.lat);if(!this.fixedRadius||this.irregular){this.radius=this.map.getResolution();} if(this.persist){this.clear();} -this.feature=new OpenLayers.Feature.Vector();this.createGeometry();this.layer.addFeatures([this.feature],{silent:true});this.layer.drawFeature(this.feature,this.style);},move:function(evt){var maploc=this.map.getLonLatFromPixel(evt.xy);var point=new OpenLayers.Geometry.Point(maploc.lon,maploc.lat);if(this.irregular){var ry=Math.sqrt(2)*Math.abs(point.y-this.origin.y)/2;this.radius=Math.max(this.map.getResolution()/2,ry);}else if(this.fixedRadius){this.origin=point;}else{this.calculateAngle(point,evt);this.radius=Math.max(this.map.getResolution()/2,point.distanceTo(this.origin));} +this.feature=new OpenLayers.Feature.Vector();this.createGeometry();this.callback("create",[this.origin,this.feature]);this.layer.addFeatures([this.feature],{silent:true});this.layer.drawFeature(this.feature,this.style);},move:function(evt){var maploc=this.map.getLonLatFromPixel(evt.xy);var point=new OpenLayers.Geometry.Point(maploc.lon,maploc.lat);if(this.irregular){var ry=Math.sqrt(2)*Math.abs(point.y-this.origin.y)/2;this.radius=Math.max(this.map.getResolution()/2,ry);}else if(this.fixedRadius){this.origin=point;}else{this.calculateAngle(point,evt);this.radius=Math.max(this.map.getResolution()/2,point.distanceTo(this.origin));} this.modifyGeometry();if(this.irregular){var dx=point.x-this.origin.x;var dy=point.y-this.origin.y;var ratio;if(dy==0){ratio=dx/(this.radius*Math.sqrt(2));}else{ratio=dx/dy;} this.feature.geometry.resize(1,this.origin,ratio);this.feature.geometry.move(dx/2,dy/2);} -this.layer.drawFeature(this.feature,this.style);},up:function(evt){this.finalize();},out:function(evt){this.finalize();},createGeometry:function(){this.angle=Math.PI*((1/this.sides)-(1/2));if(this.snapAngle){this.angle+=this.snapAngle*(Math.PI/180);} +this.layer.drawFeature(this.feature,this.style);},up:function(evt){this.finalize();if(this.start==this.last){this.callback("done",[evt.xy]);}},out:function(evt){this.finalize();},createGeometry:function(){this.angle=Math.PI*((1/this.sides)-(1/2));if(this.snapAngle){this.angle+=this.snapAngle*(Math.PI/180);} this.feature.geometry=OpenLayers.Geometry.Polygon.createRegularPolygon(this.origin,this.radius,this.sides,this.snapAngle);},modifyGeometry:function(){var angle,dx,dy,point;var ring=this.feature.geometry.components[0];if(ring.components.length!=(this.sides+1)){this.createGeometry();ring=this.feature.geometry.components[0];} for(var i=0;i0){this.removeMarker(this.markers[0]);}}},drawMarker:function(marker){var px=this.map.getLayerPxFromLonLat(marker.lonlat);if(px==null){marker.display(false);}else{var markerImg=marker.draw(px);if(!marker.drawn){this.div.appendChild(markerImg);marker.drawn=true;}}},getDataExtent:function(){var maxExtent=null;if(this.markers&&(this.markers.length>0)){var maxExtent=new OpenLayers.Bounds();for(var i=0,len=this.markers.length;i0){this.removeMarker(this.markers[0]);}}},drawMarker:function(marker){var px=this.map.getLayerPxFromLonLat(marker.lonlat);if(px==null){marker.display(false);}else{if(!marker.isDrawn()){var markerImg=marker.draw(px);this.div.appendChild(markerImg);}else if(marker.icon){marker.icon.moveTo(px);}}},getDataExtent:function(){var maxExtent=null;if(this.markers&&(this.markers.length>0)){var maxExtent=new OpenLayers.Bounds();for(var i=0,len=this.markers.length;i=0;--i){feature=this.layer.selectedFeatures[i];if(!options||options.except!=feature){this.unselect(feature);}}},clickFeature:function(feature){if(!this.hover){var selected=(OpenLayers.Util.indexOf(this.layer.selectedFeatures,feature)>-1);if(selected){if(this.toggleSelect()){this.unselect(feature);}else if(!this.multipleSelect()){this.unselectAll({except:feature});}}else{if(!this.multipleSelect()){this.unselectAll({except:feature});} -this.select(feature);}}},multipleSelect:function(){return this.multiple||this.handlers.feature.evt[this.multipleKey];},toggleSelect:function(){return this.toggle||this.handlers.feature.evt[this.toggleKey];},clickoutFeature:function(feature){if(!this.hover&&this.clickout){this.unselectAll();}},overFeature:function(feature){if(this.hover&&(OpenLayers.Util.indexOf(this.layer.selectedFeatures,feature)==-1)){this.select(feature);}},outFeature:function(feature){if(this.hover){this.unselect(feature);}},select:function(feature){var cont=this.layer.events.triggerEvent("beforefeatureselected",{feature:feature});if(cont!==false){this.layer.selectedFeatures.push(feature);var selectStyle=this.selectStyle||this.renderIntent;this.layer.drawFeature(feature,selectStyle);this.layer.events.triggerEvent("featureselected",{feature:feature});this.onSelect(feature);}},unselect:function(feature){this.layer.drawFeature(feature,"default");OpenLayers.Util.removeItem(this.layer.selectedFeatures,feature);this.layer.events.triggerEvent("featureunselected",{feature:feature});this.onUnselect(feature);},selectBox:function(position){if(position instanceof OpenLayers.Bounds){var minXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.left,position.bottom));var maxXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.right,position.top));var bounds=new OpenLayers.Bounds(minXY.lon,minXY.lat,maxXY.lon,maxXY.lat);if(!this.multipleSelect()){this.unselectAll();} -var prevMultiple=this.multiple;this.multiple=true;for(var i=0,len=this.layer.features.length;i-1){if(bounds.toGeometry().intersects(feature.geometry)){if(OpenLayers.Util.indexOf(this.layer.selectedFeatures,feature)==-1){this.select(feature);}}}} -this.multiple=prevMultiple;}},setMap:function(map){this.handlers.feature.setMap(map);if(this.box){this.handlers.box.setMap(map);} -OpenLayers.Control.prototype.setMap.apply(this,arguments);},CLASS_NAME:"OpenLayers.Control.SelectFeature"});OpenLayers.Control.ZoomBox=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,out:false,draw:function(){this.handler=new OpenLayers.Handler.Box(this,{done:this.zoomBox},{keyMask:this.keyMask});},zoomBox:function(position){if(position instanceof OpenLayers.Bounds){if(!this.out){var minXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.left,position.bottom));var maxXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.right,position.top));var bounds=new OpenLayers.Bounds(minXY.lon,minXY.lat,maxXY.lon,maxXY.lat);}else{var pixWidth=Math.abs(position.right-position.left);var pixHeight=Math.abs(position.top-position.bottom);var zoomFactor=Math.min((this.map.size.h/pixHeight),(this.map.size.w/pixWidth));var extent=this.map.getExtent();var center=this.map.getLonLatFromPixel(position.getCenterPixel());var xmin=center.lon-(extent.getWidth()/2)*zoomFactor;var xmax=center.lon+(extent.getWidth()/2)*zoomFactor;var ymin=center.lat-(extent.getHeight()/2)*zoomFactor;var ymax=center.lat+(extent.getHeight()/2)*zoomFactor;var bounds=new OpenLayers.Bounds(xmin,ymin,xmax,ymax);} -this.map.zoomToExtent(bounds);}else{if(!this.out){this.map.setCenter(this.map.getLonLatFromPixel(position),this.map.getZoom()+1);}else{this.map.setCenter(this.map.getLonLatFromPixel(position),this.map.getZoom()-1);}}},CLASS_NAME:"OpenLayers.Control.ZoomBox"});OpenLayers.Format.WKT=OpenLayers.Class(OpenLayers.Format,{initialize:function(options){this.regExes={'typeStr':/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,'spaces':/\s+/,'parenComma':/\)\s*,\s*\(/,'doubleParenComma':/\)\s*\)\s*,\s*\(\s*\(/,'trimParens':/^\s*\(?(.*?)\)?\s*$/};OpenLayers.Format.prototype.initialize.apply(this,[options]);},read:function(wkt){var features,type,str;var matches=this.regExes.typeStr.exec(wkt);if(matches){type=matches[1].toLowerCase();str=matches[2];if(this.parse[type]){features=this.parse[type].apply(this,[str]);} +this.units="m";this.projection="EPSG:900913";},forwardMercator:function(lon,lat){var x=lon*20037508.34/180;var y=Math.log(Math.tan((90+lat)*Math.PI/360))/(Math.PI/180);y=y*20037508.34/180;return new OpenLayers.LonLat(x,y);},inverseMercator:function(x,y){var lon=(x/20037508.34)*180;var lat=(y/20037508.34)*180;lat=180/Math.PI*(2*Math.atan(Math.exp(lat*Math.PI/180))-Math.PI/2);return new OpenLayers.LonLat(lon,lat);},projectForward:function(point){var lonlat=OpenLayers.Layer.SphericalMercator.forwardMercator(point.x,point.y);point.x=lonlat.lon;point.y=lonlat.lat;return point;},projectInverse:function(point){var lonlat=OpenLayers.Layer.SphericalMercator.inverseMercator(point.x,point.y);point.x=lonlat.lon;point.y=lonlat.lat;return point;}};OpenLayers.Projection.addTransform("EPSG:4326","EPSG:900913",OpenLayers.Layer.SphericalMercator.projectForward);OpenLayers.Projection.addTransform("EPSG:900913","EPSG:4326",OpenLayers.Layer.SphericalMercator.projectInverse);OpenLayers.Control.DrawFeature=OpenLayers.Class(OpenLayers.Control,{layer:null,callbacks:null,EVENT_TYPES:["featureadded"],featureAdded:function(){},handlerOptions:null,initialize:function(layer,handler,options){this.EVENT_TYPES=OpenLayers.Control.DrawFeature.prototype.EVENT_TYPES.concat(OpenLayers.Control.prototype.EVENT_TYPES);OpenLayers.Control.prototype.initialize.apply(this,[options]);this.callbacks=OpenLayers.Util.extend({done:this.drawFeature,modify:function(vertex,feature){this.layer.events.triggerEvent("sketchmodified",{vertex:vertex,feature:feature});},create:function(vertex,feature){this.layer.events.triggerEvent("sketchstarted",{vertex:vertex,feature:feature});}},this.callbacks);this.layer=layer;var sketchStyle=this.layer.styleMap&&this.layer.styleMap.styles.temporary;if(sketchStyle){this.handlerOptions=this.handlerOptions||{};this.handlerOptions.layerOptions=OpenLayers.Util.applyDefaults(this.handlerOptions.layerOptions,{styleMap:new OpenLayers.StyleMap({"default":sketchStyle})});} +this.handler=new handler(this,this.callbacks,this.handlerOptions);},drawFeature:function(geometry){var feature=new OpenLayers.Feature.Vector(geometry);var proceed=this.layer.events.triggerEvent("sketchcomplete",{feature:feature});if(proceed!==false){feature.state=OpenLayers.State.INSERT;this.layer.addFeatures([feature]);this.featureAdded(feature);this.events.triggerEvent("featureadded",{feature:feature});}},CLASS_NAME:"OpenLayers.Control.DrawFeature"});OpenLayers.Control.ZoomBox=OpenLayers.Class(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,out:false,alwaysZoom:false,draw:function(){this.handler=new OpenLayers.Handler.Box(this,{done:this.zoomBox},{keyMask:this.keyMask});},zoomBox:function(position){if(position instanceof OpenLayers.Bounds){if(!this.out){var minXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.left,position.bottom));var maxXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.right,position.top));var bounds=new OpenLayers.Bounds(minXY.lon,minXY.lat,maxXY.lon,maxXY.lat);}else{var pixWidth=Math.abs(position.right-position.left);var pixHeight=Math.abs(position.top-position.bottom);var zoomFactor=Math.min((this.map.size.h/pixHeight),(this.map.size.w/pixWidth));var extent=this.map.getExtent();var center=this.map.getLonLatFromPixel(position.getCenterPixel());var xmin=center.lon-(extent.getWidth()/2)*zoomFactor;var xmax=center.lon+(extent.getWidth()/2)*zoomFactor;var ymin=center.lat-(extent.getHeight()/2)*zoomFactor;var ymax=center.lat+(extent.getHeight()/2)*zoomFactor;var bounds=new OpenLayers.Bounds(xmin,ymin,xmax,ymax);} +var lastZoom=this.map.getZoom();this.map.zoomToExtent(bounds);if(lastZoom==this.map.getZoom()&&this.alwaysZoom==true){this.map.zoomTo(lastZoom+(this.out?-1:1));}}else{if(!this.out){this.map.setCenter(this.map.getLonLatFromPixel(position),this.map.getZoom()+1);}else{this.map.setCenter(this.map.getLonLatFromPixel(position),this.map.getZoom()-1);}}},CLASS_NAME:"OpenLayers.Control.ZoomBox"});OpenLayers.Format.WKT=OpenLayers.Class(OpenLayers.Format,{initialize:function(options){this.regExes={'typeStr':/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,'spaces':/\s+/,'parenComma':/\)\s*,\s*\(/,'doubleParenComma':/\)\s*\)\s*,\s*\(\s*\(/,'trimParens':/^\s*\(?(.*?)\)?\s*$/};OpenLayers.Format.prototype.initialize.apply(this,[options]);},read:function(wkt){var features,type,str;var matches=this.regExes.typeStr.exec(wkt);if(matches){type=matches[1].toLowerCase();str=matches[2];if(this.parse[type]){features=this.parse[type].apply(this,[str]);} if(this.internalProjection&&this.externalProjection){if(features&&features.CLASS_NAME=="OpenLayers.Feature.Vector"){features.geometry.transform(this.externalProjection,this.internalProjection);}else if(features&&type!="geometrycollection"&&typeof features=="object"){for(var i=0,len=features.length;i=bounds.bottom-tilelat*this.buffer)||rowidx=bounds.bottom-tilelat*this.buffer)||rowidx=0)&&(testCell=0)){tile=this.grid[testRow][testCell];} if((tile!=null)&&(!tile.queued)){tileQueue.unshift(tile);tile.queued=true;directionsTried=0;iRow=testRow;iCell=testCell;}else{direction=(direction+1)%4;directionsTried++;}} for(var i=0,len=tileQueue.length;irows){var row=this.grid.pop();for(var i=0,l=row.length;icolumns){for(var i=0,l=this.grid.length;i0){appliedRules=true;for(var i=0,len=elseRules.length;i0&&appliedRules==false){style.display="none";}else{style.display="";} -return style;},applySymbolizer:function(rule,style,feature){var symbolizerPrefix=feature.geometry?this.getSymbolizerPrefix(feature.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0];var symbolizer=rule.symbolizer[symbolizerPrefix]||rule.symbolizer;return this.createLiterals(OpenLayers.Util.extend(style,symbolizer),feature);},createLiterals:function(style,feature){var context=this.context||feature.attributes||feature.data;for(var i in this.propertyStyles){style[i]=OpenLayers.Style.createLiteral(style[i],context,feature);} -return style;},findPropertyStyles:function(){var propertyStyles={};var style=this.defaultStyle;this.addPropertyStyles(propertyStyles,style);var rules=this.rules;var symbolizer,value;for(var i=0,len=rules.length;i0&&appliedRules==false){style.display="none";} +return style;},applySymbolizer:function(rule,style,feature){var symbolizerPrefix=feature.geometry?this.getSymbolizerPrefix(feature.geometry):OpenLayers.Style.SYMBOLIZER_PREFIXES[0];var symbolizer=rule.symbolizer[symbolizerPrefix]||rule.symbolizer;if(this.defaultsPerSymbolizer===true){var defaults=this.defaultStyle;OpenLayers.Util.applyDefaults(symbolizer,{pointRadius:defaults.pointRadius});if(symbolizer.stroke===true||symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{strokeWidth:defaults.strokeWidth,strokeColor:defaults.strokeColor,strokeOpacity:defaults.strokeOpacity,strokeDashstyle:defaults.strokeDashstyle,strokeLinecap:defaults.strokeLinecap});} +if(symbolizer.fill===true||symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{fillColor:defaults.fillColor,fillOpacity:defaults.fillOpacity});} +if(symbolizer.graphic===true){OpenLayers.Util.applyDefaults(symbolizer,{pointRadius:this.defaultStyle.pointRadius,externalGraphic:this.defaultStyle.externalGraphic,graphicName:this.defaultStyle.graphicName,graphicOpacity:this.defaultStyle.graphicOpacity,graphicWidth:this.defaultStyle.graphicWidth,graphicHeight:this.defaultStyle.graphicHeight,graphicXOffset:this.defaultStyle.graphicXOffset,graphicYOffset:this.defaultStyle.graphicYOffset});}} +return this.createLiterals(OpenLayers.Util.extend(style,symbolizer),feature);},createLiterals:function(style,feature){var context=this.context||feature.attributes||feature.data;for(var i in this.propertyStyles){style[i]=OpenLayers.Style.createLiteral(style[i],context,feature);} +return style;},findPropertyStyles:function(){var propertyStyles={};var style=this.defaultStyle;this.addPropertyStyles(propertyStyles,style);var rules=this.rules;var symbolizer,value;for(var i=0,len=rules.length;i=0&&along1<=1&&along2>=0&&along2<=1){if(!point){intersection=true;}else{var x=seg1.x1+(along1*x12_11);var y=seg1.y1+(along1*y12_11);intersection=new OpenLayers.Geometry.Point(x,y);}}} -return intersection;};OpenLayers.Layer.TMS=OpenLayers.Class(OpenLayers.Layer.Grid,{serviceVersion:"1.0.0",isBaseLayer:true,tileOrigin:null,initialize:function(name,url,options){var newArguments=[];newArguments.push(name,url,{},options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.TMS(this.name,this.url,this.options);} -obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getURL:function(bounds){bounds=this.adjustBounds(bounds);var res=this.map.getResolution();var x=Math.round((bounds.left-this.tileOrigin.lon)/(res*this.tileSize.w));var y=Math.round((bounds.bottom-this.tileOrigin.lat)/(res*this.tileSize.h));var z=this.map.getZoom();var path=this.serviceVersion+"/"+this.layername+"/"+z+"/"+x+"/"+y+"."+this.type;var url=this.url;if(url instanceof Array){url=this.selectUrl(path,url);} -return url+path;},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},setMap:function(map){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);if(!this.tileOrigin){this.tileOrigin=new OpenLayers.LonLat(this.map.maxExtent.left,this.map.maxExtent.bottom);}},CLASS_NAME:"OpenLayers.Layer.TMS"});OpenLayers.Rule=OpenLayers.Class({id:null,name:'default',title:null,description:null,context:null,filter:null,elseFilter:false,symbolizer:null,minScaleDenominator:null,maxScaleDenominator:null,initialize:function(options){this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");this.symbolizer={};OpenLayers.Util.extend(this,options);},destroy:function(){for(var i in this.symbolizer){this.symbolizer[i]=null;} +return this.bounds;},calculateBounds:function(){},distanceTo:function(geometry,options){},getVertices:function(nodes){},atPoint:function(lonlat,toleranceLon,toleranceLat){var atPoint=false;var bounds=this.getBounds();if((bounds!=null)&&(lonlat!=null)){var dX=(toleranceLon!=null)?toleranceLon:0;var dY=(toleranceLat!=null)?toleranceLat:0;var toleranceBounds=new OpenLayers.Bounds(this.bounds.left-dX,this.bounds.bottom-dY,this.bounds.right+dX,this.bounds.top+dY);atPoint=toleranceBounds.containsLonLat(lonlat);} +return atPoint;},getLength:function(){return 0.0;},getArea:function(){return 0.0;},getCentroid:function(){return null;},toString:function(){return OpenLayers.Format.WKT.prototype.write(new OpenLayers.Feature.Vector(this));},CLASS_NAME:"OpenLayers.Geometry"});OpenLayers.Geometry.fromWKT=function(wkt){var format=arguments.callee.format;if(!format){format=new OpenLayers.Format.WKT();arguments.callee.format=format;} +var geom;var result=format.read(wkt);if(result instanceof OpenLayers.Feature.Vector){geom=result.geometry;}else if(result instanceof Array){var len=result.length;var components=new Array(len);for(var i=0;i=0&&along1<=1&&along2>=0&&along2<=1){if(!point){intersection=true;}else{var x=seg1.x1+(along1*x12_11);var y=seg1.y1+(along1*y12_11);intersection=new OpenLayers.Geometry.Point(x,y);}}} +if(tolerance){var dist;if(intersection){if(point){var segs=[seg1,seg2];var seg,x,y;outer:for(var i=0;i<2;++i){seg=segs[i];for(var j=1;j<3;++j){x=seg["x"+j];y=seg["y"+j];dist=Math.sqrt(Math.pow(x-intersection.x,2)+ +Math.pow(y-intersection.y,2));if(dist=1.0){x=x2;y=y2;}else{x=x1+along*dx;y=y1+along*dy;} +return{distance:Math.sqrt(Math.pow(x-x0,2)+Math.pow(y-y0,2)),x:x,y:y};};OpenLayers.Layer.TMS=OpenLayers.Class(OpenLayers.Layer.Grid,{serviceVersion:"1.0.0",isBaseLayer:true,tileOrigin:null,serverResolutions:null,initialize:function(name,url,options){var newArguments=[];newArguments.push(name,url,{},options);OpenLayers.Layer.Grid.prototype.initialize.apply(this,newArguments);},destroy:function(){OpenLayers.Layer.Grid.prototype.destroy.apply(this,arguments);},clone:function(obj){if(obj==null){obj=new OpenLayers.Layer.TMS(this.name,this.url,this.options);} +obj=OpenLayers.Layer.Grid.prototype.clone.apply(this,[obj]);return obj;},getURL:function(bounds){bounds=this.adjustBounds(bounds);var res=this.map.getResolution();var x=Math.round((bounds.left-this.tileOrigin.lon)/(res*this.tileSize.w));var y=Math.round((bounds.bottom-this.tileOrigin.lat)/(res*this.tileSize.h));var z=this.serverResolutions!=null?OpenLayers.Util.indexOf(this.serverResolutions,res):this.map.getZoom();var path=this.serviceVersion+"/"+this.layername+"/"+z+"/"+x+"/"+y+"."+this.type;var url=this.url;if(url instanceof Array){url=this.selectUrl(path,url);} +return url+path;},addTile:function(bounds,position){return new OpenLayers.Tile.Image(this,position,bounds,null,this.tileSize);},setMap:function(map){OpenLayers.Layer.Grid.prototype.setMap.apply(this,arguments);if(!this.tileOrigin){this.tileOrigin=new OpenLayers.LonLat(this.map.maxExtent.left,this.map.maxExtent.bottom);}},CLASS_NAME:"OpenLayers.Layer.TMS"});OpenLayers.Rule=OpenLayers.Class({id:null,name:'default',title:null,description:null,context:null,filter:null,elseFilter:false,symbolizer:null,minScaleDenominator:null,maxScaleDenominator:null,initialize:function(options){this.symbolizer={};OpenLayers.Util.extend(this,options);this.id=OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");},destroy:function(){for(var i in this.symbolizer){this.symbolizer[i]=null;} this.symbolizer=null;},evaluate:function(feature){var context=this.getContext(feature);var applies=true;if(this.minScaleDenominator||this.maxScaleDenominator){var scale=feature.layer.map.getScale();} if(this.minScaleDenominator){applies=scale>=OpenLayers.Style.createLiteral(this.minScaleDenominator,context);} if(applies&&this.maxScaleDenominator){applies=scale=0;--i){this.removeComponent(components[i]);}},removeComponent:function(component){OpenLayers.Util.removeItem(this.components,component);this.clearBounds();},getLength:function(){var length=0.0;for(var i=0,len=this.components.length;i=0;i--){if(i!=0&&features[i-1].geometry){this.renderer.locked=true;}else{this.renderer.locked=false;} var feature=features[i];delete this.unrenderedFeatures[feature.id];if(notify){this.events.triggerEvent("beforefeatureremoved",{feature:feature});} -this.features=OpenLayers.Util.removeItem(this.features,feature);feature.layer=null;if(feature.geometry){this.renderer.eraseGeometry(feature.geometry);} +this.features=OpenLayers.Util.removeItem(this.features,feature);feature.layer=null;if(feature.geometry){this.renderer.eraseFeatures(feature);} if(OpenLayers.Util.indexOf(this.selectedFeatures,feature)!=-1){OpenLayers.Util.removeItem(this.selectedFeatures,feature);} if(notify){this.events.triggerEvent("featureremoved",{feature:feature});}} if(notify){this.events.triggerEvent("featuresremoved",{features:features});}},destroyFeatures:function(features,options){var all=(features==undefined);if(all){features=this.features;} -if(features){this.removeFeatures(features,options);for(var i=features.length-1;i>=0;i--){features[i].destroy();}}},drawFeature:function(feature,style){if(typeof style!="object"){var renderIntent=typeof style=="string"?style:feature.renderIntent;style=feature.style||this.style;if(!style){style=this.styleMap.createSymbolizer(feature,renderIntent);}} +if(features){this.removeFeatures(features,options);for(var i=features.length-1;i>=0;i--){features[i].destroy();}}},drawFeature:function(feature,style){if(!this.drawn){return} +if(typeof style!="object"){if(!style&&feature.state===OpenLayers.State.DELETE){style="delete";} +var renderIntent=style||feature.renderIntent;style=feature.style||this.style;if(!style){style=this.styleMap.createSymbolizer(feature,renderIntent);}} if(!this.renderer.drawFeature(feature,style)){this.unrenderedFeatures[feature.id]=feature;}else{delete this.unrenderedFeatures[feature.id];};},eraseFeatures:function(features){this.renderer.eraseFeatures(features);},getFeatureFromEvent:function(evt){if(!this.renderer){OpenLayers.Console.error(OpenLayers.i18n("getFeatureError"));return null;} var featureId=this.renderer.getFeatureIdFromEvent(evt);return this.getFeatureById(featureId);},getFeatureById:function(featureId){var feature=null;for(var i=0,len=this.features.length;i0)){var maxExtent=this.features[0].geometry.getBounds();for(var i=0,len=this.features.length;i0)){area+=Math.abs(this.components[0].getArea());for(var i=1,len=this.components.length;i0){contained=this.components[0].containsPoint(point);if(contained!==1){if(contained&&numRings>1){var hole;for(var i=1;i0)){maxExtent=new OpenLayers.Bounds();for(var i=0,len=this.features.length;i1)){for(var i=1,len=this.components.length;i2)){OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);}},intersects:function(geometry){var intersect=false;var type=geometry.CLASS_NAME;if(type=="OpenLayers.Geometry.LineString"||type=="OpenLayers.Geometry.LinearRing"||type=="OpenLayers.Geometry.Point"){var segs1=this.getSortedSegments();var segs2;if(type=="OpenLayers.Geometry.Point"){segs2=[{x1:geometry.x,y1:geometry.y,x2:geometry.x,y2:geometry.y}];}else{segs2=geometry.getSortedSegments();} +var gml=this.format?new this.format(options):new OpenLayers.Format.GML(options);this.addFeatures(gml.read(doc));this.events.triggerEvent("loadend");},requestFailure:function(request){OpenLayers.Console.userError(OpenLayers.i18n("errorLoadingGML",{'url':this.url}));this.events.triggerEvent("loadend");},CLASS_NAME:"OpenLayers.Layer.GML"});OpenLayers.Layer.Vector.RootContainer=OpenLayers.Class(OpenLayers.Layer.Vector,{displayInLayerSwitcher:false,layers:null,initialize:function(name,options){OpenLayers.Layer.Vector.prototype.initialize.apply(this,arguments);},display:function(){},getFeatureFromEvent:function(evt){var layers=this.layers;var feature;for(var i=0;i=0;--i){feature=layer.selectedFeatures[i];if(!options||options.except!=feature){this.unselect(feature);}}}},clickFeature:function(feature){if(!this.hover){var selected=(OpenLayers.Util.indexOf(feature.layer.selectedFeatures,feature)>-1);if(selected){if(this.toggleSelect()){this.unselect(feature);}else if(!this.multipleSelect()){this.unselectAll({except:feature});}}else{if(!this.multipleSelect()){this.unselectAll({except:feature});} +this.select(feature);}}},multipleSelect:function(){return this.multiple||(this.handlers.feature.evt&&this.handlers.feature.evt[this.multipleKey]);},toggleSelect:function(){return this.toggle||(this.handlers.feature.evt&&this.handlers.feature.evt[this.toggleKey]);},clickoutFeature:function(feature){if(!this.hover&&this.clickout){this.unselectAll();}},overFeature:function(feature){var layer=feature.layer;if(this.hover){if(this.highlightOnly){this.highlight(feature);}else if(OpenLayers.Util.indexOf(layer.selectedFeatures,feature)==-1){this.select(feature);}}},outFeature:function(feature){if(this.hover){if(this.highlightOnly){if(feature._lastHighlighter==this.id){if(feature._prevHighlighter&&feature._prevHighlighter!=this.id){delete feature._lastHighlighter;var control=this.map.getControl(feature._prevHighlighter);if(control){control.highlight(feature);}}else{this.unhighlight(feature);}}}else{this.unselect(feature);}}},highlight:function(feature){var layer=feature.layer;var cont=this.events.triggerEvent("beforefeaturehighlighted",{feature:feature});if(cont!==false){feature._prevHighlighter=feature._lastHighlighter;feature._lastHighlighter=this.id;var style=this.selectStyle||this.renderIntent;layer.drawFeature(feature,style);this.events.triggerEvent("featurehighlighted",{feature:feature});}},unhighlight:function(feature){var layer=feature.layer;feature._lastHighlighter=feature._prevHighlighter;delete feature._prevHighlighter;layer.drawFeature(feature,feature.style||feature.layer.style||"default");this.events.triggerEvent("featureunhighlighted",{feature:feature});},select:function(feature){var cont=this.onBeforeSelect.call(this.scope,feature);var layer=feature.layer;if(cont!==false){cont=layer.events.triggerEvent("beforefeatureselected",{feature:feature});if(cont!==false){layer.selectedFeatures.push(feature);this.highlight(feature);layer.events.triggerEvent("featureselected",{feature:feature});this.onSelect.call(this.scope,feature);}}},unselect:function(feature){var layer=feature.layer;this.unhighlight(feature);OpenLayers.Util.removeItem(layer.selectedFeatures,feature);layer.events.triggerEvent("featureunselected",{feature:feature});this.onUnselect.call(this.scope,feature);},selectBox:function(position){if(position instanceof OpenLayers.Bounds){var minXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.left,position.bottom));var maxXY=this.map.getLonLatFromPixel(new OpenLayers.Pixel(position.right,position.top));var bounds=new OpenLayers.Bounds(minXY.lon,minXY.lat,maxXY.lon,maxXY.lat);if(!this.multipleSelect()){this.unselectAll();} +var prevMultiple=this.multiple;this.multiple=true;var layers=this.layers||[this.layer];var layer;for(var l=0;l-1){if(bounds.toGeometry().intersects(feature.geometry)){if(OpenLayers.Util.indexOf(layer.selectedFeatures,feature)==-1){this.select(feature);}}}}} +this.multiple=prevMultiple;}},setMap:function(map){this.handlers.feature.setMap(map);if(this.box){this.handlers.box.setMap(map);} +OpenLayers.Control.prototype.setMap.apply(this,arguments);},CLASS_NAME:"OpenLayers.Control.SelectFeature"});OpenLayers.Geometry.Curve=OpenLayers.Class(OpenLayers.Geometry.MultiPoint,{componentTypes:["OpenLayers.Geometry.Point"],initialize:function(points){OpenLayers.Geometry.MultiPoint.prototype.initialize.apply(this,arguments);},getLength:function(){var length=0.0;if(this.components&&(this.components.length>1)){for(var i=1,len=this.components.length;i1)){var p1,p2;for(var i=1,len=geom.components.length;i2)){OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);}},intersects:function(geometry){var intersect=false;var type=geometry.CLASS_NAME;if(type=="OpenLayers.Geometry.LineString"||type=="OpenLayers.Geometry.LinearRing"||type=="OpenLayers.Geometry.Point"){var segs1=this.getSortedSegments();var segs2;if(type=="OpenLayers.Geometry.Point"){segs2=[{x1:geometry.x,y1:geometry.y,x2:geometry.x,y2:geometry.y}];}else{segs2=geometry.getSortedSegments();} var seg1,seg1x1,seg1x2,seg1y1,seg1y2,seg2,seg2y1,seg2y2;outer:for(var i=0,len=segs1.length;iseg1x2){break;} if(seg2.x2Math.max(seg1y1,seg1y2)){continue;} @@ -947,49 +1028,72 @@ if(Math.max(seg2y1,seg2y2)0){var parser=this.parseGeometry[type.toLowerCase()];if(parser){geometry=parser.apply(this,[nodeList[0]]);if(this.internalProjection&&this.externalProjection){geometry.transform(this.externalProjection,this.internalProjection);}}else{OpenLayers.Console.error(OpenLayers.i18n("unsupportedGeometryType",{'geomType':type}));} -break;}} -var attributes;if(this.extractAttributes){attributes=this.parseAttributes(node);} -var feature=new OpenLayers.Feature.Vector(geometry,attributes);feature.gml={featureType:node.firstChild.nodeName.split(":")[1],featureNS:node.firstChild.namespaceURI,featureNSPrefix:node.firstChild.prefix};var childNode=node.firstChild;var fid;while(childNode){if(childNode.nodeType==1){fid=childNode.getAttribute("fid")||childNode.getAttribute("id");if(fid){break;}} -childNode=childNode.nextSibling;} -feature.fid=fid;return feature;},parseGeometry:{point:function(node){var nodeList,coordString;var coords=[];var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"pos");if(nodeList.length>0){coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);} -if(coords.length==0){nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coordinates");if(nodeList.length>0){coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.removeSpace,"");coords=coordString.split(",");}} -if(coords.length==0){nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coord");if(nodeList.length>0){var xList=this.getElementsByTagNameNS(nodeList[0],this.gmlns,"X");var yList=this.getElementsByTagNameNS(nodeList[0],this.gmlns,"Y");if(xList.length>0&&yList.length>0){coords=[xList[0].firstChild.nodeValue,yList[0].firstChild.nodeValue];}}} -if(coords.length==2){coords[2]=null;} -if(this.xy){return new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);} -else{return new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}},multipoint:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"Point");var components=[];if(nodeList.length>0){var point;for(var i=0;i0){coordString=this.concatChildValues(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);var dim=parseInt(nodeList[0].getAttribute("dimension"));var j,x,y,z;for(var i=0;i0){coordString=this.concatChildValues(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coordString=coordString.replace(this.regExes.trimComma,",");var pointList=coordString.split(this.regExes.splitSpace);for(var i=0;i0){var line;for(var i=0;i0){var ring;for(var i=0;i0){var polygon;for(var i=0;i0){var coords=[];if(lpoint.length>0){coordString=lpoint[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);} -if(coords.length==2){coords[2]=null;} -if(this.xy){var lowerPoint=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{var lowerPoint=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}} -var upoint=this.getElementsByTagNameNS(node,this.gmlns,"upperCorner");if(upoint.length>0){var coords=[];if(upoint.length>0){coordString=upoint[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);} -if(coords.length==2){coords[2]=null;} -if(this.xy){var upperPoint=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{var upperPoint=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}} -if(lowerPoint&&upperPoint){components.push(new OpenLayers.Geometry.Point(lowerPoint.x,lowerPoint.y));components.push(new OpenLayers.Geometry.Point(upperPoint.x,lowerPoint.y));components.push(new OpenLayers.Geometry.Point(upperPoint.x,upperPoint.y));components.push(new OpenLayers.Geometry.Point(lowerPoint.x,upperPoint.y));components.push(new OpenLayers.Geometry.Point(lowerPoint.x,lowerPoint.y));var ring=new OpenLayers.Geometry.LinearRing(components);envelope=new OpenLayers.Geometry.Polygon([ring]);} -return envelope;}},parseAttributes:function(node){var attributes={};var childNode=node.firstChild;var children,i,child,grandchildren,grandchild,name,value;while(childNode){if(childNode.nodeType==1){children=childNode.childNodes;for(i=0;i0){var xDir=seg.x10){lines.unshift(j,1);Array.prototype.splice.apply(targetParts,lines);j+=lines.length-2;} +if(mutual){for(var k=0,len=splits.points.length;k0&&points.length>0){points.push(vert2.clone());sourceParts.push(new OpenLayers.Geometry.LineString(points));}}else{results=target.splitWith(this,options);} +if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];} +if(sourceParts&&sourceParts.length>1){sourceSplit=true;}else{sourceParts=[];} +if(targetSplit||sourceSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}} +return results;},splitWith:function(geometry,options){return geometry.split(this,options);},getVertices:function(nodes){var vertices;if(nodes===true){vertices=[this.components[0],this.components[this.components.length-1]];}else if(nodes===false){vertices=this.components.slice(1,this.components.length-1);}else{vertices=this.components.slice();} +return vertices;},distanceTo:function(geometry,options){var edge=!(options&&options.edge===false);var details=edge&&options&&options.details;var result,best={};var min=Number.POSITIVE_INFINITY;if(geometry instanceof OpenLayers.Geometry.Point){var segs=this.getSortedSegments();var x=geometry.x;var y=geometry.y;var seg;for(var i=0,len=segs.length;ix&&((y>seg.y1&&yseg.y2))){break;}}} +if(details){best={distance:best.distance,x0:best.x,y0:best.y,x1:x,y1:y};}else{best=best.distance;}}else if(geometry instanceof OpenLayers.Geometry.LineString){var segs0=this.getSortedSegments();var segs1=geometry.getSortedSegments();var seg0,seg1,intersection,x0,y0;var len1=segs1.length;var interOptions={point:true};outer:for(var i=0,len=segs0.length;i4){this.components.pop();OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);var firstPoint=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[firstPoint]);}},move:function(x,y){for(var i=0,len=this.components.length;i2)){var sumX=0.0;var sumY=0.0;for(var i=0;i2)){var sum=0.0;for(var i=0,len=this.components.length;i2){var p1,p2;for(var i=0;i=x1&&px<=x2)||x1>=x2&&(px<=x1&&px>=x2)){crosses=-1;break;}} +continue;} +cx=approx(getX(py,x1,y1,x2,y2),digs);if(cx==px){if(y1=y1&&py<=y2)||y1>y2&&(py<=y1&&py>=y2)){crosses=-1;break;}} +if(cx<=px){continue;} +if(x1!=x2&&(cxMath.max(x1,x2))){continue;} +if(y1=y1&&pyy2&&(py=y2)){++crosses;}} +var contained=(crosses==-1)?1:!!(crosses&1);return contained;},intersects:function(geometry){var intersect=false;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){intersect=this.containsPoint(geometry);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LineString"){intersect=geometry.intersects(this);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){intersect=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[geometry]);}else{for(var i=0,len=geometry.components.length;i1){sourceSplit=true;}else{sourceParts=[];} +if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];} +if(sourceSplit||targetSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}} +return results;},splitWith:function(geometry,options){var results=null;var mutual=options&&options.mutual;var splits,targetLine,sourceLines,sourceSplit,targetSplit,sourceParts,targetParts;if(geometry instanceof OpenLayers.Geometry.LineString){targetParts=[];sourceParts=[geometry];for(var i=0,len=this.components.length;i1){sourceSplit=true;}else{sourceParts=[];} +if(targetParts&&targetParts.length>1){targetSplit=true;}else{targetParts=[];} +if(sourceSplit||targetSplit){if(mutual){results=[sourceParts,targetParts];}else{results=targetParts;}} +return results;},CLASS_NAME:"OpenLayers.Geometry.MultiLineString"});OpenLayers.Geometry.Polygon=OpenLayers.Class(OpenLayers.Geometry.Collection,{componentTypes:["OpenLayers.Geometry.LinearRing"],initialize:function(components){OpenLayers.Geometry.Collection.prototype.initialize.apply(this,arguments);},getArea:function(){var area=0.0;if(this.components&&(this.components.length>0)){area+=Math.abs(this.components[0].getArea());for(var i=1,len=this.components.length;i0)){area+=Math.abs(this.components[0].getGeodesicArea(projection));for(var i=1,len=this.components.length;i0){contained=this.components[0].containsPoint(point);if(contained!==1){if(contained&&numRings>1){var hole;for(var i=1;i4){this.components.pop();OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,arguments);var firstPoint=this.components[0];OpenLayers.Geometry.Collection.prototype.addComponent.apply(this,[firstPoint]);}},move:function(x,y){for(var i=0,len=this.components.length;i2)){var sum=0.0;for(var i=0,len=this.components.length;i=x1&&px<=x2)||x1>=x2&&(px<=x1&&px>=x2)){crosses=-1;break;}} -continue;} -cx=approx(getX(py,x1,y1,x2,y2),digs);if(cx==px){if(y1=y1&&py<=y2)||y1>y2&&(py<=y1&&py>=y2)){crosses=-1;break;}} -if(cx<=px){continue;} -if(x1!=x2&&(cxMath.max(x1,x2))){continue;} -if(y1=y1&&pyy2&&(py=y2)){++crosses;}} -var contained=(crosses==-1)?1:!!(crosses&1);return contained;},intersects:function(geometry){var intersect=false;if(geometry.CLASS_NAME=="OpenLayers.Geometry.Point"){intersect=this.containsPoint(geometry);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LineString"){intersect=geometry.intersects(this);}else if(geometry.CLASS_NAME=="OpenLayers.Geometry.LinearRing"){intersect=OpenLayers.Geometry.LineString.prototype.intersects.apply(this,[geometry]);}else{for(var i=0,len=geometry.components.length;i0){var parser=this.parseGeometry[type.toLowerCase()];if(parser){geometry=parser.apply(this,[nodeList[0]]);if(this.internalProjection&&this.externalProjection){geometry.transform(this.externalProjection,this.internalProjection);}}else{OpenLayers.Console.error(OpenLayers.i18n("unsupportedGeometryType",{'geomType':type}));} +break;}} +var attributes;if(this.extractAttributes){attributes=this.parseAttributes(node);} +var feature=new OpenLayers.Feature.Vector(geometry,attributes);feature.gml={featureType:node.firstChild.nodeName.split(":")[1],featureNS:node.firstChild.namespaceURI,featureNSPrefix:node.firstChild.prefix};var childNode=node.firstChild;var fid;while(childNode){if(childNode.nodeType==1){fid=childNode.getAttribute("fid")||childNode.getAttribute("id");if(fid){break;}} +childNode=childNode.nextSibling;} +feature.fid=fid;return feature;},parseGeometry:{point:function(node){var nodeList,coordString;var coords=[];var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"pos");if(nodeList.length>0){coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);} +if(coords.length==0){nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coordinates");if(nodeList.length>0){coordString=nodeList[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.removeSpace,"");coords=coordString.split(",");}} +if(coords.length==0){nodeList=this.getElementsByTagNameNS(node,this.gmlns,"coord");if(nodeList.length>0){var xList=this.getElementsByTagNameNS(nodeList[0],this.gmlns,"X");var yList=this.getElementsByTagNameNS(nodeList[0],this.gmlns,"Y");if(xList.length>0&&yList.length>0){coords=[xList[0].firstChild.nodeValue,yList[0].firstChild.nodeValue];}}} +if(coords.length==2){coords[2]=null;} +if(this.xy){return new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);} +else{return new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}},multipoint:function(node){var nodeList=this.getElementsByTagNameNS(node,this.gmlns,"Point");var components=[];if(nodeList.length>0){var point;for(var i=0;i0){coordString=this.getChildValue(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);var dim=parseInt(nodeList[0].getAttribute("dimension"));var j,x,y,z;for(var i=0;i0){coordString=this.getChildValue(nodeList[0]);coordString=coordString.replace(this.regExes.trimSpace,"");coordString=coordString.replace(this.regExes.trimComma,",");var pointList=coordString.split(this.regExes.splitSpace);for(var i=0;i0){var line;for(var i=0;i0){var ring;for(var i=0;i0){var polygon;for(var i=0;i0){var coords=[];if(lpoint.length>0){coordString=lpoint[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);} +if(coords.length==2){coords[2]=null;} +if(this.xy){var lowerPoint=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{var lowerPoint=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}} +var upoint=this.getElementsByTagNameNS(node,this.gmlns,"upperCorner");if(upoint.length>0){var coords=[];if(upoint.length>0){coordString=upoint[0].firstChild.nodeValue;coordString=coordString.replace(this.regExes.trimSpace,"");coords=coordString.split(this.regExes.splitSpace);} +if(coords.length==2){coords[2]=null;} +if(this.xy){var upperPoint=new OpenLayers.Geometry.Point(coords[0],coords[1],coords[2]);}else{var upperPoint=new OpenLayers.Geometry.Point(coords[1],coords[0],coords[2]);}} +if(lowerPoint&&upperPoint){components.push(new OpenLayers.Geometry.Point(lowerPoint.x,lowerPoint.y));components.push(new OpenLayers.Geometry.Point(upperPoint.x,lowerPoint.y));components.push(new OpenLayers.Geometry.Point(upperPoint.x,upperPoint.y));components.push(new OpenLayers.Geometry.Point(lowerPoint.x,upperPoint.y));components.push(new OpenLayers.Geometry.Point(lowerPoint.x,lowerPoint.y));var ring=new OpenLayers.Geometry.LinearRing(components);envelope=new OpenLayers.Geometry.Polygon([ring]);} +return envelope;}},parseAttributes:function(node){var attributes={};var childNode=node.firstChild;var children,i,child,grandchildren,grandchild,name,value;while(childNode){if(childNode.nodeType==1){children=childNode.childNodes;for(i=0;iPx&08mU+MbXgCoSTsN`}XPQEoZClU7tzwY0Ou#KeV!gxJ^4b#!#%-O&2>>-YEf=;z|c#I~iOna<0+=jY=0_44@l z_3_`U6A=+bLqhKC-(_TE=;q?<>gDplA*raI?(ORO`~KhC%=`NJXlQ69A|n3!?b5ho z&CSdJ008y%^~1u!`S|vBb8FMn)3dOr&CSB*gndUBmeyI>gnX^ z=Hl(`?e_HR?(X4@jElCjr0~ElmX(wJ{QJJVt^NJ~kdKYMyR~IwUDc~3X=q`SlaZ^d zr}Xmcl#+y8T2k!BQ~3Dxv9Pc1zcPJ%ajlFi|NZu*p_Gk`f8E^Jf`NDI>EyVrjrjTg zy0@tD@9M9tosyA{YtvT?Ca_A@#gF6>($c4=H}&9 zQ%>RH;ljVMeSCVVsipt_`{>Jd+SbV1z-;^Z@&Et-{rvd;{{677r?91k`1$r-U0V74 z_v!5C>gnhI{`s1lnEwC%`~Ca&_V(xL@2;(*o3S`TqU<@bK{S z^Yi}w{p{=J?Ca*w6r$?ECZ${hgu{Q3X?|LW`I z`uY0S(!~G&{maL>+1AJU`T6wp^ZNSvpMox;p`fa#o7B<4*ww|4kd*N6@6yh}>gww9 z^75LQj={jc>FDOdohTd|7_qXr+uY&q@b2&M@sW|0?CIgq$guza|NsC0?C9Up(b2fL zuZf9;ducG1m6es2l==Di`uOs|rc?R-_vh#2sil|8z@N^}((CHz*wn`B(0=^>`@&)7 ziU0rr32;bRa{vGf6951U69E94oEQKA00(qQO+^RU0TvVkDq2og4FCWEK}keGR4C7F zlCf&TFc^dt3?8M$7!c?SO%h5l*kfsjc5BnETjx$) zJN6`-CbT^ni~qj!A%n<1OW7YC4|{S*SNgYXmLAA4bNU}03F}?&^)NWyhs4mYjWJp? z!ko3*S+A`hG!T0M@eaU0TJL*r!|3d+ZQFI8djM;!g= Date: Thu, 25 Jun 2009 10:43:42 +0000 Subject: [PATCH 17/20] Lakes are already visible on zoom 7, not 8 --- config/key.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/key.yml b/config/key.yml index bd775a18a..69b883c0f 100644 --- a/config/key.yml +++ b/config/key.yml @@ -31,7 +31,7 @@ mapnik: - { min_zoom: 10, max_zoom: 18, name: industrial, image: industrial.png } - { min_zoom: 10, max_zoom: 18, name: commercial, image: commercial.png } - { min_zoom: 10, max_zoom: 18, name: heathland, image: heathland.png } - - { min_zoom: 8, max_zoom: 18, name: lake, image: lake.png } + - { min_zoom: 7, max_zoom: 18, name: lake, image: lake.png } - { min_zoom: 10, max_zoom: 18, name: farm, image: farm.png } - { min_zoom: 10, max_zoom: 18, name: brownfield, image: brownfield.png } - { min_zoom: 11, max_zoom: 18, name: cemetery, image: cemetery.png } From b5e9f8f3a6a81b7ab95f6ffd60e8925384c381f1 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 25 Jun 2009 11:56:25 +0000 Subject: [PATCH 18/20] Correct some interpolation names. --- config/locales/pt-BR.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index e53dd8833..58976f5e7 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -91,9 +91,9 @@ pt-BR: no_bounding_box: "Nenhum limite de área foi armazenado para estas alterações." show_area_box: "Área de exibição" box: "Área" - has_nodes: "Tem os seguintes {{node_count}} pontos:" - has_ways: "Tem os seguintes {{way_count}} caminhos:" - has_relations: "tem as seguintes {{relation_count}} relações:" + has_nodes: "Tem os seguintes {{count}} pontos:" + has_ways: "Tem os seguintes {{count}} caminhos:" + has_relations: "tem as seguintes {{count}} relações:" common_details: edited_at: "Editado em:" edited_by: "Editado por:" @@ -280,7 +280,7 @@ pt-BR: heading: "O usuário {{user}} não existe" body: "Desculpe, não há usuário com o nome {{user}}. Por favor, verifique se digitou corretamente, ou talvez o link que clicou esteja errado." diary_entry: - posted_by: "Postado por {{link_user}} em {{created}} em {{language}}" + posted_by: "Postado por {{link_user}} em {{created}} em {{language_link}}" comment_link: "Comentar nesta entrada" reply_link: "Responder esta entrada" comment_count: @@ -709,7 +709,7 @@ OpenStreetMap em:" settings_link_text: "configurações" your friends: "Seus amigos" no friends: "Você ainda não adicionou amigos." - km away: "{{distance}} km de distância" + km away: "{{count}} km de distância" nearby users: "Usuários próximos: " no nearby users: "Não existem usuários mapeando por perto." change your settings: "mudar suas configurações" From c28cfea4b70c060e433fa6f5f2f6fc10a83f8053 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 25 Jun 2009 12:35:59 +0000 Subject: [PATCH 19/20] Fix some interpolation variables. --- config/locales/es.yml | 2 +- config/locales/ko.yml | 2 +- config/locales/nl.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/locales/es.yml b/config/locales/es.yml index 26ff065b0..1cc6fa404 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -97,7 +97,7 @@ es: in_changeset: "En el conjunto de cambios:" containing_relation: relation: "Relación {{relation_name}}" - relation_as: "(como {{relacion_role}})" + relation_as: "(como {{relation_role}})" map: loading: "Cargando..." deleted: "Borrado" diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 1bb75ac50..5964837f1 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -280,7 +280,7 @@ ko: heading: "The user {{user}} does not exist" body: "Sorry, there is no user with the name {{user}}. Please check your spelling, or maybe the link you clicked is wrong." diary_entry: - posted_by: "Posted by {{link_user}} at {{created}} in {{language}}" + posted_by: "Posted by {{link_user}} at {{created}} in {{language_link}}" comment_link: 이 항목에 댓글 남기기 reply_link: 이 항목에 답변하기 comment_count: diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 87f588f6e..e15e3dff2 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -455,7 +455,7 @@ nl: tags: "Tags:" save_button: "Wijzigingen opslaan" no_such_user: - body: "Sorry, er is geen gebruiker {{name}}. Controleer de spelling, of misschien is de link waarop je klikte verkeerd." + body: "Sorry, er is geen gebruiker {{user}}. Controleer de spelling, of misschien is de link waarop je klikte verkeerd." trace_form: upload_gpx: "Upload GPX-bestand" description: "Beschrijving" From 2ec4555edfc25217c9d45ba40fa3414d929bc24f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 25 Jun 2009 12:48:40 +0000 Subject: [PATCH 20/20] Add a --validate-variables option to check that interpolated Ruby i18n variables (C<{{foo}}> and C<[[foo]]>) are equivalent in the two provided files. Depend on 5.10 because I'm lazy and want to use smart-matching --- script/locale/diff | 56 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/script/locale/diff b/script/locale/diff index 4706bcac1..8ce35ad5c 100755 --- a/script/locale/diff +++ b/script/locale/diff @@ -1,4 +1,5 @@ #!/usr/bin/env perl +use feature ':5.10'; use strict; use warnings; use YAML::Syck qw(Load LoadFile); @@ -24,6 +25,9 @@ locale-diff - Compare two YAML files and print how their datastructures differ # unlikley to be translated diff --untranslated-values-all en.yml is.yml + # Check that interpolated variables ({{var}} and [[var]]) are the same + diff --validate-variables en.yml is.yml + =head1 DESCRIPTION This utility prints the differences between two YAML files using @@ -57,6 +61,11 @@ This helps to find untranslated values. Like C<--untranslated-values> but ignores blacklists. +=item --validate-variables + +Check that interpolated Ruby i18n variables (C<{{foo}}> and +C<[[foo]]>) are equivalent in the two provided files. + =back =head1 AUTHOR @@ -73,10 +82,11 @@ Getopt::Long::Parser->new( 'keys' => \my $keys, 'untranslated-values' => \my $untranslated_values, 'untranslated-values-all' => \my $untranslated_values_all, + 'validate-variables' => \my $validate_variables, ) or help(); # --keys is the default -$keys = 1 if not $untranslated_values_all and not $untranslated_values; +$keys = 1 if not $untranslated_values_all and not $untranslated_values and not $validate_variables; # On --help help() if $help; @@ -92,10 +102,9 @@ my $to_data = LoadFile($to); my $from_parsed = { iterate($from_data->{basename($from)}) }; my $to_parsed = { iterate($to_data->{basename($to)}) }; -# Since this used to be the default, support that... if ($keys) { - print_key_differences(); + print_key_differences($from_parsed, $to_parsed); } elsif ($untranslated_values or $untranslated_values_all) { @@ -106,19 +115,24 @@ elsif ($untranslated_values or $untranslated_values_all) @untranslated = prune_untranslated_with_blacklist(basename($to), @untranslated); } - print $_, "\n" for @untranslated; + say for @untranslated; +} elsif ($validate_variables) +{ + print_validate_variables($from_parsed, $to_parsed); } exit 0; sub print_key_differences { + my ($f, $t) = @_; + # Hack around Test::Differences wanting a Test::* module loaded $INC{"Test.pm"} = 1; sub Test::ok { print shift } # Diff the tree - eq_or_diff([ sort keys %$from_parsed ], [ sort keys %$to_parsed ]); + eq_or_diff([ sort keys %$f ], [ sort keys %$t ]); } sub untranslated_keys @@ -149,6 +163,38 @@ sub prune_untranslated_with_blacklist sort keys %keys; } +sub print_validate_variables +{ + my ($f, $t) = @_; + + while (my ($key, $val) = each %$f) + { + next if exists $f->{$key} and not exists $t->{$key}; + + my @from_var = parse_variables_from_string($f->{$key}); + my @to_var = parse_variables_from_string($t->{$key}); + + unless (@from_var ~~ @to_var) { + say "$key in $from has (@from_var) and $to has (@to_var)"; + } + + } +} + +sub parse_variables_from_string +{ + my ($string) = @_; + + # This probably matches most of the variables + my $var = qr/ [a-z0-9_]+? /xs; + + if (my @var = $string =~ m/ \{\{ ($var) \}\} | \[\[ ($var) \]\] /gsx) { + return sort grep { defined } @var; + } else { + return; + } +} + sub iterate { my ($hash, @path) = @_;