Commit 0461c5e2 authored by Bas Lijnse's avatar Bas Lijnse

Added mechanism for starting new processes with the user interface.

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/branches/fancyTasks@349 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 3518bf2a
......@@ -82,7 +82,25 @@ div.loginWindow {
background-position: top;
background-repeat: repeat-x;
}
/* NEW WORK LIST STYLES */
ul.newwork {
font-size: 11px;
list-style: none;
padding: 0px;
}
ul.newwork li {
padding: 0px 0px 0px 18px;
background-repeat: no-repeat;
height: 16px;
margin: 0px 0px 2px 0px;
}
ul.newwork a {
color: #000;
text-decoration: underline;
}
ul.newwork a:hover {
color: #f90;
}
/* WORK LIST PANEL STYLES */
div.treegrid {
position: absolute;
......@@ -216,6 +234,7 @@ div.trace th {
text-align: left;
padding: 2px;
}
/* WELCOME SCREEN STYLES */
#welcome {
background: url('../img/welcome/bg.png') top repeat-x;
......
......@@ -35,9 +35,9 @@ itasks.ApplicationPanel = Ext.extend(Ext.Panel, {
minWidth: 200,
maxWidth: 400,
items: [
{xtype: 'itasks.debug', id: 'debugpanel' },
{xtype: 'itasks.cwpanel' },
{xtype: 'itasks.nwpanel' }
{xtype: 'itasks.nwpanel', id: 'newpanel' },
//{xtype: 'itasks.cwpanel' },
{xtype: 'itasks.debug', id: 'debugpanel' }
]
},{
id: 'centerpanel',
......@@ -67,13 +67,18 @@ itasks.ApplicationPanel = Ext.extend(Ext.Panel, {
//Initializing the gui...
var apppanel = this;
var worklist = this.getComponent('centerpanel').getComponent('worklist');
var worktabs = this.getComponent('centerpanel').getComponent('worktabs');
var debugpanel = this.getComponent('leftpanel').getComponent('debugpanel');
var newpanel = this.getComponent('leftpanel').getComponent('newpanel');
//Set worklist applicationPanel reference and refresh
worklist.setApplicationPanel(apppanel);
worklist.refresh();
newpanel.setApplicationPanel(apppanel);
newpanel.refresh();
//Connect event handlers
worklist.on('cellclick',function (grid,row,col,event) {
......@@ -88,6 +93,12 @@ itasks.ApplicationPanel = Ext.extend(Ext.Panel, {
},this);
newtab.refresh();
});
newpanel.on('processStarted',function(startTask) {
worklist.refresh();
//TODO: Automatically open a tab
},this);
debugpanel.getTaskForestButton().on('click',function() {
worktabs.openTaskForestTab(apppanel);
});
......
......@@ -5,15 +5,93 @@ Ext.ns('itasks');
itasks.NewWorkPanel = Ext.extend(Ext.Panel, {
applicationPanel: undefined,
initComponent: function() {
Ext.apply(this, {
title: 'Start new work',
iconCls: 'icon-newwork',
html: 'This panel will be used to start new work',
bodyStyle: 'padding: 5px'
bodyStyle: 'padding: 10px 0px 0px 15px;'
});
itasks.NewWorkPanel.superclass.initComponent.apply(this,arguments);
},
setApplicationPanel: function (panel) {
this.applicationPanel = panel;
},
refresh: function() {
//Add the session id
params = this.applicationPanel.addSessionParam({});
//Send the data to the server
Ext.Ajax.request({
url: 'handlers/new/list',
method: "GET",
params: params,
scripts: false,
callback: this.processList,
scope: this
});
},
processList: function (el,success,response,options) {
if(success) {
var data = Ext.decode(response.responseText);
//Check for session errors.
this.applicationPanel.checkSessionResponse(data);
//Build the html
var list = this.body.createChild({tag: 'ul', cls: 'newwork'});
//var html = "";
var num = data.length;
for(var i = 0; i < num; i++) {
var label = data[i].label;
var icon = data[i].icon;
var li = list.createChild({tag: 'li', cls : 'icon-' + icon, children: [
{tag: 'a', href: '#', html: label}
]});
//Attach click handler
li.on('click', function(el,evt,options) {
this.startWork(options.flowLabel);
},this,{flowLabel : label});
}
}
},
startWork: function (workflow) {
var params = {workflow: workflow};
//Add the session id
params = this.applicationPanel.addSessionParam(params);
//Send the data to the server
Ext.Ajax.request({
url: 'handlers/new/start',
method: "GET",
params: params,
scripts: false,
callback: this.processStart,
scope: this
});
},
processStart: function (el,success,response,options) {
if(success) {
var data = Ext.decode(response.responseText);
//Check for session errors.
this.applicationPanel.checkSessionResponse(data);
//Fire event
this.fireEvent('processStarted',data.taskid);
}
}
});
......
......@@ -15,7 +15,7 @@ itasks.WorkListPanel = Ext.extend(Ext.ux.grid.livegrid.GridPanel, {
direction: 'ASC'
},
proxy: new Ext.data.HttpProxy({
url: 'handlers/worklist'
url: 'handlers/work/list'
}),
reader: new Ext.ux.grid.livegrid.JsonReader({
root: 'worklist',
......
......@@ -148,10 +148,21 @@ itasks.WorkTabPanel = Ext.extend(Ext.Panel, {
//Determine in which panel the new content must be put
this.setNextContentPanel(trace);
//Fill the content and trace panels
this.setupContentPanel(trace, data);
this.setupTracePanels(trace, data);
//Create content
if (data.error != null) {
this.autoClose(this.makeErrorMessage(data.error), 5);
} else if(data.status == 'TaskFinished') { //Check if the task is done
this.fireEvent('taskfinished', this.id);
this.autoClose(this.makeFinishedMessage(), 5);
} else if(data.status == 'TaskDeleted') {
this.fireEvent('taskdeleted', this.id);
this.autoClose(this.makeDeletedMessage(), 5);
} else {
//Fill the content and trace panels
this.setupContentPanel(trace, data);
this.setupTracePanels(trace, data);
}
//Hide the current content panel and switch to new content
this.switchContentPanels(trace);
......@@ -423,7 +434,7 @@ itasks.WorkTabPanel = Ext.extend(Ext.Panel, {
//Send the data to the server
Ext.Ajax.request({
url: 'handlers/work?taskid=' + this.id,
url: 'handlers/work/tab?taskid=' + this.id,
method: "POST",
params: params,
scripts: false,
......
definition module NewListHandler //iTasks.Handlers.NewListHandler
import Http, Session
import InternaliTasksCommon
/**
* Handles the ajax requests from the 'start new work' panel.
*/
handleNewListRequest :: !HTTPRequest !Session *HSt -> (!HTTPResponse, !*HSt)
\ No newline at end of file
implementation module NewListHandler
import StdEnv
import Http, Session
import JSON
import InternaliTasksCommon
:: NewWorkItem = { icon :: String // An icon name. The actual icon image is defined in the css.
, label :: String // A label of the workflow that is started
}
derive JSONEncode NewWorkItem
handleNewListRequest :: !HTTPRequest !Session *HSt -> (!HTTPResponse, !*HSt)
handleNewListRequest request session hst
= ({http_emptyResponse & rsp_data = toJSON itemlist}, hst)
where
itemlist = [ {icon = "editTask", label = "Workflow 1"}
, {icon = "editTask", label = "Workflow 2"}
]
definition module NewStartHandler //iTasks.Handlers.NewListHandler
import Http, Session
import InternaliTasksCommon
/**
* Handles the ajax requests from the 'start new work' panel.
*/
handleNewStartRequest :: !HTTPRequest !Session *HSt -> (!HTTPResponse, !*HSt)
\ No newline at end of file
implementation module NewStartHandler
import StdEnv
import Http, Session
import JSON
import InternaliTasksCommon
:: NewWorkItem = { icon :: String // An icon name. The actual icon image is defined in the css.
, label :: String // A label of the workflow that is started
}
derive JSONEncode NewWorkItem
handleNewStartRequest :: !HTTPRequest !Session *HSt -> (!HTTPResponse, !*HSt)
handleNewStartRequest request session hst
= ({http_emptyResponse & rsp_data = response}, hst)
where
workflow = http_getValue "workflow" request.arg_get ""
response = "{\"success\" : true, \"taskid\": \"" +++ taskid workflow +++ "\"}"
taskid "Workflow 1" = "123.0"
taskid "Workflow 2" = "32.0"
\ No newline at end of file
......@@ -13,7 +13,7 @@ import iTasksSettings, InternaliTasksCommon, InternaliTasksThreadHandling
import BasicCombinators, iTasksProcessHandling
import Http, HttpUtil, HttpServer, HttpTextUtil, sapldebug
import IndexHandler, AuthenticationHandler, DeauthenticationHandler, FilterListHandler, WorkListHandler, WorkTabHandler //iTasks.Framework.Handlers.*
import IndexHandler, AuthenticationHandler, DeauthenticationHandler, NewListHandler, NewStartHandler, FilterListHandler, WorkListHandler, WorkTabHandler //iTasks.Framework.Handlers.*
import TaskTreeForestHandler, ProcessTableHandler, ThreadTableHandler
import TaskTree, TaskTreeFilters
......@@ -63,8 +63,10 @@ startServer mainTask world
,((==) ("/" +++ ThisExe +++ "/handlers/authenticate"), handleAnonRequest handleAuthenticationRequest)
,((==) ("/" +++ ThisExe +++ "/handlers/deauthenticate"), handleSessionRequest handleDeauthenticationRequest)
,((==) ("/" +++ ThisExe +++ "/handlers/filters"), handleFilterListRequest)
,((==) ("/" +++ ThisExe +++ "/handlers/worklist"), handleSessionRequest (handleWorkListRequest mainTask))
,((==) ("/" +++ ThisExe +++ "/handlers/work"), handleSessionRequest (handleWorkTabRequest mainTask))
,((==) ("/" +++ ThisExe +++ "/handlers/new/list"), handleSessionRequest handleNewListRequest)
,((==) ("/" +++ ThisExe +++ "/handlers/new/start"), handleSessionRequest handleNewStartRequest)
,((==) ("/" +++ ThisExe +++ "/handlers/work/list"), handleSessionRequest (handleWorkListRequest mainTask))
,((==) ("/" +++ ThisExe +++ "/handlers/work/tab"), handleSessionRequest (handleWorkTabRequest mainTask))
,((==) ("/" +++ ThisExe +++ "/handlers/tasktreeforest"), handleSessionRequest (handleTaskTreeForestRequest mainTask))
,((==) ("/" +++ ThisExe +++ "/handlers/processtable"), handleSessionRequest (handleProcessTableRequest mainTask))
,((==) ("/" +++ ThisExe +++ "/handlers/threadtable"), handleSessionRequest (handleThreadTableRequest mainTask))
......
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