Worked on creating and Saving Case tracker properties and started with Users and user groups(Ad hoc) Extjs

This commit is contained in:
safan
2011-01-07 13:39:38 +00:00
parent d21f0c079f
commit 665ec0a37e
7 changed files with 641 additions and 189 deletions

View File

@@ -5719,5 +5719,114 @@ class processMap {
}
return $aReportTable;
}
function getExtAvailableUsersList($sTaskUID = '', $iType = 1) {
try {
$oTasks = new Tasks ( );
$aAux = $oTasks->getGroupsOfTask($sTaskUID, $iType);
$aUIDS1 = array();
$aUIDS2 = array();
foreach ($aAux as $aGroup) {
$aUIDS1 [] = $aGroup ['GRP_UID'];
}
$aAux = $oTasks->getUsersOfTask($sTaskUID, $iType);
foreach ($aAux as $aUser) {
$aUIDS2 [] = $aUser ['USR_UID'];
}
$aUsers = array();
$aUsers [] = array('LABEL' => 'char', 'TAS_UID' => 'char', 'USR_UID' => 'char', 'TU_TYPE' => 'integer', 'TU_RELATION' => 'integer');
$sDelimiter = DBAdapter::getStringDelimiter ();
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(GroupwfPeer::GRP_UID);
$oCriteria->addAsColumn('GRP_TITLE', 'C.CON_VALUE');
$oCriteria->addAlias('C', 'CONTENT');
$aConditions = array();
$aConditions [] = array(GroupwfPeer::GRP_UID, 'C.CON_ID');
$aConditions [] = array('C.CON_CATEGORY', $sDelimiter . 'GRP_TITLE' . $sDelimiter);
$aConditions [] = array('C.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter);
$oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
$oCriteria->add(GroupwfPeer::GRP_STATUS, 'ACTIVE');
$oCriteria->add(GroupwfPeer::GRP_UID, $aUIDS1, Criteria::NOT_IN);
//$oCriteria->add(GroupwfPeer::GRP_UID, '', Criteria::NOT_EQUAL);
$oDataset = GroupwfPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$c = 0;
while ($aRow = $oDataset->getRow()) {
$c++;
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn('COUNT(*) AS MEMBERS_NUMBER');
$oCriteria->add(GroupUserPeer::GRP_UID, $aRow ['GRP_UID']);
$oDataset2 = GroupUserPeer::doSelectRS($oCriteria);
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset2->next();
$aRow2 = $oDataset2->getRow();
$aUsers [] = array('LABEL' => $aRow ['GRP_TITLE'] . ' <a href="#" onclick="usersGroup(\'' . $aRow ['GRP_UID'] . '\', \'' . $c . '\');return false;"><font color="green"><strong>(' . $aRow2 ['MEMBERS_NUMBER'] . ' ' . ((int) $aRow2 ['MEMBERS_NUMBER'] == 1 ? G::LoadTranslation('ID_USER') : G::LoadTranslation('ID_USERS')) . ')</strong></font></a> <br /><div id="users' . $c . '" style="display: none"></div>', 'TAS_UID' => $sTaskUID, 'USR_UID' => $aRow ['GRP_UID'], 'TU_TYPE' => $iType, 'TU_RELATION' => 2);
$oDataset->next();
}
$sDelimiter = DBAdapter::getStringDelimiter ();
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(UsersPeer::USR_UID);
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$oCriteria->add(UsersPeer::USR_STATUS, 'ACTIVE');
$oCriteria->add(UsersPeer::USR_UID, $aUIDS2, Criteria::NOT_IN);
$oDataset = UsersPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$aUsers [] = array('LABEL' => $aRow ['USR_FIRSTNAME'] . ' ' . $aRow ['USR_LASTNAME'], 'TAS_UID' => $sTaskUID, 'USR_UID' => $aRow ['USR_UID'], 'TU_TYPE' => $iType, 'TU_RELATION' => 1);
$oDataset->next();
}
global $_DBArray;
$_DBArray = (isset($_SESSION ['_DBArray']) ? $_SESSION ['_DBArray'] : '');
$_DBArray ['availableUsers'] = $aUsers;
$_SESSION ['_DBArray'] = $_DBArray;
G::LoadClass('ArrayPeer');
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('availableUsers');
$oCriteria->addDescendingOrderByColumn(TaskUserPeer::TU_RELATION);
$oCriteria->addAscendingOrderByColumn('LABEL');
return $oCriteria;
} catch (Exception $oError) {
throw ($oError);
}
}
function getExtusersadhoc($sProcessUID = '', $sTaskUID = '') {
try {
$oProcess = new Process ( );
$aFields = $oProcess->load($sProcessUID);
$oTask = new Task ( );
$aFields = $oTask->load($sTaskUID);
$_SESSION ['iType'] = 2;
$aFields ['TASK'] = $sTaskUID;
$aFields ['TYPE'] = $_SESSION ['iType'];
$aFields ['OF_TO_ASSIGN'] = G::LoadTranslation('ID_DE_ASSIGN');
$aFields ['CONFIRM'] = G::LoadTranslation('ID_MSG_CONFIRM_DEASIGN_USER_GROUP_MESSAGE');
$aFields ['UIDS'] = "'0'";
$oTasks = new Tasks ( );
$oGroups = new Groups ( );
$aAux1 = $oTasks->getGroupsOfTask($sTaskUID, $_SESSION ['iType']);
foreach ($aAux1 as $aGroup) {
$aAux2 = $oGroups->getUsersOfGroup($aGroup ['GRP_UID']);
foreach ($aAux2 as $aUser) {
$aFields ['UIDS'] .= ",'" . $aUser ['USR_UID'] . "'";
}
}
global $G_PUBLISH;
$G_PUBLISH = new Publisher ( );
$oTask = new Task ( );
$aTask = $oTask->load($sTaskUID);
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'users/users_ShortListAdhoc', $this->getTaskUsersCriteria($sTaskUID, $_SESSION ['iType']), $aFields);
G::RenderPage('publish', 'raw');
return true;
} catch (Exception $oError) {
throw ($oError);
}
}
}

