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