zena 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. data/History.txt +25 -0
  2. data/app/controllers/documents_controller.rb +3 -25
  3. data/app/controllers/nodes_controller.rb +34 -24
  4. data/app/controllers/user_sessions_controller.rb +5 -4
  5. data/app/controllers/versions_controller.rb +44 -17
  6. data/app/models/acl.rb +2 -7
  7. data/app/models/group.rb +6 -2
  8. data/app/models/link.rb +14 -0
  9. data/app/models/node.rb +2 -2
  10. data/app/models/site.rb +13 -4
  11. data/app/models/text_document.rb +1 -1
  12. data/app/models/user.rb +11 -2
  13. data/app/models/virtual_class.rb +1 -1
  14. data/app/views/groups/_form.rhtml +6 -6
  15. data/app/views/nodes/render_error.rhtml +15 -0
  16. data/app/views/templates/document_create_tabs/_file.rhtml +1 -1
  17. data/app/views/templates/document_create_tabs/_import.rhtml +1 -1
  18. data/app/views/templates/document_create_tabs/_template.rhtml +1 -1
  19. data/app/views/templates/document_create_tabs/_text_document.rhtml +1 -1
  20. data/app/views/templates/edit_tabs/_title.rhtml +1 -1
  21. data/app/views/zafu/default/Node-admin.zafu +1 -1
  22. data/bricks/acls/zena/test/integration/acl_integration_test.rb +2 -2
  23. data/bricks/acls/zena/test/unit/acl_test.rb +2 -1
  24. data/bricks/fs_skin/zena/migrate/20110702010330_add_fs_skin_to_idx_templates.rb +1 -0
  25. data/bricks/fs_skin/zena/skins/blog/img/style.css +4 -4
  26. data/bricks/grid/lib/bricks/grid.rb +9 -3
  27. data/bricks/passenger/zena/deploy.rb +2 -1
  28. data/bricks/pdf/lib/bricks/pdf.rb +1 -1
  29. data/bricks/tags/zena/test/zafu/tags.yml +5 -1
  30. data/bricks/zena/zena/migrate/20120904071601_change_link_status_to_float.rb +13 -0
  31. data/config/bricks.yml +10 -10
  32. data/config/deploy.rb +1 -5
  33. data/config/gems.yml +2 -2
  34. data/db/init/base/skins/default/Node.zafu +7 -3
  35. data/db/init/base/skins/default/notes.zafu +3 -1
  36. data/lib/zafu/all.rb +0 -9
  37. data/lib/zafu/compiler.rb +0 -4
  38. data/lib/zafu/controller_methods.rb +0 -2
  39. data/lib/zafu/handler.rb +0 -5
  40. data/lib/zafu/markup.rb +4 -6
  41. data/lib/zafu/ordered_hash.rb +3 -2
  42. data/lib/zafu/parsing_rules.rb +1 -3
  43. data/lib/zafu/process/ajax.rb +4 -2
  44. data/lib/zafu/process/context.rb +34 -4
  45. data/lib/zafu/process/forms.rb +2 -2
  46. data/lib/zafu/process/ruby_less_processing.rb +5 -10
  47. data/lib/zafu/template.rb +0 -2
  48. data/lib/zafu/test_helper.rb +0 -2
  49. data/lib/zafu/view_methods.rb +0 -1
  50. data/lib/zafu.rb +1 -1
  51. data/lib/zena/acts/secure_node.rb +5 -4
  52. data/lib/zena/console.rb +19 -17
  53. data/lib/zena/core_ext/string.rb +3 -2
  54. data/lib/zena/deploy/app_init.rhtml +6 -1
  55. data/lib/zena/deploy/httpd.rhtml +16 -13
  56. data/lib/zena/deploy/stats.vhost.rhtml +1 -1
  57. data/lib/zena/deploy/vhost.rhtml +31 -11
  58. data/lib/zena/deploy/vhost_ssl_redir.rhtml +12 -0
  59. data/lib/zena/deploy/vhost_www.rhtml +1 -1
  60. data/lib/zena/deploy.rb +55 -11
  61. data/lib/zena/info.rb +1 -1
  62. data/lib/zena/parser/zazen_rules.rb +18 -9
  63. data/lib/zena/routes.rb +1 -3
  64. data/lib/zena/site_worker.rb +8 -1
  65. data/lib/zena/use/ajax.rb +29 -3
  66. data/lib/zena/use/ancestry.rb +2 -1
  67. data/lib/zena/use/authlogic.rb +12 -18
  68. data/lib/zena/use/context.rb +1 -1
  69. data/lib/zena/use/dates.rb +28 -18
  70. data/lib/zena/use/display.rb +49 -7
  71. data/lib/zena/use/forms.rb +51 -18
  72. data/lib/zena/use/html_tags.rb +6 -6
  73. data/lib/zena/use/i18n.rb +13 -4
  74. data/lib/zena/use/image_builder.rb +2 -0
  75. data/lib/zena/use/query_builder.rb +39 -14
  76. data/lib/zena/use/query_link.rb +57 -0
  77. data/lib/zena/use/query_node.rb +68 -32
  78. data/lib/zena/use/relations.rb +25 -15
  79. data/lib/zena/use/rendering.rb +66 -15
  80. data/lib/zena/use/upload.rb +34 -5
  81. data/lib/zena/use/urls.rb +28 -25
  82. data/lib/zena/use/version_hash.rb +14 -2
  83. data/lib/zena/use/zafu_safe_definitions.rb +72 -3
  84. data/lib/zena/use/zazen.rb +16 -4
  85. data/lib/zena.rb +1 -0
  86. data/public/javascripts/grid.js +213 -64
  87. data/public/javascripts/raphael.js +10 -0
  88. data/public/javascripts/zena.js +146 -22
  89. data/public/stylesheets/reset.css +12 -12
  90. data/public/stylesheets/zena.css +1 -1
  91. data/test/custom_queries/complex.host.yml +19 -0
  92. data/test/fixtures/files/TestNode.zafu +40 -4
  93. data/test/functional/nodes_controller_test.rb +84 -39
  94. data/test/functional/versions_controller_test.rb +2 -2
  95. data/test/integration/navigation_test.rb +61 -35
  96. data/test/integration/query_node/basic.yml +7 -7
  97. data/test/integration/query_node/comments.yml +1 -1
  98. data/test/integration/query_node/complex.yml +3 -3
  99. data/test/integration/query_node/filters.yml +32 -8
  100. data/test/integration/query_node/idx_key_value.yml +10 -10
  101. data/test/integration/query_node/idx_scope.yml +7 -7
  102. data/test/integration/query_node/relations.yml +4 -4
  103. data/test/integration/zafu_compiler/ajax.yml +19 -11
  104. data/test/integration/zafu_compiler/apphelper.yml +1 -1
  105. data/test/integration/zafu_compiler/asset.yml +2 -2
  106. data/test/integration/zafu_compiler/comments.yml +1 -1
  107. data/test/integration/zafu_compiler/dates.yml +1 -1
  108. data/test/integration/zafu_compiler/display.yml +49 -21
  109. data/test/integration/zafu_compiler/eval.yml +4 -4
  110. data/test/integration/zafu_compiler/forms.yml +25 -11
  111. data/test/integration/zafu_compiler/i18n.yml +5 -0
  112. data/test/integration/zafu_compiler/meta.yml +3 -3
  113. data/test/integration/zafu_compiler/query.yml +27 -9
  114. data/test/integration/zafu_compiler/relations.yml +9 -9
  115. data/test/integration/zafu_compiler/roles.yml +6 -6
  116. data/test/integration/zafu_compiler/rubyless.yml +7 -2
  117. data/test/integration/zafu_compiler/safe_definitions.yml +33 -4
  118. data/test/integration/zafu_compiler/security.yml +46 -1
  119. data/test/integration/zafu_compiler/urls.yml +28 -13
  120. data/test/integration/zafu_compiler/user.yml +12 -7
  121. data/test/integration/zafu_compiler/zafu_attributes.yml +1 -1
  122. data/test/integration/zafu_compiler/zazen.yml +5 -5
  123. data/test/integration/zafu_compiler_test.rb +18 -0
  124. data/test/selenium/Filter/filter3.rsel +20 -0
  125. data/test/selenium/Filter/filter4.rsel +20 -0
  126. data/test/sites/zena/versions.yml +2 -0
  127. data/test/unit/exif_data_test.rb +6 -1
  128. data/test/unit/group_test.rb +18 -3
  129. data/test/unit/node_test.rb +0 -7
  130. data/test/unit/project_test.rb +4 -0
  131. data/test/unit/relation_proxy_test.rb +2 -2
  132. data/test/unit/remote_test.rb +0 -9
  133. data/test/unit/role_test.rb +1 -1
  134. data/test/unit/string_hash_test.rb +1 -1
  135. data/test/unit/text_document_test.rb +13 -13
  136. data/test/unit/zena/use/html_tags_test.rb +6 -6
  137. data/test/unit/zena/use/rendering_test.rb +20 -10
  138. data/test/unit/zena/use/urls_test.rb +21 -18
  139. data/test/unit/zena/use/zafu_template_test.rb +0 -5
  140. data/test/unit/zena/use/zazen_test.rb +25 -25
  141. data/zena.gemspec +63 -57
  142. metadata +136 -130
  143. data/test/functional/nodes_controller_commit_test.rb +0 -67
