summaryrefslogtreecommitdiff
path: root/src/www/gfse/cloud2.js
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2012-02-10 17:26:02 +0000
committerhallgren <hallgren@chalmers.se>2012-02-10 17:26:02 +0000
commit73827b9bf7ed18ed9437b1214e9a01f81e227923 (patch)
tree635923f0fb1ef4ad710e0c610a4102474bfa4b99 /src/www/gfse/cloud2.js
parent6b29296060a0fcbc32ddb27fe56325bccff144e0 (diff)
gfse: stay on the same page when compiling grammars
The link to the minibar (or compiler errors) are now shown below the grammar on the same page. If you go to the minibar, you only have to press the back button once to get back to the editor. Also some output formatting changes in GFServer.hs.
Diffstat (limited to 'src/www/gfse/cloud2.js')
-rw-r--r--src/www/gfse/cloud2.js26
1 files changed, 24 insertions, 2 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) {