Commit 8ff4893b authored by Rinus Plasmeijer's avatar Rinus Plasmeijer

multiple choice generalized such that tasks can also be executed in parallel


git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@107 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 35764df6
......@@ -114,8 +114,6 @@ return_D :: !a -> Task a | gForm {|*|}, iCreateAndPrint a
(@:) :: will prompt who is waiting for task with give name
(@::) :: same, default task name given
*/
//(@:) infix 3 :: !(!String,!Int) (Task a) -> (Task a) | iCreateAndPrint a
//(@::) infix 3 :: !Int (Task a) -> (Task a) | iCreate a
(@:) infix 3 :: !Int !(LabeledTask a) -> Task a | iData a
(@::) infix 3 :: !Int !(Task a) -> Task a | iData a
......@@ -135,26 +133,43 @@ seqTasks :: do all iTasks one after another, task completed when all done
*/
seqTasks :: ![LabeledTask a] -> Task [a] | iCreateAndPrint a
/* Choose out one or more Tasks sequentially before they are executed sequentially:
/* Choose out the tasks you want to do one forehand, labels are used to make the choice:
buttonTask :: Choose the iTask when button pressed
buttonTask :: Do the iTask when button pressed
chooseTask :: Choose one iTask from list, depending on button pressed, button horizontal displayed
chooseTaskV :: Choose one iTask from list, depending on button pressed, buttons vertical displayed
chooseTask_pdm :: Choose one iTask from list, depending on pulldownmenu item selected
mchoiceTask :: Multiple Choice of iTasks, depending on marked checkboxes
mchoiceTask2 :: as mchoiceTask, boolean used for initial checking
mchoice: choose tasks depending on the checkboxes set
mchoiceTask :: Checked tasks will be done SEQUENTIALLY
mchoiceTask2 :: as mchoiceTask, boolean used for initial setting of the checks
mchoiceTask3 :: as mchoiceTask2, function can be used to (re)set the checkboxes
mchoiceTask :: Checked tasks can be done in INTERLEAVED
mchoiceTask2 :: as mchoiceTask, boolean used for initial setting of the checks
mchoiceTask3 :: as mchoiceTask2, function can be used to (re)set the checkboxes
gchoiceTasks :: most general mchoice function, can be used e.g. with andTasksCond
*/
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
mchoiceTasks :: !HtmlCode ![LabeledTask a] -> Task [a] | iCreateAndPrint a
mchoiceTasks2 :: !HtmlCode ![(!Bool,LabeledTask a)] -> Task [a] | iCreateAndPrint a
mchoiceTasks :: !HtmlCode ![LabeledTask a] -> Task [a] | iData a
mchoiceTasks2 :: !HtmlCode ![(!Bool,LabeledTask a)] -> Task [a] | iData a
mchoiceTasks3 :: !HtmlCode ![((!Bool,!ChoiseUpdate,!HtmlCode),LabeledTask a)]
-> Task [a] | iCreateAndPrint a
-> Task [a] | iData a
mchoiceAndTasks :: !HtmlCode ![LabeledTask a] -> Task [a] | iData a
mchoiceAndTasks2:: !HtmlCode ![(!Bool,LabeledTask a)] -> Task [a] | iData a
mchoiceAndTasks3:: !HtmlCode ![((!Bool,!ChoiseUpdate,!HtmlCode),LabeledTask a)]
-> Task [a] | iData a
gchoiceTasks :: !([LabeledTask a] -> Task [a])
!HtmlCode ![((!Bool,!ChoiseUpdate,!HtmlCode),LabeledTask a)]
-> Task [a] | iData a
:: ChoiseUpdate :== !Bool [Bool] -> [Bool] // changed checkbox + current settings -> new settings
......@@ -172,6 +187,7 @@ orTask2 :: !(Task a,Task b) -> Task (EITHER a b)
orTasks :: ![LabeledTask a] -> Task a | iData a
/* Do Tasks parallel / interleaved and FINISH when ALL Tasks done:
andTask :: do both iTasks in any order (interleaved), task completed when both done
(-&&-) :: same, now as infix combinator
andTasks :: do all iTasks in any order (interleaved), task completed when all done
......@@ -181,7 +197,9 @@ andTasks_mu :: assign task to indicated users, task completed when all done
andTask :: !(Task a,Task b) -> Task (a,b) | iCreateAndPrint a & iCreateAndPrint b
(-&&-) infixr 4 :: !(Task a) !(Task b) -> Task (a,b) | iCreateAndPrint a & iCreateAndPrint b
andTasks :: ![LabeledTask a] -> Task [a] | iData a
andTasksCond :: !([a] -> Bool) ![LabeledTask a] -> Task [a] | iData a
andTasks_mu :: !String ![(Int,Task a)] -> Task [a] | iData a
/* Time and Date management:
......
......@@ -1287,15 +1287,32 @@ where
= chosenTask {tst & activated = True, html = BT [], tasknr = [0:tasknr]}
= (a,{tst & activated = adone, html = html +|+ ahtml, tasknr = tasknr})
mchoiceTasks :: !HtmlCode ![LabeledTask a] -> (Task [a]) | iCreateAndPrint a
mchoiceTasks prompt taskOptions = mchoiceTasks3 prompt [((False,\b bs -> bs,[]),labeltask) \\ labeltask <- taskOptions]
mchoiceTasks :: !HtmlCode ![LabeledTask a] -> (Task [a]) | iData a
mchoiceTasks prompt taskOptions
= gchoiceTasks seqTasks prompt [((False,\b bs -> bs,[]),labeltask) \\ labeltask <- taskOptions]
mchoiceTasks2 :: !HtmlCode ![(!Bool,LabeledTask a)] -> Task [a] | iCreateAndPrint a
mchoiceTasks2 prompt taskOptions = mchoiceTasks3 prompt [((set,\b bs -> bs,[]),labeltask) \\ (set,labeltask) <- taskOptions]
mchoiceTasks2 :: !HtmlCode ![(!Bool,LabeledTask a)] -> Task [a] | iData a
mchoiceTasks2 prompt taskOptions
= gchoiceTasks seqTasks prompt [((set,\b bs -> bs,[]),labeltask) \\ (set,labeltask) <- taskOptions]
mchoiceTasks3 :: !HtmlCode ![((!Bool,!ChoiseUpdate,!HtmlCode),LabeledTask a)]
-> Task [a] | iCreateAndPrint a
mchoiceTasks3 prompt taskOptions = mkTask "mchoiceTask" (domchoiceTasks taskOptions)
mchoiceTasks3 :: !HtmlCode ![((!Bool,!ChoiseUpdate,!HtmlCode),LabeledTask a)] -> Task [a] | iData a
mchoiceTasks3 prompt taskOptions
= gchoiceTasks seqTasks prompt taskOptions
mchoiceAndTasks :: !HtmlCode ![LabeledTask a] -> (Task [a]) | iData a
mchoiceAndTasks prompt taskOptions
= gchoiceTasks andTasks prompt [((False,\b bs -> bs,[]),labeltask) \\ labeltask <- taskOptions]
mchoiceAndTasks2 :: !HtmlCode ![(!Bool,LabeledTask a)] -> Task [a] | iData a
mchoiceAndTasks2 prompt taskOptions
= gchoiceTasks andTasks prompt [((set,\b bs -> bs,[]),labeltask) \\ (set,labeltask) <- taskOptions]
mchoiceAndTasks3 :: !HtmlCode ![((!Bool,!ChoiseUpdate,!HtmlCode),LabeledTask a)] -> Task [a] | iData a
mchoiceAndTasks3 prompt taskOptions
= gchoiceTasks andTasks prompt taskOptions
gchoiceTasks :: !([LabeledTask a] -> Task [a]) !HtmlCode ![((!Bool,!ChoiseUpdate,!HtmlCode),LabeledTask a)] -> Task [a] | iData a
gchoiceTasks taskorderfun prompt taskOptions = mkTask "mchoiceTask" (domchoiceTasks taskOptions)
where
domchoiceTasks [] tst = ([],{tst& activated = True})
domchoiceTasks taskOptions tst=:{tasknr,html,options,userId} // choose one subtask out of the list
......@@ -1307,7 +1324,7 @@ where
# (cboxes,tst) = LiftHst (ListFuncCheckBox (Set ,cFormId options seltaskId (setCheckboxes nsettings))) tst
# (done,tst) = LiftHst (mkStoreForm (Init,storageFormId options donetaskId False) id) tst
# optionsform = cboxes.form <=|> [[CTxt Yellow label] <||> htmlcode \\ ((_,_,htmlcode),(label,_)) <- taskOptions]
| done.value = seqTasks [labeledTask \\ (_,labeledTask) <- taskOptions & True <- snd cboxes.value] {tst & tasknr = [0:tasknr]}
| done.value = taskorderfun [labeledTask \\ (_,labeledTask) <- taskOptions & True <- snd cboxes.value] {tst & tasknr = [0:tasknr]}
# (_,tst=:{html=ahtml,activated = adone})
= (internEditSTask "" "OK" Void) {tst & activated = True, html = BT [], tasknr = [-1:tasknr]}
| not adone = ([],{tst & html = html +|+ BT prompt +|+ BT [optionsform] +|+ ahtml})
......@@ -1959,6 +1976,34 @@ iTaskButton label
= LButton defpixel label
/*
mchoiceTasks3 :: !HtmlCode ![((!Bool,!ChoiseUpdate,!HtmlCode),LabeledTask a)]
-> Task [a] | iCreateAndPrint a
mchoiceTasks3 prompt taskOptions = mkTask "mchoiceTask" (domchoiceTasks taskOptions)
where
domchoiceTasks [] tst = ([],{tst& activated = True})
domchoiceTasks taskOptions tst=:{tasknr,html,options,userId} // choose one subtask out of the list
# seltaskId = iTaskId userId tasknr ("MtpChSel" <+++ length taskOptions)
# donetaskId = iTaskId userId tasknr "MtpChSt"
# (cboxes,tst) = LiftHst (ListFuncCheckBox (Init,cFormId options seltaskId initCheckboxes)) tst
# (fun,nblist) = cboxes.value
# nsettings = fun nblist
# (cboxes,tst) = LiftHst (ListFuncCheckBox (Set ,cFormId options seltaskId (setCheckboxes nsettings))) tst
# (done,tst) = LiftHst (mkStoreForm (Init,storageFormId options donetaskId False) id) tst
# optionsform = cboxes.form <=|> [[CTxt Yellow label] <||> htmlcode \\ ((_,_,htmlcode),(label,_)) <- taskOptions]
| done.value = seqTasks [labeledTask \\ (_,labeledTask) <- taskOptions & True <- snd cboxes.value] {tst & tasknr = [0:tasknr]}
# (_,tst=:{html=ahtml,activated = adone})
= (internEditSTask "" "OK" Void) {tst & activated = True, html = BT [], tasknr = [-1:tasknr]}
| not adone = ([],{tst & html = html +|+ BT prompt +|+ BT [optionsform] +|+ ahtml})
# (_,tst) = LiftHst (mkStoreForm (Init,storageFormId options donetaskId False) (\_ -> True)) tst
= domchoiceTasks taskOptions {tst & tasknr = tasknr, html = html, options = options, userId =userId, activated = True} // choose one subtask out of the list
initCheckboxes =
[(if set CBChecked CBNotChecked label, \b bs _ -> setfun b bs) \\ ((set,setfun,_),(label,_)) <- taskOptions & i <- [0..]]
setCheckboxes boollist =
[(if set CBChecked CBNotChecked label, \b bs _ -> setfun b bs) \\ ((_,setfun,_),(label,_)) <- taskOptions
& i <- [0..] & set <- boollist]
*/
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