users assignment (continue)

This commit is contained in:
Erik Amaru Ortiz
2011-02-22 23:22:50 +00:00
parent ea617b4f07
commit 282c491797
5 changed files with 601 additions and 195 deletions

View File

@@ -147,4 +147,61 @@ class TaskUser extends BaseTaskUser {
return $aRows;
}
//erik: new functions
function getUsersTask($TAS_UID, $TU_TYPE=1){
require_once 'classes/model/Users.php';
$groupsTask = array();
$usersTask = array();
//getting task's users
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$criteria->addSelectColumn(UsersPeer::USR_USERNAME);
$criteria->addSelectColumn(TaskUserPeer::TAS_UID);
$criteria->addSelectColumn(TaskUserPeer::USR_UID);
$criteria->addSelectColumn(TaskUserPeer::TU_TYPE);
$criteria->addSelectColumn(TaskUserPeer::TU_RELATION);
$criteria->addJoin(TaskUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
$criteria->add(TaskUserPeer::TAS_UID, $TAS_UID);
$criteria->add(TaskUserPeer::TU_TYPE, $TU_TYPE);
$criteria->add(TaskUserPeer::TU_RELATION, 1);
$dataset = TaskUserPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($dataset->next())
$usersTask[] = $dataset->getRow();
//getting task's groups
$delimiter = DBAdapter::getStringDelimiter ();
$criteria = new Criteria('workflow');
$criteria->addAsColumn('GRP_TITLE', 'CONTENT.CON_VALUE');
$criteria->addSelectColumn(TaskUserPeer::TAS_UID);
$criteria->addSelectColumn(TaskUserPeer::USR_UID);
$criteria->addSelectColumn(TaskUserPeer::TU_TYPE);
$criteria->addSelectColumn(TaskUserPeer::TU_RELATION);
$aConditions[] = array(TaskUserPeer::USR_UID, 'CONTENT.CON_ID');
$aConditions[] = array('CONTENT.CON_CATEGORY', $delimiter . 'GRP_TITLE' . $delimiter);
$aConditions[] = array('CONTENT.CON_LANG', $delimiter . SYS_LANG . $delimiter);
$criteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
$criteria->add(TaskUserPeer::TAS_UID, $TAS_UID);
$criteria->add(TaskUserPeer::TU_TYPE, $TU_TYPE);
$criteria->add(TaskUserPeer::TU_RELATION, 2);
$dataset = TaskUserPeer::doSelectRS($criteria);
$dataset = TaskUserPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while( $dataset->next() )
$usersTask[] = $dataset->getRow();
$result->data = $usersTask;
$result->totalCount = sizeof($usersTask);
return $result;
}
} // TaskUser

View File

