iqvoc 3.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +69 -0
- data/Gemfile.lock +134 -0
- data/LICENSE +13 -0
- data/README.md +68 -0
- data/Rakefile +23 -0
- data/app/controllers/application_controller.rb +125 -0
- data/app/controllers/collections/hierarchical_controller.rb +44 -0
- data/app/controllers/collections_controller.rb +124 -0
- data/app/controllers/concepts/alphabetical_controller.rb +39 -0
- data/app/controllers/concepts/hierarchical_controller.rb +74 -0
- data/app/controllers/concepts/untranslated_controller.rb +38 -0
- data/app/controllers/concepts/versions_controller.rb +119 -0
- data/app/controllers/concepts_controller.rb +174 -0
- data/app/controllers/dashboard_controller.rb +43 -0
- data/app/controllers/pages_controller.rb +22 -0
- data/app/controllers/rdf_controller.rb +43 -0
- data/app/controllers/search_results_controller.rb +101 -0
- data/app/controllers/triple_store_syncs_controller.rb +45 -0
- data/app/controllers/user_sessions_controller.rb +48 -0
- data/app/controllers/users_controller.rb +81 -0
- data/app/helpers/application_helper.rb +60 -0
- data/app/helpers/concepts_helper.rb +86 -0
- data/app/helpers/dashboard_helper.rb +46 -0
- data/app/helpers/rdf_helper.rb +63 -0
- data/app/helpers/search_results_helper.rb +32 -0
- data/app/models/collection/base.rb +161 -0
- data/app/models/collection/member/base.rb +23 -0
- data/app/models/collection/member/collection.rb +33 -0
- data/app/models/collection/member/concept.rb +33 -0
- data/app/models/collection/unordered.rb +18 -0
- data/app/models/concept/base.rb +418 -0
- data/app/models/concept/relation/base.rb +95 -0
- data/app/models/concept/relation/reverse_relation_extension.rb +49 -0
- data/app/models/concept/relation/skos/base.rb +37 -0
- data/app/models/concept/relation/skos/broader/base.rb +41 -0
- data/app/models/concept/relation/skos/broader/mono.rb +28 -0
- data/app/models/concept/relation/skos/broader/poly.rb +23 -0
- data/app/models/concept/relation/skos/narrower/base.rb +37 -0
- data/app/models/concept/relation/skos/related.rb +21 -0
- data/app/models/concept/skos/base.rb +28 -0
- data/app/models/label/base.rb +98 -0
- data/app/models/label/skos/base.rb +27 -0
- data/app/models/labeling/base.rb +81 -0
- data/app/models/labeling/skos/alt_label.rb +21 -0
- data/app/models/labeling/skos/base.rb +99 -0
- data/app/models/labeling/skos/hidden_label.rb +25 -0
- data/app/models/labeling/skos/pref_label.rb +30 -0
- data/app/models/match/base.rb +57 -0
- data/app/models/match/skos/base.rb +23 -0
- data/app/models/match/skos/broad_match.rb +21 -0
- data/app/models/match/skos/close_match.rb +21 -0
- data/app/models/match/skos/exact_match.rb +21 -0
- data/app/models/match/skos/mapping_relation.rb +21 -0
- data/app/models/match/skos/narrow_match.rb +21 -0
- data/app/models/match/skos/related_match.rb +21 -0
- data/app/models/note/annotated/base.rb +29 -0
- data/app/models/note/base.rb +127 -0
- data/app/models/note/skos/base.rb +52 -0
- data/app/models/note/skos/change_note.rb +38 -0
- data/app/models/note/skos/definition.rb +33 -0
- data/app/models/note/skos/editorial_note.rb +21 -0
- data/app/models/note/skos/example.rb +21 -0
- data/app/models/note/skos/history_note.rb +21 -0
- data/app/models/note/skos/scope_note.rb +21 -0
- data/app/models/origin_mapping.rb +58 -0
- data/app/models/rdf_store.rb +96 -0
- data/app/models/search_extension.rb +58 -0
- data/app/models/user.rb +49 -0
- data/app/models/user_session.rb +23 -0
- data/app/views/collections/_collection.html.erb +10 -0
- data/app/views/collections/_form.html.erb +47 -0
- data/app/views/collections/edit.html.erb +11 -0
- data/app/views/collections/index.html.erb +12 -0
- data/app/views/collections/new.html.erb +7 -0
- data/app/views/collections/show.html.erb +53 -0
- data/app/views/collections/show.iqrdf +22 -0
- data/app/views/concepts/_base_data.html.erb +72 -0
- data/app/views/concepts/_close_match.html.erb +16 -0
- data/app/views/concepts/_show_head.html.erb +23 -0
- data/app/views/concepts/_visualization.html.erb +9 -0
- data/app/views/concepts/alphabetical/_pref_labeling.html.erb +6 -0
- data/app/views/concepts/alphabetical/index.html.erb +17 -0
- data/app/views/concepts/edit.html.erb +32 -0
- data/app/views/concepts/hierarchical/_treeview.html.erb +20 -0
- data/app/views/concepts/hierarchical/index.html.erb +5 -0
- data/app/views/concepts/index.iqrdf +24 -0
- data/app/views/concepts/new.html.erb +3 -0
- data/app/views/concepts/show_published.html.erb +16 -0
- data/app/views/concepts/show_unpublished.html.erb +43 -0
- data/app/views/concepts/untranslated/index.html.erb +23 -0
- data/app/views/dashboard/index.html.erb +47 -0
- data/app/views/errors/access_denied.html.erb +3 -0
- data/app/views/errors/multiple_choices.html.erb +11 -0
- data/app/views/errors/not_found.html.erb +8 -0
- data/app/views/kaminari/_page.html.erb +6 -0
- data/app/views/kaminari/_paginator.html.erb +15 -0
- data/app/views/layouts/_controls.html.erb +37 -0
- data/app/views/layouts/_header.html.erb +1 -0
- data/app/views/layouts/_navigation.html.erb +27 -0
- data/app/views/layouts/_sections.html.erb +8 -0
- data/app/views/layouts/application.html.erb +83 -0
- data/app/views/pages/about.html.erb +77 -0
- data/app/views/partials/_rdf_logo.html.erb +4 -0
- data/app/views/partials/collection/_member.html.erb +14 -0
- data/app/views/partials/collection_label/_search_result.html.erb +5 -0
- data/app/views/partials/concept/_edit_link_base.html.erb +4 -0
- data/app/views/partials/concept/_inline_base.html.erb +4 -0
- data/app/views/partials/concept/_new_link_base.html.erb +4 -0
- data/app/views/partials/concept/relation/_base.html.erb +8 -0
- data/app/views/partials/concept/relation/_edit_base.html.erb +15 -0
- data/app/views/partials/concept/relation/skos/_narrower.html.erb +12 -0
- data/app/views/partials/concept/relation/skos/broader/_mono.html.erb +28 -0
- data/app/views/partials/concept/relation/skos/broader/_poly.html.erb +14 -0
- data/app/views/partials/labeling/skos/_base.html.erb +17 -0
- data/app/views/partials/labeling/skos/_edit_base.html.erb +7 -0
- data/app/views/partials/labeling/skos/_search_result.html.erb +12 -0
- data/app/views/partials/match/_base.html.erb +13 -0
- data/app/views/partials/match/_edit_base.html.erb +6 -0
- data/app/views/partials/note/_base.html.erb +15 -0
- data/app/views/partials/note/_edit_base.html.erb +28 -0
- data/app/views/partials/note/_note.html.erb +14 -0
- data/app/views/partials/note/_search_result.html.erb +8 -0
- data/app/views/partials/note/skos/_edit_change_note.html.erb +47 -0
- data/app/views/partials/note/skos/definition/_search_result.html.erb +8 -0
- data/app/views/rdf/show_concept.iqrdf +5 -0
- data/app/views/search_results/_head_contents.html.erb +4 -0
- data/app/views/search_results/_rdf_links.html.erb +4 -0
- data/app/views/search_results/index.html.erb +92 -0
- data/app/views/search_results/index.iqrdf +33 -0
- data/app/views/triple_store_syncs/new.html.erb +7 -0
- data/app/views/user_sessions/new.html.erb +11 -0
- data/app/views/users/_form.html.erb +45 -0
- data/app/views/users/_user_preference.html.erb +12 -0
- data/app/views/users/edit.html.erb +14 -0
- data/app/views/users/index.html.erb +29 -0
- data/app/views/users/new.html.erb +13 -0
- data/config/application.rb +82 -0
- data/config/boot.rb +29 -0
- data/config/database.template.yml +43 -0
- data/config/database.yml +40 -0
- data/config/deploy/common.rb +79 -0
- data/config/deploy/ec2.rb +43 -0
- data/config/deploy/history.rb +29 -0
- data/config/deploy/innoq.rb +37 -0
- data/config/deploy.rb +72 -0
- data/config/engine.rb +25 -0
- data/config/environment.rb +21 -0
- data/config/environments/development.rb +74 -0
- data/config/environments/production.rb +65 -0
- data/config/environments/production.template.rb +65 -0
- data/config/environments/production_internal.rb +65 -0
- data/config/environments/test.rb +51 -0
- data/config/initializers/action_view.rb +23 -0
- data/config/initializers/active_record.rb +18 -0
- data/config/initializers/backtrace_silencers.rb +23 -0
- data/config/initializers/inflections.rb +26 -0
- data/config/initializers/iqvoc.rb +50 -0
- data/config/initializers/jdbc.rb +23 -0
- data/config/initializers/kaminari_config.rb +8 -0
- data/config/initializers/language.rb +6 -0
- data/config/initializers/mime_types.rb +24 -0
- data/config/initializers/secret_token.rb +29 -0
- data/config/initializers/secret_token.rb.template +29 -0
- data/config/initializers/session_store.rb +24 -0
- data/config/locales/activerecord.de.yml +135 -0
- data/config/locales/activerecord.en.yml +135 -0
- data/config/locales/authlogic.de.yml +38 -0
- data/config/locales/authlogic.en.yml +38 -0
- data/config/locales/de.yml +326 -0
- data/config/locales/defaults.de.yml +153 -0
- data/config/locales/en.yml +332 -0
- data/config/routes.rb +53 -0
- data/config/warble.rb +158 -0
- data/db/iqvoc_test.sqlite3 +0 -0
- data/db/migrate/20100927101502_create_schema.rb +174 -0
- data/db/migrate/20101125141218_add_collection_tables.rb +32 -0
- data/db/migrate/20101129161528_add_type_to_collections.rb +24 -0
- data/db/migrate/20101202094602_add_origin_to_collections.rb +25 -0
- data/db/migrate/20101202135420_rename_collection_contents_to_collection_members.rb +25 -0
- data/db/migrate/20101208103531_add_type_to_collection_contents.rb +27 -0
- data/db/migrate/20101210153916_add_indexes_to_collections.rb +25 -0
- data/db/migrate/20110204121244_create_collection_labels.rb +32 -0
- data/db/migrate/20110208084250_change_origin_lengths.rb +27 -0
- data/db/migrate/20110328124300_discard_collection_specifics.rb +27 -0
- data/db/migrate/20110408120357_remove_classifications_and_classifiers.rb +32 -0
- data/db/migrate/20110408120740_remove_xl_specfic_stuff.rb +39 -0
- data/db/migrate/20110420133640_change_value_in_notes.rb +8 -0
- data/db/migrate/20110427120534_add_published_at_to_labels.rb +9 -0
- data/db/migrate/20110510162719_use_mono_hierarchy_instead_of_poly_hierarchy.rb +13 -0
- data/db/migrate/20110512132624_extend_notes_value_field_length.rb +8 -0
- data/db/migrate/20110525103100_separate_note_annotation_predicates.rb +38 -0
- data/db/migrate/20110615134040_change_umt_note_annotations_to_dct.rb +9 -0
- data/db/schema.rb +127 -0
- data/db/seeds.rb +37 -0
- data/iqvoc.gemspec +27 -0
- data/lib/engine_tasks/assets.rake +49 -0
- data/lib/engine_tasks/db.rake +18 -0
- data/lib/engine_tasks/release.rake +118 -0
- data/lib/iqvoc/ability.rb +44 -0
- data/lib/iqvoc/data_helper.rb +27 -0
- data/lib/iqvoc/deep_cloning.rb +92 -0
- data/lib/iqvoc/rdf_helper.rb +67 -0
- data/lib/iqvoc/skos_importer.rb +144 -0
- data/lib/iqvoc/version.rb +19 -0
- data/lib/iqvoc/versioning.rb +151 -0
- data/lib/iqvoc.rb +228 -0
- data/lib/maker.rb +144 -0
- data/lib/ojdbc14.jar +0 -0
- data/lib/string.rb +23 -0
- data/lib/tasks/importer.rake +16 -0
- data/lib/tasks/jdbc.rake +24 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +26 -0
- data/public/favicon.ico +0 -0
- data/public/images/iqvoc/add.png +0 -0
- data/public/images/iqvoc/arrow_down.gif +0 -0
- data/public/images/iqvoc/arrow_up.gif +0 -0
- data/public/images/iqvoc/footer.png +0 -0
- data/public/images/iqvoc/go_there.png +0 -0
- data/public/images/iqvoc/header.png +0 -0
- data/public/images/iqvoc/header_long.png +0 -0
- data/public/images/iqvoc/iqvoc.png +0 -0
- data/public/images/iqvoc/note_add.png +0 -0
- data/public/images/iqvoc/note_delete.png +0 -0
- data/public/images/iqvoc/note_edit.png +0 -0
- data/public/images/iqvoc/ok.png +0 -0
- data/public/images/iqvoc/rails.png +0 -0
- data/public/images/iqvoc/rdf_flyer.gif +0 -0
- data/public/images/iqvoc/red_arrow.png +0 -0
- data/public/images/iqvoc/remove.png +0 -0
- data/public/images/iqvoc/shadow.png +0 -0
- data/public/images/iqvoc/spinner.gif +0 -0
- data/public/images/iqvoc/tokenizer_delete.png +0 -0
- data/public/images/iqvoc/tokenizer_pencile.png +0 -0
- data/public/images/iqvoc/tokenizer_show.png +0 -0
- data/public/images/iqvoc/unfinished.png +0 -0
- data/public/javascripts/iqvoc/application.js +123 -0
- data/public/javascripts/iqvoc/entityselect.js +121 -0
- data/public/javascripts/iqvoc/excanvas.js +35 -0
- data/public/javascripts/iqvoc/iqvoc.js +118 -0
- data/public/javascripts/iqvoc/jit_rgraph.js +153 -0
- data/public/javascripts/iqvoc/jquery-1.6.2.min.js +18 -0
- data/public/javascripts/iqvoc/jquery-treeview/changelog.txt +29 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/async.html +44 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/bg.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/demo.js +43 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/images.html +56 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/index.html +340 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/large.html +559 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/prerendered.html +621 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/screen.css +24 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/simple.html +82 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/source.php +87 -0
- data/public/javascripts/iqvoc/jquery-treeview/demo/source.phps +87 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/ajax-loader.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/file.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/folder-closed.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/folder.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/minus.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/plus.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-black-line.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-black.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-default-line.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-default.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-famfamfam-line.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-famfamfam.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-gray-line.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-gray.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-red-line.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/images/treeview-red.gif +0 -0
- data/public/javascripts/iqvoc/jquery-treeview/jquery.treeview.async.js +82 -0
- data/public/javascripts/iqvoc/jquery-treeview/jquery.treeview.css +75 -0
- data/public/javascripts/iqvoc/jquery-treeview/jquery.treeview.js +251 -0
- data/public/javascripts/iqvoc/jquery-treeview/jquery.treeview.min.js +15 -0
- data/public/javascripts/iqvoc/jquery-treeview/jquery.treeview.pack.js +16 -0
- data/public/javascripts/iqvoc/jquery-treeview/lib/jquery.cookie.js +92 -0
- data/public/javascripts/iqvoc/jquery-treeview/lib/jquery.js +3363 -0
- data/public/javascripts/iqvoc/jquery-treeview/todo +8 -0
- data/public/javascripts/iqvoc/jquery-ui-1.8.13.custom.js +3229 -0
- data/public/javascripts/iqvoc/jquery-ui-1.8.13.custom.min.js +163 -0
- data/public/javascripts/iqvoc/jquery-ui.datepicker-de.js +22 -0
- data/public/javascripts/iqvoc/json2.js +480 -0
- data/public/javascripts/iqvoc/langselect.js +73 -0
- data/public/javascripts/iqvoc/rails.js +132 -0
- data/public/javascripts/iqvoc/storage.js +122 -0
- data/public/javascripts/iqvoc/visualization.js +321 -0
- data/public/robots.txt +5 -0
- data/public/stylesheets/iqvoc/blueprint/ie.css +35 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/buttons/icons/cross.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/buttons/icons/key.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/buttons/icons/tick.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/buttons/readme.txt +32 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/buttons/screen.css +97 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/fancy-type/readme.txt +14 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/fancy-type/screen.css +71 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/icons/doc.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/icons/email.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/icons/external.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/icons/feed.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/icons/im.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/icons/pdf.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/icons/visited.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/icons/xls.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/readme.txt +18 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/link-icons/screen.css +40 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/rtl/readme.txt +10 -0
- data/public/stylesheets/iqvoc/blueprint/plugins/rtl/screen.css +110 -0
- data/public/stylesheets/iqvoc/blueprint/print.css +29 -0
- data/public/stylesheets/iqvoc/blueprint/screen.css +258 -0
- data/public/stylesheets/iqvoc/blueprint/src/forms.css +65 -0
- data/public/stylesheets/iqvoc/blueprint/src/grid.css +280 -0
- data/public/stylesheets/iqvoc/blueprint/src/grid.png +0 -0
- data/public/stylesheets/iqvoc/blueprint/src/ie.css +76 -0
- data/public/stylesheets/iqvoc/blueprint/src/print.css +85 -0
- data/public/stylesheets/iqvoc/blueprint/src/reset.css +45 -0
- data/public/stylesheets/iqvoc/blueprint/src/typography.css +106 -0
- data/public/stylesheets/iqvoc/forms.css +71 -0
- data/public/stylesheets/iqvoc/images/back.png +0 -0
- data/public/stylesheets/iqvoc/images/branch.png +0 -0
- data/public/stylesheets/iqvoc/images/categ.png +0 -0
- data/public/stylesheets/iqvoc/images/categ_open.png +0 -0
- data/public/stylesheets/iqvoc/images/go_there.png +0 -0
- data/public/stylesheets/iqvoc/images/iqvoc.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_end.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_end_filled.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_mid.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_mid_filled.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_nothing.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_only.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_only_filled.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_top.png +0 -0
- data/public/stylesheets/iqvoc/images/leaf_top_filled.png +0 -0
- data/public/stylesheets/iqvoc/images/nothing.png +0 -0
- data/public/stylesheets/iqvoc/images/top_01.png +0 -0
- data/public/stylesheets/iqvoc/images/trunk.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-icons_217bc0_256x240.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-icons_2e83ff_256x240.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-icons_469bdd_256x240.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-icons_6da8d5_256x240.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-icons_d8e7f3_256x240.png +0 -0
- data/public/stylesheets/iqvoc/images/ui-icons_f9bd01_256x240.png +0 -0
- data/public/stylesheets/iqvoc/iqvoc.css +477 -0
- data/public/stylesheets/iqvoc/jquery-ui-1.8.13.custom.css +415 -0
- data/public/stylesheets/iqvoc/widgets.css +81 -0
- data/test/factories.rb +74 -0
- data/test/integration/alphabetical_test.rb +53 -0
- data/test/integration/authentication_test.rb +41 -0
- data/test/integration/browse_concepts_and_labels_test.rb +61 -0
- data/test/integration/browse_static_pages_test.rb +29 -0
- data/test/integration/client_augmentation_test.rb +42 -0
- data/test/integration/client_edit_concept_test.rb +72 -0
- data/test/integration/collection_circularity_test.rb +110 -0
- data/test/integration/concept_test.rb +61 -0
- data/test/integration/edit_concepts_test.rb +40 -0
- data/test/integration/note_annotations_test.rb +86 -0
- data/test/integration/search_test.rb +205 -0
- data/test/integration/tree_test.rb +31 -0
- data/test/integration/untranslated_test.rb +60 -0
- data/test/integration_test_helper.rb +45 -0
- data/test/performance/browsing_test.rb +25 -0
- data/test/test_helper.rb +29 -0
- data/test/unit/concept_test.rb +93 -0
- data/test/unit/note_test.rb +32 -0
- data/test/unit/origin_mapping_test.rb +70 -0
- data/test/unit/skos_import_test.rb +100 -0
- metadata +522 -0
@@ -0,0 +1,480 @@
|
|
1
|
+
/*
|
2
|
+
http://www.JSON.org/json2.js
|
3
|
+
2011-02-23
|
4
|
+
|
5
|
+
Public Domain.
|
6
|
+
|
7
|
+
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
8
|
+
|
9
|
+
See http://www.JSON.org/js.html
|
10
|
+
|
11
|
+
|
12
|
+
This code should be minified before deployment.
|
13
|
+
See http://javascript.crockford.com/jsmin.html
|
14
|
+
|
15
|
+
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
|
16
|
+
NOT CONTROL.
|
17
|
+
|
18
|
+
|
19
|
+
This file creates a global JSON object containing two methods: stringify
|
20
|
+
and parse.
|
21
|
+
|
22
|
+
JSON.stringify(value, replacer, space)
|
23
|
+
value any JavaScript value, usually an object or array.
|
24
|
+
|
25
|
+
replacer an optional parameter that determines how object
|
26
|
+
values are stringified for objects. It can be a
|
27
|
+
function or an array of strings.
|
28
|
+
|
29
|
+
space an optional parameter that specifies the indentation
|
30
|
+
of nested structures. If it is omitted, the text will
|
31
|
+
be packed without extra whitespace. If it is a number,
|
32
|
+
it will specify the number of spaces to indent at each
|
33
|
+
level. If it is a string (such as '\t' or ' '),
|
34
|
+
it contains the characters used to indent at each level.
|
35
|
+
|
36
|
+
This method produces a JSON text from a JavaScript value.
|
37
|
+
|
38
|
+
When an object value is found, if the object contains a toJSON
|
39
|
+
method, its toJSON method will be called and the result will be
|
40
|
+
stringified. A toJSON method does not serialize: it returns the
|
41
|
+
value represented by the name/value pair that should be serialized,
|
42
|
+
or undefined if nothing should be serialized. The toJSON method
|
43
|
+
will be passed the key associated with the value, and this will be
|
44
|
+
bound to the value
|
45
|
+
|
46
|
+
For example, this would serialize Dates as ISO strings.
|
47
|
+
|
48
|
+
Date.prototype.toJSON = function (key) {
|
49
|
+
function f(n) {
|
50
|
+
// Format integers to have at least two digits.
|
51
|
+
return n < 10 ? '0' + n : n;
|
52
|
+
}
|
53
|
+
|
54
|
+
return this.getUTCFullYear() + '-' +
|
55
|
+
f(this.getUTCMonth() + 1) + '-' +
|
56
|
+
f(this.getUTCDate()) + 'T' +
|
57
|
+
f(this.getUTCHours()) + ':' +
|
58
|
+
f(this.getUTCMinutes()) + ':' +
|
59
|
+
f(this.getUTCSeconds()) + 'Z';
|
60
|
+
};
|
61
|
+
|
62
|
+
You can provide an optional replacer method. It will be passed the
|
63
|
+
key and value of each member, with this bound to the containing
|
64
|
+
object. The value that is returned from your method will be
|
65
|
+
serialized. If your method returns undefined, then the member will
|
66
|
+
be excluded from the serialization.
|
67
|
+
|
68
|
+
If the replacer parameter is an array of strings, then it will be
|
69
|
+
used to select the members to be serialized. It filters the results
|
70
|
+
such that only members with keys listed in the replacer array are
|
71
|
+
stringified.
|
72
|
+
|
73
|
+
Values that do not have JSON representations, such as undefined or
|
74
|
+
functions, will not be serialized. Such values in objects will be
|
75
|
+
dropped; in arrays they will be replaced with null. You can use
|
76
|
+
a replacer function to replace those with JSON values.
|
77
|
+
JSON.stringify(undefined) returns undefined.
|
78
|
+
|
79
|
+
The optional space parameter produces a stringification of the
|
80
|
+
value that is filled with line breaks and indentation to make it
|
81
|
+
easier to read.
|
82
|
+
|
83
|
+
If the space parameter is a non-empty string, then that string will
|
84
|
+
be used for indentation. If the space parameter is a number, then
|
85
|
+
the indentation will be that many spaces.
|
86
|
+
|
87
|
+
Example:
|
88
|
+
|
89
|
+
text = JSON.stringify(['e', {pluribus: 'unum'}]);
|
90
|
+
// text is '["e",{"pluribus":"unum"}]'
|
91
|
+
|
92
|
+
|
93
|
+
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
|
94
|
+
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
|
95
|
+
|
96
|
+
text = JSON.stringify([new Date()], function (key, value) {
|
97
|
+
return this[key] instanceof Date ?
|
98
|
+
'Date(' + this[key] + ')' : value;
|
99
|
+
});
|
100
|
+
// text is '["Date(---current time---)"]'
|
101
|
+
|
102
|
+
|
103
|
+
JSON.parse(text, reviver)
|
104
|
+
This method parses a JSON text to produce an object or array.
|
105
|
+
It can throw a SyntaxError exception.
|
106
|
+
|
107
|
+
The optional reviver parameter is a function that can filter and
|
108
|
+
transform the results. It receives each of the keys and values,
|
109
|
+
and its return value is used instead of the original value.
|
110
|
+
If it returns what it received, then the structure is not modified.
|
111
|
+
If it returns undefined then the member is deleted.
|
112
|
+
|
113
|
+
Example:
|
114
|
+
|
115
|
+
// Parse the text. Values that look like ISO date strings will
|
116
|
+
// be converted to Date objects.
|
117
|
+
|
118
|
+
myData = JSON.parse(text, function (key, value) {
|
119
|
+
var a;
|
120
|
+
if (typeof value === 'string') {
|
121
|
+
a =
|
122
|
+
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
|
123
|
+
if (a) {
|
124
|
+
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
|
125
|
+
+a[5], +a[6]));
|
126
|
+
}
|
127
|
+
}
|
128
|
+
return value;
|
129
|
+
});
|
130
|
+
|
131
|
+
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
|
132
|
+
var d;
|
133
|
+
if (typeof value === 'string' &&
|
134
|
+
value.slice(0, 5) === 'Date(' &&
|
135
|
+
value.slice(-1) === ')') {
|
136
|
+
d = new Date(value.slice(5, -1));
|
137
|
+
if (d) {
|
138
|
+
return d;
|
139
|
+
}
|
140
|
+
}
|
141
|
+
return value;
|
142
|
+
});
|
143
|
+
|
144
|
+
|
145
|
+
This is a reference implementation. You are free to copy, modify, or
|
146
|
+
redistribute.
|
147
|
+
*/
|
148
|
+
|
149
|
+
/*jslint evil: true, strict: false, regexp: false */
|
150
|
+
|
151
|
+
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
|
152
|
+
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
|
153
|
+
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
|
154
|
+
lastIndex, length, parse, prototype, push, replace, slice, stringify,
|
155
|
+
test, toJSON, toString, valueOf
|
156
|
+
*/
|
157
|
+
|
158
|
+
|
159
|
+
// Create a JSON object only if one does not already exist. We create the
|
160
|
+
// methods in a closure to avoid creating global variables.
|
161
|
+
|
162
|
+
var JSON;
|
163
|
+
if (!JSON) {
|
164
|
+
JSON = {};
|
165
|
+
}
|
166
|
+
|
167
|
+
(function () {
|
168
|
+
"use strict";
|
169
|
+
|
170
|
+
function f(n) {
|
171
|
+
// Format integers to have at least two digits.
|
172
|
+
return n < 10 ? '0' + n : n;
|
173
|
+
}
|
174
|
+
|
175
|
+
if (typeof Date.prototype.toJSON !== 'function') {
|
176
|
+
|
177
|
+
Date.prototype.toJSON = function (key) {
|
178
|
+
|
179
|
+
return isFinite(this.valueOf()) ?
|
180
|
+
this.getUTCFullYear() + '-' +
|
181
|
+
f(this.getUTCMonth() + 1) + '-' +
|
182
|
+
f(this.getUTCDate()) + 'T' +
|
183
|
+
f(this.getUTCHours()) + ':' +
|
184
|
+
f(this.getUTCMinutes()) + ':' +
|
185
|
+
f(this.getUTCSeconds()) + 'Z' : null;
|
186
|
+
};
|
187
|
+
|
188
|
+
String.prototype.toJSON =
|
189
|
+
Number.prototype.toJSON =
|
190
|
+
Boolean.prototype.toJSON = function (key) {
|
191
|
+
return this.valueOf();
|
192
|
+
};
|
193
|
+
}
|
194
|
+
|
195
|
+
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
196
|
+
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
197
|
+
gap,
|
198
|
+
indent,
|
199
|
+
meta = { // table of character substitutions
|
200
|
+
'\b': '\\b',
|
201
|
+
'\t': '\\t',
|
202
|
+
'\n': '\\n',
|
203
|
+
'\f': '\\f',
|
204
|
+
'\r': '\\r',
|
205
|
+
'"' : '\\"',
|
206
|
+
'\\': '\\\\'
|
207
|
+
},
|
208
|
+
rep;
|
209
|
+
|
210
|
+
|
211
|
+
function quote(string) {
|
212
|
+
|
213
|
+
// If the string contains no control characters, no quote characters, and no
|
214
|
+
// backslash characters, then we can safely slap some quotes around it.
|
215
|
+
// Otherwise we must also replace the offending characters with safe escape
|
216
|
+
// sequences.
|
217
|
+
|
218
|
+
escapable.lastIndex = 0;
|
219
|
+
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
|
220
|
+
var c = meta[a];
|
221
|
+
return typeof c === 'string' ? c :
|
222
|
+
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
223
|
+
}) + '"' : '"' + string + '"';
|
224
|
+
}
|
225
|
+
|
226
|
+
|
227
|
+
function str(key, holder) {
|
228
|
+
|
229
|
+
// Produce a string from holder[key].
|
230
|
+
|
231
|
+
var i, // The loop counter.
|
232
|
+
k, // The member key.
|
233
|
+
v, // The member value.
|
234
|
+
length,
|
235
|
+
mind = gap,
|
236
|
+
partial,
|
237
|
+
value = holder[key];
|
238
|
+
|
239
|
+
// If the value has a toJSON method, call it to obtain a replacement value.
|
240
|
+
|
241
|
+
if (value && typeof value === 'object' &&
|
242
|
+
typeof value.toJSON === 'function') {
|
243
|
+
value = value.toJSON(key);
|
244
|
+
}
|
245
|
+
|
246
|
+
// If we were called with a replacer function, then call the replacer to
|
247
|
+
// obtain a replacement value.
|
248
|
+
|
249
|
+
if (typeof rep === 'function') {
|
250
|
+
value = rep.call(holder, key, value);
|
251
|
+
}
|
252
|
+
|
253
|
+
// What happens next depends on the value's type.
|
254
|
+
|
255
|
+
switch (typeof value) {
|
256
|
+
case 'string':
|
257
|
+
return quote(value);
|
258
|
+
|
259
|
+
case 'number':
|
260
|
+
|
261
|
+
// JSON numbers must be finite. Encode non-finite numbers as null.
|
262
|
+
|
263
|
+
return isFinite(value) ? String(value) : 'null';
|
264
|
+
|
265
|
+
case 'boolean':
|
266
|
+
case 'null':
|
267
|
+
|
268
|
+
// If the value is a boolean or null, convert it to a string. Note:
|
269
|
+
// typeof null does not produce 'null'. The case is included here in
|
270
|
+
// the remote chance that this gets fixed someday.
|
271
|
+
|
272
|
+
return String(value);
|
273
|
+
|
274
|
+
// If the type is 'object', we might be dealing with an object or an array or
|
275
|
+
// null.
|
276
|
+
|
277
|
+
case 'object':
|
278
|
+
|
279
|
+
// Due to a specification blunder in ECMAScript, typeof null is 'object',
|
280
|
+
// so watch out for that case.
|
281
|
+
|
282
|
+
if (!value) {
|
283
|
+
return 'null';
|
284
|
+
}
|
285
|
+
|
286
|
+
// Make an array to hold the partial results of stringifying this object value.
|
287
|
+
|
288
|
+
gap += indent;
|
289
|
+
partial = [];
|
290
|
+
|
291
|
+
// Is the value an array?
|
292
|
+
|
293
|
+
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
294
|
+
|
295
|
+
// The value is an array. Stringify every element. Use null as a placeholder
|
296
|
+
// for non-JSON values.
|
297
|
+
|
298
|
+
length = value.length;
|
299
|
+
for (i = 0; i < length; i += 1) {
|
300
|
+
partial[i] = str(i, value) || 'null';
|
301
|
+
}
|
302
|
+
|
303
|
+
// Join all of the elements together, separated with commas, and wrap them in
|
304
|
+
// brackets.
|
305
|
+
|
306
|
+
v = partial.length === 0 ? '[]' : gap ?
|
307
|
+
'[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
|
308
|
+
'[' + partial.join(',') + ']';
|
309
|
+
gap = mind;
|
310
|
+
return v;
|
311
|
+
}
|
312
|
+
|
313
|
+
// If the replacer is an array, use it to select the members to be stringified.
|
314
|
+
|
315
|
+
if (rep && typeof rep === 'object') {
|
316
|
+
length = rep.length;
|
317
|
+
for (i = 0; i < length; i += 1) {
|
318
|
+
if (typeof rep[i] === 'string') {
|
319
|
+
k = rep[i];
|
320
|
+
v = str(k, value);
|
321
|
+
if (v) {
|
322
|
+
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
323
|
+
}
|
324
|
+
}
|
325
|
+
}
|
326
|
+
} else {
|
327
|
+
|
328
|
+
// Otherwise, iterate through all of the keys in the object.
|
329
|
+
|
330
|
+
for (k in value) {
|
331
|
+
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
332
|
+
v = str(k, value);
|
333
|
+
if (v) {
|
334
|
+
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
335
|
+
}
|
336
|
+
}
|
337
|
+
}
|
338
|
+
}
|
339
|
+
|
340
|
+
// Join all of the member texts together, separated with commas,
|
341
|
+
// and wrap them in braces.
|
342
|
+
|
343
|
+
v = partial.length === 0 ? '{}' : gap ?
|
344
|
+
'{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
|
345
|
+
'{' + partial.join(',') + '}';
|
346
|
+
gap = mind;
|
347
|
+
return v;
|
348
|
+
}
|
349
|
+
}
|
350
|
+
|
351
|
+
// If the JSON object does not yet have a stringify method, give it one.
|
352
|
+
|
353
|
+
if (typeof JSON.stringify !== 'function') {
|
354
|
+
JSON.stringify = function (value, replacer, space) {
|
355
|
+
|
356
|
+
// The stringify method takes a value and an optional replacer, and an optional
|
357
|
+
// space parameter, and returns a JSON text. The replacer can be a function
|
358
|
+
// that can replace values, or an array of strings that will select the keys.
|
359
|
+
// A default replacer method can be provided. Use of the space parameter can
|
360
|
+
// produce text that is more easily readable.
|
361
|
+
|
362
|
+
var i;
|
363
|
+
gap = '';
|
364
|
+
indent = '';
|
365
|
+
|
366
|
+
// If the space parameter is a number, make an indent string containing that
|
367
|
+
// many spaces.
|
368
|
+
|
369
|
+
if (typeof space === 'number') {
|
370
|
+
for (i = 0; i < space; i += 1) {
|
371
|
+
indent += ' ';
|
372
|
+
}
|
373
|
+
|
374
|
+
// If the space parameter is a string, it will be used as the indent string.
|
375
|
+
|
376
|
+
} else if (typeof space === 'string') {
|
377
|
+
indent = space;
|
378
|
+
}
|
379
|
+
|
380
|
+
// If there is a replacer, it must be a function or an array.
|
381
|
+
// Otherwise, throw an error.
|
382
|
+
|
383
|
+
rep = replacer;
|
384
|
+
if (replacer && typeof replacer !== 'function' &&
|
385
|
+
(typeof replacer !== 'object' ||
|
386
|
+
typeof replacer.length !== 'number')) {
|
387
|
+
throw new Error('JSON.stringify');
|
388
|
+
}
|
389
|
+
|
390
|
+
// Make a fake root object containing our value under the key of ''.
|
391
|
+
// Return the result of stringifying the value.
|
392
|
+
|
393
|
+
return str('', {'': value});
|
394
|
+
};
|
395
|
+
}
|
396
|
+
|
397
|
+
|
398
|
+
// If the JSON object does not yet have a parse method, give it one.
|
399
|
+
|
400
|
+
if (typeof JSON.parse !== 'function') {
|
401
|
+
JSON.parse = function (text, reviver) {
|
402
|
+
|
403
|
+
// The parse method takes a text and an optional reviver function, and returns
|
404
|
+
// a JavaScript value if the text is a valid JSON text.
|
405
|
+
|
406
|
+
var j;
|
407
|
+
|
408
|
+
function walk(holder, key) {
|
409
|
+
|
410
|
+
// The walk method is used to recursively walk the resulting structure so
|
411
|
+
// that modifications can be made.
|
412
|
+
|
413
|
+
var k, v, value = holder[key];
|
414
|
+
if (value && typeof value === 'object') {
|
415
|
+
for (k in value) {
|
416
|
+
if (Object.prototype.hasOwnProperty.call(value, k)) {
|
417
|
+
v = walk(value, k);
|
418
|
+
if (v !== undefined) {
|
419
|
+
value[k] = v;
|
420
|
+
} else {
|
421
|
+
delete value[k];
|
422
|
+
}
|
423
|
+
}
|
424
|
+
}
|
425
|
+
}
|
426
|
+
return reviver.call(holder, key, value);
|
427
|
+
}
|
428
|
+
|
429
|
+
|
430
|
+
// Parsing happens in four stages. In the first stage, we replace certain
|
431
|
+
// Unicode characters with escape sequences. JavaScript handles many characters
|
432
|
+
// incorrectly, either silently deleting them, or treating them as line endings.
|
433
|
+
|
434
|
+
text = String(text);
|
435
|
+
cx.lastIndex = 0;
|
436
|
+
if (cx.test(text)) {
|
437
|
+
text = text.replace(cx, function (a) {
|
438
|
+
return '\\u' +
|
439
|
+
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
440
|
+
});
|
441
|
+
}
|
442
|
+
|
443
|
+
// In the second stage, we run the text against regular expressions that look
|
444
|
+
// for non-JSON patterns. We are especially concerned with '()' and 'new'
|
445
|
+
// because they can cause invocation, and '=' because it can cause mutation.
|
446
|
+
// But just to be safe, we want to reject all unexpected forms.
|
447
|
+
|
448
|
+
// We split the second stage into 4 regexp operations in order to work around
|
449
|
+
// crippling inefficiencies in IE's and Safari's regexp engines. First we
|
450
|
+
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
|
451
|
+
// replace all simple value tokens with ']' characters. Third, we delete all
|
452
|
+
// open brackets that follow a colon or comma or that begin the text. Finally,
|
453
|
+
// we look to see that the remaining characters are only whitespace or ']' or
|
454
|
+
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
|
455
|
+
|
456
|
+
if (/^[\],:{}\s]*$/
|
457
|
+
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
|
458
|
+
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
|
459
|
+
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
460
|
+
|
461
|
+
// In the third stage we use the eval function to compile the text into a
|
462
|
+
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
|
463
|
+
// in JavaScript: it can begin a block or an object literal. We wrap the text
|
464
|
+
// in parens to eliminate the ambiguity.
|
465
|
+
|
466
|
+
j = eval('(' + text + ')');
|
467
|
+
|
468
|
+
// In the optional fourth stage, we recursively walk the new structure, passing
|
469
|
+
// each name/value pair to a reviver function for possible transformation.
|
470
|
+
|
471
|
+
return typeof reviver === 'function' ?
|
472
|
+
walk({'': j}, '') : j;
|
473
|
+
}
|
474
|
+
|
475
|
+
// If the text is not JSON parseable, then a SyntaxError is thrown.
|
476
|
+
|
477
|
+
throw new SyntaxError('JSON.parse');
|
478
|
+
};
|
479
|
+
}
|
480
|
+
}());
|
@@ -0,0 +1,73 @@
|
|
1
|
+
/*jslint vars: true, unparam: true, browser: true */
|
2
|
+
/*global jQuery, IQVOC */
|
3
|
+
|
4
|
+
IQVOC.LanguageSelector = (function($) {
|
5
|
+
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
var getSelection, setSelection;
|
9
|
+
|
10
|
+
// namespace is used for both localStorage and the event being triggered
|
11
|
+
var LanguageSelector = function(container, namespace) {
|
12
|
+
this.container = container;
|
13
|
+
this.namespace = namespace;
|
14
|
+
this.langs = getSelection(namespace);
|
15
|
+
this.checkboxes = $("input:checkbox", container)
|
16
|
+
.live("change", this.onChange);
|
17
|
+
|
18
|
+
$(container).addClass("widget").data("widget", this);
|
19
|
+
this.init();
|
20
|
+
};
|
21
|
+
$.extend(LanguageSelector.prototype, {
|
22
|
+
onChange: function(ev) {
|
23
|
+
var el = $(this),
|
24
|
+
widget = el.closest(".widget").data("widget");
|
25
|
+
if(this.checked) {
|
26
|
+
widget.add(el.val());
|
27
|
+
} else {
|
28
|
+
widget.remove(el.val());
|
29
|
+
}
|
30
|
+
},
|
31
|
+
init: function() {
|
32
|
+
if(this.langs === null) {
|
33
|
+
this.langs = $.map(this.checkboxes, function(node, i) {
|
34
|
+
return $(node).val();
|
35
|
+
});
|
36
|
+
}
|
37
|
+
var self = this;
|
38
|
+
this.checkboxes.each(function(i, node) {
|
39
|
+
node.checked = $.inArray($(node).val(), self.langs) !== -1;
|
40
|
+
});
|
41
|
+
this.notify();
|
42
|
+
},
|
43
|
+
notify: function() {
|
44
|
+
$(document).trigger(this.namespace, { langs: this.langs });
|
45
|
+
},
|
46
|
+
add: function(value) {
|
47
|
+
if($.inArray(value, this.langs) === -1) {
|
48
|
+
this.langs.push(value);
|
49
|
+
setSelection(this.langs, this.namespace, this);
|
50
|
+
}
|
51
|
+
},
|
52
|
+
remove: function(value) {
|
53
|
+
var pos = $.inArray(value, this.langs);
|
54
|
+
if(pos !== -1) {
|
55
|
+
this.langs.splice(pos, 1);
|
56
|
+
setSelection(this.langs, this.namespace, this);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
});
|
60
|
+
|
61
|
+
getSelection = function(namespace) {
|
62
|
+
var langs = IQVOC.Storage.getItem(namespace);
|
63
|
+
return langs === null ? null : (langs ? langs.split(",") : []);
|
64
|
+
};
|
65
|
+
|
66
|
+
setSelection = function(langs, namespace, context) {
|
67
|
+
IQVOC.Storage.setItem(namespace, langs.join(","));
|
68
|
+
context.notify();
|
69
|
+
};
|
70
|
+
|
71
|
+
return LanguageSelector;
|
72
|
+
|
73
|
+
}(jQuery));
|
@@ -0,0 +1,132 @@
|
|
1
|
+
jQuery(function ($) {
|
2
|
+
var csrf_token = $('meta[name=csrf-token]').attr('content'),
|
3
|
+
csrf_param = $('meta[name=csrf-param]').attr('content');
|
4
|
+
|
5
|
+
$.fn.extend({
|
6
|
+
/**
|
7
|
+
* Triggers a custom event on an element and returns the event result
|
8
|
+
* this is used to get around not being able to ensure callbacks are placed
|
9
|
+
* at the end of the chain.
|
10
|
+
*
|
11
|
+
* TODO: deprecate with jQuery 1.4.2 release, in favor of subscribing to our
|
12
|
+
* own events and placing ourselves at the end of the chain.
|
13
|
+
*/
|
14
|
+
triggerAndReturn: function (name, data) {
|
15
|
+
var event = new $.Event(name);
|
16
|
+
this.trigger(event, data);
|
17
|
+
|
18
|
+
return event.result !== false;
|
19
|
+
},
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Handles execution of remote calls firing overridable events along the way
|
23
|
+
*/
|
24
|
+
callRemote: function () {
|
25
|
+
var el = this,
|
26
|
+
method = el.attr('method') || el.attr('data-method') || 'GET',
|
27
|
+
url = el.attr('action') || el.attr('href'),
|
28
|
+
dataType = el.attr('data-type') || 'script';
|
29
|
+
|
30
|
+
if (url === undefined) {
|
31
|
+
throw "No URL specified for remote call (action or href must be present).";
|
32
|
+
} else {
|
33
|
+
if (el.triggerAndReturn('ajax:before')) {
|
34
|
+
var data = el.is('form') ? el.serializeArray() : [];
|
35
|
+
$.ajax({
|
36
|
+
url: url,
|
37
|
+
data: data,
|
38
|
+
dataType: dataType,
|
39
|
+
type: method.toUpperCase(),
|
40
|
+
beforeSend: function (xhr) {
|
41
|
+
el.trigger('ajax:loading', xhr);
|
42
|
+
},
|
43
|
+
success: function (data, status, xhr) {
|
44
|
+
el.trigger('ajax:success', [data, status, xhr]);
|
45
|
+
},
|
46
|
+
complete: function (xhr) {
|
47
|
+
el.trigger('ajax:complete', xhr);
|
48
|
+
},
|
49
|
+
error: function (xhr, status, error) {
|
50
|
+
el.trigger('ajax:failure', [xhr, status, error]);
|
51
|
+
}
|
52
|
+
});
|
53
|
+
}
|
54
|
+
|
55
|
+
el.trigger('ajax:after');
|
56
|
+
}
|
57
|
+
}
|
58
|
+
});
|
59
|
+
|
60
|
+
/**
|
61
|
+
* confirmation handler
|
62
|
+
*/
|
63
|
+
$('a[data-confirm],input[data-confirm]').live('click', function () {
|
64
|
+
var el = $(this);
|
65
|
+
if (el.triggerAndReturn('confirm')) {
|
66
|
+
if (!confirm(el.attr('data-confirm'))) {
|
67
|
+
return false;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
});
|
71
|
+
|
72
|
+
|
73
|
+
/**
|
74
|
+
* remote handlers
|
75
|
+
*/
|
76
|
+
$('form[data-remote]').live('submit', function (e) {
|
77
|
+
$(this).callRemote();
|
78
|
+
e.preventDefault();
|
79
|
+
});
|
80
|
+
|
81
|
+
$('a[data-remote],input[data-remote]').live('click', function (e) {
|
82
|
+
$(this).callRemote();
|
83
|
+
e.preventDefault();
|
84
|
+
});
|
85
|
+
|
86
|
+
$('a[data-method]:not([data-remote])').live('click', function (e){
|
87
|
+
var link = $(this),
|
88
|
+
href = link.attr('href'),
|
89
|
+
method = link.attr('data-method'),
|
90
|
+
form = $('<form method="post" action="'+href+'"></form>'),
|
91
|
+
metadata_input = '<input name="_method" value="'+method+'" type="hidden" />';
|
92
|
+
|
93
|
+
if (csrf_param != null && csrf_token != null) {
|
94
|
+
metadata_input += '<input name="'+csrf_param+'" value="'+csrf_token+'" type="hidden" />';
|
95
|
+
}
|
96
|
+
|
97
|
+
form.hide()
|
98
|
+
.append(metadata_input)
|
99
|
+
.appendTo('body');
|
100
|
+
|
101
|
+
e.preventDefault();
|
102
|
+
form.submit();
|
103
|
+
});
|
104
|
+
|
105
|
+
/**
|
106
|
+
* disable-with handlers
|
107
|
+
*/
|
108
|
+
var disable_with_input_selector = 'input[data-disable-with]';
|
109
|
+
var disable_with_form_remote_selector = 'form[data-remote]:has(' + disable_with_input_selector + ')';
|
110
|
+
var disable_with_form_not_remote_selector = 'form:not([data-remote]):has(' + disable_with_input_selector + ')';
|
111
|
+
|
112
|
+
var disable_with_input_function = function () {
|
113
|
+
$(this).find(disable_with_input_selector).each(function () {
|
114
|
+
var input = $(this);
|
115
|
+
input.data('enable-with', input.val())
|
116
|
+
.attr('value', input.attr('data-disable-with'))
|
117
|
+
.attr('disabled', 'disabled');
|
118
|
+
});
|
119
|
+
};
|
120
|
+
|
121
|
+
$(disable_with_form_remote_selector).live('ajax:before', disable_with_input_function);
|
122
|
+
$(disable_with_form_not_remote_selector).live('submit', disable_with_input_function);
|
123
|
+
|
124
|
+
$(disable_with_form_remote_selector).live('ajax:complete', function () {
|
125
|
+
$(this).find(disable_with_input_selector).each(function () {
|
126
|
+
var input = $(this);
|
127
|
+
input.removeAttr('disabled')
|
128
|
+
.val(input.data('enable-with'));
|
129
|
+
});
|
130
|
+
});
|
131
|
+
|
132
|
+
});
|