zena 1.0.0.rc2 → 1.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +23 -0
- data/README.rdoc +1 -1
- data/app/controllers/columns_controller.rb +3 -31
- data/app/controllers/comments_controller.rb +8 -3
- data/app/controllers/data_entries_controller.rb +1 -1
- data/app/controllers/documents_controller.rb +2 -2
- data/app/controllers/nodes_controller.rb +29 -12
- data/app/controllers/relations_controller.rb +2 -2
- data/app/controllers/sites_controller.rb +1 -1
- data/app/controllers/user_sessions_controller.rb +6 -3
- data/app/controllers/users_controller.rb +18 -16
- data/app/controllers/versions_controller.rb +20 -18
- data/app/controllers/virtual_classes_controller.rb +103 -17
- data/app/helpers/users_helper.rb +1 -1
- data/app/models/column.rb +19 -50
- data/app/models/comment.rb +2 -1
- data/app/models/node.rb +45 -22
- data/app/models/relation.rb +13 -0
- data/app/models/relation_proxy.rb +3 -2
- data/app/models/role.rb +213 -4
- data/app/models/site.rb +18 -11
- data/app/models/template.rb +37 -35
- data/app/models/version.rb +1 -1
- data/app/models/virtual_class.rb +154 -86
- data/app/views/columns/_li.html.erb +1 -1
- data/app/views/columns/index.html.erb +1 -9
- data/app/views/comments/index.rhtml +10 -8
- data/app/views/documents/_crop.rhtml +5 -6
- data/app/views/documents/crop_form.rjs +3 -2
- data/app/views/groups/index.rhtml +1 -1
- data/app/views/iformats/index.rhtml +1 -1
- data/app/views/nodes/_import_results.rhtml +1 -1
- data/app/views/nodes/_parent.rhtml +1 -2
- data/app/views/nodes/update.rjs +3 -4
- data/app/views/relations/index.erb +1 -1
- data/app/views/sites/index.erb +1 -1
- data/app/views/templates/drive_tabs/_drive.rhtml +0 -2
- data/app/views/templates/edit_tabs/_image.rhtml +1 -1
- data/app/views/templates/edit_tabs/_title.rhtml +0 -6
- data/app/views/users/index.rhtml +1 -1
- data/app/views/users/preferences.html.erb +2 -2
- data/app/views/versions/backup.rjs +1 -1
- data/app/views/versions/custom_tab.rhtml +9 -4
- data/app/views/versions/destroy.rjs +2 -2
- data/app/views/versions/update.rjs +2 -9
- data/app/views/virtual_classes/_form.erb +3 -2
- data/app/views/virtual_classes/import_prepare.html.erb +13 -0
- data/app/views/virtual_classes/index.erb +28 -8
- data/app/views/zafu/default/Node-+adminLayout.zafu +1 -13
- data/app/views/zafu/default/Node-+login.zafu +1 -0
- data/app/views/zafu/default/Node-+notFound.zafu +1 -1
- data/app/views/zafu/default/Node-+popupLayout.zafu +1 -2
- data/app/views/zafu/default/Node-+search.zafu +1 -1
- data/app/views/zafu/default/Node-admin.zafu +205 -0
- data/app/views/zafu/default/Node.zafu +11 -11
- data/bricks/captcha/lib/bricks/captcha.rb +3 -2
- data/bricks/mongrel/zena/init.rb +2 -1
- data/bricks/pdf/README +5 -5
- data/bricks/pdf/lib/bricks/pdf/engine/prince.rb +2 -2
- data/bricks/pdf/lib/bricks/pdf/engine/xhtml2pdf.rb +2 -2
- data/bricks/pdf/lib/bricks/pdf/install.rb +5 -5
- data/bricks/pdf/lib/bricks/pdf.rb +11 -11
- data/bricks/pdf/test/engines/test_prince.rb +4 -4
- data/bricks/pdf/test/engines/test_xhtml2pdf.rb +4 -4
- data/bricks/pdf/test/shoulda_macros/shoulda_pdf.rb +2 -2
- data/bricks/pdf/zena/init.rb +2 -2
- data/bricks/pdf/zena/tasks.rb +2 -2
- data/bricks/sphinx/lib/bricks/sphinx.rb +6 -2
- data/bricks/sphinx/zena/{sphinx.yml → sphinx.yml.erb} +2 -2
- data/bricks/sphinx/zena/tasks.rb +28 -2
- data/bricks/tags/lib/bricks/tags.rb +16 -1
- data/bricks/tags/zena/test/unit/tags_test.rb +15 -0
- data/bricks/tags/zena/test/zafu/tags.yml +5 -1
- data/bricks/worker/lib/bricks/worker.rb +39 -0
- data/bricks/worker/zena/deploy.rb +0 -2
- data/bricks/worker/zena/init.rb +1 -0
- data/bricks/worker/zena/test/sites/zena/delayed_jobs.yml +16 -0
- data/bricks/worker/zena/test/zafu/worker.yml +8 -0
- data/bricks/zena/zena/migrate/01_base.rb +36 -60
- data/bricks/zena/zena/migrate/02_zerox1_schema.rb +388 -0
- data/bricks/zena/zena/migrate/03_zerox1_data.rb +380 -0
- data/bricks/zena/zena/migrate/20110315161158_add_reverse_scope_to_roles.rb +9 -0
- data/config/database_example.yml +1 -1
- data/config/environment.rb +1 -1
- data/config/gems.yml +17 -14
- data/db/init/base/skins/default/Node-+index.zafu +8 -1
- data/db/init/base/skins/default/Node-+login.zafu +1 -0
- data/db/init/base/skins/default/Node-+popupLayout.zafu +1 -2
- data/db/init/base/skins/default/Node-+search.zafu +2 -2
- data/db/init/base/skins/default/Node.zafu +9 -9
- data/db/init/base/skins/default/{favicon.png → img/favicon.png} +0 -0
- data/db/init/base/skins/default/{style.css → img/style.css} +0 -0
- data/db/init/base/skins/default/img/translations.yml +11 -0
- data/db/init/base/skins/default/notes.zafu +7 -9
- data/doc/zafu_changes.yml +12 -0
- data/lib/bricks/loader.rb +38 -15
- data/lib/tasks/zena.rake +74 -24
- data/lib/zena/acts/enrollable.rb +4 -1
- data/lib/zena/acts/secure.rb +2 -48
- data/lib/zena/acts/serializable.rb +13 -1
- data/lib/zena/app.rb +9 -0
- data/lib/zena/code_syntax.rb +154 -151
- data/lib/zena/console.rb +141 -0
- data/lib/zena/controller/test_case.rb +1 -1
- data/lib/zena/db_helper/abstract_db.rb +17 -5
- data/lib/zena/db_helper/mysql.rb +14 -12
- data/lib/zena/db_helper/postgresql.rb +1 -2
- data/lib/zena/db_helper/sqlite3.rb +6 -6
- data/lib/zena/deploy/awstats.conf.rhtml +1 -1
- data/lib/zena/deploy/httpd.rhtml +6 -1
- data/lib/zena/deploy/vhost.rhtml +9 -1
- data/lib/zena/deploy.rb +12 -7
- data/lib/zena/foxy_parser.rb +3 -1
- data/lib/zena/info.rb +1 -1
- data/lib/zena/parser/zafu_tags.rb +1 -0
- data/lib/zena/parser/zazen_rules.rb +1 -1
- data/lib/zena/remote/node.rb +15 -3
- data/lib/zena/remote/serializable_array.rb +19 -0
- data/lib/zena/remote.rb +1 -0
- data/lib/zena/routes.rb +7 -2
- data/lib/zena/site_worker.rb +11 -1
- data/lib/zena/unit/test_case.rb +68 -0
- data/lib/zena/use/action.rb +6 -2
- data/lib/zena/use/ajax.rb +127 -53
- data/lib/zena/use/ancestry.rb +11 -8
- data/lib/zena/use/calendar.rb +265 -129
- data/lib/zena/use/conditional.rb +1 -1
- data/lib/zena/use/context.rb +5 -5
- data/lib/zena/use/dates.rb +172 -60
- data/lib/zena/use/display.rb +70 -39
- data/lib/zena/use/error_rendering.rb +1 -3
- data/lib/zena/use/field_index.rb +4 -1
- data/lib/zena/use/forms.rb +94 -72
- data/lib/zena/use/fulltext.rb +16 -24
- data/lib/zena/use/html_tags.rb +20 -12
- data/lib/zena/use/i18n.rb +37 -37
- data/lib/zena/use/image_builder.rb +8 -1
- data/lib/zena/use/ml_index.rb +16 -16
- data/lib/zena/use/prop_eval.rb +10 -5
- data/lib/zena/use/query_builder.rb +55 -23
- data/lib/zena/use/query_node.rb +51 -25
- data/lib/zena/use/refactor.rb +2 -28
- data/lib/zena/use/relations.rb +1 -1
- data/lib/zena/use/rendering.rb +29 -0
- data/lib/zena/use/scope_index.rb +75 -14
- data/lib/zena/use/search.rb +5 -10
- data/lib/zena/use/test_helper.rb +2 -2
- data/lib/zena/use/urls.rb +125 -104
- data/lib/zena/use/workflow.rb +2 -1
- data/lib/zena/use/zafu_attributes.rb +2 -2
- data/lib/zena/use/zafu_safe_definitions.rb +20 -0
- data/lib/zena/use/zafu_templates.rb +20 -6
- data/lib/zena/use/zazen.rb +31 -20
- data/lib/zena/view/test_case.rb +5 -0
- data/lib/zena/zafu_compiler.rb +24 -2
- data/lib/zena.rb +12 -6
- data/locale/de/LC_MESSAGES/zena.mo +0 -0
- data/locale/de/zena.po +1345 -1164
- data/locale/en/LC_MESSAGES/zena.mo +0 -0
- data/locale/en/zena.po +1275 -1129
- data/locale/fr/LC_MESSAGES/zena.mo +0 -0
- data/locale/fr/zena.mo +0 -0
- data/locale/fr/zena.po +1617 -1441
- data/locale/log.txt +9 -0
- data/locale/zena.pot +957 -748
- data/public/javascripts/prototype.js +1 -1
- data/public/javascripts/zena.js +99 -44
- data/public/stylesheets/admin.css +6 -4
- data/public/stylesheets/backend.css +71 -0
- data/public/stylesheets/calendar.css +24 -25
- data/public/stylesheets/code.css +11 -6
- data/public/stylesheets/comment.css +2 -1
- data/public/stylesheets/popup.css +7 -8
- data/test/custom_queries/complex.host.yml +15 -1
- data/test/fixtures/files/Node-test.zafu +29 -28
- data/test/fixtures/files/translations_de.yml +12 -1
- data/test/fixtures/files/translations_fr.yml +12 -1
- data/test/functional/comments_controller_test.rb +9 -0
- data/test/functional/iformats_controller_test.rb +1 -1
- data/test/functional/nodes_controller_test.rb +124 -35
- data/test/functional/users_controller_test.rb +132 -3
- data/test/functional/virtual_classes_controller_test.rb +75 -4
- data/test/integration/navigation_test.rb +51 -9
- data/test/integration/query_node/basic.yml +19 -7
- data/test/integration/query_node/complex.yml +1 -1
- data/test/integration/query_node/dates.yml +27 -1
- data/test/integration/query_node/filters.yml +1 -1
- data/test/integration/query_node/relations.yml +13 -4
- data/test/integration/query_node_test.rb +4 -0
- data/test/integration/xml_api_test.rb +6 -1
- data/test/integration/zafu_compiler/action.yml +3 -3
- data/test/integration/zafu_compiler/ajax.yml +103 -22
- data/test/integration/zafu_compiler/basic.yml +0 -52
- data/test/integration/zafu_compiler/calendar.yml +44 -20
- data/test/integration/zafu_compiler/comments.yml +53 -0
- data/test/integration/zafu_compiler/complex.yml +11 -11
- data/test/integration/zafu_compiler/complex_ok.yml +16 -3
- data/test/integration/zafu_compiler/conditional.yml +15 -5
- data/test/integration/zafu_compiler/context.yml +9 -0
- data/test/integration/zafu_compiler/dates.yml +43 -15
- data/test/integration/zafu_compiler/display.yml +60 -6
- data/test/integration/zafu_compiler/errors.yml +6 -2
- data/test/integration/zafu_compiler/forms.yml +45 -6
- data/test/integration/zafu_compiler/i18n.yml +8 -1
- data/test/integration/zafu_compiler/meta.yml +38 -0
- data/test/integration/zafu_compiler/query.yml +43 -4
- data/test/integration/zafu_compiler/relations.yml +26 -33
- data/test/integration/zafu_compiler/rubyless.yml +10 -0
- data/test/integration/zafu_compiler/safe_definitions.yml +21 -1
- data/test/integration/zafu_compiler/urls.yml +75 -5
- data/test/integration/zafu_compiler/version.yml +2 -2
- data/test/integration/zafu_compiler/zafu_attributes.yml +5 -1
- data/test/integration/zafu_compiler/zazen.yml +14 -6
- data/test/integration/zafu_compiler_test.rb +5 -1
- data/test/sites/complex/columns.yml +5 -0
- data/test/sites/complex/roles.yml +4 -0
- data/test/sites/zena/nodes.yml +13 -2
- data/test/sites/zena/roles.yml +13 -5
- data/test/sites/zena/versions.yml +27 -9
- data/test/unit/column_test.rb +51 -5
- data/test/unit/iformat_test.rb +2 -2
- data/test/unit/node_test.rb +29 -17
- data/test/unit/note_test.rb +1 -1
- data/test/unit/relation_proxy_test.rb +4 -5
- data/test/unit/relation_test.rb +16 -0
- data/test/unit/remote_test.rb +2 -2
- data/test/unit/role_test.rb +292 -4
- data/test/unit/site_test.rb +12 -0
- data/test/unit/template_test.rb +1 -1
- data/test/unit/text_document_test.rb +1 -1
- data/test/unit/virtual_class_test.rb +200 -83
- data/test/unit/zena/acts/enrollable_test.rb +26 -31
- data/test/unit/zena/use/calendar_test.rb +90 -37
- data/test/unit/zena/use/field_index_test.rb +28 -0
- data/test/unit/zena/use/html_tags_test.rb +7 -3
- data/test/unit/zena/use/ml_index_test.rb +2 -16
- data/test/unit/zena/use/nested_attributes_alias_view_test.rb +2 -2
- data/test/unit/zena/use/prop_eval_test.rb +50 -8
- data/test/unit/zena/use/query_node_test.rb +11 -0
- data/test/unit/zena/use/rendering_test.rb +72 -0
- data/test/unit/zena/use/scope_index_test.rb +37 -2
- data/test/unit/zena/use/urls_test.rb +10 -0
- data/test/unit/zena/use/zazen_test.rb +3 -3
- data/vendor/plugins/gettext_i18n_rails/Gemfile +11 -0
- data/vendor/plugins/gettext_i18n_rails/Gemfile.lock +92 -0
- data/vendor/plugins/gettext_i18n_rails/Rakefile +12 -17
- data/vendor/plugins/gettext_i18n_rails/Readme.md +215 -0
- data/vendor/plugins/gettext_i18n_rails/VERSION +1 -1
- data/vendor/plugins/gettext_i18n_rails/gettext_i18n_rails.gemspec +38 -34
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/active_record.rb +1 -1
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/backend.rb +30 -14
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/haml_parser.rb +1 -1
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/html_safe_translations.rb +29 -0
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/i18n_hacks.rb +29 -1
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/model_attributes_finder.rb +7 -1
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/railtie.rb +10 -0
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/ruby_gettext_extractor.rb +6 -2
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/string_interpolate_fix.rb +20 -0
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails/tasks.rb +120 -0
- data/vendor/plugins/gettext_i18n_rails/lib/gettext_i18n_rails.rb +10 -3
- data/vendor/plugins/gettext_i18n_rails/lib/tasks/gettext_rails_i18n.rake +1 -74
- data/vendor/plugins/gettext_i18n_rails/spec/gettext_i18n_rails/active_record_spec.rb +51 -20
- data/vendor/plugins/gettext_i18n_rails/spec/gettext_i18n_rails/backend_spec.rb +12 -7
- data/vendor/plugins/gettext_i18n_rails/spec/gettext_i18n_rails/string_interpolate_fix_spec.rb +32 -0
- data/vendor/plugins/gettext_i18n_rails/spec/gettext_i18n_rails_spec.rb +38 -1
- data/vendor/plugins/gettext_i18n_rails/spec/rails2/Gemfile +11 -0
- data/vendor/plugins/gettext_i18n_rails/spec/spec_helper.rb +1 -8
- data/zena.gemspec +2241 -2217
- metadata +123 -83
- data/.gitignore +0 -36
- data/app/views/nodes/_dates.rhtml +0 -13
- data/db/init/base/skins/default/Node-+adminLayout.zafu +0 -46
- data/db/init/base/skins/default/Node-tree.zafu +0 -19
- data/vendor/plugins/gettext_i18n_rails/README.markdown +0 -143
@@ -13,19 +13,19 @@ require 'tempfile'
|
|
13
13
|
# end
|
14
14
|
|
15
15
|
module Bricks
|
16
|
-
module
|
16
|
+
module Pdf
|
17
17
|
class Install
|
18
18
|
|
19
|
-
# Utility to install library necessary to
|
19
|
+
# Utility to install library necessary to Pdf on unix like machine.
|
20
20
|
#
|
21
|
-
# To install xhtml2pdf and his dependencies, see
|
21
|
+
# To install xhtml2pdf and his dependencies, see Pdf::xhtml2pdf in zena/tasks.rb
|
22
22
|
|
23
23
|
include FileUtils::Verbose
|
24
24
|
|
25
25
|
attr_reader :url, :file, :md5, :sha1, :force
|
26
26
|
|
27
27
|
def self.from_url url, opts={}
|
28
|
-
tmpf = Tempfile.new('
|
28
|
+
tmpf = Tempfile.new('Pdf').path
|
29
29
|
install_dir = "#{tmpf}_d"
|
30
30
|
FileUtils.mkpath(install_dir)
|
31
31
|
in_dir(install_dir) do
|
@@ -111,7 +111,7 @@ module Bricks
|
|
111
111
|
end
|
112
112
|
|
113
113
|
end # Install
|
114
|
-
end #
|
114
|
+
end # Pdf
|
115
115
|
end # Bricks
|
116
116
|
|
117
117
|
|
@@ -1,19 +1,19 @@
|
|
1
1
|
=begin rdoc
|
2
|
-
|
2
|
+
Pdf is module to render file or IO streams (strings obviously) into pdf.
|
3
3
|
|
4
4
|
Examples:
|
5
5
|
|
6
|
-
Bricks::
|
6
|
+
Bricks::Pdf.engine = 'Xhtml2pdf'
|
7
7
|
|
8
|
-
Bricks::
|
9
|
-
Bricks::
|
8
|
+
Bricks::Pdf.render_file "myfile.html" => STDOUT (strings)
|
9
|
+
Bricks::Pdf.render_file "myfile.html", "out.pdf" => out.pdf (file)
|
10
10
|
|
11
|
-
Bricks::
|
12
|
-
Bricks::
|
11
|
+
Bricks::Pdf.render_string "This is text to render." => STDOUT (strings)
|
12
|
+
Bricks::Pdf.render_string "This is text to render.", "out.pdf" => out.pdf (file)
|
13
13
|
=end
|
14
14
|
|
15
15
|
module Bricks
|
16
|
-
module
|
16
|
+
module Pdf
|
17
17
|
extend self
|
18
18
|
# Wrapper around pdf engines
|
19
19
|
module Engine
|
@@ -31,10 +31,10 @@ module Bricks
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def engine=(engine_name)
|
34
|
-
engine_module = Zena.resolve_const("Bricks::
|
34
|
+
engine_module = Zena.resolve_const("Bricks::Pdf::Engine::#{engine_name.to_s.capitalize}")
|
35
35
|
extend engine_module
|
36
36
|
rescue NameError
|
37
|
-
raise
|
37
|
+
raise Pdf::InvalidEngine, "Could not load pdf engine '#{engine_name}'."
|
38
38
|
end
|
39
39
|
|
40
40
|
def render(options)
|
@@ -66,7 +66,7 @@ module Bricks
|
|
66
66
|
|
67
67
|
target_file = Tempfile.new('trg').path + '.pdf'
|
68
68
|
|
69
|
-
data = Bricks::
|
69
|
+
data = Bricks::Pdf.render(get_render_auth_params.merge(
|
70
70
|
:data => data,
|
71
71
|
:output => target_file
|
72
72
|
))
|
@@ -106,5 +106,5 @@ module Bricks
|
|
106
106
|
|
107
107
|
module ZafuMethods
|
108
108
|
end # ZafuMethods
|
109
|
-
end #
|
109
|
+
end # Pdf
|
110
110
|
end # Bricks
|
@@ -2,14 +2,14 @@ require 'helper'
|
|
2
2
|
require 'bricks/pdf/engine/prince'
|
3
3
|
|
4
4
|
class TestPrince < Test::Unit::TestCase
|
5
|
-
context 'With a Prince based
|
5
|
+
context 'With a Prince based Pdf engine' do
|
6
6
|
subject do
|
7
7
|
Module.new do
|
8
|
-
extend Bricks::
|
9
|
-
extend Bricks::
|
8
|
+
extend Bricks::Pdf
|
9
|
+
extend Bricks::Pdf::Engine::Prince
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
should_behave_as_pdf_engine
|
14
|
-
end # With a Prince based
|
14
|
+
end # With a Prince based Pdf engine
|
15
15
|
end
|
@@ -2,14 +2,14 @@ require 'helper'
|
|
2
2
|
require 'bricks/pdf/engine/xhtml2pdf'
|
3
3
|
|
4
4
|
class TestXhtml2pdf < Test::Unit::TestCase
|
5
|
-
context 'With a Prince based
|
5
|
+
context 'With a Prince based Pdf engine' do
|
6
6
|
subject do
|
7
7
|
Module.new do
|
8
|
-
extend Bricks::
|
9
|
-
extend Bricks::
|
8
|
+
extend Bricks::Pdf
|
9
|
+
extend Bricks::Pdf::Engine::Xhtml2pdf
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
should_behave_as_pdf_engine
|
14
|
-
end # With a Xhtml2pdf based
|
14
|
+
end # With a Xhtml2pdf based Pdf engine
|
15
15
|
end
|
@@ -27,7 +27,7 @@ class Test::Unit::TestCase
|
|
27
27
|
end
|
28
28
|
|
29
29
|
should 'fill STDOUT if no destination is specified' do
|
30
|
-
assert_match %r{^%
|
30
|
+
assert_match %r{^%Pdf}, subject.render(:input => contact_html)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -40,7 +40,7 @@ class Test::Unit::TestCase
|
|
40
40
|
end
|
41
41
|
|
42
42
|
should 'fill STDOUT if no destination is specified' do
|
43
|
-
assert_match %r{^%
|
43
|
+
assert_match %r{^%Pdf}, subject.render(:data => '<html>Hello World</html>')
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
data/bricks/pdf/zena/init.rb
CHANGED
data/bricks/pdf/zena/tasks.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
namespace :pdf do
|
2
2
|
desc "Install binary for xhtml2pdf library"
|
3
3
|
task :xhtml2pdf => :environment do
|
4
|
-
install = Bricks::
|
4
|
+
install = Bricks::Pdf::Install
|
5
5
|
install.from_url "http://pypi.python.org/packages/source/p/pisa/pisa-3.0.33.tar.gz", :md5 => 'e2040b12211303d065bc4ae2470d2700'
|
6
6
|
|
7
7
|
install.from_url "http://www.reportlab.com/ftp/reportlab-2.5.tar.gz"
|
@@ -12,6 +12,6 @@ namespace :pdf do
|
|
12
12
|
|
13
13
|
install.from_url 'http://pybrary.net/pyPdf/pyPdf-1.12.tar.gz'
|
14
14
|
|
15
|
-
puts "\n==========================================\nBricks::
|
15
|
+
puts "\n==========================================\nBricks::Pdf dependencies installation done"
|
16
16
|
end
|
17
17
|
end
|
@@ -7,7 +7,7 @@ module Bricks
|
|
7
7
|
def search_text(query, opts = {})
|
8
8
|
if offset = opts[:offset]
|
9
9
|
limit = opts[:limit] || 20
|
10
|
-
ids = search_for_ids(query, :with => with, :limit => (offset + limit) * [limit,20].max)
|
10
|
+
ids = search_for_ids(query, :with => opts[:with], :limit => (offset + limit) * [limit,20].max)
|
11
11
|
return [] if ids.empty?
|
12
12
|
# 1. filter with secure
|
13
13
|
secure_ids = Zena::Db.fetch_ids("SELECT id FROM nodes WHERE #{secure_scope('nodes')} AND id IN (#{ids.join(',')})")
|
@@ -56,7 +56,11 @@ module Bricks
|
|
56
56
|
|
57
57
|
where "versions.status >= #{Zena::Status[:pub]}"
|
58
58
|
|
59
|
-
set_property :field_weights => {
|
59
|
+
set_property :field_weights => {
|
60
|
+
:idx_text_high => 5,
|
61
|
+
:idx_text_medium => 3,
|
62
|
+
:idx_text_lowv => 2
|
63
|
+
}
|
60
64
|
set_property :group_concat_max_len => 30000 # FIXME: articles can easily have a length of 17000 chars...
|
61
65
|
set_property :delta => (has_dd ? :delayed : true)
|
62
66
|
end
|
@@ -4,8 +4,8 @@ test:
|
|
4
4
|
production:
|
5
5
|
enable_star: 1
|
6
6
|
min_infix_len: 2
|
7
|
-
pid_file:
|
8
|
-
searchd_files:
|
7
|
+
pid_file: <%= shared_path %>/log/searchd.production.pid
|
8
|
+
searchd_files: <%= shared_path %>/db/sphinx
|
9
9
|
run_indexer_at: "10,40"
|
10
10
|
|
11
11
|
development:
|
data/bricks/sphinx/zena/tasks.rb
CHANGED
@@ -2,6 +2,28 @@
|
|
2
2
|
# environment since it needs to get configuration settings from the classes in zena.
|
3
3
|
require 'tempfile'
|
4
4
|
require 'yaml'
|
5
|
+
require 'thinking_sphinx'
|
6
|
+
|
7
|
+
|
8
|
+
class RenderClass
|
9
|
+
def initialize(path)
|
10
|
+
@text = File.read(path)
|
11
|
+
end
|
12
|
+
|
13
|
+
def render(hash)
|
14
|
+
@values = hash
|
15
|
+
ERB.new(@text).result(binding)
|
16
|
+
end
|
17
|
+
|
18
|
+
def method_missing(sym)
|
19
|
+
return @values[sym] if @values.has_key?(sym)
|
20
|
+
super
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def render(file, hash)
|
25
|
+
RenderClass.new(file).render(hash)
|
26
|
+
end
|
5
27
|
|
6
28
|
namespace :sphinx do
|
7
29
|
setup_done = File.exist?("#{RAILS_ROOT}/config/#{RAILS_ENV}.sphinx.conf")
|
@@ -14,7 +36,10 @@ namespace :sphinx do
|
|
14
36
|
if File.exist?("#{RAILS_ROOT}/config/sphinx.yml")
|
15
37
|
puts "Sphinx searchd: config/sphinx.yml exists, not copying"
|
16
38
|
else
|
17
|
-
|
39
|
+
conf = render(File.join(File.dirname(__FILE__), 'sphinx.yml.erb'), :shared_path => File.expand_path(File.join(RAILS_ROOT,'..', '..', 'shared')))
|
40
|
+
File.open("#{RAILS_ROOT}/config/sphinx.yml", 'wb') do |f|
|
41
|
+
f.puts conf
|
42
|
+
end
|
18
43
|
puts "Sphinx searchd: created initial config/sphinx.yml"
|
19
44
|
end
|
20
45
|
|
@@ -48,7 +73,8 @@ namespace :sphinx do
|
|
48
73
|
else
|
49
74
|
crontab = res.chomp.split("\n")
|
50
75
|
res = []
|
51
|
-
|
76
|
+
root = File.expand_path(File.join(RAILS_ROOT, '..', '..', 'current'))
|
77
|
+
job = "#{every} * * * * cd #{root} && /usr/bin/env rake RAILS_ENV=production sphinx:index >> /root/cron.log 2>&1"
|
52
78
|
job_inserted = false
|
53
79
|
job_action = 'install'
|
54
80
|
crontab.each do |line|
|
@@ -24,6 +24,18 @@ module Bricks
|
|
24
24
|
end
|
25
25
|
|
26
26
|
module InstanceMethods
|
27
|
+
def self.included(base)
|
28
|
+
# TODO: when we use to_xml instead of XmlSerializer, we can
|
29
|
+
# use 'tag_names' => SerializableArray.new('tag_names', 'tag', tag_names)
|
30
|
+
base.export_xml(Proc.new do |opts|
|
31
|
+
builder, rec = opts[:builder], opts[:record]
|
32
|
+
builder.tag!('tag_names', :type => :array) do
|
33
|
+
rec.tag_names.each do |tag|
|
34
|
+
builder.tag!('tag', tag, :type => :string)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end)
|
38
|
+
end
|
27
39
|
|
28
40
|
def l_tag
|
29
41
|
l_comment
|
@@ -77,6 +89,10 @@ module Bricks
|
|
77
89
|
@tag_names ||= (tags || []).map {|t| t[:comment]}
|
78
90
|
end
|
79
91
|
|
92
|
+
def tag_names=(tag_array)
|
93
|
+
@tag_names = tag_array
|
94
|
+
end
|
95
|
+
|
80
96
|
# List of Links that are tags for the current node.
|
81
97
|
def tags
|
82
98
|
return @tags if defined?(@tags)
|
@@ -118,7 +134,6 @@ module Bricks
|
|
118
134
|
end
|
119
135
|
end
|
120
136
|
|
121
|
-
|
122
137
|
private
|
123
138
|
|
124
139
|
def tags_as_list(str)
|
@@ -100,4 +100,19 @@ class TagsTest < Zena::Unit::TestCase
|
|
100
100
|
assert_equal 'big, brown, socks', node.tag_list
|
101
101
|
end
|
102
102
|
|
103
|
+
context 'A node with tags' do
|
104
|
+
setup do
|
105
|
+
login(:tiger)
|
106
|
+
end
|
107
|
+
|
108
|
+
subject do
|
109
|
+
secure(Node) { nodes(:status) }
|
110
|
+
end
|
111
|
+
|
112
|
+
should 'serialize tag values in xml' do
|
113
|
+
assert_equal %w{blue sky}, Hash.from_xml(subject.to_xml)['node']['tag_names']
|
114
|
+
end
|
115
|
+
end # A node with tags
|
116
|
+
|
117
|
+
|
103
118
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# test_file:
|
1
|
+
# test_file: ../../../../../test/integration/zafu_compiler_test.rb
|
2
2
|
default:
|
3
3
|
context:
|
4
4
|
node: 'status'
|
@@ -39,3 +39,7 @@ tag_names:
|
|
39
39
|
node: 'status'
|
40
40
|
src: "<r:tag_names><r:each join=', ' do='show'/></r:tag_names>"
|
41
41
|
res: "blue, sky"
|
42
|
+
|
43
|
+
checkbox_tagged:
|
44
|
+
src: "<r:input type='checkbox' name='tagged[blue]'/>"
|
45
|
+
res: "<input type='checkbox' name='node[tagged][blue]' value='blue' checked='checked'/>"
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Bricks
|
2
|
+
module Worker
|
3
|
+
class Job < ActiveRecord::Base
|
4
|
+
include RubyLess
|
5
|
+
set_table_name :delayed_jobs
|
6
|
+
|
7
|
+
safe_method :run_at => Time, :created_at => Time, :info => String
|
8
|
+
# can be nil
|
9
|
+
safe_context :locked_at => Time, :locked_by => String
|
10
|
+
|
11
|
+
def info
|
12
|
+
obj = YAML.load(self[:handler])
|
13
|
+
if obj.respond_to?(:info)
|
14
|
+
obj.info
|
15
|
+
else
|
16
|
+
obj.inspect
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end # Job
|
20
|
+
|
21
|
+
module ViewMethods
|
22
|
+
include RubyLess
|
23
|
+
|
24
|
+
safe_context :delayed_jobs => [Job]
|
25
|
+
|
26
|
+
def delayed_jobs
|
27
|
+
jobs = Bricks::Worker::Job.find(:all,
|
28
|
+
# FIXME: find a way to add site_id to delayed_jobs...
|
29
|
+
#:conditions => ['site_id = ?', current_site.id],
|
30
|
+
:order => 'run_at ASC'
|
31
|
+
)
|
32
|
+
jobs.empty? ? nil : jobs
|
33
|
+
end
|
34
|
+
end # ViewMethods
|
35
|
+
end # Worker
|
36
|
+
end
|
37
|
+
|
38
|
+
# Make sure the class is loaded before first YAML.load
|
39
|
+
Zena::SiteWorker
|
data/bricks/worker/zena/init.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
zena_index:
|
2
|
+
run_at: 2011-03-21 10:41
|
3
|
+
handler: |
|
4
|
+
--- !ruby/struct:Zena::SiteWorker
|
5
|
+
site_id: 705790410
|
6
|
+
action: :rebuild_index
|
7
|
+
page: 1
|
8
|
+
|
9
|
+
ocean_vhash:
|
10
|
+
run_at: 2011-03-21 10:05
|
11
|
+
handler: |
|
12
|
+
--- !ruby/struct:Zena::SiteWorker
|
13
|
+
site_id: 740511775
|
14
|
+
action: :rebuild_vhash
|
15
|
+
page: 1
|
16
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# test_file: ../../../../test/integration/zafu_compiler_test.rb
|
2
|
+
default:
|
3
|
+
context:
|
4
|
+
node: 'status'
|
5
|
+
visitor: 'anon'
|
6
|
+
src: "<r:delayed_jobs do='each' join=', '>[<r:run_at format='%Y-%m-%d %H:%M'/> <r:info/>]</r:delayed_jobs>"
|
7
|
+
tem: "/delayed_jobs/"
|
8
|
+
res: "[2011-03-21 10:05 -], [2011-03-21 10:41 rebuild_index, page 1/1]"
|