Dodano wyszukiwarke na stronie glownej. Refs #75.
[redakcja.git] / project / templates / explorer / panels / xmleditor.html
1 {% load toolbar_tags %}
2
3 <div class="iframe-container" style="position: absolute; top: 40px; left:0px; right:0px; bottom: 0px;">
4         <textarea name="text">{{ text }}</textarea>
5 </div>
6
7 {% toolbar %}
8
9 <script type="text/javascript" charset="utf-8">
10
11 panel_hooks = {
12         load: function () {
13                 var self = this;
14                 var panel = self.contentDiv;
15
16         var textareaId = 'xmleditor-' + Math.ceil(Math.random() * 1000000000);
17         $('textarea', panel).attr('id', textareaId);
18
19         var texteditor = CodeMirror.fromTextArea(textareaId, {
20             parserfile: 'parsexml.js',
21             path: "{{STATIC_URL}}js/codemirror/",
22             stylesheet: "{{STATIC_URL}}css/xmlcolors.css",
23             parserConfig: {useHTMLKludges: false},
24             onChange: function() {
25                 self.fireEvent('contentChanged');
26             },
27             initCallback: function(editor) {
28                 // Editor is loaded
29                 // Buttons are connected
30                 // register callbacks for actions
31                 texteditor.grabKeys(
32                     $.fbind(self, self.hotkeyPressed),
33                     $.fbind(self, self.isHotkey) );
34                 
35             }
36         })
37
38         $(texteditor.frame).css({width: '100%', height: '100%'});    
39         this.texteditor = texteditor;
40     },
41
42         unload: function() { 
43                 this.texteditor = null;
44         },
45
46
47         //refresh: function() { }, // no support for refresh
48
49         saveInfo: function(saveInfo) {
50                 var myInfo = {
51                         url: "{% url file_xml fpath %}", 
52                         postData: {
53                                 content: this.texteditor.getCode()
54                         } 
55                 };
56                 $.extend(saveInfo, myInfo);
57         },
58
59         toolbarResized: function() {
60             $('.iframe-container', self.contentDiv).css('top',
61                     $('.toolbar', self.contentDiv).outerHeight() );
62         }
63 };
64
65 </script>