@@ -37,8 +37,10 @@ literal:
37
37
  res: "para = \"hello\""
38
38
 
39
39
  literal_date:
40
+ context:
41
+ lang: fr
40
42
  tem: "<%= query_parse('para' => %{2.12.1983}) %>"
41
- res: "para = '1983-12-02'"
43
+ res: "para = '1983-12-01 23:00'"
42
44
 
43
45
  number:
44
46
  tem: "<%= query_parse('para' => %{45}) %>"
@@ -55,8 +57,10 @@ greater_then:
55
57
  greater_then_date:
56
58
  context:
57
59
  lang: fr
60
+ tz: Asia/Jakarta
58
61
  tem: "<%= query_parse('para' => %{>7.5.1965}) %>"
59
- res: "para >'1965-05-07'"
62
+ # Uses visitor timezone to UTC
63
+ res: "para >'1965-05-06 17:00'"
60
64
 
61
65
  greater_or_equal_then:
62
66
  tem: "<%= query_parse('para' => %{>=32}) %>"
@@ -86,19 +90,19 @@ interval_date:
86
90
  context:
87
91
  lang: fr
88
92
  tem: "<%= query_parse('para' => %{1.1.2010..31.12.2010}) %>"
89
- res: "para >= '2010-01-01' and para <= '2010-12-31'"
93
+ res: "para >= '2009-12-31 23:00' and para <= '2010-12-30 23:00'"
90
94
 
91
95
  not_interval_date:
92
96
  context:
93
97
  lang: fr
94
98
  tem: "<%= query_parse('para' => %{!1.1.2010..31.12.2010}) %>"
95
- res: "not (para >= '2010-01-01' and para <= '2010-12-31')"
99
+ res: "not (para >= '2009-12-31 23:00' and para <= '2010-12-30 23:00')"
96
100
 
97
101
  interval_date_en:
98
102
  context:
99
103
  lang: en
