diff options
| author | hallgren <hallgren@chalmers.se> | 2014-06-20 10:34:51 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2014-06-20 10:34:51 +0000 |
| commit | ef20e8cbac41246ce557053e0fac67aede1a9735 (patch) | |
| tree | 0e45265c704dbbec1ea3320589dfd94222aa6597 /src | |
| parent | 2601dac64111a6ec9866ea4ee71cac2df49a9d02 (diff) | |
PGF Service, command=grammar: include the last modified time of the grammar in the output
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/PGFService.hs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/server/PGFService.hs b/src/server/PGFService.hs index 4024c0496..b25e8a86d 100644 --- a/src/server/PGFService.hs +++ b/src/server/PGFService.hs @@ -12,9 +12,10 @@ import URLEncoding #if C_RUNTIME import qualified PGF2 as C ---import Data.Time.Clock(UTCTime,getCurrentTime,diffUTCTime) +--import Data.Time.Clock(getCurrentTime,diffUTCTime) #endif +import Data.Time.Clock(UTCTime) import Data.Time.Format(formatTime) import System.Locale(defaultTimeLocale,rfc822DateFormat) import Network.CGI @@ -115,6 +116,7 @@ cpgfMain command (t,(pgf,pc)) = grammar = showJSON $ makeObj ["name".=C.abstractName pgf, + "lastmodified".=show t, "startcat".=C.startCat pgf, "languages".=languages] where @@ -311,7 +313,7 @@ pgfMain command (t,pgf) = "translate" -> o =<< doTranslate pgf # input % cat % to % limit %trie "translategroup" -> o =<< doTranslateGroup pgf # input % cat % to % limit "lookupmorpho" -> o =<< doLookupMorpho pgf # from1 % textInput - "grammar" -> o =<< doGrammar pgf # requestAcceptLanguage + "grammar" -> o =<< doGrammar t pgf # requestAcceptLanguage "abstrtree" -> outputGraphviz =<< abstrTree pgf # graphvizOptions % tree "alignment" -> outputGraphviz =<< alignment pgf # tree % to "parsetree" -> outputGraphviz =<< parseTree pgf # from1 % graphvizOptions % tree @@ -620,9 +622,10 @@ doGenerate pgf mcat mdepth mlimit (tos,unlex) = limit = take (fromMaybe 1 mlimit) depth = fromMaybe 4 mdepth -doGrammar :: PGF -> Maybe (Accept Language) -> JSValue -doGrammar pgf macc = showJSON $ makeObj +doGrammar :: UTCTime -> PGF -> Maybe (Accept Language) -> JSValue +doGrammar t pgf macc = showJSON $ makeObj ["name".=PGF.abstractName pgf, + "lastmodified".=show t, "userLanguage".=selectLanguage pgf macc, "startcat".=PGF.showType [] (PGF.startCat pgf), "categories".=categories, |