View File

@@ -1,158 +1,179 @@
<?php
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection);
//$_GET['sid'] gets STEP_UID and sTYPE(i.e BEFORE and AFTER) in format STEP_UID-sTYPE
if(isset($_GET['stepid']))
{
$aStepTypeId = explode('|',$_GET['stepid']);
$_SESSION['stepUID'] = $_GET['stepid'];
//$aStepTypeId = explode('-','2517180104cd42c25cc39e4071099227-BEFORE');
$sStep = $aStepTypeId[0];
$sType = $aStepTypeId[1];
}
{
$aStepTypeId = explode('|',$_GET['stepid']);
$_SESSION['stepUID'] = $_GET['stepid'];
//$aStepTypeId = explode('-','2517180104cd42c25cc39e4071099227-BEFORE');
$sStep = $aStepTypeId[0];
$sType = $aStepTypeId[1];
}
//$_GET['sid'] gets STEP_UID and sTYPE(i.e BEFORE and AFTER) in format STEP_UID-sTYPE
if(isset($_GET['stepid']))
{
$aStepTypeId = explode('|',$_GET['stepid']);
$_SESSION['stepUID'] = $_GET['stepid'];
//$aStepTypeId = explode('-','2517180104cd42c25cc39e4071099227-BEFORE');
$sStep = $aStepTypeId[0];
$sType = $aStepTypeId[1];
}
switch($_GET['action'])
{
case 'getDynaformList':
$rows = $oProcessMap->getExtDynaformsList($_GET['pid']);
array_shift($rows);
break;
{
case 'getDynaformList':
$rows = $oProcessMap->getExtDynaformsList($_GET['pid']);
array_shift($rows);
break;
case 'getPMTableDynaform':
$oAdditionalTables = new AdditionalTables();
$aData = $oAdditionalTables->load($_GET['tabId'], true);
$addTabName = $aData['ADD_TAB_NAME'];
foreach ($aData['FIELDS'] as $iRow => $aRow) {
if ($aRow['FLD_KEY'] == 1) {
$rows[] = $aRow;
}
}
break;
case 'getAdditionalTables':
$rows = $oProcessMap->getExtAdditionalTablesList();
break;
case 'getInputDocumentList':
$rows = $oProcessMap->getExtInputDocumentsCriteria($_GET['pid']);
array_shift($rows);
break;
case 'editInputDocument':
require_once 'classes/model/InputDocument.php';
$oInputDocument = new InputDocument();
$rows = $oInputDocument->load($_GET['INP_DOC_UID']);
break;
case 'getOutputDocument':
$rows = $oProcessMap->getExtOutputDocumentsCriteria($_GET['pid']);
array_shift($rows);
break;
case 'editOutputDocument':
require_once 'classes/model/OutputDocument.php';
$oOutputDocument = new OutputDocument();
$rows = $oOutputDocument->load($_GET['tid']);
break;
case 'getReportTables':
$rows = $oProcessMap->getExtReportTables($_GET['pid']);
break;
case 'getReportTableType':
if(isset($_GET['pid']) && $_GET['type'] == 'NORMAL')
{
$aTheFields = array();
$aTheFields = getDynaformsVars($_GET['pid'], false);
foreach ($aTheFields as $aField)
{
$rows[] = array('FIELD_UID' => $aField['sName'] . '-' . $aField['sType'],
'FIELD_NAME' => $aField['sName']);
}
}
else if (isset($_GET['pid']) && $_GET['type'] == 'GRID')
{
$aTheFields = array();
$aTheFields = getGridsVars($_GET['pid']);
foreach ($aTheFields as $aField)
case 'getPMTableDynaform':
$oAdditionalTables = new AdditionalTables();
$aData = $oAdditionalTables->load($_GET['tabId'], true);
$addTabName = $aData['ADD_TAB_NAME'];
foreach ($aData['FIELDS'] as $iRow => $aRow)
{
$rows[] = array('FIELD_UID' => $aField['sName'] . '-' . $aField['sXmlForm'],
'FIELD_NAME' => $aField['sName']);
if ($aRow['FLD_KEY'] == 1)
{
$rows[] = $aRow;
}
}
}
break;
break;
case 'getDatabaseConnectionList':
$rows = $oProcessMap->getExtCriteriaDBSList($_GET['pid']);
break;
case 'getAdditionalTables':
$rows = $oProcessMap->getExtAdditionalTablesList();
break;
case 'editDatabaseConnection':
require_once 'classes/model/DbSource.php';
$o = new DbSource();
$rows = $o->load($_GET['tid']);
break;
case 'getInputDocumentList':
$rows = $oProcessMap->getExtInputDocumentsCriteria($_GET['pid']);
array_shift($rows);
break;
case 'process_User':
$rows = $oProcessMap->listExtProcessesUser($processUID);
break;
case 'availableProcessesUser':
$rows = $oProcessMap->listExtNoProcessesUser($processUID);
break;
case 'supervisorDynaforms':
$rows = $oProcessMap->getExtSupervisorDynaformsList($processUID);
break;
case 'availableSupervisorDynaforms':
$rows = $oProcessMap->getExtAvailableSupervisorDynaformsList($processUID);
break;
case 'supervisorInputDoc':
$rows = $oProcessMap->getExtSupervisorInputsList($processUID);
break;
case 'availableSupervisorInputDoc':
$rows = $oProcessMap->getExtAvailableSupervisorInputsList($processUID);
break;
case 'editInputDocument':
require_once 'classes/model/InputDocument.php';
$oInputDocument = new InputDocument();
$rows = $oInputDocument->load($_GET['INP_DOC_UID']);
break;
case 'getAssignedCaseTrackerObjects':
$rows = $oProcessMap->getExtCaseTrackerObjectsCriteria($_GET['pid']);
break;
case 'getOutputDocument':
$rows = $oProcessMap->getExtOutputDocumentsCriteria($_GET['pid']);
array_shift($rows);
break;
case 'getAvailableCaseTrackerObjects':
$rows = $oProcessMap->getAvailableExtCaseTrackerObjects($_GET['tid']);
break;
case 'editOutputDocument':
require_once 'classes/model/OutputDocument.php';
$oOutputDocument = new OutputDocument();
$rows = $oOutputDocument->load($_GET['tid']);
break;
case 'getAvailableSteps':
$rows = $oProcessMap->getExtAvailableBBCriteria($_GET['pid'], $_GET['tid']);
array_shift($rows);
break;
case 'getReportTables':
$rows = $oProcessMap->getExtReportTables($_GET['pid']);
break;
case 'getAssignedSteps':
$rows = $oProcessMap->getExtStepsCriteria($_GET['tid']);
array_shift($rows);
break;
case 'getReportTableType':
if(isset($_GET['pid']) && $_GET['type'] == 'NORMAL')
{
$aTheFields = array();
$aTheFields = getDynaformsVars($_GET['pid'], false);
foreach ($aTheFields as $aField)
{
$rows[] = array('FIELD_UID' => $aField['sName'] . '-' . $aField['sType'],
'FIELD_NAME' => $aField['sName']);
}
}
case 'getAssignedUsersList':
$rows = $oProcessMap->usersExtList($_GET['pid'], $_GET['tid']);
array_shift($rows);
break;
else if (isset($_GET['pid']) && $_GET['type'] == 'GRID')
{
$aTheFields = array();
$aTheFields = getGridsVars($_GET['pid']);
foreach ($aTheFields as $aField)
{
$rows[] = array('FIELD_UID' => $aField['sName'] . '-' . $aField['sXmlForm'],
'FIELD_NAME' => $aField['sName']);
}
}
break;
case 'getAvailableUsersList':
$rows = $oProcessMap->getAvailableExtUsersCriteria($_GET['tid']);
break;
case 'getDatabaseConnectionList':
$rows = $oProcessMap->getExtCriteriaDBSList($_GET['pid']);
break;
case 'getAvailableStepTriggers':
$aStepTypeId = explode('|',$_SESSION['stepUID']);
$sStep = $aStepTypeId[0];
$sType = $aStepTypeId[1];
//Getting available Steps Criteria that have been not selected for a particular task
$rows = $oProcessMap->getExtAvailableStepTriggersCriteria($_GET['pid'], $sStep, $_GET['tid'], $sType);
break;
case 'editDatabaseConnection':
require_once 'classes/model/DbSource.php';
$o = new DbSource();
$rows = $o->load($_GET['tid']);
break;
case 'getAssignedStepTriggers':
$rows = $oProcessMap->getExtStepTriggersCriteria($sStep, $_GET['tid'], $sType);
break;
}
//$result['totalCount'] = count($rows);
case 'process_User':
$rows = $oProcessMap->listExtProcessesUser($processUID);
break;
case 'availableProcessesUser':
$rows = $oProcessMap->listExtNoProcessesUser($processUID);
break;
case 'supervisorDynaforms':
$rows = $oProcessMap->getExtSupervisorDynaformsList($processUID);
break;
case 'availableSupervisorDynaforms':
$rows = $oProcessMap->getExtAvailableSupervisorDynaformsList($processUID);
break;
case 'supervisorInputDoc':
$rows = $oProcessMap->getExtSupervisorInputsList($processUID);
break;
case 'availableSupervisorInputDoc':
$rows = $oProcessMap->getExtAvailableSupervisorInputsList($processUID);
break;
case 'getAssignedCaseTrackerObjects':
$rows = $oProcessMap->getExtCaseTrackerObjectsCriteria($_GET['pid']);
break;
case 'getAvailableCaseTrackerObjects':
$rows = $oProcessMap->getAvailableExtCaseTrackerObjects($_GET['tid']);
break;
case 'getAvailableSteps':
$rows = $oProcessMap->getExtAvailableBBCriteria($_GET['pid'], $_GET['tid']);
array_shift($rows);
break;
case 'getAssignedSteps':
$rows = $oProcessMap->getExtStepsCriteria($_GET['tid']);
array_shift($rows);
break;
case 'getAssignedUsersList':
$rows = $oProcessMap->usersExtList($_GET['pid'], $_GET['tid']);
array_shift($rows);
break;
case 'getAvailableUsersList':
$rows = $oProcessMap->getAvailableExtUsersCriteria($_GET['tid']);
break;
case 'getAvailableStepTriggers':
$aStepTypeId = explode('|',$_SESSION['stepUID']);
$sStep = $aStepTypeId[0];
$sType = $aStepTypeId[1];
//Getting available Steps Criteria that have been not selected for a particular task
$rows = $oProcessMap->getExtAvailableStepTriggersCriteria($_GET['pid'], $sStep, $_GET['tid'], $sType);
break;
case 'getAssignedStepTriggers':
$rows = $oProcessMap->getExtStepTriggersCriteria($sStep, $_GET['tid'], $sType);
break;
case 'availableUsers':
$rows = $oProcessMap->getExtAvailableUsersList($_GET['tid']);
break;
case 'assignedUsers':
$rows = $oProcessMap->getExtusersadhoc($_GET['pid'], $_GET['tid']);
array_shift($rows);
break;
}
//$result['totalCount'] = count($rows);
//$result['data'] = $rows;
//print json_encode( $result ) ;
$tmpData = json_encode( $rows ) ;
@@ -160,5 +181,4 @@ switch($_GET['action'])
$result = $tmpData;
echo $result;
?>
?>

