<%= render_query_totals(@query) %>
<div class="autoscroll">
<table class="list projects odd-even <%= @query.css_classes %>">
<thead>
  <tr>
    <% @query.inline_columns.each do |column| %>
      <%= column_header(@query, column) %>
    <% end %>
  </tr>
</thead>
<tbody>
<% grouped_project_list(entries, @query) do |entry, level, group_name, group_count, group_totals| -%>
  <% if group_name %>
    <% reset_cycle %>
    <tr class="group open">
      <td colspan="<%= @query.inline_columns.size %>">
        <span class="expander icon icon-expanded" onclick="toggleRowGroup(this);">&nbsp;</span>
        <span class="name"><%= group_name %></span>
        <% if group_count %>
        <span class="count"><%= group_count %></span>
        <% end %>
        <span class="totals"><%= group_totals %></span>
        <%= link_to_function("#{l(:button_collapse_all)}/#{l(:button_expand_all)}",
                             "toggleAllRowGroups(this)", :class => 'toggle-all') %>
      </td>
    </tr>
  <% end %>
  <tr id="project-<%= entry.id %>" class="<%= cycle('odd', 'even') %> <%= entry.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
    <% @query.inline_columns.each do |column| %>
    <%= content_tag('td', column_content(column, entry), :class => column.css_classes) %>
    <% end %>
  </tr>
<% end -%>
</tbody>
</table>
</div>
<span class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></span>

<div id="csv-export-options" style="display:none;">
  <h3 class="title"><%= l(:label_export_options, :export_format => 'CSV') %></h3>
  <%= form_tag(projects_path(:format => 'csv'), :method => :get, :id => 'csv-export-form') do %>
  <%= query_as_hidden_field_tags(@query) %>
  <p>
    <label><%= radio_button_tag 'c[]', '', true %> <%= l(:description_selected_columns) %></label><br />
    <label><%= radio_button_tag 'c[]', 'all_inline' %> <%= l(:description_all_columns) %></label>
  </p>
  <%= export_csv_encoding_select_tag %>
  <p class="buttons">
    <%= submit_tag l(:button_export), :name => nil, :onclick => "hideModal(this);", :data => { :disable_with => false } %>
    <%= link_to_function l(:button_cancel), "hideModal(this);" %>
  </p>
  <% end %>
</div>
