finish update for process actions with proxy
This commit is contained in:
@@ -116,94 +116,82 @@ class ProcessProxy extends HttpProxyController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get users list
|
||||||
|
*
|
||||||
|
* @param $params httpdata object
|
||||||
|
*/
|
||||||
function getUsers($params)
|
function getUsers($params)
|
||||||
{
|
{
|
||||||
require_once 'classes/model/Users.php';
|
require_once 'classes/model/Users.php';
|
||||||
G::LoadClass('configuration');
|
$search = isset($params->search) ? $params->search: null;
|
||||||
$conf = new Configurations;
|
return Users::getAll($params->start, $params->limit, $search);
|
||||||
|
|
||||||
$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(
|
|
||||||
'format',
|
|
||||||
Array(
|
|
||||||
'userName'=>$user['USR_USERNAME'],
|
|
||||||
'firstName'=>$user['USR_FIRSTNAME'],
|
|
||||||
'lastName'=>$user['USR_LASTNAME']
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
print G::json_encode($users);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get groups list
|
||||||
|
*
|
||||||
|
* @param $params httpdata object
|
||||||
|
*/
|
||||||
function getGroups($params)
|
function getGroups($params)
|
||||||
{
|
{
|
||||||
require_once 'classes/model/Groupwf.php';
|
require_once 'classes/model/Groupwf.php';
|
||||||
$search = isset($params['search']) ? $params['search']: null;
|
$search = isset($params['search']) ? $params['search']: null;
|
||||||
$groups = Groupwf::getAll($params['start'], $params['limit'], $search);
|
return Groupwf::getAll($params['start'], $params['limit'], $search);
|
||||||
|
|
||||||
print G::json_encode($groups);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function assignUsersTask($param)
|
/**
|
||||||
|
* Assign actors to task
|
||||||
|
*
|
||||||
|
* @param unknown_type $param
|
||||||
|
*/
|
||||||
|
function assignActorsTask($param)
|
||||||
{
|
{
|
||||||
try{
|
require_once 'classes/model/TaskUser.php';
|
||||||
require_once 'classes/model/TaskUser.php';
|
require_once 'classes/model/Task.php';
|
||||||
require_once 'classes/model/Task.php';
|
$oTaskUser = new TaskUser();
|
||||||
$oTaskUser = new TaskUser();
|
$UIDS = explode(',', $param->UIDS);
|
||||||
$UIDS = explode(',', $param['UIDS']);
|
$TU_TYPE = $param->TU_TYPE;
|
||||||
$TU_TYPE = 1;
|
$TAS_UID = $param->TAS_UID;
|
||||||
|
|
||||||
foreach( $UIDS as $UID ) {
|
foreach( $UIDS as $UID ) {
|
||||||
if ($_POST['TU_RELATION'] == 1 )
|
if ($param->TU_RELATION == '1' )
|
||||||
$oTaskUser->create(array('TAS_UID' => $param['TAS_UID'], 'USR_UID' => $UID, 'TU_TYPE' => $TU_TYPE, 'TU_RELATION' => 1));
|
$oTaskUser->create(array('TAS_UID' => $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));
|
|
||||||
}
|
|
||||||
$task = TaskPeer::retrieveByPk($param['TAS_UID']);
|
|
||||||
|
|
||||||
$result->success = true;
|
|
||||||
if( count($UIDS) > 1 )
|
|
||||||
$result->msg = __('ID_ACTORS_ASSIGNED_SUCESSFULLY', SYS_LANG, Array(count($UIDS), $task->getTasTitle()));
|
|
||||||
else
|
else
|
||||||
$result->msg = __('ID_ACTOR_ASSIGNED_SUCESSFULLY', SYS_LANG, Array('tas_title'=>$task->getTasTitle()));
|
$oTaskUser->create(array('TAS_UID' => $TAS_UID, 'USR_UID' => $UID, 'TU_TYPE' => $TU_TYPE, 'TU_RELATION' => 2));
|
||||||
} catch(Exception $e){
|
|
||||||
$result->success = false;
|
|
||||||
$result->msg = $e->getMessage();
|
|
||||||
}
|
}
|
||||||
|
$task = TaskPeer::retrieveByPk($TAS_UID);
|
||||||
|
|
||||||
print G::json_encode($result);
|
$this->success = true;
|
||||||
|
if( count($UIDS) > 1 )
|
||||||
|
$this->msg = __('ID_ACTORS_ASSIGNED_SUCESSFULLY', SYS_LANG, Array(count($UIDS), $task->getTasTitle()));
|
||||||
|
else
|
||||||
|
$this->msg = __('ID_ACTOR_ASSIGNED_SUCESSFULLY', SYS_LANG, Array('tas_title'=>$task->getTasTitle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeUsersTask($param)
|
/**
|
||||||
|
* Remove Actors from Task
|
||||||
|
*
|
||||||
|
* @param $param
|
||||||
|
*/
|
||||||
|
function removeActorsTask($param)
|
||||||
{
|
{
|
||||||
try{
|
require_once 'classes/model/TaskUser.php';
|
||||||
require_once 'classes/model/TaskUser.php';
|
$oTaskUser = new TaskUser();
|
||||||
$oTaskUser = new TaskUser();
|
$USR_UIDS = explode(',', $param->USR_UID);
|
||||||
$USR_UIDS = explode(',', $param['USR_UID']);
|
$TU_RELATIONS = explode(',', $param->TU_RELATION);
|
||||||
$TU_RELATIONS = explode(',', $param['TU_RELATION']);
|
$TU_TYPE = $param->TU_TYPE;
|
||||||
$TU_TYPE = 1;
|
|
||||||
|
|
||||||
foreach($USR_UIDS as $i=>$USR_UID) {
|
foreach($USR_UIDS as $i=>$USR_UID) {
|
||||||
if ($TU_RELATIONS[$i] == 1 ){
|
if ($TU_RELATIONS[$i] == 1 ){
|
||||||
|
$oTaskUser->remove($param->TAS_UID, $USR_UID, $TU_TYPE, 1);
|
||||||
$oTaskUser->remove($param['TAS_UID'], $USR_UID, $TU_TYPE, 1);
|
} else {
|
||||||
|
$oTaskUser->remove($param->TAS_UID, $USR_UID, $TU_TYPE, 2);
|
||||||
} else {
|
|
||||||
$oTaskUser->remove($param['TAS_UID'], $USR_UID, $TU_TYPE, 2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$result->success = true;
|
|
||||||
$result->msg = '';
|
|
||||||
} catch(Exception $e){
|
|
||||||
$result->success = false;
|
|
||||||
$result->msg = $e->getMessage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print G::json_encode($result);
|
$this->success = true;
|
||||||
|
$this->msg = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -392,6 +380,9 @@ class ProcessProxy extends HttpProxyController
|
|||||||
$this->sucess = true;
|
$this->sucess = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get calendar list
|
||||||
|
*/
|
||||||
function getCaledarList()
|
function getCaledarList()
|
||||||
{
|
{
|
||||||
G::LoadClass('calendar');
|
G::LoadClass('calendar');
|
||||||
@@ -399,20 +390,23 @@ class ProcessProxy extends HttpProxyController
|
|||||||
$calendarObj = $calendar->getCalendarList(true, true);
|
$calendarObj = $calendar->getCalendarList(true, true);
|
||||||
$calendarObj['array'][0] = Array('CALENDAR_UID'=>'', 'CALENDAR_NAME'=>'');
|
$calendarObj['array'][0] = Array('CALENDAR_UID'=>'', 'CALENDAR_NAME'=>'');
|
||||||
|
|
||||||
$response->rows = $calendarObj['array'];
|
$this->rows = $calendarObj['array'];
|
||||||
|
|
||||||
print G::json_encode($response);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get PM Variables
|
||||||
|
*
|
||||||
|
* @param $param{PRO_UID}
|
||||||
|
*/
|
||||||
function getPMVariables($param)
|
function getPMVariables($param)
|
||||||
{
|
{
|
||||||
G::LoadClass('processMap');
|
G::LoadClass('processMap');
|
||||||
$oProcessMap = new processMap(new DBConnection);
|
$oProcessMap = new processMap(new DBConnection);
|
||||||
$response->rows = getDynaformsVars($param['PRO_UID']);
|
$rows = getDynaformsVars($param->PRO_UID);
|
||||||
foreach($response->rows as $i=>$var){
|
foreach($rows as $i=>$var){
|
||||||
$response->rows[$i]['sName'] = "@@{$var['sName']}";
|
$rows[$i]['sName'] = "@@{$var['sName']}";
|
||||||
}
|
}
|
||||||
print G::json_encode($response);
|
$this->rows = $rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -267,9 +267,9 @@ Ext.onReady ( function() {
|
|||||||
usersPanelLimit = 1000;
|
usersPanelLimit = 1000;
|
||||||
|
|
||||||
var usersStore = new Ext.data.Store( {
|
var usersStore = new Ext.data.Store( {
|
||||||
autoLoad: true,
|
autoLoad: false,
|
||||||
proxy : new Ext.data.HttpProxy({
|
proxy : new Ext.data.HttpProxy({
|
||||||
url: '../processes/ajaxListener?action=getUsers&start='+usersPanelStart+'&limit='+usersPanelLimit
|
url: '../processProxy/getUsers?start='+usersPanelStart+'&limit='+usersPanelLimit
|
||||||
}),
|
}),
|
||||||
reader : new Ext.data.JsonReader( {
|
reader : new Ext.data.JsonReader( {
|
||||||
totalProperty: 'totalCount',
|
totalProperty: 'totalCount',
|
||||||
@@ -350,9 +350,9 @@ Ext.onReady ( function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var groupsStore = new Ext.data.Store( {
|
var groupsStore = new Ext.data.Store( {
|
||||||
autoLoad: true,
|
autoLoad: false,
|
||||||
proxy : new Ext.data.HttpProxy({
|
proxy : new Ext.data.HttpProxy({
|
||||||
url: '../processes/ajaxListener?action=getGroups&start='+usersPanelStart+'&limit='+usersPanelLimit
|
url: '../processProxy/getGroups?start='+usersPanelStart+'&limit='+usersPanelLimit
|
||||||
}),
|
}),
|
||||||
reader : new Ext.data.JsonReader( {
|
reader : new Ext.data.JsonReader( {
|
||||||
totalProperty: 'totalCount',
|
totalProperty: 'totalCount',
|
||||||
@@ -509,7 +509,7 @@ Ext.onReady ( function() {
|
|||||||
parent.Ext.getCmp('eastPanelCenter').setTitle(Ext.getCmp('usersPanel')._targetTask.name);
|
parent.Ext.getCmp('eastPanelCenter').setTitle(Ext.getCmp('usersPanel')._targetTask.name);
|
||||||
}
|
}
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
url: '../processes/ajaxListener',
|
url: '../processProxy/assignActorsTask',
|
||||||
success: function(response){
|
success: function(response){
|
||||||
var result = Ext.util.JSON.decode(response.responseText);
|
var result = Ext.util.JSON.decode(response.responseText);
|
||||||
if( result.success ) {
|
if( result.success ) {
|
||||||
@@ -521,6 +521,7 @@ Ext.onReady ( function() {
|
|||||||
if( typeof parent != 'undefined' ) {
|
if( typeof parent != 'undefined' ) {
|
||||||
var tu_type = '';
|
var tu_type = '';
|
||||||
parent.Ext.getCmp('eastPanel').show();
|
parent.Ext.getCmp('eastPanel').show();
|
||||||
|
parent.Ext.getCmp('usersPanelTabs').getTabEl('usersTaskGrid').style.display = '';
|
||||||
parent.Ext.getCmp('usersPanelTabs').setActiveTab(1);
|
parent.Ext.getCmp('usersPanelTabs').setActiveTab(1);
|
||||||
parent.Ext.getCmp('usersTaskGrid').store.reload({params:{tas_uid: _TAS_UID, tu_type: tu_type}});
|
parent.Ext.getCmp('usersTaskGrid').store.reload({params:{tas_uid: _TAS_UID, tu_type: tu_type}});
|
||||||
}
|
}
|
||||||
@@ -530,9 +531,9 @@ Ext.onReady ( function() {
|
|||||||
},
|
},
|
||||||
failure: function(){},
|
failure: function(){},
|
||||||
params: {
|
params: {
|
||||||
action : 'assignUsersTask',
|
|
||||||
TAS_UID : _TAS_UID,
|
TAS_UID : _TAS_UID,
|
||||||
TU_RELATION : type,
|
TU_RELATION : type,
|
||||||
|
TU_TYPE : 1,
|
||||||
UIDS : uids
|
UIDS : uids
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -546,6 +547,10 @@ Ext.onReady ( function() {
|
|||||||
usersPanel.setPosition(0, divScroll.scrollTop);
|
usersPanel.setPosition(0, divScroll.scrollTop);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
usersPanel.on('afterrender', function(e) {
|
||||||
|
Ext.getCmp('usersGrid').store.load();
|
||||||
|
Ext.getCmp('groupsGrid').store.load();
|
||||||
|
}, this);
|
||||||
|
|
||||||
//usersPanel.show();
|
//usersPanel.show();
|
||||||
var divScroll = document.body;
|
var divScroll = document.body;
|
||||||
|
|||||||
@@ -149,13 +149,14 @@ Ext.onReady ( function() {
|
|||||||
|
|
||||||
//PMExt.confirm(_('ID_CONFIRM'), _('ID_REMOVE_USERS_CONFIRM'), function(){
|
//PMExt.confirm(_('ID_CONFIRM'), _('ID_REMOVE_USERS_CONFIRM'), function(){
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
url : '../processes/ajaxListener',
|
url : '../processProxy/removeActorsTask',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
params: {
|
params: {
|
||||||
action : 'removeUsersTask',
|
action : 'removeUsersTask',
|
||||||
USR_UID: usr_uid,
|
USR_UID: usr_uid,
|
||||||
TU_RELATION: tu_relation,
|
TU_RELATION: tu_relation,
|
||||||
TAS_UID: _TAS_UID
|
TAS_UID: _TAS_UID,
|
||||||
|
TU_TYPE: 1
|
||||||
},
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
var result = Ext.util.JSON.decode(response.responseText);
|
var result = Ext.util.JSON.decode(response.responseText);
|
||||||
@@ -262,8 +263,8 @@ Ext.onReady ( function() {
|
|||||||
allowBlank : true,
|
allowBlank : true,
|
||||||
store : new Ext.data.Store( {
|
store : new Ext.data.Store( {
|
||||||
//autoLoad: true, //autoload the data
|
//autoLoad: true, //autoload the data
|
||||||
proxy : new Ext.data.HttpProxy({ url: '../processes/ajaxListener'}),
|
proxy : new Ext.data.HttpProxy({ url: '../processProxy/getCaledarList'}),
|
||||||
baseParams : {action: 'getCaledarList'},
|
//baseParams : {action: 'getCaledarList'},
|
||||||
reader : new Ext.data.JsonReader( {
|
reader : new Ext.data.JsonReader( {
|
||||||
root : 'rows',
|
root : 'rows',
|
||||||
fields : [
|
fields : [
|
||||||
@@ -287,8 +288,8 @@ Ext.onReady ( function() {
|
|||||||
allowBlank : true,
|
allowBlank : true,
|
||||||
store : new Ext.data.Store( {
|
store : new Ext.data.Store( {
|
||||||
//autoLoad: false, //autoload the data
|
//autoLoad: false, //autoload the data
|
||||||
proxy : new Ext.data.HttpProxy({ url: '../processes/ajaxListener'}),
|
proxy : new Ext.data.HttpProxy({ url: '../processProxy/getPMVariables'}),
|
||||||
baseParams : {action: 'getPMVariables', PRO_UID: pro_uid},
|
baseParams : {PRO_UID: pro_uid},
|
||||||
reader : new Ext.data.JsonReader( {
|
reader : new Ext.data.JsonReader( {
|
||||||
root : 'rows',
|
root : 'rows',
|
||||||
fields : [
|
fields : [
|
||||||
|
|||||||
Reference in New Issue
Block a user