Commit 858db5d0 authored by Rinus Plasmeijer's avatar Rinus Plasmeijer

cond task now has a display function as argument:

one can choose to display each subtask in a tab, show all task in the same window, or display the sub tasks in a user defined way

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/branches/fancyTasks@320 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent e4728533
......@@ -3893,6 +3893,22 @@ OtherModules
Fusion: False
DclOpen: False
IclOpen: False
Module
Name: DeauthenticationHandler
Dir: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
DclOpen: False
IclOpen: False
Static
Mods
Path: {Project}\coffeemachine.icl
......@@ -4102,43 +4118,13 @@ Static
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\TaskTree\TSt.icl
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Session.icl
Path: {Application}\Libraries\MersenneTwister\MersenneTwister.icl
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\DeauthenticationHandler.icl
Objs
Path: {Application}\Libraries\StdEnv\Clean System Files\_startup0.o
Path: {Application}\Libraries\StdEnv\Clean System Files\_startup1Trace.o
Path: {Application}\Libraries\StdEnv\Clean System Files\_startup2.o
Path: {Application}\Libraries\StdEnv\Clean System Files\_system.o
Path: {Project}\Clean System Files\coffeemachine.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\BasicTasks\Clean System Files\iTasksDB.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Clean System Files\iTasksExceptionHandling.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\BasicTasks\Clean System Files\iTasksTimeAndDateHandling.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\TaskCombinators\Clean System Files\iTasksCombinators.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\ThreadTableHandler.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\ProcessTableHandler.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\TaskTreeForestHandler.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\WorkTabHandler.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\Platform\Clean System Files\Text.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Util\Clean System Files\JSON.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\TaskTree\Clean System Files\TaskTreeFilters.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\TaskTree\Clean System Files\TaskTree.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\WorkListHandler.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\FilterListHandler.o
Path: {Application}\Libraries\MersenneTwister\Clean System Files\MersenneTwister.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Clean System Files\Session.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\AuthenticationHandler.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\IndexHandler.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\graph_copy\Clean System Files\sapldebug.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\TaskCombinators\Clean System Files\iTasksHtmlSupport.o
Path: {Application}\Libraries\Generics\Clean System Files\GenBimap.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Clean System Files\iTasksProcessHandling.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\BasicTasks\Clean System Files\iTasksEditors.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\TaskCombinators\Clean System Files\iTasksLiftingCombinators.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Clean System Files\InternaliTasksThreadHandling.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\graph_copy\Clean System Files\graph_to_sapl_string.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\graph_copy\Clean System Files\graph_to_string_with_descriptors.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\TaskTree\Clean System Files\TSt.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Clean System Files\iTasksSettings.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Clean System Files\InternaliTasksCommon.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Clean System Files\iTasksTypes.o
Path: {Application}\Libraries\Dynamics\extension\Clean System Files\StdCleanTypes.o
Path: {Application}\Libraries\Dynamics\implementation\windows\Clean System Files\_SystemDynamic.o
Path: {Application}\Libraries\StdEnv\Clean System Files\StdOverloaded.o
......@@ -4314,6 +4300,38 @@ Static
Path: {Application}\Libraries\StdEnv\Clean System Files\_SystemStrictLists.o
Path: {Application}\Libraries\StdEnv\Clean System Files\_SystemEnumStrict.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\TaskCombinators\Clean System Files\iTasksBasicCombinators.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Clean System Files\iTasksTypes.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Clean System Files\InternaliTasksCommon.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Clean System Files\iTasksSettings.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\TaskTree\Clean System Files\TSt.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\graph_copy\Clean System Files\graph_to_string_with_descriptors.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\graph_copy\Clean System Files\graph_to_sapl_string.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Clean System Files\InternaliTasksThreadHandling.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Clean System Files\iTasksProcessHandling.o
Path: {Application}\Libraries\Generics\Clean System Files\GenBimap.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\TaskCombinators\Clean System Files\iTasksLiftingCombinators.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\BasicTasks\Clean System Files\iTasksEditors.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\TaskCombinators\Clean System Files\iTasksHtmlSupport.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\graph_copy\Clean System Files\sapldebug.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\IndexHandler.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\AuthenticationHandler.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Clean System Files\Session.o
Path: {Application}\Libraries\MersenneTwister\Clean System Files\MersenneTwister.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\DeauthenticationHandler.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\FilterListHandler.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\WorkListHandler.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\Platform\Clean System Files\Text.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Util\Clean System Files\JSON.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\TaskTree\Clean System Files\TaskTree.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\TaskTree\Clean System Files\TaskTreeFilters.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\WorkTabHandler.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\TaskTreeForestHandler.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\ProcessTableHandler.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Framework\Handlers\Clean System Files\ThreadTableHandler.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\TaskCombinators\Clean System Files\iTasksCombinators.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\BasicTasks\Clean System Files\iTasksTimeAndDateHandling.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\Clean System Files\iTasksExceptionHandling.o
Path: C:\Documents and Settings\rinus\Desktop\SVN papers + code\iTasks 2.0\iTasks\BasicTasks\Clean System Files\iTasksDB.o
Path: {Application}\Libraries\ArgEnvWindows\Clean System Files\ArgEnvC.o
Path: {Application}\Libraries\ObjectIO\OS Windows\Clean System Files\cCrossCallFileSelectors_121.o
Path: {Application}\Libraries\ObjectIO\OS Windows\Clean System Files\cCrossCallFont_121.o
......
......@@ -49,13 +49,15 @@ selectTasks :: !(SelectingTask a) !(OrderingTask a) ![LabeledTask a] -> Task [a
/*
Execute all Tasks in parallel / interleaved and FINISH as soon as the predicate holds for the tasks which are finished:
allTasksCond :: - string is used to give a useful name to the trace;
- TaskToShow is some iData based form such that dynamically can be chosen which tasks to show;
- the predicate is applied on the set of tasks which are finished
*/
:: TasksToShow a :== String [LabeledTask a] *TSt *-> *(([Int],[HtmlTag]),!*TSt) // some iData determining which tasks to show
:: FinishPred a :== [a] -> Bool
:: DisplaySubTasks :== !String !TaskNr ![(Bool,HtmlTree)] -> HtmlTree // function determining how to display the subtasks
:: FinishPred a :== [a] -> Bool // predicate determining when the task is finished, depending on the results returned by finished subtasks
allTasksCond :: !String !(TasksToShow a) !(FinishPred a) ![LabeledTask a] -> Task [a] | iData a
allTasksCond :: !String !DisplaySubTasks !(FinishPred a) ![LabeledTask a] -> Task [a] | iData a
displayAsTab :: DisplaySubTasks // show each sub tasks in a tab
displayAll :: DisplaySubTasks
/* Support for user defined combinators
newTask :: lifts a (user defined) task to an abstract unit: after completion of a (complicated task) only i's final result will be remembered
......
......@@ -169,8 +169,8 @@ where
lengthltask = length ltasks
allTasksCond :: !String !(TasksToShow a) !(FinishPred a) ![LabeledTask a] -> Task [a] | iData a
allTasksCond label _ pred taskCollection
allTasksCond :: !String !DisplaySubTasks !(FinishPred a) ![LabeledTask a] -> Task [a] | iData a
allTasksCond label displayOption pred taskCollection
= mkTask "andTasksCond" (Task (doandTasks taskCollection))
where
lengthltask = length taskCollection
......@@ -181,15 +181,10 @@ where
= checkAllTasks label taskCollection 0 True ([],[]) {tst & html = BT [] [],activated = True}
| finished || pred alist = (alist,{tst & html = html, activated = True}) // stop, all work done so far satisfies predicate
= (alist,{tst & activated = False
, html = html +|+ collectCode label acode // show previous code
, html = html +|+ displayOption label tasknr acode // show previous code
})
where
collectCode :: !String ![(Bool,HtmlTree)] -> HtmlTree
collectCode label htmls = CondAnd label lengthltask [({ caTaskNrId = toStringTaskNr [0,i:tasknr]
, caIndex = lengthltask
, caStatus = finished
},html) \\ (finished,html) <- htmls & i <- [0..]]
checkAllTasks :: !String ![LabeledTask a] !Int !Bool !(![a],![(Bool,HtmlTree)]) !*TSt -> *(!(![a],![(Bool,HtmlTree)]),!*TSt) | iCreateAndPrint a
checkAllTasks traceid taskCollection ctasknr bool (alist,acode) tst=:{tasknr}
......@@ -199,6 +194,28 @@ where
= appTaskTSt (mkParSubTask traceid ctasknr task) {tst & tasknr = tasknr, activated = True, html = BT [] []} // check tasks
= checkAllTasks traceid taskCollection (inc ctasknr) False (if adone [a:alist] alist,[(adone,html):acode]) {tst & tasknr = tasknr}
displayAsTab :: DisplaySubTasks
displayAsTab = displayAsTab`
where
displayAsTab` label tasknr htmls
= CondAnd label nrSubTasks [({ caTaskNrId = toStringTaskNr [0,i:tasknr]
, caIndex = nrSubTasks
, caStatus = finished
},html) \\ (finished,html) <- htmls & i <- [0..]
]
where
nrSubTasks = length htmls
displayAll :: DisplaySubTasks
displayAll = displayAll`
where
displayAll` label tasknr htmls
= foldl (+|+) (BT [] []) (map snd htmls)
/*
allTasksCond :: !String !(TasksToShow a) !(FinishPred a) ![LabeledTask a] -> Task [a] | iData a
allTasksCond label chooser pred taskCollection
......
......@@ -92,7 +92,6 @@ andTasks :: do all iTasks in any order (interleaved), task completed when all
andTask2 :: do both iTasks in any order (interleaved), task completed when both done
andTasks_mu :: assign task to indicated users, task completed when all done
andTasksCond :: do all iTasks in any order (interleaved), task completed when predicate holds for finished tasks
andTasksCond_pdm:: same as andTasksCond, pull down menu used to select the tasks
*/
(-||-) infixr 3 :: !(Task a) !(Task a) -> Task a | iData a
(-&&-) infixr 4 :: !(Task a) !(Task b) -> Task (a,b) | iData a & iData b
......@@ -103,7 +102,6 @@ andTasks :: ![LabeledTask a] -> Task [a] | iData a
andTask2 :: !(Task a,Task b) -> Task (a,b) | iData a & iData b
andTasks_mu :: !String ![(Int,Task a)] -> Task [a] | iData a
andTasksCond :: !String !([a] -> Bool) ![LabeledTask a] -> Task [a] | iData a
andTasksCond_pdm:: !String !([a] -> Bool) ![LabeledTask a] -> Task [a] | iData a
/* convenient combinators for tasks that maybe return a result:
(=>>?) :: as bind, but do the second task only if the first one delivers a result
......
......@@ -225,12 +225,9 @@ orTasks taskCollection = newTask "orTasks" (andTasksCond "or Tasks" (\list -> le
orTask2 :: !(Task a,Task b) -> Task (EITHER a b) | iData a & iData b
orTask2 (taska,taskb)
= allTasksCond "orTask2" showBoth (\list -> length list > 0) [("orTask.0",taska =>> \a -> return_V (LEFT a)),("orTask.0",taskb =>> \b -> return_V (RIGHT b))]
= allTasksCond "orTask2" displayAll (\list -> length list > 0) [("orTask.0",taska =>> \a -> return_V (LEFT a)),("orTask.0",taskb =>> \b -> return_V (RIGHT b))]
=>> \res -> return_V (hd res)
showBoth id list tst=:{hst}
# (sel,hst) = mkEditForm (Init,nFormId id [0,1] <@ NoForm) hst
= ((sel.Form.value,sel.form),{tst & hst = hst})
andTasks :: ![LabeledTask a] -> (Task [a]) | iData a
andTasks taskCollection = newTask "andTasks" (andTasksCond "and Tasks" (\_ -> False) taskCollection)
......@@ -253,7 +250,7 @@ where
andTask2 :: !(Task a,Task b) -> Task (a,b) | iData a & iData b
andTask2 (taska,taskb)
= allTasksCond "andTask2" showBoth (\l -> False) [("andTask.0",taska =>> \a -> return_V (LEFT a)),("andTask.0",taskb =>> \b -> return_V (RIGHT b))]
= allTasksCond "andTask2" displayAll (\l -> False) [("andTask.0",taska =>> \a -> return_V (LEFT a)),("andTask.0",taskb =>> \b -> return_V (RIGHT b))]
=>> \[LEFT a, RIGHT b] -> return_V (a,b)
andTasks_mu :: !String ![(Int,Task a)] -> (Task [a]) | iData a
......@@ -263,25 +260,8 @@ where
andTasksCond :: !String !([a] -> Bool) ![LabeledTask a] -> (Task [a]) | iData a
andTasksCond label pred taskCollection
= allTasksCond label selectButtons pred taskCollection
where
selectButtons id list tst=:{hst,userId,tasknr,options}
# ((i,buttons,chosenname),hst) = mkTaskButtons True "mybut" userId tasknr options (map fst list) hst
= (([i],mkbuttons buttons chosenname),{tst & hst = hst})
where
mkbuttons buttons chosenname = if (length list > 1)
[showMainLabel label,showTrace " / ",showLabel chosenname: buttons] // PK "and"->label
[]
= allTasksCond label displayAsTab pred taskCollection
andTasksCond_pdm :: !String !([a] -> Bool) ![LabeledTask a] -> Task [a] | iData a
andTasksCond_pdm label pred taskCollection
= allTasksCond label selectButtons pred taskCollection
where
selectButtons ident list tst=:{hst,options}
# (result,hst) = FuncMenu (Init,applyoptions (nFormId (ident +++ "andTaskCond_pdm") (0,[(name,id) \\ (name,_) <- list]))) hst
= (([snd result.Form.value],[showLabel label] <||> result.form),{tst & hst = hst})
where
applyoptions nformid = nformid <@ options.tasklife <@ options.taskstorage <@ options.taskmode
......
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