Galeria skanów jest domyślnie zamknięta.
[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 type="text/javascript" charset="utf-8">
8         function addEditorButton(label, fn) {
9             $('<button type="button">' + label + '</button>').click(function(event) {
10                 var text = $('#id_text').getSelection().text;
11                 $('#id_text').replaceSelection(fn(text));
12                 event.preventDefault();
13             }).appendTo('#buttons');
14         }
15         
16         $(function() {
17             $('#id_folders').change(function() {
18                 $('#images').load('/images/' + $('#id_folders').val() + '/', function() {
19                     $('#images').data('lastScroll', -1000);
20                 });
21             });
22             
23             function resizePanels() {
24                 $('iframe').width($(window).width() - $('#sidebar').outerWidth());
25                 $('iframe').height($(window).height() - 100);
26                 $('#images-wrap, #toggle-sidebar').height($(window).height() - 100);
27             }
28             
29             $('#toggle-sidebar').toggle(function() {
30                 $('#images-wrap').width(480);
31                 $('#sidebar').width(488);
32                 resizePanels();
33             }, function() {
34                 $('#images-wrap').width(0);
35                 $('#sidebar').width(8);
36                 resizePanels();
37             })
38             
39             $(window).resize(function() {
40                 resizePanels();
41             })
42             
43             var editor = CodeMirror.fromTextArea("id_text", {
44                 parserfile: 'parsexml.js',
45                 path: "/static/js/codemirror/",
46                 stylesheet: "/static/css/xmlcolors.css",
47                 parserConfig: {useHTMLKludges: false}
48             });
49             
50             $('iframe').load(function() {
51                 $($('iframe').contents()).scroll(function() {
52                     var percentScrolled = $('body', this).scrollTop() / $('body', this).height();
53                     $('#images-wrap').scrollTop(percentScrolled * $('#images').height());
54                 });
55                 
56                 setTimeout(function() {resizePanels();}, 10);
57             })
58             
59             addEditorButton('utwór', function(text) { return '<utwor>' + text + '</utwor>'; });
60             addEditorButton('akap', function(text) { return '<akap>' + text + '</akap>'; });
61             
62             $('#images').lazyload('.image-box', {threshold: 600});
63         });
64
65     </script>
66 {% endblock extrahead %}
67
68 {% block breadcrumbs %}<a href="{% url file_list %}">Platforma Redakcyjna</a> ❯ plik {{ hash }}{% endblock breadcrumbs %}
69
70 {% block maincontent %}
71     <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="padding: 3px; margin-left: 10px">{{ image_folders_form.folders }}</div><div style="clear: both; height: 0; width: 0">&nbsp;</div></div>    
72     
73     <form action="." method="post" accept-charset="utf-8">
74         <div id="panels">
75             <div id="sidebar">
76                 <div id="images-wrap">
77                     <div id="images">
78                         <p>Aby zobaczyć obrazki wybierz folder z obrazkami powyżej.</p>
79                     </div>
80                 </div>
81                 <div id="toggle-sidebar"></div>
82             </div>
83             <textarea id="id_text" name="text" width="480px">{{ form.text.field.initial }}</textarea>
84         </div>
85         
86         <div id="status-bar">
87             {{ form.user.errors }} {{ form.commit_message.errors }}
88             <p>Użytkownik: {{ form.user }} Opis zmian: {{ form.commit_message }} <input type="submit" value="Zapisz"/></p>
89         </div>
90     </form>
91 {% endblock maincontent %}