diff --git a/src/editor/simple/cloud.js b/src/editor/simple/cloud.js index 44b7d8157..f19b6ee37 100644 --- a/src/editor/simple/cloud.js +++ b/src/editor/simple/cloud.js @@ -123,8 +123,10 @@ function download_json() { get_list(download_files); } -function link_directories(olddir,newdir,cont) { - ajax_http_get("upload.cgi?rmdir="+olddir+"&newdir="+newdir,cont) +function link_directories(newdir,cont) { + with_dir(function(olddir) { + ajax_http_get("upload.cgi?rmdir="+olddir+"&newdir="+newdir,cont) + }) } /* -------------------------------------------------------------------------- */ diff --git a/src/editor/simple/cloud2.js b/src/editor/simple/cloud2.js index c57922438..38210a6f6 100644 --- a/src/editor/simple/cloud2.js +++ b/src/editor/simple/cloud2.js @@ -10,14 +10,19 @@ function with_dir(cont) { } function remove_cloud_grammar(g) { - alert("remove_cloud_grammar(g) not implemented yet!!!") + var dir=local.get("dir") + if(dir && g.unique_name) { + var path=g.unique_name+".json" + gfcloud("rm",{file:path},debug); + } } // Upload the grammar to the server and check it for errors function upload(g) { function upload2(dir) { - var form=node("form",{method:"post",action:"/upload"}, - [hidden("dir",dir),hidden(g.basename,show_abstract(g))]) + var form=node("form",{method:"post",action:"/cloud"}, + [hidden("dir",dir),hidden("command","upload"), + hidden(g.basename,show_abstract(g))]) var files = [g.basename+".gf"] for(var i in g.concretes) { var cname=g.basename+g.concretes[i].langcode; @@ -39,19 +44,105 @@ function upload(g) { // Upload the grammar to store it in the cloud function upload_json(cont) { - alert("upload_json() not implemented yet!!!") + function upload3(resptext,status) { + local.put("json_uploaded",Date.now()); + //debug("Upload complete") + if(cont) cont(); + else { + var sharing=element("sharing"); + if(sharing) sharing.innerHTML=resptext; + } + } + function upload2(dir) { + var prefix=dir.substr(10)+"-" // skip "/tmp/gfse." + //debug("New form data"); + //var form=new FormData(); // !!! Doesn't work on Android 2.2! + var form={dir:dir}; + //debug("Preparing form data"); + for(var i=0;i