]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Resource/PageEntity.hs
.searchResult .date
[Rakka.git] / Rakka / Resource / PageEntity.hs
index d71b53ad75661c18561f6785be30f96d26834881..e354004728c746caa043200d2c1ef9b336e39ec4 100644 (file)
@@ -55,19 +55,20 @@ fallbackPageEntity env path
 
 handleGet :: Environment -> PageName -> Resource ()
 handleGet env name
-    = runIdempotentA $ proc ()
-    -> do pageM <- getPageA (envStorage env) -< (name, Nothing)
-          case pageM of
-            Nothing
-                -> do items <- getDirContentsA (envStorage env) -< (name, Nothing)
-                      case items of
-                        [] -> handlePageNotFound   env -< name
-                        _  -> handleGetPageListing env -< (name, items)
-            Just page
-                -> if isEntity page then
-                       handleGetEntity env -< page
-                   else
-                       handleRedirect env -< page
+    = do BaseURI baseURI <- getSysConf (envSysConf env)
+         runIdempotentA baseURI $ proc ()
+             -> do pageM <- getPageA (envStorage env) -< (name, Nothing)
+                   case pageM of
+                     Nothing
+                         -> do items <- getDirContentsA (envStorage env) -< (name, Nothing)
+                               case items of
+                                 [] -> handlePageNotFound   env -< name
+                                 _  -> handleGetPageListing env -< (name, items)
+                     Just page
+                         -> if isEntity page then
+                                handleGetEntity env -< page
+                            else
+                                handleRedirect env -< page
 
 
 {-
@@ -103,19 +104,9 @@ handleGetEntity :: (ArrowXml a, ArrowChoice a, ArrowIO a) => Environment -> a Pa
 handleGetEntity env
     = proc page
     -> do tree <- xmlizePage -< page
-          returnA -< do -- text/x-rakka の場合は、内容が動的に生成され
-                        -- てゐる可能性があるので、ETag も
-                        -- Last-Modified も返す事が出來ない。
-                        case entityType page of
-                          MIMEType "text" "x-rakka" _
-                              -> return ()
-                          _   -> case entityRevision page of
-                                   0   -> foundTimeStamp (entityLastMod page) -- 0 はデフォルトページ
-                                   rev -> foundEntity (strongETag $ show rev) (entityLastMod page)
-
-                        outputXmlPage tree [ (MIMEType "application" "xhtml+xml" [], entityToXHTML env)
-                                           , (MIMEType "application" "rss+xml"   [], entityToRSS   env)
-                                           ]
+          returnA -< outputXmlPage tree [ (MIMEType "application" "xhtml+xml" [], entityToXHTML env)
+                                        , (MIMEType "application" "rss+xml"   [], entityToRSS   env)
+                                        ]
 
 
 entityToXHTML :: (ArrowXml a, ArrowChoice a, ArrowIO a) => Environment -> a XmlTree XmlTree
@@ -144,7 +135,7 @@ entityToXHTML env
                  += sattr "xmlns" "http://www.w3.org/1999/xhtml"
                  += ( getXPathTreesInDoc "/page/@lang"
                       `guards`
-                      qattr (QN "xml" "lang" "")
+                      qattr (mkQName "xml" "lang" "")
                                 ( getXPathTreesInDoc "/page/@lang/text()" )
                     )
                  += ( eelem "head"
@@ -560,7 +551,7 @@ findFeeds sto
          addAttrCond cond "rakka:isFeed STREQ yes"
          setOrder    cond "@uri STRA"
          result <- searchPages sto cond
-         return (map fst result)
+         return (map hpPageName $ srPages result)
 
 
 mkFeedURIStr :: URI -> PageName -> String