MFlow  Create and maintain dynamic Web applications as easy and fast as console applications
Thou shall not write request handlers
 This release: 11/06/2014.  agocorona@gmail.com (@agocorona) <>< . issues & bugs .  Mflow Source code,     source code of this site




Using Amazon Web Services with TCache and the Rich Text editor


The code of this example is identical to any one for persistence in files that you can find here except the procedure  amazonSDBpersist that set the default persistence in Amazon simpleDB. It also shows how to edit HTML online with htmlEdit primitive, that creates a rich text editor out of a text input form. In this case, it is configured with bold and italic controls.

Here is the permanent link for the running example (This page)

http://mflowdemo.herokuapp.com/noscript/database

It also shows how to edit HTML with htmlEdit. It is a widget modifier that convert an input box or a  text box into a rich text editor 


Running example

(in the light red box):

list of all texts

How long have you lived here? seroquel price street It was former Prime Minister Ibrahim Boubacar Keita’s race to lose after winning nearly 40 percent of the first-round vote and receiving endorsements from almost all the other candidates. He faced former Finance Minister Soumaila Cisse, and results are expected by Friday.


I've got a full-time job cena viagra u beogradu Gregory Floyd, president of Teamsters Local 237, which represents 8,000 NYCHA workers who do some of these repairs, blamed the delay on Rhea, who implemented a computerized repair request system that Floyd said has slowed down response times considerably.


How would you like the money? fluoxetine hcl capsules side effects "Some of the likelihood of a September taper continues tostrengthen and you've also seen a lot of stable news coming outof the European zone. That may provide that window ofopportunity for the Fed to start in September," said SeanMurphy, a Treasuries trader at Societe Generale in New York.


I'd like to speak to someone about a mortgage best buy viagra generika online ThyssenKrupp tried to allay investors' concerns over itsfinancial strength, saying that even if banks cancelled thecredit line, which it said was unlikely, it would still haveenough liquidity to cover debt maturities.


Get a job genotropin pen 5 ndc "Today's order is really going to put some sunlight into the corners of the MCSO that have been such a problem in terms of people's civil rights. It's a great day," said Cecillia Wang, an American Civil Liberties Union lawyer who is representing the plaintiffs.


i'm fine good work filagra samples An unnamed member of Hodgson’s squad took umbrage at a joke he recited in an attempt to highlight the importance of new England star Andros Townsend to the team and which included the expression “feed the monkey”. The quip appeared to fall flat, something Hodgson quickly seemed to acknowledge by reassuring Townsend he had not intended to say anything inappropriate.


Photography prozac nation full movie watch online The suit attacks the investigative tactics MLB used in its year-long probe of the Biogenesis clinic and Rodriguez's alleged involvement in procuring performance-enhancing drugs from Bosch over at least a three-year period. Bosch is believed to have introduced evidence of email, text messages, with Rodriguez, detailing their transactions, as well as evidence that Bosch administered PEDs to Rodriguez.


enter a new text

exit to the home page

or press the back button or enter the URL any other page in the web site


Source code:

{-# LANGUAGE DeriveDataTypeable, RecordWildCards
           , OverloadedStrings, StandaloneDeriving
           , ScopedTypeVariables, CPP #-}
module Database where

import Data.Typeable
import Data.TCache.IndexQuery
import Data.TCache.DefaultPersistence
import Data.TCache.AWS
import Data.Monoid
import qualified Data.Text as T
import Data.String
import Data.ByteString.Lazy.Char8 hiding (index)


-- #define ALONE -- to execute it alone, uncomment this
#ifdef ALONE
import MFlow.Wai.Blaze.Html.All
main= do
  syncWrite  $ Asyncronous 120 defaultCheck  1000
  index idnumber
  runNavigation "" $ transientNav grid
#else
import MFlow.Wai.Blaze.Html.All hiding(select, page)
import Menu
#endif



-- to run it alone,  remove Menu.hs and uncomment this:

--askm= ask
--
--main= do
--  syncWrite  $ Asyncronous 120 defaultCheck  1000
--  index idnumber
--  runNavigation "" $ step database

data  MyData= MyData{idnumber :: Int, textdata :: T.Text} deriving (Typeable, Read, Show)  -- that is enough for file persistence
instance Indexable MyData where
   key=  show . idnumber    -- the key of the register


domain= "mflowdemo"

instance  Serializable MyData where
  serialize=  pack . show
  deserialize=  read . unpack
  setPersist =  const . Just $ amazonS3Persist domain -- False
 
data Options= NewText | Exit deriving (Show, Typeable)


     
database= do
     liftIO $ index idnumber
     database'


database'= do
     all <- allTexts

     r <- page $ listtexts all

     case r of
         NewText -> do
              text <- page $   p "Insert the text"
                           ++> htmlEdit ["bold","italic"] ""  -- rich text editor with bold and italic buttons
                                        (getMultilineText "" <! [("rows","3"),("cols","80")]) <++ br
                           <** submitButton "enter"

              addtext all text  -- store the name in the cache (later will be written to disk automatically)
              database' 

         Exit -> return ()
     where
     menu= wlink NewText   << p "enter a new text" <|>
           wlink Exit      << p "exit to the home page"

     listtexts all  =  do
           h3 "list of all texts"
           ++> mconcat[p $ preEscapedToHtml t >> hr | t <- all]
           ++> menu
           <++ b "or press the back button or enter the  URL any other page in the web site"

     addtext all text= liftIO . atomically . newDBRef $ MyData (Prelude.length all) text
     allTexts= liftIO . atomically . select textdata $ idnumber .>=. (0 :: Int)


comments powered by Disqus