View File

@@ -1,11 +1,16 @@
<?
unset($_POST['form']['SAVE']);
if (!isset($_POST['form']['CT_DERIVATION_HISTORY'])) {
$_POST['form']['CT_DERIVATION_HISTORY'] = 0;
if(isset($_POST['form']))
$sValue = $_POST['form']; //For old processmap
else
$sValue = $_POST;
unset($sValue['SAVE']);
if (!isset($sValue['CT_DERIVATION_HISTORY'])) {
$sValue['CT_DERIVATION_HISTORY'] = 0;
}
if (!isset($_POST['form']['CT_MESSAGE_HISTORY'])) {
$_POST['form']['CT_MESSAGE_HISTORY'] = 0;
if (!isset($sValue['CT_MESSAGE_HISTORY'])) {
$sValue['CT_MESSAGE_HISTORY'] = 0;
}
require_once 'classes/model/CaseTracker.php';
$oCaseTracker = new CaseTracker();
$oCaseTracker->update($_POST['form']);
$oCaseTracker->update($sValue);

View File

@@ -77,6 +77,7 @@ MyWorkflow.prototype.AddTaskContextMenu= function(oShape)
},
{
text: 'Users & Users Groups (ad-hoc)',
handler: taskExtObj.editUsersAdHoc,
scope: oShape
},
{

View File

@@ -1053,7 +1053,7 @@ ProcessMapContext.prototype.processSupervisors= function()
});
var window = new Ext.Window({
title: 'Assign Process Supervisor',
title: 'Supervisor',
collapsible: false,
maximizable: false,
width: 400,
@@ -1270,7 +1270,7 @@ ProcessMapContext.prototype.processDynaform= function()
});
var window = new Ext.Window({
title: 'Assign Dynaform',
title: 'Dynaform',
collapsible: false,
maximizable: false,
width: 400,
@@ -1487,7 +1487,7 @@ ProcessMapContext.prototype.processIODoc= function()
});
var window = new Ext.Window({
title: 'Assign Dynaform',
title: 'Input Documents',
collapsible: false,
maximizable: false,
width: 400,
@@ -1517,7 +1517,7 @@ ProcessMapContext.prototype.processFileManager= function()
,height:300
});
var window = new Ext.Window({
var window = new Ext.Window({
title: 'Edit Process',
collapsible: false,
maximizable: false,
@@ -1577,29 +1577,53 @@ ProcessMapContext.prototype.caseTrackerProperties= function()
labelWidth: 75, // label settings here cascade unless overridden
frame:true,
bodyStyle:'padding:5px 5px 0',
width: 500,
height: 400,
defaults: {width: 350},
width: 300,
height: 300,
//defaults: {width: 350},
defaultType: 'textfield',
items: [{
width :100,
xtype :'combo',
mode :'local',
triggerAction :'all',
forceSelection :true,
editable :false,
fieldLabel :'Map Type',
name :'CT_MAP_TYPE',
displayField :'name',
value :'Process Map',
valueField :'value',
store :new Ext.data.JsonStore({
fields : ['name', 'value'],
data :[{name: 'None', value:'0'},
{name: 'Process Map', value: '1'},
{name: 'Stages Map', value:'2'}]
})
},{
xtype: 'fieldset',
layout:'column',
border:false,
width: 400,
//title: 'valueBased',
hidden: false,
id: 'evaluate',
items:[{
columnWidth:.6,
layout: 'form',
border:false,
items: [{
width :100,
xtype :'combo',
mode :'local',
triggerAction :'all',
forceSelection :true,
editable :false,
fieldLabel :'Map Type',
name :'CT_MAP_TYPE',
displayField :'name',
value :'PROCESSMAP',
valueField :'value',
store :new Ext.data.JsonStore({
fields : ['name', 'value'],
data :[{name: 'None', value:'NONE'},
{name: 'PROCESSMAP', value: 'PROCESSMAP'},
{name: 'STAGES', value:'STAGES'}]
})
}]
},{
columnWidth:.3,
layout: 'form',
border:false,
items: [{
xtype: 'box',
bodyStyle: 'padding:0 0 0 50px;',
autoEl: {tag: 'a', href: '../tracker/tracker_Ajax?PRO_UID=pro_uid&action=editStagesMap', children: [{tag: 'div', html: 'Edit'}]},
style: 'cursor:pointer;'
}]
}]
},{
xtype: 'checkbox',
fieldLabel: 'Derivation History',
name: 'CT_DERIVATION_HISTORY'
@@ -1609,17 +1633,17 @@ ProcessMapContext.prototype.caseTrackerProperties= function()
fieldLabel: 'Messages History',
name: 'CT_MESSAGE_HISTORY'
// checked:checkMessages
}]
}]
});
var Propertieswindow = new Ext.Window({
title: 'Edit Process',
title: 'Case tracker',
collapsible: false,
maximizable: false,
width: 500,
height: 400,
minWidth: 300,
minHeight: 200,
width: 300,
height: 300,
//minWidth: 300,
//minHeight: 200,
layout: 'fit',
plain: true,
bodyStyle: 'padding:5px;',
@@ -1629,13 +1653,22 @@ ProcessMapContext.prototype.caseTrackerProperties= function()
text: 'Save',
handler: function(){
var getForm = PropertiesForm.getForm().getValues();
var pro_uid = getForm.PRO_UID;
//var pro_uid = getForm.PRO_UID;
var MapType = getForm.CT_MAP_TYPE;
var DerivationHistory = getForm.CT_DERIVATION_HISTORY;
var MessageHistory = getForm.CT_MESSAGE_HISTORY;
if(DerivationHistory == 'on')
DerivationHistory = '1';
else
DerivationHistory = '0';
if(MessageHistory == 'on')
MessageHistory = '1';
else
MessageHistory = '0';
Ext.Ajax.request({
url : '../tracker/tracker_save.php',
url : '../tracker/tracker_Save.php',
method: 'POST',
params:{
PRO_UID :pro_uid,
@@ -1645,7 +1678,7 @@ ProcessMapContext.prototype.caseTrackerProperties= function()
},
success: function(response) {
Ext.MessageBox.alert ('Status','Connection Saved Successfully.');
}
}
});
}
},{

View File

@@ -528,7 +528,7 @@ ProcessOptions.prototype.dbConnection = function()
var btnRemove = new Ext.Button({
id: 'btnRemove',
text: 'Remove Step',
text: 'Remove',
iconCls: 'application_delete',
handler: function (s) {
editor.stopEditing();
@@ -861,7 +861,8 @@ ProcessOptions.prototype.dbConnection = function()
fieldLabel: 'Port',
name: 'DBS_PORT',
id:'port',
allowBlank: false
allowBlank: false,
editable:false
},{
xtype: 'textarea',
fieldLabel: 'Description',
@@ -879,9 +880,9 @@ ProcessOptions.prototype.dbConnection = function()
title: 'Add new Database Source',
collapsible: false,
maximizable: true,
width: 450,
width: 300,
//autoHeight: true,
height: 400,
//height: 400,
//layout: 'fit',
plain: true,
bodyStyle: 'padding:5px;',
@@ -958,7 +959,7 @@ ProcessOptions.prototype.dbConnection = function()
title: 'Database Source List',
collapsible: false,
maximizable: true,
width: 550,
width: 480,
//autoHeight: true,
height: 400,
//layout: 'fit',
@@ -1295,7 +1296,7 @@ ProcessOptions.prototype.addInputDoc= function(_5625)
autoHeight:false,
clicksToEdit: 1,
minHeight:400,
height :400,
height :350,
layout: 'fit',
cm: inputDocColumns,
stripeRows: true,

View File

@@ -402,8 +402,8 @@ TaskContext.prototype.editTaskSteps = function(_3252){
title: 'Steps Of',
collapsible: false,
maximizable: false,
width: 800,
height: 470,
width: 700,
height: 380,
minWidth: 200,
minHeight: 150,
layout: 'fit',
@@ -683,7 +683,7 @@ TaskContext.prototype.editUsers= function(_5625)
});
var window = new Ext.Window({
title: 'Assign User',
title: 'Users and User Groups',
collapsible: false,
maximizable: false,
width: 400,
@@ -771,7 +771,7 @@ TaskContext.prototype.editTaskProperties= function(_5625)
remoteSort : true,
//fields : taskFields,
proxy: new Ext.data.HttpProxy({
url: 'proxyTaskPropertiesDetails?tid='+taskId
url: 'proxyExtjs?tid='+taskId+'&action=getPropertiesList'
})
});
//taskUsers.setDefaultSort('LABEL', 'asc');
@@ -1310,7 +1310,7 @@ TaskContext.prototype.editTaskProperties= function(_5625)
//Loading Task Details into the form
taskPropertiesTabs.form.load({
url:'proxyTaskPropertiesDetails.php?tid=' +taskId,
url:'proxyExtjs.php?tid='+taskId+'&action=getPropertiesList',
method:'GET',
waitMsg:'Loading',
success:function(form, action) {
@@ -1327,11 +1327,11 @@ TaskContext.prototype.editTaskProperties= function(_5625)
var window = new Ext.Window({
title: 'Task: ',
title: 'Task:',
collapsible: false,
maximizable: false,
width: 600,
height: 450,
height: 400,
minWidth: 300,
minHeight: 150,
layout: 'fit',
@@ -1775,4 +1775,287 @@ TaskContext.prototype.stepTriggers = function(_5625)
}]
});
window.show();*/
}
TaskContext.prototype.editUsersAdHoc= function(_5625)
{
var taskExtObj = new TaskContext();
var pro_uid = workflow.getUrlVars();
var taskId = workflow.currentSelection.id;
var userFields = Ext.data.Record.create([
{
name: 'LABEL',
type: 'string'
},
{
name: 'TU_TYPE',
type: 'string'
},
{
name: 'TU_RELATION',
type: 'string'
},
{
name: 'TAS_UID',
type: 'string'
},
{
name: 'USR_UID',
type: 'string'
}
]);
var editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'
});
var btnAdd = new Ext.Button({
id: 'btnAdd',
text: 'Assign User',
iconCls: 'application_add',
handler: function(){
var User = grid.getStore();
var e = new userFields({
//LABEL: 'Select User or Group',
//LABEL: User.data.items[0].data.LABEL,
TAS_UID: '',
TU_TYPE: '',
USR_UID: '',
TU_RELATION: ''
});
//storeUsers.reload();
if(storeUsers.data.items.length == 0)
Ext.MessageBox.alert ('Status','No users are available. All users have been already assigned.');
else
{
editor.stopEditing();
taskUsers.insert(0, e);
grid.getView().refresh();
//grid.getSelectionModel().selectRow(0);
editor.startEditing(0, 0);
}
}
});
var btnRemove = new Ext.Button({
id: 'btnRemove',
text: 'Remove User',
iconCls: 'application_delete',
handler: function (s) {
editor.stopEditing();
var s = grid.getSelectionModel().getSelections();
for(var i = 0, r; r = s[i]; i++){
//First Deleting assigned users from Database
var user_TURel = r.data.TU_RELATION;
var userUID = r.data.USR_UID;
var user_TUtype = r.data.TU_TYPE;
var urlparams = '?action=ofToAssign&data={"TAS_UID":"'+taskId+'","TU_RELATION":"'+user_TURel+'","USR_UID":"'+userUID+'","TU_TYPE":"'+user_TUtype+'"}';
//if USR_UID is properly defined (i.e. set to valid value) then only delete the row
//else its a BLANK ROW for which Ajax should not be called.
if(r.data.USR_UID != "")
{
Ext.Ajax.request({
url : 'processes_Ajax.php' +urlparams ,
/*method: 'POST',
params: {
functions : 'ofToAssign',
TAS_UID : taskId,
TU_RELATION : user_TURel,
USR_UID : userUID,
TU_TYPE : user_TUtype
},*/
success: function(response) {
Ext.MessageBox.alert ('Status','User has been removed successfully.');
//Secondly deleting from Grid
taskUsers.remove(r);
//Reloading available user store
taskUsers.reload();
}
});
}
else
taskUsers.remove(r);
}
}
});
var tb = new Ext.Toolbar({
items: [btnAdd, btnRemove]
});
// create the Data Store of users that are already assigned to a task
var taskUsers = new Ext.data.JsonStore({
root : 'data',
totalProperty: 'totalCount',
idProperty : 'gridIndex',
remoteSort : true,
fields : userFields,
proxy: new Ext.data.HttpProxy({
url: 'proxyExtjs?pid='+pro_uid+'&tid='+taskId+'&action=assignedUsers'
})
});
//taskUsers.setDefaultSort('LABEL', 'asc');
taskUsers.load();
// create the Data Store of users that are not assigned to a task
var storeUsers = new Ext.data.JsonStore({
root : 'data',
url : 'proxyExtjs?tid='+taskId+'&action=availableUsers',
totalProperty : 'totalCount',
idProperty : 'gridIndex',
remoteSort : false, //true,
autoLoad : true,
fields : userFields
});
var grid = new Ext.grid.GridPanel({
store: taskUsers,
id : 'mygrid',
//cm: cm,
loadMask: true,
loadingText: 'Loading...',
renderTo: 'cases-grid',
frame: false,
autoHeight:false,
clicksToEdit: 1,
minHeight:400,
height :400,
layout: 'fit',
plugins: [editor],
columns: [
new Ext.grid.RowNumberer(),
{
id: 'LABEL',
header: 'Group or User',
dataIndex: 'LABEL',
width: 100,
sortable: true,
editor: new Ext.form.ComboBox({
xtype: 'combo',
fieldLabel: 'Users_groups',
hiddenName: 'number',
store : storeUsers,
displayField : 'LABEL' ,
valueField : 'LABEL',
name : 'LABEL',
scope : _5625,
triggerAction: 'all',
emptyText: 'Select User or Group',
allowBlank: false,
onSelect: function(record, index){
var User = grid.getStore();
if(typeof _5625.scope.workflow.currentrowIndex == 'undefined')
var selectedrowIndex = '0';
else
selectedrowIndex = _5625.scope.workflow.currentrowIndex; //getting Index of the row that has been edited
//User.data.items[0].data.LABEL= record.data.LABEL;
User.data.items[selectedrowIndex].data.TAS_UID = record.data.TAS_UID;
User.data.items[selectedrowIndex].data.TU_TYPE = record.data.TU_TYPE;
User.data.items[selectedrowIndex].data.USR_UID = record.data.USR_UID;
User.data.items[selectedrowIndex].data.TU_RELATION = record.data.TU_RELATION;
this.setValue(record.data[this.valueField || this.displayField]);
this.collapse();
}
})
}
],
sm: new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
rowselect: function(smObj, rowIndex, record) {
_5625.scope.workflow.currentrowIndex = rowIndex;
}
}
}),
stripeRows: true,
viewConfig: {forceFit: true},
tbar: tb
});
storeUsers.load();
editor.on({
scope: this,
afteredit: function(roweditor, changes, record, rowIndex) {
var taskId = record.data.TAS_UID;
var userId = record.data.USR_UID;
var tu_Type = record.data.TU_TYPE;
var tu_Relation = record.data.TU_RELATION;
var urlparams = '?action=assign&data={"TAS_UID":"'+taskId+'","USR_UID":"'+userId+'","TU_TYPE":"'+tu_Type+'","TU_RELATION":"'+tu_Relation+'"}';
Ext.Ajax.request({
url: 'processes_Ajax.php' +urlparams ,
success: function (response) { // When saving data success
Ext.MessageBox.alert ('Status','User has been successfully assigned');
},
failure: function () { // when saving data failed
Ext.MessageBox.alert ('Status','Failed saving User Assigned to Task');
}
});
//Updating the user incase if already assigned user has been replaced by other user
if(changes != '' && typeof record.json != 'undefined')
{
var user_TURel = record.json.TU_RELATION;
var userUID = record.json.USR_UID;
var user_TUtype = record.json.TU_TYPE;
urlparams = '?action=ofToAssign&data={"TAS_UID":"'+taskId+'","TU_RELATION":"'+user_TURel+'","USR_UID":"'+userUID+'","TU_TYPE":"'+user_TUtype+'"}';
Ext.Ajax.request({
url : 'processes_Ajax.php' +urlparams ,
success: function(response) {
//Ext.MessageBox.alert ('Status','User has been updated successfully.');
}
});
}
storeUsers.reload();
}
});
var panel = new Ext.Panel({
id: 'panel',
renderTo: Ext.getBody(),
items: [grid]
});
var window = new Ext.Window({
title: 'Users and User Groups',
collapsible: false,
maximizable: false,
width: 400,
height: 350,
minWidth: 200,
minHeight: 150,
layout: 'fit',
plain: true,
bodyStyle: 'padding:5px;',
buttonAlign: 'center',
items: panel
/*buttons: [{
text: 'Save',
handler: function(){
Ext.MessageBox.alert ("User has been successfully assigned");
//var getstore = grid.getStore();
//var getData = getstore.data.items;
//taskExtObj.saveTaskUsers(getData);
}
},{
text: 'Cancel',
handler: function(){
// when this button clicked,
window.close();
}
}]*/
});
window.show();
}