added new process user interface
This commit is contained in:
@@ -459,6 +459,21 @@ class Process extends BaseProcess {
|
||||
return (is_object ($oPro) && get_class ($oPro) == 'Process' );
|
||||
}
|
||||
|
||||
public function existsByProTitle($PRO_TITLE)
|
||||
{
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn('COUNT(*) AS PROCESS');
|
||||
$oCriteria->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE');
|
||||
$oCriteria->add(ContentPeer::CON_LANG, SYS_LANG);
|
||||
$oCriteria->add(ContentPeer::CON_VALUE, $PRO_TITLE);
|
||||
$oDataset = ContentPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
return $aRow['PROCESS'] ? true : false;
|
||||
}
|
||||
|
||||
//new functions
|
||||
function getAllProcessesCount(){
|
||||
$c = $this->tmpCriteria;
|
||||
|
||||
@@ -3,13 +3,17 @@
|
||||
if( ! isset($_GET['PRO_UID']) )
|
||||
throw new Exception('The Process ID was not set!');
|
||||
|
||||
require_once 'classes/model/Process.php';
|
||||
$process = ProcessPeer::retrieveByPK( $_GET['PRO_UID'] );
|
||||
|
||||
if( get_class($process) != 'Process' ) {
|
||||
throw new Exception("The Process with UID: {$_GET['PRO_UID']} doesn't exist!");
|
||||
}
|
||||
|
||||
$processUID = $_GET['PRO_UID'];
|
||||
$_SESSION['PROCESS'] = $processUID;
|
||||
$_SESSION['PROCESSMAP'] = 'BPMN';
|
||||
|
||||
require_once 'classes/model/Process.php';
|
||||
$process = ProcessPeer::retrieveByPK( $processUID );
|
||||
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
$oHeadPublisher->usingExtJs('ux/miframe');
|
||||
|
||||
@@ -17,7 +21,7 @@
|
||||
$oHeadPublisher->addExtJsScript('bpmn/MyWorkflow',true ); //adding a javascript file .js
|
||||
$oHeadPublisher->addExtJsScript('bpmn/pmosExt', true ); //adding a javascript file .js
|
||||
$oHeadPublisher->addExtJsScript('bpmn/TaskContext', true ); //adding a javascript file .js
|
||||
$oHeadPublisher->addExtJsScript('bpmn/ProcessMapContext', true ); //adding a javascript file .js
|
||||
$oHeadPublisher->addExtJsScript('bpmn/ProcessMapContext', false ); //adding a javascript file .js
|
||||
$oHeadPublisher->addExtJsScript('bpmn/processmap', true ); //adding a javascript file .js
|
||||
$oHeadPublisher->addExtJsScript('bpmn/Annotation' );
|
||||
$oHeadPublisher->addExtJsScript('bpmn/FlowConnector');
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?
|
||||
|
||||
$request = $_POST['request'];
|
||||
$request = isset($_GET['request']) ? $_GET['request'] : $_POST['request'];
|
||||
|
||||
switch($request){
|
||||
switch($request)
|
||||
{
|
||||
case 'categoriesList':
|
||||
require_once "classes/model/ProcessCategory.php";
|
||||
|
||||
@@ -14,6 +15,77 @@ switch($request){
|
||||
$response->rows = array_merge($defaultOption, $processCategory->getAll('array'));
|
||||
|
||||
echo G::json_encode($response);
|
||||
break;
|
||||
|
||||
case 'processCategories':
|
||||
require_once "classes/model/ProcessCategory.php";
|
||||
|
||||
$processCategory = new ProcessCategory;
|
||||
$defaultOption = Array();
|
||||
$defaultOption[] = Array('CATEGORY_UID'=>'', 'CATEGORY_NAME'=>G::LoadTranslation('ID_PROCESS_NO_CATEGORY'));
|
||||
|
||||
$response->rows = array_merge($defaultOption, $processCategory->getAll('array'));
|
||||
|
||||
echo G::json_encode($response);
|
||||
break;
|
||||
|
||||
case 'saveProcess':
|
||||
try{
|
||||
require_once 'classes/model/Task.php';
|
||||
G::LoadClass('processMap');
|
||||
$oProcessMap = new ProcessMap();
|
||||
|
||||
if( ! isset($_POST['PRO_UID']) ) {
|
||||
|
||||
if( Process::existsByProTitle($_POST['PRO_TITLE']) ) {
|
||||
$result = array(
|
||||
'success' => false,
|
||||
'msg' => 'Process Save Error',
|
||||
'errors' => array(
|
||||
'PRO_TITLE' => G::LoadTranslation('ID_PROCESSTITLE_ALREADY_EXISTS', SYS_LANG, $_POST)
|
||||
)
|
||||
);
|
||||
print G::json_encode($result);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$processData['USR_UID'] = $_SESSION['USER_LOGGED'];
|
||||
$processData['PRO_TITLE'] = $_POST['PRO_TITLE'];
|
||||
$processData['PRO_DESCRIPTION'] = $_POST['PRO_DESCRIPTION'];
|
||||
$processData['PRO_CATEGORY'] = $_POST['PRO_CATEGORY'];
|
||||
|
||||
$sProUid = $oProcessMap->createProcess($processData);
|
||||
|
||||
//call plugins
|
||||
$oData['PRO_UID'] = $sProUid;
|
||||
$oData['PRO_TEMPLATE'] = ( isset($_POST['PRO_TEMPLATE']) && $_POST['PRO_TEMPLATE'] != '' ) ? $_POST['form']['PRO_TEMPLATE'] : '';
|
||||
$oData['PROCESSMAP'] = $oProcessMap;
|
||||
|
||||
$oPluginRegistry =& PMPluginRegistry::getSingleton();
|
||||
$oPluginRegistry->executeTriggers ( PM_NEW_PROCESS_SAVE , $oData );
|
||||
|
||||
} else {
|
||||
//$oProcessMap->updateProcess($_POST['form']);
|
||||
$sProUid = $_POST['PRO_UID'];
|
||||
}
|
||||
|
||||
//Save Calendar ID for this process
|
||||
if( isset($_POST['PRO_CALENDAR']) ){
|
||||
G::LoadClass("calendar");
|
||||
$calendarObj=new Calendar();
|
||||
$calendarObj->assignCalendarTo($sProUid, $_POST['PRO_CALENDAR'], 'PROCESS');
|
||||
}
|
||||
|
||||
$result->success = true;
|
||||
$result->PRO_UID = $sProUid;
|
||||
$result->msg = G::LoadTranslation('ID_CREATE_PROCESS_SUCCESS');
|
||||
} catch(Exception $e){
|
||||
$result->success = false;
|
||||
$result->msg = $e->getMessage();
|
||||
}
|
||||
|
||||
print G::json_encode($result);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,20 +27,11 @@
|
||||
G::loadClass('configuration');
|
||||
$conf = new Configurations;
|
||||
|
||||
$oHeadPublisher->addExtJsScript('processes/main', false ); //adding a javascript file .js
|
||||
$oHeadPublisher->addExtJsScript('processes/main', true ); //adding a javascript file .js
|
||||
$oHeadPublisher->addContent('processes/main'); //adding a html file .html.
|
||||
|
||||
$translations = G::getTranslations(Array(
|
||||
'ID_NEW', 'ID_EDIT', 'ID_STATUS', 'ID_DELETE', 'ID_IMPORT', 'ID_BROWSE_LIBRARY', 'ID_CATEGORY', 'ID_SELECT',
|
||||
'ID_PRO_DESCRIPTION', 'ID_PRO_TITLE', 'ID_CATEGORY', 'ID_STATUS', 'ID_PRO_USER', 'ID_PRO_CREATE_DATE', 'ID_PRO_DEBUG', 'ID_INBOX', 'ID_DRAFT',
|
||||
'ID_COMPLETED', 'ID_CANCELLED', 'ID_TOTAL_CASES', 'ID_ENTER_SEARCH_TERM', 'ID_ACTIVATE', 'ID_DEACTIVATE',
|
||||
'ID_SELECT', 'ID_SEARCH', 'ID_NO_SELECTION_WARNING', 'ID_PROCESS_DELETE_LABEL', 'ID_PROCESS_DELETE_ALL_LABEL',
|
||||
'ID_PROCESS_CANT_DELETE', 'ID_EDIT_BPMN'
|
||||
));
|
||||
|
||||
$oHeadPublisher->assign('pageSize', $conf->getEnvSetting('casesListRowNumber'));
|
||||
|
||||
$oHeadPublisher->assign('TRANSLATIONS', $translations);
|
||||
G::RenderPage('publish', 'extJs');
|
||||
|
||||
|
||||
|
||||
@@ -349,7 +349,142 @@ Ext.onReady(function(){
|
||||
|
||||
|
||||
function newProcess(){
|
||||
window.location = 'processes_New';
|
||||
// window.location = 'processes_New';
|
||||
|
||||
var ProcessCategories = new Ext.form.ComboBox({
|
||||
fieldLabel : 'Category',
|
||||
hiddenName : 'PRO_CATEGORY',
|
||||
valueField : 'CATEGORY_UID',
|
||||
displayField : 'CATEGORY_NAME',
|
||||
triggerAction : 'all',
|
||||
// emptyText : 'Select a category',
|
||||
selectOnFocus : true,
|
||||
editable : false,
|
||||
width: 180,
|
||||
allowBlank : true,
|
||||
|
||||
store : new Ext.data.Store( {
|
||||
proxy : new Ext.data.HttpProxy( {
|
||||
url : 'mainAjax',
|
||||
method : 'POST'
|
||||
}),
|
||||
baseParams : {
|
||||
request : 'processCategories'
|
||||
},
|
||||
reader : new Ext.data.JsonReader( {
|
||||
root : 'rows',
|
||||
fields : [ {
|
||||
name : 'CATEGORY_UID'
|
||||
}, {
|
||||
name : 'CATEGORY_NAME'
|
||||
} ]
|
||||
}),
|
||||
listeners:{
|
||||
load: function(){
|
||||
//i = cmbUsernameFormats.store.findExact('id', default_format, 0);
|
||||
//cmbUsernameFormats.setValue(cmbUsernameFormats.store.getAt(i).data.id);
|
||||
//cmbUsernameFormats.setRawValue(cmbUsernameFormats.store.getAt(i).data.name);
|
||||
}
|
||||
}
|
||||
}),
|
||||
listeners:{
|
||||
afterrender:function(){
|
||||
ProcessCategories.store.load();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var fieldset = {
|
||||
xtype : 'fieldset',
|
||||
autoHeight : true,
|
||||
defaults : {
|
||||
labelStyle : 'padding: 0px;',
|
||||
style: 'font-weight: bold'
|
||||
},
|
||||
items : [ {
|
||||
id: 'PRO_TITLE',
|
||||
fieldLabel: 'Title',
|
||||
xtype:'textfield',
|
||||
vtype: 'processName',
|
||||
width: 260
|
||||
}, {
|
||||
id: 'PRO_DESCRIPTION',
|
||||
fieldLabel: 'Description',
|
||||
xtype:'textarea',
|
||||
width: 260
|
||||
},
|
||||
ProcessCategories
|
||||
]
|
||||
}
|
||||
|
||||
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({
|
||||
title: 'Create Process',
|
||||
width: 450,
|
||||
height: 220,
|
||||
layout:'fit',
|
||||
autoScroll:true,
|
||||
modal: true,
|
||||
maximizable: false,
|
||||
items: [frm]
|
||||
});
|
||||
win.show();
|
||||
}
|
||||
|
||||
function saveProcess()
|
||||
{
|
||||
Ext.getCmp('newProcessForm').getForm().submit( {
|
||||
url : 'mainAjax?request=saveProcess',
|
||||
waitMsg : 'Creating Process...',
|
||||
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
|
||||
location.href = '../bpmn/processmap?PRO_UID='+resp.result.PRO_UID;
|
||||
},
|
||||
failure: function(obj, result) {
|
||||
Ext.Msg.alert( _('ID_ERROR'), resp.result.PRO_UID);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function doSearch(){
|
||||
@@ -542,3 +677,78 @@ capitalize = function(s){
|
||||
s = s.toLowerCase();
|
||||
return s.replace( /(^|\s)([a-z])/g , function(m,p1,p2){ return p1+p2.toUpperCase(); } );
|
||||
};
|
||||
|
||||
|
||||
// Add the additional 'advanced' VTypes
|
||||
Ext.apply(Ext.form.VTypes, {
|
||||
daterange : function(val, field) {
|
||||
var date = field.parseDate(val);
|
||||
|
||||
if(!date){
|
||||
return false;
|
||||
}
|
||||
if (field.startDateField) {
|
||||
var start = Ext.getCmp(field.startDateField);
|
||||
if (!start.maxValue || (date.getTime() != start.maxValue.getTime())) {
|
||||
start.setMaxValue(date);
|
||||
start.validate();
|
||||
}
|
||||
}
|
||||
else if (field.endDateField) {
|
||||
var end = Ext.getCmp(field.endDateField);
|
||||
if (!end.minValue || (date.getTime() != end.minValue.getTime())) {
|
||||
end.setMinValue(date);
|
||||
end.validate();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Always return true since we're only using this vtype to set the
|
||||
* min/max allowed values (these are tested for after the vtype test)
|
||||
*/
|
||||
return true;
|
||||
},
|
||||
|
||||
processName : function(val, field) {
|
||||
//if (field.initialPassField) {
|
||||
|
||||
Ext.Ajax.request({
|
||||
url : 'mainAjax' ,
|
||||
params : {request:'verifyProcessName', PRO_TITLE : val },
|
||||
method: 'POST',
|
||||
success: function ( result, request ) {
|
||||
var data = Ext.util.JSON.decode(result.responseText);
|
||||
return data.success;
|
||||
},
|
||||
failure: function ( result, request) {
|
||||
Ext.MessageBox.alert('Failed', result.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
//}
|
||||
//return true;
|
||||
},
|
||||
|
||||
processNameText : 'Process Name Already exists!'
|
||||
});
|
||||
|
||||
|
||||
function valProcess(){
|
||||
var val = Ext.getCmp('PRO_TITLE').getValue();
|
||||
|
||||
return Ext.Ajax.request({
|
||||
url : 'mainAjax' ,
|
||||
params : {request:'verifyProcessName', PRO_TITLE : val },
|
||||
method: 'POST',
|
||||
success: function ( result, request ) {
|
||||
var data = Ext.util.JSON.decode(result.responseText);
|
||||
//if( data.success )
|
||||
return 'sssssssss';
|
||||
// else
|
||||
// return true;
|
||||
},
|
||||
failure: function ( result, request) {
|
||||
Ext.MessageBox.alert('Failed', result.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user