<div id="folderlisting-main-table"
     i18n:domain="plone">
  <tal:block condition="view/selectall">
    <input type="hidden" name="paths:list"
           tal:repeat="item view/batch/items_not_on_page"
           tal:attributes="value item/path"/>
  </tal:block>

  <!-- <div metal:use-macro="context/document_actions/macros/document_actions">
      Document actions (print, sendto etc)
  </div> -->
  <p class="discreet"
     tal:condition="not: view/batch"
     i18n:translate="description_no_visible_items_add_paste">
     This folder has no visible items. To add content, press the
     add button, or paste content from another location.
  </p>

  <metal:listing define-macro="folder_listing"
                 tal:define="nosortclass view/get_nosort_class">
                             
  <div class="visualClear" id="clear-space-before-navigation"><!-- --></div>

    <table class="listing"
           summary="Content listing"
           i18n:attributes="summary summary_content_listing;">
      <thead>
        <tr tal:condition="not:view/selectcurrentbatch">
          <th colspan="6" class="nosort"
              i18n:translate="label_select_all">
            Select:
            <a tal:attributes="href view/selectscreen_url"
               id="foldercontents-selectall"
               i18n:name="label_link_all"
               i18n:translate="label_all">
              All
            </a>
          </th>
        </tr>
        <tr tal:condition="view/show_select_all_items">
          <th colspan="6" class="nosort"
              i18n:translate="label_all_items_on_page_selected">
            All
            <tal:block replace="view/batch/items_on_page"
                       i18n:name="number" />
            items on this page are selected. 
            <a tal:attributes="href view/selectall_url"
               id="foldercontents-selectall-completebatch"
               i18n:name="link_select_items"
               i18n:translate="label_select_all_items_folder">
              Select all
              <tal:block replace="view/batch/size"
                         i18n:name="number" />
              items in this folder.
            </a>
          </th>
        </tr>
        <tr tal:condition="view/selectall">
          <th colspan="6" class="nosort"
              i18n:translate="label_all_items_in_folder_selected">
            All
            <tal:block replace="view/batch/size"
                       i18n:name="number" />
            items in this folder are selected.
            <a tal:attributes="href view/selectnone_url"
               id="foldercontents-clearselection"
               i18n:name="link_clear_selection"
                i18n:translate="label_clear_selection">
              Clear selection
            </a>
          </th>
        </tr>
        <tr>
          <th class="nosort">&nbsp;</th>
          <th tal:attributes="class nosortclass"
              id="foldercontents-title-column">&nbsp;<tal:title i18n:translate="listingheader_title"
              >Title</tal:title>&nbsp;</th>
          <th tal:attributes="class nosortclass"
              id="foldercontents-size-column">&nbsp;<tal:size i18n:translate="listingheader_size"
              >Size</tal:size>&nbsp;</th>
          <th tal:attributes="class nosortclass"
              id="foldercontents-modified-column">&nbsp;<tal:modified i18n:translate="listingheader_modified"
              >Modified</tal:modified>&nbsp;</th>
          <th tal:attributes="class nosortclass"
              id="foldercontents-status-column">&nbsp;<tal:state i18n:translate="listingheader_status"
              >State</tal:state>&nbsp;</th>
          <th class="nosort" 
              id="foldercontents-order-column"
              tal:condition="view/show_sort_column">
            &nbsp;<tal:order i18n:translate="listingheader_order">Order</tal:order>&nbsp;</th>
        </tr>
      </thead>

      <metal:block tal:condition="view/batch">
      <tbody tal:define="portal view/portal">
          <tal:items tal:repeat="item view/batch">
              <tr tal:attributes="class item/table_row_class;
                                  id string:folder-contents-item-${item/id};" >

                 <tal:comment replace="nothing">
                      * We have to check if the browserDefault stuff is really necessary
                      * Create title_or_id metadata in the catalog (why not just use item.Title or item.getId? (alecm))
                 </tal:comment>

                 <td class="notDraggable">
                     <input type="checkbox"
                            class="noborder"
                            name="paths:list" id="#"
                            value="#"
                            tal:attributes="value   item/path;
                                            id      string:cb_${item/id};
                                            checked item/checked;
                                            alt     string:Select ${item/title_or_id};
                                            title   string:Select ${item/title_or_id}" />
                <input type="hidden" name="selected_obj_paths:list" value="#"
                       tal:attributes="value item/relative_url" />

              </td>
              <td>
                  <span tal:attributes="class item/type_class">
                      <img tal:replace="structure item/icon" />
                      <a href="#" tal:attributes="href  item/view_url;
                                                title string: ${item/obj_type}: ${item/description};
                                                class item/state_class;">
                          <strong tal:omit-tag="not: item/is_browser_default">
                          <label tal:content="item/title_or_id"
                                 tal:attributes="for string:cb_${item/id}">
                            Item Title
                          </label>
                          </strong>
                      </a>
                  </span>

                  <span class="state-expired"
                        tal:condition="item/is_expired"
                        i18n:translate="time_expired">expired</span>
              </td>

              <td>
                <span tal:condition="not: item/size"> &nbsp; </span>
                <span tal:condition="item/size"
                      tal:content="item/size"
                      tal:attributes="class item/state_class"> size </span>
              </td>
              <td tal:content="item/modified"
                  tal:attributes="class item/state_class">
                  08/19/2001 03:01 AM
              </td>
              <td>
                  <span i18n:translate=""
                        tal:condition="item/state_title"
                        tal:content="item/state_title"
                        tal:attributes="class item/state_class" />
                  <span tal:condition="not: item/state_title">&nbsp;</span>
              </td>
              <td tal:condition="view/show_sort_column">
                <a href=""
                   title="Move item up"
                   i18n:attributes="title title_move_item_up;"
                   tal:attributes="href string:${context/absolute_url}/folder_position?position=up&amp;id=${item/quoted_id}">
                  &#9650;
                </a>
                &nbsp;
                <a href=""
                   title="Move item down"
                   i18n:attributes="title title_move_item_down;"
                   tal:attributes="href string:${context/absolute_url}/folder_position?position=down&amp;id=${item/quoted_id}">
                  &#9660;
                </a>
              </td>
             </tr>
          </tal:items>
      </tbody>
    </metal:block>
    </table>
  </metal:listing>
</div>
