5
filename = document.getElementById("save_filename").value;
6
data = editAreaLoader.getValue("editbox");
7
do_action("putfile", filename, {"path":".", "data":data});
8
saved_status.data = "Saved.";
13
saved_status.data = "Not saved.";
16
/** Presents the text editor.
18
function handle_text(path, text, handler_type)
20
/* Create a textarea with the text in it
21
* (The makings of a primitive editor).
25
var files = document.getElementById("filesbody");
26
var div = document.createElement("div");
27
files.appendChild(div);
28
div.setAttribute("class", "padding");
30
/* Set up minimal interface */
31
var p = dom_make_text_elem("p", "Path: ");
32
var pathname = document.createElement("input");
33
pathname.setAttribute("type", "text");
34
pathname.setAttribute("size", "30");
35
pathname.setAttribute("id", "save_filename");
36
pathname.setAttribute("value", path);
37
p.appendChild(pathname);
38
var savebutton = document.createElement("input");
39
savebutton.setAttribute("type", "button");
40
savebutton.setAttribute("value", "Save");
41
savebutton.setAttribute("onclick", "save_file()");
42
p.appendChild(savebutton);
43
var t = document.createTextNode(" ");
45
saved_status = document.createTextNode("Saved.");
46
//p.appendChild(saved_status);
49
/* Print a warning message if this is not actually a text file.
51
if (handler_type != "text")
53
var warn = dom_make_text_elem("p",
54
"Warning: You are editing a binary " +
55
"file, which explains any strange characters you may see. If " +
56
"you save this file, you could corrupt it.");
57
div.appendChild(warn);
59
var txt_elem = dom_make_text_elem("textarea",
61
div.appendChild(txt_elem);
62
txt_elem.setAttribute("id", "editbox");
63
txt_elem.setAttribute("onchange", "edit_text()");
64
/* TODO: Make CSS height: 100% work */
65
txt_elem.setAttribute("rows", "35");
67
/* Load EditArea into the editbox */