summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/PGFService.hs12
-rw-r--r--src/www/minibar/pgf_offline.js2
2 files changed, 7 insertions, 7 deletions
diff --git a/src/server/PGFService.hs b/src/server/PGFService.hs
index ee83394da..71c4f37d3 100644
--- a/src/server/PGFService.hs
+++ b/src/server/PGFService.hs
@@ -48,15 +48,15 @@ cgiMain cache = handleErrors . handleCGIErrors $
cgiMain' :: Cache PGF -> FilePath -> CGI CGIResult
cgiMain' cache path =
- do pgf <- liftIO $ readCache cache path
- command <- liftM (maybe "grammar" (urlDecodeUnicode . UTF8.decodeString))
+ do command <- liftM (maybe "grammar" (urlDecodeUnicode . UTF8.decodeString))
(getInput "command")
- pgfMain path pgf command
+ case command of
+ "download" -> outputBinary =<< liftIO (BS.readFile path)
+ _ -> pgfMain command =<< liftIO (readCache cache path)
-pgfMain :: FilePath -> PGF -> String -> CGI CGIResult
-pgfMain path pgf command =
+pgfMain :: String -> PGF -> CGI CGIResult
+pgfMain command pgf =
case command of
- "download" -> outputBinary =<< liftIO (BS.readFile path)
"parse" -> outputJSONP =<< doParse pgf `fmap` getText `ap` getCat `ap` getFrom `ap` getLimit
"complete" -> outputJSONP =<< doComplete pgf `fmap` getText `ap` getCat `ap` getFrom `ap` getLimit
"linearize" -> outputJSONP =<< doLinearize pgf `fmap` getTree `ap` getTo
diff --git a/src/www/minibar/pgf_offline.js b/src/www/minibar/pgf_offline.js
index e5a3933a5..622ede42a 100644
--- a/src/www/minibar/pgf_offline.js
+++ b/src/www/minibar/pgf_offline.js
@@ -29,7 +29,7 @@ function pgf_offline(options) {
self.current_grammar_url=new_grammar_url;
if(cont) cont();
}
- ajax_http_get_binary(new_grammar_url,update_pgf);
+ ajax_http_get_binary(new_grammar_url+"?command=download",update_pgf);
},
get_grammarlist: function(cont,err) {
if(this.grammar_list) cont(this.grammar_list)