2010-12-02 23:34:41 +00:00
|
|
|
/*
|
|
|
|
|
* @author: Erik A. Ortiz
|
|
|
|
|
* Aug 20th, 2010
|
|
|
|
|
*/
|
|
|
|
|
var processesGrid;
|
|
|
|
|
var store;
|
|
|
|
|
var comboCategory;
|
|
|
|
|
|
|
|
|
|
new Ext.KeyMap(document, {
|
|
|
|
|
key: Ext.EventObject.F5,
|
|
|
|
|
fn: function(keycode, e) {
|
|
|
|
|
if (! e.ctrlKey) {
|
|
|
|
|
if (Ext.isIE)
|
|
|
|
|
e.browserEvent.keyCode = 8;
|
|
|
|
|
e.stopEvent();
|
|
|
|
|
document.location = document.location;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
Ext.Msg.alert('Refresh', 'You clicked: CTRL-F5');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ext.onReady(function(){
|
2011-02-07 16:04:51 +00:00
|
|
|
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
|
2010-12-02 23:34:41 +00:00
|
|
|
Ext.QuickTips.init();
|
|
|
|
|
|
|
|
|
|
store = new Ext.data.GroupingStore( {
|
|
|
|
|
//var store = new Ext.data.Store( {
|
|
|
|
|
proxy : new Ext.data.HttpProxy({
|
|
|
|
|
url: 'processesList'
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
reader : new Ext.data.JsonReader( {
|
|
|
|
|
totalProperty: 'totalCount',
|
|
|
|
|
root: 'data',
|
|
|
|
|
fields : [
|
|
|
|
|
{name : 'PRO_DESCRIPTION'},
|
|
|
|
|
{name : 'PRO_UID'},
|
|
|
|
|
{name : 'PRO_CATEGORY_LABEL'},
|
|
|
|
|
{name : 'PRO_TITLE'},
|
|
|
|
|
{name : 'PRO_STATUS'},
|
|
|
|
|
{name : 'PRO_STATUS_LABEL'},
|
|
|
|
|
{name : 'PRO_CREATE_DATE'},
|
2011-02-10 21:37:30 +00:00
|
|
|
{name : 'PRO_DEBUG'},
|
2010-12-02 23:34:41 +00:00
|
|
|
{name : 'PRO_DEBUG_LABEL'},
|
|
|
|
|
{name : 'PRO_CREATE_USER_LABEL'},
|
|
|
|
|
{name : 'CASES_COUNT', type:'float'},
|
|
|
|
|
{name : 'CASES_COUNT_DRAFT', type:'float'},
|
|
|
|
|
{name : 'CASES_COUNT_TO_DO', type:'float'},
|
|
|
|
|
{name : 'CASES_COUNT_COMPLETED', type:'float'},
|
|
|
|
|
{name : 'CASES_COUNT_CANCELLED', type:'float'}
|
|
|
|
|
]
|
|
|
|
|
})//,
|
|
|
|
|
//sortInfo:{field: 'PRO_TITLE', direction: "ASC"}
|
|
|
|
|
//groupField:'PRO_CATEGORY_LABEL'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var expander = new Ext.ux.grid.RowExpander({
|
|
|
|
|
tpl : new Ext.Template(
|
|
|
|
|
'<p><b>'+TRANSLATIONS.ID_PRO_DESCRIPTION+':</b> {PRO_DESCRIPTION}</p><br>'
|
|
|
|
|
)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
comboCategory = new Ext.form.ComboBox({
|
|
|
|
|
fieldLabel : 'Categoty',
|
|
|
|
|
hiddenName : 'category',
|
|
|
|
|
store : new Ext.data.Store( {
|
|
|
|
|
proxy : new Ext.data.HttpProxy( {
|
2011-02-26 22:57:37 +00:00
|
|
|
url : '../processProxy/categoriesList',
|
2010-12-02 23:34:41 +00:00
|
|
|
method : 'POST'
|
|
|
|
|
}),
|
|
|
|
|
reader : new Ext.data.JsonReader( {
|
|
|
|
|
fields : [ {
|
|
|
|
|
name : 'CATEGORY_UID'
|
|
|
|
|
}, {
|
|
|
|
|
name : 'CATEGORY_NAME'
|
|
|
|
|
} ]
|
|
|
|
|
})
|
|
|
|
|
}),
|
|
|
|
|
valueField : 'CATEGORY_UID',
|
|
|
|
|
displayField : 'CATEGORY_NAME',
|
|
|
|
|
triggerAction : 'all',
|
|
|
|
|
emptyText : TRANSLATIONS.ID_SELECT,
|
|
|
|
|
selectOnFocus : true,
|
|
|
|
|
editable : true,
|
|
|
|
|
width: 180,
|
|
|
|
|
allowBlank : true,
|
|
|
|
|
autocomplete: true,
|
|
|
|
|
typeAhead: true,
|
|
|
|
|
allowBlankText : 'You should to select a language from the list.',
|
|
|
|
|
listeners:{
|
|
|
|
|
scope: this,
|
|
|
|
|
'select': function() {
|
|
|
|
|
filter = comboCategory.value;
|
|
|
|
|
store.setBaseParam( 'category', filter);
|
|
|
|
|
var searchTxt = Ext.util.Format.trim(Ext.getCmp('searchTxt').getValue());
|
|
|
|
|
|
|
|
|
|
if( searchTxt == '' ){
|
|
|
|
|
store.setBaseParam( 'processName', '');
|
|
|
|
|
}
|
|
|
|
|
store.load({params:{category: filter, start : 0 , limit : 25 }});
|
|
|
|
|
}}
|
|
|
|
|
})
|
2011-02-07 16:04:51 +00:00
|
|
|
/* storePageSize = new Ext.data.SimpleStore({
|
|
|
|
|
fields: ['size'],
|
|
|
|
|
data: [['20'],['30'],['40'],['50'],['100']],
|
|
|
|
|
autoLoad: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var comboPageSize = new Ext.form.ComboBox({
|
|
|
|
|
typeAhead : false,
|
|
|
|
|
mode : 'local',
|
|
|
|
|
triggerAction : 'all',
|
|
|
|
|
store: storePageSize,
|
|
|
|
|
valueField: 'size',
|
|
|
|
|
displayField: 'size',
|
|
|
|
|
width: 50,
|
|
|
|
|
editable: false,
|
|
|
|
|
listeners:{
|
|
|
|
|
select: function(c,d,i){
|
|
|
|
|
//UpdatePageConfig(d.data['size']);
|
|
|
|
|
bbar.pageSize = parseInt(d.data['size']);
|
|
|
|
|
bbar.moveFirst();
|
|
|
|
|
|
|
|
|
|
//Ext.getCmp('bbar').setPageSize(comboPageSize.getValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
comboPageSize.setValue(pageSize);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var bbar = new Ext.PagingToolbar({
|
|
|
|
|
id: 'bbar',
|
|
|
|
|
pageSize: '15',
|
|
|
|
|
store: store,
|
|
|
|
|
displayInfo: true,
|
|
|
|
|
displayMsg: 'Displaying Processes {0} - {1} of {2}',
|
|
|
|
|
emptyMsg: "",
|
|
|
|
|
items:[_('ID_PAGE_SIZE')+':',comboPageSize]
|
|
|
|
|
}) */
|
2010-12-02 23:34:41 +00:00
|
|
|
processesGrid = new Ext.grid.GridPanel( {
|
|
|
|
|
region: 'center',
|
|
|
|
|
layout: 'fit',
|
|
|
|
|
id: 'processesGrid',
|
|
|
|
|
height:500,
|
|
|
|
|
//autoWidth : true,
|
|
|
|
|
width:'',
|
|
|
|
|
title : '',
|
|
|
|
|
stateful : true,
|
|
|
|
|
stateId : 'grid',
|
|
|
|
|
enableColumnResize: true,
|
|
|
|
|
enableHdMenu: true,
|
|
|
|
|
frame:false,
|
|
|
|
|
plugins: expander,
|
|
|
|
|
cls : 'grid_with_checkbox',
|
|
|
|
|
columnLines: true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*view: new Ext.grid.GroupingView({
|
|
|
|
|
//forceFit:true,
|
|
|
|
|
//groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
|
|
|
|
|
groupTextTpl: '{text}'
|
|
|
|
|
}),*/
|
|
|
|
|
viewConfig: {
|
|
|
|
|
forceFit:true
|
|
|
|
|
},
|
|
|
|
|
cm: new Ext.grid.ColumnModel({
|
|
|
|
|
defaults: {
|
|
|
|
|
width: 200,
|
|
|
|
|
sortable: true
|
|
|
|
|
},
|
|
|
|
|
columns: [
|
|
|
|
|
expander,
|
|
|
|
|
{id:'PRO_UID', dataIndex: 'PRO_UID', hidden:true, hideable:false},
|
|
|
|
|
{header: "", dataIndex: 'PRO_STATUS', width: 50, hidden:true, hideable:false},
|
|
|
|
|
{header: TRANSLATIONS.ID_PRO_DESCRIPTION, dataIndex: 'PRO_DESCRIPTION',hidden:true, hideable:false},
|
|
|
|
|
{header: TRANSLATIONS.ID_PRO_TITLE, dataIndex: 'PRO_TITLE', width: 300},
|
|
|
|
|
{header: TRANSLATIONS.ID_CATEGORY, dataIndex: 'PRO_CATEGORY_LABEL', width: 100, hidden:false},
|
|
|
|
|
{header: TRANSLATIONS.ID_STATUS, dataIndex: 'PRO_STATUS_LABEL', width: 50, renderer:function(v,p,r){
|
|
|
|
|
color = r.get('PRO_STATUS') == 'ACTIVE'? 'green': 'red';
|
|
|
|
|
return String.format("<font color='{0}'>{1}</font>", color, v);
|
|
|
|
|
}},
|
|
|
|
|
{header: TRANSLATIONS.ID_PRO_USER, dataIndex: 'PRO_CREATE_USER_LABEL', width: 150},
|
|
|
|
|
{header: TRANSLATIONS.ID_PRO_CREATE_DATE, dataIndex: 'PRO_CREATE_DATE', width: 90},
|
|
|
|
|
{header: TRANSLATIONS.ID_INBOX, dataIndex: 'CASES_COUNT_TO_DO', width: 50, align:'right'},
|
|
|
|
|
{header: TRANSLATIONS.ID_DRAFT, dataIndex: 'CASES_COUNT_DRAFT', width: 50, align:'right'},
|
|
|
|
|
{header: TRANSLATIONS.ID_COMPLETED, dataIndex: 'CASES_COUNT_COMPLETED', width: 70, align:'right'},
|
|
|
|
|
{header: TRANSLATIONS.ID_CANCELLED, dataIndex: 'CASES_COUNT_CANCELLED', width: 70, align:'right'},
|
|
|
|
|
{header: TRANSLATIONS.ID_TOTAL_CASES, dataIndex: 'CASES_COUNT', width: 80,renderer:function(v){return "<b>"+v+"</b>";}, align:'right'},
|
|
|
|
|
{header: TRANSLATIONS.ID_PRO_DEBUG, dataIndex: 'PRO_DEBUG_LABEL', width: 50, align:'center'}
|
|
|
|
|
]
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
store: store,
|
|
|
|
|
|
|
|
|
|
tbar:[
|
|
|
|
|
{
|
|
|
|
|
text:TRANSLATIONS.ID_NEW,
|
2010-12-14 19:24:50 +00:00
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_add',
|
|
|
|
|
//icon: '/images/addc.png',
|
2010-12-02 23:34:41 +00:00
|
|
|
handler: newProcess
|
|
|
|
|
},
|
|
|
|
|
'-'
|
|
|
|
|
,{
|
|
|
|
|
text:TRANSLATIONS.ID_EDIT,
|
2010-12-14 19:24:50 +00:00
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_pencil',
|
|
|
|
|
//icon: '/images/edit.gif',
|
2010-12-02 23:34:41 +00:00
|
|
|
handler: editProcess
|
2010-12-06 06:19:19 +00:00
|
|
|
},{
|
2010-12-15 20:03:53 +00:00
|
|
|
text:TRANSLATIONS.ID_EDIT_BPMN,
|
2010-12-14 19:24:50 +00:00
|
|
|
iconCls: 'button_menu_ext',
|
|
|
|
|
icon: '/images/pencil_beta.png',
|
2010-12-06 06:19:19 +00:00
|
|
|
handler: editNewProcess
|
2010-12-02 23:34:41 +00:00
|
|
|
},{
|
|
|
|
|
text:TRANSLATIONS.ID_STATUS,
|
|
|
|
|
id:'activator',
|
|
|
|
|
icon: '',
|
|
|
|
|
iconCls: 'silk-add',
|
|
|
|
|
handler: activeDeactive,
|
|
|
|
|
disabled:true
|
|
|
|
|
},{
|
|
|
|
|
text:TRANSLATIONS.ID_DELETE,
|
2010-12-14 19:24:50 +00:00
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_delete',
|
|
|
|
|
//icon: '/images/delete-16x16.gif',
|
2010-12-02 23:34:41 +00:00
|
|
|
handler:deleteProcess
|
|
|
|
|
},{
|
|
|
|
|
xtype: 'tbseparator'
|
|
|
|
|
},{
|
|
|
|
|
text:TRANSLATIONS.ID_IMPORT,
|
|
|
|
|
iconCls: 'silk-add',
|
|
|
|
|
icon: '/images/import.gif',
|
|
|
|
|
handler:importProcess
|
2010-12-08 10:18:53 +00:00
|
|
|
},{
|
|
|
|
|
text:'Import XPDL',
|
|
|
|
|
iconCls: 'silk-add',
|
|
|
|
|
icon: '/images/import.gif',
|
|
|
|
|
handler:importXPDLProcess
|
2010-12-02 23:34:41 +00:00
|
|
|
},/*{
|
|
|
|
|
text:'Export',
|
|
|
|
|
iconCls: 'silk-add',
|
|
|
|
|
icon: '/images/export.png',
|
|
|
|
|
},*/{
|
|
|
|
|
text:TRANSLATIONS.ID_BROWSE_LIBRARY,
|
2010-12-14 19:24:50 +00:00
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_world',
|
|
|
|
|
//icon: '/images/icon-pmwebservices.png',
|
2010-12-02 23:34:41 +00:00
|
|
|
handler: browseLibrary
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
xtype: 'tbfill'
|
|
|
|
|
},{
|
|
|
|
|
xtype: 'tbseparator'
|
|
|
|
|
},
|
|
|
|
|
TRANSLATIONS.ID_CATEGORY,
|
|
|
|
|
comboCategory,{
|
|
|
|
|
xtype: 'tbseparator'
|
|
|
|
|
},new Ext.form.TextField ({
|
|
|
|
|
id: 'searchTxt',
|
|
|
|
|
ctCls:'pm_search_text_field',
|
|
|
|
|
allowBlank: true,
|
|
|
|
|
width: 150,
|
|
|
|
|
emptyText: TRANSLATIONS.ID_ENTER_SEARCH_TERM,//'enter search term',
|
|
|
|
|
listeners: {
|
|
|
|
|
specialkey: function(f,e){
|
|
|
|
|
if (e.getKey() == e.ENTER) {
|
|
|
|
|
doSearch();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}),{
|
|
|
|
|
text:'X',
|
|
|
|
|
ctCls:'pm_search_x_button',
|
|
|
|
|
handler: function(){
|
|
|
|
|
//store.setBaseParam( 'category', '<reset>');
|
|
|
|
|
store.setBaseParam( 'processName', '');
|
|
|
|
|
store.load({params:{start : 0 , limit : '' }});
|
|
|
|
|
Ext.getCmp('searchTxt').setValue('');
|
|
|
|
|
//comboCategory.setValue('');
|
|
|
|
|
//store.reload();
|
|
|
|
|
}
|
|
|
|
|
},{
|
|
|
|
|
text:TRANSLATIONS.ID_SEARCH,
|
|
|
|
|
handler: doSearch
|
|
|
|
|
}
|
|
|
|
|
],
|
2011-02-10 21:37:30 +00:00
|
|
|
// paging bar on the bottom
|
2011-02-07 16:04:51 +00:00
|
|
|
bbar: new Ext.PagingToolbar({
|
2010-12-02 23:34:41 +00:00
|
|
|
pageSize: 15,
|
|
|
|
|
store: store,
|
|
|
|
|
displayInfo: true,
|
2011-02-07 16:04:51 +00:00
|
|
|
displayMsg: 'Displaying Processes {0} - {1} of {2}',
|
|
|
|
|
emptyMsg: "",
|
2010-12-02 23:34:41 +00:00
|
|
|
items:[]
|
2011-02-07 16:04:51 +00:00
|
|
|
}),
|
2010-12-02 23:34:41 +00:00
|
|
|
listeners: {
|
|
|
|
|
rowdblclick: editProcess,
|
|
|
|
|
render: function(){
|
|
|
|
|
this.loadMask = new Ext.LoadMask(this.body, {msg:'Loading...'});
|
|
|
|
|
processesGrid.getSelectionModel().on('rowselect', function(){
|
2011-02-10 21:37:30 +00:00
|
|
|
var rowSelected = processesGrid.getSelectionModel().getSelected();
|
|
|
|
|
var activator = Ext.getCmp('activator');
|
|
|
|
|
activator.setDisabled(false);
|
|
|
|
|
if( rowSelected.data.PRO_STATUS == 'ACTIVE' ){
|
|
|
|
|
activator.setIcon('/images/deactivate.png');
|
|
|
|
|
activator.setText(TRANSLATIONS.ID_DEACTIVATE);
|
|
|
|
|
} else {
|
|
|
|
|
activator.setIcon('/images/activate.png');
|
|
|
|
|
activator.setText(TRANSLATIONS.ID_ACTIVATE);
|
|
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
});
|
|
|
|
|
}
|
2011-02-10 21:37:30 +00:00
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
processesGrid.store.load({params: {"function":"languagesList"}});
|
2011-02-10 21:37:30 +00:00
|
|
|
processesGrid.addListener('rowcontextmenu', onMessageContextMenu,this);
|
|
|
|
|
processesGrid.on('rowcontextmenu', function (grid, rowIndex, evt) {
|
|
|
|
|
var sm = grid.getSelectionModel();
|
|
|
|
|
sm.selectRow(rowIndex, sm.isSelected(rowIndex));
|
|
|
|
|
|
|
|
|
|
var rowSelected = Ext.getCmp('processesGrid').getSelectionModel().getSelected();
|
|
|
|
|
var activator = Ext.getCmp('activator2');
|
|
|
|
|
var debug = Ext.getCmp('debug');
|
|
|
|
|
|
|
|
|
|
if( rowSelected.data.PRO_STATUS == 'ACTIVE' ){
|
|
|
|
|
activator.setIconClass('icon-deactivate');
|
|
|
|
|
activator.setText(TRANSLATIONS.ID_DEACTIVATE);
|
|
|
|
|
} else {
|
|
|
|
|
activator.setIconClass('icon-activate');
|
|
|
|
|
activator.setText(TRANSLATIONS.ID_ACTIVATE);
|
|
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
|
2011-02-10 21:37:30 +00:00
|
|
|
if( rowSelected.data.PRO_DEBUG == 1){
|
|
|
|
|
debug.setIconClass('icon-debug-disabled');
|
|
|
|
|
debug.setText(_('ID_DISABLE_DEBUG'));
|
|
|
|
|
} else {
|
|
|
|
|
debug.setIconClass('icon-debug');
|
|
|
|
|
debug.setText(_('ID_ENABLE_DEBUG'));
|
|
|
|
|
}
|
|
|
|
|
}, this);
|
|
|
|
|
processesGrid.on('contextmenu', function (evt) {
|
|
|
|
|
evt.preventDefault();
|
|
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
|
function onMessageContextMenu(grid, rowIndex, e) {
|
|
|
|
|
e.stopEvent();
|
|
|
|
|
var coords = e.getXY();
|
|
|
|
|
messageContextMenu.showAt([coords[0], coords[1]]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var messageContextMenu = new Ext.menu.Menu({
|
|
|
|
|
id: 'messageContextMenu',
|
|
|
|
|
items: [{
|
|
|
|
|
text: _('ID_EDIT'),
|
|
|
|
|
iconCls: 'button_menu_ext ss_sprite ss_pencil',
|
|
|
|
|
handler: editProcess
|
|
|
|
|
},{
|
|
|
|
|
text: _('ID_EDIT_BPMN'),
|
|
|
|
|
icon: '/images/pencil_beta.png',
|
|
|
|
|
handler: editNewProcess
|
|
|
|
|
}, {
|
|
|
|
|
id: 'activator2',
|
|
|
|
|
text: '',
|
|
|
|
|
icon: '',
|
|
|
|
|
handler: activeDeactive
|
|
|
|
|
}, {
|
|
|
|
|
id: 'debug',
|
|
|
|
|
text: '',
|
|
|
|
|
handler: enableDisableDebug
|
|
|
|
|
}, {
|
|
|
|
|
text: _('ID_DELETE'),
|
|
|
|
|
icon: '/images/delete.png',
|
|
|
|
|
handler: deleteProcess
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
2010-12-02 23:34:41 +00:00
|
|
|
|
|
|
|
|
var viewport = new Ext.Viewport({
|
|
|
|
|
layout: 'border',
|
|
|
|
|
autoScroll: true,
|
|
|
|
|
items: [
|
|
|
|
|
processesGrid
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function newProcess(){
|
2011-02-10 17:01:21 +00:00
|
|
|
// window.location = 'processes_New';
|
|
|
|
|
var ProcessCategories = new Ext.form.ComboBox({
|
|
|
|
|
fieldLabel : 'Category',
|
|
|
|
|
hiddenName : 'PRO_CATEGORY',
|
|
|
|
|
valueField : 'CATEGORY_UID',
|
|
|
|
|
displayField : 'CATEGORY_NAME',
|
|
|
|
|
triggerAction : 'all',
|
|
|
|
|
selectOnFocus : true,
|
|
|
|
|
editable : false,
|
|
|
|
|
width: 180,
|
|
|
|
|
allowBlank : true,
|
|
|
|
|
|
|
|
|
|
store : new Ext.data.Store( {
|
2011-02-27 12:24:54 +00:00
|
|
|
autoLoad: true, //autoload the data
|
2011-02-10 17:01:21 +00:00
|
|
|
proxy : new Ext.data.HttpProxy( {
|
2011-02-27 12:24:54 +00:00
|
|
|
url : '../processProxy/getCategoriesList',
|
2011-02-10 17:01:21 +00:00
|
|
|
method : 'POST'
|
|
|
|
|
}),
|
2011-02-27 12:24:54 +00:00
|
|
|
|
2011-02-10 17:01:21 +00:00
|
|
|
reader : new Ext.data.JsonReader( {
|
|
|
|
|
fields : [ {
|
|
|
|
|
name : 'CATEGORY_UID'
|
|
|
|
|
}, {
|
|
|
|
|
name : 'CATEGORY_NAME'
|
|
|
|
|
} ]
|
2011-02-10 21:37:30 +00:00
|
|
|
})
|
2011-02-27 12:24:54 +00:00
|
|
|
})
|
2011-02-10 17:01:21 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var frm = new Ext.FormPanel( {
|
|
|
|
|
id: 'newProcessForm',
|
|
|
|
|
labelAlign : 'right',
|
|
|
|
|
bodyStyle : 'padding:5px 5px 0',
|
|
|
|
|
width : 400,
|
|
|
|
|
items : [ {
|
|
|
|
|
id: 'PRO_TITLE',
|
|
|
|
|
fieldLabel: _('ID_TITLE'),
|
|
|
|
|
xtype:'textfield',
|
|
|
|
|
width: 260
|
|
|
|
|
}, {
|
|
|
|
|
id: 'PRO_DESCRIPTION',
|
|
|
|
|
fieldLabel: _('ID_DESCRIPTION'),
|
|
|
|
|
xtype:'textarea',
|
|
|
|
|
width: 260
|
|
|
|
|
},
|
|
|
|
|
ProcessCategories,
|
|
|
|
|
{
|
|
|
|
|
id: 'editor',
|
|
|
|
|
xtype: 'radiogroup',
|
|
|
|
|
fieldLabel: _('ID_OPEN_WITH'),
|
|
|
|
|
items: [
|
|
|
|
|
{boxLabel: _('ID_CLASSIC_EDITOR'), name: 'editor', inputValue: 'classic', checked: true},
|
|
|
|
|
{boxLabel: _('ID_BPMN_EDITOR'), name: 'editor', inputValue: 'bpmn'}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
buttons : [{
|
|
|
|
|
text : _('ID_CREATE'),
|
|
|
|
|
handler : saveProcess
|
|
|
|
|
},{
|
|
|
|
|
text : _('ID_CANCEL'),
|
|
|
|
|
handler : function() {
|
|
|
|
|
win.close();
|
|
|
|
|
}
|
|
|
|
|
}]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var win = new Ext.Window({
|
2011-02-10 21:37:30 +00:00
|
|
|
title: _('ID_CREATE_PROCESS'),
|
2011-02-10 17:01:21 +00:00
|
|
|
width: 450,
|
|
|
|
|
height: 220,
|
|
|
|
|
layout:'fit',
|
|
|
|
|
autoScroll:true,
|
|
|
|
|
modal: true,
|
|
|
|
|
maximizable: false,
|
|
|
|
|
items: [frm]
|
|
|
|
|
});
|
|
|
|
|
win.show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function saveProcess()
|
|
|
|
|
{
|
|
|
|
|
Ext.getCmp('newProcessForm').getForm().submit( {
|
2011-02-27 12:24:54 +00:00
|
|
|
url : '../processProxy/saveProcess',
|
|
|
|
|
waitMsg : _('ID_SAVING_PROCESS'),
|
2011-02-10 17:01:21 +00:00
|
|
|
timeout : 36000,
|
|
|
|
|
success : function(obj, resp) {
|
|
|
|
|
var editor = Ext.getCmp('editor').getValue().getGroupValue();
|
|
|
|
|
if( editor == 'classic')
|
|
|
|
|
location.href = 'processes_Map?PRO_UID='+resp.result.PRO_UID;
|
|
|
|
|
else
|
2011-03-03 13:08:18 +00:00
|
|
|
location.href = '../bpmnDesigner?id='+resp.result.PRO_UID;
|
2011-02-10 17:01:21 +00:00
|
|
|
},
|
2011-02-27 12:24:54 +00:00
|
|
|
failure: function(obj, resp) {
|
|
|
|
|
//Ext.Msg.alert( _('ID_ERROR'), resp.result.msg);
|
2011-02-11 06:50:53 +00:00
|
|
|
}
|
2011-02-10 17:01:21 +00:00
|
|
|
});
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function doSearch(){
|
|
|
|
|
if(comboCategory.getValue() == '')
|
|
|
|
|
store.setBaseParam( 'category', '<reset>');
|
|
|
|
|
filter = Ext.getCmp('searchTxt').getValue();
|
|
|
|
|
|
|
|
|
|
store.setBaseParam('processName', filter);
|
|
|
|
|
store.load({params:{processName: filter, start : 0 , limit : 25 }});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
editProcess = function(){
|
|
|
|
|
var rowSelected = processesGrid.getSelectionModel().getSelected();
|
|
|
|
|
if( rowSelected ) {
|
|
|
|
|
location.href = 'processes_Map?PRO_UID='+rowSelected.data.PRO_UID+'&rand='+Math.random()
|
|
|
|
|
} else {
|
|
|
|
|
Ext.Msg.show({
|
|
|
|
|
title:'',
|
|
|
|
|
msg: TRANSLATIONS.ID_NO_SELECTION_WARNING,
|
|
|
|
|
buttons: Ext.Msg.INFO,
|
|
|
|
|
fn: function(){},
|
|
|
|
|
animEl: 'elId',
|
|
|
|
|
icon: Ext.MessageBox.INFO,
|
|
|
|
|
buttons: Ext.MessageBox.OK
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-06 06:19:19 +00:00
|
|
|
editNewProcess = function(){
|
|
|
|
|
var rowSelected = processesGrid.getSelectionModel().getSelected();
|
|
|
|
|
if( rowSelected ) {
|
2011-03-02 23:49:29 +00:00
|
|
|
location.href = '../bpmnDesigner?id='+rowSelected.data.PRO_UID
|
2010-12-06 06:19:19 +00:00
|
|
|
} else {
|
|
|
|
|
Ext.Msg.show({
|
|
|
|
|
title:'',
|
|
|
|
|
msg: TRANSLATIONS.ID_NO_SELECTION_WARNING,
|
|
|
|
|
buttons: Ext.Msg.INFO,
|
|
|
|
|
fn: function(){},
|
|
|
|
|
animEl: 'elId',
|
|
|
|
|
icon: Ext.MessageBox.INFO,
|
|
|
|
|
buttons: Ext.MessageBox.OK
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-02 23:34:41 +00:00
|
|
|
deleteProcess = function(){
|
|
|
|
|
var rows = processesGrid.getSelectionModel().getSelections();
|
|
|
|
|
if( rows.length > 0 ) {
|
|
|
|
|
isValid = true;
|
|
|
|
|
errLog = Array();
|
2011-02-10 21:37:30 +00:00
|
|
|
|
2010-12-02 23:34:41 +00:00
|
|
|
//verify if the selected rows have not any started or delegated cases
|
|
|
|
|
for(i=0; i<rows.length; i++){
|
|
|
|
|
if( rows[i].get('CASES_COUNT') != 0 ){
|
|
|
|
|
errLog.push(i);
|
|
|
|
|
isValid = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( isValid ){
|
|
|
|
|
ids = Array();
|
|
|
|
|
for(i=0; i<rows.length; i++)
|
|
|
|
|
ids[i] = rows[i].get('PRO_UID');
|
|
|
|
|
|
|
|
|
|
PRO_UIDS = ids.join(',');
|
|
|
|
|
|
|
|
|
|
Ext.Msg.confirm(
|
|
|
|
|
TRANSLATIONS.ID_CONFIRM,
|
|
|
|
|
rows.length == 1? TRANSLATIONS.ID_PROCESS_DELETE_LABEL: TRANSLATIONS.ID_PROCESS_DELETE_ALL_LABEL,
|
|
|
|
|
function(btn, text){
|
|
|
|
|
if ( btn == 'yes' ){
|
|
|
|
|
Ext.MessageBox.show({ msg: TRANSLATIONS.ID_DELETING_ELEMENTS, wait:true,waitConfig: {interval:200} });
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
url: 'processes_Delete',
|
|
|
|
|
success: function(response) {
|
|
|
|
|
Ext.MessageBox.hide();
|
|
|
|
|
processesGrid.store.reload();
|
|
|
|
|
result = Ext.util.JSON.decode(response.responseText);
|
|
|
|
|
|
|
|
|
|
if(result){
|
|
|
|
|
if(result.status != 0){
|
|
|
|
|
Ext.MessageBox.show({
|
|
|
|
|
title: 'Error',
|
|
|
|
|
msg: result.msg,
|
|
|
|
|
buttons: Ext.MessageBox.OK,
|
|
|
|
|
icon: Ext.MessageBox.ERROR
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
Ext.MessageBox.show({
|
|
|
|
|
title: 'Error',
|
|
|
|
|
msg: response.responseText,
|
|
|
|
|
buttons: Ext.MessageBox.OK,
|
|
|
|
|
icon: Ext.MessageBox.ERROR
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
params: {PRO_UIDS:PRO_UIDS}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
errMsg = '';
|
|
|
|
|
for(i=0; i<errLog.length; i++){
|
|
|
|
|
e = TRANSLATIONS.ID_PROCESS_CANT_DELETE;
|
|
|
|
|
e = e.replace('{0}', rows[errLog[i]].get('PRO_TITLE'));
|
|
|
|
|
e = e.replace('{1}', rows[errLog[i]].get('CASES_COUNT'));
|
|
|
|
|
errMsg += e + '<br/>';
|
|
|
|
|
}
|
|
|
|
|
Ext.MessageBox.show({
|
|
|
|
|
title: 'Error',
|
|
|
|
|
msg: errMsg,
|
|
|
|
|
buttons: Ext.MessageBox.OK,
|
|
|
|
|
icon: Ext.MessageBox.ERROR
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Ext.Msg.show({
|
|
|
|
|
title:'',
|
|
|
|
|
msg: TRANSLATIONS.ID_NO_SELECTION_WARNING,
|
|
|
|
|
buttons: Ext.Msg.INFO,
|
|
|
|
|
fn: function(){},
|
|
|
|
|
animEl: 'elId',
|
|
|
|
|
icon: Ext.MessageBox.INFO,
|
|
|
|
|
buttons: Ext.MessageBox.OK
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
importProcess = function(){
|
|
|
|
|
window.location = 'processes_Import';
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-08 10:18:53 +00:00
|
|
|
importXPDLProcess = function(){
|
|
|
|
|
window.location = 'processes_ImportXpdl';
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-02 23:34:41 +00:00
|
|
|
browseLibrary = function(){
|
|
|
|
|
window.location = 'processes_Library';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function activeDeactive(){
|
|
|
|
|
var rows = processesGrid.getSelectionModel().getSelections();
|
|
|
|
|
|
|
|
|
|
if( rows.length > 0 ) {
|
|
|
|
|
var ids = '';
|
|
|
|
|
for(i=0; i<rows.length; i++) {
|
|
|
|
|
if(i != 0 ) ids += ',';
|
|
|
|
|
ids += rows[i].get('PRO_UID');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Ext.Ajax.request({
|
2011-02-27 12:24:54 +00:00
|
|
|
url : '../processProxy/changeStatus',
|
|
|
|
|
params : { UIDS : ids },
|
2010-12-02 23:34:41 +00:00
|
|
|
success: function ( result, request ) {
|
|
|
|
|
store.reload();
|
|
|
|
|
var activator = Ext.getCmp('activator');
|
|
|
|
|
activator.setDisabled(true);
|
|
|
|
|
activator.setText('Status');
|
|
|
|
|
activator.setIcon('');
|
|
|
|
|
},
|
|
|
|
|
failure: function ( result, request) {
|
|
|
|
|
Ext.MessageBox.alert('Failed', result.responseText);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
Ext.Msg.show({
|
|
|
|
|
title:'',
|
|
|
|
|
msg: TRANSLATIONS.ID_NO_SELECTION_WARNING,
|
|
|
|
|
buttons: Ext.Msg.INFO,
|
|
|
|
|
fn: function(){},
|
|
|
|
|
animEl: 'elId',
|
|
|
|
|
icon: Ext.MessageBox.INFO,
|
|
|
|
|
buttons: Ext.MessageBox.OK
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-10 21:37:30 +00:00
|
|
|
function enableDisableDebug()
|
|
|
|
|
{
|
|
|
|
|
var rows = processesGrid.getSelectionModel().getSelections();
|
2011-02-10 17:01:21 +00:00
|
|
|
|
2011-02-10 21:37:30 +00:00
|
|
|
if( rows.length > 0 ) {
|
|
|
|
|
var ids = '';
|
|
|
|
|
for(i=0; i<rows.length; i++)
|
|
|
|
|
ids += (i != 0 ? ',': '') + rows[i].get('PRO_UID');
|
|
|
|
|
|
|
|
|
|
Ext.Ajax.request({
|
2011-02-27 12:24:54 +00:00
|
|
|
url : '../processProxy/changeDebugMode' ,
|
|
|
|
|
params : {UIDS: ids},
|
2011-02-10 17:01:21 +00:00
|
|
|
success: function ( result, request ) {
|
2011-02-10 21:37:30 +00:00
|
|
|
store.reload();
|
|
|
|
|
var activator = Ext.getCmp('activator');
|
|
|
|
|
activator.setDisabled(true);
|
|
|
|
|
activator.setText('Status');
|
|
|
|
|
activator.setIcon('');
|
2011-02-10 17:01:21 +00:00
|
|
|
},
|
|
|
|
|
failure: function ( result, request) {
|
|
|
|
|
Ext.MessageBox.alert('Failed', result.responseText);
|
|
|
|
|
}
|
2011-02-10 21:37:30 +00:00
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
Ext.Msg.show({
|
|
|
|
|
title:'',
|
|
|
|
|
msg: TRANSLATIONS.ID_NO_SELECTION_WARNING,
|
|
|
|
|
buttons: Ext.Msg.INFO,
|
|
|
|
|
fn: function(){},
|
|
|
|
|
animEl: 'elId',
|
|
|
|
|
icon: Ext.MessageBox.INFO,
|
|
|
|
|
buttons: Ext.MessageBox.OK
|
|
|
|
|
});
|
|
|
|
|
}
|
2011-02-10 17:01:21 +00:00
|
|
|
|
|
|
|
|
}
|