clckwrks-plugin-media 0.6.16.8 → 0.6.16.9
raw patch · 4 files changed
+21/−32 lines, 4 filesdep +hsx2hsdep ~clckwrkssetup-changed
Dependencies added: hsx2hs
Dependency ranges changed: clckwrks
Files
- Clckwrks/Media/Page/AllMedia.hs +7/−7
- Clckwrks/Media/Page/Upload.hs +6/−6
- Setup.hs +1/−12
- clckwrks-plugin-media.cabal +7/−7
Clckwrks/Media/Page/AllMedia.hs view
@@ -1,5 +1,4 @@-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -F -pgmFhsx2hs #-}+{-# LANGUAGE QuasiQuotes, OverloadedStrings #-} module Clckwrks.Media.Page.AllMedia where import Control.Applicative ((<$>))@@ -15,21 +14,22 @@ import Happstack.Server (Response, asContentType, notFound, serveFile, toResponse) import HSP.XML (XML, fromStringLit) import HSP.XMLGenerator+import Language.Haskell.HSX.QQ (hsx) allMedia :: MediaM Response allMedia = do mediumIds <- query AllMediumIds- template "all media" <link rel="stylesheet" type="text/css" href=(PluginData (fromString "media") "style.css") /> $ + template "all media" [hsx| <link rel="stylesheet" type="text/css" href=(PluginData (fromString "media") "style.css") /> |] $ mkGallery mediumIds mkGallery :: [MediumId] -> XMLGenT MediaM XML-mkGallery mediumIds =+mkGallery mediumIds = [hsx| <ul id="media-gallery"> <% mapM mkPreview mediumIds %>- </ul>+ </ul> |] mkPreview :: MediumId -> XMLGenT MediaM XML-mkPreview mid =+mkPreview mid = [hsx| <li> <a href=(GetMedium mid)><img src=(Preview mid) /></a>- </li>+ </li> |]
Clckwrks/Media/Page/Upload.hs view
@@ -1,5 +1,4 @@-{-# LANGUAGE TypeFamilies, OverloadedStrings #-}-{-# OPTIONS_GHC -F -pgmFhsx2hs #-}+{-# LANGUAGE TypeFamilies, OverloadedStrings, QuasiQuotes #-} module Clckwrks.Media.Page.Upload where import Control.Applicative ((<$>), (<*))@@ -19,6 +18,7 @@ import Happstack.Server (ContentType, Input, Response, ServerPartT, ok, setResponseCode, toResponse) import HSP.XML (fromStringLit) import HSP.XMLGenerator+import Language.Haskell.HSX.QQ (hsx) import Magic (magicFile) import Text.Reform ((++>), FormError(..)) import Text.Reform.Happstack (reform)@@ -43,11 +43,11 @@ uploadMedium :: MediaURL -> MediaM Response uploadMedium here =- do template "Upload Medium" () $+ do template "Upload Medium" () $ [hsx| <%> <% reform (form here) "ep" saveMedium Nothing uploadForm %> </%>-+ |] where saveMedium :: (String, FilePath, ContentType) -> MediaM Response saveMedium (tempPath, origName, contentType) =@@ -57,11 +57,11 @@ case contentTypeExtension contentType of Nothing -> do setResponseCode 415- template "Unsupported Type" () $+ template "Unsupported Type" () $ [hsx| <%> <h1>Unsupported Type</h1> <p>The file you uploaded appears to have the content type <b><% contentType %></b>. However, at this time the only supported types are <b><% intercalate ", " acceptedTypes %></b>.</p>- </%>+ </%> |] (Just (ext, kind)) -> do -- renameFile would be faster, but may not work if it has to cross physical devices -- in theory, the filename could be the md5sum of the file making it easy to check for corruption
Setup.hs view
@@ -1,13 +1,2 @@-#!/usr/bin/env runghc--module Main where- import Distribution.Simple-import Distribution.Simple.Program--hsx2hsProgram = simpleProgram "hsx2hs"--main :: IO ()-main = defaultMainWithHooks simpleUserHooks {- hookedPrograms = [hsx2hsProgram]- }+main = defaultMain
clckwrks-plugin-media.cabal view
@@ -1,5 +1,5 @@ Name: clckwrks-plugin-media-Version: 0.6.16.8+Version: 0.6.16.9 Synopsis: media plugin for clckwrks Description: support for images and image gallerys. Homepage: http://clckwrks.com/@@ -9,9 +9,9 @@ Maintainer: Jeremy Shaw <jeremy@n-heptane.com> Copyright: 2012 Jeremy Shaw, SeeReason Partners LLC Category: Clckwrks-Build-type: Custom-Cabal-version: >=1.6-Tested-With: GHC == 7.10.2, GHC == 8.0.1, GHC == 8.6.3, GHC == 8.8.1+Build-type: Simple+Cabal-version: >=1.10+Tested-With: GHC == 8.0.1, GHC == 8.6.3, GHC == 8.8.3, GHC == 8.10.1 extra-source-files: README.md Data-Files: data/style.css@@ -22,8 +22,7 @@ location: http://hub.darcs.net/stepcut/clckwrks Library- Build-tools:- hsx2hs+ Default-language: Haskell2010 Exposed-modules: Clckwrks.Media@@ -47,13 +46,14 @@ attoparsec >= 0.10 && < 0.14, blaze-html >= 0.5 && < 0.10, cereal >= 0.4 && < 0.6,- clckwrks >= 0.21 && < 0.26,+ clckwrks >= 0.21 && < 0.27, containers >= 0.4 && < 0.7, directory >= 1.1 && < 1.4, filepath >= 1.2 && < 1.5, gd == 3000.*, happstack-server >= 7.0 && < 7.7, hsp >= 0.9 && < 0.11,+ hsx2hs >= 0.13 && < 0.15, ixset >= 1.0 && < 1.2, magic >= 1.0 && < 1.2, mtl >= 2.0 && < 2.3,