100
104
  tem: "<%= query_parse('para' => %{2010/1/1..2010/12/31}) %>"
101
- res: "para >= '2010-01-01' and para <= '2010-12-31'"
105
+ res: "para >= '2009-12-31 23:00' and para <= '2010-12-30 23:00'"
102
106
 
103
107
  like:
104
108
  tem: "<%= query_parse('para' => %{*bar}) %>"
@@ -242,7 +246,7 @@ query_count:
242
246
 
243
247
  simple_select:
244
248
  src: "<div do='nodes select title as ti' find='first' do='ti'/>"
245
- tem: '/<%= var1.attributes\["ti"\] %>/'
249
+ tem: '/<%=h var1.attributes\["ti"\] %>/'
246
250
  res: "<div>crocodiles</div>"
247
251
 
248
252
  select_with_type:
@@ -252,12 +256,12 @@ select_with_type:
252
256
 
253
257
  select_in_from:
254
258
  src: "<div do='images select title as it from projects select title as pt in site' do='each' join=', '><r:pt/>: <r:it/></div>"
255
- tem: '/<%= var2.attributes\["pt"\] %>: <%= var2.attributes\["it"\] %>/'
259
+ tem: '/<%=h var2.attributes\["pt"\] %>: <%=h var2.attributes\["it"\] %>/'
256
260
  res: "<div>a wiki with Zena: bird, a wiki with Zena: flower, Clean Water project: it's a lake</div>"
257
261
 
258
262
  select_in_from_saved:
259
263
  src: "<div do='images select title as it from projects select title as pt in site' do='set' list='this' do='list' do='each' join=', '><r:pt/>: <r:it/></div>"
260
- tem: '/<%= var3.attributes\["pt"\] %>: <%= var3.attributes\["it"\] %>/'
264
+ tem: '/<%=h var3.attributes\["pt"\] %>: <%=h var3.attributes\["it"\] %>/'
261
265
  res: "<div>a wiki with Zena: bird, a wiki with Zena: flower, Clean Water project: it's a lake</div>"
262
266
 
263
267
  select_group:
@@ -278,13 +282,27 @@ query_errors:
278
282
  src: "<r:query default='nodes' select='nodes in #{params[:c]}'><r:elsif test='query_errors' do='query_errors'/></r:query>"
279
283
  res: "<span class='query'>nodes in badaboum</span> <span class='error'>Invalid scope 'badaboum'.</span>"
280
284
 
285
+ query_count:
286
+ context:
287
+ c: 'badaboum'
288
+ src: "<r:query default='nodes in site' find='count' select='pages in site'/>"
289
+ tem: "/:find => :count/"
290
+ res: "19"
291
+
292
+ query_count_string_context:
293
+ context:
294
+ c: 'badaboum'
295
+ src: "<r:void do='%q{2007}'><r:query default='nodes in site' find='count' select='pages where created_at.year < #{this} in site'/></r:void>"
296
+ tem: '/.Node., "@node".*:find => :count/'
297
+ res: "19"
298
+
281
299
  find_with_rubyless:
282
300
  src: "<b do='find(\"images in site limit 2\")' do='each' join=', ' do='title'/>"
283
301
  res: "<b>Autumn Tree, bird</b>"
284
302
 
285
303
  find_loads_class:
286
304
  src: "<div do='find(11)'><r:origin/></div>"
287
- tem: "<% if var1 = find_node_by_zip(11) %><div><%= var1.prop['origin'] %></div><% end %>"
305
+ tem: "<% if var1 = find_node_by_zip(11) %><div><%=h var1.prop['origin'] %></div><% end %>"
288
306
 
289
307
  query_on_vclass:
290
308
  # typical syntax error (should be Contact?)
@@ -43,7 +43,7 @@ pages:
43
43
 
44
44
  root:
45
45
  src: "<r:root do='title'/>"
46
- tem: "<% if var1 = visitor.site.root_node %><%= var1.prop['title'] %><% end %>"
46
+ tem: "<% if var1 = visitor.site.root_node %><%=h var1.prop['title'] %><% end %>"
47
47
  res: 'Zena the wild CMS'
48
48
 
49
49
  root_should_be_a_project_for_relations:
@@ -52,7 +52,7 @@ root_should_be_a_project_for_relations:
52
52
 
53
53
  root_should_be_a_project_for_attributes:
54
54
  src: "<r:root do='origin'/>"
55
- tem: "<% if var1 = visitor.site.root_node %><%= var1.prop['origin'] %><% end %>"
55
+ tem: "<% if var1 = visitor.site.root_node %><%=h var1.prop['origin'] %><% end %>"
56
56
 
57
57
  notes:
58
58
  context:
@@ -118,11 +118,11 @@ author:
118
118
 
119
119
  public_readable_link:
120
120
  src: "<r:show attr='set_tag_ids'/>"
121
- tem: '<%= h @node.rel["set_tag"].try(:other_zips) %>'
121
+ tem: '<%=h @node.rel["set_tag"].try(:other_zips) %>'
122
122
 
123
123
  public_readable_link_for:
124
124
  src: "<r:show attr='hot_for_ids'/>"
125
- tem: '<%= h @node.rel["hot_for"].try(:other_zips) %>'
125
+ tem: '<%=h @node.rel["hot_for"].try(:other_zips) %>'
126
126
  res: '21'
127
127
 
128
128
  public_readable_link_id:
@@ -140,7 +140,7 @@ context_root:
140
140
 
141
141
  parent:
142
142
  src: "<r:parent do='title'/>"
143
- tem: "<% if var1 = @node.parent %><%= var1.prop['title'] %><% end %>"
143
+ tem: "<% if var1 = @node.parent %><%=h var1.prop['title'] %><% end %>"
144
144
  res: "Clean Water project"
