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
@@ -135,10 +135,23 @@ class VirtualClassesControllerTest < Zena::Controller::TestCase
|
|
135
135
|
|
136
136
|
should 'save name and kpath' do
|
137
137
|
put_subject
|
138
|
-
vclass =
|
138
|
+
vclass = roles(:Letter)
|
139
139
|
assert_equal 'Life', vclass.name
|
140
140
|
assert_equal 'NNL', vclass.kpath
|
141
141
|
end
|
142
|
+
|
143
|
+
context 'by changing prop_eval' do
|
144
|
+
subject do
|
145
|
+
{:action => :update, :id => roles_id(:Letter), :virtual_class => { :prop_eval => '{"title" => "what"}'}}
|
146
|
+
end
|
147
|
+
|
148
|
+
should 'change prop_eval' do
|
149
|
+
put_subject
|
150
|
+
vclass = roles(:Letter)
|
151
|
+
assert_equal '{"title" => "what"}', vclass.prop_eval
|
152
|
+
end
|
153
|
+
end # by changing prop_eval
|
154
|
+
|
142
155
|
|
143
156
|
# TODO: What happens to properties for a class if kpath changes ?
|
144
157
|
end # updating a virtual class
|
@@ -180,17 +193,75 @@ class VirtualClassesControllerTest < Zena::Controller::TestCase
|
|
180
193
|
end
|
181
194
|
end # destroying a virtual class
|
182
195
|
|
196
|
+
context 'prepare import for role definitions' do
|
197
|
+
subject do
|
198
|
+
{:action => :import_prepare, :attachment => uploaded_fixture('vclasses.yml', 'text/yaml')}
|
199
|
+
end
|
200
|
+
|
201
|
+
should 'create a diff' do
|
202
|
+
assert_difference('::Role.count', 0) do
|
203
|
+
post_subject
|
204
|
+
assert_response :success
|
205
|
+
diff = assigns(:diff)
|
206
|
+
assert_match(/<ins class="differ">Foo/, diff)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end # importing virtual class definitions
|
210
|
+
|
183
211
|
context 'importing virtual class definitions' do
|
184
212
|
subject do
|
185
|
-
{:action => :import, :
|
213
|
+
{:action => :import, :roles => {
|
214
|
+
'Node' => {
|
215
|
+
'Note' => {
|
216
|
+
'Foo' => {
|
217
|
+
'type' => 'VirtualClass',
|
218
|
+
},
|
219
|
+
'Bar' => {
|
220
|
+
'type' => 'Role',
|
221
|
+
}
|
222
|
+
}
|
223
|
+
}
|
224
|
+
}.to_yaml}
|
186
225
|
end
|
187
226
|
|
188
227
|
should 'create virtual classes' do
|
189
|
-
assert_difference('VirtualClass.count',
|
190
|
-
|
228
|
+
assert_difference('VirtualClass.count', 1) do
|
229
|
+
assert_difference('Role.count', 2) do
|
230
|
+
post_subject
|
231
|
+
end
|
191
232
|
end
|
192
233
|
end
|
193
234
|
end # importing virtual class definitions
|
235
|
+
|
236
|
+
context 'exporting virtual class definitions' do
|
237
|
+
subject do
|
238
|
+
{:action => :export}
|
239
|
+
end
|
240
|
+
|
241
|
+
should 'dump virtual classes to yaml' do
|
242
|
+
get_subject
|
243
|
+
res = YAML.load @response.body
|
244
|
+
assert_equal 'VirtualClass', res['Node']['Page']['Project']['Blog']['type']
|
245
|
+
assert_equal res['Node']['Original'], roles(:Original).export
|
246
|
+
end
|
247
|
+
end # importing virtual class definitions
|
248
|
+
|
249
|
+
context 'with roles on vclass' do
|
250
|
+
setup do
|
251
|
+
secure!(::Role) { ::Role.create('name' => 'Address', 'superclass' => 'Contact')}
|
252
|
+
end
|
253
|
+
|
254
|
+
context 'exporting virtual class definitions' do
|
255
|
+
subject do
|
256
|
+
{:action => :export}
|
257
|
+
end
|
258
|
+
|
259
|
+
should 'not have role duplicates in yaml' do
|
260
|
+
get_subject
|
261
|
+
assert_no_match %r{Address.*Address}m, @response.body
|
262
|
+
end
|
263
|
+
end # exporting virtual class definitions
|
264
|
+
end # with roles on vclass
|
194
265
|
end # that is an admin
|
195
266
|
end # A logged in user
|
196
267
|
end
|
@@ -96,7 +96,7 @@ class NavigationTest < Zena::Integration::TestCase
|
|
96
96
|
@visitor = users(:tiger)
|
97
97
|
Thread.current[:visitor] = nil
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
should 'render home page' do
|
101
101
|
get 'http://test.host/oo'
|
102
102
|
assert_response :success
|
@@ -255,6 +255,43 @@ class NavigationTest < Zena::Integration::TestCase
|
|
255
255
|
assert_equal 'fr', session[:lang]
|
256
256
|
end
|
257
257
|
|
258
|
+
context 'On a page with custom base' do
|
259
|
+
setup do
|
260
|
+
login(:lion)
|
261
|
+
assert_equal users(:lion).id, visitor.id
|
262
|
+
# add a publication in 'fr'
|
263
|
+
visitor.lang = 'fr'
|
264
|
+
node = secure!(Node) { nodes(:cleanWater) }
|
265
|
+
node.update_attributes(:title => 'Eau propre', :v_status => Zena::Status[:pub])
|
266
|
+
logout
|
267
|
+
end
|
268
|
+
|
269
|
+
subject do
|
270
|
+
'http://test.host/projects-list/Clean-Water-project'
|
271
|
+
end
|
272
|
+
|
273
|
+
should 'get response' do
|
274
|
+
get subject
|
275
|
+
assert_redirected_to '/en/projects-list/Clean-Water-project'
|
276
|
+
follow_redirect!
|
277
|
+
assert_response :success
|
278
|
+
end
|
279
|
+
|
280
|
+
context 'in the wrong language' do
|
281
|
+
should 'redirect to translated page' do
|
282
|
+
# Set 'fr' session lang
|
283
|
+
get 'http://test.host/fr'
|
284
|
+
get subject
|
285
|
+
assert_redirected_to '/fr/projects-list/Clean-Water-project'
|
286
|
+
follow_redirect!
|
287
|
+
assert_redirected_to '/fr/projects-list/Eau-propre'
|
288
|
+
follow_redirect!
|
289
|
+
assert_response :success
|
290
|
+
end
|
291
|
+
end # in the wrong language
|
292
|
+
|
293
|
+
end # On a page with custom base
|
294
|
+
|
258
295
|
def test_url_with_custom_base
|
259
296
|
get 'http://test.host/en/projects-list/Clean-Water-project'
|
260
297
|
assert_response :success
|
@@ -395,14 +432,19 @@ class NavigationTest < Zena::Integration::TestCase
|
|
395
432
|
end
|
396
433
|
end
|
397
434
|
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
435
|
+
# We use test_helper's login
|
436
|
+
# def login(user = nil)
|
437
|
+
# open_session do |sess|
|
438
|
+
# sess.extend(CustomAssertions)
|
439
|
+
# if user
|
440
|
+
# sess.post 'http://test.host/session', :login=>user.to_s, :password=>user.to_s
|
441
|
+
# sess.follow_redirect!
|
442
|
+
# end
|
443
|
+
# end
|
444
|
+
# end
|
445
|
+
def logout
|
446
|
+
@visitor = nil
|
447
|
+
Thread.current[:visitor] = nil
|
406
448
|
end
|
407
449
|
|
408
450
|
def anon
|
@@ -53,19 +53,19 @@ project:
|
|
53
53
|
|
54
54
|
many_alternatives:
|
55
55
|
src: tagged in site or images in site or tags in site
|
56
|
-
sql: "%Q{SELECT nodes.*,links.id AS link_id
|
56
|
+
sql: "%Q{SELECT nodes.*,links.id AS `link_id`,links.status AS `l_status`,links.comment AS `l_comment`,links.date AS `l_date` FROM links,nodes WHERE #{secure_scope('nodes')} AND ((nodes.id = links.source_id AND links.relation_id = _ID(node_has_tags)) OR (nodes.kpath LIKE 'NDI%' AND links.id = 0) OR (nodes.kpath LIKE 'NPT%' AND links.id = 0)) GROUP BY nodes.id ORDER BY nodes.zip ASC}"
|
57
57
|
# res: "art, bird, Clean Water project, flower, it's a lake, menu, news, opening, tree"
|
58
58
|
|
59
59
|
alternatives_same_join:
|
60
60
|
src: tagged in site or icons
|
61
|
-
sql: "[%Q{SELECT nodes.*,links.id AS link_id
|
61
|
+
sql: "[%Q{SELECT nodes.*,links.id AS `link_id`,links.status AS `l_status`,links.comment AS `l_comment`,links.date AS `l_date` FROM links,nodes WHERE #{secure_scope('nodes')} AND ((nodes.id = links.source_id AND links.relation_id = _ID(node_has_tags)) OR (nodes.id = links.target_id AND links.relation_id = _ID(node_has_an_icon) AND links.source_id = ?)) GROUP BY nodes.id ORDER BY nodes.zip ASC}, @node.id]"
|
62
62
|
res: "Clean Water project, it's a lake, super ouverture"
|
63
63
|
|
64
64
|
same_name_as_class:
|
65
65
|
context:
|
66
66
|
node: 'opening'
|
67
67
|
src: "set_tags"
|
68
|
-
sql: "[%Q{SELECT nodes.*,links.id AS link_id
|
68
|
+
sql: "[%Q{SELECT nodes.*,links.id AS `link_id`,links.status AS `l_status`,links.comment AS `l_comment`,links.date AS `l_date` FROM links,nodes WHERE #{secure_scope('nodes')} AND nodes.id = links.target_id AND links.relation_id = _ID(node_has_tags) AND links.source_id = ? ORDER BY nodes.zip ASC}, @node.id]"
|
69
69
|
res: "Art, News list"
|
70
70
|
|
71
71
|
|
@@ -100,21 +100,29 @@ children_with_order_clause:
|
|
100
100
|
notes_or_news:
|
101
101
|
context:
|
102
102
|
class: Project
|
103
|
-
sql: "[%Q{SELECT nodes.*,links.id AS link_id
|
103
|
+
sql: "[%Q{SELECT nodes.*,links.id AS `link_id`,links.status AS `l_status`,links.comment AS `l_comment`,links.date AS `l_date` FROM links,nodes WHERE #{secure_scope('nodes')} AND ((nodes.kpath LIKE 'NN%' AND nodes.parent_id = ? AND links.id = 0) OR (nodes.id = links.source_id AND links.relation_id = _ID(note_has_calendars) AND links.target_id = ?)) GROUP BY nodes.id ORDER BY nodes.zip ASC}, @node.id, @node.id]"
|
104
104
|
|
105
105
|
news_or_notes:
|
106
106
|
context:
|
107
107
|
class: Project
|
108
|
-
sql: "[%Q{SELECT nodes.*,links.id AS link_id
|
108
|
+
sql: "[%Q{SELECT nodes.*,links.id AS `link_id`,links.status AS `l_status`,links.comment AS `l_comment`,links.date AS `l_date` FROM links,nodes WHERE #{secure_scope('nodes')} AND ((nodes.id = links.source_id AND links.relation_id = _ID(note_has_calendars) AND links.target_id = ?) OR (nodes.kpath LIKE 'NN%' AND nodes.parent_id = ? AND links.id = 0)) GROUP BY nodes.id ORDER BY nodes.zip ASC}, @node.id, @node.id]"
|
109
109
|
|
110
110
|
order_l_status:
|
111
111
|
context:
|
112
112
|
node: art
|
113
113
|
class: Tag
|
114
114
|
src: "tagged order by l_status ASC, zip ASC"
|
115
|
-
sql: "[%Q{SELECT nodes.*,links.id AS link_id
|
115
|
+
sql: "[%Q{SELECT nodes.*,links.id AS `link_id`,links.status AS `l_status`,links.comment AS `l_comment`,links.date AS `l_date` FROM links,nodes WHERE #{secure_scope('nodes')} AND nodes.id = links.source_id AND links.relation_id = _ID(node_has_tags) AND links.target_id = ? ORDER BY links.status ASC, nodes.zip ASC}, @node.id]"
|
116
116
|
res: "super ouverture, Clean Water project"
|
117
117
|
|
118
|
+
order_random:
|
119
|
+
context:
|
120
|
+
node: wiki
|
121
|
+
src: "nodes order by random limit 1"
|
122
|
+
sqlite3: "[%Q{SELECT nodes.* FROM nodes WHERE #{secure_scope('nodes')} AND nodes.parent_id = ? ORDER BY random() LIMIT 1}, @node.id]"
|
123
|
+
mysql: "[%Q{SELECT nodes.* FROM nodes WHERE #{secure_scope('nodes')} AND nodes.parent_id = ? ORDER BY RAND() LIMIT 1}, @node.id]"
|
124
|
+
res: "/bird|flower/"
|
125
|
+
|
118
126
|
paginate_one:
|
119
127
|
src: "nodes in site order by zip limit 2 paginate p"
|
120
128
|
# we sort by zip to avoid collation problems when some DB sort Capital letters first
|
@@ -128,4 +136,8 @@ paginate_two:
|
|
128
136
|
p: 2
|
129
137
|
src: "nodes in site order by zip limit 2 paginate p"
|
130
138
|
sql: "[%Q{SELECT nodes.* FROM nodes WHERE #{secure_scope('nodes')} ORDER BY nodes.zip LIMIT 2 OFFSET ?}, ((params[:p].to_i > 0 ? params[:p].to_i : 1)-1)*2]"
|
131
|
-
res: "Solenopsis Invicta, Panthera Tigris Sumatran"
|
139
|
+
res: "Solenopsis Invicta, Panthera Tigris Sumatran"
|
140
|
+
|
141
|
+
select_index_field:
|
142
|
+
src: "nodes select title as ti"
|
143
|
+
sql: "/SELECT nodes.*,ml1.value AS `ti`/"
|
@@ -70,7 +70,7 @@ custom_query_form_with_where:
|
|
70
70
|
context:
|
71
71
|
node: roger
|
72
72
|
class: Employee
|
73
|
-
date: 2005-03-01
|
73
|
+
date: '2005-03-01'
|
74
74
|
src: "emp_form_dates where last_date is null or (repeat_every is not null and next_date lt #{date} + 6 month)"
|
75
75
|
res: "how to use the winch, secure a site, engine maintenance, information transmission, fiber junction, how to use the radio"
|
76
76
|
|
@@ -19,4 +19,30 @@ year:
|
|
19
19
|
|
20
20
|
year_on_whatever:
|
21
21
|
src: "nodes where id.year < now.year"
|
22
|
-
res: '' # no errors
|
22
|
+
res: '' # no errors
|
23
|
+
|
24
|
+
date_tz:
|
25
|
+
context:
|
26
|
+
date: '2006-04-11 7:0'
|
27
|
+
tz: 'Asia/Jakarta'
|
28
|
+
# This date is translated to 2006-04-11 0:0 UTC
|
29
|
+
src: "nodes where created_at = #{date}"
|
30
|
+
res: "crocodiles"
|
31
|
+
|
32
|
+
date_tz_day_interval:
|
33
|
+
context:
|
34
|
+
date: '2006-04-11'
|
35
|
+
tz: 'Asia/Jakarta'
|
36
|
+
# This date is translated to 2006-04-10 17:0 UTC
|
37
|
+
src: "nodes where #{date} <= created_at and created_at < #{date} + 1 day"
|
38
|
+
sql: '/INTERVAL 1 DAY/'
|
39
|
+
res: "crocodiles"
|
40
|
+
|
41
|
+
date_tz_date:
|
42
|
+
context:
|
43
|
+
date: '2006-04-11'
|
44
|
+
tz: 'Asia/Jakarta'
|
45
|
+
# This date is translated to 2006-04-10 17:0 UTC
|
46
|
+
src: "nodes where created_at.date = #{date}"
|
47
|
+
sql: '/INTERVAL 1 DAY/'
|
48
|
+
res: "crocodiles"
|
@@ -27,7 +27,7 @@ filter_l_status:
|
|
27
27
|
node: art
|
28
28
|
class: Tag
|
29
29
|
src: "tagged where l_status > 5"
|
30
|
-
sql: "[%Q{SELECT nodes.*,links.id AS link_id
|
30
|
+
sql: "[%Q{SELECT nodes.*,links.id AS `link_id`,links.status AS `l_status`,links.comment AS `l_comment`,links.date AS `l_date` FROM links,nodes WHERE #{secure_scope('nodes')} AND links.status > 5 AND nodes.id = links.source_id AND links.relation_id = _ID(node_has_tags) AND links.target_id = ? ORDER BY nodes.zip ASC}, @node.id]"
|
31
31
|
res: "Clean Water project"
|
32
32
|
|
33
33
|
param_filter:
|
@@ -15,11 +15,14 @@ bad_relation:
|
|
15
15
|
|
16
16
|
overriden_relation:
|
17
17
|
src: 'references'
|
18
|
-
sql: "[%Q{SELECT nodes.*,links.id AS link_id
|
18
|
+
sql: "[%Q{SELECT nodes.*,links.id AS `link_id`,links.status AS `l_status`,links.comment AS `l_comment`,links.date AS `l_date` FROM links,nodes WHERE #{secure_scope('nodes')} AND nodes.id = links.target_id AND links.relation_id = _ID(node_has_references) AND links.source_id = ? ORDER BY nodes.zip ASC}, @node.id]"
|
19
19
|
|
20
20
|
link_selects_in_sub_query:
|
21
21
|
src: "icons or images"
|
22
|
-
sql: "[%Q{SELECT nodes.*,links.id AS link_id
|
22
|
+
sql: "[%Q{SELECT nodes.*,links.id AS `link_id`,links.status AS `l_status`,links.comment AS `l_comment`,links.date AS `l_date` FROM links,nodes WHERE #{secure_scope('nodes')} AND ((nodes.id = links.target_id AND links.relation_id = _ID(node_has_an_icon) AND links.source_id = ?) OR (nodes.kpath LIKE 'NDI%' AND nodes.parent_id = ? AND links.id = 0)) GROUP BY nodes.id ORDER BY nodes.zip ASC}, @node.id, @node.id]"
|
23
|
+
|
24
|
+
project:
|
25
|
+
sql: "[%Q{SELECT nodes.* FROM nodes WHERE #{secure_scope('nodes')} AND nodes.id = ? ORDER BY nodes.zip ASC}, @node.get_project_id]"
|
23
26
|
|
24
27
|
projects_from_tags:
|
25
28
|
sql: "/nodes.id = no1.project_id AND no1.kpath LIKE 'NPT%' AND no1.parent_id = ?/"
|
@@ -57,7 +60,7 @@ root_should_be_project:
|
|
57
60
|
# Make sure we do not start query on a Project so that we can tell if 'root' properly sets main_class.
|
58
61
|
node: ant
|
59
62
|
src: 'news from root'
|
60
|
-
sql: "%Q{SELECT nodes.*,links.id AS link_id
|
63
|
+
sql: "%Q{SELECT nodes.*,links.id AS `link_id`,links.status AS `l_status`,links.comment AS `l_comment`,links.date AS `l_date` FROM links,nodes,nodes AS no1 WHERE #{secure_scope('nodes')} AND nodes.id = links.source_id AND links.relation_id = 488905946 AND links.target_id = no1.id AND no1.id = 850927283 GROUP BY nodes.id ORDER BY nodes.zip ASC}"
|
61
64
|
|
62
65
|
start_as_tag:
|
63
66
|
context:
|
@@ -72,4 +75,10 @@ from_visitor:
|
|
72
75
|
res: 'Nature'
|
73
76
|
|
74
77
|
# l_date_as_date:
|
75
|
-
# src: "select *,if(l_date,l_date,event_at) AS date from (notes or assigned_notes) order by date"
|
78
|
+
# src: "select *,if(l_date,l_date,event_at) AS date from (notes or assigned_notes) order by date"
|
79
|
+
|
80
|
+
project_as_blog:
|
81
|
+
# Should scope by path
|
82
|
+
# This is the same as "project where class like Blog"
|
83
|
+
src: "Blog:project"
|
84
|
+
sql: "[%Q{SELECT nodes.* FROM nodes WHERE #{secure_scope('nodes')} AND nodes.kpath LIKE 'NPPB%' AND nodes.id = ? ORDER BY nodes.zip ASC}, @node.get_project_id]"
|
@@ -29,6 +29,10 @@ class QueryNodeTest < Zena::Unit::TestCase
|
|
29
29
|
def yt_do_test(file, test)
|
30
30
|
@context = Hash[*(yt_get('context', file, test).map{|k,v| [k.to_sym, v]}.flatten)]
|
31
31
|
|
32
|
+
if @context[:date]
|
33
|
+
@context[:date] = @context[:date].to_utc('%Y-%m-%d %H:%M:%S', @context[:tz] ? TZInfo::Timezone.get(@context[:tz]) : visitor.tz)
|
34
|
+
end
|
35
|
+
|
32
36
|
params = {}
|
33
37
|
(@context[:params] || {}).each do |k,v|
|
34
38
|
params[k.to_sym] = v
|
@@ -7,6 +7,11 @@ class XmlApiTest < Zena::Integration::TestCase
|
|
7
7
|
include Zena::Integration::MockResource
|
8
8
|
self.site = 'http://test.host'
|
9
9
|
self.element_name = 'node'
|
10
|
+
def initialize(*args)
|
11
|
+
super
|
12
|
+
hash = self.attributes
|
13
|
+
hash['tag_names'] = Zena::Remote::SerializableArray.new('tag_names', 'tag', hash['tag_names'] || [])
|
14
|
+
end
|
10
15
|
end
|
11
16
|
|
12
17
|
class BadTokenResource < ActiveResource::Base
|
@@ -61,7 +66,7 @@ class XmlApiTest < Zena::Integration::TestCase
|
|
61
66
|
|
62
67
|
assert_equal [nodes_zip(:status)], result
|
63
68
|
end
|
64
|
-
|
69
|
+
|
65
70
|
should 'find the list of nodes with qb' do
|
66
71
|
subject # create index entry for art
|
67
72
|
# create index entry for status
|
@@ -67,8 +67,8 @@ action:
|
|
67
67
|
res: "/nodes/22/versions/0/edit.*Open the edition window to edit the node.*Zena.open_window/"
|
68
68
|
|
69
69
|
swap:
|
70
|
-
src: "<span do='block' do='swap' attr='
|
71
|
-
tem: '/:dom_id =>
|
70
|
+
src: "<span do='block' do='swap' attr='weight' states='100,-100' do='weight'/>"
|
71
|
+
tem: '/:dom_id => %Q\{list1\}, :t_url => "action/swap/list1"/'
|
72
72
|
'/action/swap/en/list1.erb': "/<span id='list1'>/"
|
73
73
|
|
74
74
|
swap_in_each:
|
@@ -77,4 +77,4 @@ swap_in_each:
|
|
77
77
|
|
78
78
|
hand_made_swap:
|
79
79
|
src: "<r:link update='_page' node[origin]='#{next_in_list(origin, \"todo,done\")}' action='update'/>"
|
80
|
-
tem: "
|
80
|
+
tem: "/node\[origin\]. => .#\{next_in_list_s\(@node.prop\['origin'\].*todo,done.*method:.put./"
|