default: context: lang: 'en' visitor: 'ant' node: 'cleanWater' src: "simple text" tem: "simple text" res: "simple text" # ============= query_parse_param ======== empty: tem: "<%= query_parse('para' => %{}) %>" res: "1=1" empty_quotes: tem: "<%= query_parse('para' => %{\"\"}) %>" res: "para = \"\"" empty_single_quotes: tem: "<%= query_parse('para' => %{''}) %>" res: "para = ''" null_quoted: tem: "<%= query_parse('para' => %{\"null\"}) %>" res: "para = \"null\"" is_null: tem: "<%= query_parse('para' => %{null}) %>" res: "para is null" is_not_null: tem: "<%= query_parse('para' => %{!null}) %>" res: "not (para is null)" literal: tem: "<%= query_parse('para' => %{hello}) %>" res: "para = \"hello\"" literal_date: context: lang: fr tem: "<%= query_parse('para' => %{2.12.1983}) %>" res: "para = '1983-12-01 23:00'" number: tem: "<%= query_parse('para' => %{45}) %>" res: "para = 45" not_number: tem: "<%= query_parse('para' => %{!45}) %>" res: "not (para = 45)" greater_then: tem: "<%= query_parse('para' => %{>32}) %>" res: "para >32" greater_then_date: context: lang: fr tz: Asia/Jakarta tem: "<%= query_parse('para' => %{>7.5.1965}) %>" # Uses visitor timezone to UTC res: "para >'1965-05-06 17:00'" greater_or_equal_then: tem: "<%= query_parse('para' => %{>=32}) %>" res: "para >=32" smaller_then: tem: "<%= query_parse('para' => %{< 32}) %>" res: "para < 32" smaller_or_equal_then: tem: "<%= query_parse('para' => %{<=32}) %>" res: "para <=32" equal: tem: "<%= query_parse('para' => %{=32+3}) %>" res: "para =32+3" not_equal: tem: "<%= query_parse('para' => %{!=32}) %>" res: "not (para =32)" interval: tem: "<%= query_parse('para' => %{10..20}) %>" res: "para >= 10 and para <= 20" interval_date: context: lang: fr tem: "<%= query_parse('para' => %{1.1.2010..31.12.2010}) %>" res: "para >= '2009-12-31 23:00' and para <= '2010-12-30 23:00'" not_interval_date: context: lang: fr tem: "<%= query_parse('para' => %{!1.1.2010..31.12.2010}) %>" res: "not (para >= '2009-12-31 23:00' and para <= '2010-12-30 23:00')" interval_date_en: context: lang: en tem: "<%= query_parse('para' => %{2010/1/1..2010/12/31}) %>" res: "para >= '2009-12-31 23:00' and para <= '2010-12-30 23:00'" interval_date_iso: context: lang: en tem: "<%= query_parse('para' => %{2010-1-1..2010-12-31}) %>" res: "para >= '2009-12-31 23:00' and para <= '2010-12-30 23:00'" like: tem: "<%= query_parse('para' => %{*bar}) %>" res: "para like \"%bar\"" like_at_end: tem: "<%= query_parse('para' => %{bar*}) %>" res: "para like \"bar%\"" literal_with_star: tem: "<%= query_parse('para' => %{'*bar'}) %>" res: "para = '*bar'" many_params: tem: "<%= query_parse('anti' => %{'*bar'}, 'gone' => %{> 13}) %>" res: "/anti = '\*bar' and gone > 13|gone > 13 and anti = '\*bar'/" rubyless_query_parse: context: p: id: '> 45' name: 'foo' src: "query_parse(params[:p])" res: "/id > 45 and name = \"foo\"|name = \"foo\" and id > 45/" paginate_list: src: "" # should define page_name res: "1 2" paginate_count: src: "" # should properly pass the query to sub-contexts. tem: '/<%= _znodes %>/' res: "19" count: src: "" # should detect 'count' method and count nodes without pagination. tem: '/<%= _znodes %>/' res: "19" paginate_page_name: context: p: 5 src: "()" # should define page_name res: "…(4) 5 6(6) 7(7)" # ============= Dynamic query ======== query: # Live compile and query from params context: visitor: lion node: cleanWater qb: "nodes where updated_at.year = 2007 in project" src: "" tem: "/if var1 = query\('Node', \"@node\", params\[:qb\] \|\| \"nodes in project\", :find => :all, :binding => binding\)/" res: 'crocodiles' query_with_default: # Live compile and query from params context: visitor: lion node: cleanWater src: "" res: "crocodiles, it's a lake, The lake we love, Nice Bananas, parc opening, status title, water" query_with_param: # Live compile and query from params context: visitor: lion node: cleanWater qb: "nodes where updated_at.year = #{params[:p]} in project" p: 2007 src: "" res: 'crocodiles' query_eval: # Live compile and query from params context: visitor: lion node: cleanWater scope: 'self' src: "" res: 'crocodiles, Nice Bananas, status title' query_with_parse: context: filter: title: 'status title' src: "" tem: '/query.*pages where #\{query_parse\(params\[:filter\]\)\} in site\"/' res: 'status title' query_with_parse_paginate: src: "" # should properly pass the query to sub-contexts. tem: '/page_numbers/' res: "/1.*2.*3.*4.*5/" link_page_list: src: | : # should properly pass the query to sub-contexts. res: "/: 1 \| 2 \| 3 \| " tem: '/params\[:filter\] \|\| \"pages in site\"/' res: '' query_eval_in_sub_context: # Live compile and query from params context: visitor: lion node: cleanWater scope: 'self' # Should pass binding so that local var3 is recognized src: "" res: 'crocodiles, Nice Bananas, status title' query_eval_find_one: # Live compile and query from params context: visitor: lion node: cleanWater src: "" tem: "/<%= zen_path\(var1\) %>/" res: "/crocodiles/" query_count: tem: '<%= query("Page", "@node", "pages in site", :type => :count) %>' res: '19' simple_select: src: "
" tem: '/<%=h var1.attributes\["ti"\] %>/' res: "
crocodiles
" select_with_type: src: "
" tem: '/format_date\(var1.rcast\("ti", :time\)/' res: "
11.04.2006
" select_in_from: src: "
:
" tem: '/<%=h var2.attributes\["pt"\] %>: <%=h var2.attributes\["it"\] %>/' res: "
a wiki with Zena: bird, a wiki with Zena: flower, Clean Water project: it's a lake
" select_in_from_saved: src: "
:
" tem: '/<%=h var3.attributes\["pt"\] %>: <%=h var3.attributes\["it"\] %>/' res: "
a wiki with Zena: bird, a wiki with Zena: flower, Clean Water project: it's a lake
" select_group: src: "
:
" res: "
a wiki with Zena: bird, flower / Clean Water project: it's a lake
" select_group_count: src: "
:
" res: "
a wiki with Zena: 2, Clean Water project: 1
" select_group_count_having: src: "
:
" res: "
a wiki with Zena: 2
" query_errors: context: c: 'badaboum' src: "" res: "nodes in badaboum Invalid scope 'badaboum'." query_count: context: c: 'badaboum' src: "" tem: "/:find => :count/" res: "19" query_count_string_context: context: c: 'badaboum' src: "" tem: '/.Node., "@node".*:find => :count/' res: "19" find_with_rubyless: src: "" res: "Autumn Tree, bird" find_loads_class: src: "
" tem: "<% if var1 = find_node_by_zip(11) %>
<%=h var1.prop['origin'] %>
<% end %>" query_on_vclass: # typical syntax error (should be Contact?) src: "
" # does the query on last @node tem: "/Node.do_find/" res: '
Zena the wild CMS, people
'