zena 1.0.0.beta3 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +29 -0
- data/Rakefile +2 -0
- data/TODO_ZENA_1_0 +13 -23
- data/app/controllers/columns_controller.rb +1 -1
- data/app/controllers/comments_controller.rb +4 -3
- data/app/controllers/documents_controller.rb +8 -11
- data/app/controllers/nodes_controller.rb +39 -21
- data/app/controllers/users_controller.rb +8 -3
- data/app/controllers/versions_controller.rb +2 -2
- data/app/controllers/virtual_classes_controller.rb +17 -11
- data/app/helpers/documents_helper.rb +0 -3
- data/app/helpers/users_helper.rb +17 -0
- data/app/models/cache.rb +36 -31
- data/app/models/column.rb +48 -5
- data/app/models/comment.rb +14 -5
- data/app/models/data_entry.rb +2 -2
- data/app/models/document.rb +23 -33
- data/app/models/idx_nodes_datetime.rb +4 -0
- data/app/models/idx_nodes_float.rb +4 -0
- data/app/models/idx_project.rb +3 -0
- data/app/models/node.rb +372 -308
- data/app/models/page.rb +1 -31
- data/app/models/relation.rb +4 -4
- data/app/models/relation_proxy.rb +128 -17
- data/app/models/role.rb +27 -2
- data/app/models/site.rb +64 -56
- data/app/models/template.rb +11 -12
- data/app/models/text_document.rb +6 -7
- data/app/models/user.rb +95 -46
- data/app/models/version.rb +2 -2
- data/app/models/virtual_class.rb +418 -73
- data/app/views/columns/_form.html.erb +1 -1
- data/app/views/columns/_li.html.erb +1 -1
- data/app/views/comments/_form.rhtml +1 -1
- data/app/views/comments/_li.rhtml +1 -1
- data/app/views/comments/_li_simple.rhtml +1 -1
- data/app/views/groups/_form.rhtml +1 -1
- data/app/views/links/_li.rhtml +1 -1
- data/app/views/nodes/_groups.rhtml +1 -1
- data/app/views/nodes/_import_results.rhtml +1 -1
- data/app/views/nodes/_parent.rhtml +1 -1
- data/app/views/nodes/_results.rhtml +1 -1
- data/app/views/nodes/create.rjs +4 -2
- data/app/views/relations/_li.erb +2 -2
- data/app/views/templates/document_create_tabs/_file.rhtml +1 -1
- data/app/views/templates/document_create_tabs/_template.rhtml +2 -2
- data/app/views/templates/document_create_tabs/_text_document.rhtml +2 -2
- data/app/views/templates/edit_tabs/_help.rhtml +1 -1
- data/app/views/templates/edit_tabs/_title.rhtml +0 -3
- data/app/views/users/_form.rhtml +2 -6
- data/app/views/users/_li.rhtml +1 -3
- data/app/views/users/create.rjs +4 -4
- data/app/views/users/preferences.html.erb +1 -4
- data/app/views/versions/custom_tab.rhtml +5 -0
- data/app/views/virtual_classes/_form.erb +20 -10
- data/app/views/virtual_classes/_li.erb +21 -8
- data/app/views/zafu/default/Node-+search.zafu +1 -1
- data/app/views/zafu/default/Node.zafu +3 -3
- data/bricks/captcha/lib/bricks/captcha.rb +1 -1
- data/bricks/mongrel/zena/deploy.rb +14 -0
- data/bricks/{data2pdf → pdf}/.document +0 -0
- data/bricks/pdf/README +33 -0
- data/bricks/{data2pdf → pdf}/Rakefile +0 -0
- data/bricks/pdf/VERSION +1 -0
- data/bricks/pdf/lib/bricks/pdf.rb +110 -0
- data/bricks/pdf/lib/bricks/pdf/engine/prince.rb +38 -0
- data/bricks/pdf/lib/bricks/pdf/engine/xhtml2pdf.rb +9 -0
- data/bricks/pdf/lib/bricks/pdf/install.rb +121 -0
- data/bricks/pdf/test/engines/test_prince.rb +15 -0
- data/bricks/pdf/test/engines/test_xhtml2pdf.rb +15 -0
- data/bricks/{data2pdf → pdf}/test/fixtures/application.css +0 -0
- data/bricks/{data2pdf → pdf}/test/fixtures/contact.html +0 -0
- data/bricks/{data2pdf → pdf}/test/fixtures/pisa-default.css +0 -0
- data/bricks/{data2pdf → pdf}/test/fixtures/sheet1.css +0 -0
- data/bricks/{data2pdf → pdf}/test/fixtures/sheet2.css +0 -0
- data/bricks/{data2pdf → pdf}/test/fixtures/simple-html.html +0 -0
- data/bricks/{data2pdf → pdf}/test/fixtures/simple-text.txt +0 -0
- data/bricks/{data2pdf → pdf}/test/helper.rb +4 -5
- data/bricks/pdf/test/shoulda_macros/shoulda_pdf.rb +72 -0
- data/bricks/pdf/zena/init.rb +5 -0
- data/bricks/pdf/zena/tasks.rb +17 -0
- data/bricks/sphinx/lib/{use_sphinx.rb → bricks/sphinx.rb} +1 -1
- data/bricks/tags/zena/init.rb +2 -2
- data/bricks/tags/zena/test/zafu/tags.yml +4 -4
- data/bricks/zena/zena/migrate/01_base.rb +482 -0
- data/config/bricks.yml +22 -6
- data/config/gems.yml +8 -6
- data/db/20100628074512_zena0x_to1x.rb +6 -1
- data/db/fix/024_correct_vclass_kpath.rb +11 -0
- data/db/fix/025_move_tag_into_vclass.rb +13 -0
- data/db/{migrate → fix}/026_rename_templates.rb +0 -0
- data/db/{migrate → fix}/045_avoid_star_in_templates.rb +0 -0
- data/db/{migrate → fix}/046_fix_zazen_image_tag.rb +0 -0
- data/db/{migrate → fix}/047_change_default_link_id_to_zero.rb +1 -3
- data/db/{migrate → fix}/049_fix_publish_from_is_null.rb +0 -0
- data/db/{migrate → fix}/20090924141459_zafu_fix_sept09.rb +0 -0
- data/db/{migrate → fix}/20091013100351_rename_publish_group_to_drive_group.rb +1 -3
- data/db/{migrate → fix}/20091124161608_rebuild_fullpath.rb +0 -1
- data/db/{migrate → fix}/20100115134729_rebuild_fullpath_after_fix.rb +0 -0
- data/db/{migrate → fix}/20100526090140_renamed_contact_model_to_base_contact.rb +2 -4
- data/db/{migrate → fix/old_migrations}/001_create_base.rb +0 -1
- data/db/{migrate → fix/old_migrations}/002_add_time_zone_to_users.rb +0 -0
- data/db/{migrate → fix/old_migrations}/003_add_custom_base_flag.rb +0 -0
- data/db/{migrate → fix/old_migrations}/004_rename_template_skin.rb +0 -0
- data/db/{migrate → fix/old_migrations}/005_create_cached_pages.rb +0 -0
- data/db/{migrate → fix/old_migrations}/006_create_sites.rb +0 -0
- data/db/{migrate → fix/old_migrations}/007_replace_id_by_zip.rb +0 -0
- data/db/{migrate → fix/old_migrations}/008_user_status.rb +0 -0
- data/db/{migrate → fix/old_migrations}/009_fulltext.rb +0 -0
- data/db/fix/old_migrations/010_create_template_content.rb +17 -0
- data/db/{migrate → fix/old_migrations}/011_project_to_section.rb +0 -0
- data/db/{migrate → fix/old_migrations}/012_add_project_id.rb +0 -0
- data/db/{migrate → fix/old_migrations}/013_remove_defaults.rb +0 -0
- data/db/{migrate → fix/old_migrations}/014_add_sort_field.rb +0 -0
- data/db/{migrate → fix/old_migrations}/015_add_dyn_attributes.rb +0 -0
- data/db/{migrate → fix/old_migrations}/016_remove_translations.rb +0 -0
- data/db/{migrate → fix/old_migrations}/017_rename_authorize.rb +0 -0
- data/db/{migrate → fix/old_migrations}/018_add_auth_option.rb +0 -0
- data/db/{migrate → fix/old_migrations}/019_remove_user_status.rb +0 -0
- data/db/{migrate → fix/old_migrations}/020_create_participation.rb +0 -0
- data/db/{migrate → fix/old_migrations}/021_create_relations.rb +0 -0
- data/db/{migrate → fix/old_migrations}/022_create_virtual_classes.rb +0 -0
- data/db/{migrate → fix/old_migrations}/023_ip_on_anonymous_comment.rb +0 -0
- data/db/{migrate → fix/old_migrations}/027_add_country_to_contacts.rb +0 -0
- data/db/{migrate → fix/old_migrations}/028_change_size_of_conten_type_field.rb +0 -0
- data/db/{migrate → fix/old_migrations}/029_create_data_entries.rb +0 -0
- data/db/{migrate → fix/old_migrations}/030_redit_auto_publish_site_settings.rb +0 -0
- data/db/{migrate → fix/old_migrations}/031_create_iformats.rb +0 -0
- data/db/{migrate → fix/old_migrations}/032_caches_context_as_hash.rb +0 -0
- data/db/{migrate → fix/old_migrations}/033_documents_kpath_change.rb +0 -0
- data/db/{migrate → fix/old_migrations}/034_change_file_storage.rb +0 -0
- data/db/{migrate → fix/old_migrations}/035_add_status_to_link.rb +0 -0
- data/db/{migrate → fix/old_migrations}/036_add_flag_fields_on_nodes.rb +0 -0
- data/db/{migrate → fix/old_migrations}/037_add_auto_create_discussion_to_v_class.rb +0 -0
- data/db/{migrate → fix/old_migrations}/038_create_site_attributes.rb +0 -0
- data/db/{migrate → fix/old_migrations}/039_default_position.rb +0 -0
- data/db/{migrate → fix/old_migrations}/040_second_value_for_data_entry.rb +0 -0
- data/db/{migrate → fix/old_migrations}/041_add_attributes_to_v_class.rb +0 -0
- data/db/{migrate → fix/old_migrations}/042_fix_position_should_be_float.rb +0 -0
- data/db/{migrate → fix/old_migrations}/043_move_user_lang_into_participation.rb +0 -0
- data/db/{migrate → fix/old_migrations}/044_remove_monolingual_site_option.rb +0 -0
- data/db/{migrate → fix/old_migrations}/048_link_source_target_can_be_null.rb +0 -0
- data/db/{migrate → fix/old_migrations}/050_date_in_links.rb +0 -0
- data/db/{migrate → fix/old_migrations}/051_add_exif_tags_to_images.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20090825201159_insert_zero_link.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20090825201200_merge_bricks_migrations_with_std_migrations.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20090927125912_allow_null_in_text_fields.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20090928133440_no_more_private_nodes.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20090928143754_version_status_change.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20091001084025_change_status_values_for_comments.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20091009084057_add_vhash_in_node.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20091014130833_fix_template_title.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20091014183726_merge_participation_into_users.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20091018200734_add_popup_info_to_image_format.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20091026161708_add_persistence_token.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20091101184952_add_session_table.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20091123175137_add_single_access_token.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100125062254_add_dynamo_to_version.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100201133242_remove_default_status_on_version.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100208194210_create_attachments.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100210112319_change_dynamo_to_property.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100320145726_transform_template_contents_into_index.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100328125634_change_skin_name_to_id.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100417061257_add_properties_to_sites.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100419163149_rename_name_to_node_name.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100422091606_change_v_class_table_into_roles.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100422094048_node_habtm_roles.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100422115935_create_columns.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100513181529_add_site_id_to_columns.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100519091711_add_index_definition_to_columns.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100519091940_create_idx_nodes_string.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100519232432_create_idx_nodes_ml_string.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100525113858_add_porperties_to_users.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100527130937_change_column_index_to_string.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100531135128_add_fulltext_builder_fields.rb +0 -0
- data/db/{migrate → fix/old_migrations}/20100915062903_add_api_group_id_to_site.rb +0 -0
- data/db/fix/old_migrations/20100923154807_remove_base_contact.rb +84 -0
- data/db/fix/old_migrations/20100926192223_remove_su_user.rb +8 -0
- data/db/fix/old_migrations/20100927141658_add_eval_attributes_to_v_class.rb +12 -0
- data/db/fix/old_migrations/20100928185257_add_obvious_idx.rb +52 -0
- data/db/fix/old_migrations/20100929143111_remove_node_name.rb +11 -0
- data/db/fix/old_migrations/20101006090454_store_properties_in_long_text.rb +9 -0
- data/db/fix/old_migrations/20101014185753_remove_user_prototype_id.rb +9 -0
- data/db/fix/old_migrations/20101101084318_create_scope_index.rb +35 -0
- data/db/fix/old_migrations/20101109074232_create_idx_nodes_tables.rb +65 -0
- data/db/fix/old_migrations/20101110184235_add_role_update_to_site.rb +9 -0
- data/db/fix/old_migrations/20101116103920_change_scope_index.rb +31 -0
- data/db/fix/old_migrations/20101123125822_add_integer_idx.rb +17 -0
- data/db/fix/old_migrations/20101130134522_add_index_field.rb +13 -0
- data/db/fix/old_migrations/20101213133816_add_group_to_relation.rb +9 -0
- data/db/init/base/help.fr.zml +1 -1
- data/db/init/base/skins/default.zml +0 -1
- data/db/init/base/skins/default/Node-+search.zafu +1 -1
- data/db/init/base/skins/default/Node-tree.zafu +3 -3
- data/db/init/base/skins/default/Node.zafu +3 -3
- data/lib/bricks/loader.rb +4 -1
- data/lib/bricks/requirements_validation.rb +11 -6
- data/lib/log_recorder/lib/log_recorder.rb +2 -2
- data/lib/tasks/zena.rake +25 -15
- data/lib/zena.rb +42 -9
- data/lib/zena/acts/enrollable.rb +81 -99
- data/lib/zena/acts/secure.rb +27 -23
- data/lib/zena/acts/secure_node.rb +10 -55
- data/lib/zena/acts/serializable.rb +9 -10
- data/lib/zena/app.rb +0 -2
- data/lib/zena/code_syntax.rb +1 -1
- data/lib/zena/controller/test_case.rb +0 -5
- data/lib/zena/core_ext/string.rb +48 -20
- data/lib/zena/db.rb +10 -442
- data/lib/zena/db_helper/abstract_db.rb +184 -0
- data/lib/zena/db_helper/mysql.rb +150 -0
- data/lib/zena/db_helper/postgresql.rb +79 -0
- data/lib/zena/db_helper/sqlite3.rb +135 -0
- data/lib/zena/deploy.rb +4 -1
- data/lib/zena/deploy/httpd.rhtml +3 -3
- data/lib/zena/deploy/vhost.rhtml +1 -1
- data/lib/zena/foxy_parser.rb +37 -18
- data/lib/zena/info.rb +3 -13
- data/lib/zena/migrator.rb +0 -1
- data/lib/zena/parser/zafu_rules.rb +9 -4
- data/lib/zena/parser/zazen_rules.rb +5 -5
- data/lib/zena/parser/zena_rules.rb +1 -1
- data/lib/zena/remote/interface.rb +1 -1
- data/lib/zena/site_worker.rb +3 -3
- data/lib/zena/test_controller.rb +10 -10
- data/lib/zena/use/action.rb +66 -6
- data/lib/zena/use/ajax.rb +39 -13
- data/lib/zena/use/ancestry.rb +210 -0
- data/lib/zena/use/authlogic.rb +30 -1
- data/lib/zena/use/calendar.rb +158 -0
- data/lib/zena/use/conditional.rb +3 -2
- data/lib/zena/use/context.rb +42 -12
- data/lib/zena/use/dates.rb +15 -14
- data/lib/zena/use/display.rb +54 -7
- data/lib/zena/use/error_rendering.rb +1 -0
- data/lib/zena/use/field_index.rb +20 -0
- data/lib/zena/use/fixtures.rb +12 -9
- data/lib/zena/use/forms.rb +230 -106
- data/lib/zena/use/fulltext.rb +28 -14
- data/lib/zena/use/html_tags.rb +1 -24
- data/lib/zena/use/i18n.rb +69 -14
- data/lib/zena/use/kpath.rb +60 -0
- data/lib/zena/use/ml_index.rb +6 -4
- data/lib/zena/use/node_context.rb +63 -0
- data/lib/zena/use/prop_eval.rb +90 -0
- data/lib/zena/use/query_builder.rb +159 -29
- data/lib/zena/use/query_comment.rb +1 -1
- data/lib/zena/use/query_node.rb +147 -56
- data/lib/zena/use/recursion.rb +2 -2
- data/lib/zena/use/relations.rb +31 -19
- data/lib/zena/use/rendering.rb +111 -121
- data/lib/zena/use/scope_index.rb +230 -0
- data/lib/zena/use/search.rb +7 -7
- data/lib/zena/use/urls.rb +87 -25
- data/lib/zena/use/version_hash.rb +113 -113
- data/lib/zena/use/workflow.rb +5 -1
- data/lib/zena/use/zafu_attributes.rb +11 -14
- data/lib/zena/use/zafu_eval.rb +1 -1
- data/lib/zena/use/zafu_safe_definitions.rb +91 -9
- data/lib/zena/use/zafu_templates.rb +146 -102
- data/lib/zena/use/zazen.rb +5 -4
- data/lib/zena/zafu_compiler.rb +1 -0
- data/locale/en/LC_MESSAGES/zena.mo +0 -0
- data/locale/en/zena.po +0 -1
- data/locale/fr/LC_MESSAGES/zena.mo +0 -0
- data/locale/fr/zena.mo +0 -0
- data/locale/fr/zena.po +4 -4
- data/misc/zena +35 -0
- data/misc/zena_init +41 -0
- data/public/images/ext/{basecontact.png → contact.png} +0 -0
- data/public/javascripts/zena.js +35 -7
- data/public/stylesheets/admin.css +5 -2
- data/public/stylesheets/default.css +2 -1
- data/public/stylesheets/popup.css +1 -1
- data/public/stylesheets/zena.css +2 -2
- data/test/custom_queries/complex.host.yml +12 -5
- data/test/fixtures/files/Node-test.zafu +3 -3
- data/test/fixtures/files/translations_fr.yml +4 -2
- data/test/functional/documents_controller_test.rb +31 -0
- data/test/functional/nodes_controller_commit_test.rb +1 -5
- data/test/functional/nodes_controller_test.rb +92 -12
- data/test/functional/user_sessions_controller_test.rb +2 -2
- data/test/functional/users_controller_test.rb +31 -29
- data/test/functional/versions_controller_test.rb +2 -2
- data/test/functional/virtual_classes_controller_test.rb +2 -2
- data/test/integration/multiple_hosts_test.rb +19 -8
- data/test/integration/navigation_test.rb +91 -12
- data/test/integration/query_node/basic.yml +40 -37
- data/test/integration/query_node/complex.yml +23 -18
- data/test/integration/query_node/dates.yml +3 -3
- data/test/integration/query_node/errors.yml +7 -1
- data/test/integration/query_node/filters.yml +41 -35
- data/test/integration/query_node/idx_fields.yml +11 -0
- data/test/integration/query_node/idx_key_value.yml +77 -0
- data/test/integration/query_node/idx_scope.yml +33 -0
- data/test/integration/query_node/relations.yml +13 -13
- data/test/integration/query_node_test.rb +6 -10
- data/test/integration/zafu_compiler/action.yml +19 -6
- data/test/integration/zafu_compiler/ajax.yml +111 -51
- data/test/integration/zafu_compiler/apphelper.yml +1 -1
- data/test/integration/zafu_compiler/asset.yml +1 -1
- data/test/integration/zafu_compiler/basic.yml +42 -52
- data/test/integration/zafu_compiler/calendar.yml +3 -3
- data/test/integration/zafu_compiler/complex.yml +16 -16
- data/test/integration/zafu_compiler/complex_ok.yml +2 -2
- data/test/integration/zafu_compiler/conditional.yml +42 -33
- data/test/integration/zafu_compiler/data.yml +3 -3
- data/test/integration/zafu_compiler/dates.yml +25 -10
- data/test/integration/zafu_compiler/display.yml +49 -12
- data/test/integration/zafu_compiler/errors.yml +26 -6
- data/test/integration/zafu_compiler/eval.yml +4 -4
- data/test/integration/zafu_compiler/forms.yml +89 -15
- data/test/integration/zafu_compiler/i18n.yml +23 -18
- data/test/integration/zafu_compiler/idx_scope.yml +7 -0
- data/test/integration/zafu_compiler/later.yml +10 -16
- data/test/integration/zafu_compiler/off/off.yml +2 -2
- data/test/integration/zafu_compiler/query.yml +207 -0
- data/test/integration/zafu_compiler/recursion.yml +2 -2
- data/test/integration/zafu_compiler/relations.yml +144 -168
- data/test/integration/zafu_compiler/roles.yml +86 -10
- data/test/integration/zafu_compiler/rubyless.yml +49 -6
- data/test/integration/zafu_compiler/safe_definitions.yml +35 -6
- data/test/integration/zafu_compiler/search.yml +1 -1
- data/test/integration/zafu_compiler/security.yml +37 -0
- data/test/integration/zafu_compiler/urls.yml +50 -40
- data/test/integration/zafu_compiler/user.yml +21 -6
- data/test/integration/zafu_compiler/version.yml +6 -6
- data/test/integration/zafu_compiler/zafu_attributes.yml +43 -34
- data/test/integration/zafu_compiler/zazen.yml +10 -10
- data/test/integration/zafu_compiler_test.rb +19 -13
- data/test/sites/complex/nodes.yml +0 -2
- data/test/sites/complex/roles.yml +9 -1
- data/test/sites/complex/sites.yml +0 -1
- data/test/sites/complex/users.yml +2 -5
- data/test/sites/ocean/nodes.yml +2 -5
- data/test/sites/ocean/roles.yml +8 -0
- data/test/sites/ocean/sites.yml +0 -1
- data/test/sites/ocean/users.yml +0 -13
- data/test/sites/zena/columns.yml +27 -5
- data/test/sites/zena/idx_projects.yml +5 -0
- data/test/sites/zena/nodes.yml +8 -32
- data/test/sites/zena/relations.yml +5 -0
- data/test/sites/zena/roles.yml +25 -3
- data/test/sites/zena/sites.yml +2 -2
- data/test/sites/zena/users.yml +1 -21
- data/test/sites/zena/versions.yml +35 -12
- data/test/test_helper.rb +7 -0
- data/test/unit/after_commit_test.rb +7 -7
- data/test/unit/cache_test.rb +32 -0
- data/test/unit/cached_page_test.rb +1 -1
- data/test/unit/column_test.rb +31 -7
- data/test/unit/comment_test.rb +2 -2
- data/test/unit/core_ext_test.rb +38 -7
- data/test/unit/document_test.rb +14 -42
- data/test/unit/node_test.rb +311 -324
- data/test/unit/note_test.rb +23 -31
- data/test/unit/page_test.rb +16 -58
- data/test/unit/project_test.rb +2 -2
- data/test/unit/relation_proxy_test.rb +148 -21
- data/test/unit/relation_test.rb +23 -3
- data/test/unit/remote_test.rb +15 -9
- data/test/unit/role_test.rb +9 -0
- data/test/unit/site_test.rb +49 -47
- data/test/unit/skin_test.rb +16 -0
- data/test/unit/template_test.rb +60 -69
- data/test/unit/text_document_test.rb +15 -14
- data/test/unit/user_test.rb +101 -41
- data/test/unit/version_test.rb +4 -4
- data/test/unit/virtual_class_test.rb +577 -36
- data/test/unit/workflow_test.rb +58 -21
- data/test/unit/zena/acts/enrollable_test.rb +36 -127
- data/test/unit/zena/acts/secure_test.rb +6 -22
- data/test/unit/zena/acts/serializable_test.rb +18 -0
- data/test/unit/zena/db_test.rb +14 -14
- data/test/unit/zena/parser/zafu.yml +5 -3
- data/test/unit/zena/use/ancestry_test.rb +198 -0
- data/test/unit/zena/use/calendar_test.rb +8 -8
- data/test/unit/zena/use/dates_test.rb +2 -0
- data/test/unit/zena/use/fulltext_test.rb +9 -1
- data/test/unit/zena/use/html_tags_test.rb +2 -16
- data/test/unit/zena/use/i18n_test.rb +2 -2
- data/test/unit/zena/use/kpath_test.rb +13 -0
- data/test/unit/zena/use/ml_index_test.rb +60 -12
- data/test/unit/zena/use/prop_eval_test.rb +170 -0
- data/test/unit/zena/use/query_node_test.rb +9 -2
- data/test/unit/zena/use/rendering_test.rb +98 -1
- data/test/unit/zena/use/scope_index_test.rb +464 -0
- data/test/unit/zena/use/urls_test.rb +23 -13
- data/test/unit/zena/use/version_hash_test.rb +2 -2
- data/test/unit/zena/use/zafu_template_test.rb +21 -8
- data/test/unit/zena/use/zazen_test.rb +47 -47
- data/zena.gemspec +177 -143
- metadata +222 -141
- data/app/models/base_contact.rb +0 -79
- data/app/models/book.rb +0 -242
- data/app/models/contact_content.rb +0 -70
- data/app/models/contact_version.rb +0 -40
- data/app/models/reference.rb +0 -18
- data/app/views/templates/edit_tabs/_basecontact.rhtml +0 -8
- data/bricks/data2pdf/README +0 -19
- data/bricks/data2pdf/VERSION +0 -1
- data/bricks/data2pdf/lib/data2pdf.rb +0 -60
- data/bricks/data2pdf/lib/engines/prince.rb +0 -39
- data/bricks/data2pdf/lib/engines/xhtml2pdf.rb +0 -41
- data/bricks/data2pdf/lib/install.rb +0 -111
- data/bricks/data2pdf/test/engines/test_prince.rb +0 -14
- data/bricks/data2pdf/test/engines/test_xhtml2pdf.rb +0 -14
- data/bricks/data2pdf/test/shoulda_macros/shoulda_data2pdf.rb +0 -91
- data/bricks/data2pdf/test/unit/test_rendering.rb +0 -37
- data/config/routes.rb +0 -3
- data/db/migrate/010_create_template_content.rb +0 -17
- data/db/migrate/024_correct_vclass_kpath.rb +0 -13
- data/db/migrate/025_move_tag_into_vclass.rb +0 -15
- data/lib/version_off.rb +0 -323
- data/lib/zena/use/node_name.rb +0 -94
- data/test/integration/query_node/properties.yml +0 -41
- data/test/unit/base_contact_test.rb +0 -242
- data/test/unit/node_name_test.rb +0 -137
data/app/models/base_contact.rb
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
class BaseContact < Reference
|
2
|
-
|
3
|
-
property do |t|
|
4
|
-
t.string 'first_name', :index => true
|
5
|
-
t.string 'name', :index => true
|
6
|
-
|
7
|
-
t.text 'address'
|
8
|
-
t.string 'postal_code'
|
9
|
-
t.string 'city'
|
10
|
-
t.string 'country'
|
11
|
-
|
12
|
-
t.string 'telephone'
|
13
|
-
t.string 'mobile'
|
14
|
-
t.string 'email'
|
15
|
-
|
16
|
-
t.date 'birthday'
|
17
|
-
end
|
18
|
-
|
19
|
-
safe_property :first_name, :name,
|
20
|
-
:address, :postal_code, :city, :country,
|
21
|
-
:telephone, :mobile, :email,
|
22
|
-
:birthday
|
23
|
-
|
24
|
-
safe_method :fullname => String, :initials => String
|
25
|
-
|
26
|
-
attr_protected :site_id
|
27
|
-
|
28
|
-
class << self
|
29
|
-
|
30
|
-
# Class list to which this class can change to
|
31
|
-
def change_to_classes_for_form
|
32
|
-
classes_for_form(:class => 'BaseContact')
|
33
|
-
end
|
34
|
-
|
35
|
-
def ksel
|
36
|
-
self == BaseContact ? 'C' : super
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def fullname(first_name = self.first_name, name = self.name)
|
41
|
-
(!first_name.blank? && !name.blank?) ? (first_name + ' ' + name) : (first_name.blank? ? name : first_name)
|
42
|
-
end
|
43
|
-
|
44
|
-
def fullname_changed?
|
45
|
-
self.properties.first_name_changed? || self.properties.name_changed?
|
46
|
-
end
|
47
|
-
|
48
|
-
def fullname_was
|
49
|
-
fullname(self.properties.first_name_was, self.properties.name_was)
|
50
|
-
end
|
51
|
-
|
52
|
-
def initials
|
53
|
-
fullname.split(" ").map {|w| w[0..0].capitalize}.join("")
|
54
|
-
end
|
55
|
-
|
56
|
-
private
|
57
|
-
def set_defaults
|
58
|
-
|
59
|
-
if title.blank?
|
60
|
-
self.title = fullname
|
61
|
-
elsif fullname.blank?
|
62
|
-
if title =~ /^(\S+)\s+(.*)$/
|
63
|
-
self.first_name = $1
|
64
|
-
self.name = $2
|
65
|
-
else
|
66
|
-
self.name = title
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
if properties.title_changed? && fullname_changed?
|
71
|
-
# Ignore if both title and fullname changed
|
72
|
-
elsif fullname_changed? && title == fullname_was
|
73
|
-
# Fullname changed and title was in sync
|
74
|
-
self.title = fullname
|
75
|
-
end
|
76
|
-
|
77
|
-
super
|
78
|
-
end
|
79
|
-
end
|
data/app/models/book.rb
DELETED
@@ -1,242 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
# install yaz http://www.indexdata.dk/yaz/ :
|
3
|
-
# ./configure --enable-shared
|
4
|
-
# make
|
5
|
-
# sudo make install
|
6
|
-
#
|
7
|
-
# install ruby/zoom http://ruby-zoom.rubyforge.org/ :
|
8
|
-
# ruby extconf.rg
|
9
|
-
# make
|
10
|
-
# sudo make install
|
11
|
-
|
12
|
-
asin = '0521780195'
|
13
|
-
book_covers = '/Users/gaspard/book_covers/'
|
14
|
-
#asin = '0226732169'
|
15
|
-
#asin = '023945857892' # bad for testing
|
16
|
-
|
17
|
-
#require 'zoom'
|
18
|
-
#
|
19
|
-
#ZOOM::Connection.open('z3950.loc.gov', 7090) do |conn|
|
20
|
-
# conn.database_name = 'Voyager'
|
21
|
-
# conn.preferred_record_syntax = 'USMARC'
|
22
|
-
# rset = conn.search("@attr 1=7 #{asin}")
|
23
|
-
# p rset[0]
|
24
|
-
#end
|
25
|
-
|
26
|
-
# using amazon web services :
|
27
|
-
# access key : 1186KA3K523YWH49MV02
|
28
|
-
# US : http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=1186KA3K523YWH49MV02&Operation=ItemLookup&IdType=ASIN&ItemId=#{asin}&MerchantId=All&ResponseGroup=Large
|
29
|
-
|
30
|
-
require 'net/http' # http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/
|
31
|
-
url = "http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=1186KA3K523YWH49MV02&Operation=ItemLookup&IdType=ASIN&ItemId=#{asin}&MerchantId=All&ResponseGroup=Medium"
|
32
|
-
r = Net::HTTP.get_response( URI.parse( url ) )
|
33
|
-
|
34
|
-
# parse xml
|
35
|
-
require "rexml/document"
|
36
|
-
include REXML
|
37
|
-
|
38
|
-
doc = REXML::Document.new r.body
|
39
|
-
# error handling
|
40
|
-
doc.elements.each("ItemLookupResponse/Items/Request/Errors/Error/Message") {|elem| puts elem.text}
|
41
|
-
|
42
|
-
# get book info
|
43
|
-
puts doc.elements["ItemLookupResponse/Items/Item/ItemAttributes/Title"].text
|
44
|
-
puts doc.elements["ItemLookupResponse/Items/Item/ItemAttributes/Author"].text
|
45
|
-
#doc.elements.each("ItemLookupResponse/Items/Item/ItemAttributes/Author") {|elem| puts elem.text}
|
46
|
-
puts doc.elements["ItemLookupResponse/Items/Item/ItemAttributes/NumberOfPages"].text
|
47
|
-
puts doc.elements["ItemLookupResponse/Items/Item/ItemAttributes/ProductGroup"].text
|
48
|
-
puts doc.elements["ItemLookupResponse/Items/Item/ItemAttributes/PublicationDate"].text
|
49
|
-
puts doc.elements["ItemLookupResponse/Items/Item/ItemAttributes/Publisher"].text
|
50
|
-
# size in cm :
|
51
|
-
puts doc.elements["ItemLookupResponse/Items/Item/ItemAttributes/PackageDimensions/Length"].text.to_f * 0.0254
|
52
|
-
puts doc.elements["ItemLookupResponse/Items/Item/ItemAttributes/PackageDimensions/Width"].text.to_f * 0.0254
|
53
|
-
puts doc.elements["ItemLookupResponse/Items/Item/ItemAttributes/PackageDimensions/Height"].text.to_f * 0.0254
|
54
|
-
puts doc.elements["ItemLookupResponse/Items/Item/ItemAttributes/PackageDimensions/Weight"].text.to_f * 4.54
|
55
|
-
|
56
|
-
# detail page
|
57
|
-
puts doc.elements["ItemLookupResponse/Items/Item/DetailPageURL"].text
|
58
|
-
|
59
|
-
# get cover pictures
|
60
|
-
|
61
|
-
def getCover(asin,url,size,local_folder)
|
62
|
-
filename = "#{local_folder}#{size}_#{asin}.jpg"
|
63
|
-
if File.exist?(filename)
|
64
|
-
puts "#{filename} exists."
|
65
|
-
else
|
66
|
-
puts "downloading #{url}... to #{filename}"
|
67
|
-
# download pict
|
68
|
-
pict = Net::HTTP.get_response(URI.parse(url))
|
69
|
-
File.open(filename, 'wb') {|f| f.write(pict.body)}
|
70
|
-
end
|
71
|
-
end
|
72
|
-
getCover(asin,doc.elements["ItemLookupResponse/Items/Item/SmallImage/URL"].text,'Small',book_covers)
|
73
|
-
getCover(asin,doc.elements["ItemLookupResponse/Items/Item/MediumImage/URL"].text,'Medium',book_covers)
|
74
|
-
getCover(asin,doc.elements["ItemLookupResponse/Items/Item/LargeImage/URL"].text,'Large',book_covers)
|
75
|
-
=end
|
76
|
-
=begin
|
77
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
78
|
-
<ItemLookupResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2005-10-05">
|
79
|
-
<OperationRequest>
|
80
|
-
<HTTPHeaders>
|
81
|
-
<Header Name="UserAgent" Value="curl/7.13.1 (powerpc-apple-darwin8.0) libcurl/7.13.1 OpenSSL/0.9.7i zlib/1.2.3"/>
|
82
|
-
</HTTPHeaders>
|
83
|
-
<RequestId>1FNX6CR1RERFCW0804E1</RequestId>
|
84
|
-
<Arguments>
|
85
|
-
<Argument Name="ResponseGroup" Value="Medium"/>
|
86
|
-
<Argument Name="Operation" Value="ItemLookup"/>
|
87
|
-
<Argument Name="MerchantId" Value="All"/>
|
88
|
-
<Argument Name="Service" Value="AWSECommerceService"/>
|
89
|
-
<Argument Name="AWSAccessKeyId" Value="1186KA3K523YWH49MV02"/>
|
90
|
-
<Argument Name="ItemId" Value="097669400X"/>
|
91
|
-
<Argument Name="IdType" Value="ASIN"/>
|
92
|
-
</Arguments>
|
93
|
-
<RequestProcessingTime>0.0330460071563721</RequestProcessingTime>
|
94
|
-
</OperationRequest>
|
95
|
-
<Items>
|
96
|
-
<Request>
|
97
|
-
<IsValid>True</IsValid>
|
98
|
-
<ItemLookupRequest>
|
99
|
-
<IdType>ASIN</IdType>
|
100
|
-
<MerchantId>All</MerchantId>
|
101
|
-
<ItemId>097669400X</ItemId>
|
102
|
-
<ResponseGroup>Medium</ResponseGroup>
|
103
|
-
</ItemLookupRequest>
|
104
|
-
</Request>
|
105
|
-
<Item>
|
106
|
-
<ASIN>097669400X</ASIN>
|
107
|
-
<DetailPageURL>http://www.amazon.com/exec/obidos/redirect?tag=ws%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=097669400X%2526tag=ws%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/097669400X%25253FSubscriptionId=1186KA3K523YWH49MV02</DetailPageURL>
|
108
|
-
<SalesRank>656</SalesRank>
|
109
|
-
<SmallImage>
|
110
|
-
<URL>http://images.amazon.com/images/P/097669400X.01._SCTHUMBZZZ_.jpg</URL>
|
111
|
-
<Height Units="pixels">75</Height>
|
112
|
-
<Width Units="pixels">62</Width>
|
113
|
-
</SmallImage>
|
114
|
-
<MediumImage>
|
115
|
-
<URL>http://images.amazon.com/images/P/097669400X.01._SCMZZZZZZZ_.jpg</URL>
|
116
|
-
<Height Units="pixels">160</Height>
|
117
|
-
<Width Units="pixels">133</Width>
|
118
|
-
</MediumImage>
|
119
|
-
<LargeImage>
|
120
|
-
<URL>http://images.amazon.com/images/P/097669400X.01._SCLZZZZZZZ_.jpg</URL>
|
121
|
-
<Height Units="pixels">500</Height>
|
122
|
-
<Width Units="pixels">416</Width>
|
123
|
-
</LargeImage>
|
124
|
-
<ImageSets>
|
125
|
-
<ImageSet Category="primary">
|
126
|
-
<SmallImage>
|
127
|
-
<URL>http://images.amazon.com/images/P/097669400X.01._SCTHUMBZZZ_.jpg</URL>
|
128
|
-
<Height Units="pixels">75</Height>
|
129
|
-
<Width Units="pixels">62</Width>
|
130
|
-
</SmallImage>
|
131
|
-
<MediumImage>
|
132
|
-
<URL>http://images.amazon.com/images/P/097669400X.01._SCMZZZZZZZ_.jpg</URL>
|
133
|
-
<Height Units="pixels">160</Height>
|
134
|
-
<Width Units="pixels">133</Width>
|
135
|
-
</MediumImage>
|
136
|
-
<LargeImage>
|
137
|
-
<URL>http://images.amazon.com/images/P/097669400X.01._SCLZZZZZZZ_.jpg</URL>
|
138
|
-
<Height Units="pixels">500</Height>
|
139
|
-
<Width Units="pixels">416</Width>
|
140
|
-
</LargeImage>
|
141
|
-
</ImageSet>
|
142
|
-
</ImageSets>
|
143
|
-
<ItemAttributes>
|
144
|
-
<Author>Dave Thomas</Author>
|
145
|
-
<Author>David Hansson</Author>
|
146
|
-
<Author>Leon Breedt</Author>
|
147
|
-
<Author>Mike Clark</Author>
|
148
|
-
<Author>Thomas Fuchs</Author>
|
149
|
-
<Author>Andrea Schwarz</Author>
|
150
|
-
<Binding>Paperback</Binding>
|
151
|
-
<EAN>9780976694007</EAN>
|
152
|
-
<Edition>1</Edition>
|
153
|
-
<ISBN>097669400X</ISBN>
|
154
|
-
<ListPrice>
|
155
|
-
<Amount>3495</Amount>
|
156
|
-
<CurrencyCode>USD</CurrencyCode>
|
157
|
-
<FormattedPrice>$34.95</FormattedPrice>
|
158
|
-
</ListPrice>
|
159
|
-
<NumberOfItems>1</NumberOfItems>
|
160
|
-
<NumberOfPages>450</NumberOfPages>
|
161
|
-
<PackageDimensions>
|
162
|
-
<Height Units="hundredths-inches">105</Height>
|
163
|
-
<Length Units="hundredths-inches">900</Length>
|
164
|
-
<Weight Units="hundredths-pounds">187</Weight>
|
165
|
-
<Width Units="hundredths-inches">750</Width>
|
166
|
-
</PackageDimensions>
|
167
|
-
<ProductGroup>Book</ProductGroup>
|
168
|
-
<PublicationDate>2005-07-01</PublicationDate>
|
169
|
-
<Publisher>Pragmatic Bookshelf</Publisher>
|
170
|
-
<Title>Agile Web Development with Rails : A Pragmatic Guide (The Facets of Ruby Series)</Title>
|
171
|
-
</ItemAttributes>
|
172
|
-
<OfferSummary>
|
173
|
-
<LowestNewPrice>
|
174
|
-
<Amount>2276</Amount>
|
175
|
-
<CurrencyCode>USD</CurrencyCode>
|
176
|
-
<FormattedPrice>$22.76</FormattedPrice>
|
177
|
-
</LowestNewPrice>
|
178
|
-
<LowestUsedPrice>
|
179
|
-
<Amount>2276</Amount>
|
180
|
-
<CurrencyCode>USD</CurrencyCode>
|
181
|
-
<FormattedPrice>$22.76</FormattedPrice>
|
182
|
-
</LowestUsedPrice>
|
183
|
-
<LowestCollectiblePrice>
|
184
|
-
<Amount>3495</Amount>
|
185
|
-
<CurrencyCode>USD</CurrencyCode>
|
186
|
-
<FormattedPrice>$34.95</FormattedPrice>
|
187
|
-
</LowestCollectiblePrice>
|
188
|
-
<TotalNew>25</TotalNew>
|
189
|
-
<TotalUsed>9</TotalUsed>
|
190
|
-
<TotalCollectible>1</TotalCollectible>
|
191
|
-
<TotalRefurbished>0</TotalRefurbished>
|
192
|
-
</OfferSummary>
|
193
|
-
<EditorialReviews>
|
194
|
-
<EditorialReview>
|
195
|
-
<Source>Book Description</Source>
|
196
|
-
<Content>Rails is a full-stack, open-source web framework that enables you to create full-featured, sophisticated web-based applications, but with a twist... A full Rails application probably has less total code than the XML you'd need to configure the same application in other frameworks. With this book you'll learn how to use <i>ActiveRecord</i> to connect business objects and database tables. No more painful object-relational mapping. Just create your business objects and let Rails do the rest. You'll learn how to use the <i>Action Pack</i> framework to route incoming requests and render pages using easy-to-write templates and components. See how to exploit the Rails service frameworks to send emails, implement web services, and create dynamic, user-centric web-pages using built-in Javascript and Ajax support. There are extensive chapters on testing, deployment, and scaling. You'll see how easy it is to install Rails using your web server of choice (such as Apache or lighttpd) or using its own included web server. You'll be writing applications that work with your favorite database (MySQL, Oracle, Postgres, and more) in no time at all. You'll create a complete online store application in the extended tutorial section, so you'll see how a full Rails application is developed---iteratively and rapidly. Rails strives to honor the Pragmatic Programmer's "DRY Principle" by avoiding the extra work of configuration files and code annotations. You can develop in real-time: make a change, and watch it work immediately. Forget XML. Everything in Rails, from templates to control flow to business logic, is written in Ruby, the language of choice for programmers who like to get the job done well (and leave work on time for a change). Rails is the framework of choice for the new generation of Web 2.0 developers. <em>Agile Web Development with Rails</em> is the book for that generation, written by Dave Thomas (Pragmatic Programmer and author of <em>Programming Ruby</em>) and David Heinemeier Hansson, who created Rails.</Content>
|
197
|
-
</EditorialReview>
|
198
|
-
</EditorialReviews>
|
199
|
-
</Item>
|
200
|
-
</Items>
|
201
|
-
</ItemLookupResponse>
|
202
|
-
=end
|
203
|
-
|
204
|
-
|
205
|
-
=begin
|
206
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
207
|
-
<ItemLookupResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2005-10-05">
|
208
|
-
<OperationRequest>
|
209
|
-
<HTTPHeaders>
|
210
|
-
<Header Name="UserAgent" Value="Mozilla/5.0 (Macintosh; U; PPC Mac OS X; fr) AppleWebKit/416.11 (KHTML, like Gecko) Safari/416.12"/>
|
211
|
-
</HTTPHeaders>
|
212
|
-
<RequestId>1A8ACWG822D5K6X4HS5C</RequestId>
|
213
|
-
<Arguments>
|
214
|
-
<Argument Name="MerchantId" Value="All"/>
|
215
|
-
<Argument Name="Service" Value="AWSECommerceService"/>
|
216
|
-
<Argument Name="AWSAccessKeyId" Value="1186KA3K523YWH49MV02"/>
|
217
|
-
<Argument Name="ItemId" Value="0976698746400X"/>
|
218
|
-
<Argument Name="IdType" Value="ASIN"/>
|
219
|
-
<Argument Name="ResponseGroup" Value="Medium"/>
|
220
|
-
<Argument Name="Operation" Value="ItemLookup"/>
|
221
|
-
</Arguments>
|
222
|
-
<RequestProcessingTime>0.0273139476776123</RequestProcessingTime>
|
223
|
-
</OperationRequest>
|
224
|
-
<Items>
|
225
|
-
<Request>
|
226
|
-
<IsValid>True</IsValid>
|
227
|
-
<ItemLookupRequest>
|
228
|
-
<IdType>ASIN</IdType>
|
229
|
-
<MerchantId>All</MerchantId>
|
230
|
-
<ItemId>0976698746400X</ItemId>
|
231
|
-
<ResponseGroup>Medium</ResponseGroup>
|
232
|
-
</ItemLookupRequest>
|
233
|
-
<Errors>
|
234
|
-
<Error>
|
235
|
-
<Code>AWS.InvalidParameterValue</Code>
|
236
|
-
<Message>0976698746400X is not a valid value for ItemId. Please change this value and retry your request.</Message>
|
237
|
-
</Error>
|
238
|
-
</Errors>
|
239
|
-
</Request>
|
240
|
-
</Items>
|
241
|
-
</ItemLookupResponse>
|
242
|
-
=end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
=begin rdoc
|
2
|
-
Used by BaseContact to store contact data. See the documentation on this class for more information.
|
3
|
-
|
4
|
-
=== Attributes
|
5
|
-
|
6
|
-
Provides the following attributes to BaseContact :
|
7
|
-
|
8
|
-
first_name:: first name
|
9
|
-
name:: name
|
10
|
-
address:: address (text)
|
11
|
-
zip:: zip code
|
12
|
-
city:: city name
|
13
|
-
telephone:: phone number
|
14
|
-
mobile:: mobile phone number
|
15
|
-
email:: email address
|
16
|
-
birthday:: birthday (date)
|
17
|
-
=end
|
18
|
-
class ContactContent < ActiveRecord::Base
|
19
|
-
include RubyLess
|
20
|
-
safe_method :created_at => Time, :updated_at => Time, :fullname => String, :initials => String,
|
21
|
-
:address => String
|
22
|
-
safe_attribute :name, :first_name, :city, :country, :telephone, :mobile, :email, :zip
|
23
|
-
|
24
|
-
attr_protected :site_id
|
25
|
-
|
26
|
-
after_initialize :set_contact_content_defaults
|
27
|
-
before_validation :content_before_validation
|
28
|
-
|
29
|
-
#extend Zena::Use::Multiversion
|
30
|
-
#act_as_content
|
31
|
-
|
32
|
-
# Full contact name to show in views.
|
33
|
-
def fullname(first_name = self.first_name, name = self.name)
|
34
|
-
(!first_name.blank? && !name.blank?) ? (first_name + " " + name) : (first_name.blank? ? name : first_name)
|
35
|
-
end
|
36
|
-
|
37
|
-
# First letters of the first_name and the name in capitals (ex. GB).
|
38
|
-
def initials
|
39
|
-
fullname.split(" ").map {|w| w[0..0].capitalize}.join("")
|
40
|
-
end
|
41
|
-
|
42
|
-
# Return true if this content is not used by any version.
|
43
|
-
def can_destroy?
|
44
|
-
0 == self.class.count_by_sql("SELECT COUNT(*) FROM versions WHERE id = #{self[:version_id]} OR content_id = #{self[:version_id]}")
|
45
|
-
end
|
46
|
-
|
47
|
-
def fullname_was
|
48
|
-
fullname(first_name_changed? ? first_name_was : self.first_name, name_changed? ? name_was : self.name)
|
49
|
-
end
|
50
|
-
|
51
|
-
def fullname_changed?
|
52
|
-
first_name_changed? || name_changed?
|
53
|
-
end
|
54
|
-
|
55
|
-
def attributes_with_defaults=(attrs)
|
56
|
-
self.attributes_without_defaults = attrs
|
57
|
-
%W{address}.each do |txt_field|
|
58
|
-
self[txt_field] ||= ''
|
59
|
-
end
|
60
|
-
end
|
61
|
-
alias_method_chain :attributes=, :defaults
|
62
|
-
|
63
|
-
private
|
64
|
-
def content_before_validation
|
65
|
-
self[:site_id] = version.node[:site_id]
|
66
|
-
[:first_name, :name, :address, :zip, :city, :telephone, :mobile, :email].each do |sym|
|
67
|
-
self[sym] ||= ""
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
=begin rdoc
|
2
|
-
This class stores version text for BaseContact. See Version for details.
|
3
|
-
|
4
|
-
=== Content
|
5
|
-
|
6
|
-
Uses ContactContent.
|
7
|
-
=end
|
8
|
-
class BaseContactVersion < Version
|
9
|
-
|
10
|
-
def self.content_class
|
11
|
-
ContactContent
|
12
|
-
end
|
13
|
-
|
14
|
-
def redaction_content
|
15
|
-
@old_fullname ||= content.fullname
|
16
|
-
super
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
def version_before_validation
|
21
|
-
if title.blank?
|
22
|
-
self.title = content.fullname
|
23
|
-
elsif content.fullname.blank?
|
24
|
-
if title =~ /^(\S+)\s+(.*)$/
|
25
|
-
content.first_name = $1
|
26
|
-
content.name = $2
|
27
|
-
else
|
28
|
-
content.name = title
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
if title_changed? && content.fullname_changed?
|
33
|
-
# ignore if both title and fullname changed
|
34
|
-
elsif content.fullname_changed? && title == content.fullname_was
|
35
|
-
# fullname changed and title was in sync
|
36
|
-
self.title = content.fullname
|
37
|
-
end
|
38
|
-
super
|
39
|
-
end
|
40
|
-
end
|
data/app/models/reference.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
=begin rdoc
|
2
|
-
A reference represents some information that the site mirrors. It is not displayed in the page hierarchy nor in some date related view (calendar,blog) but is usually found by doing a search or by its links. For example you could create a Tag called 'clients' and link every contact that is a client to this tag. Going to this tag you would have the list of clients.
|
3
|
-
|
4
|
-
A reference can only be created in a Section. It can be linked from anywhere.
|
5
|
-
|
6
|
-
=== subclasses
|
7
|
-
|
8
|
-
BaseContact:: every User has a unique contact page to store address, name, phone, etc.
|
9
|
-
Book:: used to add a bibliography and/or by the 'Reading' class (not implemented yet).
|
10
|
-
|
11
|
-
=== links
|
12
|
-
|
13
|
-
Default links for Reference are:
|
14
|
-
|
15
|
-
reference_for:: nodes for which the current item is a reference.
|
16
|
-
=end
|
17
|
-
class Reference < Node
|
18
|
-
end
|