~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/media/browser/editor.js

  • Committer: mattgiuca
  • Date: 2008-02-05 01:41:15 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:409
Moved www/conf and www/common to a new directory lib. This separates the "web"
part of IVLE from what is becoming less web oriented (at least from Apache's
standpoint).
Modified setup.py to install this lib directory correctly and write conf in
the right place. Also adds the lib directory to ivle.pth.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
{
5
5
    filename = document.getElementById("save_filename").value;
6
6
    data = editAreaLoader.getValue("editbox");
7
 
    do_action("putfile", filename, {"path":".", "data":data});
 
7
    /* Do NOT refresh the page contents (causes problems for editarea and is
 
8
     * unnecessary). */
 
9
    do_action("putfile", filename, {"path":".", "data":data}, null, true);
8
10
    saved_status.data = "Saved.";
9
11
}
10
12
 
13
15
    saved_status.data = "Not saved.";
14
16
}
15
17
 
16
 
/** Presents the text editor.
 
18
/** Presents the "editor heading" (the part with the save box)
 
19
 * inserting it into a given element at the front.
17
20
 */
18
 
function handle_text(path, text, handler_type)
 
21
function present_editorhead(elem, path, handler_type)
19
22
{
20
 
    /* Create a textarea with the text in it
21
 
     * (The makings of a primitive editor).
22
 
     */
23
 
 
24
 
    setmode(true);
25
 
    var files = document.getElementById("filesbody");
26
23
    var div = document.createElement("div");
27
 
    files.appendChild(div);
28
 
    div.setAttribute("class", "padding");
 
24
    /* Insert as the head element */
 
25
    elem.insertBefore(div, elem.firstChild)
 
26
    div.setAttribute("id", "editorhead");
29
27
 
30
28
    /* Set up minimal interface */
31
29
    var p = dom_make_text_elem("p", "Path: ");
56
54
            "you save this file, you could corrupt it.");
57
55
        div.appendChild(warn);
58
56
    }
 
57
}
 
58
 
 
59
/** Presents the text editor.
 
60
 */
 
61
function handle_text(path, text, handler_type)
 
62
{
 
63
    /* Create a textarea with the text in it
 
64
     * (The makings of a primitive editor).
 
65
     */
 
66
    setmode(true);
 
67
 
 
68
    var files = document.getElementById("filesbody");
 
69
    /* Put our UI at the top */
 
70
    present_editorhead(files, path, handler_type);
 
71
 
 
72
    var div = document.createElement("div");
 
73
    files.appendChild(div);
59
74
    var txt_elem = dom_make_text_elem("textarea",
60
75
        text.toString())
61
76
    div.appendChild(txt_elem);
68
83
    editAreaLoader.init({
69
84
        id : "editbox",
70
85
        syntax: "python",
71
 
        start_highlight: true
 
86
        start_highlight: true,
 
87
        allow_toggle: false,
 
88
        allow_resize: false,
 
89
        replace_tab_by_spaces: 4,
72
90
    });
73
91
}
74
92