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,48 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
class UserSessionsController < ApplicationController
|
18
|
+
|
19
|
+
skip_before_filter :require_user, :only => [:new, :create]
|
20
|
+
|
21
|
+
def new
|
22
|
+
# TODO Check abilities
|
23
|
+
|
24
|
+
@user_session = UserSession.new
|
25
|
+
end
|
26
|
+
|
27
|
+
def create
|
28
|
+
# TODO Check abilities
|
29
|
+
|
30
|
+
@user_session = UserSession.new(params[:user_session])
|
31
|
+
if @user_session.save
|
32
|
+
flash[:notice] = I18n.t("txt.controllers.user_sessions.login_success")
|
33
|
+
redirect_to params[:back_to] || (can?(:use, :dashboard) ? dashboard_url : root_path)
|
34
|
+
else
|
35
|
+
flash[:error] = I18n.t("txt.views.user_sessions.error")
|
36
|
+
render :action => :new
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def destroy
|
41
|
+
# TODO Check abilities
|
42
|
+
|
43
|
+
current_user_session.destroy
|
44
|
+
flash[:notice] = I18n.t("txt.controllers.user_sessions.logout_success")
|
45
|
+
redirect_to root_path
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
class UsersController < ApplicationController
|
18
|
+
|
19
|
+
load_and_authorize_resource # cancan magic
|
20
|
+
|
21
|
+
def index
|
22
|
+
@users = User.find(:all)
|
23
|
+
|
24
|
+
respond_to do |format|
|
25
|
+
format.html # index.html.erb
|
26
|
+
format.xml { render :xml => @users }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def new
|
31
|
+
@user = User.new
|
32
|
+
|
33
|
+
respond_to do |format|
|
34
|
+
format.html # new.html.erb
|
35
|
+
format.xml { render :xml => @user }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def create
|
40
|
+
@user = User.new(params[:user])
|
41
|
+
|
42
|
+
respond_to do |format|
|
43
|
+
if @user.save
|
44
|
+
flash[:notice] = I18n.t('txt.controllers.users.successfully_created')
|
45
|
+
format.html { redirect_to users_path }
|
46
|
+
else
|
47
|
+
format.html { render :action => "new" }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def edit
|
53
|
+
@user = User.find(params[:id])
|
54
|
+
end
|
55
|
+
|
56
|
+
def update
|
57
|
+
@user = User.find(params[:id])
|
58
|
+
|
59
|
+
respond_to do |format|
|
60
|
+
if @user.update_attributes(params[:user])
|
61
|
+
flash[:notice] = I18n.t('txt.controllers.users.successfully_updated')
|
62
|
+
format.html { redirect_to edit_user_path(:id => @user) }
|
63
|
+
format.xml { head :ok }
|
64
|
+
else
|
65
|
+
format.html { render :action => "edit" }
|
66
|
+
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def destroy
|
72
|
+
@user = User.find(params[:id])
|
73
|
+
@user.destroy
|
74
|
+
|
75
|
+
respond_to do |format|
|
76
|
+
format.html { redirect_to users_path }
|
77
|
+
format.xml { head :ok }
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
module ApplicationHelper
|
18
|
+
|
19
|
+
def iqvoc_default_rdf_namespaces
|
20
|
+
Iqvoc.rdf_namespaces.merge({
|
21
|
+
:default => root_url(:format => nil, :lang => nil, :trailing_slash => true).gsub(/\/\/$/, "/"), # gsub because of a Rails bug :-(
|
22
|
+
:coll => collections_url(:trailing_slash => true, :lang => nil, :format => nil),
|
23
|
+
:schema => controller.schema_url(:format => nil, :anchor => "", :lang => nil)
|
24
|
+
})
|
25
|
+
end
|
26
|
+
|
27
|
+
def options_for_language_select(selected = nil)
|
28
|
+
locales_collection = Iqvoc.available_languages.map { |l| [l.to_s, l.to_s] }
|
29
|
+
|
30
|
+
options_for_select(locales_collection, selected)
|
31
|
+
end
|
32
|
+
|
33
|
+
def user_details(user)
|
34
|
+
"#{user.name} (#{user.telephone_number})"
|
35
|
+
end
|
36
|
+
|
37
|
+
# Formats a list ob items or returns a remark if no items where given
|
38
|
+
def item_listing(items, &block)
|
39
|
+
return content_tag :p, "-", :class => 'term-unavailable' if items.empty?
|
40
|
+
|
41
|
+
content_tag :ul, :class => "entity_list" do
|
42
|
+
items.map do |item|
|
43
|
+
content_tag :li do
|
44
|
+
block.call(item)
|
45
|
+
end
|
46
|
+
end.join("\n").html_safe
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def error_messages_for(object)
|
51
|
+
if object.errors.any?
|
52
|
+
content_tag :ul, :class => "flash_error error_list" do
|
53
|
+
object.errors.full_messages.each do |msg|
|
54
|
+
concat(content_tag(:li, msg))
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
module ConceptsHelper
|
18
|
+
|
19
|
+
# if `broader` is supplied, the tree's direction is reversed (descendants represent broader relations)
|
20
|
+
def treeview(concepts, broader = false)
|
21
|
+
render :partial => "concepts/hierarchical/treeview",
|
22
|
+
:locals => { :concepts => concepts, :broader => broader }
|
23
|
+
end
|
24
|
+
|
25
|
+
def letter_selector(&block)
|
26
|
+
letters = ('A'..'Z').to_a +
|
27
|
+
(0..9).to_a +
|
28
|
+
['[']
|
29
|
+
|
30
|
+
content_tag :ul, :class => 'letter_selector' do
|
31
|
+
html = ""
|
32
|
+
letters.each do |letter|
|
33
|
+
html += content_tag(:li, link_to(letter, yield(letter)),
|
34
|
+
:class => "ui-corner-all ui-widget-content" +
|
35
|
+
((params[:letter] == letter.to_s.downcase) ? " ui-state-active" : ""))
|
36
|
+
end
|
37
|
+
html.html_safe
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Renders associated objects of a given concept to a hash structure.
|
42
|
+
# This hash is taken by view/layouts/_sections to be rendered.
|
43
|
+
def concept_view_data(concept)
|
44
|
+
res = {}
|
45
|
+
|
46
|
+
render_concept_association(res, concept, Collection::Member::Concept)
|
47
|
+
|
48
|
+
Iqvoc::Concept.labeling_classes.each do |labeling_class, languages|
|
49
|
+
(languages || Iqvoc::available_languages).each do |lang|
|
50
|
+
render_concept_association(res, concept, labeling_class, :lang => lang)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
Iqvoc::Concept.relation_classes.each do |relation_class|
|
55
|
+
render_concept_association(res, concept, relation_class)
|
56
|
+
end
|
57
|
+
|
58
|
+
Iqvoc::Concept.match_classes.each do |match_class|
|
59
|
+
render_concept_association(res, concept, match_class)
|
60
|
+
end
|
61
|
+
|
62
|
+
Iqvoc::Concept.note_classes.each do |note_class|
|
63
|
+
render_concept_association(res, concept, note_class)
|
64
|
+
end
|
65
|
+
|
66
|
+
Iqvoc::Concept.additional_association_classes.keys.each do |assoc_class|
|
67
|
+
render_concept_association(res, concept, assoc_class)
|
68
|
+
end
|
69
|
+
|
70
|
+
res
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
# Renders a partial taken from the .partial_name method of the objects
|
76
|
+
# associated to the concept.
|
77
|
+
def render_concept_association(hash, concept, association_class, further_options = {})
|
78
|
+
html = render(association_class.partial_name(concept), further_options.merge(:concept => concept, :klass => association_class))
|
79
|
+
# Convert the already safely buffered string back to a regular one
|
80
|
+
# in order to be able to modify it with squish
|
81
|
+
if String.new(html).squish.present?
|
82
|
+
((hash[association_class.view_section(concept)] ||= {})[association_class.view_section_sort_key(concept)] ||= "") << html.html_safe
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
module DashboardHelper
|
18
|
+
|
19
|
+
def sorting_arrows_for(name)
|
20
|
+
content_tag :div, :class => "sorting_arrows" do
|
21
|
+
link_to(image_tag("iqvoc/arrow_down.gif", :class => "arrow_down"),
|
22
|
+
dashboard_path(:order => "asc", :by => name.to_s)) +
|
23
|
+
link_to(image_tag("iqvoc/arrow_up.gif", :class => "arrow_up"),
|
24
|
+
dashboard_path(:order => "desc", :by => name.to_s))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def consistency_status(item)
|
29
|
+
css, msg = if item.valid_with_full_validation?
|
30
|
+
["valid", "✓"]
|
31
|
+
else
|
32
|
+
["invalid", "✗"]
|
33
|
+
end
|
34
|
+
|
35
|
+
content_tag :span, raw(msg), :class => css
|
36
|
+
end
|
37
|
+
|
38
|
+
def link_to_dashboard_item(item)
|
39
|
+
if item.is_a?(Label::Base)
|
40
|
+
item.published? ? label_path(:id => item.origin) : label_path(:published => 0, :id => item.origin)
|
41
|
+
else
|
42
|
+
item.published? ? concept_path(:id => item.origin) : concept_path(:published => 0, :id => item.origin)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
module RdfHelper
|
18
|
+
|
19
|
+
def render_concept(document, concept)
|
20
|
+
|
21
|
+
# You can not eager load polymorpihc associations. That's why we're loading
|
22
|
+
# the collections _one_ time and remember them for further _render_concept_
|
23
|
+
# calls in the future.
|
24
|
+
@rdf_helper_cached_collections ||= Iqvoc::Collection.base_class.select("id, origin").all.each_with_object({}) do |c, hash|
|
25
|
+
hash[c.id] = c.origin
|
26
|
+
end
|
27
|
+
|
28
|
+
document << concept.build_rdf_subject(document, controller) do |c|
|
29
|
+
|
30
|
+
concept.collection_members.each do |collection_member|
|
31
|
+
if @rdf_helper_cached_collections[collection_member.collection_id]
|
32
|
+
c.Schema::memberOf(IqRdf::Coll::build_uri(@rdf_helper_cached_collections[collection_member.collection_id]))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
c.Schema::expires(concept.expired_at) if concept.expired_at
|
37
|
+
c.Owl::deprecated(true) if concept.expired_at and concept.expired_at <= Date.new
|
38
|
+
|
39
|
+
concept.labelings.each do |labeling|
|
40
|
+
labeling.build_rdf(document, c)
|
41
|
+
end
|
42
|
+
|
43
|
+
concept.relations.each do |relation|
|
44
|
+
relation.build_rdf(document, c)
|
45
|
+
end
|
46
|
+
|
47
|
+
concept.notes.each do |note|
|
48
|
+
note.build_rdf(document, c)
|
49
|
+
end
|
50
|
+
|
51
|
+
concept.matches.each do |match|
|
52
|
+
match.build_rdf(document, c)
|
53
|
+
end
|
54
|
+
|
55
|
+
Iqvoc::Concept.additional_association_class_names.keys.each do |class_name|
|
56
|
+
concept.send(class_name.to_relation_name).each do |additional_object|
|
57
|
+
additional_object.build_rdf(document, c)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
module SearchResultsHelper
|
18
|
+
|
19
|
+
def select_search_checkbox?(lang)
|
20
|
+
(params[:languages] && params[:languages].include?(lang.to_s)) ||
|
21
|
+
(!params[:query] && I18n.locale.to_s == lang.to_s)
|
22
|
+
end
|
23
|
+
|
24
|
+
def highlight_query(text, query)
|
25
|
+
query.split(/\n/).each do |q|
|
26
|
+
# call to ActiveSupport's highlight
|
27
|
+
text = highlight(text.to_s, q.strip)
|
28
|
+
end
|
29
|
+
text
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,161 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
class Collection::Base < Concept::Base
|
18
|
+
|
19
|
+
#*********** Associations
|
20
|
+
|
21
|
+
has_many Note::SKOS::Definition.name.to_relation_name,
|
22
|
+
:class_name => 'Note::SKOS::Definition',
|
23
|
+
:as => :owner,
|
24
|
+
:dependent => :destroy
|
25
|
+
|
26
|
+
has_many :members,
|
27
|
+
:class_name => 'Collection::Member::Base',
|
28
|
+
:foreign_key => 'collection_id',
|
29
|
+
:dependent => :destroy
|
30
|
+
|
31
|
+
has_many :concept_members,
|
32
|
+
:class_name => 'Collection::Member::Concept',
|
33
|
+
:foreign_key => 'collection_id',
|
34
|
+
:dependent => :destroy
|
35
|
+
has_many :concepts,
|
36
|
+
:through => :concept_members
|
37
|
+
|
38
|
+
has_many :collection_members,
|
39
|
+
:class_name => 'Collection::Member::Collection',
|
40
|
+
:foreign_key => 'collection_id',
|
41
|
+
:dependent => :destroy
|
42
|
+
has_many :subcollections,
|
43
|
+
:through => :collection_members
|
44
|
+
|
45
|
+
has_many :parent_collection_members,
|
46
|
+
:class_name => 'Collection::Member::Collection',
|
47
|
+
:foreign_key => 'target_id',
|
48
|
+
:dependent => :destroy
|
49
|
+
has_many :parent_collections,
|
50
|
+
:through => :parent_collection_members
|
51
|
+
|
52
|
+
|
53
|
+
#********** Hooks
|
54
|
+
|
55
|
+
after_save :regenerate_concept_members, :regenerate_collection_members
|
56
|
+
|
57
|
+
#********** Scopes
|
58
|
+
|
59
|
+
scope :by_origin, lambda { |origin|
|
60
|
+
where(:origin => origin)
|
61
|
+
}
|
62
|
+
|
63
|
+
scope :by_label_value, lambda { |val|
|
64
|
+
includes(:labels).merge(Label::Base.by_query_value(val))
|
65
|
+
}
|
66
|
+
|
67
|
+
scope :tops, lambda {
|
68
|
+
includes(:parent_collection_members).
|
69
|
+
where("#{Collection::Member::Collection.table_name}.target_id IS NULL")
|
70
|
+
}
|
71
|
+
|
72
|
+
#********** Validations
|
73
|
+
|
74
|
+
validate :circular_subcollections
|
75
|
+
|
76
|
+
#********** Methods
|
77
|
+
|
78
|
+
def to_param
|
79
|
+
origin
|
80
|
+
end
|
81
|
+
|
82
|
+
def label
|
83
|
+
pref_label
|
84
|
+
end
|
85
|
+
|
86
|
+
def build_rdf_subject(document, controller, &block)
|
87
|
+
IqRdf::Coll::build_uri(self.origin, IqRdf::Skos::build_uri("Collection"), &block)
|
88
|
+
end
|
89
|
+
|
90
|
+
def inline_member_concept_origins=(origins)
|
91
|
+
@member_concept_origins = origins.to_s.
|
92
|
+
split(Iqvoc::InlineDataHelper::Splitter).map(&:strip)
|
93
|
+
end
|
94
|
+
|
95
|
+
def inline_member_concept_origins
|
96
|
+
@member_concept_origins || concept_members.map { |m| m.concept.origin }.uniq
|
97
|
+
end
|
98
|
+
|
99
|
+
def inline_member_concepts
|
100
|
+
if @member_concept_origins
|
101
|
+
Concept::Base.editor_selectable.where(:origin => @member_concept_origins)
|
102
|
+
else
|
103
|
+
concepts.select{|c| c.editor_selectable?}
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def inline_member_collection_origins=(origins)
|
108
|
+
@member_collection_origins = origins.to_s.
|
109
|
+
split(Iqvoc::InlineDataHelper::Splitter).map(&:strip)
|
110
|
+
end
|
111
|
+
|
112
|
+
def inline_member_collection_origins
|
113
|
+
@member_collection_origins || collection_members.
|
114
|
+
map { |m| m.subcollection.origin }.uniq
|
115
|
+
end
|
116
|
+
|
117
|
+
def inline_member_collections
|
118
|
+
if @member_collection_origins
|
119
|
+
Collection::Base.where(:origin => @member_collection_origins)
|
120
|
+
else
|
121
|
+
subcollections
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
#********** Hook methods
|
126
|
+
|
127
|
+
def regenerate_concept_members
|
128
|
+
return if @member_concept_origins.nil? # There is nothing to do
|
129
|
+
concept_members.destroy_all
|
130
|
+
@member_concept_origins.each do |new_origin|
|
131
|
+
Concept::Base.by_origin(new_origin).each do |c|
|
132
|
+
concept_members.create!(:target_id => c.id)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def regenerate_collection_members
|
138
|
+
return if @member_collection_origins.nil? # There is nothing to do
|
139
|
+
collection_members.destroy_all
|
140
|
+
@member_collection_origins.each do |new_origin|
|
141
|
+
Iqvoc::Collection.base_class.where(:origin => new_origin).each do |c|
|
142
|
+
collection_members.create!(:target_id => c.id)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
#******** Validation methods
|
148
|
+
|
149
|
+
# This only prevent circles of length 2.
|
150
|
+
# # TODO: This shuold be a real circle detector (but still performant) or be
|
151
|
+
# removed (seems to me like the better idea).
|
152
|
+
def circular_subcollections
|
153
|
+
Iqvoc::Collection.base_class.by_origin(@member_collection_origins).each do |subcollection|
|
154
|
+
if subcollection.subcollections.all.include?(self)
|
155
|
+
errors.add(:base,
|
156
|
+
I18n.t("txt.controllers.collections.circular_error") % subcollection.pref_label)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
class Collection::Member::Base < ActiveRecord::Base
|
18
|
+
|
19
|
+
set_table_name 'collection_members'
|
20
|
+
|
21
|
+
belongs_to :collection, :class_name => 'Collection::Base'
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
class Collection::Member::Collection < Collection::Member::Base
|
18
|
+
|
19
|
+
belongs_to :subcollection, :class_name => 'Collection::Base', :foreign_key => 'target_id'
|
20
|
+
|
21
|
+
def self.view_section(obj)
|
22
|
+
"main"
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.view_section_sort_key(obj)
|
26
|
+
100
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.partial_name(obj)
|
30
|
+
"partials/collection/member"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
class Collection::Member::Concept < Collection::Member::Base
|
18
|
+
|
19
|
+
belongs_to :concept, :class_name => Iqvoc::Concept.base_class_name, :foreign_key => 'target_id'
|
20
|
+
|
21
|
+
def self.view_section(obj)
|
22
|
+
"main"
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.view_section_sort_key(obj)
|
26
|
+
250
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.partial_name(obj)
|
30
|
+
"partials/collection/member"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
class Collection::Unordered < Collection::Base
|
18
|
+
end
|