Merge branch 'master' of git@stigma:platforma
[redakcja.git] / project / templates / explorer / file_xml.html
1 {% extends "base.html" %}
2
3 {% block extrahead %}
4     <script src="/static/js/jquery.fieldselection.js" type="text/javascript" charset="utf-8"></script>
5     <script src="/static/js/jquery.lazyload.js" type="text/javascript" charset="utf-8"></script>
6     <script src="/static/js/codemirror/codemirror.js" type="text/javascript" charset="utf-8"></script>
7     <script src="/static/js/jquery.autoscroll.js" type="text/javascript" charset="utf-8"></script>
8     <script type="text/javascript" charset="utf-8">
9         function addEditorButton(label, fn) {
10             $('<button type="button">' + label + '</button>').click(function(event) {
11                 var text = $('#id_text').getSelection().text;
12                 $('#id_text').replaceSelection(fn(text));
13                 event.preventDefault();
14             }).appendTo('#buttons');
15         }
16         
17         $(function() {
18             $('#id_folders').change(function() {
19                 $('#images').load('/images/' + $('#id_folders').val() + '/', function() {
20                     $('#images').data('lastScroll', -1000);
21                 });
22             });
23             
24             function resizePanels() {
25                 $('iframe').width($(window).width() - $('#sidebar').outerWidth());
26                 $('iframe').height($(window).height() - 100);
27                 $('#images-wrap, #toggle-sidebar').height($(window).height() - 100);
28             }
29             
30             $('#toggle-sidebar').toggle(function() {
31                 $('#images-wrap').width(480);
32                 $('#sidebar').width(488);
33                 resizePanels();
34             }, function() {
35                 $('#images-wrap').width(0);
36                 $('#sidebar').width(8);
37                 resizePanels();
38             })
39             
40             $(window).resize(function() {
41                 resizePanels();
42             })
43             
44             var editor = CodeMirror.fromTextArea("id_text", {
45                 parserfile: 'parsexml.js',
46                 path: "/static/js/codemirror/",
47                 stylesheet: "/static/css/xmlcolors.css",
48                 parserConfig: {useHTMLKludges: false}
49             });
50             
51             $('iframe').load(function() {
52                 $('#images').autoscroll('iframe');
53                 $('.toggleAutoscroll').toggle(function() {
54                     $(this).html('Synchronizuj przewijanie');
55                     $('#images').disableAutoscroll();
56                 }, function() {
57                     $(this).html('Nie synchronizuj przewijania');
58                     $('#images').enableAutoscroll();
59                 })
60                 setTimeout(function() {resizePanels();}, 10);
61             })
62             
63             addEditorButton('utwór', function(text) { return '<utwor>' + text + '</utwor>'; });
64             addEditorButton('akap', function(text) { return '<akap>' + text + '</akap>'; });
65             
66             $('#images-wrap').lazyload('.image-box', {threshold: 640 * 10, scrollTreshold: 640 * 5});
67         });
68
69     </script>
70 {% endblock extrahead %}
71
72 {% block breadcrumbs %}<a href="{% url file_list %}">Platforma Redakcyjna</a> ❯ plik {{ hash }}{% endblock breadcrumbs %}
73
74 {% block maincontent %}
75     <div id="tabs"><a href="{% url file_xml hash %}" class="active">Źródło</a><a href="{% url file_html hash %}">HTML</a><div style="clear: both; height: 0; width: 0">&nbsp;</div></div>    
76     
77     <form action="." method="post" accept-charset="utf-8">
78         <div id="panels">
79             <div id="sidebar">
80                 <div id="images-wrap">
81                     <div id="images">
82                         <p>Aby zobaczyć obrazki wybierz folder poniżej:</p>
83                         <p>{{ image_folders_form.folders }}</p>
84                     </div>
85                 </div>
86                 <div id="toggle-sidebar"></div>
87             </div>
88             <textarea id="id_text" name="text" width="480px">{{ form.text.field.initial }}</textarea>
89         </div>
90         
91         <div id="status-bar">
92             {{ form.user.errors }} {{ form.commit_message.errors }}
93             <p>
94                 Użytkownik: {{ form.user }}
95                 Opis zmian: {{ form.commit_message }}
96                 <input type="submit" value="Zapisz"/>
97                 <a href="#" class="toggleAutoscroll" style="float: right">Nie synchronizuj przewijania</a>
98             </p>
99         </div>
100     </form>
101 {% endblock maincontent %}