Commit 535db532 authored by Rinus Plasmeijer's avatar Rinus Plasmeijer

made an attempt to tell why a task cannot be found:

it can be finished or it can be deleted

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/branches/fancyTasks@305 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 45d2ef43
......@@ -30,7 +30,7 @@ handleWorkListRequest mainTask request session hst
, priority = mytaskdescr.taskPriority
, timestamp = (\(Time i) -> i) mytaskdescr.timeCreated
}
\\ mytaskdescr <- determineTaskList thisUserId htmlTree
\\ mytaskdescr <- determineTaskList thisUserId htmlTree | not mytaskdescr.curStatus
]
= ({http_emptyResponse & rsp_data = toJSON worklist}, hst)
......
......@@ -29,7 +29,7 @@ handleWorkTabRequest mainTask request session hst
# taskId = http_getValue "taskid" request.arg_get "error" // fetch task id of the tab selecetd
# (toServer, htmlTree, maybeError, maybeProcessTable, maybeThreadTable, hst)
= calculateTaskTree thisUserId True True True mainTask hst // calculate the TaskTree given the id of the current user
# (taskDone,html,inputs) = determineTaskForTab thisUserId taskId htmlTree // filter out the code and inputs to display in this tab
# (taskStatus,html,inputs) = determineTaskForTab thisUserId taskId htmlTree // filter out the code and inputs to display in this tab
# (htmlstates,hst) = getPageStates hst // Collect states that must be temporarily stored in the browser
# hst =: {states} = storeStates hst // Write states that are stored on the server
......@@ -38,14 +38,19 @@ handleWorkTabRequest mainTask request session hst
# (updateTrace,states) = mbUpdateTrace request states
# subTreeTrace = mbSubTreeTrace request thisUserId taskId htmlTree
# activeTasks = if taskDone
# activeTasks = if (taskStatus == TaskFinished || taskStatus == TaskDeleted)
(Just [ mytaskdescr.taskNrId
\\ mytaskdescr <- determineTaskList thisUserId htmlTree
])
Nothing
# tempMessage = case taskStatus of
TaskFinished -> "TaskFinished"
TaskDeleted -> "TaskDeleted"
TaskActivated -> "TaskActivated"
# content =
{TabContent
| done = taskDone
| done = taskStatus == TaskFinished || taskStatus == TaskDeleted
, error = maybeError
, html = toString (DivTag [IdAttr ("itasks-tab-" +++ taskId)] html)
, inputs = inputs
......
......@@ -116,7 +116,16 @@ where
# (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 }) // plus new one tagged
, html = ohtml +|+ ( { delegatorId = userId
, taskWorkerId = nuserId
, taskNrId = toStringTaskNr tasknr
, processNr = processNr
, worflowLabel = workflowLabel
, taskPriority = NormalPriority
, taskLabel = taskname
, timeCreated = currtime
, curStatus = activated
} @@: BT [] [])}) // plus new one tagged
= (a,{tst & userId = userId // restore user Id
, html = ohtml +|+ ( { delegatorId = userId
, taskWorkerId = nuserId
......@@ -126,6 +135,7 @@ where
, taskPriority = NormalPriority
, taskLabel = taskname
, timeCreated = currtime
, curStatus = activated
} @@: nhtml)
})
......
......@@ -64,6 +64,7 @@ import HSt
, taskLabel :: !String // name of the task
, timeCreated :: !Time
, taskPriority :: !TaskPriority
, curStatus :: !Bool
}
:: TaskNrId :== String
......
......@@ -2,8 +2,12 @@ definition module TaskTreeFilters
import iTasksTypes
:: TaskStatus = TaskFinished | TaskActivated | TaskDeleted
instance == TaskStatus
determineTaskList :: !UserId !HtmlTree -> [TaskDescription]
determineTaskForTab :: !UserId !TaskNrId !HtmlTree -> (!Bool,![HtmlTag],![InputId])
determineTaskForTab :: !UserId !TaskNrId !HtmlTree -> (!TaskStatus,![HtmlTag],![InputId])
mkFilteredTaskTree :: !UserId !UserId !HtmlTree -> (![HtmlTag],![InputId])
mkUnfilteredTaskTree :: !HtmlTree -> (![HtmlTag],![InputId])
......
......@@ -4,6 +4,16 @@ import StdEnv
import iDataFormlib
import InternaliTasksCommon, iTasksHtmlSupport
:: TaskStatus = TaskFinished | TaskActivated | TaskDeleted
instance == TaskStatus
where
(==) TaskFinished TaskFinished = True
(==) TaskActivated TaskActivated = True
(==) TaskDeleted TaskDeleted = True
(==) _ _ = False
determineTaskList :: !UserId !HtmlTree -> [TaskDescription]
determineTaskList thisuser (taskdescr @@: tree)
# collected = determineTaskList thisuser tree
......@@ -26,14 +36,18 @@ determineTaskList thisuser (DivCode id tree)
determineTaskList thisuser (TaskTrace traceinfo tree)
= determineTaskList thisuser tree
determineTaskForTab :: !UserId !TaskNrId !HtmlTree -> (!Bool,![HtmlTag],![InputId])
determineTaskForTab :: !UserId !TaskNrId !HtmlTree -> (!TaskStatus,![HtmlTag],![InputId])
determineTaskForTab thisuser thistaskid tree
= case determineTaskTree thisuser thistaskid tree of //Find the subtree by task id
Nothing
= (True, [], []) //Subtask not found, nothing to do anymore
= (TaskDeleted, [], []) //Subtask not found, nothing to do anymore
Just tree
# (html,inputs) = mkFilteredTaskTree thisuser thisuser tree //Collect only the parts for the current user
= (False, html, inputs)
= (test tree, html, inputs)
where
test (description @@: html)
| description.taskNrId == thistaskid && description.curStatus = TaskFinished
= TaskActivated
determineTaskTree :: !UserId !TaskNrId !HtmlTree -> Maybe HtmlTree
determineTaskTree thisuser thistaskid (taskdescr @@: tree)
......
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