summaryrefslogtreecommitdiff
path: root/src/www
diff options
context:
space:
mode:
Diffstat (limited to 'src/www')
-rw-r--r--src/www/gfse/cloud2.js26
-rw-r--r--src/www/gfse/editor.css4
-rw-r--r--src/www/gfse/editor.js11
-rw-r--r--src/www/gfse/index.html6
4 files changed, 38 insertions, 9 deletions
diff --git a/src/www/gfse/cloud2.js b/src/www/gfse/cloud2.js
index 7b3d90f0f..c9e59a21d 100644
--- a/src/www/gfse/cloud2.js
+++ b/src/www/gfse/cloud2.js
@@ -26,7 +26,7 @@ function remove_cloud_grammar(g) {
}
// Upload the grammar to the server and check it for errors
-function upload(g) {
+function old_upload(g) {
function upload2(dir) {
var form=node("form",{method:"post",action:"/cloud"},
[hidden("dir",dir),hidden("command","make"),
@@ -42,12 +42,34 @@ function upload(g) {
form.submit();
form.parentNode.removeChild(form);
}
-
+
function upload3(message) { if(message) alert(message); }
with_dir(upload2)
}
+// Upload the grammar to the server and check it for errors
+function upload(g) {
+ function upload2(dir) {
+ var pre="dir="+encodeURIComponent(dir)
+ var form= {command:"make"}
+ form[encodeURIComponent(g.basename+".gf")]=show_abstract(g)
+ for(var i in g.concretes) {
+ var cname=g.basename+g.concretes[i].langcode+".gf";
+ form[encodeURIComponent(cname)]=show_concrete(g)(g.concretes[i]);
+ }
+ ajax_http_post("/cloud",pre+encodeArgs(form),upload3)
+ }
+
+ function upload3(message) {
+ var dst=element("compiler_output")
+ if(dst) dst.innerHTML=message;
+ else alert(message);
+ }
+
+ with_dir(upload2)
+}
+
// Upload the grammar to store it in the cloud
function upload_json(cont) {
function upload2(dir,unique_id) {
diff --git a/src/www/gfse/editor.css b/src/www/gfse/editor.css
index 302548371..74d15345e 100644
--- a/src/www/gfse/editor.css
+++ b/src/www/gfse/editor.css
@@ -89,4 +89,6 @@ ul.languages { -moz-column-width: 20em; }
li { margin-top: 0.5ex; margin-bottom: 0.5ex; }
-#sharing h1, #sharing .footer { display: none; } \ No newline at end of file
+#sharing h1, #sharing .footer { display: none; }
+
+div.compiler_output .back_to_editor { display: none; }
diff --git a/src/www/gfse/editor.js b/src/www/gfse/editor.js
index d2c41f30f..885a6871c 100644
--- a/src/www/gfse/editor.js
+++ b/src/www/gfse/editor.js
@@ -120,7 +120,12 @@ function open_grammar(i) {
edit_grammar(g);
}
-function close_grammar(g) { save_grammar(g); draw_grammar_list(); }
+function close_grammar(g) {
+ var o=element("compiler_output");
+ if(o) o.innerHTML="";
+ save_grammar(g);
+ draw_grammar_list();
+}
function reload_grammar(g) { save_grammar(g); edit_grammar(g); }
function save_grammar(g) {
@@ -143,8 +148,8 @@ function draw_grammar(g) {
function draw_namebar(g,files) {
return div_class("namebar",
[table([tr([td(draw_name(g)),
- td_right([draw_plainbutton(g,files),
- upload_button(g),
+ td_right([upload_button(g),
+ draw_plainbutton(g,files),
draw_closebutton(g)])])])])
}
diff --git a/src/www/gfse/index.html b/src/www/gfse/index.html
index 52c96a34f..a3b9559e9 100644
--- a/src/www/gfse/index.html
+++ b/src/www/gfse/index.html
@@ -16,14 +16,14 @@
<body class=hover>
<h2>GF online editor for simple multilingual grammars</h2>
-<div id=editor>
-</div>
+<div id=editor></div>
<small class="hidden">
<span class=more>+</span>=Add an item,
<span class=delete>×</span>=Delete item,
<span class=edit>%</span>=Edit item.
</small>
<small class="ifhover">Hover over items for hints and editing options.</small>
+<div id=compiler_output class=compiler_output></div>
<noscript>
This page does not work without JavaScript.
@@ -32,7 +32,7 @@ This page does not work without JavaScript.
<hr>
<div class=modtime><small>
HTML
-<!-- hhmts start --> Last modified: Mon Oct 10 19:24:05 CEST 2011 <!-- hhmts end -->
+<!-- hhmts start --> Last modified: Fri Feb 10 17:47:16 CET 2012 <!-- hhmts end -->
</small></div>
<a href="about.html">About</a>
<pre id=debug></pre>