X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Rakka%2FSystemConfig.hs;h=ecf608df873232944880dbc0b518d6644cbebf46;hb=ed0a2de09fc91fbd25c3ee82a722ef88793f2a8f;hp=eb526fbc45939a6863d2fc139fd2a45876f8138c;hpb=9ff4eb243ae1545c62a5ab2eaf8dcb2f7c40b20d;p=Rakka.git diff --git a/Rakka/SystemConfig.hs b/Rakka/SystemConfig.hs index eb526fb..ecf608d 100644 --- a/Rakka/SystemConfig.hs +++ b/Rakka/SystemConfig.hs @@ -12,6 +12,7 @@ module Rakka.SystemConfig , DefaultPage(..) , StyleSheet(..) , Languages(..) + , GlobalLock(..) , serializeStringPairs , deserializeStringPairs @@ -134,7 +135,7 @@ deserializeStringPairs :: String -> Maybe [(String, String)] deserializeStringPairs = sequence . map deserializePair' . lines where deserializePair' :: String -> Maybe (String, String) - deserializePair' s = case break (/= ' ') s of + deserializePair' s = case break (== ' ') s of (a, ' ':b) -> Just (a, b) _ -> Nothing @@ -209,3 +210,15 @@ instance SysConfValue Languages where , ("pt", "Português") , ("sv", "Svenska" ) ] + + +newtype GlobalLock = GlobalLock Bool deriving (Show, Typeable) +instance SysConfValue GlobalLock where + confPath _ = "globalLock" + serialize (GlobalLock isLocked) + | isLocked = "*" + | otherwise = "" + deserialize "*" = Just (GlobalLock True) + deserialize "" = Just (GlobalLock False) + deserialize _ = Nothing + defaultValue _ = GlobalLock False