summaryrefslogtreecommitdiff
path: root/examples/filebrowser/templates/directory.pt
blob: 212e77e6a9d589de5370ea922a092db2b4d38f5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<html metal:use-macro="here/standard_template.pt/macros/page">

<metal:extra fill-slot="extra_head">

<script type="text/javascript">
var field_index = 1;
function add_upload() {
  var form = $('upload-form');
  var upload = document.createElement('INPUT');
  upload.setAttribute('type', 'file');
  field_index++;
  upload.setAttribute('name', 'file_' + field_index);
  form.appendChild(document.createElement('BR'));
  form.appendChild(document.createTextNode('Upload: '));
  form.appendChild(upload);
}

function change_upload_button() {
  var button = $('upload-button');
  button.disabled = 'true';
  button.value = 'Uploading...';
}
</script>

</metal:extra>

<metal:body fill-slot="body">

<div class="header">
 <div class="controls">
  <span tal:replace="structure python:
  servlet.pastebutton(servlet.path)"/>
 </div>
 <tal:if condition="python: not servlet.fragment and options.get('parent')">
 Parent: <a tal:attributes="href options/parent/url"
          tal:content="options/parent/name"/><br>
 </tal:if>
 Files: <tt tal:content="python: len(options['files'])"/>
 | <a href="#" onclick="toggle('mkdir', {link: this}); return false" 
    shownhtml="&amp;lt;&amp;lt;&amp;lt;"
    style="text-decoration: none; color: #226">make dir...</a>
   <span id="mkdir" style="display: none">
    <form tal:attributes="action servlet/pathurl/action=mkdir"
     method="POST" class="inline">
     <input type="text" name="dirname" style="width: 5em">
     <input type="submit" value="make">
    </form>
   </span>

</div>

<tal:for repeat="f options/files">
 <div tal:attributes="class python: 'item %s' % test(repeat['f'].odd(),
                      'odd', 'even')"
      tal:define="toggle f/url/toggle">
  <div class="controls">
   <span tal:condition="python: f['path'].isdir"
    tal:replace="structure python: servlet.pastebutton(f['path'])"/>
   <span tal:replace="structure python: servlet.copybutton(f['path'], 'cut')"/>
   <span tal:replace="structure python: servlet.copybutton(f['path'],
    'copy')"/>
  </div>
  <span tal:replace="structure python: toggle.link(
    servlet.icons('1downarrow.png', alt='display'),
    shownhtml=servlet.icons('1uparrow.png', alt='hide'))"/>
   <a tal:attributes="href f/url"
    tal:content="f/name" />
   <blockquote tal:attributes="id toggle/id" 
    style="display: none" class="subdisplay">...</blockquote>
 </div>
</tal:for>

<p tal:condition="not: options/files">
There are no files in this directory
</p>

<form tal:attributes="action options/upload_url" method="POST"
 enctype="multipart/form-data" id="upload-form"
 onsubmit="change_upload_button(); return true;">
Upload: <input type="file" name="file_1">
<input type="submit" value="Upload" id="upload-button">
<button onclick="add_upload(); return false;">More...</button>
</form>

</metal:body>
</html>