]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Wiki/Interpreter/Base.hs
more redirection
[Rakka.git] / Rakka / Wiki / Interpreter / Base.hs
index 6feb92a77c82dcec77157cf3f0bff2929328a06f..6b883c376c270d68a2ecfaa00b112706bb358b66 100644 (file)
@@ -8,7 +8,6 @@ import           Control.Arrow.ListArrow
 import           Data.Map (Map)
 import qualified Data.Map as M
 import           Data.Maybe
-import           Network.URI
 import           Rakka.Page
 import           Rakka.SystemConfig
 import           Rakka.Wiki
@@ -103,31 +102,28 @@ otherLangsInterp
 
 -- <input type="button"
 --        value="Create new page"
---        onclick="Rakka.newPage(\"http://example.org/\")"
+--        onclick="Rakka.newPage()"
 --        class="newButton" />
 newPageInterp :: Interpreter
 newPageInterp 
     = InlineCommandInterpreter {
         iciName      = "newPage"
       , iciInterpret
-          = \ ctx (InlineCommand _ args _) ->
-            do BaseURI baseURI <- getSysConf (ctxSysConf ctx)
-               
-               let label = fromMaybe "Create new page" (lookup "label" args)
-                   uri   = uriToString id baseURI ""
-                   attrs = [ ("type"   , "button")
-                           , ("value"  , label)
-                           , ("onclick", "Rakka.newPage(\"" ++ uri ++ "\")")
-                           , ("class"  , "newButton")
-                           ]
-
-               return (Input attrs)
+          = \ _ (InlineCommand _ args _) ->
+            let label = fromMaybe "Create new page" (lookup "label" args)
+                attrs = [ ("type"   , "button")
+                        , ("value"  , label)
+                        , ("onclick", "Rakka.newPage()")
+                        , ("class"  , "newButton")
+                        ]
+            in
+              return (Input attrs)
       }
 
 
 -- <input type="button"
 --        value="Edit"
---        onclick="Rakka.editPage(\"http://example.org/\", \"Foo\")"
+--        onclick="Rakka.editPage(\"Foo\")"
 --        class="editButton" />
 editPageInterp :: Interpreter
 editPageInterp 
@@ -135,16 +131,13 @@ editPageInterp
         iciName      = "editPage"
       , iciInterpret
           = \ ctx (InlineCommand _ args _) ->
-            do BaseURI baseURI <- getSysConf (ctxSysConf ctx)
-
-               let name  = fromMaybe (ctxPageName ctx) (lookup "page" args)
-                   label = fromMaybe "Edit this page" (lookup "label" args)
-                   uri   = uriToString id baseURI ""
-                   attrs = [ ("type"   , "button")
-                           , ("value"  , label)
-                           , ("onclick", "Rakka.editPage(\"" ++ uri ++ "\", \"" ++ name ++ "\")")
-                           , ("class"  , "editButton")
-                           ]
-
-               return (Input attrs)
+            let name  = fromMaybe (ctxPageName ctx) (lookup "page" args)
+                label = fromMaybe "Edit this page" (lookup "label" args)
+                attrs = [ ("type"   , "button")
+                        , ("value"  , label)
+                        , ("onclick", "Rakka.editPage(\"" ++ name ++ "\")")
+                        , ("class"  , "editButton")
+                        ]
+            in
+              return (Input attrs)
       }