145
145
 
146
146
  parent_no_parent:
@@ -418,7 +418,7 @@ nodes_in_site_group_by_year:
418
418
 
419
419
  find_by_zip:
420
420
  src: "<div do='find(30)' do='img'/>"
421
- res: '/image30_std.jpg/'
421
+ res: '/image30_std.75a9a.jpg/'
422
422
 
423
423
  find_count:
424
424
  context:
@@ -433,7 +433,7 @@ same_name_as_class:
433
433
 
434
434
  start:
435
435
  src: "<r:start do='title'/>"
436
- tem: "<% var1 = start_node %><%= var1.prop['title'] %>"
436
+ tem: "<% var1 = start_node %><%=h var1.prop['title'] %>"
437
437
  res: 'status title'
438
438
 
439
439
  from_class_start:
@@ -466,12 +466,12 @@ array_count:
466
466
 
467
467
  first:
468
468
  src: "<div do='nodes in site'><r:first do='link'/></div>"
469
- tem: "/if var2 = var1.first %><a href='<%= zen_path\(var2\) %>'><%= var2.prop\['title'\] %>/"
469
+ tem: "/if var2 = var1.first %><a href='<%= zen_path\(var2\) %>'><%=h var2.prop\['title'\] %>/"
470
470
  res: '/a href.*a wiki with Zena/'
471
471
 
472
472
  rubyless_first:
473
473
  src: "<div do='nodes in site'><span do='first.title'/></div>"
474
- tem: "/span><%= \(var1.first \? var1.first.prop\['title'\] : nil\) %>/"
474
+ tem: "/span><%=h \(var1.first \? var1.first.prop\['title'\] : nil\) %>/"
475
475
  res: '<div><span>a wiki with Zena</span></div>'
476
476
 
477
477
  query_in_array:
@@ -10,7 +10,7 @@ default:
10
10
 
11
11
  show_property_filter_vclass:
12
12
  src: "<r:Letter? do='paper'/>"
13
- tem: "<% if @node.kpath_match?('NNL') %><%= @node.prop['paper'] %><% end %>"
13
+ tem: "<% if @node.kpath_match?('NNL') %><%=h @node.prop['paper'] %><% end %>"
14
14
 
15
15
  show_property_filter_role_no_role:
16
16
  src: "<r:Original?>Has an origin</r:Original?>"
@@ -59,12 +59,12 @@ vclass_name:
59
59
  context:
60
60
  node: letter
61
61
  src: "<r:vclass do='name'/>"
62
- tem: "<% var1 = @node.virtual_class %><%= var1.name %>"
62
+ tem: "<% var1 = @node.virtual_class %><%=h var1.name %>"
63
63
  res: "Letter"
64
64
 
65
65
  vclass_icon:
66
66
  src: " <r:Letter do='icon'/>"
67
- tem: "<% if var1 = VirtualClass[\"Letter\"] %> <%= var1.prop['icon'] %><% end %>"
67
+ tem: "<% if var1 = VirtualClass[\"Letter\"] %> <%=h var1.prop['icon'] %><% end %>"
68
68
  res: " /images/page.png"
69
69
 
70
70
  vclass_img:
@@ -89,7 +89,7 @@ vclass_column_size:
89
89
 
90
90
  vclass_context:
91
91
  src: "<r:Image><r:name/></r:Image>"
92
- tem: "<% if var1 = VirtualClass[\"Image\"] %><%= var1.name %><% end %>"
92
+ tem: "<% if var1 = VirtualClass[\"Image\"] %><%=h var1.name %><% end %>"
93
93
  res: "Image"
94
94
 
95
95
  vclass_scope:
@@ -101,7 +101,7 @@ vclass_scope:
101
101
 
102
102
  vclass_in_rubyless:
103
103
  src: "<b do='Contact.name'/>"
104
- tem: "<b><%= (VirtualClass[\"Contact\"] ? VirtualClass[\"Contact\"].name : nil) %></b>"
104
+ tem: "<b><%=h (VirtualClass[\"Contact\"] ? VirtualClass[\"Contact\"].name : nil) %></b>"
105
105
  res: "<b>Contact</b>"
106
106
 
107
107
  grid_manual:
@@ -137,4 +137,4 @@ inspect_display_links:
137
137
  <li do='each' do='link'/>
138
138
  </ul>
139
139
  </r:Template>
140
- tem: '/<h3><%= _zrel %></h3>/'
140
+ tem: '/<h3><%=h _zrel %></h3>/'
@@ -4,6 +4,11 @@ default:
4
4
  visitor: 'anon'
5
5
  node: 'status'
6
6
 
7
+ show_literal:
8
+ src: "<r:void do='%Q{&}'/>"
9
+ tem: "&amp;"
10
+ res: "&amp;"
11
+
7
12
  tagged_relation:
8
13
  context:
9
14
  node: 'art'
@@ -24,11 +29,11 @@ tagged_rubyless:
24
29
  context:
25
30
  node: 'status'
26
31
  src: "<r:tagged do='keys'><r:each join=', ' do='show'/></r:tagged>"
27
- res: "sky, blue"
32
+ res: "/sky, blue|blue, sky/"
28
33
 
29
34
  optional_hash:
30
35
  src: "<r:dummy do='hello' lang='fr'/>"
31
- tem: "<% var1 = @node.dummy %><%= var1.hello({:lang => \"fr\"}) %>"
36
+ tem: "<% var1 = @node.dummy %><%=h var1.hello({:lang => \"fr\"}) %>"
32
37
  res: "Salut poilu!"
33
38
 
34
39
  build_query:
