diff options
| author | hallgren <hallgren@chalmers.se> | 2011-10-21 15:43:57 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2011-10-21 15:43:57 +0000 |
| commit | 442dc95071dc9a9a71a93b190c5b67493b286695 (patch) | |
| tree | 90f2c3996f4933fb690299a167b357a695af5acd /src/www/gfse/cloud2.js | |
| parent | ed451653bd9fa4d835cb263c06d0ecb9133b9935 (diff) | |
Work on example-based grammar writing
+ Preparations to support more target languages. Tested with Swedish.
+ Don't enable example-based editing if there is less that two concrete
languages in the grammar.
+ Don't show the "By example" button until the required lincat has been defined.
+ Remember the chosen language for examples.
Diffstat (limited to 'src/www/gfse/cloud2.js')
| -rw-r--r-- | src/www/gfse/cloud2.js | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/www/gfse/cloud2.js b/src/www/gfse/cloud2.js index e32749dc1..71de22387 100644 --- a/src/www/gfse/cloud2.js +++ b/src/www/gfse/cloud2.js @@ -42,16 +42,28 @@ function upload(g) { // Upload the grammar to store it in the cloud function upload_json(cont) { - 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) { + function upload3(resptext,status) { + local.put("json_uploaded",Date.now()); + //debug("Upload complete") + if(cont) cont(); + else { + var sharing=element("sharing"); + if(sharing) { + if(status==204) { + var a=empty("a"); + a.href="share.html#"+dir.substr(5) // skip "/tmp/" + a.innerHTML=a.href; + sharing.innerHTML=""; + sharing.appendChild(text("Use the following link for shared access to your grammars from multiple devices: ")) + sharing.appendChild(a) + } + else + sharing.innerHTML=resptext; + } + } + } + var prefix=dir.substr(10)+"-" // skip "/tmp/gfse." //debug("New form data"); //var form=new FormData(); // !!! Doesn't work on Android 2.2! |
