Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/templates/editor.html
blob: afb59824113d2ac24248de1fba922e95b54a977d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:py="http://genshi.edgewall.org/">
<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <title>Editor</title>
  <link rel="stylesheet" href="/www/css/main.css" type="text/css" />
<script src="/www/js/jquery-1.6.2.js" type="text/javascript"></script>
<!-- <script src="js/jquery-plugins/json.js" type="text/javascript"></script>
  <script src="js/jquery-plugins/jquery.hotkeys-0.7.8.js" type="text/javascript"></script>
  <script src="js/jquery-plugins/jquery.intercept.js" type="text/javascript"></script> -->
</head>
<body>
<script src="/www/js/ace/ace-uncompressed.js" type="text/javascript" charset="utf-8"></script>
<script src="/www/js/ace/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
<script py:if="mode" src="/www/js/ace/mode-${mode}.js" type="text/javascript" charset="utf-8"></script>
<pre id="editor">$content</pre>
<div id="editor-sidebar" class="bling">
<div class="file">
    <img src="/www/icons/${icon}" /><br/>
    ${absdir}/<br/>
    <strong>${basename}</strong><br/>
</div>
<hr />
<form action="/save" method="post">
<input type="hidden" name="filename" id="filename" value="$filename" />
<input type="hidden" name="directory" id="directory" value="$directory" />
<input type="hidden" name="content" id="content" value="ñññ" />
<input type="button" class="btn" value="Browse directory" onclick='location.href="/browse?directory=${directory}"' />
<br/>
<input type="submit" class="btn" value="Save file" /><br/>
<input type="button" class="btn" value="Delete file" onclick='location.href="/delete?filename=${filename}"' />
<!-- save a magic cookie for security here TODO -->
<input type="button" class="btn" value="Return to main" onclick='top.location.href="/www/index.html"' />
</form>
</div>
<script>
window.onload = function() {
    var aceEditor = ace.edit("editor");
    aceEditor.setTheme("ace/theme/twilight");
    aceEditor.getSession().setUseSoftTabs(true);
    // we can assume we're on unix
    aceEditor.getSession().setNewLineMode("unix");

    if ("${mode}"!="") {
        var thisMode = require("ace/mode/${mode}").Mode;
        aceEditor.getSession().setMode(new thisMode());
    }

    function dispatch() {
        var c = $('#content');
        c.val(aceEditor.getSession().getValue()); 
    }
    dispatch()

    aceEditor.getSession().on('change', dispatch);  
    $('.bling').slideDown("slow");
};
</script>
</body>
</html>