Commit 590278de authored by Bas Lijnse's avatar Bas Lijnse

Replaced newlisthandler and newstarthandler with the workflow and task service

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@1110 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 4c7d401d
......@@ -3,6 +3,35 @@
*/
Ext.ns("itasks");
itasks.NewWorkTreeLoader = Ext.extend(Ext.tree.TreeLoader, {
load: function (node, callback, scope) {
this.dataUrl = "/services/json/workflows" + (node.id == "_ROOT_" ? "" : "/" + node.id);
itasks.NewWorkTreeLoader.superclass.load.apply(this,arguments);
},
processResponse: function (response, node, callback, scope) {
try {
var o = Ext.decode(response.responseText);
node.beginUpdate();
for(var i = 0, len = o.workflows.length; i < len; i++ ) {
var wf = o.workflows[i];
var n = this.createNode({ id : wf.name
, text: wf.label
, iconCls: wf.folder ? "icon-folder" : "icon-workflow"
, leaf: ! wf.folder
, singleClickExpand: true
});
if(n) {
node.appendChild(n);
}
}
node.endUpdate();
this.runCallback(callback, scope || node, [node]);
} catch(e) {
handleFailure(response);
}
}
});
itasks.NewWorkPanel = Ext.extend(Ext.tree.TreePanel ,{
initComponent: function() {
......@@ -10,10 +39,8 @@ itasks.NewWorkPanel = Ext.extend(Ext.tree.TreePanel ,{
Ext.apply(this, {
title: "New task...",
iconCls: "icon-newwork",
loader: new Ext.tree.TreeLoader({
dataUrl: itasks.config.serverUrl + "/new/list",
baseParams: {_session: itasks.app.session},
requestMethod: "POST"
loader: new itasks.NewWorkTreeLoader({
baseParams: {_session: itasks.app.session}
}),
root: {text: "_ROOT_", nodeType: "async", id: "_ROOT_", expanded: true},
rootVisible: false,
......@@ -31,7 +58,7 @@ itasks.NewWorkPanel = Ext.extend(Ext.tree.TreePanel ,{
Ext.Ajax.request({
method: "POST",
url: itasks.config.serverUrl + "/new/start",
url: "/services/json/tasks/create",
params: {_session: itasks.app.session, workflow: workflow},
scripts: false,
callback: this.startWorkflowCB,
......@@ -40,9 +67,8 @@ itasks.NewWorkPanel = Ext.extend(Ext.tree.TreePanel ,{
},
startWorkflowCB: function(el, success, response, options){
try {
var data = Ext.decode(response.responseText);
this.fireEvent("processStarted",data.taskid);
var o = Ext.decode(response.responseText);
this.fireEvent("processStarted",o.taskId);
} catch(SyntaxError) {}
}
});
......
......@@ -16,7 +16,8 @@ from HttpServer import :: HTTPServerControl(..), :: HTTPServerOption(..)
import Setup
//import AuthenticationHandler, DeauthenticationHandler
import NewListHandler, NewStartHandler, WorkListHandler, WorkTabHandler, PropertyHandler, UserListHandler
//import NewListHandler, NewStartHandler, WorkListHandler
import WorkTabHandler, PropertyHandler, UserListHandler
import TaskTreeForestHandler, ProcessTableHandler
import RPCHandlers
......@@ -44,9 +45,9 @@ where
//'old' handlers
//,((==) (config.serverPath +++ "/authenticate"), handleAnonRequest config flows handleAuthenticationRequest)
//,((==) (config.serverPath +++ "/deauthenticate"), handleSessionRequest config flows handleDeauthenticationRequest)
,((==) (config.serverPath +++ "/new/list"), handleSessionRequest config flows handleNewListRequest)
,((==) (config.serverPath +++ "/new/start"), handleSessionRequest config flows handleNewStartRequest)
,((==) (config.serverPath +++ "/work/list"), handleSessionRequest config flows handleWorkListRequest)
//,((==) (config.serverPath +++ "/new/list"), handleSessionRequest config flows handleNewListRequest)
//,((==) (config.serverPath +++ "/new/start"), handleSessionRequest config flows handleNewStartRequest)
//,((==) (config.serverPath +++ "/work/list"), handleSessionRequest config flows handleWorkListRequest)
,((==) (config.serverPath +++ "/work/tab"), handleSessionRequest config flows handleWorkTabRequest)
,((==) (config.serverPath +++ "/work/property"), handleSessionRequest config flows handlePropertyRequest)
,((==) (config.serverPath +++ "/data/users"), handleSessionRequest config flows handleUserListRequest)
......@@ -67,7 +68,7 @@ where
serviceDispatch config flows req world
# tst = initTSt req config flows world
# (response,tst) = case (split "/" req.req_path) of
# (response,tst) = case (split "/" (http_urldecode req.req_path)) of
["","services",format:path]
# html = format == "html"
# json = format == "json"
......
......@@ -36,8 +36,7 @@ where
params = [("_session", sessionParam, False)]
onPath paths wf
= wf.Workflow.path % (0, (size paths - 1)) == paths
onPath paths wf = paths == "" || (wf.Workflow.path % (0, (size paths))) == paths +++ "/"
//Allow the root user
isAllowed RootUser _ = True
......@@ -47,7 +46,7 @@ where
isAllowed _ wf = isEmpty wf.Workflow.roles
workflowItems path user workflows
# paths = join "/" path
# paths = join "/" path
= removeDup [workflowItem paths wf \\ wf <- workflows | onPath paths wf && isAllowed user wf]
workflowItem paths wf
# shortPath = wf.Workflow.path % (if (paths == "") 0 (size paths + 1), size wf.Workflow.path)
......@@ -56,4 +55,4 @@ where
= {WorkflowItem | name = wf.Workflow.path, label = shortPath, folder = False}
| otherwise
# label = shortPath % (0, slashPos - 1)
= {WorkflowItem | name = if (paths == "") label (paths +++ "/" +++ label), label = label, folder = True}
= {WorkflowItem | name = if (paths == "") label (paths +++ "/" +++ label), label = label, folder = True}
\ 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