<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"
      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
      lang="en"
      metal:use-macro="context/main_template/macros/master"
      i18n:domain="xmldirector.plonecore">
<body>
    
    
<slot metal:fill-slot="javascript_head_slot">
    <script type="text/javascript" tal:attributes="src string:$portal_url/++resource++xmldirector.plonecore/dropzone/dist/dropzone.js"></script>
    <script type="text/javascript" tal:content="string: UPLOAD_URL = '${context/absolute_url}/upload-file'" />
</slot>


<slot metal:fill-slot="style_slot">
    <link rel="stylesheet" tal:attributes="href string:$portal_url/++resource++xmldirector.plonecore/dropzone/dist/dropzone.css" />
</slot>


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

        <div id="import-path">
            <span class="label" i18n:translate="">Import path</span>:
            <span tal:content="request/subpath | string:''"/>
        </div>

        <div id="zip-form"
            tal:define="UPLOAD_URL string:${context/absolute_url}/upload-file">

          <fieldset id="zip-upload">
              <legend i18n:translate="">ZIP import</legend>
              <div class="help" i18n:translate="">
                  Use this form for uploading a ZIP file. The ZIP file will be unzipped. The ZIP file may contain nested directories.
              </div>
              <form method="POST" tal:attributes="action string:${context/absolute_url}/connector-zip-upload" enctype="multipart/form-data">
                  <div>
                      <label for="zip-file" i18n:translate="">ZIP file</label>
                      <input type="file" name="zipfile" size="60" id="zipfile" />
                      <input type="hidden" name="subpath" tal:attributes="value request/subpath | nothing" />
                  </div>
                  <div style="margin-top: 1em;margin-bottom: 2em">
                      <input class="zip-upload" type="submit" class="context" i18n:attributes="value" value="UPLOAD" />
                  </div>
              </form>
          </fieldset>

          <!-- uploadify -->    
          <fieldset id="uploadify">
              <legend i18n:translate="">Multi/single file upload</legend>
              <div class="help" i18n:translate="">
                  Use this form for uploading a single or multiple files.
              </div>

              <form tal:attributes="action UPLOAD_URL" class="dropzone" id="dropzone" init="foo">
                <div class="dz-message" i18n:translate="">Drop file here or click to upload</div>
                <div class="fallback">
                    <input name="file" type="file" multiple />
                </div>
                <input type="hidden" name="subpath" tal:attributes="value request/subpath | nothing" />
              </form>
              <div id="upload-message"></div>
          </fieldset>
        </div>

        <div style="clear: both"></div>

        <div class="actions">
            <a tal:attributes="href string:${context/absolute_url}/@@view/${request/subpath|nothing}" i18n:translate="">Back to file/directory listing</a>
        </div>

        <script type="text/javascript">
            Dropzone.autoDiscover = false;
            $(document).ready(function() {

                $("#dropzone").dropzone({ 
                    url: UPLOAD_URL,
                    maxFilesize: 50,
                    addRemoveLinks: false,
                    parallelUploads: 1
                });
            });
        </script>
  </metal:content-core>
</metal:main>

</body>
</html>

