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