Commit 4e18fe74 authored by Rinus Plasmeijer's avatar Rinus Plasmeijer
Browse files

time asking tasks now use new timer module

time stamp added when tasks are created...

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/branches/fancyTasks@233 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent e46b77ce
......@@ -64,8 +64,8 @@ instance - HtmlTime
// special's
:: HtmlDate = Date Int Int Int // Day Month Year
:: HtmlTime = Time Int Int Int // Hours Minutes Seconds
:: HtmlDate = HtmlDate Int Int Int // Day Month Year
:: HtmlTime = HtmlTime Int Int Int // Hours Minutes Seconds
:: RefreshTimer = RefreshTimer Int // The editor for this type refreshes it's form after n milliseconds
......
......@@ -328,25 +328,34 @@ where
// time and date
import Time
getTimeAndDate :: !*HSt -> *(!(!HtmlTime,!HtmlDate),!*HSt)
getTimeAndDate hst=:{world = world=:{worldC}}
# (tm,worldC) = localTime worldC
= ((HtmlTime tm.hour tm.min tm.sec,HtmlDate tm.mday tm.mon tm.year),{hst & world = {world & worldC = worldC}})
/*
import StdTime
getTimeAndDate :: !*HSt -> *(!(!HtmlTime,!HtmlDate),!*HSt)
getTimeAndDate hst
# (time,hst) = accWorldHSt getCurrentTime hst
# (date,hst) = accWorldHSt getCurrentDate hst
= ((Time time.hours time.minutes time.seconds,Date date.day date.month date.year),hst)
= ((HtmlTime time.hours time.minutes time.seconds,HtmlDate date.day date.month date.year),hst)
*/
gForm {|HtmlTime|} (init,formid) hst
= specialize (flip mkBimapEditor {map_to = toPullDown, map_from = fromPullDown}) (init,formid <@ nPage) hst
where
nPage = if (formid.lifespan == Client) Client Page
toPullDown (Time h m s) = (hv,mv,sv)
toPullDown (HtmlTime h m s) = (hv,mv,sv)
where
hv = PullDown (1, defpixel/2) (h,[toString i \\ i <- [0..23]])
mv = PullDown (1, defpixel/2) (m,[toString i \\ i <- [0..59]])
sv = PullDown (1, defpixel/2) (s,[toString i \\ i <- [0..59]])
fromPullDown (hv,mv,sv) = Time (convert hv) (convert mv) (convert sv)
fromPullDown (hv,mv,sv) = HtmlTime (convert hv) (convert mv) (convert sv)
where
convert x = toInt (toString x)
......@@ -354,7 +363,7 @@ gForm {|HtmlDate|} (init,formid) hst
= specialize (flip mkBimapEditor {map_to = toPullDown, map_from = fromPullDown}) (init,formid <@ nPage) hst
where
nPage = if (formid.lifespan == Client) Client Page
toPullDown (Date d m y) = (dv,mv,yv)
toPullDown (HtmlDate d m y) = (dv,mv,yv)
where
dv = PullDown (1, defpixel/2) (md-1, [toString i \\ i <- [1..31]])
mv = PullDown (1, defpixel/2) (mm-1, [toString i \\ i <- [1..12]])
......@@ -364,7 +373,7 @@ where
md = if (d >= 1 && d <= 31) d 1
mm = if (m >= 1 && m <= 12) m 1
fromPullDown (dv,mv,yv) = Date (convert dv) (convert mv) (convert yv)
fromPullDown (dv,mv,yv) = HtmlDate (convert dv) (convert mv) (convert yv)
where
convert x = toInt (toString x)
......@@ -456,25 +465,25 @@ where
(==) _ _ = False
derive gLexOrd HtmlTime, HtmlDate
instance + HtmlTime where (+) (Time h1 m1 s1) (Time h2 m2 s2)
= Time (h1 + h2) (m1 + m2) (s1 + s2)
instance - HtmlTime where (-) (Time h1 m1 s1) (Time h2 m2 s2)
= Time (h1 - h2) (m1 - m2) (s1 - s2)
instance + HtmlTime where (+) (HtmlTime h1 m1 s1) (HtmlTime h2 m2 s2)
= HtmlTime (h1 + h2) (m1 + m2) (s1 + s2)
instance - HtmlTime where (-) (HtmlTime h1 m1 s1) (HtmlTime h2 m2 s2)
= HtmlTime (h1 - h2) (m1 - m2) (s1 - s2)
instance < HtmlTime
where
(<) (Time h1 m1 s1) (Time h2 m2 s2)
(<) (HtmlTime h1 m1 s1) (HtmlTime h2 m2 s2)
| h1 <> h2 = h1 < h2
| m1 <> m2 = m1 < m2
= s1 < s2
instance < HtmlDate
where
(<) (Date d1 m1 y1) (Date d2 m2 y2)
(<) (HtmlDate d1 m1 y1) (HtmlDate d2 m2 y2)
| y1 <> y2 = y1 < y2
| m1 <> m2 = m1 < m2
= d1 < d2
instance toString HtmlTime where
toString (Time hrs min sec) = toString hrs <+++ ":" <+++ min <+++ ":" <+++ sec
toString (HtmlTime hrs min sec) = toString hrs <+++ ":" <+++ min <+++ ":" <+++ sec
instance toString HtmlDate where
toString (Date day month year) = toString day <+++ "/" <+++ month <+++ "/" <+++ year
toString (HtmlDate day month year) = toString day <+++ "/" <+++ month <+++ "/" <+++ year
......@@ -4,21 +4,31 @@ import StdEnv
import Http
import Text
import JSON
import Time
import iDataHandler
import TaskTree, TaskTreeFilters
import TaskTree, TaskTreeFilters, InternaliTasksCommon
:: WorkListItem = { taskid :: String //Task id of the work item
, for :: String //Label of the user who issued the work
, subject :: String //Short description of the work
}
:: WorkListItem = { taskid :: String // Task id of the work item
/* from */ , for :: String // Id of the user who issued the work
, processname :: String // Name given to the work process the task belongs to
, subject :: String // Name give to the task, which can be a short description of the work to do
, priority :: TaskPriority // Priority of the task
, timestamp :: Time // Time stamp when the task was issued
}
derive JSONEncode WorkListItem
derive JSONEncode WorkListItem, Time, TaskPriority
handleWorkListRequest :: !(Task a) !HTTPRequest *HSt -> (!HTTPResponse, !*HSt) | iData a
handleWorkListRequest mainTask request hst
# thisUserId = 0 // has to be fetched from the request in the future
# (toServer, htmlTree, maybeError, hst) = calculateTaskTree thisUserId mainTask hst // Calculate the TaskTree given the id of the current user
# worklist = [{taskid = toString mytaskdescr.taskNrId, for = toString mytaskdescr.delegatorId, subject = mytaskdescr.worflowLabel +++ " " +++ mytaskdescr.taskLabel}
# worklist = [ { taskid = toString mytaskdescr.taskNrId
, for = toString mytaskdescr.delegatorId
, processname = mytaskdescr.worflowLabel
, subject = mytaskdescr.taskLabel
, priority = NormalPriority
, timestamp = Time 0
}
\\ mytaskdescr <- collectTaskList (\taskdescr -> taskdescr.taskWorkerId == thisUserId) htmlTree
]
......
......@@ -15,5 +15,5 @@ handleWorkTabRequest mainTask request hst
# taskId = http_getValue "taskid" request.arg_get "error" // fetch task id of the tab selecetd
# (toServer, htmlTree, maybeError, hst) = calculateTaskTree thisUserId mainTask hst // calculate the TaskTree given the id of the current user
# (htmlcode,hst) = determineTaskForTab thisUserId taskId htmlTree hst // filter out the code to display in this tab
# htmlstring = toString (print_to_stdout htmlcode [#!])
# htmlstring = toString (print_to_stdout htmlcode [#!]) // convert to string
= ({http_emptyResponse & rsp_data = htmlstring},hst)
\ No newline at end of file
......@@ -8,6 +8,7 @@ definition module InternaliTasksCommon
//
import iDataFormData
import iTasksSettings
import Time
derive gForm TCl
......@@ -63,9 +64,12 @@ derive write TCl
, processNr :: !ProcessNr // entry in process table
, worflowLabel :: !WorkflowLabel // name of the workflow
, taskLabel :: !String // name of the task
, timeCreated :: !Time
, taskPriority :: !TaskPriority
}
:: HtmlCode :== ![BodyTag] // for prompting /inting html code
:: TaskNrId :== String
:: TaskPriority = HighPriority | NormalPriority | LowPriority
instance == GarbageCollect
......
......@@ -14,9 +14,10 @@ import iTasksTypes, iTasksLiftingCombinators
import InternaliTasksThreadHandling
import GenBimap
derive gForm Maybe, []
derive gUpd Maybe, []
derive gPrint Maybe
derive gForm Maybe, [], Time
derive gUpd Maybe, [], Time
derive gPrint Maybe, Time
derive gParse Time
// ******************************************************************************************************
......@@ -110,6 +111,7 @@ assignTaskTo nuserId (taskname,taska) = assignTaskTo`
where
assignTaskTo` tst=:{html=ohtml,tasknr,activated,userId,workflowLink=(_,(_,processNr,workflowLabel))}
| not activated = (createDefault,tst)
# (currtime,tst) = appWorldOnce "time" time tst
# tst = IF_Ajax (administrateNewThread userId tst) tst
# (a,tst=:{html=nhtml,activated}) = IF_Ajax (UseAjax @>> taska) taska {tst & html = BT [],userId = nuserId} // activate task of indicated user
| activated = (a,{tst & activated = True // work is done
......@@ -121,7 +123,9 @@ where
, taskNrId = showTaskNr tasknr
, processNr = processNr
, worflowLabel = workflowLabel
, taskPriority = NormalPriority
, taskLabel = taskname
, timeCreated = currtime
} @@: nhtml)
})
......
......@@ -112,6 +112,8 @@ where
, processNr = 0 // entry in process table
, worflowLabel = defaultWorkflowName // name of the workflow
, taskLabel = "main" // name of the task
, taskPriority = NormalPriority
, timeCreated = Time 0
}
collect :: !UserId !UserId ![(!ProcessNr,!WorkflowLabel,!TaskLabel,![BodyTag])] !HtmlTree -> (![BodyTag],![(!ProcessNr,!WorkflowLabel,!TaskLabel,![BodyTag])])
......
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