zena 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -4,27 +4,27 @@ default:
4
4
  node: 'cleanWater'
5
5
  visitor: 'ant'
6
6
  src: "blogs where blog.title = 'a wiki with Zena' in site"
7
- sql: "%Q{SELECT nodes.* FROM idx_projects AS sc1,nodes WHERE #{secure_scope('nodes')} AND sc1.blog_title = 'a wiki with Zena' AND nodes.id = sc1.node_id AND nodes.kpath LIKE 'NPPB%' ORDER BY nodes.zip ASC}"
7
+ sql: "%Q{SELECT nodes.* FROM nodes LEFT JOIN idx_projects AS sc1 ON nodes.id = sc1.node_id WHERE #{secure_scope('nodes')} AND sc1.blog_title = 'a wiki with Zena' AND nodes.kpath LIKE 'NPPB%' ORDER BY nodes.zip ASC}"
8
8
  res: 'a wiki with Zena'
9
9
 
10
10
  # CUSTOM TABLE BASED INDEX
11
11
 
12
12
  get_kpath_from_class:
13
13
  src: "blogs where contact.name = 'xx' in site"
14
- sql: "%Q{SELECT nodes.* FROM idx_projects AS sc1,nodes WHERE #{secure_scope('nodes')} AND sc1.contact_name = 'xx' AND nodes.id = sc1.node_id AND nodes.kpath LIKE 'NPPB%' ORDER BY nodes.zip ASC}"
14
+ sql: "%Q{SELECT nodes.* FROM nodes LEFT JOIN idx_projects AS sc1 ON nodes.id = sc1.node_id WHERE #{secure_scope('nodes')} AND sc1.contact_name = 'xx' AND nodes.kpath LIKE 'NPPB%' ORDER BY nodes.zip ASC}"
15
15
 
16
16
  get_kpath_from_class_with_function:
17
17
  src: "blogs where tag.created_at.year = 'xx' in site"
18
- sql: "%Q{SELECT nodes.* FROM idx_projects AS sc1,nodes WHERE #{secure_scope('nodes')} AND year(sc1.tag_created_at) = 'xx' AND nodes.id = sc1.node_id AND nodes.kpath LIKE 'NPPB%' ORDER BY nodes.zip ASC}"
18
+ sql: "%Q{SELECT nodes.* FROM nodes LEFT JOIN idx_projects AS sc1 ON nodes.id = sc1.node_id WHERE #{secure_scope('nodes')} AND year(sc1.tag_created_at) = 'xx' AND nodes.kpath LIKE 'NPPB%' ORDER BY nodes.zip ASC}"
19
19
 
20
20
  many_keys:
21
21
  src: "blogs where blog.title = 'a wiki with Zena' and contact.name = 'cont' in site"
22
- sql: "%Q{SELECT nodes.* FROM idx_projects AS sc1,nodes WHERE #{secure_scope('nodes')} AND sc1.blog_title = 'a wiki with Zena' AND sc1.contact_name = 'cont' AND nodes.id = sc1.node_id AND nodes.kpath LIKE 'NPPB%' ORDER BY nodes.zip ASC}"
22
+ sql: "%Q{SELECT nodes.* FROM nodes LEFT JOIN idx_projects AS sc1 ON nodes.id = sc1.node_id WHERE #{secure_scope('nodes')} AND sc1.blog_title = 'a wiki with Zena' AND sc1.contact_name = 'cont' AND nodes.kpath LIKE 'NPPB%' ORDER BY nodes.zip ASC}"
23
23
  res: 'a wiki with Zena'
24
24
 
25
25
  or_keys:
26
26
  src: "blogs where blog.title = 'bad' or contact.name = 'cont' in site"
27
- sql: "%Q{SELECT nodes.* FROM idx_projects AS sc1,nodes WHERE #{secure_scope('nodes')} AND ((sc1.blog_title = 'bad' AND nodes.id = sc1.node_id) OR (sc1.contact_name = 'cont' AND nodes.id = sc1.node_id)) AND nodes.kpath LIKE 'NPPB%' GROUP BY nodes.id ORDER BY nodes.zip ASC}"
27
+ sql: "%Q{SELECT nodes.* FROM nodes LEFT JOIN idx_projects AS sc1 ON nodes.id = sc1.node_id WHERE #{secure_scope('nodes')} AND (sc1.blog_title = 'bad' OR sc1.contact_name = 'cont') AND nodes.kpath LIKE 'NPPB%' GROUP BY nodes.id ORDER BY nodes.zip ASC}"
28
28
  res: 'a wiki with Zena'
29
29
 
30
30
  id_key:
@@ -34,10 +34,10 @@ id_key:
34
34
 
35
35
  sort_by_scoped_value:
36
36
  src: "blogs in site order by contact.name asc"
37
- sql: "%Q{SELECT nodes.* FROM idx_projects AS sc1,nodes WHERE #{secure_scope('nodes')} AND nodes.id = sc1.node_id AND nodes.kpath LIKE 'NPPB%' ORDER BY sc1.contact_name ASC}"
37
+ sql: "%Q{SELECT nodes.* FROM nodes LEFT JOIN idx_projects AS sc1 ON nodes.id = sc1.node_id WHERE #{secure_scope('nodes')} AND nodes.kpath LIKE 'NPPB%' ORDER BY sc1.contact_name ASC}"
38
38
  res: 'a wiki with Zena'
39
39
 
40
40
  should_not_mess_with_select:
41
41
  src: "blogs select title as blog_title in site order by contact.name asc"
42
- sql: "%Q{SELECT nodes.*,ml1.value AS `blog_title` FROM idx_nodes_ml_strings AS ml1,idx_projects AS sc1,nodes WHERE #{secure_scope('nodes')} AND nodes.id = sc1.node_id AND ml1.lang = 'fr' AND ml1.key = 'title' AND ml1.node_id = nodes.id AND nodes.kpath LIKE 'NPPB%' ORDER BY sc1.contact_name ASC}"
42
+ sql: "%Q{SELECT nodes.*,ml1.value AS `blog_title` FROM nodes LEFT JOIN idx_nodes_ml_strings AS ml1 ON ml1.node_id = nodes.id AND ml1.key = 'title' AND ml1.lang = 'fr' LEFT JOIN idx_projects AS sc1 ON nodes.id = sc1.node_id WHERE #{secure_scope('nodes')} AND nodes.kpath LIKE 'NPPB%' ORDER BY sc1.contact_name ASC}"
43
43
  res: 'a wiki with Zena'
@@ -7,7 +7,7 @@ default:
7
7
  sql: "[%Q{SELECT nodes.* FROM nodes WHERE #{secure_scope('nodes')} AND nodes.parent_id = ? ORDER BY nodes.zip ASC}, @node.id]"
8
8
 
9
9
  nodes_from_nodes_in_section:
10
- sql: "[%Q{SELECT nodes.* FROM nodes,nodes AS no1 WHERE #{secure_scope('nodes')} AND nodes.parent_id = no1.id AND no1.section_id = ? GROUP BY nodes.id ORDER BY nodes.zip ASC}, @node.get_section_id]"
10
+ sql: "[%Q{SELECT nodes.* FROM nodes JOIN nodes AS no1 WHERE #{secure_scope('nodes')} AND nodes.parent_id = no1.id AND no1.section_id = ? GROUP BY nodes.id ORDER BY nodes.zip ASC}, @node.get_section_id]"
11
11
 
12
12
  bad_relation:
13
13
  src: "categories in site"
@@ -15,11 +15,11 @@ bad_relation:
15
15
 
16
16
  overriden_relation:
17
17
  src: 'references'
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]"
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 JOIN 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`,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]"
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 JOIN 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
23
 
24
24
  project:
25
25
  sql: "[%Q{SELECT nodes.* FROM nodes WHERE #{secure_scope('nodes')} AND nodes.id = ? ORDER BY nodes.zip ASC}, @node.get_project_id]"
@@ -60,7 +60,7 @@ root_should_be_project:
60
60
  # Make sure we do not start query on a Project so that we can tell if 'root' properly sets main_class.
61
61
  node: ant
62
62
  src: 'news from root'
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}"
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 JOIN nodes JOIN 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}"
64
64
 
65
65
  start_as_tag:
66
66
  context:
@@ -6,14 +6,14 @@ default:
6
6
 
7
7
  block:
8
8
  src: "<r:parent><r:block name='foobar' do='title'/></r:parent>"
9
- tem: "<% if var1 = @node.parent %><div id='foobar' data-z='<%= var1.zip %>'><%= var1.prop['title'] %></div><% end %>"
10
- 'ajax/block/en/foobar.erb': "<div id='<%= ndom_id(@node) %>' data-z='<%= @node.zip %>'><%= @node.prop['title'] %></div>"
9
+ tem: "<% if var1 = @node.parent %><div id='foobar' data-z='<%= var1.zip %>'><%=h var1.prop['title'] %></div><% end %>"
10
+ 'ajax/block/en/foobar.erb': "<div id='<%= ndom_id(@node) %>' data-z='<%= @node.zip %>'><%=h @node.prop['title'] %></div>"
11
11
 
12
12
  add:
13
13
  src: "<ul id='children' do='nodes'><li do='each' do='link'/><li do='add'/></ul>"
14
14
  tem: "/\[\"children_add\", \"children_0\"\].each\(Element.toggle\)/"
15
15
  'ajax/add/en/children_form.erb': "/class='form' .*id='<%= ndom_id\(@node\) %>'/"
16
- 'ajax/add/en/children.erb': "<li id='<%= ndom_id(@node) %>'><a href='<%= zen_path(@node) %>'><%= @node.prop['title'] %></a></li>"
16
+ 'ajax/add/en/children.erb': "<li id='<%= ndom_id(@node) %>'><a href='<%= zen_path(@node) %>'><%=h @node.prop['title'] %></a></li>"
17
17
 
18
18
  edit_not_each:
19
19
  src: "<li class='blah'>this is a post <r:edit>edit post</r:edit></li>"
@@ -80,7 +80,7 @@ each_add_with_form:
80
80
  <li do='add'>add new</li>
81
81
  <li do='form'><input name='title'/> this is the form</li>
82
82
  </ol>
83
- res: "/<li id='list1_30'>bird.*<li id='list1_31'>flower.*<li.*list1_add.*list1_0.*toggle.*<li.*style.*none.*list1_0.*Ajax.Request.*input type='hidden' name='t_url' value=.ajax/each/add/with/form/list1.*input type='hidden' name='node\[parent_id\]' value=.29./"
83
+ res: "/<li id='list1_30'>bird.*<li id='list1_31'>flower.*<li.*list1_add.*list1_0.*toggle.*<li.*style.*none.*list1_0.*Ajax.Request.*input type='hidden' name='node\[parent_id\]' value=.29.*input type='hidden' name='t_url' value=.ajax/each/add/with/form/list1/"
84
84
 
85
85
  each_add_with_form_in_sub_block:
86
86
  context:
@@ -107,8 +107,8 @@ each_add_with_form_klass_set:
107
107
  res: "!/hidden.*node\[klass\].*Node.*select.*node\[klass\]/"
108
108
 
109
109
  each_add_with_select:
110
- src: "<r:children><r:each do='title'/><r:add/><r:form><r:select name='icon_id' nodes='images in project' selected='[main.icon_id]_abc'/></r:form></r:children>"
111
- 'ajax/each/add/with/select/en/list1_form.erb': '/map.|r| \[r.name, r.zip.to_s\]., \"#.@node.icon_zip._abc\"\)/'
110
+ src: "<r:children><r:each do='title'/><r:add/><r:form><r:select name='icon_id' nodes='images in project' selected='main.icon_id'/></r:form></r:children>"
111
+ 'ajax/each/add/with/select/en/list1_form.erb': '/map.|r| \[r.name, r.zip.to_s\]., \"#.@node.icon_zip\"\)/'
112
112
  tem: "/nodes.kpath LIKE 'NDI%'/"
113
113
 
114
114
  each_edit_with_form:
@@ -133,7 +133,7 @@ block_dictionary:
133
133
  make_form:
134
134
  src: "<ul do='children'><li do='each' do='title'/><li do='add'/></ul>"
135
135
  tem: "/<li style='display:none;' class='form' id='list1_0'>.*remote_form_for\(:node, var2_new"
136
- 'ajax/make/form/en/list1.erb': "<li id='<%= ndom_id(@node) %>'><%= @node.prop['title'] %></li>"
136
+ 'ajax/make/form/en/list1.erb': "<li id='<%= ndom_id(@node) %>'><%=h @node.prop['title'] %></li>"
137
137
  'ajax/make/form/en/list1_form.erb': "/<li class='form' id='<%= ndom_id\(@node\) %>'>/"
138
138
 
139
139
  each_edit_cannot_write:
@@ -205,7 +205,7 @@ live_filter_select_options:
205
205
  draggable_do_syntax:
206
206
  src: "<r:images in='site' do='each' draggable='all' do='img' mode='pv'/>"
207
207
  tem: "/add_drag_id\(%Q\{list1_#\{var2.zip\}\}/"
208
- res: "/id='list1_30'><img src='/en/image30_pv.jpg\?967816914293'/"
208
+ res: "/id='list1_30'><img src='/en/image30_pv.7f6f0.jpg'/"
209
209
  js: '/"list1_24"\].each.*Zena.draggable\(item, false\)/'
210
210
 
211
211
  draggable_true:
@@ -269,6 +269,14 @@ draggable_with_id_set:
269
269
  src: "<h1 id='title' do='title' draggable='true'/>"
270
270
  tem: "/<h1 id='title'><span class='drag' id='<%= %Q\{drag_#\{@node.zip\}\} %>'><span class='drag_handle'>&nbsp;</span><% add_drag_id\(%Q\{drag_#\{@node.zip\}/"
271
271
 
272
+ sortable:
273
+ context:
274
+ node: 'projects'
275
+ src: "<ol do='pages'><li do='reset_sort'/><li do='each' sortable='true' do='title'/></ol>"
276
+ tem: "/<ol>.*Zena.resetSort.*<li data-a='position' data-p='<%= var2.position %>' id='<%= %Q.list1_#.var2.zip.. %>'>/"
277
+ res: "/<li data-a='position' data-p='0.0' id='list1_29'><span class='drag_handle'>&nbsp;</span>a wiki with Zena</li>/"
278
+ js: "/Zena.sortable\('list1_29', \{handle:'drag_handle'\}\)/"
279
+
272
280
  unlink:
273
281
  context:
274
282
  node: 'art'
@@ -366,7 +374,7 @@ update_target_encode_params:
366
374
 
367
375
  include_update_target:
368
376
  src: "IUT: <r:include template='/ajax/update/target'><r:with part='foo'><r:show attr='title'/></r:with></r:include>"
369
- tem: "/IUT: UT: <div .*id='foo'.*><%= h @node.prop\['title'\] %></div> <a .*zen_path.*onclick='new Ajax.Request/"
377
+ tem: "/IUT: UT: <div .*id='foo'.*><%=h @node.prop\['title'\] %></div> <a .*zen_path.*onclick='new Ajax.Request/"
370
378
 
371
379
  id_in_each_group_should_be_scoped:
372
380
  src: "<ul do='comments from nodes in site' do='group' by='discussion_id'><li do='each'><r:node do='block' do='title'/></li></ul>"
@@ -422,13 +430,13 @@ js:
422
430
 
423
431
  js_dyn:
424
432
  src: "x <r:js>alert('ho <r:title/>');</r:js> y"
425
- tem: "x <% js_data << capture do %>alert('ho <%= @node.prop['title'] %>');<% end %> y"
433
+ tem: "x <% js_data << capture do %>alert('ho <%=h @node.prop['title'] %>');<% end %> y"
426
434
  res: "x y"
427
435
  js: "<script type=\"text/javascript\">\n//<![CDATA[\nalert('ho status title');\n//]]>\n</script>"
428
436
 
429
437
  js_less_then:
430
438
  src: "x <r:js>if (i < 4) alert('ho <r:title/>');</r:js> y"
431
- tem: "x <% js_data << capture do %>if (i < 4) alert('ho <%= @node.prop['title'] %>');<% end %> y"
439
+ tem: "x <% js_data << capture do %>if (i < 4) alert('ho <%=h @node.prop['title'] %>');<% end %> y"
432
440
  res: "x y"
433
441
  js: "<script type=\"text/javascript\">\n//<![CDATA[\nif (i < 4) alert('ho status title');\n//]]>\n</script>"
434
442
 
@@ -11,7 +11,7 @@ img_tag_use_icon:
11
11
  context:
12
12
  node: 'wiki'
13
13
  tem: "<%= img_tag(@node, :alt_src => 'icon') %>"
14
- res: "<img src='/en/image30.jpg?1144713600' width='660' height='600' alt='bird' class='full'/>"
14
+ res: "<img src='/en/image30.11fbc.jpg' width='660' height='600' alt='bird' class='full'/>"
15
15
 
16
16
  set_lang_fr:
17
17
  context:
@@ -10,7 +10,7 @@ default:
10
10
 
11
11
  rename_asset:
12
12
  src: "<link href='/Default skin/style.css' rel='Stylesheet' type='text/css'/>"
13
- tem: "<link rel='Stylesheet' type='text/css' href='/en/textdocument54.css?1144713600'/>"
13
+ tem: "<link rel='Stylesheet' type='text/css' href='/en/textdocument54.11fbc.css'/>"
14
14
 
15
15
  should_not_change_script:
16
16
  src: "<script type='text/javascript' src='http://example.com'></script>"
@@ -23,5 +23,5 @@ change_style_url:
23
23
  </style>
24
24
  res: |
25
25
  <style>
26
- #super { background:url('/oo/image40.jpg?1144713600');}
26
+ #super { background:url('/oo/image40.11fbc.jpg');}
27
27
  </style>
@@ -14,7 +14,7 @@ comments_shown_if_empty_but_can_comment:
14
14
 
15
15
  discussion:
16
16
  src: "<r:discussion do='comments' do='title'></r:discussion>"
17
- tem: "<% if var1 = @node.discussion %><% if var2 = var1.comments %><%= var2.first.title %><% end %><% end %>"
17
+ tem: "<% if var1 = @node.discussion %><% if var2 = var1.comments %><%=h var2.first.title %><% end %><% end %>"
18
18
  # no error
19
19
  res: "What about rivers ?"
20
20
 
@@ -22,7 +22,7 @@ select_date_attr:
22
22
 
23
23
  date_in_link:
24
24
  src: "<r:link y='log_at.year'/>"
25
- tem: "<a href='<%= zen_path(@node, {:y => (@node.log_at ? @node.log_at.year_tz : nil)}) %>'><%= @node.prop['title'] %></a>"
25
+ tem: "<a href='<%= zen_path(@node, {:y => (@node.log_at ? @node.log_at.year_tz : nil)}) %>'><%=h @node.prop['title'] %></a>"
26
26
 
27
27
  log_at:
28
28
  context:
@@ -35,7 +35,7 @@ cdata:
35
35
  res: |
36
36
  <script type='text/javascript'>
37
37
  <![CDATA[
38
- var urls = ['http://test.host/oo/image40_med.jpg?390663777446', 'http://test.host/en/image30_med.jpg?390663777446'];
38
+ var urls = ['http://test.host/oo/image40_med.05b01.jpg', 'http://test.host/en/image30_med.05b01.jpg'];
39
39
  //]]>
40
40
  </script>
41
41
 
@@ -49,12 +49,14 @@ multiline_tag:
49
49
  </div>
50
50
  </div>
51
51
  tem: "!/do='pages'/"
52
-
53
52
 
54
53
  show_title:
55
- old_src: "<r:show attr='title'/>"
56
- old_tem: "<%= @node.title %>"
57
54
  src: "<r:title/>"
55
+ tem: "<%=h @node.prop['title'] %>"
56
+ res: "status title"
57
+
58
+ show_title_h_false:
59
+ src: "<r:title h='false'/>"
58
60
  tem: "<%= @node.prop['title'] %>"
59
61
  res: "status title"
60
62
 
@@ -62,7 +64,7 @@ show_title_with_opts:
62
64
  old_src: "<h1 do='title' class='s70' status='true' actions='all'>this is the title</h1>"
63
65
  old_tem: "/<h1 class='s<%= @node.version.status %>'><%= show_title\(:node=>@node\) \+ node_actions\(:node=>@node, .*:actions=>\"all\"/"
64
66
  src: "<h1 do='title' prefix='status' actions='all' live='true'>this is the title</h1>"
65
- tem: "<h1 class='s<%= @node.version.status %>'><span id='_title<%= @node.zip %>'><%= h @node.prop['title'] %></span> <%= node_actions(@node, :actions => \"all\") %></h1>"
67
+ tem: "<h1 class='s<%= @node.version.status %>'><span id='_title<%= @node.zip %>'><%=h @node.prop['title'] %></span> <%= node_actions(@node, :actions => \"all\") %></h1>"
66
68
  old_res: "/<h1 class='s50'><span id='title22'.*class='actions'>/"
67
69
  res: "/<h1 class='s50'><span id='_title22'.*class='actions'>/"
68
70
 
@@ -90,7 +92,7 @@ show_title_in_list:
90
92
 
91
93
  do_title:
92
94
  src: "<h2 do='title'/>"
93
- tem: "<h2><%= @node.prop['title'] %></h2>"
95
+ tem: "<h2><%=h @node.prop['title'] %></h2>"
94
96
  res: "<h2>status title</h2>"
95
97
 
96
98
  show_title_link_id_from_stored:
@@ -140,7 +142,7 @@ title_in_version_context:
140
142
  show_shortcut:
141
143
  old_src: "<p do='[title]'>hello</p>"
142
144
  src: "<p do='title'>hello</p>"
143
- tem: "<p><%= @node.prop['title'] %></p>"
145
+ tem: "<p><%=h @node.prop['title'] %></p>"
144
146
  res: "<p>status title</p>"
145
147
 
146
148
  zazen_shortcut:
@@ -184,13 +186,13 @@ show_width:
184
186
  show_else:
185
187
  old_src: "<r:show attr='comment' else='name'/>"
186
188
  src: "<r:show eval='origin || title'/>"
187
- tem: "<%= h (@node.prop['origin'] or @node.prop['title']) %>"
189
+ tem: "<%=h (@node.prop['origin'] or @node.prop['title']) %>"
188
190
  res: "status title"
189
191
 
190
192
  show_default:
191
193
  old_src: "<r:show attr='d_foo' default='baz'/>"
192
194
  src: "<r:show eval='origin || \"baz\"'/>"
193
- tem: "<%= h (@node.prop['origin'] or \"baz\") %>"
195
+ tem: "<%=h (@node.prop['origin'] or \"baz\") %>"
194
196
  res: "baz"
195
197
 
196
198
  javascripts:
@@ -201,6 +203,10 @@ stylesheets:
201
203
  src: "<r:stylesheets list='zena,code,search'/>"
202
204
  tem: "/link href.*/stylesheets/zena.css.*text/css.*code.css.*text/css.*search.css.*stylesheet/"
203
205
 
206
+ search_box:
207
+ src: "<div id='search' do='search_box' type='search'/>"
208
+ res: "/<div id='search'><div class=\"search\">/"
209
+
204
210
  icon:
205
211
  context:
206
212
  node: wiki
@@ -244,7 +250,7 @@ img_tag_icon:
244
250
  context:
245
251
  node: 'cleanWater'
246
252
  src: "<r:img alt_src='icon'/>"
247
- res: "<img src='/en/projects-list/Clean-Water-project/image24_std.jpg?929831698949' width='545' height='400' alt='it&apos;s a lake' class='std'/>"
253
+ res: "<img src='/en/projects-list/Clean-Water-project/image24_std.75a9a.jpg' width='545' height='400' alt='it&apos;s a lake' class='std'/>"
248
254
 
249
255
  icon:
250
256
  context:
@@ -256,36 +262,36 @@ img_image:
256
262
  context:
257
263
  node: 'bird_jpg'
258
264
  src: "<r:img/><r:img mode='med'/>"
259
- res: "/<img src='/en/image30_std.jpg\?929831698949' width='440' height='400' alt='bird' class='std'/><img src='/en/image30_med.jpg\?390663777446' width='220' height='200' alt='bird' id='.*' class='med' onclick='Zena.popup\(this\)'/>/"
265
+ res: "/<img src='/en/image30_std.75a9a.jpg' width='440' height='400' alt='bird' class='std'/><img src='/en/image30_med.05b01.jpg' width='220' height='200' alt='bird' id='.*' class='med' onclick='Zena.popup\(this\)'/>/"
260
266
 
261
267
  img_image_not_public:
262
268
  context:
263
269
  visitor: 'ant'
264
270
  node: 'tree_jpg'
265
271
  src: "<r:img/><r:img mode='med'/>"
266
- res: "/<img src='/oo/image40_std.jpg\?929831698949' width='600' height='399' alt='Autumn Tree' class='std'/><img src='/oo/image40_med.jpg\?390663777446' width='300' height='200' alt='Autumn Tree' id='.*' class='med' onclick='Zena.popup\(this\)'/>/"
272
+ res: "/<img src='/oo/image40_std.75a9a.jpg' width='600' height='399' alt='Autumn Tree' class='std'/><img src='/oo/image40_med.05b01.jpg' width='300' height='200' alt='Autumn Tree' id='.*' class='med' onclick='Zena.popup\(this\)'/>/"
267
273
 
268
274
  img_href:
269
275
  context:
270
276
  node: 'bird_jpg'
271
277
  src: "<r:img link='this'/>"
272
- res: "<a href='/oo/image30.html'><img src='/en/image30_std.jpg?929831698949' width='440' height='400' alt='bird' class='std'/></a>"
278
+ res: "<a href='/oo/image30.html'><img src='/en/image30_std.75a9a.jpg' width='440' height='400' alt='bird' class='std'/></a>"
273
279
 
274
280
  img_src_id:
275
281
  src: "<r:img src='find(30)'/>"
276
- res: "<img src='/en/image30_std.jpg?929831698949' width='440' height='400' alt='bird' class='std'/>"
282
+ res: "<img src='/en/image30_std.75a9a.jpg' width='440' height='400' alt='bird' class='std'/>"
277
283
 
278
284
  img_src_finder:
279
285
  src: "<r:img src='find(\"icon from project\")'/>"
280
- res: "/image24_std.jpg/"
286
+ res: "/image24_std.75a9a.jpg/"
281
287
 
282
288
  img_src_mode:
283
289
  src: "<r:img src='find(30)' mode='pv'/>"
284
- res: "<img src='/en/image30_pv.jpg?967816914293' width='70' height='70' alt='bird' class='pv'/>"
290
+ res: "<img src='/en/image30_pv.7f6f0.jpg' width='70' height='70' alt='bird' class='pv'/>"
285
291
 
286
292
  img_html_params:
287
293
  src: "<r:img src='find(30)' id='super'/>"
288
- res: "<img src='/en/image30_std.jpg?929831698949' width='440' height='400' alt='bird' id='super' class='std'/>"
294
+ res: "<img src='/en/image30_std.75a9a.jpg' width='440' height='400' alt='bird' id='super' class='std'/>"
289
295
 
290
296
  zena:
291
297
  src: "<r:zena/>"
@@ -330,7 +336,7 @@ show_with_label_shortcut:
330
336
  context:
331
337
  lang: fr
332
338
  src: "<li do='show' label='t' blank='hide' attr='title'/>"
333
- tem: "<% if !@node.prop['title'].blank? %><li><label>titre</label> <span><%= h @node.prop['title'] %></span></li><% end %>"
339
+ tem: "<% if !@node.prop['title'].blank? %><li><label>titre</label> <span><%=h @node.prop['title'] %></span></li><% end %>"
334
340
  res: "<li><label>titre</label> <span>Etat des travaux</span></li>"
335
341
 
336
342
  show_with_custom_label_shortcut:
@@ -414,16 +420,23 @@ short_path:
414
420
  show_param:
415
421
  context:
416
422
  t: 'hello'
417
- src: "<r:show param='t'/>"
418
- tem: "<%= h params[:t] %>"
423
+ # src: "<r:show param='t'/><r:show param='x'/>"
424
+ tem: "<%=h params[:t] %><%=h params[:x] %>"
419
425
  res: "hello"
420
426
 
427
+ display_hash_type:
428
+ context:
429
+ node: test
430
+ src: "<r:void do='settings[\"one\"]'/>"
431
+ tem: "<%=h (@node.prop['settings'] ? @node.prop['settings'][\"one\"] : nil) %>"
432
+ res: "un"
433
+
421
434
  default_host:
422
435
  context:
423
436
  node: 'bird_jpg'
424
437
  src: "<r:default host='b.#{site.host}'><r:zazen text='this is a \"link\":12.'/> xxx: <r:img/></r:default>"
425
438
  tem: '/zazen.*:host.*visitor.site.host/'
426
- res: "/href=\"http://b.test.host/oo/section12.html\">link.*src='http://b.test.host/en/image30_std.jpg/"
439
+ res: "/href=\"http://b.test.host/oo/section12.html\">link.*src='http://b.test.host/en/image30_std.75a9a.jpg/"
427
440
 
428
441
  zazen_without_markup:
429
442
  src: "<r:void do='zazen(title)'/>"
@@ -482,3 +495,18 @@ each_alternate_by_hand:
482
495
  src: "<ol do='pages'><r:each alt_class='blue'><li class='#{alt_class}' do='title'/></r:each></ol>"
483
496
  tem: "/class='<%= _zaltclass %>'/"
484
497
  res: "<ol><li class=''>crocodiles</li><li class='blue'>status title</li></ol>"
498
+
499
+ with_a_custom_img_tag_field:
500
+ # img_tag field set in test.
501
+ src: "<r:zazen text='A:!22! B:!22_pv!'/> C:<r:img/>"
502
+ res: "/A:<foobar>PATH=.*page22_std.html uuid=img.*</foobar> B:.*<img src='/images/ext/page_pv.png'.*C:<foobar>PATH=.*page22_std.html uuid=img.*</foobar>/"
503
+
504
+ with_a_custom_img_tag_field_with_JS:
505
+ # img_tag field set in test.
506
+ src: "<r:zazen text='A:!22!'/> C:<r:img/>"
507
+ res: "<div class='zazen'><p>A:blah blah blah blah </p></div> C:blah blah blah blah "
508
+ js: "/\nsome js\nmore JS\nsome js\nmore JS\n/"
509
+
510
+ invalid_document:
511
+ src: "<r:zazen text='!21!'/>"
512
+ res: "/images/ext/project.png/"
@@ -24,12 +24,12 @@ set_var:
24
24
 
25
25
  set_var_propagates:
26
26
  src: "<div do='set' a='%q{hello}'><r:void do='set' a='%q{goodbye}'/><r:a/></div>"
27
- tem: '<div><% _za = "hello" %><% _za = "goodbye" %><%= _za %></div>'
27
+ tem: '<div><% _za = "hello" %><% _za = "goodbye" %><%=h _za %></div>'
28
28
  res: "<div>goodbye</div>"
29
29
 
30
30
  set_var_can_be_nil:
31
31
  src: "<div do='set' a='%q{hello}'><r:void do='set' a='origin'/><r:a/></div>"
32
- tem: "<div><% _za = \"hello\" %><% _za = @node.prop['origin'] || _za %><%= _za %></div>"
32
+ tem: "<div><% _za = \"hello\" %><% _za = @node.prop['origin'] || _za %><%=h _za %></div>"
33
33
  res: "<div>hello</div>"
34
34
 
35
35
  set_var_different_type:
@@ -38,12 +38,12 @@ set_var_different_type:
38
38
 
39
39
  node_eval:
40
40
  src: "<r:void do='@node.eval(\"title\")'/>"
41
- tem: "<%= @node.zafu_eval(\"title\") %>"
41
+ tem: "<%=h @node.zafu_eval(\"title\") %>"
42
42
  res: "status title"
43
43
 
44
44
  node_eval_array:
45
45
  context:
46
46
  node: opening
47
47
  src: "<r:void do='@node.eval(\"set_tag_ids\")'/>"
48
- tem: "<%= @node.zafu_eval(\"set_tag_ids\") %>"
48
+ tem: "<%=h @node.zafu_eval(\"set_tag_ids\") %>"
49
49
  res: "33,34"
@@ -36,7 +36,7 @@ new:
36
36
  # Should accept allowed params (from class and roles) and transform ids to zip (back and forth)
37
37
  src: "<r:new klass='Letter' title='%q{Joe}' parent_id='project.id' paper='%q{white}' origin='%q{Mars}' bad='%q{value}'><r:form><r:input name='title'/> <r:input name='parent_id'/></r:form></r:new>"
38
38
  tem: "/:title => \"Joe\", :parent_id => .*@node.project.zip.*, :paper => \"white\", :origin => \"Mars\"/"
39
- res: "/<input type='text' name='node\[title\]' value='Joe' id='list1_title'/> <input type='text' name='node\[parent_id\]' value='21'[^>]+/><div class='hidden'><input type='hidden' name='node\[klass\]' value='Letter'/><input type='submit'/><input type='hidden' name='node\[paper\]' value='white'/><input type='hidden' name='node\[origin\]' value='Mars'/></div>/"
39
+ res: "/node\[paper\]' value='white'/"
40
40
 
41
41
  translate_id_to_zip:
42
42
  src: "<b do='hot_id'/><i do='parent_id'/>"
@@ -45,7 +45,7 @@ translate_id_to_zip:
45
45
  select_class_existing_node:
46
46
  context:
47
47
  node: 'letter'
48
- src: "<r:form><r:select name='klass' root_class='Note' selected='Post'/></r:form>"
48
+ src: "<r:form><r:select name='klass' root_class='Note'/></r:form>"
49
49
  res: "/<select name=.node\[klass\]. id=.list1_klass.><option value=\"Note\">klass_Note<\/option>\n<option value=\"Letter\" selected=\"selected\">  klass_Letter<\/option>\n<option value=\"Post\">  klass_Post<\/option><\/select>/"
50
50
 
51
51
  select_class_new_node:
@@ -66,12 +66,12 @@ select_data:
66
66
  res: "/<select name=.k. data-d='foo'.*NN.*k_Note.*NNL.*k_Letter.*NNP.*k_Post/"
67
67
 
68
68
  select_nodes:
69
- src: "<r:form><r:select nodes='images in site' name='foo'></select></r:form>"
70
- res: "/name='node\[foo\]'[^>]+><option value=\"\" selected=\"selected\"></option>\n<option value=\"40\">Autumn Tree</option>\n<option value=\"30\">bird</option>/"
69
+ src: "<r:form><r:select nodes='images in site' name='origin'></select></r:form>"
70
+ res: "/name='node\[origin\]'[^>]+><option value=\"\" selected=\"selected\"></option>\n<option value=\"40\">Autumn Tree</option>\n<option value=\"30\">bird</option>/"
71
71
 
72
72
  select_nodes_show_rubyless:
73
- src: "<r:form><r:select nodes='images in site' name='foo' show='title.limit(3)'></select></r:form>"
74
- res: "/name='node\[foo\]'[^>]+><option value=\"\" selected=\"selected\"></option>\n<option value=\"40\">Aut…</option>\n<option value=\"30\">bir…</option>/"
73
+ src: "<r:form><r:select nodes='images in site' name='origin' show='title.limit(3)'></select></r:form>"
74
+ res: "/name='node\[origin\]'[^>]+><option value=\"\" selected=\"selected\"></option>\n<option value=\"40\">Aut…</option>\n<option value=\"30\">bir…</option>/"
75
75
 
76
76
  do_not_set_parent_id_if_form_contains_parent_id:
77
77
  src: "<r:children><r:each do='title'/><r:add/><r:form><r:select name='parent_id' nodes='projects in site'/><input name='title'/></r:form></r:children>"
@@ -82,15 +82,15 @@ select_nodes_selected:
82
82
  res: "/option\s* value=.21.\s* selected=.selected.>Clean Water/"
83
83
 
84
84
  select_nodes_in_ajax:
85
- src: "<r:pages><r:each do='title'/><r:add/><r:form><r:select nodes='images in site' name='d_ref'/></r:form></r:pages>"
86
- res: "/name=.node\[d_ref\].[^>]+><option value=\"\" selected=\"selected\"></option>\n<option value=\"40\">Autumn Tree</option>\n<option value=\"30\">bird</option>/"
85
+ src: "<r:pages><r:each do='title'/><r:add/><r:form><r:select nodes='images in site' name='origin'/></r:form></r:pages>"
86
+ res: "/name=.node\[origin\].[^>]+><option value=\"\" selected=\"selected\"></option>\n<option value=\"40\">Autumn Tree</option>\n<option value=\"30\">bird</option>/"
87
87
 
88
88
  select_nodes_show_attr:
89
89
  src: "<r:form><r:select name='title' nodes='images in site' attr='ext' show='title'/></r:form>"
90
90
  res: "/name=.node\[title\].[^>]+>.*<option value=\"jpg\">flower</option>\n<option value=\"jpg\">it's a lake</option>/"
91
91
 
92
92
  select_time_zone:
93
- src: "<r:form><r:select type='time_zone' name='d_tz'/></r:form>"
93
+ src: "<r:form><r:select type='time_zone' name='settings[tz]'/></r:form>"
94
94
  res: "/Asia/Jakarta.*Europe/Zurich.*US/Hawai"
95
95
 
96
96
  select_values_tshow:
@@ -221,7 +221,7 @@ textarea_with_blocks:
221
221
  context:
222
222
  node: 'ant'
223
223
  src: "<r:Contact? do='textarea' name='first_name'>Sir <r:show attr='first_name'/></r:Contact?>"
224
- tem: "/<textarea name='node\[first_name\]'>Sir <%= h @node.prop\['first_name'\] %></textarea>/"
224
+ tem: "/<textarea name='node\[first_name\]'>Sir <%=h @node.prop\['first_name'\] %></textarea>/"
225
225
  res: "<textarea name='node[first_name]'>Sir Solenopsis</textarea>"
226
226
 
227
227
  input_new:
@@ -232,7 +232,7 @@ input_new:
232
232
 
233
233
  show_in_form:
234
234
  src: "<r:form><b do='title'/></r:form>"
235
- tem: "/<b><%= @node.prop\['title'\] %></b>/"
235
+ tem: "/<b><%=h @node.prop\['title'\] %></b>/"
236
236
  res: '/<b>status title</b>/'
237
237
 
238
238
  not_set_parent_id:
@@ -301,6 +301,20 @@ select_eval_value:
301
301
  tem: "<select name='q'><%= options_for_select((params[:f] || '').split(',').map(&:strip).map {|e| [trans(e), e]}, param_value(\"q\").to_s) %></select>"
302
302
  res: "<select name='q'><option value=\"a\">a</option>\n<option value=\"b\">b</option>\n<option value=\"c\">c</option>\n<option value=\"en\" selected=\"selected\">english</option></select>"
303
303
 
304
+ select_for_hash:
305
+ context:
306
+ node: test
307
+ src: "<r:select label='t' name='settings[one]' values='foo,un'/>"
308
+ tem: "<label>settings_one</label> <span><select name='node[settings][one]'><%= options_for_select([[\"settings_one_foo\", \"foo\"], [\"settings_one_un\", \"un\"]], (@node.prop['settings'] ? @node.prop['settings'][\"one\"] : nil).to_s) %></select></span>"
309
+ res: "/<label>settings_one</label> .*option value=\"un\" selected=\"selected\"/"
310
+
311
+ select_for_hash_tprefix:
312
+ context:
313
+ node: test
314
+ src: "<r:select tprefix='rel' name='settings[one]' values='foo,un'/>"
315
+ tem: "<select name='node[settings][one]'><%= options_for_select([[\"rel_foo\", \"foo\"], [\"rel_un\", \"un\"]], (@node.prop['settings'] ? @node.prop['settings'][\"one\"] : nil).to_s) %></select>"
316
+ res: "<select name='node[settings][one]'><option value=\"foo\">rel_foo</option>\n<option value=\"un\" selected=\"selected\">rel_un</option></select>"
317
+
304
318
  crop:
305
319
  context:
306
320
  node: 'bird_jpg'
@@ -97,6 +97,11 @@ trans_literal_string:
97
97
  trans_block:
98
98
  src: "<r:t>en</r:t>"
99
99
  tem: "english"
100
+
101
+ link_trans:
102
+ # SECURITY: translation **REMOVES** html_escape (because the dictionary can contain JS or images).
103
+ src: "<r:link do='t' text='#{title}'/>"
104
+ tem: "<a href='<%= zen_path(@node) %>'><%= trans(\"#{@node.prop['title']}\") %></a>"
100
105
 
101
106
  lang_links:
102
107
  src: "<div id='lang' do='lang_links'><a>en</a> | <b>fr</b></div>"
@@ -18,7 +18,7 @@ less_then_in_dyn_param:
18
18
 
19
19
  greater_then_in_dyn_param:
20
20
  src: "<a foo='#{created_at > now ? \'yes\' : \'no\'}'>xx</a>"
21
- tem: "<a foo='<%= (@node.created_at ? (@node.created_at>Time.now) : nil) ? \"yes\" : \"no\" %>'>xx</a>"
21
+ tem: "<a foo='<%= ((@node.created_at ? (@node.created_at>Time.now) : nil) ? \"yes\" : \"no\") %>'>xx</a>"
22
22
 
23
23
  greater_then_in_do:
24
24
  src: "<a foo='bar' do='pages where created_at > 7'>xx</a>"
@@ -56,7 +56,7 @@ include_part:
56
56
 
57
57
  include_part_replace_method:
58
58
  src: "include_part: <r:include template='/meta/id/name' part='bob' do='title'/>"
59
- tem: "include_part: <b><%= @node.prop['title'] %></b>"
59
+ tem: "include_part: <b><%=h @node.prop['title'] %></b>"
60
60
 
61
61
  id_do:
62
62
  src: "<h1 id='logo' do='title'/>"
@@ -72,7 +72,7 @@ with_part_do_setup:
72
72
 
73
73
  with_part_do:
74
74
  src: "with_part_do: <r:include template='/meta/with/part/do/setup'><r:with part='main' do='title'/></r:include>"
75
- tem: "with_part_do: <div id='content'>hello <div id='main'><%= @node.prop['title'] %></div></div>"
75
+ tem: "with_part_do: <div id='content'>hello <div id='main'><%=h @node.prop['title'] %></div></div>"
76
76
 
77
77
  # this test is a dummy used by include_context
78
78
  context_dummy: