Commit 892a8e7f authored by Rinus Plasmeijer's avatar Rinus Plasmeijer

*** empty log message ***


git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@109 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent f96a39c6
......@@ -156,6 +156,7 @@ buttonTask :: !String !(Task a) -> Task a | iCreateAndPrint a
chooseTask :: !HtmlCode ![LabeledTask a] -> Task a | iCreateAndPrint a
chooseTaskV :: !HtmlCode ![LabeledTask a] -> Task a | iCreateAndPrint a
chooseTask_pdm :: !HtmlCode ![LabeledTask a] -> Task a | iCreateAndPrint a
chooseTask_radio:: !HtmlCode ![LabeledTask a] -> Task a | iCreateAndPrint a
mchoiceTasks :: !HtmlCode ![LabeledTask a] -> Task [a] | iData a
mchoiceTasks2 :: !HtmlCode ![(!Bool,LabeledTask a)] -> Task [a] | iData a
......
......@@ -1287,6 +1287,33 @@ where
= chosenTask {tst & activated = True, html = BT [], tasknr = [0:tasknr]}
= (a,{tst & activated = adone, html = html +|+ ahtml, tasknr = tasknr})
chooseTask_radio :: !HtmlCode ![LabeledTask a] -> (Task a) |iCreateAndPrint a
chooseTask_radio prompt taskOptions = mkTask "chooseTask_radio" (dochooseTask_pdm taskOptions)
where
dochooseTask_pdm [] tst = return createDefault tst
dochooseTask_pdm taskOptions tst=:{tasknr,html,userId,options} // choose one subtask out of a pulldown menu
# numberOfButtons = length taskOptions
# taskId = iTaskId userId tasknr ("ChoStRadio" <+++ numberOfButtons)
# (chosen,tst) = LiftHst (mkStoreForm (Init,storageFormId options taskId (False,0)) id) tst
# (done,choice) = chosen.value
| not done // no choice made yet
# taskRadioMenuId = iTaskId userId tasknr ("ChoRadio" <+++ numberOfButtons)
# (nradio,tst) = LiftHst (ListFuncRadio (Init,sessionFormId options taskRadioMenuId (0,[\i a -> i \\ j <- [0 .. numberOfButtons - 1]]))) tst
# choice = if nradio.changed (snd nradio.value) choice
# (nradio,tst) = LiftHst (ListFuncRadio (Set, sessionFormId options taskRadioMenuId (choice,[\i a -> i \\ j <- [0 .. numberOfButtons - 1]]))) tst
# (_,tst=:{activated=adone,html=ahtml})
= internEditSTask "" "Done" Void {tst & activated = True, html = BT [], tasknr = [-1:tasknr]}
# (_,tst) = LiftHst (mkStoreForm (Init,storageFormId options taskId (False,0)) (\_ -> (adone,choice))) {tst & activated = adone, html = BT []}
| not adone = (createDefault,{tst & activated = False, html = html +|+ BT prompt +|+ BT nradio.form +|+ ahtml, tasknr = tasknr})
# chosenTask = snd (taskOptions!!choice)
# (a,tst=:{activated=bdone,html=bhtml})
= chosenTask {tst & activated = True, html = BT [], tasknr = [0:tasknr]}
= (a,{tst & tasknr = tasknr, activated = bdone, html = html +|+ bhtml})
# chosenTask = snd (taskOptions!!choice)
# (a,tst=:{activated=adone,html=ahtml})
= chosenTask {tst & activated = True, html = BT [], tasknr = [0:tasknr]}
= (a,{tst & activated = adone, html = html +|+ ahtml, tasknr = tasknr})
mchoiceTasks :: !HtmlCode ![LabeledTask a] -> (Task [a]) | iData a
mchoiceTasks prompt taskOptions
= gchoiceTasks seqTasks prompt [((False,\b bs -> bs,[]),labeltask) \\ labeltask <- taskOptions]
......
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