@@ -12,7 +12,7 @@ params:
12
12
  d: 'hello ladies'
13
13
  old_src: "<i do='show' param='d'/>"
14
14
  src: "<i do='params[:d]'/>"
15
- tem: "<i><%= params[:d] %></i>"
15
+ tem: "<i><%=h params[:d] %></i>"
16
16
  res: "<i>hello ladies</i>"
17
17
 
18
18
  string_gsub:
@@ -140,14 +140,20 @@ array_include:
140
140
  src: "<b do='[1,2,3].include?(2)'/>"
141
141
  tem: "<% if [1,2,3].include?(2) %><b></b><% end %>"
142
142
 
143
+ range:
144
+ context:
145
+ x: 4
146
+ src: "<r:void do='(0..params[:x].to_i).to_a'><span do='each' join=' ' do='this'/></r:void>"
147
+ res: '<span>0</span> <span>1</span> <span>2</span> <span>3</span> <span>4</span>'
148
+
143
149
  hash_to_params:
144
150
  context:
145
151
  q:
146
152
  one: '1'
147
153
  two: '2'
148
154
  src: "<b do='{:q => params[:q]}' do='to_param'/>"
149
- tem: "<% var1 = {:q => params[:q]} %><b><%= var1.to_param %></b>"
150
- res: '<b>q%5Bone%5D=1&q%5Btwo%5D=2</b>'
155
+ tem: "<% var1 = {:q => params[:q]} %><b><%=h var1.to_param %></b>"
156
+ res: '<b>q%5Bone%5D=1&amp;q%5Btwo%5D=2</b>'
151
157
 
152
158
  string_hash:
153
159
  src: "<b do='set' a='string_hash'>AAA<r:eval>a['foo']</r:eval></b>"
@@ -158,4 +164,27 @@ string_hash_with_params:
158
164
  src: "<b do='set' a='string_hash(:foo => \"men\")'>AAA<r:eval>a['foo']</r:eval></b>"
159
165
  res: "<b>AAAmen</b>"
160
166
  tem: "/StringHash.from_hash\(\{:foo => \"men\"\}\)/"
161
-
167
+
168
+ aparams:
169
+ context:
170
+ par: 'a, b, '
171
+ src: "<div do='aparams[:par]'><r:each join='==' do='this'/></div>"
172
+ res: "<div>a==b</div>"
173
+
174
+ aparams_array:
175
+ context:
176
+ par:
177
+ - a
178
+ - b
179
+ - ''
180
+ src: "<div do='aparams[:par]'><r:each join='==' do='this'/></div>"
181
+ res: "<div>a==b</div>"
182
+
183
+ hparams:
184
+ context:
185
+ par:
186
+ x: 'a'
187
+ y: 'b'
188
+ src: "<div do='hparams[:par][:x]'/><div do='hparams[:par][:y]'/>"
189
+ res: "<div>a</div><div>b</div>"
190
+
@@ -45,7 +45,52 @@ build_erb_with_void:
45
45
  lang: fr
46
46
  src: "ABC: <r:void><</r:void><r:void>%= 5+8 %</r:void><r:void>></r:void></r:load>"
47
47
  tem: "ABC: <span class='parser_error'>Invalid tag near '&lt;&lt;/r:void&gt;&lt;'</span>"
48
-
48
+
49
+ erb_in_trans_do:
50
+ context:
51
+ lang: fr
52
+ src: |
53
+ <r:load dictionary='/Default skin/translations'>
54
+ <p do='t'>mean</p>
55
+ </r:load>
56
+ res: "!/13/"
57
+
58
+ erb_in_trans_do_t:
59
+ context:
60
+ lang: fr
61
+ src: |
62
+ <r:load dictionary='/Default skin/translations'>
63
+ <p do='t("mean")'/>
64
+ </r:load>
65
+ res: "!/13/"
66
+
67
+ erb_in_trans_r_t:
68
+ context:
69
+ lang: fr
70
+ src: |
71
+ <r:load dictionary='/Default skin/translations'>
72
+ <r:t>mean</r:t>
73
+ </r:load>
74
+ res: "!/13/"
75
+
76
+ erb_in_trans_dyn_t:
77
+ context:
78
+ lang: fr
79
+ src: |
80
+ <r:load dictionary='/Default skin/translations'>
81
+ <p do='t("#{origin}mean")'/>
82
+ </r:load>
83
+ res: "!/13/"
84
+
85
+ erb_in_trans_link:
86
+ context:
87
+ lang: fr
88
+ src: |
89
+ <r:load dictionary='/Default skin/translations'>
90
+ <p do='link' t='mean'/>
91
+ </r:load>
92
+ res: "!/13/"
93
+
49
94
  mean_inc:
50
95
  src: '<'
51
96
  res: '&lt;'
@@ -44,7 +44,7 @@ path_with_mode:
44
44
 
45
45
  link:
46
46
  src: "<r:link/>"
47
- tem: "<a href='<%= zen_path(@node) %>'><%= @node.prop['title'] %></a>"
47
+ tem: "<a href='<%= zen_path(@node) %>'><%=h @node.prop['title'] %></a>"
48
48
  res: "<a href='/oo/projects-list/Clean-Water-project/page22.html'>status title</a>"
49
49
 
50
50
  link_not_logged:
@@ -75,7 +75,7 @@ link_class:
75
75
 
76
76
  link_set_class:
77
77
  src: "<r:link class='#{title}_foo'/>"
78
- tem: "<a class='<%= \"#{@node.prop['title']}_foo\" %>' href='<%= zen_path(@node) %>'><%= @node.prop['title'] %></a>"
78
+ tem: "<a class='<%= \"#{@node.prop['title']}_foo\" %>' href='<%= zen_path(@node) %>'><%=h @node.prop['title'] %></a>"
79
79
  res: "<a class='status title_foo' href='/oo/projects-list/Clean-Water-project/page22.html'>status title</a>"
