Adding all changes of the Gmail Integration

New Change deleting Date
This commit is contained in:
jenny
2015-11-09 11:01:11 -04:00
parent 7fc80c41c7
commit 703d10cdad
14 changed files with 1079 additions and 15 deletions

View File

@@ -11,6 +11,8 @@ if (isset( $_GET['ux'] )) {
default:
$url = 'casesListExtJs';
}
} else if( isset( $_GET['gmail'] ) ){
$url = 'derivatedGmail';
} else {
$url = 'casesListExtJs';
}
@@ -19,7 +21,11 @@ if (isset( $_GET['ux'] )) {
}
echo " window.parent.location.href = '$url';";
if (isset( $_GET['ux'] )) {
echo '} else { window.parent.location.href = \'casesListExtJs\'; }';
if(PMLicensedFeatures::getSingleton()->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')){
echo '} else { window.parent.location.href = \'derivatedGmail\'; }';
} else {
echo '} else { window.parent.location.href = \'casesListExtJs\'; }';
}
}
?>
}

View File

@@ -67,6 +67,15 @@ $aDelegation = $oAppDelegation->load( $sAppUid, $iDelIndex );
//if there are no user in the delegation row, this case is still in selfservice
if ($aDelegation['USR_UID'] == "") {
$oCase->setCatchUser( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'] );
//changing email labels if the claim comes from gmail
if($_SESSION['gmail'] == 1){
$labGmail = new labelsGmail();
$oResponse = $labGmail->setLabels($sAppUid, $iDelIndex, -1, true);
die( '<script type="text/javascript">
parent.document.getElementById("iframePM").setAttribute("src", "'.$_SESSION["server"].'cases/cases_Open?APP_UID=' . $_SESSION["APPLICATION"] . '&DEL_INDEX=' . $_SESSION["INDEX"] . '&action=unassigned");
</script>' );
}
} else {
G::SendMessageText( G::LoadTranslation( 'ID_CASE_ALREADY_DERIVATED' ), 'error' );
}

View File

@@ -24,7 +24,52 @@
if (!isset($_SESSION['USER_LOGGED'])) {
G::SendTemporalMessage( 'ID_LOGIN_AGAIN', 'warning', 'labels' );
die( '<script type="text/javascript">
parent.location = "../cases/casesStartPage?action=startCase";
var olink = parent.uri;
var flag = 0;
if(olink == undefined){
olink = window.frameElement.src;
flag = 1;
}
if(olink.search("gmail") == -1){
parent.location = "../cases/casesStartPage?action=startCase";
} else {
var data = olink.split("?");
var odata = data[1].split("&");
var appUid = odata[0].split("=");
var delIndex = odata[1].split("=");
var action = odata[2].split("=");
var dataToSend = {
"action": "credentials",
"operation": "refreshPmSession",
"type": "processCall",
"funParams": [
appUid[1],
delIndex[1],
action[1],
0
],
"expectReturn": false
};
if (flag == 0){
parent.parent.postMessage(JSON.stringify(dataToSend), "https://mail.google.com");
} else {
dataToSend = {
"action": "credentials",
"operation": "refreshPmSession",
"type": "processCall",
"funParams": [
appUid[1],
delIndex[1],
action[1],
1
],
"expectReturn": false
};
parent.postMessage(JSON.stringify(dataToSend), "*");
}
}
</script>');
}
/* Permissions */
@@ -176,6 +221,8 @@ try {
if (isset( $_SESSION['user_experience'] )) {
$aNextStep['PAGE'] = 'casesListExtJsRedirector?ux=' . $_SESSION['user_experience'];
$debuggerAvailable = false;
} else if( isset( $_SESSION['gmail'] ) ){
$aNextStep['PAGE'] = 'casesListExtJsRedirector?gmail='.$_SESSION['gmail'];
} else {
$aNextStep['PAGE'] = 'casesListExtJsRedirector';
}

View File

@@ -22,6 +22,10 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
if(isset( $_GET['gmail']) && $_GET['gmail'] == 1){
$_SESSION['gmail'] = 1;
}
/* Permissions */
if ($RBAC->userCanAccess( 'PM_CASES' ) != 1) {
switch ($RBAC->userCanAccess( 'PM_CASES' )) {

View File

@@ -27,10 +27,61 @@ if (!isset($_SESSION['USER_LOGGED'])) {
die( '<script type="text/javascript">
try
{
prnt = parent.parent;
top.location = top.location;
var olink = parent.uri;
var flag = 0;
if(olink == undefined){
olink = window.frameElement.src;
flag = 1;
}
if(olink.search("gmail") == -1){
prnt = parent.parent;
top.location = top.location;
} else {
var data = olink.split("?");
var odata = data[1].split("&");
var appUid = odata[0].split("=");
var delIndex = odata[1].split("=");
var action = odata[2].split("=");
var dataToSend = {
"action": "credentials",
"operation": "refreshPmSession",
"type": "processCall",
"funParams": [
appUid[1],
delIndex[1],
action[1],
0
],
"expectReturn": false
};
if (flag == 0){
parent.parent.postMessage(JSON.stringify(dataToSend), "https://mail.google.com");
}else {
//top.location =
var x = window.postMessage(JSON.stringify(dataToSend), "https://mail.google.com");
if(x == undefined){
//Here the code to access the extension from the gadget
dataToSend = {
"action": "credentials",
"operation": "refreshPmSession",
"type": "processCall",
"funParams": [
appUid[1],
delIndex[1],
action[1],
1
],
"expectReturn": false
};
parent.postMessage(JSON.stringify(dataToSend), "*");
}
}
}
}
catch (err)
catch (err)
{
parent.location = parent.location;
}

View File

@@ -2,6 +2,11 @@
require_once 'classes/model/AppDelegation.php';
$delegation = new AppDelegation();
if( $delegation->alreadyRouted($_SESSION['APPLICATION'],$_SESSION['INDEX']) ) {
if($_SESSION['gmail'] == 1){
$mUrl = '../cases/cases_Open?APP_UID='.$_SESSION['APPLICATION'].'&DEL_INDEX='.$_SESSION['INDEX'].'&action=sent';
header( 'location:' . $mUrl );
die();
}
G::header('location: ../cases/casesListExtJs');
die();
}
@@ -9,16 +14,67 @@ if( $delegation->alreadyRouted($_SESSION['APPLICATION'],$_SESSION['INDEX']) ) {
if (!isset($_SESSION['USER_LOGGED'])) {
G::SendTemporalMessage( 'ID_LOGIN_AGAIN', 'warning', 'labels' );
die( '<script type="text/javascript">
try
{
prnt = parent.parent;
top.location = top.location;
}
catch (err)
{
parent.location = parent.location;
}
</script>');
try
{
var olink = parent.uri;
var flag = 0;
if(olink == undefined){
olink = window.frameElement.src;
flag = 1;
}
if(olink.search("gmail") == -1){
prnt = parent.parent;
top.location = top.location;
} else {
var data = olink.split("?");
var odata = data[1].split("&");
var appUid = odata[0].split("=");
var delIndex = odata[1].split("=");
var action = odata[2].split("=");
var dataToSend = {
"action": "credentials",
"operation": "refreshPmSession",
"type": "processCall",
"funParams": [
appUid[1],
delIndex[1],
action[1],
0
],
"expectReturn": false
};
if (flag == 0){
parent.parent.postMessage(JSON.stringify(dataToSend), "https://mail.google.com");
}else {
//top.location =
var x = window.postMessage(JSON.stringify(dataToSend), "https://mail.google.com");
if(x == undefined){
//Here the code to access the extension from the gadget
dataToSend = {
"action": "credentials",
"operation": "refreshPmSession",
"type": "processCall",
"funParams": [
appUid[1],
delIndex[1],
action[1],
1
],
"expectReturn": false
};
parent.postMessage(JSON.stringify(dataToSend), "*");
}
}
}
}
catch (err)
{
parent.location = parent.location;
}
</script>');
}
/**
* cases_Step.php

View File

@@ -0,0 +1,47 @@
<?php
use Gulliver\core\ServiceContainer;
$sc = ServiceContainer::getInstance();
$session = $sc->make('session.store');
$licensedFeatures = & PMLicensedFeatures::getSingleton();
if (!$licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die;
}
$caseId = $session->get('APPLICATION');
$usrUid = $session->get('USER_LOGGED');
$usrName = $session->get('USR_FULLNAME');
$actualIndex = $session->get('INDEX');
$cont = 0;
use \ProcessMaker\Services\Api;
$appDel = new AppDelegation();
$actualThread = $appDel->Load($caseId, $actualIndex);
$actualLastIndex = $actualThread['DEL_PREVIOUS'];
$appDelPrev = $appDel->LoadParallel($caseId);
if($appDelPrev == array()){
$appDelPrev['0'] = $actualThread;
}
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
foreach ($appDelPrev as $app){
if( ($app['DEL_INDEX'] != $actualIndex) && ($app['DEL_PREVIOUS'] != $actualLastIndex) ){ //Sending the email to all threads of the case except the actual thread
$response = $Pmgmail->sendEmail($caseId, "", $app['DEL_INDEX']);
}
}
$oLabels = new labelsGmail();
$oResponse = $oLabels->setLabels($caseId, $actualIndex, $actualLastIndex, false);
if( $session->get('gmail') === 1 ){
//$session->set('gmail', 0);
$mUrl = '/sys'. $session->get('WORKSPACE') .'/en/neoclassic/cases/cases_Open?APP_UID='.$caseId.'&DEL_INDEX='.$actualIndex.'&action=sent';
} else{
$mUrl = 'casesListExtJs';
}
header( 'location:' . $mUrl );

View File

@@ -28,6 +28,12 @@
* @date Jan 3th, 2010
*/
$tBarGmail = false;
if(isset( $_GET['gmail']) && $_GET['gmail'] == 1){
$_SESSION['gmail'] = 1;
$tBarGmail = true;
}
if (! isset( $_GET['APP_UID'] ) || ! isset( $_GET['DEL_INDEX'] )) {
if (isset( $_GET['APP_NUMBER'] )) {
G::LoadClass( 'case' );
@@ -102,6 +108,7 @@ $oHeadPublisher->assign( '_ENV_CURRENT_DATE', $conf->getSystemDate( date( 'Y-m-d
$oHeadPublisher->assign( '_ENV_CURRENT_DATE_NO_FORMAT', date( 'Y-m-d-h-i-A' ) );
$oHeadPublisher->assign( 'idfirstform', is_null( $oStep ) ? '' : $oStep->getStepUidObj() );
$oHeadPublisher->assign( 'appStatus', $case['APP_STATUS'] );
$oHeadPublisher->assign( 'tbarGmail', $tBarGmail);
if(!isset($_SESSION['APPLICATION']) || !isset($_SESSION['TASK']) || !isset($_SESSION['INDEX'])) {
$_SESSION['APPLICATION'] = $case['APP_UID'];