platform 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +21 -0
- data/.rspec +2 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +191 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +5 -0
- data/Rakefile +37 -0
- data/app/assets/images/platform/.gitkeep +0 -0
- data/app/assets/images/platform/accept.png +0 -0
- data/app/assets/images/platform/action_tab_bkgd.gif +0 -0
- data/app/assets/images/platform/action_tab_white_bkgd.gif +0 -0
- data/app/assets/images/platform/add.png +0 -0
- data/app/assets/images/platform/apps/app_icon.gif +0 -0
- data/app/assets/images/platform/apps/app_logo.gif +0 -0
- data/app/assets/images/platform/arrow_down.gif +0 -0
- data/app/assets/images/platform/arrow_down.png +0 -0
- data/app/assets/images/platform/arrow_down_grey.png +0 -0
- data/app/assets/images/platform/arrow_right.gif +0 -0
- data/app/assets/images/platform/arrow_up.png +0 -0
- data/app/assets/images/platform/arrow_up_grey.png +0 -0
- data/app/assets/images/platform/bullet_go.png +0 -0
- data/app/assets/images/platform/buttons.png +0 -0
- data/app/assets/images/platform/cancel.png +0 -0
- data/app/assets/images/platform/clipboard_icon.gif +0 -0
- data/app/assets/images/platform/close.gif +0 -0
- data/app/assets/images/platform/cross.png +0 -0
- data/app/assets/images/platform/default_app_icon.gif +0 -0
- data/app/assets/images/platform/default_app_logo.gif +0 -0
- data/app/assets/images/platform/delete.png +0 -0
- data/app/assets/images/platform/disk.png +0 -0
- data/app/assets/images/platform/exclamation.png +0 -0
- data/app/assets/images/platform/eye.png +0 -0
- data/app/assets/images/platform/eye_not.png +0 -0
- data/app/assets/images/platform/field_sprite.gif +0 -0
- data/app/assets/images/platform/find.png +0 -0
- data/app/assets/images/platform/globe.gif +0 -0
- data/app/assets/images/platform/help.png +0 -0
- data/app/assets/images/platform/help/app_reg.png +0 -0
- data/app/assets/images/platform/help/app_reg_ext.png +0 -0
- data/app/assets/images/platform/help/app_reg_web.png +0 -0
- data/app/assets/images/platform/help/auth_desktop.png +0 -0
- data/app/assets/images/platform/help/auth_iframe.png +0 -0
- data/app/assets/images/platform/help/auth_iphone.png +0 -0
- data/app/assets/images/platform/help/auth_web.png +0 -0
- data/app/assets/images/platform/help/authorize.png +0 -0
- data/app/assets/images/platform/help/ext.png +0 -0
- data/app/assets/images/platform/help/login.png +0 -0
- data/app/assets/images/platform/help/login_desktop.png +0 -0
- data/app/assets/images/platform/help/login_iphone.png +0 -0
- data/app/assets/images/platform/help/login_web.png +0 -0
- data/app/assets/images/platform/help2.png +0 -0
- data/app/assets/images/platform/information.png +0 -0
- data/app/assets/images/platform/keyboard.png +0 -0
- data/app/assets/images/platform/language_selector_arrow.gif +0 -0
- data/app/assets/images/platform/left_quote.png +0 -0
- data/app/assets/images/platform/lightning.png +0 -0
- data/app/assets/images/platform/loading.gif +0 -0
- data/app/assets/images/platform/loading2.gif +0 -0
- data/app/assets/images/platform/loading3.gif +0 -0
- data/app/assets/images/platform/loading_animation.gif +0 -0
- data/app/assets/images/platform/loading_large.gif +0 -0
- data/app/assets/images/platform/lock.png +0 -0
- data/app/assets/images/platform/lock_add.png +0 -0
- data/app/assets/images/platform/lock_delete.png +0 -0
- data/app/assets/images/platform/lock_open.png +0 -0
- data/app/assets/images/platform/medals/bronze.png +0 -0
- data/app/assets/images/platform/medals/gold.png +0 -0
- data/app/assets/images/platform/medals/runner.png +0 -0
- data/app/assets/images/platform/medals/silver.png +0 -0
- data/app/assets/images/platform/minus_node.png +0 -0
- data/app/assets/images/platform/oauth/perm_tile.gif +0 -0
- data/app/assets/images/platform/oauth/right_grey.png +0 -0
- data/app/assets/images/platform/pencil.png +0 -0
- data/app/assets/images/platform/photo_silhouette.gif +0 -0
- data/app/assets/images/platform/pixel.gif +0 -0
- data/app/assets/images/platform/platform.png +0 -0
- data/app/assets/images/platform/platform2.png +0 -0
- data/app/assets/images/platform/platform3.png +0 -0
- data/app/assets/images/platform/platform4.png +0 -0
- data/app/assets/images/platform/platform5.png +0 -0
- data/app/assets/images/platform/plus.png +0 -0
- data/app/assets/images/platform/plus_node.png +0 -0
- data/app/assets/images/platform/random.png +0 -0
- data/app/assets/images/platform/random2.png +0 -0
- data/app/assets/images/platform/rating_star0.png +0 -0
- data/app/assets/images/platform/rating_star05.png +0 -0
- data/app/assets/images/platform/rating_star1.png +0 -0
- data/app/assets/images/platform/rating_stars.gif +0 -0
- data/app/assets/images/platform/rating_stars.psd +0 -0
- data/app/assets/images/platform/reply.png +0 -0
- data/app/assets/images/platform/right_quote.png +0 -0
- data/app/assets/images/platform/rotating_world.gif +0 -0
- data/app/assets/images/platform/script.png +0 -0
- data/app/assets/images/platform/script_edit.png +0 -0
- data/app/assets/images/platform/script_gear.png +0 -0
- data/app/assets/images/platform/site_sprite.gif +0 -0
- data/app/assets/images/platform/spinner.gif +0 -0
- data/app/assets/images/platform/star.png +0 -0
- data/app/assets/images/platform/table_edit.png +0 -0
- data/app/assets/images/platform/table_gear.png +0 -0
- data/app/assets/images/platform/table_multiple.png +0 -0
- data/app/assets/images/platform/thumb_down.png +0 -0
- data/app/assets/images/platform/thumb_up.png +0 -0
- data/app/assets/images/platform/top_left_stem.png +0 -0
- data/app/assets/images/platform/top_right_stem.png +0 -0
- data/app/assets/images/platform/translate_icn.gif +0 -0
- data/app/assets/images/platform/treeview/diffDoc.gif +0 -0
- data/app/assets/images/platform/treeview/diffFolder.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2blank.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2doc.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2folderclosed.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2folderopen.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2lastnode.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2link.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2mlastnode.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2mnode.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2node.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2plastnode.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2pnode.gif +0 -0
- data/app/assets/images/platform/treeview/ftv2vertline.gif +0 -0
- data/app/assets/images/platform/wizard.png +0 -0
- data/app/assets/images/platform/world_link.png +0 -0
- data/app/assets/javascripts/platform/api_explorer.js +628 -0
- data/app/assets/javascripts/platform/application.js +9 -0
- data/app/assets/javascripts/platform/ftiens4.js +1197 -0
- data/app/assets/javascripts/platform/jsdk.js +539 -0
- data/app/assets/javascripts/platform/platform.js +447 -0
- data/app/assets/javascripts/platform/shortcut.js +223 -0
- data/app/assets/javascripts/platform/ua.js +147 -0
- data/app/assets/stylesheets/platform/api_explorer.css.scss +140 -0
- data/app/assets/stylesheets/platform/application.css.scss +6 -0
- data/app/assets/stylesheets/platform/components.css.scss +208 -0
- data/app/assets/stylesheets/platform/layout.css.scss +119 -0
- data/app/assets/stylesheets/platform/oauth.css +51 -0
- data/app/assets/stylesheets/platform/platform.css.scss +311 -0
- data/app/controllers/platform/admin/apps_controller.rb +99 -0
- data/app/controllers/platform/admin/base_controller.rb +60 -0
- data/app/controllers/platform/admin/categories_controller.rb +132 -0
- data/app/controllers/platform/admin/clientsdk_controller.rb +30 -0
- data/app/controllers/platform/admin/developers_controller.rb +30 -0
- data/app/controllers/platform/admin/exceptions_controller.rb +30 -0
- data/app/controllers/platform/admin/forum_controller.rb +34 -0
- data/app/controllers/platform/admin/metrics_controller.rb +42 -0
- data/app/controllers/platform/api/apps_controller.rb +40 -0
- data/app/controllers/platform/api/base_controller.rb +541 -0
- data/app/controllers/platform/apps_controller.rb +142 -0
- data/app/controllers/platform/base_controller.rb +127 -0
- data/app/controllers/platform/developer/api_explorer_controller.rb +56 -0
- data/app/controllers/platform/developer/apps_controller.rb +161 -0
- data/app/controllers/platform/developer/base_controller.rb +51 -0
- data/app/controllers/platform/developer/blog_controller.rb +29 -0
- data/app/controllers/platform/developer/dashboard_controller.rb +63 -0
- data/app/controllers/platform/developer/forum_controller.rb +85 -0
- data/app/controllers/platform/developer/help_controller.rb +113 -0
- data/app/controllers/platform/developer/info_controller.rb +41 -0
- data/app/controllers/platform/developer/registration_controller.rb +39 -0
- data/app/controllers/platform/developer/resources_controller.rb +30 -0
- data/app/controllers/platform/forum_controller.rb +74 -0
- data/app/controllers/platform/oauth_controller.rb +421 -0
- data/app/controllers/platform/ratings_controller.rb +61 -0
- data/app/helpers/platform/admin/categories_helper.rb +54 -0
- data/app/helpers/platform/apps_helper.rb +26 -0
- data/app/helpers/platform/developer/dashboard_helper.rb +42 -0
- data/app/helpers/platform/developer/help_helper.rb +45 -0
- data/app/helpers/platform_helper.rb +26 -0
- data/app/models/platform/application.rb +394 -0
- data/app/models/platform/application_category.rb +34 -0
- data/app/models/platform/application_developer.rb +30 -0
- data/app/models/platform/application_filter.rb +30 -0
- data/app/models/platform/application_log.rb +32 -0
- data/app/models/platform/application_log_filter.rb +34 -0
- data/app/models/platform/application_metric.rb +58 -0
- data/app/models/platform/application_metric_filter.rb +34 -0
- data/app/models/platform/application_permission.rb +30 -0
- data/app/models/platform/application_permission_filter.rb +30 -0
- data/app/models/platform/application_usage_metric.rb +58 -0
- data/app/models/platform/application_usage_metric_filter.rb +34 -0
- data/app/models/platform/application_user.rb +45 -0
- data/app/models/platform/application_user_filter.rb +34 -0
- data/app/models/platform/base_filter.rb +46 -0
- data/app/models/platform/category.rb +64 -0
- data/app/models/platform/daily_application_metric.rb +31 -0
- data/app/models/platform/developer.rb +45 -0
- data/app/models/platform/developer_filter.rb +26 -0
- data/app/models/platform/forum_message.rb +35 -0
- data/app/models/platform/forum_message_filter.rb +26 -0
- data/app/models/platform/forum_topic.rb +38 -0
- data/app/models/platform/forum_topic_filter.rb +26 -0
- data/app/models/platform/logged_exception.rb +290 -0
- data/app/models/platform/logged_exception_filter.rb +58 -0
- data/app/models/platform/media/image.rb +26 -0
- data/app/models/platform/media/media.rb +58 -0
- data/app/models/platform/monthly_application_metric.rb +31 -0
- data/app/models/platform/oauth/access_token.rb +57 -0
- data/app/models/platform/oauth/client_token.rb +38 -0
- data/app/models/platform/oauth/oauth_model_methods.rb +41 -0
- data/app/models/platform/oauth/oauth_token.rb +57 -0
- data/app/models/platform/oauth/oauth_token_filter.rb +34 -0
- data/app/models/platform/oauth/refresh_token.rb +47 -0
- data/app/models/platform/oauth/request_token.rb +50 -0
- data/app/models/platform/permission.rb +27 -0
- data/app/models/platform/rating.rb +43 -0
- data/app/models/platform/rating_filter.rb +30 -0
- data/app/models/platform/rollup_log.rb +27 -0
- data/app/models/platform/rollup_log_filter.rb +30 -0
- data/app/models/platform/total_application_metric.rb +40 -0
- data/app/models/platform/weekly_application_metric.rb +31 -0
- data/app/views/platform/admin/apps/_categories.html.erb +17 -0
- data/app/views/platform/admin/apps/_categories_scripts.html.erb +17 -0
- data/app/views/platform/admin/apps/_tabs.html.erb +25 -0
- data/app/views/platform/admin/apps/index.html.erb +32 -0
- data/app/views/platform/admin/apps/permissions.html.erb +7 -0
- data/app/views/platform/admin/apps/ratings.html.erb +7 -0
- data/app/views/platform/admin/apps/tokens.html.erb +18 -0
- data/app/views/platform/admin/apps/users.html.erb +7 -0
- data/app/views/platform/admin/apps/view.html.erb +170 -0
- data/app/views/platform/admin/categories/_tabs.html.erb +22 -0
- data/app/views/platform/admin/categories/category_assigner.html.erb +9 -0
- data/app/views/platform/admin/categories/category_assigner_tree.html.erb +81 -0
- data/app/views/platform/admin/categories/index.html.erb +106 -0
- data/app/views/platform/admin/categories/items.html.erb +153 -0
- data/app/views/platform/admin/categories/lb_update_application_category.html.erb +54 -0
- data/app/views/platform/admin/categories/lb_update_category.html.erb +64 -0
- data/app/views/platform/admin/categories/tree.html.erb +64 -0
- data/app/views/platform/admin/clientsdk/index.html.erb +89 -0
- data/app/views/platform/admin/common/_footer.html.erb +1 -0
- data/app/views/platform/admin/common/_header.html.erb +32 -0
- data/app/views/platform/admin/common/_lightbox_buttons.html.erb +5 -0
- data/app/views/platform/admin/common/_paginator.html.erb +20 -0
- data/app/views/platform/admin/developers/_tabs.html.erb +22 -0
- data/app/views/platform/admin/developers/index.html.erb +7 -0
- data/app/views/platform/admin/exceptions/_tabs.html.erb +22 -0
- data/app/views/platform/admin/exceptions/index.html.erb +7 -0
- data/app/views/platform/admin/forum/_tabs.html.erb +22 -0
- data/app/views/platform/admin/forum/index.html.erb +7 -0
- data/app/views/platform/admin/forum/messages.html.erb +7 -0
- data/app/views/platform/admin/metrics/_tabs.html.erb +25 -0
- data/app/views/platform/admin/metrics/application_log.html.erb +7 -0
- data/app/views/platform/admin/metrics/index.html.erb +9 -0
- data/app/views/platform/admin/metrics/rollup_log.html.erb +7 -0
- data/app/views/platform/admin/metrics/usage.html.erb +7 -0
- data/app/views/platform/apps/_actions_module.html.erb +3 -0
- data/app/views/platform/apps/_app_footer.html.erb +8 -0
- data/app/views/platform/apps/_app_header.html.erb +25 -0
- data/app/views/platform/apps/_apps_module.html.erb +42 -0
- data/app/views/platform/apps/_authorize_form.html.erb +11 -0
- data/app/views/platform/apps/_categories_module.html.erb +11 -0
- data/app/views/platform/apps/_featured_apps_module.html.erb +40 -0
- data/app/views/platform/apps/_left.html.erb +20 -0
- data/app/views/platform/apps/_monthly_users_module.html.erb +8 -0
- data/app/views/platform/apps/_paginator.html.erb +13 -0
- data/app/views/platform/apps/_rank_module.html.erb +18 -0
- data/app/views/platform/apps/_search_apps_module.html.erb +35 -0
- data/app/views/platform/apps/canvas_app.html.erb +15 -0
- data/app/views/platform/apps/index.html.erb +86 -0
- data/app/views/platform/apps/view.html.erb +71 -0
- data/app/views/platform/apps/xd.html.erb +11 -0
- data/app/views/platform/common/_footer.html.erb +1 -0
- data/app/views/platform/common/_header.html.erb +4 -0
- data/app/views/platform/common/_paginator.html.erb +32 -0
- data/app/views/platform/common/_scripts.html.erb +7 -0
- data/app/views/platform/common/_user_login.html.erb +11 -0
- data/app/views/platform/developer/api_explorer/history.html.erb +31 -0
- data/app/views/platform/developer/api_explorer/index.html.erb +134 -0
- data/app/views/platform/developer/api_explorer/oauth_lander.html.erb +4 -0
- data/app/views/platform/developer/api_explorer/options.html.erb +44 -0
- data/app/views/platform/developer/apps/_form.html.erb +340 -0
- data/app/views/platform/developer/apps/create_version.html.erb +19 -0
- data/app/views/platform/developer/apps/edit.html.erb +21 -0
- data/app/views/platform/developer/apps/index.html.erb +375 -0
- data/app/views/platform/developer/apps/new.html.erb +20 -0
- data/app/views/platform/developer/blog/index.html.erb +7 -0
- data/app/views/platform/developer/common/_footer.html.erb +1 -0
- data/app/views/platform/developer/common/_header.html.erb +34 -0
- data/app/views/platform/developer/dashboard/_apps_info.html.erb +84 -0
- data/app/views/platform/developer/dashboard/_discussions.html.erb +68 -0
- data/app/views/platform/developer/dashboard/_header.html.erb +12 -0
- data/app/views/platform/developer/dashboard/_reviews.html.erb +53 -0
- data/app/views/platform/developer/dashboard/_statistics.html.erb +105 -0
- data/app/views/platform/developer/dashboard/index.html.erb +85 -0
- data/app/views/platform/developer/dashboard/settings.html.erb +23 -0
- data/app/views/platform/developer/forum/_message.html.erb +17 -0
- data/app/views/platform/developer/forum/_messages.html.erb +14 -0
- data/app/views/platform/developer/forum/_new_message.html.erb +28 -0
- data/app/views/platform/developer/forum/_new_topic.html.erb +39 -0
- data/app/views/platform/developer/forum/index.html.erb +89 -0
- data/app/views/platform/developer/forum/topic.html.erb +28 -0
- data/app/views/platform/developer/help/_footer.html.erb +4 -0
- data/app/views/platform/developer/help/_header.html.erb +95 -0
- data/app/views/platform/developer/help/_navigation.html.erb +99 -0
- data/app/views/platform/developer/help/api.html.erb +120 -0
- data/app/views/platform/developer/help/credits.html.erb +77 -0
- data/app/views/platform/developer/help/index.html.erb +19 -0
- data/app/views/platform/developer/help/license.html.erb +586 -0
- data/app/views/platform/developer/help/oauth_app_login.html.erb +177 -0
- data/app/views/platform/developer/help/oauth_client_side.html.erb +264 -0
- data/app/views/platform/developer/help/oauth_desktop.html.erb +191 -0
- data/app/views/platform/developer/help/oauth_extensions.html.erb +342 -0
- data/app/views/platform/developer/help/oauth_intro.html.erb +371 -0
- data/app/views/platform/developer/help/oauth_mobile.html.erb +292 -0
- data/app/views/platform/developer/help/oauth_server_side.html.erb +603 -0
- data/app/views/platform/developer/help/oauth_trusted_client.html.erb +202 -0
- data/app/views/platform/developer/help/reference.html.erb +42 -0
- data/app/views/platform/developer/help/sdk_ios.html.erb +31 -0
- data/app/views/platform/developer/help/sdk_js.html.erb +202 -0
- data/app/views/platform/developer/info/_basic_info.html.erb +74 -0
- data/app/views/platform/developer/info/_header.html.erb +12 -0
- data/app/views/platform/developer/info/index.html.erb +23 -0
- data/app/views/platform/developer/registration/index.html.erb +134 -0
- data/app/views/platform/developer/resources/index.html.erb +23 -0
- data/app/views/platform/forum/_message.html.erb +17 -0
- data/app/views/platform/forum/_messages.html.erb +14 -0
- data/app/views/platform/forum/_new_message.html.erb +26 -0
- data/app/views/platform/forum/_new_topic.html.erb +38 -0
- data/app/views/platform/forum/_topic.html.erb +18 -0
- data/app/views/platform/forum/_topics.html.erb +74 -0
- data/app/views/platform/login/index.html.erb +31 -0
- data/app/views/platform/login/register.html.erb +55 -0
- data/app/views/platform/oauth/_authorization_box.html.erb +75 -0
- data/app/views/platform/oauth/_authorization_popup.html.erb +38 -0
- data/app/views/platform/oauth/_authorize_form.html.erb +11 -0
- data/app/views/platform/oauth/auth_failed.html.erb +0 -0
- data/app/views/platform/oauth/auth_success.html.erb +0 -0
- data/app/views/platform/oauth/authorize_desktop.html.erb +76 -0
- data/app/views/platform/oauth/authorize_failure_iframe.html.erb +1 -0
- data/app/views/platform/oauth/authorize_failure_mobile.html.erb +24 -0
- data/app/views/platform/oauth/authorize_failure_popup.html.erb +24 -0
- data/app/views/platform/oauth/authorize_failure_web.html.erb +1 -0
- data/app/views/platform/oauth/authorize_iframe.html.erb +16 -0
- data/app/views/platform/oauth/authorize_mobile.html.erb +1 -0
- data/app/views/platform/oauth/authorize_popup.html.erb +1 -0
- data/app/views/platform/oauth/authorize_success_iframe.html.erb +1 -0
- data/app/views/platform/oauth/authorize_success_mobile.html.erb +24 -0
- data/app/views/platform/oauth/authorize_success_popup.html.erb +24 -0
- data/app/views/platform/oauth/authorize_success_web.html.erb +1 -0
- data/app/views/platform/oauth/authorize_web.html.erb +3 -0
- data/app/views/platform/oauth/xd.html.erb +13 -0
- data/app/views/platform/ratings/_list.html.erb +30 -0
- data/app/views/platform/ratings/_new.html.erb +70 -0
- data/app/views/platform/ratings/_rating.html.erb +17 -0
- data/config/platform/config.yml +133 -0
- data/config/platform/data/default_applications.yml +39 -0
- data/config/platform/data/default_categories.yml +56 -0
- data/config/platform/data/default_permissions.yml +0 -0
- data/config/platform/site/features.yml +66 -0
- data/config/routes.rb +59 -0
- data/db/migrate/20110602232141_create_platform_tables.rb +262 -0
- data/docs/Classes.graffle +7315 -0
- data/docs/Classes.pdf +0 -0
- data/lib/generators/platform/platform_generator.rb +56 -0
- data/lib/generators/platform/templates/db/create_platform_tables.rb +262 -0
- data/lib/generators/platform/templates/layouts/platform.html.erb +49 -0
- data/lib/generators/platform/templates/layouts/platform_admin.html.erb +60 -0
- data/lib/platform.rb +6 -0
- data/lib/platform/api/already_jsoned_string.rb +9 -0
- data/lib/platform/api/proxy.rb +45 -0
- data/lib/platform/api/proxy/base.rb +62 -0
- data/lib/platform/cache.rb +78 -0
- data/lib/platform/config.rb +666 -0
- data/lib/platform/engine.rb +5 -0
- data/lib/platform/exception.rb +27 -0
- data/lib/platform/extensions/action_controller_extension.rb +65 -0
- data/lib/platform/extensions/action_view_extension.rb +168 -0
- data/lib/platform/extensions/object_extension.rb +51 -0
- data/lib/platform/helper.rb +33 -0
- data/lib/platform/logger.rb +62 -0
- data/lib/platform/railtie.rb +52 -0
- data/lib/platform/random_password_generator.rb +76 -0
- data/lib/platform/simple_string_permissions.rb +40 -0
- data/lib/platform/version.rb +3 -0
- data/lib/tasks/platform.rake +119 -0
- data/platform.gemspec +45 -0
- data/script/rails +6 -0
- data/spec/config/config_spec.rb +10 -0
- data/spec/dummy_app.rb +52 -0
- data/spec/models/application_spec.rb +53 -0
- data/spec/models/developer_spec.rb +23 -0
- data/spec/spec_helper.rb +29 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +7 -0
- data/test/dummy/app/assets/stylesheets/admin.css +200 -0
- data/test/dummy/app/assets/stylesheets/application.css +47 -0
- data/test/dummy/app/assets/stylesheets/components.css.scss +211 -0
- data/test/dummy/app/assets/stylesheets/layout.css.scss +143 -0
- data/test/dummy/app/controllers/admin/admins_controller.rb +7 -0
- data/test/dummy/app/controllers/admin/base_controller.rb +12 -0
- data/test/dummy/app/controllers/admin/bookmarks_controller.rb +7 -0
- data/test/dummy/app/controllers/admin/users_controller.rb +19 -0
- data/test/dummy/app/controllers/api/base_controller.rb +5 -0
- data/test/dummy/app/controllers/api/bookmarks_controller.rb +35 -0
- data/test/dummy/app/controllers/api/users_controller.rb +19 -0
- data/test/dummy/app/controllers/application_controller.rb +31 -0
- data/test/dummy/app/controllers/home_controller.rb +7 -0
- data/test/dummy/app/controllers/login_controller.rb +65 -0
- data/test/dummy/app/helpers/application_helper.rb +9 -0
- data/test/dummy/app/helpers/home_helper.rb +2 -0
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/models/admin.rb +4 -0
- data/test/dummy/app/models/admin_filter.rb +7 -0
- data/test/dummy/app/models/bookmark.rb +7 -0
- data/test/dummy/app/models/user.rb +34 -0
- data/test/dummy/app/views/admin/admins/index.html.erb +7 -0
- data/test/dummy/app/views/admin/bookmarks/index.html.erb +5 -0
- data/test/dummy/app/views/admin/users/index.html.erb +10 -0
- data/test/dummy/app/views/demo/index.rhtml +108 -0
- data/test/dummy/app/views/demo/tokens.rhtml +35 -0
- data/test/dummy/app/views/home/index.html.erb +43 -0
- data/test/dummy/app/views/layouts/_footer.html.erb +16 -0
- data/test/dummy/app/views/layouts/_header.html.erb +22 -0
- data/test/dummy/app/views/layouts/admin.html.erb +97 -0
- data/test/dummy/app/views/layouts/application.html.erb +25 -0
- data/test/dummy/app/views/layouts/minimal.html.erb +37 -0
- data/test/dummy/app/views/layouts/popup.html.erb +43 -0
- data/test/dummy/app/views/login/index.html.erb +34 -0
- data/test/dummy/app/views/login/register.html.erb +51 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +51 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +30 -0
- data/test/dummy/config/environments/production.rb +60 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/platform/api/0/bookmark.yml +18 -0
- data/test/dummy/config/platform/api/0/user.yml +17 -0
- data/test/dummy/config/platform/api/1/bookmark.yml +58 -0
- data/test/dummy/config/platform/api/1/user.yml +36 -0
- data/test/dummy/config/platform/config.yml +135 -0
- data/test/dummy/config/platform/data/default_applications.yml +39 -0
- data/test/dummy/config/platform/data/default_categories.yml +56 -0
- data/test/dummy/config/platform/data/default_permissions.yml +0 -0
- data/test/dummy/config/platform/site/features.yml +66 -0
- data/test/dummy/config/platform/site/sample_apps.yml +100 -0
- data/test/dummy/config/routes.rb +30 -0
- data/test/dummy/config/tr8n/config.yml +247 -0
- data/test/dummy/config/tr8n/data/ip_locations.csv +93460 -0
- data/test/dummy/config/tr8n/rules/default_date_rules.yml +20 -0
- data/test/dummy/config/tr8n/rules/default_gender_list_rules.yml +82 -0
- data/test/dummy/config/tr8n/rules/default_gender_rules.yml +20 -0
- data/test/dummy/config/tr8n/rules/default_language_cases.yml +272 -0
- data/test/dummy/config/tr8n/rules/default_list_rules.yml +19 -0
- data/test/dummy/config/tr8n/rules/default_numeric_rules.yml +42 -0
- data/test/dummy/config/tr8n/rules/default_value_rules.yml +18 -0
- data/test/dummy/config/tr8n/site/default_glossary.yml +18 -0
- data/test/dummy/config/tr8n/site/default_languages.yml +1591 -0
- data/test/dummy/config/tr8n/site/features.yml +111 -0
- data/test/dummy/config/tr8n/site/shortcuts.yml +55 -0
- data/test/dummy/config/tr8n/site/sitemap.json +42 -0
- data/test/dummy/config/tr8n/tokens/data.yml +19 -0
- data/test/dummy/config/tr8n/tokens/decorations.yml +19 -0
- data/test/dummy/config/will_filter/config.yml +99 -0
- data/test/dummy/db/migrate/20101207014543_create_users.rb +23 -0
- data/test/dummy/db/migrate/20110113223509_create_admins.rb +15 -0
- data/test/dummy/db/migrate/20110930041143_create_will_filter_filters.rb +15 -0
- data/test/dummy/db/migrate/20110930041150_create_tr8n_tables.rb +350 -0
- data/test/dummy/db/migrate/20111004075531_create_platform_tables.rb +262 -0
- data/test/dummy/db/migrate/20111012055603_create_bookmarks.rb +10 -0
- data/test/dummy/db/schema.rb +683 -0
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/dummy/lib/platform/api/bookmark_proxy_0.rb +12 -0
- data/test/dummy/lib/platform/api/bookmark_proxy_1.rb +12 -0
- data/test/dummy/lib/platform/api/user_proxy_0.rb +12 -0
- data/test/dummy/lib/platform/api/user_proxy_1.rb +12 -0
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/fixtures/documents.yml +11 -0
- data/test/dummy/test/unit/document_test.rb +7 -0
- metadata +886 -0
@@ -0,0 +1,447 @@
|
|
1
|
+
/****************************************************************************
|
2
|
+
Copyright (c) 2011 Michael Berkovich, Ian McDaniel, Geni Inc
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
****************************************************************************/
|
23
|
+
|
24
|
+
/****************************************************************************
|
25
|
+
**** Platform Generic Helper Functions
|
26
|
+
****************************************************************************/
|
27
|
+
|
28
|
+
document.createElement('platform');
|
29
|
+
|
30
|
+
var Platform = Platform || {
|
31
|
+
element:function(element_id) {
|
32
|
+
if (typeof element_id == 'string') return document.getElementById(element_id);
|
33
|
+
return element_id;
|
34
|
+
},
|
35
|
+
value:function(element_id) {
|
36
|
+
return Platform.element(element_id).value;
|
37
|
+
}
|
38
|
+
};
|
39
|
+
|
40
|
+
/****************************************************************************
|
41
|
+
**** Platform Effects Helper Functions - Can be overloaded by JS frameworks
|
42
|
+
****************************************************************************/
|
43
|
+
|
44
|
+
Platform.Effects = {
|
45
|
+
toggle: function(element_id) {
|
46
|
+
if (Platform.element(element_id).style.display == "none")
|
47
|
+
Platform.element(element_id).show();
|
48
|
+
else
|
49
|
+
Platform.element(element_id).hide();
|
50
|
+
},
|
51
|
+
hide: function(element_id) {
|
52
|
+
Platform.element(element_id).style.display = "none";
|
53
|
+
},
|
54
|
+
show: function(element_id) {
|
55
|
+
var style = (Platform.element(element_id).tagName == "SPAN") ? "inline" : "block";
|
56
|
+
Platform.element(element_id).style.display = style;
|
57
|
+
},
|
58
|
+
blindUp: function(element_id) {
|
59
|
+
Platform.Effects.hide(element_id);
|
60
|
+
},
|
61
|
+
blindDown: function(element_id) {
|
62
|
+
Platform.Effects.show(element_id);
|
63
|
+
},
|
64
|
+
appear: function(element_id) {
|
65
|
+
Platform.Effects.show(element_id);
|
66
|
+
},
|
67
|
+
fade: function(element_id) {
|
68
|
+
Platform.Effects.hide(element_id);
|
69
|
+
},
|
70
|
+
submit: function(element_id) {
|
71
|
+
Platform.element(element_id).submit();
|
72
|
+
},
|
73
|
+
focus: function(element_id) {
|
74
|
+
Platform.element(element_id).focus();
|
75
|
+
},
|
76
|
+
scrollTo: function(element_id) {
|
77
|
+
var theElement = Platform.element(element_id);
|
78
|
+
var selectedPosX = 0;
|
79
|
+
var selectedPosY = 0;
|
80
|
+
while(theElement != null){
|
81
|
+
selectedPosX += theElement.offsetLeft;
|
82
|
+
selectedPosY += theElement.offsetTop;
|
83
|
+
theElement = theElement.offsetParent;
|
84
|
+
}
|
85
|
+
window.scrollTo(selectedPosX,selectedPosY);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
/****************************************************************************
|
90
|
+
**** Platform Lightbox
|
91
|
+
****************************************************************************/
|
92
|
+
|
93
|
+
Platform.Lightbox = function() {
|
94
|
+
this.container = document.createElement('div');
|
95
|
+
this.container.className = 'platform_lightbox';
|
96
|
+
this.container.id = 'platform_lightbox';
|
97
|
+
this.container.style.display = "none";
|
98
|
+
|
99
|
+
this.overlay = document.createElement('div');
|
100
|
+
this.overlay.className = 'platform_lightbox_overlay';
|
101
|
+
this.overlay.id = 'platform_lightbox_overlay';
|
102
|
+
this.overlay.style.display = "none";
|
103
|
+
|
104
|
+
document.body.appendChild(this.container);
|
105
|
+
document.body.appendChild(this.overlay);
|
106
|
+
}
|
107
|
+
|
108
|
+
|
109
|
+
Platform.Lightbox.prototype = {
|
110
|
+
|
111
|
+
hide: function() {
|
112
|
+
this.container.style.display = "none";
|
113
|
+
this.overlay.style.display = "none";
|
114
|
+
Platform.Utils.showFlash();
|
115
|
+
},
|
116
|
+
|
117
|
+
show: function(url, opts) {
|
118
|
+
var self = this;
|
119
|
+
Platform.Utils.hideFlash();
|
120
|
+
|
121
|
+
this.container.innerHTML = "<div style='font-size:18px;text-align:left;padding:10px;'><img src='/platform/images/spinner.gif' style='vertical-align:middle'>Loading...</div>";
|
122
|
+
|
123
|
+
var overlay_height = window.innerHeight;
|
124
|
+
var overlay_width = window.innerWidth;
|
125
|
+
|
126
|
+
this.overlay.style.position = "fixed";
|
127
|
+
this.overlay.style.top = "0px";
|
128
|
+
this.overlay.style.left = "0px";
|
129
|
+
this.overlay.style.dispaly = "inline";
|
130
|
+
this.overlay.style.width = overlay_width + 'px';
|
131
|
+
this.overlay.style.height = overlay_height + 'px';
|
132
|
+
this.overlay.style.display = "block";
|
133
|
+
|
134
|
+
opts = opts || {}
|
135
|
+
opts["width"] = opts["width"] || (overlay_width / 2);
|
136
|
+
opts["height"] = opts["height"] || (overlay_height / 2);
|
137
|
+
opts["left"] = (overlay_width - opts["width"])/2;
|
138
|
+
opts["top"] = (overlay_height - opts["height"])/2 - 100;
|
139
|
+
|
140
|
+
this.container.style.position = "fixed";
|
141
|
+
this.container.style.top = opts["top"] + 'px';
|
142
|
+
this.container.style.left = opts["left"] + 'px';
|
143
|
+
this.container.style.width = opts["width"] + 'px';
|
144
|
+
this.container.style.height = opts["height"] + 'px';
|
145
|
+
this.container.style.display = "block";
|
146
|
+
|
147
|
+
Platform.Utils.update('platform_lightbox', url, {
|
148
|
+
evalScripts: true
|
149
|
+
});
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
153
|
+
/****************************************************************************
|
154
|
+
**** Platform Utils
|
155
|
+
****************************************************************************/
|
156
|
+
|
157
|
+
Platform.Utils = {
|
158
|
+
|
159
|
+
hideFlash: function() {
|
160
|
+
// alert("Hiding");
|
161
|
+
var embeds = document.getElementsByTagName('embed');
|
162
|
+
for(i = 0; i < embeds.length; i++) {
|
163
|
+
embeds[i].style.visibility = 'hidden';
|
164
|
+
}
|
165
|
+
},
|
166
|
+
|
167
|
+
showFlash: function() {
|
168
|
+
// alert("Showing");
|
169
|
+
var embeds = document.getElementsByTagName('embed');
|
170
|
+
for(i = 0; i < embeds.length; i++) {
|
171
|
+
embeds[i].style.visibility = 'visible';
|
172
|
+
}
|
173
|
+
},
|
174
|
+
|
175
|
+
isOpera: function() {
|
176
|
+
return /Opera/.test(navigator.userAgent);
|
177
|
+
},
|
178
|
+
|
179
|
+
addEvent: function(elm, evType, fn, useCapture) {
|
180
|
+
useCapture = useCapture || false;
|
181
|
+
if (elm.addEventListener) {
|
182
|
+
elm.addEventListener(evType, fn, useCapture);
|
183
|
+
return true;
|
184
|
+
} else if (elm.attachEvent) {
|
185
|
+
var r = elm.attachEvent('on' + evType, fn);
|
186
|
+
return r;
|
187
|
+
} else {
|
188
|
+
elm['on' + evType] = fn;
|
189
|
+
}
|
190
|
+
},
|
191
|
+
|
192
|
+
toQueryParams: function (obj) {
|
193
|
+
if (typeof obj == 'undefined' || obj == null) return "";
|
194
|
+
if (typeof obj == 'string') return obj;
|
195
|
+
|
196
|
+
var qs = [];
|
197
|
+
for(p in obj) {
|
198
|
+
qs.push(p + "=" + encodeURIComponent(obj[p]))
|
199
|
+
}
|
200
|
+
return qs.join("&")
|
201
|
+
},
|
202
|
+
|
203
|
+
serializeForm: function(form) {
|
204
|
+
var els = Platform.element(form).elements;
|
205
|
+
var form_obj = {}
|
206
|
+
for(i=0; i < els.length; i++) {
|
207
|
+
if (els[i].type == 'checkbox' && !els[i].checked) continue;
|
208
|
+
form_obj[els[i].name] = els[i].value;
|
209
|
+
}
|
210
|
+
return form_obj;
|
211
|
+
},
|
212
|
+
|
213
|
+
replaceAll: function(label, key, value) {
|
214
|
+
while (label.indexOf(key) != -1) {
|
215
|
+
label = label.replace(key, value);
|
216
|
+
}
|
217
|
+
return label;
|
218
|
+
},
|
219
|
+
|
220
|
+
getRequest: function() {
|
221
|
+
var factories = [
|
222
|
+
function() { return new ActiveXObject("Msxml2.XMLHTTP"); },
|
223
|
+
function() { return new XMLHttpRequest(); },
|
224
|
+
function() { return new ActiveXObject("Microsoft.XMLHTTP"); }
|
225
|
+
];
|
226
|
+
for(var i = 0; i < factories.length; i++) {
|
227
|
+
try {
|
228
|
+
var request = factories[i]();
|
229
|
+
if (request != null) return request;
|
230
|
+
} catch(e) {continue;}
|
231
|
+
}
|
232
|
+
},
|
233
|
+
|
234
|
+
ajax: function(url, options) {
|
235
|
+
options = options || {};
|
236
|
+
options.parameters = Platform.Utils.toQueryParams(options.parameters);
|
237
|
+
options.method = options.method || 'get';
|
238
|
+
|
239
|
+
var self=this;
|
240
|
+
if (options.method == 'get' && options.parameters != '') {
|
241
|
+
url = url + (url.indexOf('?') == -1 ? '?' : '&') + options.parameters;
|
242
|
+
}
|
243
|
+
|
244
|
+
var request = this.getRequest();
|
245
|
+
|
246
|
+
request.onreadystatechange = function() {
|
247
|
+
if(request.readyState == 4) {
|
248
|
+
if (request.status == 200) {
|
249
|
+
if(options.onSuccess) options.onSuccess(request);
|
250
|
+
if(options.onComplete) options.onComplete(request);
|
251
|
+
if(options.evalScripts) self.evalScripts(request.responseText);
|
252
|
+
} else {
|
253
|
+
if(options.onFailure) options.onFailure(request)
|
254
|
+
if(options.onComplete) options.onComplete(request)
|
255
|
+
}
|
256
|
+
}
|
257
|
+
}
|
258
|
+
|
259
|
+
request.open(options.method, url, true);
|
260
|
+
request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
261
|
+
request.setRequestHeader('Accept', 'text/javascript, text/html, application/xml, text/xml, */*');
|
262
|
+
request.send(options.parameters);
|
263
|
+
},
|
264
|
+
|
265
|
+
update: function(element_id, url, options) {
|
266
|
+
options.onSuccess = function(response) {
|
267
|
+
Platform.element(element_id).innerHTML = response.responseText;
|
268
|
+
};
|
269
|
+
Platform.Utils.ajax(url, options);
|
270
|
+
},
|
271
|
+
|
272
|
+
evalScripts: function(html){
|
273
|
+
var script_re = '<script[^>]*>([\\S\\s]*?)<\/script>';
|
274
|
+
var matchAll = new RegExp(script_re, 'img');
|
275
|
+
var matchOne = new RegExp(script_re, 'im');
|
276
|
+
var matches = html.match(matchAll) || [];
|
277
|
+
for(var i=0,l=matches.length;i<l;i++){
|
278
|
+
var script = (matches[i].match(matchOne) || ['', ''])[1];
|
279
|
+
// console.info(script)
|
280
|
+
// alert(script);
|
281
|
+
eval(script);
|
282
|
+
}
|
283
|
+
},
|
284
|
+
|
285
|
+
hasClassName:function(el, cls){
|
286
|
+
var exp = new RegExp("(^|\\s)"+cls+"($|\\s)");
|
287
|
+
return (el.className && exp.test(el.className))?true:false;
|
288
|
+
},
|
289
|
+
|
290
|
+
findElement: function (e,selector,el) {
|
291
|
+
var event = e || window.event;
|
292
|
+
var target = el || event.target || event.srcElement;
|
293
|
+
if(target == document.body) return null;
|
294
|
+
var condition = (selector.match(/^\./)) ? this.hasClassName(target,selector.replace(/^\./,'')) : (target.tagName.toLowerCase() == selector.toLowerCase());
|
295
|
+
if(condition) {
|
296
|
+
return target;
|
297
|
+
} else {
|
298
|
+
return this.findElement(e,selector,target.parentNode);
|
299
|
+
}
|
300
|
+
},
|
301
|
+
|
302
|
+
cumulativeOffset: function(element) {
|
303
|
+
var valueT = 0, valueL = 0;
|
304
|
+
do {
|
305
|
+
valueT += element.offsetTop || 0;
|
306
|
+
valueL += element.offsetLeft || 0;
|
307
|
+
element = element.offsetParent;
|
308
|
+
} while (element);
|
309
|
+
return [valueL, valueT];
|
310
|
+
},
|
311
|
+
|
312
|
+
wrapText: function (obj_id, beginTag, endTag) {
|
313
|
+
var obj = document.getElementById(obj_id);
|
314
|
+
|
315
|
+
if (typeof obj.selectionStart == 'number') {
|
316
|
+
// Mozilla, Opera, and other browsers
|
317
|
+
var start = obj.selectionStart;
|
318
|
+
var end = obj.selectionEnd;
|
319
|
+
obj.value = obj.value.substring(0, start) + beginTag + obj.value.substring(start, end) + endTag + obj.value.substring(end, obj.value.length);
|
320
|
+
|
321
|
+
} else if(document.selection) {
|
322
|
+
// Internet Explorer
|
323
|
+
obj.focus();
|
324
|
+
var range = document.selection.createRange();
|
325
|
+
if(range.parentElement() != obj)
|
326
|
+
return false;
|
327
|
+
|
328
|
+
if(typeof range.text == 'string')
|
329
|
+
document.selection.createRange().text = beginTag + range.text + endTag;
|
330
|
+
} else
|
331
|
+
obj.value += beginTag + " " + endTag;
|
332
|
+
|
333
|
+
return true;
|
334
|
+
},
|
335
|
+
|
336
|
+
insertAtCaret: function (areaId, text) {
|
337
|
+
var txtarea = document.getElementById(areaId);
|
338
|
+
var scrollPos = txtarea.scrollTop;
|
339
|
+
var strPos = 0;
|
340
|
+
var br = ((txtarea.selectionStart || txtarea.selectionStart == '0') ? "ff" : (document.selection ? "ie" : false ) );
|
341
|
+
|
342
|
+
if (br == "ie") {
|
343
|
+
txtarea.focus();
|
344
|
+
var range = document.selection.createRange();
|
345
|
+
range.moveStart ('character', -txtarea.value.length);
|
346
|
+
strPos = range.text.length;
|
347
|
+
} else if (br == "ff")
|
348
|
+
strPos = txtarea.selectionStart;
|
349
|
+
|
350
|
+
var front = (txtarea.value).substring(0, strPos);
|
351
|
+
var back = (txtarea.value).substring(strPos, txtarea.value.length);
|
352
|
+
txtarea.value=front+text+back;
|
353
|
+
|
354
|
+
strPos = strPos + text.length;
|
355
|
+
if (br == "ie") {
|
356
|
+
txtarea.focus();
|
357
|
+
var range = document.selection.createRange();
|
358
|
+
range.moveStart ('character', -txtarea.value.length);
|
359
|
+
range.moveStart ('character', strPos);
|
360
|
+
range.moveEnd ('character', 0); range.select();
|
361
|
+
} else if (br == "ff") {
|
362
|
+
txtarea.selectionStart = strPos;
|
363
|
+
txtarea.selectionEnd = strPos;
|
364
|
+
txtarea.focus();
|
365
|
+
}
|
366
|
+
txtarea.scrollTop = scrollPos;
|
367
|
+
},
|
368
|
+
|
369
|
+
toggleKeyboards: function() {
|
370
|
+
if(!VKI_attach) return;
|
371
|
+
if (!this.keyboardMode) {
|
372
|
+
this.keyboardMode = true;
|
373
|
+
|
374
|
+
var elements = document.getElementsByTagName("input");
|
375
|
+
for(i=0; i<elements.length; i++) {
|
376
|
+
if (elements[i].type == "text") VKI_attach(elements[i]);
|
377
|
+
}
|
378
|
+
elements = document.getElementsByTagName("textarea");
|
379
|
+
for(i=0; i<elements.length; i++) {
|
380
|
+
VKI_attach(elements[i]);
|
381
|
+
}
|
382
|
+
} else {
|
383
|
+
window.location.reload();
|
384
|
+
}
|
385
|
+
},
|
386
|
+
|
387
|
+
displayShortcuts: function() {
|
388
|
+
if (platformLightbox)
|
389
|
+
platformLightbox.show('/platform/help/lb_shortcuts', {width:400, height:480});
|
390
|
+
},
|
391
|
+
|
392
|
+
displayCredits: function() {
|
393
|
+
if (platformLightbox)
|
394
|
+
platformLightbox.show('/platform/help/lb_credits', {width:420, height:250});
|
395
|
+
},
|
396
|
+
|
397
|
+
equal: function (obj1, obj2) {
|
398
|
+
for(p in obj1) {
|
399
|
+
if(typeof(obj2[p])=='undefined') {return false;}
|
400
|
+
}
|
401
|
+
|
402
|
+
for(p in obj1) {
|
403
|
+
if (obj1[p]) {
|
404
|
+
switch(typeof(obj1[p])) {
|
405
|
+
case 'object':
|
406
|
+
if (!Platform.Utils.equal(obj1[p], obj2[p])) { return false }; break;
|
407
|
+
case 'function':
|
408
|
+
if (typeof(obj2[p])=='undefined' || (obj1[p].toString() != obj2[p].toString())) { return false; }; break;
|
409
|
+
default:
|
410
|
+
if (obj1[p] != obj2[p]) { return false; }
|
411
|
+
}
|
412
|
+
} else {
|
413
|
+
if (obj2[p]) {
|
414
|
+
return false;
|
415
|
+
}
|
416
|
+
}
|
417
|
+
}
|
418
|
+
|
419
|
+
for(p in obj2) {
|
420
|
+
if(typeof(obj1[p])=='undefined') {return false;}
|
421
|
+
}
|
422
|
+
|
423
|
+
return true;
|
424
|
+
}
|
425
|
+
|
426
|
+
|
427
|
+
}
|
428
|
+
|
429
|
+
/****************************************************************************
|
430
|
+
**** Platform Initialization
|
431
|
+
****************************************************************************/
|
432
|
+
|
433
|
+
var platformLightbox = null;
|
434
|
+
|
435
|
+
function initializePlatform() {
|
436
|
+
var setup = function() {
|
437
|
+
platformLightbox = new Platform.Lightbox();
|
438
|
+
|
439
|
+
Platform.Utils.addEvent(document, "keyup", function(event) {
|
440
|
+
if (event.keyCode == 27) { // Capture Esc key
|
441
|
+
platformLightbox.hide();
|
442
|
+
}
|
443
|
+
});
|
444
|
+
}
|
445
|
+
|
446
|
+
Platform.Utils.addEvent(window, 'load', setup);
|
447
|
+
}
|
@@ -0,0 +1,223 @@
|
|
1
|
+
/**
|
2
|
+
* http://www.openjs.com/scripts/events/keyboard_shortcuts/
|
3
|
+
* Version : 2.01.B
|
4
|
+
* By Binny V A
|
5
|
+
* License : BSD
|
6
|
+
*/
|
7
|
+
shortcut = {
|
8
|
+
'all_shortcuts':{},//All the shortcuts are stored in this array
|
9
|
+
'add': function(shortcut_combination,callback,opt) {
|
10
|
+
//Provide a set of default options
|
11
|
+
var default_options = {
|
12
|
+
'type':'keydown',
|
13
|
+
'propagate':false,
|
14
|
+
'disable_in_input':false,
|
15
|
+
'target':document,
|
16
|
+
'keycode':false
|
17
|
+
}
|
18
|
+
if(!opt) opt = default_options;
|
19
|
+
else {
|
20
|
+
for(var dfo in default_options) {
|
21
|
+
if(typeof opt[dfo] == 'undefined') opt[dfo] = default_options[dfo];
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
var ele = opt.target;
|
26
|
+
if(typeof opt.target == 'string') ele = document.getElementById(opt.target);
|
27
|
+
var ths = this;
|
28
|
+
shortcut_combination = shortcut_combination.toLowerCase();
|
29
|
+
|
30
|
+
//The function to be called at keypress
|
31
|
+
var func = function(e) {
|
32
|
+
e = e || window.event;
|
33
|
+
|
34
|
+
if(opt['disable_in_input']) { //Don't enable shortcut keys in Input, Textarea fields
|
35
|
+
var element;
|
36
|
+
if(e.target) element=e.target;
|
37
|
+
else if(e.srcElement) element=e.srcElement;
|
38
|
+
if(element.nodeType==3) element=element.parentNode;
|
39
|
+
|
40
|
+
if(element.tagName == 'INPUT' || element.tagName == 'TEXTAREA') return;
|
41
|
+
}
|
42
|
+
|
43
|
+
//Find Which key is pressed
|
44
|
+
if (e.keyCode) code = e.keyCode;
|
45
|
+
else if (e.which) code = e.which;
|
46
|
+
var character = String.fromCharCode(code).toLowerCase();
|
47
|
+
|
48
|
+
if(code == 188) character=","; //If the user presses , when the type is onkeydown
|
49
|
+
if(code == 190) character="."; //If the user presses , when the type is onkeydown
|
50
|
+
|
51
|
+
var keys = shortcut_combination.split("+");
|
52
|
+
//Key Pressed - counts the number of valid keypresses - if it is same as the number of keys, the shortcut function is invoked
|
53
|
+
var kp = 0;
|
54
|
+
|
55
|
+
//Work around for stupid Shift key bug created by using lowercase - as a result the shift+num combination was broken
|
56
|
+
var shift_nums = {
|
57
|
+
"`":"~",
|
58
|
+
"1":"!",
|
59
|
+
"2":"@",
|
60
|
+
"3":"#",
|
61
|
+
"4":"$",
|
62
|
+
"5":"%",
|
63
|
+
"6":"^",
|
64
|
+
"7":"&",
|
65
|
+
"8":"*",
|
66
|
+
"9":"(",
|
67
|
+
"0":")",
|
68
|
+
"-":"_",
|
69
|
+
"=":"+",
|
70
|
+
";":":",
|
71
|
+
"'":"\"",
|
72
|
+
",":"<",
|
73
|
+
".":">",
|
74
|
+
"/":"?",
|
75
|
+
"\\":"|"
|
76
|
+
}
|
77
|
+
//Special Keys - and their codes
|
78
|
+
var special_keys = {
|
79
|
+
'esc':27,
|
80
|
+
'escape':27,
|
81
|
+
'tab':9,
|
82
|
+
'space':32,
|
83
|
+
'return':13,
|
84
|
+
'enter':13,
|
85
|
+
'backspace':8,
|
86
|
+
|
87
|
+
'scrolllock':145,
|
88
|
+
'scroll_lock':145,
|
89
|
+
'scroll':145,
|
90
|
+
'capslock':20,
|
91
|
+
'caps_lock':20,
|
92
|
+
'caps':20,
|
93
|
+
'numlock':144,
|
94
|
+
'num_lock':144,
|
95
|
+
'num':144,
|
96
|
+
|
97
|
+
'pause':19,
|
98
|
+
'break':19,
|
99
|
+
|
100
|
+
'insert':45,
|
101
|
+
'home':36,
|
102
|
+
'delete':46,
|
103
|
+
'end':35,
|
104
|
+
|
105
|
+
'pageup':33,
|
106
|
+
'page_up':33,
|
107
|
+
'pu':33,
|
108
|
+
|
109
|
+
'pagedown':34,
|
110
|
+
'page_down':34,
|
111
|
+
'pd':34,
|
112
|
+
|
113
|
+
'left':37,
|
114
|
+
'up':38,
|
115
|
+
'right':39,
|
116
|
+
'down':40,
|
117
|
+
|
118
|
+
'f1':112,
|
119
|
+
'f2':113,
|
120
|
+
'f3':114,
|
121
|
+
'f4':115,
|
122
|
+
'f5':116,
|
123
|
+
'f6':117,
|
124
|
+
'f7':118,
|
125
|
+
'f8':119,
|
126
|
+
'f9':120,
|
127
|
+
'f10':121,
|
128
|
+
'f11':122,
|
129
|
+
'f12':123
|
130
|
+
}
|
131
|
+
|
132
|
+
var modifiers = {
|
133
|
+
shift: { wanted:false, pressed:false},
|
134
|
+
ctrl : { wanted:false, pressed:false},
|
135
|
+
alt : { wanted:false, pressed:false},
|
136
|
+
meta : { wanted:false, pressed:false} //Meta is Mac specific
|
137
|
+
};
|
138
|
+
|
139
|
+
if(e.ctrlKey) modifiers.ctrl.pressed = true;
|
140
|
+
if(e.shiftKey) modifiers.shift.pressed = true;
|
141
|
+
if(e.altKey) modifiers.alt.pressed = true;
|
142
|
+
if(e.metaKey) modifiers.meta.pressed = true;
|
143
|
+
|
144
|
+
for(var i=0; k=keys[i],i<keys.length; i++) {
|
145
|
+
//Modifiers
|
146
|
+
if(k == 'ctrl' || k == 'control') {
|
147
|
+
kp++;
|
148
|
+
modifiers.ctrl.wanted = true;
|
149
|
+
|
150
|
+
} else if(k == 'shift') {
|
151
|
+
kp++;
|
152
|
+
modifiers.shift.wanted = true;
|
153
|
+
|
154
|
+
} else if(k == 'alt') {
|
155
|
+
kp++;
|
156
|
+
modifiers.alt.wanted = true;
|
157
|
+
} else if(k == 'meta') {
|
158
|
+
kp++;
|
159
|
+
modifiers.meta.wanted = true;
|
160
|
+
} else if(k.length > 1) { //If it is a special key
|
161
|
+
if(special_keys[k] == code) kp++;
|
162
|
+
|
163
|
+
} else if(opt['keycode']) {
|
164
|
+
if(opt['keycode'] == code) kp++;
|
165
|
+
|
166
|
+
} else { //The special keys did not match
|
167
|
+
if(character == k) kp++;
|
168
|
+
else {
|
169
|
+
if(shift_nums[character] && e.shiftKey) { //Stupid Shift key bug created by using lowercase
|
170
|
+
character = shift_nums[character];
|
171
|
+
if(character == k) kp++;
|
172
|
+
}
|
173
|
+
}
|
174
|
+
}
|
175
|
+
}
|
176
|
+
|
177
|
+
if(kp == keys.length &&
|
178
|
+
modifiers.ctrl.pressed == modifiers.ctrl.wanted &&
|
179
|
+
modifiers.shift.pressed == modifiers.shift.wanted &&
|
180
|
+
modifiers.alt.pressed == modifiers.alt.wanted &&
|
181
|
+
modifiers.meta.pressed == modifiers.meta.wanted) {
|
182
|
+
callback(e);
|
183
|
+
|
184
|
+
if(!opt['propagate']) { //Stop the event
|
185
|
+
//e.cancelBubble is supported by IE - this will kill the bubbling process.
|
186
|
+
e.cancelBubble = true;
|
187
|
+
e.returnValue = false;
|
188
|
+
|
189
|
+
//e.stopPropagation works in Firefox.
|
190
|
+
if (e.stopPropagation) {
|
191
|
+
e.stopPropagation();
|
192
|
+
e.preventDefault();
|
193
|
+
}
|
194
|
+
return false;
|
195
|
+
}
|
196
|
+
}
|
197
|
+
}
|
198
|
+
this.all_shortcuts[shortcut_combination] = {
|
199
|
+
'callback':func,
|
200
|
+
'target':ele,
|
201
|
+
'event': opt['type']
|
202
|
+
};
|
203
|
+
//Attach the function with the event
|
204
|
+
if(ele.addEventListener) ele.addEventListener(opt['type'], func, false);
|
205
|
+
else if(ele.attachEvent) ele.attachEvent('on'+opt['type'], func);
|
206
|
+
else ele['on'+opt['type']] = func;
|
207
|
+
},
|
208
|
+
|
209
|
+
//Remove the shortcut - just specify the shortcut and I will remove the binding
|
210
|
+
'remove':function(shortcut_combination) {
|
211
|
+
shortcut_combination = shortcut_combination.toLowerCase();
|
212
|
+
var binding = this.all_shortcuts[shortcut_combination];
|
213
|
+
delete(this.all_shortcuts[shortcut_combination])
|
214
|
+
if(!binding) return;
|
215
|
+
var type = binding['event'];
|
216
|
+
var ele = binding['target'];
|
217
|
+
var callback = binding['callback'];
|
218
|
+
|
219
|
+
if(ele.detachEvent) ele.detachEvent('on'+type, callback);
|
220
|
+
else if(ele.removeEventListener) ele.removeEventListener(type, callback, false);
|
221
|
+
else ele['on'+type] = false;
|
222
|
+
}
|
223
|
+
}
|