80
80
 
81
81
  link_set_title:
@@ -84,7 +84,7 @@ link_set_title:
84
84
 
85
85
  link_attr:
86
86
  src: "<r:link attr='ref_lang'/>"
87
- tem: "<a href='<%= zen_path(@node) %>'><%= @node.ref_lang %></a>"
87
+ tem: "<a href='<%= zen_path(@node) %>'><%=h @node.ref_lang %></a>"
88
88
  res: "<a href='/oo/projects-list/Clean-Water-project/page22.html'>en</a>"
89
89
 
90
90
  link_tattr:
@@ -108,19 +108,19 @@ link_parent:
108
108
 
109
109
  link_with_block:
110
110
  src: "<r:link href='parent'>look at <b do='title'>her</b></r:link>"
111
- tem: "<a href='<%= zen_path(@node.parent) %>'>look at <b><%= @node.prop['title'] %></b></a>"
111
+ tem: "<a href='<%= zen_path(@node.parent) %>'>look at <b><%=h @node.prop['title'] %></b></a>"
112
112
  res: "<a href='/oo/projects-list/Clean-Water-project'>look at <b>status title</b></a>"
113
113
 
114
114
  link_project:
115
115
  context:
116
116
  node: 'bird_jpg'
117
117
  src: "<r:link href='project'/>"
118
- tem: "<a href='<%= zen_path(@node.project) %>'><%= @node.prop['title'] %></a>"
118
+ tem: "<a href='<%= zen_path(@node.project) %>'><%=h @node.prop['title'] %></a>"
119
119
  res: "<a href='/oo/blog29.html'>bird</a>"
120
120
 
121
121
  link_root:
122
122
  src: "<r:link href='root'/>"
123
- tem: "<a href='<%= zen_path(visitor.site.root_node) %>'><%= @node.prop['title'] %></a>"
123
+ tem: "<a href='<%= zen_path(visitor.site.root_node) %>'><%=h @node.prop['title'] %></a>"
124
124
  res: "<a href='/oo'>status title</a>"
125
125
 
126
126
  link_anchor:
@@ -200,14 +200,14 @@ link_with_custom_params:
200
200
  context:
201
201
  year: 2010
202
202
  src: "<r:link class='foo' href='main' y='params[:year]'/>"
203
- tem: "<a class='foo' href='<%= zen_path(@node, {:y => params[:year]}) %>'><%= @node.prop['title'] %></a>"
203
+ tem: "<a class='foo' href='<%= zen_path(@node, {:y => params[:year]}) %>'><%=h @node.prop['title'] %></a>"
204
204
  res: "<a class='foo' href='/oo/projects-list/Clean-Water-project/page22.html?y=2010'>status title</a>"
205
205
 
206
206
  link_format_data:
207
207
  context:
208
208
  node: bird_jpg
209
209
  src: "<r:link format='data'/>"
210
- res: "<a href='/en/image30.jpg?1144713600'>bird</a>"
210
+ res: "<a href='/en/image30.11fbc.jpg'>bird</a>"
211
211
 
212
212
  live_link_format:
213
213
  old_src: "<h2 do='title' link='details.xml'/>"
@@ -219,7 +219,7 @@ live_link_data_mode:
219
219
  node: 'bird_jpg'
220
220
  old_src: "<h2 do='title' link='pv.data'>super title</h2>"
221
221
  src: "<h2 do='link' live='true' mode='pv' format='data'/>"
222
- res: "<h2><a id='_title30' href='/en/image30_pv.jpg?967816914293'>bird</a></h2>"
222
+ res: "<h2><a id='_title30' href='/en/image30_pv.7f6f0.jpg'>bird</a></h2>"
223
223
 
224
224
  url_with_lang:
225
225
  context:
@@ -239,8 +239,17 @@ link_in_list_context:
239
239
  res: '/a href.*page22.html.*status title/'
240
240
 
241
241
  link_trans:
242
- src: "<r:link t='img_next_page'/>"
243
- res: "/a href.*/images/control_fastforward.png/"
242
+ context:
243
+ lang: fr
244
+ src: |
245
+ <r:load dictionary='/Default skin/translations'>
246
+ <r:link t='view_live'/>
247
+ </r:load>
248
+ tem: "/view live <img src='/images/bullet_go.png'/>/"
249
+
250
+ link_trans_block:
251
+ src: "<r:link do='t'>img_next_page</r:link>"
252
+ res: "/a href.*<img src='/images/control_fastforward.png'/"
244
253
 
245
254
  link_date_complex:
246
255
  context:
@@ -294,8 +303,8 @@ encode_blank_values:
294
303
 
295
304
  cachestamp:
296
305
  # 26 would be the template for rendering JS's id.
297
- src: "<script src='#{path(project, :format => \"js\", :tstamp => find(26).updated_at.to_i)}'></script>"
298
- res: "<script src='/oo/projects-list/Clean-Water-project.js?1144713600&tstamp=1176249600'></script>"
306
+ src: "<script src='#{path(project, :format => \"js\")}'></script>"
307
+ res: "<script src='/oo/projects-list/Clean-Water-project.11fbc.js'></script>"
299
308
 
300
309
  node_in_argument:
301
310
  src: "<r:link node[done_by]='visitor_node'/>"
@@ -311,6 +320,12 @@ link_page_next_with_block:
311
320
  src: "<r:nodes in='site' limit='3' order='zip' paginate='pak'><r:link page='next' do='t'>next</r:link></r:nodes>"
