Commit cf037080 authored by Rinus Plasmeijer's avatar Rinus Plasmeijer
Browse files

TextArea added which can be used in submit mode

parent 82065d47
...@@ -30,7 +30,9 @@ import htmlFormData ...@@ -30,7 +30,9 @@ import htmlFormData
| UpdS String // new piece of text | UpdS String // new piece of text
encodeTriplet :: !Triplet -> String // encoding of triplets encodeTriplet :: !Triplet -> String // encoding of triplets
encodeString :: !String -> String // encoding of encodeString :: !String -> String // encoding of string
urlEncode :: !String -> String
urlDecode :: !String -> *String
// Form submission handling // Form submission handling
......
...@@ -413,4 +413,5 @@ where ...@@ -413,4 +413,5 @@ where
hexToDigit i hexToDigit i
| i<=toInt '9' = i - toInt '0' | i<=toInt '9' = i - toInt '0'
| otherwise = i - toInt 'A' - 10 | otherwise = i - toInt 'A' - 10
urlDecode` ['+':xs] = [' ':urlDecode` xs]
urlDecode` [x:xs] = [x:urlDecode` xs] urlDecode` [x:xs] = [x:urlDecode` xs]
...@@ -67,13 +67,13 @@ editorRefPaper :: !(InIDataId RefPaper) !*HSt -> (Form Paper,!*HSt) ...@@ -67,13 +67,13 @@ editorRefPaper :: !(InIDataId RefPaper) !*HSt -> (Form Paper,!*HSt)
editorRefPaper (init,formid) hst editorRefPaper (init,formid) hst
# (RefPaper refpaper) = formid.ival # (RefPaper refpaper) = formid.ival
# (Ref2 name) = refpaper # (Ref2 name) = refpaper
= universalRefEditor storageOption (init,reuseFormId formid refpaper) (invariantPaper name) hst = universalRefEditor storageOption (init,reuseFormId formid refpaper <@ Submit) (invariantPaper name) hst
editorRefReport :: !(InIDataId RefReport) !*HSt -> (Form (Maybe Report),!*HSt) editorRefReport :: !(InIDataId RefReport) !*HSt -> (Form (Maybe Report),!*HSt)
editorRefReport (init,formid) hst editorRefReport (init,formid) hst
# (RefReport refreport) = formid.ival # (RefReport refreport) = formid.ival
# (Ref2 name) = refreport # (Ref2 name) = refreport
= universalRefEditor storageOption (init,reuseFormId formid refreport) (invariant name) hst = universalRefEditor storageOption (init,reuseFormId formid refreport <@ Submit) (invariant name) hst
where where
invariant name Nothing = Ok invariant name Nothing = Ok
invariant name (Just report) = invariantReport name report invariant name (Just report) = invariantReport name report
......
...@@ -69,8 +69,8 @@ import loginAdmin, htmlFormlib ...@@ -69,8 +69,8 @@ import loginAdmin, htmlFormlib
:: Familiarity = Expert :: Familiarity = Expert
| Knowledgeable | Knowledgeable
| Low | Low
:: CommCommittee:== String // TextArea :: CommCommittee:== TextArea
:: CommAuthors :== String // TextArea :: CommAuthors :== TextArea
// Information maintained by the Conference Manager *or* a Referee *or* an Author // Information maintained by the Conference Manager *or* a Referee *or* an Author
...@@ -94,7 +94,7 @@ import loginAdmin, htmlFormlib ...@@ -94,7 +94,7 @@ import loginAdmin, htmlFormlib
:: Paper = { title :: String :: Paper = { title :: String
, first_author :: Person , first_author :: Person
, co_authors :: Co_authors , co_authors :: Co_authors
, abstract :: String , abstract :: TextArea
, pdf :: String , pdf :: String
} }
:: Co_authors = Co_authors [Person] :: Co_authors = Co_authors [Person]
......
...@@ -214,16 +214,18 @@ invariantPersons id persons ...@@ -214,16 +214,18 @@ invariantPersons id persons
invariantPaper :: String Paper -> Judgement invariantPaper :: String Paper -> Judgement
invariantPaper id {title,first_author,co_authors = Co_authors authors,abstract,pdf} invariantPaper id {title,first_author,co_authors = Co_authors authors,abstract,pdf}
| title == "" = Just (id,"title of paper not specified!") | title == "" = Just (id,"title of paper not specified!")
| abstract == "" = Just (id,"no abstract of paper specified!") | tabstract == "" = Just (id,"no abstract of paper specified!")
| pdf == "" = Just (id,"no pdf given!") | pdf == "" = Just (id,"no pdf given!")
# judgementFirst_author = invariantPerson (id +++ " first author") first_author # judgementFirst_author = invariantPerson (id +++ " first author") first_author
# judgementCo_authors = foldl (+) Ok (map (invariantPerson (id +++ " co_authors")) authors) # judgementCo_authors = foldl (+) Ok (map (invariantPerson (id +++ " co_authors")) authors)
= judgementFirst_author + judgementCo_authors = judgementFirst_author + judgementCo_authors
where
(TextArea _ _ tabstract) = abstract
invariantReport :: String Report -> Judgement invariantReport :: String Report -> Judgement
invariantReport id {commCommittee,commAuthors} invariantReport id {commCommittee=(TextArea _ _ commcommittee),commAuthors=(TextArea _ _ commauthors)}
| commAuthors == "" = Just (id,"You have to make some remarks to the authors") | commauthors == "" = Just (id,"You have to make some remarks to the authors")
| commCommittee == "" = Just (id,"You have to make some remarks to the committee") | commcommittee == "" = Just (id,"You have to make some remarks to the committee")
= Ok = Ok
invariantConfAccounts :: String ConfAccounts -> Judgement invariantConfAccounts :: String ConfAccounts -> Judgement
......
...@@ -14,35 +14,18 @@ derive gParse Record ...@@ -14,35 +14,18 @@ derive gParse Record
derive gPrint Record derive gPrint Record
derive gerda Record derive gerda Record
//Start world = doHtmlSubServer (4,0,1,"tree") MyPage5 world //Start world = doHtmlSubServer (4,1,1,"tree") MyPage5 world
Start world = doHtmlServer MyPage5 world Start world = doHtmlServer MyPage4 world
MyPage5 hst :: Record = {name :: String, address :: TextArea, zipcode :: Int}
# (n1,hst) = mkEditForm (Init,nDFormId "test1" [0]) hst
# (n2,hst) = mkEditForm (Init,pDFormId "test2" [0]) hst
# (n3,hst) = mkEditForm (Set, pDFormId "test2" n1.value) hst
= mkHtml "Balanced Tree"
[ H1 [] "Balanced Tree"
, BodyTag n1.form
, Br
, toHtml n1.value, Br
, toHtml n2.value, Br
, toHtml n3.value, Br
] hst
:: Record = {name :: String, address :: String, zipcode :: Int}
myrecord :: [Record] myrecord :: TextArea
myrecord = createDefault myrecord = createDefault
myfun file
= if (sfend2 file file) (fwritec 'a' file) (fwritec 'b' file)
where
sfend2 n m = sfend n
MyPage4 hst MyPage4 hst
//# (myrecord,hst) = mkEditForm (Init,nFormId "bla" myrecord) hst # (myrecord,hst) = mkEditForm (Init,nFormId "bla" myrecord <@ Submit) hst
# (myrecord,hst) = vertlistFormButs 5 True (Init,nFormId "bla" myrecord) hst //# (myrecord,hst) = vertlistFormButs 5 True (Init,nFormId "bla" myrecord <@ Submit) hst
= mkHtml "Example" = mkHtml "Example"
[ H1 [] "" [ H1 [] ""
, BodyTag myrecord.form , BodyTag myrecord.form
......
...@@ -49,6 +49,7 @@ instance toString HtmlDate, HtmlTime ...@@ -49,6 +49,7 @@ instance toString HtmlDate, HtmlTime
| TR Int Real // Input box of size Size for Reals | TR Int Real // Input box of size Size for Reals
| TS Int String // Input box of size Size for Strings | TS Int String // Input box of size Size for Strings
:: TextArea = TextArea Int Int String // Input Area Box, row col initial string :: TextArea = TextArea Int Int String // Input Area Box, row col initial string
// Only works in Submit mode due to Html restrictions!
:: PasswordBox = PasswordBox String :: PasswordBox = PasswordBox String
// special's // special's
......
...@@ -3,7 +3,7 @@ implementation module htmlButtons ...@@ -3,7 +3,7 @@ implementation module htmlButtons
import StdFunc, StdList, StdString import StdFunc, StdList, StdString
import htmlFormlib, htmlHandler, htmlStylelib, htmlTrivial import htmlFormlib, htmlHandler, htmlStylelib, htmlTrivial
derive gUpd (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode/*, Button, CheckBox*/, RadioButton /*, PullDownMenu, TextInput */, TextArea/*, PasswordBox*/ derive gUpd (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode/*, Button, CheckBox*/, RadioButton /*, PullDownMenu, TextInput , TextArea, PasswordBox*/
derive gPrint (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, PasswordBox derive gPrint (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, PasswordBox
derive gParse (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, PasswordBox derive gParse (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, PasswordBox
derive gerda (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, PasswordBox derive gerda (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, PasswordBox
...@@ -236,24 +236,27 @@ gForm{|TextArea|} (init,formid) hst ...@@ -236,24 +236,27 @@ gForm{|TextArea|} (init,formid) hst
# (cntr,hst) = CntrHSt hst # (cntr,hst) = CntrHSt hst
= ( { changed = False = ( { changed = False
, value = formid.ival , value = formid.ival
, form = [Form [Frm_Method Post, `Frm_Events (callClean OnSubmit Edit "")] , form = [myTable [ [ Textarea [ Txa_Name (encodeTriplet (formid.id,cntr,UpdS string))
[mkSTable [ [ Textarea [Txa_Name "message", Txa_Rows row, Txa_Cols col ] "" ] , Txa_Rows (if (row == 0) 10 row)
, [ mkSTable [[ Input [Inp_Type Inp_Submit, Inp_Name (encodeTriplet (formid.id,cntr+2,UpdS string)), Inp_Value (SV "Set"),`Inp_Events (callClean OnClick Edit "")] "" , Txa_Cols (if (col == 0) 50 col)
, Input [Inp_Type Inp_Reset, Inp_Name "reset", Inp_Value (SV "Reset")] "" ] string ]
]] ]
] ]
] },incrHSt 1 hst)
]]
},incrHSt 3 hst)
where where
(TextArea row col string) = formid.ival (TextArea row col string) = formid.ival
mkSTable table myTable table
= Table [] (mktable table) = Table [] (mktable table)
where where
mktable table = [Tr [] (mkrow rows) \\ rows <- table] mktable table = [Tr [] (mkrow rows) \\ rows <- table]
mkrow rows = [Td [Td_VAlign Alo_Top, Td_Width (Pixels defpixel)] [row] \\ row <- rows] mkrow rows = [Td [Td_VAlign Alo_Top, Td_Width (Pixels defpixel)] [row] \\ row <- rows]
gUpd{|TextArea|} (UpdSearch (UpdS name) 0) (TextArea r c s) = (UpdDone, TextArea r c (urlDecode name)) // update button value
gUpd{|TextArea|} (UpdSearch val cnt) t = (UpdSearch val (cnt - 1),t) // continue search, don't change
gUpd{|TextArea|} (UpdCreate l) _ = (UpdCreate l, TextArea defsize defsize "") // create default value
gUpd{|TextArea|} mode t = (mode, t) // don't change
gForm{|PasswordBox|} (init,formid) hst gForm{|PasswordBox|} (init,formid) hst
= case formid.ival of = case formid.ival of
(PasswordBox password) (PasswordBox password)
......
...@@ -381,6 +381,7 @@ where ...@@ -381,6 +381,7 @@ where
fieldname = Input [ Inp_Type Inp_Text fieldname = Input [ Inp_Type Inp_Text
, Inp_Value (SV (prettify d.gfd_name +++ ": ")) , Inp_Value (SV (prettify d.gfd_name +++ ": "))
, Inp_ReadOnly ReadOnly , Inp_ReadOnly ReadOnly
, Inp_Disabled Disabled
, `Inp_Std [DisplayBoxStyle] , `Inp_Std [DisplayBoxStyle]
, Inp_Size maxsize` , Inp_Size maxsize`
] "" ] ""
......
...@@ -18,8 +18,8 @@ class iDataSerAndDeSerialize a ...@@ -18,8 +18,8 @@ class iDataSerAndDeSerialize a
| gParse{|*|} // To de-serialize a string back to a value | gParse{|*|} // To de-serialize a string back to a value
, iDataSerialize a , iDataSerialize a
TraceInput :== False // show what kind of information is received from Client TraceInput :== True // show what kind of information is received from Client
TraceOutput :== False // show what kind of information is stored TraceOutput :== True // show what kind of information is stored
MyDataBase :== "iDataDatabase" // name of database being used by iData applications MyDataBase :== "iDataDatabase" // name of database being used by iData applications
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment