<tal:block define="global isBdrDeployment python: here.ReportekEngine.getDeploymentType() == 'BDR'"/>
<span tal:replace="structure here/standard_html_header" />
<tal:block condition="python:context.canViewContent()">
  <div tal:replace="structure python:context.envelope_tabs(tab='overview')"/>

  <div id="operations">
    <ul>
      <tal:block condition="python:context.canAddFeedback()">
        <li><a href="manage_addFeedbackForm" title="Post feedback for this release"
               i18n:attributes="title"
               i18n:translate="">Add feedback</a></li>
      </tal:block>
        <li><a href="envelope_zip" rel="nofollow" title="Download zipped envelope with available files"
               i18n:attributes="title"
               i18n:translate="">Zip&nbsp;Envelope</a></li>
      <div tal:replace="structure python:context.activity_operations(REQUEST=context.REQUEST)"/>
    </ul>
  </div>

  <h1 tal:content="python:context.title_or_id()"></h1>

  <div class="metadata">
    <table border="0" cellspacing="2" cellpadding="2">
    <tbody>
    <tr>
      <th i18n:translate="">Description</th>
      <td tal:content="python:context.descr"></td>
    </tr>
    <tr>
      <th i18n:translate="">Obligations</th>
      <td>
        <tal:block condition="python:context.dataflow_uris" repeat="uri python:context.dataflow_uris">
          <tal:block define="df python:context.dataflow_lookup(uri)">
            <a tal:attributes="href python:df['details_url']"
               tal:content="python:df['TITLE']"></a>
            <tal:block condition="python:df.get('terminated', '0') == '1'">
             <em i18n:translate="">Terminated</em>
            </tal:block>
            <br/>
          </tal:block>
        </tal:block>
        <tal:block condition="python:not context.dataflow_uris">
          <span style="color:maroon;font-weight:bold"
                title="The obligation tag makes it possible for the requesters to find the delivery"
                i18n:attributes="title"
                i18n:translate="">
            Notice: this envelope has no obligation tag</span>
        </tal:block>
      </td>
    </tr>
    <tr>
      <th i18n:translate="">Period</th>
      <td tal:condition="python:context.endyear == ''"
          tal:content="python:'%s - %s' %(context.year, context.partofyear)">
      </td>
      <td tal:condition="not:python:context.endyear == ''"
          tal:content="python:'%s to %s' %(context.year, context.endyear)">
      </td>
    </tr>
    <tr>
      <th i18n:translate="">Coverage</th>
      <td tal:content="context/getCountryName">
        <span tal:condition="context/locality" tal:replace="python:': %s' %context.locality"></span>
      </td>
    </tr>
    <tal:block condition="context/released">
    <tr>
      <th i18n:translate="">Reported</th>
      <td tal:content="context/reportingdate"></td>
    </tr>
    </tal:block>
    <tr>
      <th i18n:translate="">Status</th>
      <td>
        <tal:block condition="not:python:context.status in ('running', 'active')">
          <span i18n:translate="">
            Envelope is <span i18n:name="status" tal:replace="context/status"></span>
          </span>
          <br/>
        </tal:block>
        <tal:block define="activeW python:context.getListOfWorkitems('active');
                           inactiveW python:context.getListOfWorkitems('inactive')">
          <metal:block use-macro="here/macros/tasks_in_progress">
          </metal:block>
        </tal:block>
      </td>
    </tr>
    <tr tal:condition="isBdrDeployment">
        <th i18n:translate="">Acceptability status</th>
        <td tal:define="statuses
                           python:{
                                True: 'Data delivery is acceptable',
                                False: 'Data delivery is not acceptable',
                                None: 'n/a'}"
            tal:content="python:statuses[context.is_acceptable()]">
        </td>
    </tr>
    </tbody>
    </table>
    </div>

  <div class="note-msg" tal:condition="context/uns_is_set">
    <strong i18n:translate="">Note</strong>
    <p i18n:translate="">
      If you want to stay updated about events in this envelope 
      <span i18n:name="subscribe">
        <a href="ReportekEngine/subscriptions_html" i18n:translate="">
          Subscribe to receive notifications
        </a>
      </span> for this country and the current dataflow(s).
    </p>
  </div>
  <form id="objectItems" method="post"
        tal:define="action_url python:context.absolute_url()"
        tal:attributes="action string:${action_url}/">

  <div tal:replace="structure context/documents_section"/>

  <tal:block condition="not:context/released">
  <strong i18n:translate="">Remember to release the envelope when you have uploaded all files</strong>
  </tal:block>

  <div tal:replace="structure context/feedback_section"/>

  </form>
</tal:block>
<tal:block condition="not:python:context.canViewContent()">
  <h1 i18n:translate="">Not available</h1>
  <p i18n:translate="">This envelope is not yet available for public view.
  Work is still in progress.</p>
</tal:block>
<span tal:replace="structure here/standard_html_footer" />
