mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-23 09:52:55 -06:00
Fixes for minibar offline
Tested it in Firefox 18 (which has the new Ionmonkey JavaScript engine). Still get stack overflows.
This commit is contained in:
@@ -48,15 +48,15 @@ cgiMain cache = handleErrors . handleCGIErrors $
|
|||||||
|
|
||||||
cgiMain' :: Cache PGF -> FilePath -> CGI CGIResult
|
cgiMain' :: Cache PGF -> FilePath -> CGI CGIResult
|
||||||
cgiMain' cache path =
|
cgiMain' cache path =
|
||||||
do pgf <- liftIO $ readCache cache path
|
do command <- liftM (maybe "grammar" (urlDecodeUnicode . UTF8.decodeString))
|
||||||
command <- liftM (maybe "grammar" (urlDecodeUnicode . UTF8.decodeString))
|
|
||||||
(getInput "command")
|
(getInput "command")
|
||||||
pgfMain path pgf command
|
|
||||||
|
|
||||||
pgfMain :: FilePath -> PGF -> String -> CGI CGIResult
|
|
||||||
pgfMain path pgf command =
|
|
||||||
case command of
|
case command of
|
||||||
"download" -> outputBinary =<< liftIO (BS.readFile path)
|
"download" -> outputBinary =<< liftIO (BS.readFile path)
|
||||||
|
_ -> pgfMain command =<< liftIO (readCache cache path)
|
||||||
|
|
||||||
|
pgfMain :: String -> PGF -> CGI CGIResult
|
||||||
|
pgfMain command pgf =
|
||||||
|
case command of
|
||||||
"parse" -> outputJSONP =<< doParse pgf `fmap` getText `ap` getCat `ap` getFrom `ap` getLimit
|
"parse" -> outputJSONP =<< doParse pgf `fmap` getText `ap` getCat `ap` getFrom `ap` getLimit
|
||||||
"complete" -> outputJSONP =<< doComplete 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
|
"linearize" -> outputJSONP =<< doLinearize pgf `fmap` getTree `ap` getTo
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ function pgf_offline(options) {
|
|||||||
self.current_grammar_url=new_grammar_url;
|
self.current_grammar_url=new_grammar_url;
|
||||||
if(cont) cont();
|
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) {
|
get_grammarlist: function(cont,err) {
|
||||||
if(this.grammar_list) cont(this.grammar_list)
|
if(this.grammar_list) cont(this.grammar_list)
|
||||||
|
|||||||
Reference in New Issue
Block a user