Commit 316cf70a authored by Rinus Plasmeijer's avatar Rinus Plasmeijer
Browse files

*** empty log message ***

parent 78692c54
......@@ -61,7 +61,7 @@ editorRefPerson :: !(InIDataId RefPerson) !*HSt -> (Form Person,!*HSt)
editorRefPerson (init,formid) hst
# (RefPerson refperson) = formid.ival
# (Ref2 name) = refperson
= universalRefEditor storageOption (init,reuseFormId formid refperson) (invariantPerson name) hst
= universalRefEditor storageOption (init,reuseFormId formid refperson <@ Submit) (invariantPerson name) hst
editorRefPaper :: !(InIDataId RefPaper) !*HSt -> (Form Paper,!*HSt)
editorRefPaper (init,formid) hst
......
......@@ -12,7 +12,7 @@ derive gerda Login
// this session login form will be used at every event to check whether the end user is indeed administrated
loginForm :: !(Init,Login) !*HSt -> (Form Login,!*HSt)
loginForm (init,login) hst = mkEditForm (init,sFormId "adminID_login" login) hst
loginForm (init,login) hst = mkEditForm (init,sFormId "adminID_login" login <@ Submit) hst
// scratch form
......
module calculator
// simple spreadsheet example
// (c) MJP 2005
import StdEnv
import StdHtml
//Start world = doHtmlServer arrowcalculator world
Start world = doHtmlServer simple world
//Start world = doHtmlServer temp world
simple hst
//# (fun,hst) = mkEditForm (pDFormId "fun") ((+) 1) hst // calculates new values
# (display,hst) = mkEditForm (nDFormId "display") 1 hst // calculates new values
# (display2,hst) = mkEditForm (nDFormId "display2") 2 hst // calculates new values
//# (fun,hst) = mkStoreForm (pdDFormId "store") ((+) 4) id hst // calculates new values
= mkHtml "Calculator"
[ H1 [] "Calculator Example: "
, toBody display
, toBody display2
// , toHtml (fun.value display.value)
] hst
import dynamic_string
temp hst
# (butfun,hst) = TableFuncBut (nFormId "calcbut") incbut hst // shows buttons
# (display,hst) = mkStoreForm (nFormId "display") 0 butfun.value hst // calculates new values
= mkHtml "Calculator"
[ H1 [] "Calculator Example: "
, toBody display
, toBody butfun
] hst
where
incbut = [[(LButton (defpixel / 3) "+1",inc)]]
calculator hst
# (calcfun,hst) = TableFuncBut (nFormId "calcbut") calcbuttons hst // shows buttons
# (display,hst) = mkStoreForm (nFormId "display") initcalc calcfun.value hst // calculates new values
= mkHtml "Calculator"
[ H1 [] "Calculator Example: "
, toBody display
, toBody calcfun
] hst
arrowcalculator hst
# (calcfun,hst) = TableFuncBut (nFormId "calcfun") calcbuttons hst // shows buttons
# (display,hst) = startCircuit circuit calcfun.value hst // calculates new values
= mkHtml "Calculator"
[ H1 [] "Calculator Example: "
, toBody display
, toBody calcfun
] hst
where
circuit = store (nFormId "display") initcalc
initcalc = (0 <|> 0)
calcbuttons = [ [(but "7",set 7), (but "8",set 8), (but "9",set 9) ]
, [(but "4",set 4), (but "5",set 5), (but "6",set 6) ]
, [(but "1",set 1), (but "2",set 2), (but "3",set 3) ]
, [(but "0",set 0), (but "C",clear), (but "CA",cla) ]
, [(but "+",app (+)), (but "-",app (-)), (but "*",app (*))]
, [(but "^2",app2 (*))]
]
where
set i (t <|> b) = (t <|> b*10 + i)
clear (t <|> b) = (t <|> 0)
cla (t <|> b) = (0 <|> 0)
app fun (t <|> b) = (fun t b <|> 0)
app2 fun (t <|> b) = (fun t t <|> 0)
but i = LButton (defpixel / 3) i
......@@ -32,7 +32,7 @@ searchOptionForm :: (SearchOptions option) *HSt -> (Form (option -> option,Int),
searchOptionForm {options} hst = FuncMenu (Init, sFormId "searchoption"(1,[(label,const option) \\ (label,option) <- options])) hst
personalDataForm :: *HSt -> (Form PersonalData,*HSt)
personalDataForm hst = mkEditForm (Init, sFormId "personal" initPersInfo) hst
personalDataForm hst = mkEditForm (Init, sFormId "personal" initPersInfo <@ Submit) hst
// session stores:
......
......@@ -201,7 +201,7 @@ gForm{|RadioButton|} (init,formid) hst
]) ""]
},incrHSt 1 hst)
gForm{|PullDownMenu|} (init,formid) hst
gForm{|PullDownMenu|} (init,formid) hst=:{submits}
# (cntr,hst) = CntrHSt hst
= case formid.ival of
v=:(PullDown (size,width) (menuindex,itemlist))
......@@ -211,7 +211,7 @@ gForm{|PullDownMenu|} (init,formid) hst
[ Sel_Name ("CS")
, Sel_Size size
, `Sel_Std [Std_Style ("width:" <+++ width <+++ "px")]
, `Sel_Events (callClean OnChange formid.mode formid.id)
, `Sel_Events (if submits [] (callClean OnChange formid.mode formid.id))
])
[ Option
[ Opt_Value (encodeTriplet (formid.id,cntr,UpdC (itemlist!!j)))
......@@ -264,16 +264,17 @@ gForm{|PasswordBox|} (init,formid) hst
},incrHSt 1 hst)
where
mkPswInput :: !Int !(InIDataId d) String UpdValue !*HSt -> (!BodyTag,!*HSt)
mkPswInput size (init,formid=:{mode = Edit}) sval updval hst=:{cntr}
mkPswInput size (init,formid=:{mode}) sval updval hst=:{cntr,submits}
| mode == Edit || mode == Submit
= ( Input [ Inp_Type Inp_Password
, Inp_Value (SV sval)
, Inp_Name (encodeTriplet (formid.id,cntr,updval))
, Inp_Size size
, `Inp_Std [EditBoxStyle, Std_Title "::Password"]
, `Inp_Events (callClean OnChange Edit "")
, `Inp_Events if (mode == Edit && not submits) (callClean OnChange Edit "") []
] ""
,incrHSt 1 hst)
mkPswInput size (init,{mode = Display}) sval _ hst
| mode == Display
= ( Input [ Inp_Type Inp_Password
, Inp_Value (SV sval)
, Inp_ReadOnly ReadOnly
......@@ -281,8 +282,7 @@ where
, Inp_Size size
] ""
,incrHSt 1 hst)
mkPswInput size (init,_) val _ hst=:{cntr}
= ( EmptyBody,incrHSt 1 hst )
= ( EmptyBody,incrHSt 1 hst )
// time and date
......
......@@ -209,7 +209,6 @@ where
((sid,pos,UpdB b), _) = (Just (pos,UpdB b) )
(_,_) = case parseTriplet tripletupd of
((sid,pos,UpdS s), Just ns) = (Just (pos,UpdS ns))
// ((sid,pos,UpdS s), _) = (Just (pos,UpdS s) )
_ = case tripletupd of
((sid,pos,UpdS s), ns) -> (Just (pos, UpdS ns))
_ -> (Nothing )
......
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