<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      lang="en"
      metal:use-macro="context/main_template/macros/master">
<body>

  <metal:content-core fill-slot="content-core">
    <metal:content-core define-macro="content-core">

      <p tal:condition="not: context/@@folderListing">
        No Todo Items added yet, add some!
      </p>

      <table class="listing" summary="Todo list" id="todo-summary"
          tal:condition="context/@@folderListing"
          tal:define="toLocalizedTime nocall:context/@@plone/toLocalizedTime;">

        <thead>
          <tr>
            <th class="nosort">&nbsp;</th>
            <th>Title</th>
            <th>Status</th>
            <th>Last modified</th>
          </tr>
        </thead>

        <tbody>
          <tr tal:repeat="item context/@@folderListing"
              tal:attributes="id  item/id">
            <td tal:attributes="class  string:todo-visual-status ${item/review_state}">
              <a href="#"
                 tal:attributes="href string:${item/getURL}/content_status_modify?workflow_action=complete"
                 tal:condition="python: item.review_state() == 'open'">
                <img tal:attributes="src string:${context/@@plone_portal_state/portal_url }/++resource++tutorial.todoapp/open.png" />
              </a>
              <a href="#"
                 tal:attributes="href string:${item/getURL}/content_status_modify?workflow_action=reopen"
                 tal:condition="python: item.review_state() == 'completed'">
                <img tal:attributes="src string:${context/@@plone_portal_state/portal_url}/++resource++tutorial.todoapp/completed.png" />
              </a>
            </td>
            <td class="todo-title">
              <a tal:attributes="href item/getURL" tal:content="item/Title">
                Get milk!
              </a>
            </td>
            <td tal:content="item/review_state"
                class="todo-state"
                >Jane Smith</td>
            <td class="todo-modified"
               tal:content="python: toLocalizedTime(item.ModificationDate(), 
                            long_format=1)">2012/08/17 13:37</td>
          </tr>
        </tbody>

      </table>

      </metal:content-core>
    </metal:content-core>

</body>
</html>

