7612a71ebd56cc23abb785076c3705f0b1a43753
[redakcja.git] / project / templates / explorer / file_list.html
1 {% extends "base.html" %}
2
3 {% block extrahead %}
4 <link rel="stylesheet" href="{{ STATIC_URL }}css/filelist.css" type="text/css" />
5     <script src="{{STATIC_URL}}js/jquery.json.js" type="text/javascript" charset="utf-8"></script>
6     <script src="{{STATIC_URL}}js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
7 <script type="text/javascript" charset="utf-8">
8 $(function() {
9         function search(event) {
10         var expr = new RegExp($('#file-list-filter').val(), 'i');
11         
12         $('#file-list p').hide().filter(function(index) {
13             return expr.test($(this).attr('title'));
14         }).show();
15     
16         event.preventDefault();
17     }
18         
19     $('#file-list-find-button').click(search);
20         $('#file-list-filter').bind('keyup change DOMAttrModified', search);
21                 
22     var defaultOptions = {
23         panels: [
24         {
25             name: 'htmleditor',
26             ratio: 0.5
27         },
28
29         {
30             name: 'gallery',
31             ratio: 0.5
32         }
33         ],
34         recentFiles: [],
35         lastUpdate: 0
36     };
37     
38         var options = null;
39     try {
40         var cookie = $.cookie('options');
41         options = $.secureEvalJSON(cookie);
42         if (!options) {
43             options = defaultOptions;
44         }
45     } catch (e) {    
46         options = defaultOptions;
47     };
48         
49         $.each(options.recentFiles, function(index) {
50                 var fileId = options.recentFiles[index].fileId;
51                 $('#recent-file-list ul').append('<li><a href="{% url editor_base %}'+fileId+'">' + fileId + '</a></li>');
52         });
53 });
54 </script>
55 {% endblock extrahead %}
56
57 {% block maincontent %}
58 <div id="main-page-widgets">
59
60 <div class="file-list-widget">
61     <form action="#" method="GET">
62     <p><input name="filter" id="file-list-filter" type="text" size="60" />
63         <input type="submit" value="Znajdź" id="file-list-find-button"/>
64         <input type="reset" value="Wyczyść" id="file-list-reset-button"/>
65     </p>
66     </form>
67     <div id="file-list">
68     {% load explorer_tags %}
69     {% for file in files %}
70     <p title="{{file|bookname}}"><a href="{% url editor_view file %}">{{ file|bookname }}</a></p>
71     {% endfor %}
72     </div>
73 </div>
74
75 <div id="recent-file-list">
76         <h2>Ostatnio oglądane pliki:</h2>
77         <ul>
78         </ul>
79 </div>
80
81 {% if perms.explorer.can_add_files %}
82 <div class="upload-file-widget">
83 <h2>Dodaj nowy utwór</h2>
84 <form action="{% url file_upload %}" method="POST" enctype="multipart/form-data">
85     <p><label>{{bookform.file.label}}: {{ bookform.file }}</label></p>
86     <p><label>{{bookform.bookname.label}}: {{bookform.bookname}}</label></p>
87     <p><label>{{bookform.autoxml}} {{bookform.autoxml.label}}</label></p>
88     <p><button type="submit">Dodaj książkę</button></p>
89 </form>
90 </div>
91 {% endif %}
92
93 </div>
94 {% endblock maincontent %}