312
321
  res: "<a href='/oo/projects-list/Clean-Water-project/page22.html?pak=2'>next</a>"
313
322
 
323
+ link_page_next_relation:
324
+ context:
325
+ node: art
326
+ src: "<r:Tag?><div id='a' do='block' do='tagged order by l_status asc limit 1 paginate pak'><r:link page='next' update='a' do='t'>next</r:link></div></r:Tag?>"
327
+ res: "!/parser_error/"
328
+
314
329
  link_page_list:
315
330
  context:
316
331
  pak: 2
@@ -10,7 +10,7 @@ default:
10
10
 
11
11
  login:
12
12
  src: "<r:visitor do='login'/>"
13
- tem: "<% var1 = visitor %><%= var1.login %>"
13
+ tem: "<% var1 = visitor %><%=h var1.login %>"
14
14
  res: "ant"
15
15
 
16
16
  lang:
@@ -23,25 +23,30 @@ is_anon:
23
23
 
24
24
  user_is_a_user:
25
25
  src: "<b do='user.login'/>"
26
- tem: "<b><%= @node.user.login %></b>"
26
+ tem: "<b><%=h @node.user.login %></b>"
27
27
  res: '<b>ant</b>'
28
28
 
29
29
  user_node_is_a_node:
30
30
  src: "<b do='user.node.title'/>"
31
- tem: "<b><%= (@node.user.node ? @node.user.node.prop['title'] : nil) %></b>"
31
+ tem: "<b><%=h (@node.user.node ? @node.user.node.prop['title'] : nil) %></b>"
32
32
  res: '<b>Solenopsis Invicta</b>'
33
33
 
34
34
  version_user_is_a_user:
35
35
  src: "<b do='v.user.login'/>"
36
- tem: "<b><%= @node.version.user.login %></b>"
36
+ tem: "<b><%=h @node.version.user.login %></b>"
37
37
  res: '<b>ant</b>'
38
38
 
39
39
  author_is_a_node:
40
40
  src: "<b do='author.title'/>"
41
- tem: "<b><%= (@node.author ? @node.author.prop['title'] : nil) %></b>"
41
+ tem: "<b><%=h (@node.author ? @node.author.prop['title'] : nil) %></b>"
42
42
  res: '<b>Solenopsis Invicta</b>'
43
43
 
44
44
  version_author_is_a_node:
45
45
  src: "<b do='v.author.title'/>"
46
- tem: "<b><%= (@node.version.author ? @node.version.author.prop['title'] : nil) %></b>"
47
- res: '<b>Solenopsis Invicta</b>'
46
+ tem: "<b><%=h (@node.version.author ? @node.version.author.prop['title'] : nil) %></b>"
47
+ res: '<b>Solenopsis Invicta</b>'
48
+
49
+ in_group:
50
+ src: <r:if test='visitor.in_group?("managers")'>managers</r:if>
51
+ tem: "<% if visitor.in_group?(\"managers\") %>managers<% end %>"
52
+ res: ""
@@ -85,7 +85,7 @@ store_node:
85
85
  store_in_block:
86
86
  src: "<r:block><r:void set_found='this' do='node' where='id = 18 in site' do='page'><r:found do='title'/>: <r:show attr='title'/></r:void></r:block>"
87
87
  res: "<div id='list1' data-z='22'>status title: a wiki with Zena</div>"
88
- 'zafu_attributes/store/in/block/en/list1.erb': "/_zfound = @node.*<% var3 = _zfound %><%= var3.prop\['title'\] %>:/"
88
+ 'zafu_attributes/store/in/block/en/list1.erb': "/_zfound = @node.*<% var3 = _zfound %><%=h var3.prop\['title'\] %>:/"
89
89
 
90
90
  set_var_outside_block:
91
91
  old_src: "<r:node select='18' set_found='this' do='pages'><r:block><r:show attr='title'/>: <r:context select='found' do='title'/></r:block></r:node>"
@@ -33,7 +33,7 @@ link_anchor_in_blank_prop:
33
33
 
34
34
  complex_link:
35
35
  tem: <%= zazen("p<. !<.31_pv!:22\n\nh4(clear). \"\":22") %>
36
- res: "<p style=\"text-align:left;\"><div class='img_left'><a href=\"/oo/projects-list/Clean-Water-project/page22.html\"><img src='/en/image31_pv.jpg?967816914293' width='70' height='70' alt='flower' class='pv'/></a></div></p>\n\n\n\t<h4 class=\"clear\"><a href=\"/oo/projects-list/Clean-Water-project/page22.html\">status title</a></h4>"
36
+ res: "<p style=\"text-align:left;\"><div class='img_left'><a href=\"/oo/projects-list/Clean-Water-project/page22.html\"><img src='/en/image31_pv.7f6f0.jpg' width='70' height='70' alt='flower' class='pv'/></a></div></p>\n\n\n\t<h4 class=\"clear\"><a href=\"/oo/projects-list/Clean-Water-project/page22.html\">status title</a></h4>"
37
37
 
38
38
  at_code:
39
39
  tem: "<%= zazen(\"Try this: @ruby|puts 'Hello'@ or this @zafu|<r:link/>@\") %>"
@@ -71,15 +71,15 @@ data_on_obj:
71
71
 
72
72
  zip_shortcut_link_with_mode_format:
73
73
  tem: "<%= zazen('Look \"here\"::lake+_life.rss, \"\"::lake_life.data.') %>"
74
- res: "/<p>Look <a href.*contact23_life.rss.*projects list/Clean Water project/Lake Tanganyika_life.rss</a>, <a href=.*image24_life.jpg.*projects list/Clean Water project/it&#8217;s a lake_life.jpg</a>./"
74
+ res: "/<p>Look <a href.*contact23_life.rss.*projects list/Clean Water project/Lake Tanganyika_life.rss</a>, <a href=.*image24_life.[0-9a-f]+.jpg.*projects list/Clean Water project/it&#8217;s a lake_life.jpg</a>./"
75
75
 