@@ -150,12 +150,10 @@ class Ajax
{
require_once 'classes/model/Users.php';
G::LoadClass('configuration');
$search = isset($params['search']) ? $params['search']: null;
$users = Users::getAll($params['start'], $params['limit'], $search);
$conf = new Configurations;
$search = isset($params['search']) ? $params['search']: null;
$users = Users::getAll($params['start'], $params['limit'], $search);
foreach($users->data as $i=>$user){
$users->data[$i]['USER'] = $conf->getEnvSetting(
@@ -179,6 +177,124 @@ class Ajax
print G::json_encode($groups);
}
function assignUsersTask($param)
{
try{
require_once 'classes/model/TaskUser.php';
$oTaskUser = new TaskUser();
$UIDS = explode(',', $param['UIDS']);
$TU_TYPE = 1;
foreach( $UIDS as $UID ) {
if ($_POST['TU_RELATION'] == 1 )
$oTaskUser->create(array('TAS_UID' => $param['TAS_UID'], 'USR_UID' => $UID, 'TU_TYPE' => $TU_TYPE, 'TU_RELATION' => 1));
else
$oTaskUser->create(array('TAS_UID' => $param['TAS_UID'], 'USR_UID' => $UID, 'TU_TYPE' => $TU_TYPE, 'TU_RELATION' => 2));
}
$result->success = true;
$result->msg = '';
} catch(Exception $e){
$result->success = false;
$result->msg = $e->getMessage();
}
print G::json_encode($result);
}
function removeUsersTask($param)
{
try{
require_once 'classes/model/TaskUser.php';
$oTaskUser = new TaskUser();
$USR_UIDS = explode(',', $param['USR_UID']);
$TU_RELATIONS = explode(',', $param['TU_RELATION']);
$TU_TYPE = 1;
foreach($USR_UIDS as $i=>$USR_UID) {
if ($TU_RELATIONS[$i] == 1 ){
$oTaskUser->remove($param['TAS_UID'], $USR_UID, $TU_TYPE, 1);
} else {
$oTaskUser->remove($param['TAS_UID'], $USR_UID, $TU_TYPE, 2);
}
}
$result->success = true;
$result->msg = '';
} catch(Exception $e){
$result->success = false;
$result->msg = "{$TU_RELATIONS[$i]} - {$param['TAS_UID']}, {$USR_UIDS[$i]}, $TU_TYPE, 1 --> " . $e->getMessage();
}
print G::json_encode($result);
}
function getUsersTask($param)
{
require_once 'classes/model/TaskUser.php';
G::LoadClass('configuration');
$usersTaskList = Array();
$task = new TaskUser;
$conf = new Configurations;
$TU_TYPE = 1;
$usersTask = $task->getUsersTask($param['TAS_UID'], $TU_TYPE);
foreach($usersTask->data as $userTask) {
$usersTaskListItem['TAS_UID'] = $userTask['TAS_UID'];
if( $userTask['TU_RELATION'] == 1 )
$usersTaskListItem['NAME'] = $conf->getEnvSetting(
'format',
Array(
'userName'=>$userTask['USR_USERNAME'],
'firstName'=>$userTask['USR_FIRSTNAME'],
'lastName'=>$userTask['USR_LASTNAME']
)
);
else
$usersTaskListItem['NAME'] = $userTask['GRP_TITLE'];
$usersTaskListItem['TU_RELATION'] = $userTask['TU_RELATION'];
$usersTaskListItem['USR_UID'] = $userTask['USR_UID'];
$usersTaskList[] = $usersTaskListItem;
}
$result->data = $usersTaskList;
$result->totalCount = $usersTask->totalCount;
print G::json_encode($result);
}
function getProcessDetail($param){
require_once 'classes/model/Process.php';
$PRO_UID = $param['PRO_UID'];
G::loadClass('tasks');
$tasks = new Tasks();
$process = ProcessPeer::retrieveByPk($PRO_UID);
$tasksList = $tasks->getAllTasks($PRO_UID);
$rootNode->id = $process->getProUid();
$rootNode->text = $process->getProTitle();
$rootNode->leaf = false;
$rootNode->expanded =true;
foreach($tasksList as $task) {
$node = new stdClass;
$node->id = $task['TAS_UID'];
$node->text = $task['TAS_TITLE'];
$node->leaf = true;
$rootNode->children[] = $node;
}
$treeDetail[] = $rootNode;
print G::json_encode($treeDetail);
}
}

View File

@@ -225,6 +225,8 @@ Figure.prototype.onDragend=function() {
case 'bpmnSubProcess':
currObj.actiontype = 'saveTaskPosition';
currObj.workflow.savePosition(currObj);
break;
case 'bpmnAnnotation':
currObj.actiontype = 'saveTextPosition';
@@ -969,8 +971,9 @@ bpmnTask.prototype.onDoubleClick = function () {
* erik: Setting task target to Drop user & group assignment
*/
bpmnTask.prototype.onMouseEnter = function () {
if( this.type == 'bpmnTask' && typeof(Ext.getCmp('usersPanel')) != 'undefined' )
Ext.getCmp('usersPanel')._targetTask = this.id;
if( this.type == 'bpmnTask' && typeof Ext.getCmp('usersPanel') != 'undefined' ) {
Ext.getCmp('usersPanel')._targetTask = {id: this.id, name: this.taskName};
}
};
bpmnTask.prototype.trim = function (str) {

View File

@@ -10,6 +10,7 @@ new Ext.KeyMap(document, {
var saveProcess;
var usersPanel;
var _TAS_UID;
Ext.onReady ( function() {
workflow = new MyWorkflow("paintarea");
@@ -131,8 +132,8 @@ Ext.onReady ( function() {
region : "center",
layout : "border",
autoScroll: true,
height : 1000,
width : PMExt.getBrowser().screen.width,
height : 1360,
width : 1280, //PMExt.getBrowser().screen.width,
//items : [west, north, center]
items : [north, center]
});
@@ -196,7 +197,6 @@ Ext.onReady ( function() {
border:true,
shim: true,
plugin: new Ext.ux.WindowAlwaysOnTop,
items: [toolbarPanel]
/*html: '<div id="x-shapes">\n\
<p id="x-shapes-task" class="toolbar-item"><img src= "/skins/ext/images/gray/shapes/pallete/task.png"/></p>\n\
@@ -268,7 +268,7 @@ Ext.onReady ( function() {
////
usersPanelStart = 0;
usersPanelLimit = 11;
usersPanelLimit = 10;
var usersStore = new Ext.data.Store( {
autoLoad: true,
@@ -289,30 +289,24 @@ Ext.onReady ( function() {
});
var usersGrid = new Ext.grid.GridPanel({
id: 'usersGrid',
title : 'Users',
id : 'usersGrid',
title : 'Users',
height : 180,
stateful : true,
stateId : 'usersGrid',
enableColumnResize: true,
enableHdMenu: true,
//frame:false,
//columnLines: true,
ddGroup : 'task-assignment',
enableDragDrop: true,
viewConfig: {
forceFit:true
stateId : 'usersGrid',
ddGroup : 'task-assignment',
enableDragDrop : true,
viewConfig : {
forceFit : true
},
cm: new Ext.grid.ColumnModel({
cm : new Ext.grid.ColumnModel({
defaults: {
width: 200,
sortable: true
width: 200,
sortable: true
},
columns: [
columns : [
{header: 'USR_UID', id:'USR_UID', dataIndex: 'USR_UID', hidden:true, hideable:false},
{header: 'USER', dataIndex: 'USER', width: 300, renderer:function(v,p,r){
return v; //String.format("<font color='green'>{0}</font>", v);
}}
{header: 'User', dataIndex: 'USER', width: 300}
]
}),
store: usersStore,
@@ -322,23 +316,22 @@ Ext.onReady ( function() {
}
},
tbar:[
//'->',
new Ext.form.TextField ({
id: 'usersSearchTxt',
ctCls:'pm_search_text_field',
allowBlank: true,
width: 230,
emptyText: _('ID_ENTER_SEARCH_TERM'),//'enter search term',
listeners: {
id : 'usersSearchTxt',
ctCls :'pm_search_text_field',
width : 220,
allowBlank : true,
emptyText : _('ID_ENTER_SEARCH_TERM'),
listeners : {
specialkey: function(f,e){
if (e.getKey() == e.ENTER)
usersSearch();
}
}
}),{
text:'X',
ctCls:'pm_search_x_button',
handler: function(){
text : 'X',
ctCls : 'pm_search_x_button',
handler : function(){
usersStore.setBaseParam( 'search', '');
usersStore.load({params:{start : 0 , limit : usersPanelLimit}});
Ext.getCmp('usersSearchTxt').setValue('');
@@ -349,15 +342,14 @@ Ext.onReady ( function() {
}
],
bbar: [new Ext.PagingToolbar({
pageSize: usersPanelLimit,
store: usersStore,
pageSize : usersPanelLimit,
store : usersStore,
displayInfo: true,
displayMsg: '{0} - {1} of {2}',
emptyMsg: ""
displayMsg : '{2} Users',
emptyMsg : ''
})]
});
var groupsStore = new Ext.data.Store( {
autoLoad: true,
proxy : new Ext.data.HttpProxy({
@@ -374,104 +366,91 @@ Ext.onReady ( function() {
});
var groupsGrid = new Ext.grid.GridPanel({
id: 'groupsGrid',
title : 'Groups',
id : 'groupsGrid',
title : 'Groups',
stateful : true,
stateId : 'groupsGrid',
//enableColumnResize: true,
//enableHdMenu: true,
frame:false,
//columnLines: true,
ddGroup : 'task-assignment',
height: 200,
enableDragDrop: true,
viewConfig: {
forceFit:true
stateId : 'groupsGrid',
ddGroup : 'task-assignment',
height : 180,
enableDragDrop : true,
viewConfig : {
forceFit :true
},
cm: new Ext.grid.ColumnModel({
defaults: {
width: 200,
sortable: true
cm : new Ext.grid.ColumnModel({
defaults : {
width : 400,
sortable : true
},
columns: [
{header: '', id:'GRP_UID', dataIndex: 'GRP_UID', hidden:true, hideable:false},
{header: 'Group', dataIndex: 'CON_VALUE', width: 300, renderer:function(v,p,r){
return v; //String.format("<font color='green'>{0}</font>", v);
}}
{id:'GRP_UID', dataIndex: 'GRP_UID', hidden:true, hideable:false},
{header: 'Group', dataIndex: 'CON_VALUE'}
]
}),
store: groupsStore,
listeners: {
render: function(){
store : groupsStore,
listeners : {
render : function(){
this.loadMask = new Ext.LoadMask(this.body, {msg:_('ID_LOADING')});
}
},
tbar:[
//'->',
tbar : [
new Ext.form.TextField ({
id: 'groupsSearchTxt',
ctCls:'pm_search_text_field',
allowBlank: true,
width: 230,
emptyText: _('ID_ENTER_SEARCH_TERM'),//'enter search term',
listeners: {
id : 'groupsSearchTxt',
ctCls :'pm_search_text_field',
allowBlank : true,
width : 220,
emptyText : _('ID_ENTER_SEARCH_TERM'),
listeners : {
specialkey: function(f,e){
if (e.getKey() == e.ENTER)
groupsSearch();
}
}
}),{
text:'X',
ctCls:'pm_search_x_button',
handler: function(){
}), {
text :'X',
ctCls :'pm_search_x_button',
handler : function(){
groupsStore.setBaseParam( 'search', '');
groupsStore.load({params:{start : 0 , limit : usersPanelLimit}});
Ext.getCmp('groupsSearchTxt').setValue('');
}
},{
text:TRANSLATIONS.ID_SEARCH,
handler: groupsSearch
}, {
text :TRANSLATIONS.ID_SEARCH,
handler : groupsSearch
}
],
bbar: [new Ext.PagingToolbar({
pageSize: usersPanelLimit,
store: groupsStore,
pageSize : usersPanelLimit,
store : groupsStore,
displayInfo: true,
displayMsg: '{0} - {1} of {2}',
emptyMsg: ""
displayMsg : '{2} Groups',
emptyMsg : 'No records found'
})]
});
usersPanel = new Ext.Window({
id: 'usersPanel',
title: '<span style="font-size:10px; font-weight:bold; align:center;">&nbsp;Actors</span>',
headerAsText: true,
collapsed : true,
width: 302,
height:380,
id : 'usersPanel',
title : 'Actors',
width : 302,
height : 350,
//x: (PMExt.getBrowser().screen.width - designerToolbarWidth) - 5,
//y: designerToolbarHeight + 2,
x: 0,
y: 0,
minimizable: false,
maximizable: false,
closable: false,
resizable: false,
floating: true,
shadow:false,
border:false,
//html: 'userslist'
minimizable : false,
maximizable : false,
closable : false,
resizable : false,
floating : true,
shadow : false,
border : false,
items:[
new Ext.TabPanel({
id : 'usersPanelTabs',
border: true, // already wrapped so don't add another border
activeTab: 0, // second tab initially active
tabPosition: 'top',
//region:'north',
split: true,
height:350,
items: [
activeTab : 0, // second tab initially active
tabPosition : 'top',
split : true,
height : 318,
items : [
usersGrid,
groupsGrid
]
@@ -501,25 +480,58 @@ Ext.onReady ( function() {
]
});
usersPanel.on('minimize',function(w){
if( Ext.getCmp('usersPanel').collapsed )
Ext.getCmp('usersPanel').expand();
else
Ext.getCmp('usersPanel').collapse();
});
// custom variables
usersPanel._targetTask = null;
usersPanel._onDrop = function(ddSource, e, data) {
alert('tas_uid: ' + Ext.getCmp('usersPanel')._targetTask);
usersPanel._onDrop = function(ddSource, e, data) {
_TAS_UID = Ext.getCmp('usersPanel')._targetTask.id;
if( typeof parent != 'undefined' ) {
parent._TAS_UID = _TAS_UID;
}
var type = Ext.getCmp('usersPanelTabs').getActiveTab().id == 'usersGrid' ? 1 : 2;
var records = ddSource.dragData.selections;
var uids = Array();
Ext.each(records, function(gridRow){
alert('usr_uid ->'+gridRow.data.USR_UID);
if( type == 1 ) {//some users grid items were dropped
//alert('usr_uid ->'+gridRow.data.USR_UID);
uids.push(gridRow.data.USR_UID);
} else { //some groups grid items were dropped
//alert('grp_uid ->'+gridRow.data.GRP_UID);
uids.push(gridRow.data.GRP_UID);
}
});
uids = uids.join(',');
if( typeof parent != 'undefined' ) {
parent.Ext.getCmp('eastPanelCenter').setTitle(Ext.getCmp('usersPanel')._targetTask.name);
}
Ext.Ajax.request({
url: '../processes/ajaxListener',
success: function(response){
var result = Ext.util.JSON.decode(response.responseText);
if( result.success ) {
PMExt.notify('', 'Users & Groups assigned successfully!');
if( typeof parent != 'undefined' ) {
parent.Ext.getCmp('eastPanel').show();
parent.Ext.getCmp('usersTaskGrid').store.reload({params: {action:'getUsersTask', TAS_UID: _TAS_UID}});
}
} else {
PMExt.error(_('ID_ERROR'), result.msg)
}
},
failure: function(){},
params: {
action : 'assignUsersTask',
TAS_UID : _TAS_UID,
TU_RELATION : type,
UIDS : uids
}
});
}
usersPanel.on('beforeshow', function(e) {
usersPanel._posRelToView = usersPanel.getPosition(true);
usersPanel._scrollPosTimer = false;
@@ -623,7 +635,7 @@ Ext.onReady ( function() {
new Ext.ToolTip({
target: 'x-shapes-annotation',
title: 'Annotation',
anchor: 'left',
anchor: 'top',
trackMouse: true,
html: ''
});
@@ -1265,28 +1277,24 @@ Ext.onReady ( function() {
function usersSearch()
{
var search = Ext.getCmp('usersSearchTxt').getValue();
var search = Ext.getCmp('usersSearchTxt').getValue().trim();
if( search == '' ) {
PMExt.info(_('ID_INFO'), _('ID_ENTER_SEARCH_TERM'));
return;
}
Ext.getCmp('usersGrid').store.setBaseParam('search', search);
Ext.getCmp('usersGrid').store.load({params:{search: search, start : 0 , limit : usersPanelLimit }});
}
function groupsSearch()
{
var search = Ext.getCmp('groupsSearchTxt').getValue();
var search = Ext.getCmp('groupsSearchTxt').getValue().trim();
if( search == '' ) {
PMExt.info(_('ID_INFO'), _('ID_ENTER_SEARCH_TERM'));
return;
}
Ext.getCmp('groupsGrid').store.setBaseParam('search', search);
Ext.getCmp('groupsGrid').store.load({params:{search: search, start : 0 , limit : usersPanelLimit }});
}
});
Ext.ux.WindowAlwaysOnTop = function(){
this.init = function(win){
win.on('deactivate', function(){
var i=1;
this.manager.each(function(){i++});
this.setZIndex(this.manager.zseed + (i*10));
})
}
}

View File

@@ -1,27 +1,19 @@
new Ext.KeyMap(document, {
key: Ext.EventObject.F5,
fn: function(keycode, e) {
//here (in the toolbar) we are disabling the ctrl-f5
e.stopEvent();
//if (! e.ctrlKey) {
// if (Ext.isIE)
// e.browserEvent.keyCode = 8;
// e.stopEvent();
//Ext.Msg.alert('Refresh', 'You clicked: F5');
//document.location = document.location;
//}
//else
//Ext.Msg.alert('Refresh', 'You clicked: CTRL-F5');
//e.stopEvent();
}
});
var _TAS_UID;
Ext.onReady ( function() {
workflow = new MyWorkflow("paintarea");
workflow.setEnableSmoothFigureHandling(false);
workflow.scrollArea.width = 2000;
//For Undo and Redo Options
// workflow.getCommandStack().addCommandStackEventListener(new commandListener());
//Getting process id from the URL using getUrlvars function
if(typeof pro_uid !== 'undefined') {
Ext.Ajax.request({
@@ -37,6 +29,7 @@ Ext.onReady ( function() {
}
/**********************************************************************************
*
* Do the Ext (Yahoo UI) Stuff
@@ -51,44 +44,270 @@ Ext.onReady ( function() {
autoScroll : true,
collapsible :true,
split :true,
//collapseMode:'mini',
hideCollapseTool: false,
items:{
html:'<div id="x-shapes">\n\
<p id="x-shapes-task" title="Task" ><img src= "/skins/ext/images/gray/shapes/pallete/task.png"/></p>\n\
<p id="x-shapes-startEvent" title="Start"><img src= "/skins/ext/images/gray/shapes/pallete/startevent.png"/></p>\n\
<p id="x-shapes-interEvent" title="Intermediate Event"><img src= "/skins/ext/images/gray/shapes/pallete/interevent.png"/></p>\n\
<p id="x-shapes-endEvent" title="End Event"><img src= "/skins/ext/images/gray/shapes/pallete/endevent.png"/></p>\n\
<p id="x-shapes-gateways" title="Gateway"><img src= "/skins/ext/images/gray/shapes/pallete/gateway.png"/></p>\n\
<p id="x-shapes-annotation" title="Annotation"><img src= "/skins/ext/images/gray/shapes/pallete/annotation.png"/></p>\n\
<!--<p id="x-shapes-group" title="Group"><img src= "/skins/ext/images/gray/shapes/pallete/group.png"/></p>\n\
<p id="x-shapes-dataobject" title="Data Object"><img src= "/skins/ext/images/gray/shapes/pallete/dataobject.png"/></p>\n\
<p id="x-shapes-pool" title="Pool"><img src= "/skins/ext/images/gray/shapes/pallete/pool.png"/></p>\n\
<p id="x-shapes-lane" title="Lane"><img src= "/skins/ext/images/gray/shapes/pallete/lane.png"/></p>\n\
<p id="x-shapes-milestone" title="Milestone"><img src= "/skins/ext/images/gray/shapes/pallete/milestone.png"/></p>-->\n\
</div>'
}
};
var east= {
id : 'eastPanel',
title : '',
region : 'east',
width : 150,
border : false,
autoScroll : true,
collapsible :true,
split :true,
collapseMode:'mini',
hideCollapseTool: false,
items:{
html:'east panel'
html:''
}
};
var north= {
var usersTaskStore = new Ext.data.GroupingStore( {
autoLoad: false,
url: '../processes/ajaxListener',
reader : new Ext.data.JsonReader({
totalProperty: 'totalCount',
root: 'data',
fields : [
{name : 'USR_UID'},
{name : 'NAME'},
{name : 'TU_RELATION'}
]
}),
baseParams: {
action: 'getUsersTask',
TAS_UID: '4619962094d5d499f746ca7075681567'
},
groupField: 'TU_RELATION'
});
var usersTaskGrid = new Ext.grid.GridPanel({
id : 'usersTaskGrid',
title : 'Users & Groups',
height : 180,
stateful : true,
stateId : 'usersTaskGrid',
sortable:false,
view: new Ext.grid.GroupingView({
forceFit:true,
groupTextTpl: '{[values.rs.length]} {[values.rs[0].data["TU_RELATION"] == 1 ? "Users" : "Groups"]}'
//groupTextTpl: '{text}'
}),
cm : new Ext.grid.ColumnModel({
defaults: {
width: 300,
sortable: true
},
columns : [
{id:'USR_UID', dataIndex: 'USR_UID', hidden:true, hideable:false},
{header: 'Assigned', id:'TU_RELATION', dataIndex: 'TU_RELATION', hidden:true, hideable:false},
{header: 'Assigned', dataIndex: 'NAME', hideable:false}
]
}),
store: usersTaskStore,
listeners: {
render: function(){
this.loadMask = new Ext.LoadMask(this.body, {msg:_('ID_LOADING')});
}
}/*,
tbar:[
'->', {
text: _('ID_REMOVE'),
iconCls: 'button_menu_ext ss_sprite ss_delete',
handler: removeUsersTask
}
]*/,
bbar: [new Ext.PagingToolbar({
pageSize : 10,
store : usersTaskStore,
displayInfo: true,
displayMsg : '{2} Users',
emptyMsg : ''
})]
});
//connecting context menu to grid
usersTaskGrid.addListener('rowcontextmenu', onDynaformsContextMenu,this);
//by default the right click is not selecting the grid row over the mouse
//we need to set this four lines
usersTaskGrid.on('rowcontextmenu', function (grid, rowIndex, evt) {
var sm = grid.getSelectionModel();
sm.selectRow(rowIndex, sm.isSelected(rowIndex));
}, this);
//prevent default
usersTaskGrid.on('contextmenu', function (evt) {
evt.preventDefault();
}, this);
function onDynaformsContextMenu(grid, rowIndex, e) {
e.stopEvent();
var coords = e.getXY();
usersTaskGridContextMenu.showAt([coords[0], coords[1]]);
}
var usersTaskGridContextMenu = new Ext.menu.Menu({
id: 'messageContextMenu',
items: [{
text: _('ID_REMOVE'),
iconCls: 'button_menu_ext ss_sprite ss_delete',
handler: removeUsersTask
}
]
});
function removeUsersTask(){
var usr_uid = Array();
var tu_relation = Array();
var rowsSelected = Ext.getCmp('usersTaskGrid').getSelectionModel().getSelections();
if( rowsSelected.length == 0 ) {
PMExt.error('', _('ID_NO_SELECTION_WARNING'));
return false;
}
for(i=0; i<rowsSelected.length; i++) {
usr_uid[i] = rowsSelected[i].get('USR_UID');
tu_relation[i] = rowsSelected[i].get('TU_RELATION');
}
usr_uid = usr_uid.join(',');
tu_relation = tu_relation.join(',');
PMExt.confirm(_('ID_CONFIRM'), _('ID_DELETE_DYNAFORM_CONFIRM'), function(){
Ext.Ajax.request({
url : '../processes/ajaxListener',
method: 'POST',
params: {
action : 'removeUsersTask',
USR_UID: usr_uid,
TU_RELATION: tu_relation,
TAS_UID: _TAS_UID
},
success: function(response) {
var result = Ext.util.JSON.decode(response.responseText);
if( result.success ){
Ext.getCmp('usersTaskGrid').store.reload();
} else {
PMExt.error(_('ID_ERROR'), result.msg);
}
}
});
});
}
var eastPanelTree = new Ext.tree.TreePanel({
useArrows: true,
autoScroll: true,
animate: true,
//autoHeight: true,
//enableDD: true,
//containerScroll: true,
rootVisible : false,
border: true,
height: PMExt.getBrowser().screen.height * 0.25,
region: 'north',
split : true,
collapseMode:'mini',
// auto create TreeLoader
loader : new Ext.tree.TreeLoader({
preloadChildren : true,
dataUrl : '../processes/ajaxListener',
baseParams : {
action : 'getProcessDetail',
PRO_UID: pro_uid
}
}),
root: {
nodeType : 'async',
draggable : false,
id : 'root',
expanded : true
}
});
var propertiesGrid = new Ext.grid.PropertyGrid({
id: 'propGrid',
title: 'Properties',
//width: 300,
autoHeight: true,
propertyNames: {
tested: 'QA',
borderWidth: 'Border Width'
},
viewConfig : {
forceFit: true,
scrollOffset: 2 // the grid will never have scrollbars
}
});
var propertyStore = new Ext.data.JsonStore({
autoLoad: true, //autoload the data
url: 'ajaxListener?action=getProcessproperties',
root: 'props',
fields: ['First name', 'Last name', 'E-mail'],
listeners: {
load: {
fn: function(store, records, options){
// get the property grid component
var propGrid = Ext.getCmp('propGrid');
// make sure the property grid exists
if (propGrid) {
// populate the property grid with store data
propGrid.setSource(store.getAt(0).data);
}
}
}
}
});
propertiesGrid.setSource({
ttile: 'Properties Grid',
Description: false,
Calendar: true,
Category: false,
created: new Date(Date.parse('10/15/2006')),
tested: false,
version: 0.01,
borderWidth: 1
});
var east = new Ext.Panel({
id : 'eastPanel',
title : '',
region : 'east',
width : 280,
title : '',
//autoScroll : true,
layout:'border',
collapsible :true,
split :true,
//collapseMode:'mini',
//hideCollapseTool: false,
items:[
eastPanelTree
, {
id: 'eastPanelCenter',
xtype: 'panel',
title: 'Process: ',
region: 'center',
layout: 'fit',
items:[
new Ext.TabPanel({
id : 'usersPanelTabs',
title : 'sdd',
border: true, // already wrapped so don't add another border
activeTab : 0, // second tab initially active
tabPosition : 'top',
split : true,
collapseMode:'mini',
//height : 318,
items : [
propertiesGrid,
usersTaskGrid
]
})
]
}
]
});
/*items:[
*/
var north = {
xtype : "panel",
initialSize: 60,
split:false,
@@ -98,7 +317,7 @@ Ext.onReady ( function() {
region : "north"
};
var south= {
var south = {
xtype : "panel",
initialSize: 120,
height: 100,
@@ -109,16 +328,16 @@ Ext.onReady ( function() {
animate: true,
region : "south",
items: {
region: 'center',
xtype: 'tabpanel',
items: [{
title: 'Properties',
html: 'Properties'
},
{
title: 'Debug Console',
html: 'Debug Console'
}]
region: 'center',
xtype: 'tabpanel',
items: [{
title: 'Properties',
html: 'Properties'
},
{
title: 'Debug Console',
html: 'Debug Console'
}]
}
};
@@ -138,6 +357,7 @@ Ext.onReady ( function() {
var processObj = new ProcessOptions();
var main = new Ext.Panel({
renderTo : "center1",
region : "center",
@@ -145,7 +365,7 @@ Ext.onReady ( function() {
autoScroll: true,
height : 1000,
width : 1300,
items : [north, center],
items : [north, center, east],
tbar: [
{
text: 'Save',
@@ -292,5 +512,7 @@ Ext.onReady ( function() {
,border:false,
items:[main]
});
Ext.getCmp('eastPanel').hide();
//Ext.getCmp('eastPanel').ownerCt.doLayout();
});