Changeset 1084

Show
Ignore:
Timestamp:
2008-07-01 01:22:42 (6 months ago)
Author:
gaspard
Message:

Fixed all bugs and tests after 'dom_id' rewrite in zafu. All ajax stuff tested and seems to work (including calendars). Closes #203(16).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app/views/templates/edit_tabs/_title.rhtml

    r1083 r1084  
    1717<%= text_area 'node', 'v_comment', :cols=>nil, :rows=>2, :class => 'full_width' %> 
    1818 
    19 <% (@node.version.dyn.keys + (@node.virtual_class ? @node.virtual_class.attributes.split(',').map(&:strip) : [])).uniq.sort do |k| -%> 
     19<% @node.dyn_attribute_keys do |k| -%> 
    2020<label for="d_<%= k %>"><%= _(k) %></label> 
    2121<%= text_area 'node', "d_#{k}", :cols=>nil, :rows=>2, :class => 'full_width' %> 
  • trunk/lib/parser/lib/rules/zena.rb

    r1083 r1084  
    192192      inc = descendant('include') 
    193193      if inc && inc.params[:part] == @name 
    194         @context["#{@name}_method".to_sym] = method_name = get_template_url[1..-1].gsub('/','_') 
     194        @context["#{@name}_method".to_sym] = method_name = template_url[1..-1].gsub('/','_') 
    195195        pre << "<% def #{method_name}(depth, node, list); return '' if depth > #{inc.params[:depth] ? [inc.params[:depth].to_i,30].min : 5}; _erbout = '' -%>" 
    196196        post << "<% _erbout; end -%><%= #{method_name}(0,#{node},#{list || "[#{node}]"}) %>" 
     
    360360      attribute = @params[:attr] || @params[:tattr] || @params[:date] 
    361361      if @params[:edit] == 'true' && !['url','path'].include?(attribute) 
    362         name = unique_name + '_' + attribute 
    363         "<% if #{node}.can_write? -%><span class='show_edit' id='#{erb_dom_id("#{attribute}_")}'>#{actions}<%= link_to_remote(#{attribute_method}, :url => edit_node_path(#{node_id}) + \"?attribute=#{attribute}&dom_id=#{dom_id("#{attribute}_")}#{@params[:publish] == 'true' ? '&publish=true' : ''}\", :method => :get) %></span><% else -%>#{actions}<%= #{attribute_method} %><% end -%>" 
     362        "<% if #{node}.can_write? -%><span class='show_edit' id='#{erb_dom_id("_#{attribute}")}'>#{actions}<%= link_to_remote(#{attribute_method}, :url => edit_node_path(#{node_id}) + \"?attribute=#{attribute}&dom_id=#{dom_id("_#{attribute}")}#{@params[:publish] == 'true' ? '&publish=true' : ''}\", :method => :get) %></span><% else -%>#{actions}<%= #{attribute_method} %><% end -%>" 
    364363      else 
    365364        "#{actions}<%= #{attribute_method} %>" 
     
    390389      if @params[:edit] == 'true' && !['url','path'].include?(attribute) 
    391390        edit_text = _('edit') 
    392         @html_tag_params[:id] = erb_dom_id("#{attribute}_") 
    393         res = "<% if #{node}.can_write? -%><span class='zazen_edit'><%= link_to_remote(#{edit_text.inspect}, :url => edit_node_path(#{node_id}) + \"?attribute=#{attribute}&dom_id=#{dom_id("#{attribute}_")}#{@params[:publish] == 'true' ? '&publish=true' : ''}&zazen=true\", :method => :get) %></span><% end -%>#{res}" 
     391        @html_tag_params[:id] = erb_dom_id("_#{attribute}") 
     392        res = "<% if #{node}.can_write? -%><span class='zazen_edit'><%= link_to_remote(#{edit_text.inspect}, :url => edit_node_path(#{node_id}) + \"?attribute=#{attribute}&dom_id=#{dom_id("_#{attribute}")}#{@params[:publish] == 'true' ? '&publish=true' : ''}&zazen=true\", :method => :get) %></span><% end -%>#{res}" 
    394393      else 
    395394        res 
     
    437436        end 
    438437      else 
    439          
    440438        if parent.method == 'each' && @method == parent.single_child_method 
    441439          # use parent as block 
     
    733731           
    734732          # TODO: show 'reply' instead of 'edit' in comments if visitor != author 
    735           out link_to_update(self, :url => "\#{edit_#{base_class.to_s.underscore}_path(#{node_id})}", :html_params => get_html_params(@params), :method => :get, :else => :void) 
     733          out link_to_update(self, :url => "\#{edit_#{base_class.to_s.underscore}_path(#{node_id})}", :html_params => get_html_params(@params), :method => :get, :cond => "#{node}.can_write?", :else => :void) 
    736734        end 
    737735      else 
     
    768766        selected = "#{node_attribute(attribute)}.to_s" 
    769767      end 
     768      html_id = html_attributes[:id] ? " id='#{html_attributes[:id]}'" : '' 
    770769      if @context[:in_filter] 
    771         select_tag = "<select name='#{attribute}'>" 
    772       else 
    773         select_tag = "<select name='#{base_class.to_s.underscore}[#{attribute}]'>" 
     770        select_tag = "<select#{html_id} name='#{attribute}'>" 
     771      else 
     772        select_tag = "<select#{html_id} name='#{base_class.to_s.underscore}[#{attribute}]'>" 
    774773      end 
    775774       
     
    798797      when 'date_box', 'date' 
    799798        return parser_error("date_box without name") unless attribute 
    800         input_id = @context[:template_url] ? ", :id=>\"#{@context[:dom_id]}_#{attribute}\"" : '' 
     799        input_id = @context[:dom_prefix] ? ", :id=>\"#{dom_id}_#{attribute}\"" : '' 
    801800        "<%= date_box '#{base_class.to_s.underscore}', #{attribute.inspect}, :size=>15#{@context[:in_add] ? ", :value=>''" : ''}#{input_id} %>" 
    802801      when 'id' 
    803802        return parser_error("select id without name") unless attribute 
    804803        name = "#{attribute}_id" unless attribute[-3..-1] == '_id' 
    805         input_id = params[:input_id] ? ", :input_id =>\"#{@context[:dom_id]}_#{attribute}\"" : '' 
     804        input_id = @context[:erb_dom_id] ? ", :input_id =>\"#{erb_dom_id}_#{attribute}\"" : '' 
    806805        "<%= select_id('#{base_class.to_s.underscore}', #{attribute.inspect}#{input_id}) %>" 
    807806      when 'time_zone' 
     
    11711170      opts[:method]       = :delete 
    11721171      opts[:default_text] = _('btn_tiny_del') 
    1173       opts[:html_params]  = get_html_params(@params
     1172      opts[:html_params]  = get_html_params({:class => 'unlink'}.merge(@params)
    11741173       
    11751174      out link_to_update(target, opts) 
     
    12781277     
    12791278    def r_each 
     1279      if @context[:dom_prefix] || @params[:draggable] == 'true' || descendant('unlink') 
     1280        id_hash = {:id => erb_dom_id} 
     1281      else 
     1282        id_hash = nil 
     1283      end 
     1284       
    12801285      if @context[:make_form] 
    12811286        # use the elements inside 'each' loop to produce the edit form 
     
    12831288      elsif @context[:list] 
    12841289        # normal rendering: inserted into the layout 
    1285         if @params[:draggable] == 'true' 
     1290        if @params[:draggable] == 'true' || descendant('unlink') 
    12861291          @html_tag ||= 'div' 
    12871292          out "<% #{var}_dom_ids = [] -%>" 
     
    13181323        @anchor_param = nil 
    13191324         
    1320         if @context[:dom_prefix] 
    1321           # ajax, set id, class 
    1322           id_hash = {:id=> erb_dom_id} 
     1325        res = expand_with(:node => var, :scope_node => var) 
     1326         
     1327        if id_hash 
    13231328          if @html_tag 
    13241329            @html_tag_params.merge!(id_hash) 
    1325             res = expand_with(:node=>var, :scope_node=>var) 
    13261330          else 
    1327             res = add_params(expand_with(:node=>var, :scope_node=>var), id_hash) 
    1328           end 
    1329         else 
    1330           res = expand_with(:node=>var, :scope_node=>var) 
    1331         end 
     1331            res = add_params(res, id_hash) 
     1332          end 
     1333        end 
     1334         
    13321335        out render_html_tag(res, html_append) 
     1336         
    13331337        out "<% end -%>" 
    13341338         
     
    13361340          out "<script type='text/javascript'>\n//<![CDATA[\n<%= #{var}_dom_ids.inspect %>.each(Zena.draggable)\n//]]>\n</script>" 
    13371341        end 
     1342         
    13381343      elsif @context[:saved_template] 
    13391344        # render to produce a saved template 
    1340         id_hash = {:id=>erb_dom_id} 
    1341         if @html_tag 
    1342           @html_tag_params.merge!(id_hash) 
    1343           out render_html_tag(expand_with(:scope_node=>node), html_append) 
    1344         else 
    1345           out add_params(expand_with(:scope_node=>node), id_hash) 
    1346         end 
     1345        res = expand_with(:scope_node => node) 
     1346        if id_hash 
     1347          if @html_tag 
     1348            @html_tag_params.merge!(id_hash) 
     1349            res = render_html_tag(res, html_append) 
     1350          else 
     1351            res = add_params(res, id_hash) 
     1352          end 
     1353        end 
     1354         
     1355        out res 
     1356         
    13471357        if @params[:draggable] == 'true' 
    13481358          out "<script type='text/javascript'>\n//<![CDATA[\nZena.draggable('#{erb_dom_id}')\n//]]>\n</script>" 
     
    16691679        # called from self (storing template / rendering) 
    16701680        size     = (params[:size] || 'large').to_sym 
    1671         dom_id   = @context[:dom_id] 
    1672         template_url = @context[:template_url] 
    16731681        finder   = params[:find] || 'notes in project' 
    16741682        ref_date = params[:date] || 'event_at' 
    16751683        type     = params[:type] ? params[:type].to_sym : :month 
    1676         @params[ref_date.gsub('_at','').to_sym] = 'month' # will produce a raw finder for all events in the same month as the ref date. 
    16771684           
    16781685        if @blocks == [] 
     
    16831690            @blocks = [make(:void, :method=>'void', :text=>"<span do='show' date='current_date' format='%d'/><ul><li do='each' do='link' attr='name'/></ul><r:else do='[current_date]' format='%d'/>")] 
    16841691          end 
     1692          remove_instance_variable(:@all_descendants) 
    16851693        elsif !descendant('else') 
    16861694          @blocks += [make(:void, :method=>'void', :text=>"<r:else do='[current_date]' format='%d'/>")] 
    16871695        end 
    16881696        @html_tag_done = false 
    1689         @html_tag_params[:id] = "#{@context[:erb_dom_id]}_<%= #{node}.zip %>" 
     1697        @html_tag_params[:id] = erb_dom_id 
    16901698        @html_tag_params[:class] ||= "#{size}cal" 
    16911699        @html_tag ||= 'div' 
     
    17061714        res = <<-END_TXT 
    17071715<h3 class='title'> 
    1708 <span><%= link_to_remote(#{_('img_prev_page').inspect}, :url => #{base_class.to_s.underscore}_path(#{node_id}) + \"/zafu?t_url=#{CGI.escape(template_url)}&dom_id=#{@context[:dom_id]}&date=#{prev_date}\", :method => :get) %></span> 
    1709 <span><%= link_to_remote(#{title}, :url => #{base_class.to_s.underscore}_path(#{node_id}) + \"/zafu?t_url=#{CGI.escape(template_url)}&dom_id=#{@context[:dom_id]}\", :method => :get) %></span> 
    1710 <span><%= link_to_remote(#{_('img_next_page').inspect}, :url => #{base_class.to_s.underscore}_path(#{node_id}) + \"/zafu?t_url=#{CGI.escape(template_url)}&dom_id=#{@context[:dom_id]}&date=#{next_date}\", :method => :get) %></span> 
     1716<span><%= link_to_remote(#{_('img_prev_page').inspect}, :url => #{base_class.to_s.underscore}_path(#{node_id}) + \"/zafu?t_url=#{CGI.escape(template_url)}&dom_id=#{dom_id}&date=#{prev_date}\", :method => :get) %></span> 
     1717<span class='date'><%= link_to_remote(#{title}, :url => #{base_class.to_s.underscore}_path(#{node_id}) + \"/zafu?t_url=#{CGI.escape(template_url)}&dom_id=#{dom_id}\", :method => :get) %></span> 
     1718<span><%= link_to_remote(#{_('img_next_page').inspect}, :url => #{base_class.to_s.underscore}_path(#{node_id}) + \"/zafu?t_url=#{CGI.escape(template_url)}&dom_id=#{dom_id}&date=#{next_date}\", :method => :get) %></span> 
    17111719</h3> 
    17121720<table cellspacing='0' class='#{size}cal'> 
     
    17161724  <tr class='body'> 
    17171725<% week.step(week+6,1) do |day_#{list_var}|; #{list_var} = cal_#{list_var}[day_#{list_var}.strftime('%Y-%m-%d')] -%> 
    1718     <td<%= cal_class(day_#{list_var},#{current_date}) %>><% if #{list_var} -%>#{expand_with(:in_if => true, :list => list_var, :date => "day_#{list_var}", :template_url => nil)}<% end -%></td> 
     1726    <td<%= cal_class(day_#{list_var},#{current_date}) %>><% if #{list_var} -%>#{expand_with(:in_if => true, :list => list_var, :date => "day_#{list_var}", :saved_template => nil, :dom_prefix => nil)}<% end -%></td> 
    17191727<% end -%> 
    17201728  </tr> 
     
    17291737        @date_scope = "TABLE_NAME.#{fld} >= '\#{start_date.strftime('%Y-%m-%d')}' AND TABLE_NAME.#{fld} <= '\#{end_date.strftime('%Y-%m-%d')}'" 
    17301738         
    1731         template_url  = get_template_url(@context) 
     1739        new_dom_scope 
    17321740         
    17331741        # SAVED TEMPLATE 
    1734         template = expand_block(self, :block => self, :node => '@node', :template_url => template_url, :dom_id => "\#{params[:dom_id]}", :erb_dom_id => "<%= params[:dom_id] %>"
     1742        template = expand_block(self, :block => self, :saved_template => true
    17351743        out helper.save_erb_to_url(template, template_url) 
    17361744         
    17371745        # INLINE 
    1738         out expand_block(self, :block => self, :template_url => template_url, :dom_id => "#{self.dom_id}_\#{#{node_id}}", :erb_dom_id => "#{self.dom_id}_<%= #{node_id} %>"
     1746        out expand_block(self, :block => self, :saved_template => false
    17391747      end 
    17401748    end 
     
    17431751    def r_cache 
    17441752      kpath   = @params[:kpath]   || Page.kpath 
    1745       context = get_template_url 
    1746       out "<% #{cache} = Cache.with(visitor.id, visitor.group_ids, #{kpath.inspect}, #{helper.send(:lang).inspect}, #{context.inspect}) do capture do %>" 
     1753      out "<% #{cache} = Cache.with(visitor.id, visitor.group_ids, #{kpath.inspect}, #{helper.send(:lang).inspect}, #{template_url.inspect}) do capture do %>" 
    17471754      out expand_with 
    17481755      out "<% end; end %><%= #{cache} %>" 
     
    17511758    # recursion 
    17521759    def r_include 
    1753       return '' if @context[:template_url
     1760      return '' if @context[:saved_template
    17541761      return super if @params[:template] || !@params[:part] 
    17551762      part = @params[:part].gsub(/[^a-zA-Z_]/,'') 
     
    18061813      return parser_error("stylesheet #{@params[:stylesheet].inspect} not found") unless doc 
    18071814       
    1808       template_url = (get_template_url.split('/')[0..-2] + ['_main.xsl']).join('/') 
     1815      template_url = (self.template_url.split('/')[0..-2] + ['_main.xsl']).join('/') 
    18091816      helper.save_erb_to_url(xsl_content, template_url) 
    18101817      out "<?xml version='1.0' encoding='utf-8'?>\n" 
     
    21092116     
    21102117    def do_list(list_finder, opts={}) 
    2111       new_dom_scope 
     2118      clear_dom_scope 
    21122119       
    21132120      @context.merge!(opts)          # pass options from 'zafu_known_contexts' to @context 
    21142121       
    2115       if (each_block = descendant('each')) && (descendant('edit') || descendant('add') || descendant('add_document') || (descendant('swap') && descendant('swap').parent.method != 'block') || ['block', 'drop'].include?(each_block.single_child_method)) 
     2122      if (each_block = descendant('each')) && (each_block.descendant('edit') || descendant('add') || descendant('add_document') || (descendant('swap') && descendant('swap').parent.method != 'block') || ['block', 'drop'].include?(each_block.single_child_method)) 
     2123        new_dom_scope 
    21162124        # ajax, build template. We could merge the following code with 'r_block'. 
    21172125        add_block  = descendant('add') 
     
    22012209     
    22022210    # use our own scope 
    2203     def new_dom_scope 
     2211    def clear_dom_scope 
    22042212      @context.delete(:dom_prefix)     # should not propagate 
    2205       @context[:dom_prefix] = self.dom_prefix 
    22062213      @context.delete(:make_form)      # should not propagate 
    22072214      @context.delete(:saved_template) # should not propagate 
    22082215    end 
    22092216     
     2217    # create our own ajax DOM scope 
     2218    def new_dom_scope 
     2219      clear_dom_scope 
     2220      @context[:dom_prefix] = self.dom_prefix 
     2221    end 
     2222     
    22102223    # DOM id for the current context 
    2211     def dom_id(prefix='') 
     2224    def dom_id(suffix='') 
    22122225      return "\#{dom_id(#{node})}" if @context && @context[:saved_template] 
    22132226      if @context && scope_node = @context[:scope_node] 
    2214         res = "#{prefix}#{dom_prefix}_\#{#{scope_node}.zip}" 
    2215       else 
    2216         res = prefix + dom_prefix 
     2227        res = "#{dom_prefix}_\#{#{scope_node}.zip}" 
     2228      else 
     2229        res = dom_prefix 
    22172230      end 
    22182231      if method == 'each' && !@context[:make_form] 
     
    22282241          parent = parent.parent 
    22292242        end 
    2230         target ? target.dom_id : res 
    2231       else 
    2232         res 
    2233       end 
    2234     end 
    2235      
    2236     def erb_dom_id(prefix='') 
     2243        target ? target.dom_id(suffix) : (res + suffix) 
     2244      else 
     2245        res + suffix 
     2246      end 
     2247    end 
     2248     
     2249    def erb_dom_id(suffix='') 
    22372250      return "<%= dom_id(#{node}) %>" if @context && @context[:saved_template] 
    22382251      if @context && scope_node = @context[:scope_node] 
    2239         res = "#{prefix}#{dom_prefix}_<%= #{scope_node}.zip %>" 
    2240       else 
    2241         res = prefix + dom_prefix 
    2242       end 
    2243       if method == 'each' && @context[:make_form] 
     2252        res = "#{dom_prefix}_<%= #{scope_node}.zip %>" 
     2253      else 
     2254        res = dom_prefix 
     2255      end 
     2256      if method == 'each' && !@context[:make_form] 
    22442257        "#{res}_<%= #{var}.zip %>" 
    22452258      elsif method == 'unlink' 
     
    22532266          parent = parent.parent 
    22542267        end 
    2255         target ? target.erb_dom_id : res 
    2256       else 
    2257         res 
     2268        target ? target.erb_dom_id(suffix) : (res + suffix) 
     2269      else 
     2270        res + suffix 
    22582271      end 
    22592272    end 
     
    24902503         
    24912504        res ||= if opts[:erb] 
    2492           "<%= #{res} %>" 
    2493         else 
    2494           "\#{#{res}}" 
     2505          "<%= #{attribute} %>" 
     2506        else 
     2507          "\#{#{attribute}}" 
    24952508        end 
    24962509        res 
     
    25092522       
    25102523      real_attribute = attribute =~ /\Ad_/ ? attribute : attribute.gsub(/\A(|[\w_]+)id(s?)\Z/, '\1zip\2') 
    2511  
     2524       
    25122525      res = if klass.ancestors.include?(Node) 
    25132526        if ['url','path'].include?(real_attribute) 
     
    26972710      if res[:name] =~ /\A([\w_]+)\[(.*?)\]/ 
    26982711        attribute = $2 
    2699         res[:id]   = "#{$1}_#{$2}" 
    27002712      else 
    27012713        attribute = res[:name] 
     
    27072719      end  
    27082720       
    2709       res[:id]   = @context[:erb_dom_id] ? "#{@context[:erb_dom_id]}_#{attribute}" : res[:name].sub('[','_').sub(']','') 
     2721      res[:id]   = "#{erb_dom_id}_#{attribute}" if @context[:dom_prefix] 
    27102722       
    27112723      [:size, :style, :class].each do |k| 
     
    28282840      return '' if ['url','path'].include?(attribute) # cannot be set with a form 
    28292841      if params[:date] 
    2830       input_id = @context[:template_url] ? ", :id=>\"#{@context[:dom_id]}_#{attribute}\"" : '' 
     2842      input_id = @context[:dom_prefix] ? ", :id=>\"#{dom_id}_#{attribute}\"" : '' 
    28312843        return "<%= date_box('#{base_class.to_s.underscore}', #{params[:date].inspect}#{input_id}) %>" 
    28322844      end 
    2833       input_id = @context[:template_url] ? " id='#{@context[:erb_dom_id]}_#{attribute}'" : '' 
     2845      input_id = @context[:dom_prefix] ? " id='#{erb_dom_id}_#{attribute}'" : '' 
    28342846      "<input type='#{params[:type] || 'text'}'#{input_id} name='#{input[:name]}' value=#{input[:value]}/>" 
    28352847    end 
     
    28512863        value = attribute ? "<%= #{node_attribute(attribute)} %>" : "" 
    28522864      end 
    2853       input_id = "#{@context[:erb_dom_id]}_#{attribute}" || name.sub('[','_').sub(']','') 
    2854       "<textarea name='#{name}' id='#{input_id}'>#{value}</textarea>" 
     2865      html_id = @context[:dom_prefix] ? " id='#{erb_dom_id}_#{attribute}'" : '' 
     2866      "<textarea#{html_id} name='#{name}'>#{value}</textarea>" 
    28552867    end 
    28562868     
  • trunk/lib/query_builder/lib/query_builder.rb

    r1083 r1084  
    211211          end 
    212212          op = $1.strip 
    213           rest = rest[$1.size..-1] 
     213          rest = rest[op.size..-1] 
    214214          op = {'lt' => '<','le' => '<=','eq' => '=','ne' => '<>','ge' => '>=','gt' => '>','like' => 'LIKE', 'not like' => 'NOT LIKE'}[op] || $1 
    215215          res << op 
  • trunk/public/stylesheets/calendar.css

    r1081 r1084  
    11/* small calendar */ 
    22 
    3 .tinycal .title { text-align: center; background:white; margin-bottom:0.5em; color:#655;} 
     3.tinycal .title { display:table; margin:auto; background:white; margin-bottom:0.5em; color:#655;} 
    44.tinycal table { margin:auto; cursor:pointer; } 
    55.tinycal table { border: 1px solid #CAD4DA; background:#F5F8F9; } 
    66.tinycal td { text-align:center; color:#333; } 
    77.tinycal a { color:inherit; } 
     8.tinycal .title span { display:block; float:left; text-align:center;} 
     9.tinycal .title .date { width:130px; } 
    810.tinycal em { border-bottom:2px solid orange; font-style:normal; } 
    911.tinycal .head td { padding: 2px; color:#655; text-align:center; } 
     
    1618 
    1719/* LARGE CALENDAR */ 
    18 .largecal .title { text-align: center; background:white; margin-bottom:0.5em; font-size:1.3em; } 
     20.largecal .title { display:table; margin:auto; background:white; margin-bottom:0.5em; font-size:1.3em; } 
    1921.largecal .title a { color:#655; font-size: 1em; font-family: Georgia, Times, serif;} 
    20 .largecal .title span { padding:0 6px; } 
    21 .largecal table { border:1px solid #655; margin:auto; border-collapse:separate; line-height:1em;} 
     22.largecal .title span { padding:0 6px; display:block; float:left; text-align:center;} 
     23.largecal .title .date {  width:150px; } 
     24.largecal table { border:1px solid #655; margin:auto; border-collapse:separate; line-height:1em; clear:left;} 
    2225.largecal .head td  { border-left:1px solid #836C6C; background: #655; color: #fff; width:14%; height:0.8em; text-align:center; padding:0.4em 3px; } 
    2326.largecal .head td:first-child {border-left-width:0;} 
  • trunk/test/fixtures/files/ajax_test.zafu

    r1083 r1084  
    2525<r:filter live='true' update='upfi'/> 
    2626</div> 
     27 
     28 
     29<h3>calendar test</h3> 
     30<div do='calendar' find='notes in site'/> 
     31 
     32<h3>week calendar</h3> 
     33<div do='calendar' find='notes in site' type='week'/> 
     34 
     35<h3>tiny calendar</h3> 
     36<div do='calendar' find='notes in site' size='tiny'/> 
     37 
    2738 
    2839<div id='edit' do='block'> 
     
    104115<hr/> 
    105116 
    106  
    107117<h2>notes & comments</h2> 
    108118 
    109 <r:include template='notes'/> 
     119<div id='notes' do='notes' in='project' limit='10' order='log_at DESC'> 
     120  <ul class='note_list'> 
     121    <li do='add' after='self'/> 
     122    <li class='inline_form' do='form'> 
     123      <form> 
     124        <p class='node_v_title'><input type='text' name='v_title' size='25'/></p> 
     125        <p class='node_klass'>  <r:select name='klass' root_class='Note' selected='Post'/></p> 
     126        <p class='node_log_at'> <input type='date_box' name='log_at'/> </p> 
     127        <p class='validate'>    <input type="submit" value='validate' do='void' tset_value='validate'/></p> 
     128      </form> 
     129    </li> 
     130    <li class='note' do='each'> 
     131      <div class='header'> 
     132        <p class='log_at' do='show' date='log_at' tformat='full_date'>04.10</p> 
     133        <h2 class='title' do='title' actions='all'/> 
     134        <div class='summary' do ='summary'/> 
     135      </div> 
     136      <r:text/> 
     137<ul do='comments'> 
     138<li do='each'><b do='[title]'/> <b do='[author_name]'/> 
     139<div do='{text}'/> 
     140</li> 
     141<li do='add'/> 
     142<li do='form'> 
     143<p><input name='title'/></p> 
     144<p><textarea name='text'/></p> 
     145<p><input type='submit'/></p> 
     146</li> 
     147</ul> 
     148      <div class='clear'></div> 
     149    </li> 
     150  </ul> 
     151</div> 
     152 
    110153 
    111154<hr/> 
  • trunk/test/helpers/application_helper_test.rb

    r1064 r1084  
    287287  end 
    288288   
    289   def test_calendar_has_note 
    290     op_at = nodes(:opening).event_at 
    291     @node = secure!(Node) { nodes(:zena) } 
    292     sql, errors, ignore_source = Node.build_find(:all, "news", :node_name => '@node', :raw_filters => ["TABLE_NAME.event_at >= '\#{start_date.strftime('%Y-%m-%d')}' AND TABLE_NAME.event_at <= '\#{end_date.strftime('%Y-%m-%d')}'"]) 
    293     sql = "\"#{sql}\"" 
    294     cal = calendar(:node=>@node, :date=>Date.civil(op_at.year, op_at.month, 5), :size=>'tiny', :sql => sql) 
    295     assert_match %r{class='sun'>12}, cal 
    296     assert_match %r{<em>18</em>}, cal 
    297     cal = calendar(:node=>@node, :date=>Date.civil(op_at.year, op_at.month, 5), :size=>'large', :sql => sql) 
    298     assert_match %r{18.*onclick=.*Updater.*largecal_preview.*/z/calendar/notes.*(selected=27.*|2006-03-18.*)(selected=27.*|2006-03-18.*)</p></td>}m, cal 
    299   end 
    300    
    301   def test_calendar_today 
    302     @node = secure!(Node) { nodes(:zena) } 
    303     sql, errors, ignore_source = Node.build_find(:all, "news", :node_name => '@node', :raw_filters => ["TABLE_NAME.event_at >= '\#{start_date.strftime('%Y-%m-%d')}' AND TABLE_NAME.event_at <= '\#{end_date.strftime('%Y-%m-%d')}'"]) 
    304     sql = "\"#{sql}\"" 
    305     cal = calendar(:node=>@node, :sql => sql, :size=>'large') 
    306     assert_match %r{<td[^>]*id='large_today'>#{Date.today.day}</td>}, cal 
    307     cal = calendar(:node=>@node, :sql => sql, :size=>'tiny') 
    308     assert_match %r{<td[^>]*id='tiny_today'>#{Date.today.day}</td>}, cal 
    309   end 
    310    
    311289  # ------ these tests were in main helper ---- 
    312290 
  • trunk/test/helpers/node_query/complex.yml

    r1078 r1084  
    5050    node: roger 
    5151  src: assigned_formations where l_status eq 100 
    52   res: form2006, transm2001, transm2002, transp2004 
     52  res: fiber2003, form2006, transm2001, transm2002, transp2004 
    5353 
    5454custom_query_form_date: 
     
    6262    node: roger 
    6363    ref_date: 2005-03-01 
    64   src: emp_form_dates where custom_a is not null and (last_date is null or next_date lt REF_DATE + 6 month) order by next_date desc 
    65   res: "transmit_information, engine
     64  src: emp_form_dates where last_date is null or (custom_a is not null and next_date lt REF_DATE + 6 month) 
     65  res: "engine, radio_usage, secure_a_site, winch_usage, transmit_information, fiber_junction
    6666 
    6767find_employees_related_to_a_course__formulate_problems: 
  • trunk/test/helpers/node_query/filters.yml

    r1078 r1084  
    6767param_filter_no_string: 
    6868  src: "notes where created_at gt REF_DATE - param:f in site" 
    69   sql: "/nodes.created_at\ >now\(\) - #\{Node.connection.quote\(params\[:f\].to_s\)\}/" 
     69  sql: "/nodes.created_at\ > now\(\) - #\{Node.connection.quote\(params\[:f\].to_s\)\}/" 
    7070 
    7171filter_literal: 
  • trunk/test/helpers/zena_parser/ajax.yml

    r1083 r1084  
    77show_edit: 
    88  src: "<r:show attr='name' edit='true'/>" 
    9   tem: "<% if @node.can_write? -%><span class='show_edit' id='list_name.<%= @node.zip %>'><%= link_to_remote(@node.name, :url => edit_node_path(@node.zip) + \"?attribute=name&identifier=list_name.#{@node.zip}\", :method => :get) %></span><% else -%><%= @node.name %><% end -%>" 
    10   res: "/span class='show_edit' id='list_name.22'>.*Ajax\.Request\('/nodes/22/edit\?attribute=name/" 
     9  tem: "<% if @node.can_write? -%><span class='show_edit' id='list1_name'><%= link_to_remote(@node.name, :url => edit_node_path(@node.zip) + \"?attribute=name&dom_id=list1_name\", :method => :get) %></span><% else -%><%= @node.name %><% end -%>" 
     10  res: "/span class='show_edit' id='list1_name'>.*Ajax\.Request\('/nodes/22/edit\?attribute=name/" 
    1111 
    1212zazen_edit: 
    1313  src: "<r:zazen attr='name' edit='true'/>" 
    14   tem: "<div id='list_name.<%= @node.zip %>'><% if @node.can_write? -%><span class='zazen_edit'><%= link_to_remote(\"edit\", :url => edit_node_path(@node.zip) + \"?attribute=name&identifier=list_name.#{@node.zip}&zazen=true\", :method => :get) %></span><% end -%><%= zazen(@node.name, :node=>@node) %></div>" 
    15   res: "/div id='list_name.22'>.*Ajax\.Request\('/nodes/22/edit\?attribute=name/" 
     14  tem: "<div id='list1_name'><% if @node.can_write? -%><span class='zazen_edit'><%= link_to_remote(\"edit\", :url => edit_node_path(@node.zip) + \"?attribute=name&dom_id=list1_name&zazen=true\", :method => :get) %></span><% end -%><%= zazen(@node.name, :node=>@node) %></div>" 
     15  res: "/div id='list1_name'>.*Ajax\.Request\('/nodes/22/edit\?attribute=name/" 
    1616 
    1717edit_not_each: 
     
    4040      <li do='form'><input name='v_title'/> this is the form</li> 
    4141    </r:children> 
    42   res: "/<li.*list_29_30.*>bird.*<li.*list_29_31.*>flower.*<li.*list_29_add.*list_29_form.*toggle.*<li .*list_29_form.*style.*none.*Ajax.Request.*input type='hidden' name='template_url' value=\"/each/add/with/form/list\".*input type='hidden' name='node\[parent_id\]' value=\"29\"/" 
     42  res: "/<li.*list1_30.*>bird.*<li.*list1_31.*>flower.*<li.*list1_add.*list1_form.*toggle.*<li .*list1_form.*style.*none.*Ajax.Request.*input type='hidden' name='t_url' value=./each/add/with/form/list1.*input type='hidden' name='node\[parent_id\]' value=.29./" 
    4343 
    4444each_add_with_form_klass_set: 
     
    5555each_add_with_select: 
    5656  src: "<r:children><r:each do='[name]'/><r:add/><r:form><select name='icon_id' nodes='images in project' selected='[main.icon_id]_abc'/></r:form></r:children>" 
    57   'each/add/en/with/select/list_form.erb': '/:selected => \"#\{@node.icon_zip\}_abc\"/' 
     57  'each/add/en/with/select/list1_form.erb': '/map.|r| \[r.name, r.zip.to_s\]., \"#.@node.icon_zip._abc\"\)/' 
    5858  tem: "/@node.do_find\(:all, \"SELECT nodes.* FROM nodes WHERE nodes.kpath LIKE 'NDI%'/" 
    5959 
     
    6262    node: 'wiki' 
    6363  src: "<r:children><r:each><li><r:show attr='name'>blah</r:show> <r:edit>edit</r:edit></li>\n</r:each><r:form><li><form>this is the form</form></li></r:form></r:children>" 
    64   res: "/<li id='list.29.30'>bird <a href='/nodes/30/edit\?template_url=.*' onclick=\"new Ajax.Request\('/nodes/30/edit\?template_url=%2Feach%2Fedit%2Fwith%2Fform%2Flist/" 
     64  res: "/<li id='list1_30'>bird <a href='/nodes/30/edit\?t_url=.*' onclick=\"new Ajax.Request\('/nodes/30/edit\?t_url=%2Feach%2Fedit%2Fwith%2Fform%2Flist/" 
    6565 
    6666make_form: 
    6767  src: "<ul do='children'><li do='each' do='[name]'/><li do='add'/></ul>" 
    68   tem: "/<li id='list_<%= @node.zip %>_form' style='display:none;'><%= form_remote_tag\(:url => nodes_path/" 
    69   'make/form/en/list.erb': "<li id='<%= params[:dom_id] %>_<%= @node.zip %>'><%= @node.name %></li>" 
    70   'make/form/en/list_form.erb': "/<li id='<%= params\[:dom_id\] %>_<%= @node.new_record\? \? 'form' : @node.zip %>'>/" 
     68  tem: "/<li id='list1_form' style='display:none;'><%= form_remote_tag\(:url => nodes_path/" 
     69  'make/form/en/list1.erb': "<li id='<%= dom_id(@node) %>'><%= @node.name %></li>" 
     70  'make/form/en/list1_form.erb': "/<li id='<%= dom_id\(@node\) %>'>/" 
    7171 
    7272each_edit_cannot_write: 
     
    7575    visitor: 'anon' 
    7676  src: "<r:children><r:each><li><r:show attr='name'>blah</r:show> <r:edit>edit</r:edit></li>\n</r:each></r:children>" 
    77   res: "/<li id='list.21.24'>lake </li>.*/" 
     77  res: "/<li id='list1_24'>lake </li>.*/" 
    7878 
    7979add_each_publish: 
    8080  src: "<ul do='children' id='things'><li do='each'>I <p do='[name]'>blah</p></li><li do='add' publish='true'/></ul>" 
    81   res: "/<ul><li.*id='things_add'.*li id='things_form'.*form.*hidden.*name='node\[v_status\]' value=\"50\"/" 
     81  res: "/<ul><li.*id='things_add'.*li id='things_form'.*form.*hidden.*name='node\[v_status\]' value=.50./" 
    8282 
    8383block_edit_form: 
     
    9191saved_each_block: 
    9292  src: "<ol do='pages'><li do='each' on_if='ancestor' do='link'/><li do='add'/></ol>" 
    93   'saved/each/en/block/list.erb': "!/var1/" 
     93  'saved/each/en/block/list1.erb': "!/var1/" 
    9494 
    9595no_recursion_in_saved_block: 
     
    103103default_focus_field: 
    104104  src: "<ol do='comments'><li do='each'/><li do='form'><input name='author_name'/> ... <input name='text'/></li><li do='add'/></ol>" 
    105   res: "/\$\(\"list_form_t\"\).focusFirstElement\(\)/" 
     105  res: "/\$\(\"list1_form_t\"\).focusFirstElement\(\)/" 
    106106 
    107107live_filter: 
     
    110110  src: "<r:filter live='true'/><r:block><ol do='pages where name like \"[param:f]%\"'><li do='each' do='[name]'/></ol></r:block>" 
    111111  tem: "/connection.quote\(params\[:f\]/" 
    112   'live/filter/en/list.erb': "/<div id='<%= params\[:dom_id\] %>.*Node.connection.quote\(params\[:f\]/" 
    113   res: "/<input type='text' name='f'.*<div id='list_21_21'><ol><li>status</li><li>track</li></ol></div>/" 
     112  'live/filter/en/list2.erb': "/<div id='<%= dom_id\(@node\) %>.*Node.connection.quote\(params\[:f\]/" 
     113  res: "/<input type='text' name='f'.*<div id='list2'><ol><li>status</li><li>track</li></ol></div>/" 
    114114 
    115115live_filter_select_options: 
     
    117117    node: cleanWater 
    118118  src: "<r:filter live='true' do='select' name='f' values='1,2'/><r:block><ol do='pages where name like \"[param:f]%\"'><li do='each' do='[name]'/></ol></r:block>" 
    119   tem: "/select('node', \"f\", [\"1\", \"2\"], :selected => params[:f].to_s)/" 
    120   'live/filter/en/list.erb': "/<div id='<%= params\[:dom_id\] %>.*Node.connection.quote\(params\[:f\]/" 
    121   res: "/<input type='text' name='f'.*<div id='list_21_21'><ol><li>status</li><li>track</li></ol></div>/" 
     119  tem: "/select name=.f.><%= options_for_select\(\[.1., .2.\], params\[:f\].to_s/" 
     120  'live/filter/en/list2.erb': "/<div id='<%= dom_id\(@node\) %>.*Node.connection.quote\(params\[:f\]/" 
     121  res: "/<select name='f'.*<div id='list2'><ol><li>status</li><li>track</li></ol></div>/" 
    122122 
    123123draggable_do_syntax: 
    124124  src: "<r:images in='site' do='each' draggable='true' do='img' mode='pv'/>" 
    125   res: "/div id='list_30'><img src='/en/image30_pv.jpg'.*list_30.*.each\(Zena.draggable/" 
    126  
     125  res: "/div id='list1_30'><img src='/en/image30_pv.jpg'.*list1_30.*.each\(Zena.draggable/" 
    127126 
    128127unlink: 
    129128  context: 
    130129    node: 'art' 
    131   src: "<r:tagged do='each' join=',' do='unlink'/>" 
    132   res: "/<a class=.unlink..*onclick=.*Ajax.Request\('/nodes/21/links/_ID(cleanWater_in_art)\?dom_id=list_33.*bullet_delete.png.*links/_ID(opening_in_art)/" 
     130  src: "<r:tagged do='each' do='unlink'/>" 
     131  res: "/<div id='list1_21'><a .*onclick=.*Ajax.Request.*_ID(cleanWater_in_art)\?dom_id=list1_21.*class=.unlink.*bullet_delete.png.*<\/div><div id='list1_27'/" 
    133132   
    134133edit_link: 
     
    137136  src: "<r:tagged><r:each><r:show attr='name'/>: <r:show attr='l_status'/> <r:edit/></r:each></r:tagged>" 
    138137  res: "/link_id/" 
    139   'edit/link/en/list_form.erb': "/<input type='hidden' name='link_id' value=\"<%= @node.link_id %>\"/>/" 
    140   'edit/link/en/list.erb': "/\#\{@node.link_id\}/" 
     138  'edit/link/en/list1_form.erb': "/<input type='hidden' name='link_id' value=.<%= @node.link_id %>./>/" 
     139  'edit/link/en/list1.erb': "/\#\{@node.link_id\}/" 
  • trunk/test/helpers/zena_parser/apphelper.yml

    r1081 r1084  
    6767 
    6868cal_class: 
    69   tem: "[<%= cal_class(Date.civil(2008,06,26), Date.civil(2008,06,26)) %>] [<%= cal_class(Date.civil(2008,06,28), Date.civil(2008,06,26)) %>] [<%= cal_class(Date.civil(2008,06,29), Date.civil(2008,06,26)) %>] [<%= cal_class(Date.civil(2008,06,28), Date.civil(2008,06,28)) %>] [<%= cal_class(Date.civil(2008,06,30), Date.civil(2008,06,28)) %>] [<%= cal_class(Date.civil(2008,07,1), Date.civil(2008,06,28)) %>] [<%= cal_class(Date.civil(2008,07,5), Date.civil(2008,06,28)) %>]" 
    70   res: "[ class='ref'] [ class='sat'] [ class='sun'] [ class='sat ref'] [] [ class='other'] [ class='satother']" 
     69  tem: | 
     70    [<%= cal_class(Date.civil(2008,06,26), Date.civil(2008,06,26)) %>] 
     71    [<%= cal_class(Date.civil(2008,06,28), Date.civil(2008,06,26)) %>] 
     72    [<%= cal_class(Date.civil(2008,06,29), Date.civil(2008,06,26)) %>] 
     73    [<%= cal_class(Date.civil(2008,06,28), Date.civil(2008,06,28)) %>] 
     74    [<%= cal_class(Date.civil(2008,05,02), Date.civil(2008,05,28)) %>] 
     75    [<%= cal_class(Date.civil(2008,05,30), Date.civil(2008,06,28)) %>] 
     76    [<%= cal_class(Date.civil(2008,05,31), Date.civil(2008,06,28)) %>] 
     77  res: | 
     78    [ class='ref'] 
     79    [ class='sat'] 
     80    [ class='sun'] 
     81    [ class='sat ref'] 
     82    [] 
     83    [ class='other'] 
     84    [ class='satother'] 
     85   
  • trunk/test/helpers/zena_parser/basic.yml

    r1083 r1084  
    3333cache_part: 
    3434  src: "<r:cache><r:show attr='name'/></r:cache>" 
    35   tem: "<% cache1 = Cache.with(visitor.id, visitor.group_ids, \"NP\", \"en\", \"/cache/part/list\") do capture do %><%= @node.name %><% end; end %><%= cache1 %>" 
     35  tem: "<% cache1 = Cache.with(visitor.id, visitor.group_ids, \"NP\", \"en\", \"/cache/part/list1\") do capture do %><%= @node.name %><% end; end %><%= cache1 %>" 
    3636 
    3737show_title: 
     
    238238link_date: 
    239239  context: 
    240     date: '2008-06-27' 
     240    ref_date: '2008-06-27' 
    241241  src: "<r:link date='current_date'/>" 
    242242  tem: "/:date=>main_date/" 
     
    367367 
    368368calendar: 
    369   src: "<div do='calendar' find='notes'/>" 
    370   res: "/<div id='small_calendar'><table/" 
     369  context: 
     370    ref_date: "2006-03-18" 
     371  src: "<div do='calendar' find='notes in site'/>" 
     372  res: "/<td class='sat ref'><span>18</span><ul><li><a href='/oo/projects/cleanWater/post27.html'>opening</a></li></ul><\/td>/" 
    371373 
    372374calendar_default_else: 
    373375  context: 
    374     date: "2008-01-10" 
    375   src: "<div do='calendar'>--</div>" 
    376   res: "." 
     376    # no notes here 
     377    ref_date: "2008-01-30" 
     378  src: "<div do='calendar'>---</div>" 
     379  res: "/<td class='sun'>27<\/td>/" 
    377380 
    378381flash_messages_both: 
     
    430433    node: 'cleanWater' 
    431434  src: "<ol do='pages'><li do='each' alt_class='blue' do='[name]'/><li do='add'/></ol>" 
    432   res: "/<li id='list.21.22'>status<\/li><li id='list.21.37' class=\"blue\">track/" 
     435  res: "/<li id='list1_22'>status<\/li><li id='list1_37' class=\"blue\">track/" 
    433436 
    434437case_when: 
     
    801804    node: 'opening' 
    802805  src: "<r:form><select name='klass' root_class='Note' selected='Post'/></r:form>" 
    803   res: "/<select id=\"node_klass\" name=\"node\[klass\]\"><option value=\"Note\">Note<\/option>\n<option value=\"Letter\">  Letter<\/option>\n<option value=\"Post\" selected=\"selected\">  Post<\/option><\/select>/" 
     806  res: "/<select name=.node\[klass\].><option value=\"Note\">Note<\/option>\n<option value=\"Letter\">  Letter<\/option>\n<option value=\"Post\" selected=\"selected\">  Post<\/option><\/select>/" 
    804807 
    805808select_nodes: 
     
    839842form_publish: 
    840843  src: "<r:form publish='true'><r:select name='d_foo' values='bar,baz'/></r:form>" 
    841   res: "/div.*name='node\[v_status\]' value=\"50\"\/>.*<\/div>/" 
     844  res: "/div.*name=.node\[v_status\]. value=.50.\/>.*<\/div>/" 
    842845 
    843846checkbox: 
     
    849852input_set_value: 
    850853  src: "<r:input type='hidden' name='icon_id' set_value='[main.id]'/>" 
    851   tem: "<input id='node_icon_id' name='node[icon_id]' type='hidden' value='<%= @node.zip %>'/>" 
    852   res: "<input id='node_icon_id' name='node[icon_id]' type='hidden' value='22'/>" 
     854  tem: "<input name='node[icon_id]' type='hidden' value='<%= @node.zip %>'/>" 
     855  res: "<input name='node[icon_id]' type='hidden' value='22'/>" 
    853856 
    854857input: 
     
    856859    node: 'ant' 
    857860  src: "<r:input name='c_first_name'/>" 
    858   tem: "<input id='node_c_first_name' name='node[c_first_name]' type='text' value='<%= fquote @node.c_zafu_read(\"first_name\") %>'/>" 
    859   res: "<input id='node_c_first_name' name='node[c_first_name]' type='text' value='Solenopsis'/>" 
     861  tem: "<input name='node[c_first_name]' type='text' value='<%= fquote @node.c_zafu_read(\"first_name\") %>'/>" 
     862  res: "<input name='node[c_first_name]' type='text' value='Solenopsis'/>" 
    860863 
    861864input_new: 
     
    870873  <tr do='add'><td><b><r:add_btn/></b></td></tr> 
    871874  </table>" 
    872   res: "/<tr class='btn_add' id='list_22_add'><td><b><a href='#' onclick/" 
     875  res: "/<tr class='btn_add' id='list1_add'><td><b><a href='#' onclick/" 
    873876 
    874877read_no_content: 
  • trunk/test/helpers/zena_parser/complex.yml

    r1078 r1084  
    77    ref_date: 2005-03-01 
    88  src: "<r:emp_form_dates where='custom_a is not null' do='each' join=', '><r:show attr='name'/> (<r:show date='event_at' format='%Y-%m-%d'/>, <r:show date='log_at' format='%Y-%m-%d'/>)</r:emp_form_dates>" 
    9   res: "engine (, ), transmit_information (2002-05-05, 2003-05-05), dangerous_transportations (2004-03-15, 2006-03-15)" 
     9  res: "engine (, ), radio_usage (, ), secure_a_site (, ), winch_usage (, ), transmit_information (2002-05-05, 2003-05-05), fiber_junction (2003-03-03, 2005-03-03), dangerous_transportations (2004-03-15, 2006-03-15), formulate_problems (2006-03-20, 2008-03-20)" 
    1010   
    1111courses_in_the_next_6_months: 
     
    1313  # event_at = last_date 
    1414  # custom_a = repetition interval 
    15   src: "<r:emp_form_dates where='custom_a is not null and (event_at is null or log_at lt REF_DATE + 6 month)' do='each' join=', '><r:show attr='name'/>: <r:show date='log_at' format='%Y-%m-%d'/></r:emp_form_dates>" 
    16   res: "engine: , transmit_information: 2003-05-05
     15  src: "<r:emp_form_dates where='last_date is null or (custom_a is not null and next_date lt REF_DATE + 6 month)' do='each' join=', '><r:show attr='name'/>: <r:show date='log_at' format='%Y-%m-%d'/></r:emp_form_dates>" 
     16  res: "engine: , radio_usage: , secure_a_site: , winch_usage: , transmit_information: 2003-05-05, fiber_junction: 2005-03-03
    1717 
    1818courses_in_the_next_6_months_do_syntax: 
    19   src: "<div do='emp_form_dates where custom_a is not null and (event_at is null or log_at lt REF_DATE + 6 month)' do='each' join=', '><r:show attr='name'/>: <r:show date='log_at' format='%Y-%m-%d'/></div>" 
    20   res: "<div>engine: , transmit_information: 2003-05-05</div>" 
     19  src: "<div do='emp_form_dates where last_date is null or (custom_a is not null and next_date lt REF_DATE + 6 month)' do='each' join=', '><r:show attr='name'/>: <r:show date='log_at' format='%Y-%m-%d'/></div>" 
     20  res: "<div>engine: , radio_usage: , secure_a_site: , winch_usage: , transmit_information: 2003-05-05, fiber_junction: 2005-03-03</div>" 
    2121 
    2222all_formations: 
    2323  src: "<r:formations in='site' do='each' join=', '><r:show attr='name'/>: <r:show date='event_at'/></r:formations>" 
    24   res: "form2005: 2005-03-20, form2006: 2006-03-20, transm2001: 2001-06-15, transm2002: 2002-05-05, transm2003: 2003-03-20, transp2004: 2004-03-15, transp2006: 2006-04-21
     24  res: "fiber2002: 2002-02-02, fiber2003: 2003-03-03, form2005: 2005-03-20, form2006: 2006-03-20, transm2001: 2001-06-15, transm2002: 2002-05-05, transm2003: 2003-03-20, transp2004: 2004-03-15, transp2006: 2006-04-21, vision2003: 2003-04-05
    2525 
    2626all_formations_with_people: 
    2727  src: "<r:formations in='site' do='each' join=', '><r:show attr='name'/>: <r:show date='event_at'/> (<r:formation_for find='all' do='each' join=', ' do='[name]'/>)</r:formations>" 
    28   res: "fiber2003: 2003-03-03 (joe, mike, roger), form2005: 2005-03-20 (roger), form2006: 2006-03-20 (roger), transm2001: 2001-06-15 (roger), transm2002: 2002-05-05 (roger), transm2003: 2003-03-20 (joe), transp2004: 2004-03-15 (roger), transp2006: 2006-04-21 (roger), vision2003: 2003-04-05 (mike)" 
     28  res: "fiber2002: 2002-02-02 (mike), fiber2003: 2003-03-03 (joe, roger), form2005: 2005-03-20 (roger), form2006: 2006-03-20 (roger), transm2001: 2001-06-15 (roger), transm2002: 2002-05-05 (roger), transm2003: 2003-03-20 (joe), transp2004: 2004-03-15 (roger), transp2006: 2006-04-21 (roger), vision2003: 2003-04-05 (mike)" 
    2929 
    3030all_people_related_to_a_course: 
     
    3232    node: transmit_information 
    3333  src: "<r:course_emp_dates do='each' join=', '><r:show attr='name'/> (last:<r:show date='event_at'/>, next:<r:show date='log_at'/>)</r:course_emp_dates>" 
    34   res: "joe (last:, next:), mike (last:, next:), roger (last:2002-05-05, next:2003-05-05)" 
     34  res: "joe (last:2003-03-20, next:2004-03-20), mike (last:, next:), roger (last:2002-05-05, next:2003-05-05)" 
    3535 
    3636all_course_emp_date: 
    37   context: 
    38     ref_date: 2004-06-01 
    39     # next: 
    40     # dangerous_t