<tal:block define="charset here/portal_properties/site_properties/default_charset|here/portal_properties/default_charset|string:utf-8;
        content_type python:request.RESPONSE.setHeader('Content-Type', 'text/xml;;charset=%s' % charset);"
 replace='structure string:&lt;?xml version="1.0" encoding="${charset}" ?&gt;'>
<?xml version="1.0"?>
</tal:block>
<collection
    xmlns:tal="http://xml.zope.org/namespaces/tal"
    xmlns:metal="http://xml.zope.org/namespaces/metal"
    tal:define="kupu context/kupu_library_tool;upload string:possible"
    >
  <tal:with define="info python:kupu.getSingleObjectInfo(context);
        breadcrumbs python:kupu.getBreadCrumbs(context,template);">
    <metal:macro use-macro="here/kupucollection.xml/macros/commonToAllItems" />
    <breadcrumbs tal:condition="breadcrumbs">
      <crumb tal:repeat="crumb breadcrumbs"
        tal:content="crumb/Title"
        tal:attributes="href crumb/absolute_url"/>
    </breadcrumbs>
  </tal:with>

  <items metal:define-macro="collectionItems">
     <metal:slot define-slot="defineItems">
       <tal:var define="global items python:kupu.getFolderItems(context);" />
     </metal:slot>

    <tal:loop repeat="info items">

      <tal:comment condition="nothing">
        We use the URI as ID here, because all resource need to have a
        site-wide unique id
      </tal:comment>

      <resource tal:attributes="id info/id; class info/class|nothing;"
                tal:condition="not:info/collection">
        <metal:macro define-macro="commonToAllItems">
          <uri metal:define-slot="uri"
               tal:content="info/url">URI</uri>
          <icon metal:define-slot="icon"
                tal:content="info/icon">icon</icon>
          <size metal:define-slot="size"
                tal:condition="info/size"
                tal:content="info/size">size</size>
          <tal:block condition="python:info.get('width') and info.get('height')">
              <width metal:define-slot="width"
                     tal:content="info/width">width</width>
              <height metal:define-slot="height"
                     tal:content="info/height">height</height>
          </tal:block>
          <preview metal:define-slot="preview"
                   tal:condition="info/preview"
                   tal:content="info/preview"></preview>
          <status tal:condition="info/state"
                tal:attributes="class info/class" tal:content="info/state" />
          <label metal:define-slot="label"
                tal:condition="info/label|nothing"
                tal:content="info/label">label</label>
          <title metal:define-slot="title"
                 tal:content="info/title">title</title>
          <description metal:define-slot="description"
                       tal:content="structure info/description">description</description>
          <anchor tal:condition="info/anchor|nothing" />
          <src tal:condition="info/src" tal:content="info/src">Source</src>
          <tal:sizes tal:condition="info/sizes|nothing">
            <sizes>
              <size tal:repeat="size info/sizes">
                <label tal:content="size/label" />
                <uri tal:content="size/uri" />
              </size>
            </sizes>
          </tal:sizes>
        </metal:macro>
      </resource>

      <collection tal:attributes="id info/id; linkable info/linkable|nothing;class info/class|nothing"
                  tal:condition="info/collection">
        <metal:insert use-macro="here/kupucollection.xml/macros/commonToAllItems" />
      </collection>

    </tal:loop>
    <uploadbutton tal:condition="python:exists('upload') and kupu.isUploadSupported(context)">
       <uri tal:content="string:${here/absolute_url}/kupuUploadImage" />
    </uploadbutton>
  </items>

</collection>
