diff --git a/src/compiler/GFServer.hs b/src/compiler/GFServer.hs index 149cb1864..685b9d76f 100644 --- a/src/compiler/GFServer.hs +++ b/src/compiler/GFServer.hs @@ -224,18 +224,17 @@ handle state0 cache execute1 resultpage cwd dir cmd (ecode,stdout,stderr) files = unlines $ "": - "
":escape cmd:"":escape (rel stderr):escape (rel stdout): - "": + wrap "h1" "Uploaded": + concatMap (pre.escape) [cmd,rel stderr,rel stdout]: (if ecode==ExitSuccess - then "
"):number source:"":[] + (wrap "h4" name++"
"):number source:"":[] number = unlines . zipWith num [1..] . lines num n s = pad (show n)++" "++escape s pad s = replicate (5-length s) ' '++s + pre = wrap "pre" + wrap t s = tag t++s++endtag t + tag t = "<"++t++">" + endtag t = tag ('/':t) + rel = unlines . map relative . lines -- remove absolute file paths from error messages: 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 @@