Commit 5b2ad1e0 authored by Rinus Plasmeijer's avatar Rinus Plasmeijer
Browse files

*** empty log message ***

parent 32cfb4f9
......@@ -21,7 +21,7 @@ findDate
?>> findDate` whom (Date 1 1 2007,Time 9 0 0)
=>> \datetime -> myId
*>> \me -> []
?>> PTask2 (confirm me whom datetime,confirm whom me datetime)
?>> PTask2 (confirm me whom datetime,confirm whom me datetime)
#>> returnV datetime
where
......@@ -37,10 +37,11 @@ where
where
proposeDateTime :: (HtmlDate,HtmlTime) -> Task (HtmlDate,HtmlTime)
proposeDateTime (date,time)
= STask "Set" input
= [Txt "Propose a new date and time for meeting",Br,Br]
?>> STask "Set" input
=>> \(_,date,_,time) -> returnV (date,time)
where
input = (showHtml [Txt "Propose date: "], date, showHtml [Txt "Propose time: "], time)
input = (showHtml [Txt "date: "], date, showHtml [Txt "time: "], time)
determineDateTime :: (HtmlDate,HtmlTime) -> Task (Bool,(HtmlDate,HtmlTime))
determineDateTime daytime
......@@ -59,6 +60,6 @@ where
confirm :: Int Int (HtmlDate,HtmlTime) -> Task Void
confirm me you (date,time)
= me @:: ( [Txt ("Person " <+++ me <+++ " and person " <+++ you <+++ " will meet on " <+++ date <+++ " at " <+++ time),Br,Br]
= me @:: ( [Txt ("Person " <+++ me <+++ " and " <+++ you <+++ " have a meeting on " <+++ date <+++ " at " <+++ time),Br,Br]
?>> STask "OK" Void
)
......@@ -7,7 +7,7 @@ derive gUpd []
npersons = 5
Start world = doHtmlServer (multiUserTask npersons (deadline mytask <<@ Persistent)) world
Start world = doHtmlServer (multiUserTask npersons (repeatTask (deadline mytask) /*<<@ Persistent*/)) world
mytask = STask "Press" 0
......@@ -16,17 +16,20 @@ deadline task
= [Txt "Choose person you want to delegate work to:",Br,Br]
?>> STask "Set" (PullDown (1,100) (0,[toString i \\ i <- [1..npersons]]))
=>> \whomPD -> [Txt "Until what time do you want to wait today?",Br,Br]
?>> STask "SetTimer" (Time 0 0 0)
?>> STask "SetTime" (Time 0 0 0)
=>> \time -> [Txt "Cancel delegated work if you are getting impatient:",Br,Br]
?>> PCTasks
[ ("Waiting", shifttask (toInt(toString whomPD)) time task)
, ("Cancel", returnV (False,createDefault))
]
=>> \(ok,value) -> if ok [Txt ("Result of task: " +++ printToString value),Br,Br]
[Txt "Task expired or canceled, default value chosen !",Br,Br]
?>> STask "OK" value
?>> PCTask2
( delegateTask (toInt(toString whomPD)) time task
, STask_button "Cancel" (returnV (False,createDefault))
)
=>> \(ok,value) -> if ok ( [Txt ("Result of task: " +++ printToString value),Br,Br]
?>> STask_button "OK" (returnV value)
)
( [Txt "Task expired or canceled, you have to do it yourself!",Br,Br]
?>> STask_button "OK" task
)
where
shifttask who time task
delegateTask who time task
= (who,"Timed Task")
@: PCTask2
( waitForTimeTask time // wait for deadline
......
......@@ -25,12 +25,19 @@ singleUserTask :: !(Task a) !*HSt -> (Html,*HSt) | iData a
multiUserTask :: !Int !(Task a) !*HSt -> (Html,*HSt) | iData a
/* Global Attribute settings: iTask are by default Lifespan = Session, StorageFormt = PlainString
For multi user systems
*/
class setTaskAttr a :: !a *TSt -> *TSt
instance setTaskAttr Lifespan, StorageFormat, Mode
/* Operations on Task state
myId :: id assigned to task
userId :: id of application user
*/
myId :: TSt -> (Int,TSt)
userId :: TSt -> (Int,TSt)
/* Assign tasks with informative name to user with indicated id
(@:) :: will prompt who is waiting for what
(@::) :: no prompting
......@@ -96,7 +103,6 @@ returnV :: a -> (Task a) | iData a
returnTask :: a -> (Task a) | iData a
returnVF :: a [BodyTag] -> (Task a) | iData a
returnF :: [BodyTag] -> TSt -> TSt
myId :: TSt -> (Int,TSt)
/* Setting up communication channels between users:
mkRTask :: Remote Task: split indicated task in two tasks: a calling task and a receiving task
......
......@@ -13,6 +13,7 @@ import dynamic_string, EncodeDecode
:: *TSt = { tasknr :: ![Int] // for generating unique form-id's
, activated :: !Bool // if true activate task, if set as result task completed
, myId :: !Int // id of user to which task is assigned
, userId :: !Int // id of application user
, html :: !HtmlTree // accumulator for html code
, storageInfo :: !Storage // iData lifespan and storage format
, hst :: !HSt // iData state
......@@ -54,8 +55,9 @@ startTask thisUser taska hst
B [] "Your page is not up-to date!",Br]],hst)
# (a,{html,hst}) = taska { tasknr = []
, activated = True
, myId = thisUser
, html = thisUser @@: BT []
, userId = thisUser
, myId = defaultUser
, html = defaultUser @@: BT []
, hst = hst
, storageInfo = {tasklife = Session, taskstorage = PlainString, taskmode = Edit }}
# (pversion,hst) = mkStoreForm (Init, pFormId userVersionNr 0) inc hst
......@@ -562,6 +564,9 @@ where
myId :: TSt -> (Int,TSt)
myId tst=:{myId} = (myId,tst)
userId :: TSt -> (Int,TSt)
userId tst=:{userId} = (userId,tst)
// debugging code
print_graph :: !a -> Bool;
......
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