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
| UpdS String // new piece of text
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
......
......@@ -413,4 +413,5 @@ where
hexToDigit i
| i<=toInt '9' = i - toInt '0'
| otherwise = i - toInt 'A' - 10
urlDecode` ['+':xs] = [' ':urlDecode` xs]
urlDecode` [x:xs] = [x:urlDecode` xs]
......@@ -67,13 +67,13 @@ editorRefPaper :: !(InIDataId RefPaper) !*HSt -> (Form Paper,!*HSt)
editorRefPaper (init,formid) hst
# (RefPaper refpaper) = formid.ival
# (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 (init,formid) hst
# (RefReport refreport) = formid.ival
# (Ref2 name) = refreport
= universalRefEditor storageOption (init,reuseFormId formid refreport) (invariant name) hst
= universalRefEditor storageOption (init,reuseFormId formid refreport <@ Submit) (invariant name) hst
where
invariant name Nothing = Ok
invariant name (Just report) = invariantReport name report
......
......@@ -69,8 +69,8 @@ import loginAdmin, htmlFormlib
:: Familiarity = Expert
| Knowledgeable
| Low
:: CommCommittee:== String // TextArea
:: CommAuthors :== String // TextArea
:: CommCommittee:== TextArea
:: CommAuthors :== TextArea
// Information maintained by the Conference Manager *or* a Referee *or* an Author
......@@ -94,7 +94,7 @@ import loginAdmin, htmlFormlib
:: Paper = { title :: String
, first_author :: Person
, co_authors :: Co_authors
, abstract :: String
, abstract :: TextArea
, pdf :: String
}
:: Co_authors = Co_authors [Person]
......
......@@ -214,16 +214,18 @@ invariantPersons id persons
invariantPaper :: String Paper -> Judgement
invariantPaper id {title,first_author,co_authors = Co_authors authors,abstract,pdf}
| 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!")
# judgementFirst_author = invariantPerson (id +++ " first author") first_author
# judgementCo_authors = foldl (+) Ok (map (invariantPerson (id +++ " co_authors")) authors)
= judgementFirst_author + judgementCo_authors
where
(TextArea _ _ tabstract) = abstract
invariantReport :: String Report -> Judgement
invariantReport id {commCommittee,commAuthors}
| commAuthors == "" = Just (id,"You have to make some remarks to the authors")
| commCommittee == "" = Just (id,"You have to make some remarks to the committee")
invariantReport id {commCommittee=(TextArea _ _ commcommittee),commAuthors=(TextArea _ _ commauthors)}
| commauthors == "" = Just (id,"You have to make some remarks to the authors")
| commcommittee == "" = Just (id,"You have to make some remarks to the committee")
= Ok
invariantConfAccounts :: String ConfAccounts -> Judgement
......
......@@ -14,35 +14,18 @@ derive gParse Record
derive gPrint Record
derive gerda Record
//Start world = doHtmlSubServer (4,0,1,"tree") MyPage5 world
Start world = doHtmlServer MyPage5 world
//Start world = doHtmlSubServer (4,1,1,"tree") MyPage5 world
Start world = doHtmlServer MyPage4 world
MyPage5 hst
# (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}
:: Record = {name :: String, address :: TextArea, zipcode :: Int}
myrecord :: [Record]
myrecord :: TextArea
myrecord = createDefault
myfun file
= if (sfend2 file file) (fwritec 'a' file) (fwritec 'b' file)
where
sfend2 n m = sfend n
MyPage4 hst
//# (myrecord,hst) = mkEditForm (Init,nFormId "bla" myrecord) hst
# (myrecord,hst) = vertlistFormButs 5 True (Init,nFormId "bla" myrecord) hst
# (myrecord,hst) = mkEditForm (Init,nFormId "bla" myrecord <@ Submit) hst
//# (myrecord,hst) = vertlistFormButs 5 True (Init,nFormId "bla" myrecord <@ Submit) hst
= mkHtml "Example"
[ H1 [] ""
, BodyTag myrecord.form
......
......@@ -49,6 +49,7 @@ instance toString HtmlDate, HtmlTime
| TR Int Real // Input box of size Size for Reals
| TS Int String // Input box of size Size for Strings
:: TextArea = TextArea Int Int String // Input Area Box, row col initial string
// Only works in Submit mode due to Html restrictions!
:: PasswordBox = PasswordBox String
// special's
......
......@@ -3,7 +3,7 @@ implementation module htmlButtons
import StdFunc, StdList, StdString
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 gParse (,), (,,), (,,,), (<->), <|>, 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
# (cntr,hst) = CntrHSt hst
= ( { changed = False
, value = formid.ival
, form = [Form [Frm_Method Post, `Frm_Events (callClean OnSubmit Edit "")]
[mkSTable [ [ Textarea [Txa_Name "message", Txa_Rows row, Txa_Cols col ] "" ]
, [ mkSTable [[ Input [Inp_Type Inp_Submit, Inp_Name (encodeTriplet (formid.id,cntr+2,UpdS string)), Inp_Value (SV "Set"),`Inp_Events (callClean OnClick Edit "")] ""
, Input [Inp_Type Inp_Reset, Inp_Name "reset", Inp_Value (SV "Reset")] ""
]]
]
]
]]
},incrHSt 3 hst)
, form = [myTable [ [ Textarea [ Txa_Name (encodeTriplet (formid.id,cntr,UpdS string))
, Txa_Rows (if (row == 0) 10 row)
, Txa_Cols (if (col == 0) 50 col)
] string ]
]
]
},incrHSt 1 hst)
where
(TextArea row col string) = formid.ival
mkSTable table
myTable table
= Table [] (mktable table)
where
mktable table = [Tr [] (mkrow rows) \\ rows <- table]
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
= case formid.ival of
(PasswordBox password)
......
......@@ -381,6 +381,7 @@ where
fieldname = Input [ Inp_Type Inp_Text
, Inp_Value (SV (prettify d.gfd_name +++ ": "))
, Inp_ReadOnly ReadOnly
, Inp_Disabled Disabled
, `Inp_Std [DisplayBoxStyle]
, Inp_Size maxsize`
] ""
......
......@@ -18,8 +18,8 @@ class iDataSerAndDeSerialize a
| gParse{|*|} // To de-serialize a string back to a value
, iDataSerialize a
TraceInput :== False // show what kind of information is received from Client
TraceOutput :== False // show what kind of information is stored
TraceInput :== True // show what kind of information is received from Client
TraceOutput :== True // show what kind of information is stored
MyDataBase :== "iDataDatabase" // name of database being used by iData applications
......
Markdown is supported
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