76
76
  zip_shortcut_image:
77
77
  tem: "<%= zazen('Look !:lake+! or !:lake!') %>"
78
- res: "/<p>Look \[projects list/Clean Water project/Lake Tanganyika is not a document\] or <img src=.*image24_std.jpg/"
78
+ res: "/<p>Look \[projects list/Clean Water project/Lake Tanganyika is not a document\] or <img src=.*image24_std.75a9a.jpg/"
79
79
 
80
80
  zip_shortcut_image_with_options:
81
81
  tem: "<%= zazen('Look !<.:lake+_med! or !=.:lake_pv!') %>"
82
- res: "/<p>Look \[projects list/Clean Water project/Lake Tanganyika is not a document\] or .*center.*<img src=.*image24_pv.jpg/"
82
+ res: "/<p>Look \[projects list/Clean Water project/Lake Tanganyika is not a document\] or .*center.*<img src=.*image24_pv.7f6f0.jpg/"
83
83
 
84
84
  zip_shortcut_gallery:
85
85
  tem: "<%= zazen('Look ![30,:lake]!') %>"
@@ -111,7 +111,7 @@ unknown_link:
111
111
 
112
112
  host:
113
113
  tem: "<%= zazen('this is a \"link\":12. !30!', :host => 'foo.com') %>"
114
- res: "/http://foo.com/oo/section12.html\">link.*http://foo.com/en/image30_std.jpg/"
114
+ res: "/http://foo.com/oo/section12.html\">link.*http://foo.com/en/image30_std.75a9a.jpg/"
115
115
 
116
116
  amp:
117
117
  tem: "<%= zazen('this & that') %>"
@@ -362,6 +362,24 @@ class ZafuCompilerTest < Zena::Controller::TestCase
362
362
  node.update_attributes!(:date => Time.utc(2012,1,1,0,0))
363
363
  yt_do_test('dates', 'time_year')
364
364
  end
365
+
366
+ def test_display_with_a_custom_img_tag_field
367
+ login(:lion)
368
+ node = secure(Node) { nodes(:status) }
369
+ node.prop['img_tag_std'] = "<foobar>PATH=PATH_std.html uuid=UUID</foobar>"
370
+ node.send(:dump_properties)
371
+ Zena::Db.execute "UPDATE versions SET properties = #{Zena::Db.quote(node.version[:properties])}"
372
+ yt_do_test('display', 'with_a_custom_img_tag_field')
373
+ end
374
+
375
+ def test_display_with_a_custom_img_tag_field_with_JS
376
+ login(:lion)
377
+ node = secure(Node) { nodes(:status) }
378
+ node.prop['img_tag_std'] = "blah blah [JS]some js[/JS]blah blah [JS]more JS[/JS]"
379
+ node.send(:dump_properties)
380
+ Zena::Db.execute "UPDATE versions SET properties = #{Zena::Db.quote(node.version[:properties])}"
381
+ yt_do_test('display', 'with_a_custom_img_tag_field_with_JS')
382
+ end
365
383
 
366
384
  yt_make
367
385
  end
@@ -0,0 +1,20 @@
1
+ open '/oo/testnode37.html?test=filter3'
2
+ # Should render preview_node with current values
3
+ verify_text 'filter3_title', 'Kill the bugs'
4
+ type 'filter31_title', 'Foobar'
5
+ wait_for_element_present 'filter3_msg'
6
+ verify_text 'filter3_title', 'Foobar'
7
+ type 'filter31_text', '*hop*'
8
+ wait_for_element_present 'css=#filter3_zazen strong'
9
+
10
+ # submit
11
+ click_and_wait 'css=input[type=submit]'
12
+
13
+ # Redirected to same page
14
+ # Parameter on [form] properly passed
15
+ verify_text 'filter3_title', 'Foobar'
16
+ type 'filter31_title', 'Kill the bugs'
17
+ type 'filter31_text', ''
18
+ click_and_wait 'css=input[type=submit]'
19
+ # Reverted changes
20
+ verify_text 'filter3_title', 'Kill the bugs'
@@ -0,0 +1,20 @@
1
+ open '/oo/testnode37.html?test=filter4'
2
+ # Should render preview_node with current values
3
+ verify_text 'filter4_title', 'Kill the bugs'
4
+ type 'filter4_b_title', 'Foobar'
5
+ wait_for_element_present 'filter4_msg'
6
+ verify_text 'filter4_title', 'Foobar'
7
+ type 'filter4_b_text', '*hop*'
8
+ wait_for_element_present 'css=#filter4_zazen strong'
9
+
10
+ # submit
11
+ click_and_wait 'css=input[type=submit]'
12
+
13
+ # Redirected to same page
14
+ # Parameter on [form] properly passed
15
+ verify_text 'filter4_title', 'Foobar'
16
+ type 'filter4_b_title', 'Kill the bugs'
17
+ type 'filter4_b_text', ''
18
+ click_and_wait 'css=input[type=submit]'
19
+ # Reverted changes
20
+ verify_text 'filter4_title', 'Kill the bugs'
@@ -547,6 +547,8 @@ wiki_node_en:
547
547
  <r:include template='/Default skin/Node'>
548
548
  <r:with part='main'>
549
549
  WIKI
550
+ //! This is used for testing cache on non-root paths.
551
+ <r:cache allow_query='p=\d'/>
550
552
  </r:with>
551
553
  </r:include>
552
554
  format: html