Commit 35354603 authored by Rinus Plasmeijer's avatar Rinus Plasmeijer

improved the numbering;

negative numbers should not occur any more;
tried to remove unnecessary sub task creation,
but it seems to be the consequence of hiding information.

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/branches/fancyTasks@329 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent b8801430
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -94,7 +94,7 @@ where
# (v,tst) = appTaskTSt (mkTaskNoInc (name <+++ "." <+++ i) (Task mysubtask)) {tst & tasknr = [i:tasknr],activated = True} // shift task
= (v,{tst & tasknr = tasknr, options = options})
where
mysubtask tst=:{tasknr} = appTaskTSt task {tst & tasknr = [0:tasknr], activated = True} // shift once again!
mysubtask tst=:{tasknr} = appTaskTSt task {tst & tasknr = [-1:tasknr], activated = True} // shift once again!
// ******************************************************************************************************
......
......@@ -69,7 +69,7 @@ where
= (value,{tst & activated = done, hst = hst}) // task is now completed, handle as previously
newTaskTrace :: !String !(Task a) -> (Task a) | iData a // used to insert a task trace later MJP BUG
newTaskTrace taskname mytask = newTask taskname mytask
newTaskTrace taskname mytask = /* newTask taskname */ mytask
// ******************************************************************************************************
// looping tasks
......@@ -110,13 +110,13 @@ where
// Assigning tasks to users, each user has to be identified by an unique number >= 0
assignTaskTo :: !UserId !(LabeledTask a) -> Task a | iData a
assignTaskTo nuserId (taskname,taska) = Task assignTaskTo`
assignTaskTo nuserId (taskname,taska) = newTask "assignTaskTo" (mkTask taskname (Task assignTaskTo`))
where
assignTaskTo` tst=:{tasknr,activated,userId,workflowLink=(_,(_,processNr,workflowLabel))}
| not activated = (createDefault,tst)
# (currtime,tst=:{html=ohtml}) = appTaskTSt (appWorldOnce ("Task " +++ taskname +++ " for " +++ toString nuserId) time) tst
# tst = IF_Ajax (administrateNewThread userId tst) tst
# (a,tst=:{html=nhtml,activated}) = appTaskTSt (IF_Ajax (UseAjax @>> taska) taska) {tst & html = BT [] [],userId = nuserId, tasknr = tasknr} // activate task of indicated user NEWTRACE
# (a,tst=:{html=nhtml,activated}) = appTaskTSt (IF_Ajax (UseAjax @>> taska) taska) {tst & html = BT [] [],userId = nuserId} // activate task of indicated user NEWTRACE
| activated = (a,{tst & activated = True // work is done
, userId = userId // restore previous user id
, html = ohtml +|+ (taskDescriptor currtime activated @@: nhtml)}) // plus new one tagged
......
......@@ -87,9 +87,9 @@ where
chooseTask_btn :: ![HtmlTag] !Bool![LabeledTask a] -> Task a | iData a
chooseTask_btn prompt horizontal ltasks
= selectTasks (\lt -> prompt ?>> selectTask_btn horizontal lt) seqTasks ltasks =>> \la -> return_V (hd la)
= newTask "selectTask_btn" (selectTasks (\lt -> prompt ?>> selectTask_btn horizontal lt) seqTasks ltasks =>> \la -> return_V (hd la))
where
selectTask_btn direction ltasks = newTask "selectTask_btn" (Task (selectTask_btn` direction ltasks))
selectTask_btn direction ltasks = Task (selectTask_btn` direction ltasks)
selectTask_btn` _ [] tst = return [] tst
selectTask_btn` horizontal taskOptions tst=:{tasknr,html,options,userId} // choose one subtask out of the list
......@@ -108,9 +108,9 @@ where
chooseTask_pdm :: ![HtmlTag] !Int ![LabeledTask a] -> Task a | iData a
chooseTask_pdm prompt initial ltasks
= selectTasks (\lt -> prompt ?>> selectTask_pdm initial lt) seqTasks ltasks =>> \la -> return_V (hd la)
= newTask "selectTask_pdm" (selectTasks (\lt -> prompt ?>> selectTask_pdm initial lt) seqTasks ltasks =>> \la -> return_V (hd la))
where
selectTask_pdm initial ltasks = newTask "selectTask_pdm" (Task (selectTask_pdm` initial ltasks))
selectTask_pdm initial ltasks = Task (selectTask_pdm` initial ltasks)
selectTask_pdm` _ [] tst = return createDefault tst
selectTask_pdm` defaultOn taskOptions tst=:{tasknr,html,userId,options} // choose one subtask out of a pulldown menu
......@@ -133,10 +133,10 @@ where
chooseTask_cbox :: !([LabeledTask a] -> Task [a]) ![HtmlTag] ![((!Bool,!ChoiceUpdate,![HtmlTag]),LabeledTask a)] -> Task [a] | iData a
chooseTask_cbox order prompt code_ltasks
= selectTasks (\lt -> prompt ?>> selectTask_cbox (map fst code_ltasks) lt) order (map snd code_ltasks)
= newTask "selectTask_cbox" (selectTasks (\lt -> prompt ?>> selectTask_cbox (map fst code_ltasks) lt) order (map snd code_ltasks))
where
selectTask_cbox :: ![(!Bool,!ChoiceUpdate,![HtmlTag])] ![LabeledTask a] -> Task [Int]
selectTask_cbox htmlcodes taskOptions = newTask "selectTask_cbox" (Task (selectTask_cbox` taskOptions))
selectTask_cbox htmlcodes taskOptions = Task (selectTask_cbox` taskOptions)
where
selectTask_cbox` [] tst = ([],{tst& activated = True})
selectTask_cbox` taskOptions tst=:{tasknr,html,options,userId} // choose one subtask out of the list
......@@ -206,7 +206,7 @@ mchoiceAndTasks3 prompt taskOptions
// Speculative OR-tasks: task ends as soon as one of its subtasks completes
(-||-) infixr 3 :: !(Task a) !(Task a) -> (Task a) | iData a
(-||-) taska taskb = newTaskTrace "-||-" (doOrTask (taska,taskb))
(-||-) taska taskb = newTask "-||-" (doOrTask (taska,taskb))
where
doOrTask :: !(Task a,Task a) -> (Task a) | iData a
doOrTask (taska,taskb)
......@@ -220,13 +220,17 @@ where
orTasks :: ![LabeledTask a] -> (Task a) | iData a
orTasks [] = Task (return createDefault)
orTasks taskCollection = newTaskTrace "orTasks" (andTasksCond "orTask" (\list -> length list >= 1) taskCollection)
orTasks taskCollection = newTask "orTasks" (andTasksCond "orTask" (\list -> length list >= 1) taskCollection)
=>> \list -> (Task (return (hd list)))
orTask2 :: !(Task a,Task b) -> Task (EITHER a b) | iData a & iData b
orTask2 (taska,taskb)
= allTasksCond "orTask" 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)
= newTask "orTask2" ( allTasksCond "orTask" 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)
)
andTasks :: ![LabeledTask a] -> (Task [a]) | iData a
......@@ -234,8 +238,8 @@ andTasks taskCollection = newTaskTrace "andTasks" (andTasksCond "andTask" (\_ ->
(-&&-?) infixr 4 :: !(Task (Maybe a)) !(Task (Maybe b)) -> Task (Maybe (a,b)) | iData a & iData b
(-&&-?) t1 t2
= andTasksCond "maybeTask" noNothing [("Maybe 1",left),("Maybe 2",right)]
=>> combineResult
= newTask "maybeTask" (andTasksCond "maybeTask" noNothing [("Maybe 1",left),("Maybe 2",right)]
=>> combineResult)
where
left = t1 =>> \tres -> return_V (LEFT tres)
right = t2 =>> \tres -> return_V (RIGHT tres)
......@@ -250,8 +254,12 @@ where
andTask2 :: !(Task a,Task b) -> Task (a,b) | iData a & iData b
andTask2 (taska,taskb)
= allTasksCond "andTask" 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)
= newTask "andTask2" (allTasksCond "andTask" 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
andTasks_mu label tasks = newTaskTrace "andTaskMU" (domu_andTasks tasks)
......
......@@ -121,7 +121,8 @@ where
scheduleWorkflows :: !(Task a) -> (Task a) | iData a
scheduleWorkflows maintask
# nmaintask = newTask defaultWorkflowName (mkTask "StartMain" (assignTaskTo 0 ("main",maintask)))
//# nmaintask = newTask defaultWorkflowName (mkTask "StartMain" (assignTaskTo 0 ("main",maintask)))
# nmaintask = assignTaskTo 0 ("main",maintask)
= IF_Ajax
(IF_ClientServer // we running both client and server
(IF_ClientTasks
......@@ -180,7 +181,8 @@ where
# ((processid,wfls),tst) = workflowProcessStore id tst // read workflow process administration
# wfl = wfls!!(entry - 1) // fetch entry
# currentWorker = getWorkflowUser wfl // such that worker can be changed dynamically !
# (a,tst=:{activated}) = appTaskTSt (newTask label (mkTask "StartMain" (assignTaskTo currentWorker ("main",task)))) tst
// # (a,tst=:{activated}) = appTaskTSt (newTask label (mkTask "StartMain" (assignTaskTo currentWorker ("main",task)))) tst
# (a,tst=:{activated}) = appTaskTSt (assignTaskTo currentWorker ("main",task)) tst
# dyn = dynamic a
| not activated = (dyn,tst) // not finished, return
......
......@@ -9,67 +9,35 @@ derive gUpd []
Start :: *World -> *World
Start world = startTaskEngine myTask world
/*
myTask :: Task Int
myTask = editTask "Done" createDefault
*/
Start world = startTaskEngine myTask5 world
myTask :: Task Void
myTask =
2 @:: editTask "Get Started" Void #>>
3 @:: ([Text "What do you want to tell your boss?"] ?>> editTask "Shout" "") =>> \msg ->
2 @:: ([Text "Worker says: ",Text msg] ?>> editTask "Ok" Void)
/*
Start :: *World -> *World
Start world = startTaskEngine (( (0 @:: processTask) -&&- (0 @:: myTask)) )world
myTask :: Task String
myTask = editTask "Done" "Enter your name..." -||- (0 @: ("nieuwe taak",editTask "Done" "Hoi Rinus"))
//Editor of a task which uses specialize to create a separate view
//processTask :: Task (Wid HtmlDate)
processTask
//= editTask "Done" 44
= spawnWorkflow 0 True ("Date Process",editTask "Done" 5)
=>> \w -> return_V True
*/
/*
:: Fruit = Apples | Oranges | Grapes
myTask5
= chooseTask [Text "Choose product:",BrTag [],BrTag []]
[("Coffee: 100", return_V (100,"Coffee"))
,("Cappucino: 150", return_V (150,"Cappucino"))
,("Tea: 50", return_V (50, "Tea"))
,("Chocolate: 100", return_V (100,"Chocolate"))
]
=>> \v -> editTask "OK" v
:: MyRec = { name :: Maybe String
, age :: Int
, favoriteFruit :: Fruit
}
derive gForm Fruit, MyRec
derive gUpd Fruit, MyRec
derive gPrint Fruit, MyRec
derive gParse Fruit, MyRec
Start :: *World -> *World
Start world = startTaskEngine ( (0 @:: dateTask) -&&- (0 @:: prTask) )world
myTask4
= seqTasks [("taak1",ed 0 0),("taak2", ed 1 1)]
myTask :: Task MyRec
myTask = editTask "Done" createDefault
myTask3
= myTask -||- myTask
prTask :: Task Bool
prTask
= spawnWorkflow 0 True ("nieuwe taak",myTask)
=>> \_ -> return_V True
myTask2
= 0 @:: ed 0 0
=>> \v -> 0 @:: ed 1 v
=>> \v -> 0 @:: ed 2 v
cbTask :: Task HtmlCheckbox
cbTask = editTask "I'm Done" (HtmlCheckbox [Text "Click me!"] False)
boolTask :: Task Bool
boolTask = editTask "Done with the bool" True
myTask
= ed 0 0
=>> \v -> ed 1 v
=>> \v -> ed 2 v
fruitTask :: Task Fruit
fruitTask = editTask "Done" createDefault
//Editor of a task which uses specialize to create a separate view
dateTask :: Task HtmlDate
dateTask = editTask "Done" createDefault
*/
\ No newline at end of file
ed i j = editTask ("OK " <+++ i) j
\ No newline at end of file
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