removing PMGmail

This commit is contained in:
Fernando Ontiveros
2025-07-11 06:36:38 -04:00
parent b0c0d8d70c
commit 3f8710b60e
27 changed files with 17 additions and 2573 deletions

View File

@@ -40,8 +40,6 @@ return array(
'Installer' => \ProcessMaker\Core\Installer::class, 'Installer' => \ProcessMaker\Core\Installer::class,
'installer' => \ProcessMaker\Core\Installer::class, 'installer' => \ProcessMaker\Core\Installer::class,
'InvalidIndexSearchTextException' => InvalidIndexSearchTextException::class, 'InvalidIndexSearchTextException' => InvalidIndexSearchTextException::class,
'JavaBridgePM' => JavaBridgePM::class,
'labelsGmail' => labelsGmail::class,
'ldapAdvanced' => LdapAdvanced::class, 'ldapAdvanced' => LdapAdvanced::class,
'multipleFilesBackup' => MultipleFilesBackup::class, 'multipleFilesBackup' => MultipleFilesBackup::class,
'NET' => Net::class, 'NET' => Net::class,

View File

@@ -1,150 +0,0 @@
<?php
use ProcessMaker\Core\System;
if (! defined( 'JAVA_BRIDGE_PATH' )) {
define( 'JAVA_BRIDGE_PATH', 'JavaBridgePM' );
}
if (! defined( 'JAVA_BRIDGE_PORT' )) {
define( 'JAVA_BRIDGE_PORT', '8080' );
}
if (! defined( 'JAVA_BRIDGE_HOST' )) {
define( 'JAVA_BRIDGE_HOST', '127.0.0.1' );
}
class JavaBridgePM
{
public $JavaBridgeDir = JAVA_BRIDGE_PATH;
public $JavaBridgePort = JAVA_BRIDGE_PORT;
public $JavaBridgeHost = JAVA_BRIDGE_HOST;
/**
* checkJavaExtension
* check if the java extension was loaded.
*
*
* @return true or false
*/
public function checkJavaExtension ()
{
try {
if (! extension_loaded( 'java' )) {
if (! (@include_once ("java/Java.inc"))) {
$urlJavaInc = "http://$this->JavaBridgeHost:$this->JavaBridgePort/$this->JavaBridgeDir/java/Java.inc";
@include_once ($urlJavaInc);
$includedFiles = get_included_files();
$found = false;
foreach ($includedFiles as $filename) {
if ($urlJavaInc == $filename) {
$found = true;
}
}
if (! $found) {
throw new Exception( 'The PHP/Java Bridge is not defined' );
}
}
return true;
}
if (! function_exists( "java_get_server_name" )) {
throw new Exception( 'The loaded java extension is not the PHP/Java Bridge' );
}
return true;
} catch (Exception $e) {
throw new Exception( 'Error in checkJavaExtension: ' . $e->getMessage() );
}
}
/**
* convert a php value to a java one...
*
* @param string $value
* @param string $className
* @return s boolean success
*/
public function convertValue ($value, $className)
{
// if we are a string, just use the normal conversion
// methods from the java extension...
try {
if ($className == 'java.lang.String') {
$temp = new Java( 'java.lang.String', $value );
return $temp;
} elseif ($className == 'java.lang.Boolean' || $className == 'java.lang.Integer' || $className == 'java.lang.Long' || $className == 'java.lang.Short' || $className == 'java.lang.Double' || $className == 'java.math.BigDecimal') {
$temp = new Java( $className, $value );
return $temp;
} elseif ($className == 'java.sql.Timestamp' || $className == 'java.sql.Time') {
$temp = new Java( $className );
$javaObject = $temp->valueOf( $value );
return $javaObject;
}
} catch (Exception $err) {
echo ('unable to convert value, ' . $value . ' could not be converted to ' . $className);
return false;
}
echo ('unable to convert value, class name ' . $className . ' not recognised');
return false;
}
/**
* generateJrxmlFromDynaform
*
* @param string $outDocUid
* @param string $dynaformUid
* @param object $template
* @return void
*/
public function generateJrxmlFromDynaform ($outDocUid, $dynaformUid, $template)
{
require_once 'classes/model/Dynaform.php';
$dyn = new Dynaform();
$aFields = $dyn->load( $dynaformUid );
$xmlFields = $dyn->getDynaformFields( $dynaformUid );
$reportTpl = PATH_TPL . 'javaBridgePM/classic.xml';
$reportFilename = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $outDocUid . '.jrxml';
foreach ($xmlFields as $key => $val) {
if ($val->type == 'submit' || $val->type == 'button' || $val->type == 'title' || $val->type == 'subtitle') {
unset( $xmlFields[$key] );
}
}
//$sqlSentence = 'SELECT * from ' . $tableName;
$sqlSentence = 'dynaform/';
$template = new TemplatePower( $reportTpl );
$template->prepare();
$template->assign( 'sqlSentence', $sqlSentence );
$template->assign( 'tableName', $aFields['DYN_TITLE'] );
$template->assign( 'heightDetail', count( $xmlFields ) * 15 + 20 );
$template->assign( 'PAGE_NUMBER', '{PAGE_NUMBER}' );
$logoReporte = System::getServerProtocolHost() . '/images/lurana.logo.png';
$template->assign( 'logoReporte', $logoReporte );
foreach ($xmlFields as $key => $val) {
$template->newBlock( 'fields' );
$template->assign( 'fieldName', $key );
}
$posX = 140;
$posLabelX = 5;
$posY = 10;
foreach ($xmlFields as $key => $val) {
$template->newBlock( 'detailFields' );
$template->assign( 'fieldName', '{' . $key . '}' );
$template->assign( 'fieldLabel', $key );
$template->assign( 'labelPosX', $posLabelX );
$template->assign( 'fieldPosX', $posX );
$template->assign( 'fieldPosY', $posY );
$posY += 15;
}
$content = $template->getOutputContent();
$iSize = file_put_contents( $reportFilename, $content );
printf( "saved %s bytes in file %s \n", $iSize, $reportFilename );
}
}

View File

@@ -1,424 +0,0 @@
<?php
class labelsGmail
{
function listLabels($service)
{
$labels = array();
try {
$labelsResponse = $service->users_labels->listUsersLabels('me');
if ($labelsResponse->getLabels()) {
$labels = array_merge($labels, $labelsResponse->getLabels());
}
} catch (Exception $e) {
print G::LoadTranslation("ID_PMGMAIL_GENERAL_ERROR") . G::getErrorMessage($e);
throw ($e);
}
return $labels;
}
/**
* Modify the Labels a Message is associated with.
*
* @param Google_Service_Gmail $service Authorized Gmail API instance.
* @param string $userId User's email address. The special value 'me'
* can be used to indicate the authenticated user.
* @param string $messageId ID of Message to modify.
* @param array $labelsToAdd Array of Labels to add.
* @param array $labelsToRemove Array of Labels to remove.
*/
function modifyMessage($service, $userId, $messageId, $labelsToAdd, $labelsToRemove)
{
$mods = new Google_Service_Gmail_ModifyMessageRequest();
$mods->setAddLabelIds($labelsToAdd);
$mods->setRemoveLabelIds($labelsToRemove);
try {
$message = $service->users_messages->modify($userId, $messageId, $mods);
} catch (Exception $e) {
print G::LoadTranslation("ID_PMGMAIL_GENERAL_ERROR") . G::getErrorMessage($e);
throw ($e);
}
}
/**
* Get list of Messages in user's mailbox.
*
* @param Google_Service_Gmail $service Authorized Gmail API instance.
* @param string $userId User's email address. The special value 'me'
* can be used to indicate the authenticated user.
*
* @return array Array of Messages.
*/
function listMessages($service, $userId, $query, $labels)
{
$pageToken = null;
$messages = array();
$opt_param = array();
do {
try {
if ($pageToken) {
$opt_param['pageToken'] = $pageToken;
}
$opt_param['labelIds'] = $labels;
$opt_param['q'] = $query;
$opt_param['maxResults'] = 3;
$messagesResponse = $service->users_messages->listUsersMessages($userId, $opt_param);
if ($messagesResponse->getMessages()) {
$messages = array_merge($messages, $messagesResponse->getMessages());
}
} catch (Exception $e) {
print G::LoadTranslation("ID_PMGMAIL_GENERAL_ERROR") . G::getErrorMessage($e);
throw ($e);
}
} while ($pageToken);
return $messages;
}
public function setLabelsToPauseCase($caseId, $index)
{
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$appData = $Pmgmail->getDraftApp($caseId, $index);
foreach ($appData as $application) {
$appNumber = $application['APP_NUMBER'];
$index = $application['DEL_INDEX'];
$threadUsr = $application['USR_UID'];
$proName = $application['APP_PRO_TITLE'];
$threadStatus = $application['DEL_THREAD_STATUS'];
$appStatus = $application['APP_STATUS'];
}
//Getting the privious User email
$oUsers = new \Users();
$usrData = $oUsers->loadDetails($threadUsr);
$mail = $usrData['USR_EMAIL'];
//The Subject to search the email
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
$pmGoogle = new PmGoogleApi();
$pmGoogle->setUser($mail);
$pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
$client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client);
$labelsIds = $this->getLabelsIds($service);
if ($appStatus == 'DRAFT') {
$labelsToRemove = $labelsIds['Draft'];
$labelsToSearch = "*-draft";
$labelsToAdd = $labelsIds['Paused'];
}
if ($appStatus == 'TO_DO') {
$labelsToRemove = $labelsIds['Inbox'];
$labelsToSearch = "*-inbox";
$labelsToAdd = $labelsIds['Paused'];
}
$q = "subject:('" . preg_quote($subject, '-') . "') label:('" . $labelsToSearch . "')";
$messageList = $this->listMessages($service, $mail, $q, $labelsToRemove);
foreach ($messageList as $message) {
$messageId = $message->getId();
$modifyResult = $this->modifyMessage($service, $mail, $messageId, array($labelsToAdd),
array($labelsToRemove));
}
}
function setLabelsTounpauseCase($caseId, $index)
{
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$appData = $Pmgmail->getDraftApp($caseId, $index);
foreach ($appData as $application) {
$appNumber = $application['APP_NUMBER'];
$index = $application['DEL_INDEX'];
$threadUsr = $application['USR_UID'];
$proName = $application['APP_PRO_TITLE'];
$threadStatus = $application['DEL_THREAD_STATUS'];
$appStatus = $application['APP_STATUS'];
}
//Getting the privious User email
$oUsers = new \Users();
$usrData = $oUsers->loadDetails($threadUsr);
$mail = $usrData['USR_EMAIL'];
//The Subject to search the email
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
$pmGoogle = new PmGoogleApi();
$pmGoogle->setUser($mail);
$pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
$client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client);
$labelsIds = $this->getLabelsIds($service);
if ($appStatus == 'DRAFT') {
$labelsToRemove = $labelsIds['Paused'];
$labelsToSearch = "*-paused";
$labelsToAdd = $labelsIds['Draft'];
}
if ($appStatus == 'TO_DO') {
$labelsToRemove = $labelsIds['Paused'];
$labelsToSearch = "*-paused";
$labelsToAdd = $labelsIds['Inbox'];
}
$q = "subject:('" . preg_quote($subject, '-') . "') label:('" . $labelsToSearch . "')";
$messageList = $this->listMessages($service, $mail, $q, $labelsToRemove);
foreach ($messageList as $message) {
$messageId = $message->getId();
$modifyResult = $this->modifyMessage($service, $mail, $messageId, array($labelsToAdd),
array($labelsToRemove));
}
}
public function setLabels($caseId, $index, $actualLastIndex, $unassigned = false)
{
//First getting the actual thread data
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$appData = $Pmgmail->getDraftApp($caseId, $index);
foreach ($appData as $application) {
$appNumber = $application['APP_NUMBER'];
$index = $application['DEL_INDEX'];
$threadUsr = $application['USR_UID'];
$proName = $application['APP_PRO_TITLE'];
$threadStatus = $application['DEL_THREAD_STATUS'];
$appStatus = $application['APP_STATUS'];
$tasUid = $application['TAS_UID'];
}
if ($threadStatus == 'CLOSED' || $unassigned == true) {
//Getting the privious User email
$oUsers = new \Users();
$usrData = $oUsers->loadDetails($threadUsr);
$mail = $usrData['USR_EMAIL'];
//The Subject to search the email
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
$pmGoogle = new PmGoogleApi();
$pmGoogle->setUser($mail);
$pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
$client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client);
$labelsIds = $this->getLabelsIds($service);
if ($actualLastIndex == 0) {
$labelsToRemove = $labelsIds['Draft'];
$labelsToSearch = "*-draft";
$labelsToAdd = $labelsIds['Participated'];
} else {
if (($actualLastIndex == -1) && ($unassigned == true)) { //Unassigned
$labelsToRemove = $labelsIds['Unassigned'];
$labelsToSearch = "*-unassigned";
$labelsToAdd = $labelsIds['Inbox'];
} else {
if ($actualLastIndex >= 1) {
$labelsToRemove = $labelsIds['Inbox'];
$labelsToSearch = "*-inbox";
$labelsToAdd = $labelsIds['Participated'];
}
}
}
//Searching the email in the user's mail
$q = "subject:('" . preg_quote($subject, '-') . "') label:('" . $labelsToSearch . "')";
$messageList = $this->listMessages($service, $mail, $q, $labelsToRemove);
//if there isn't any message at draft, and lasindex is zero, is a subprocess
//and we must search in inbox:
if ($actualLastIndex === 0 && count($messageList) ===0) {
$labelsToRemove = $labelsIds['Inbox'];
$labelsToSearch = "*-inbox";
$labelsToAdd = $labelsIds['Participated'];
$q = "subject:('" . preg_quote($subject, '-') . "') label:('" . $labelsToSearch . "')";
$messageList = $this->listMessages($service, $mail, $q, $labelsToRemove);
}
foreach ($messageList as $message) {
$messageId = $message->getId();
$modifyResult = $this->modifyMessage($service, $mail, $messageId, array($labelsToAdd),
array($labelsToRemove));
}
//in is unassigned we must remove the label to the orher users
if ($labelsToRemove === $labelsIds['Unassigned']) {
require_once(PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "TaskUser.php");
$oTaskUsers = new \TaskUser();
$taskUsers = $oTaskUsers->getAllUsersTask($tasUid);
foreach ($taskUsers as $user) {
$usrData = $oUsers->loadDetails($user['USR_UID']);
$nextMail = $usrData['USR_EMAIL'];
//this operation is just for the users that didn't make the case claim
if ($nextMail !== $mail) {
$this->changeLabelsOfUnassigned($appData[0], $nextMail);
}
}
}
}
}
function changeLabelsOfUnassigned($application, $mail)
{
$appNumber = $application['APP_NUMBER'];
$index = $application['DEL_INDEX'];
$threadUsr = $application['USR_UID'];
$proName = $application['APP_PRO_TITLE'];
$threadStatus = $application['DEL_THREAD_STATUS'];
$appStatus = $application['APP_STATUS'];
$tasUid = $application['TAS_UID'];
//The Subject to search the email
$subject = "[PM] " . $proName . " (" . $index . ") Case: " . $appNumber;
$pmGoogle = new PmGoogleApi();
$pmGoogle->setUser($mail);
$pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
$client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client);
$labelsIds = $this->getLabelsIds($service);
$labelsToRemove = $labelsIds['Unassigned'];
$labelsToSearch = "*-unassigned";
$labelsToAdd = $labelsIds['Participated'];
//Searching the email in the user's mail
$q = "subject:('" . preg_quote($subject, '-') . "') label:('" . $labelsToSearch . "')";
$messageList = $this->listMessages($service, $mail, $q, $labelsToRemove);
foreach ($messageList as $message) {
$messageId = $message->getId();
$modifyResult = $this->modifyMessage($service, $mail, $messageId, array($labelsToAdd),
array($labelsToRemove));
}
}
/**
* Delete Label with given ID.
*
* @param Google_Service_Gmail $service Authorized Gmail API instance.
* @param string $userId User's email address. The special value 'me'
* can be used to indicate the authenticated user.
* @param string $labelId Id of Label to be updated.
*/
public function deleteLabel($service, $user, $labelId)
{
try {
$service->users_labels->delete($user, $labelId);
} catch (Exception $e) {
error_log(G::LoadTranslation("ID_PMGMAIL_GENERAL_ERROR") . $e->getMessage());
}
}
/**
* Delete PMGmail integration labels getting the list of labels in an email account.
*
* @param string $mail User mail adress.
*
*/
public function deletePMGmailLabels($mail)
{
$pmGoogle = new PmGoogleApi();
$pmGoogle->setUser($mail);
$pmGoogle->setScope(PmGoogleApi::GMAIL_MODIFY);
$client = $pmGoogle->serviceClient();
$service = new Google_Service_Gmail($client);
$count = 0;
$listlabels = $this->listLabels($service);
foreach ($listlabels as $label) {
if ($label->getName() == '* Inbox' ||
$label->getName() == '* Participated' ||
$label->getName() == '* Unassigned' ||
$label->getName() == '* Draft' ||
$label->getName() == '* Inbox' ||
$label->getName() == '* --- ProcessMaker ---' ||
$label->getName() == '* Paused'
) {
$oresp = $this->deleteLabel($service, 'me', $label->getId());
$count++;
}
}
return $count . ' labels successfully deleted.';
}
public function addRelabelingToQueue($caseId, $index, $actualLastIndex, $unassigned = false)
{
$labelingQueue = new GmailRelabeling();
$labelingQueue->setCreateDate(date('Y-m-d H:i:s'));
$labelingQueue->setLabelingUid(G::generateUniqueID());
$labelingQueue->setAppUid($caseId);
$labelingQueue->setDelIndex($index);
$labelingQueue->setCurrentLastIndex($actualLastIndex);
$labelingQueue->setUnassigned(($unassigned === true) ? 1 : 0);
$labelingQueue->setStatus('pending');
$labelingQueue->save();
}
public function processPendingRelabelingInQueue()
{
$c = new \Criteria('workflow');
$c->add(\GmailRelabelingPeer::STATUS, 'pending');
$c->addAscendingOrderByColumn('CREATE_DATE');
$list = \GmailRelabelingPeer::doSelect($c);
foreach ($list as $task) {
try {
$oResponse = $this->setLabels($task->getAppUid(),
$task->getDelIndex(),
$task->getCurrentLastIndex(),
($task->getUnassigned() === 1) ? true : false
);
$task->setStatus('completed');
} catch (exception $e) {
$task->setMsgError($e->getMessage());
$task->setStatus('pending');
}
$task->save();
}
}
private function getLabelsIds($service)
{
$result = array();
try {
$listlabels = $this->listLabels($service);
foreach ($listlabels as $label) {
$labId = $label->getId();
$labName = $label->getName();
switch ($labName) {
case "* Inbox":
$result['Inbox'] = $labId;
break;
case "* Participated":
$result['Participated'] = $labId;
break;
case "* Unassigned":
$result['Unassigned'] = $labId;
break;
case "* Draft":
$result['Draft'] = $labId;
break;
case "* Paused":
$result['Paused'] = $labId;
break;
}
}
} catch (Exception $e) {
throw $e;
}
return $result;
}
}

View File

@@ -883,7 +883,6 @@ class WsBase
* @see workflow\engine\classes\class.pmFunctions::PMFSendMessage() * @see workflow\engine\classes\class.pmFunctions::PMFSendMessage()
* @see workflow\engine\methods\services\soap2::sendMessage() * @see workflow\engine\methods\services\soap2::sendMessage()
* @see \ProcessMaker\BusinessModel\EmailEvent->sendEmail() * @see \ProcessMaker\BusinessModel\EmailEvent->sendEmail()
* @see \ProcessMaker\BusinessModel\Pmgmail->sendEmailWithApplicationData()
* *
*/ */
public function sendMessage( public function sendMessage(
@@ -990,10 +989,6 @@ class WsBase
$this->getTaskId() ? $this->getTaskId() : (isset($oldFields['TAS_ID']) ? $oldFields['TAS_ID'] : 0) $this->getTaskId() ? $this->getTaskId() : (isset($oldFields['TAS_ID']) ? $oldFields['TAS_ID'] : 0)
); );
if ($gmail === 1) {
return new WsResponse(0, G::loadTranslation('ID_PMGMAIL'));
}
// Create always the record in APP_MESSAGE table // Create always the record in APP_MESSAGE table
$spool = new SpoolRun(); $spool = new SpoolRun();
$spool->setConfig($setup); $spool->setConfig($setup);

View File

@@ -284,16 +284,6 @@ class AppDelegation extends BaseAppDelegation
$actionsByEmail->sendActionsByEmail($data, $dataAbe); $actionsByEmail->sendActionsByEmail($data, $dataAbe);
} }
} }
try {
$pmGoogle = new PmGoogleApi();
if ($pmGoogle->getServiceGmailStatus()) {
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$Pmgmail->gmailsForRouting($usrUid, $tasUid, $appUid, $delIndex, $isSubprocess);
}
} catch (Exception $oError) {
error_log($oError->getMessage());
}
} }
if ($flagActionsByEmail) { if ($flagActionsByEmail) {

View File

@@ -2,18 +2,13 @@
use Illuminate\Filesystem\Filesystem; use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use ProcessMaker\Core\System;
use ProcessMaker\PDF\TCPDFHeaderFooter; use ProcessMaker\PDF\TCPDFHeaderFooter;
class OutputDocument extends BaseOutputDocument class OutputDocument extends BaseOutputDocument
{ {
public function __construct() public function __construct()
{ {
$javaInput = PATH_C . 'javaBridgePM' . PATH_SEP . 'input' . PATH_SEP;
$javaOutput = PATH_C . 'javaBridgePM' . PATH_SEP . 'output' . PATH_SEP;
G::mk_dir($javaInput);
G::mk_dir($javaOutput);
} }
public function getByUid($sOutDocUid) public function getByUid($sOutDocUid)

View File

@@ -7895,12 +7895,6 @@ msgstr "Enable the selected add-on"
msgid "Enable Google Drive." msgid "Enable Google Drive."
msgstr "Enable Google Drive." msgstr "Enable Google Drive."
# TRANSLATION
# LABEL/ID_ENABLE_PMGMAIL
#: LABEL/ID_ENABLE_PMGMAIL
msgid "Enable PM Gmail"
msgstr "Enable PM Gmail"
# TRANSLATION # TRANSLATION
# LABEL/ID_ENABLE_SEARCH_FILTER # LABEL/ID_ENABLE_SEARCH_FILTER
#: LABEL/ID_ENABLE_SEARCH_FILTER #: LABEL/ID_ENABLE_SEARCH_FILTER
@@ -21839,60 +21833,6 @@ msgstr "Are you sure that you want to disable Google Drive Integration? If you d
msgid "The file doesn't have any content stored on Drive." msgid "The file doesn't have any content stored on Drive."
msgstr "The file doesn't have any content stored on Drive." msgstr "The file doesn't have any content stored on Drive."
# TRANSLATION
# LABEL/ID_PMGMAIL
#: LABEL/ID_PMGMAIL
msgid "PM Gmail"
msgstr "PM Gmail"
# TRANSLATION
# LABEL/ID_PMGMAIL_DISABLE
#: LABEL/ID_PMGMAIL_DISABLE
msgid "Are you sure that you want to disable Gmail Integration? If you do this, all the mails and relabelling sent to Gmail will be disabled."
msgstr "Are you sure that you want to disable Gmail Integration? If you do this, all the mails and relabelling sent to Gmail will be disabled."
# TRANSLATION
# LABEL/ID_PMGMAIL_GENERAL_ERROR
#: LABEL/ID_PMGMAIL_GENERAL_ERROR
msgid "An error in processing Gmail requests occurred"
msgstr "An error in processing Gmail requests occurred"
# TRANSLATION
# LABEL/ID_PMGMAIL_SETTINGS
#: LABEL/ID_PMGMAIL_SETTINGS
msgid "Settings for Processmaker Gmail"
msgstr "Settings for Processmaker Gmail"
# TRANSLATION
# LABEL/ID_PMGMAIL_VALID
#: LABEL/ID_PMGMAIL_VALID
msgid "The Gmail token is not valid."
msgstr "The Gmail token is not valid."
# TRANSLATION
# LABEL/ID_PMG_EMAIL
#: LABEL/ID_PMG_EMAIL
msgid "Service Account Email"
msgstr "Service Account Email"
# TRANSLATION
# LABEL/ID_PMG_FILE
#: LABEL/ID_PMG_FILE
msgid "Service Account Certificate"
msgstr "Service Account Certificate"
# TRANSLATION
# LABEL/ID_PMG_SELECT_FILE
#: LABEL/ID_PMG_SELECT_FILE
msgid "Please select a json file to upload"
msgstr "Please select a json file to upload"
# TRANSLATION
# LABEL/ID_PMG_TYPE_ACCEPT
#: LABEL/ID_PMG_TYPE_ACCEPT
msgid "Only accepts files in JSON format"
msgstr "Only accepts files in JSON format"
# TRANSLATION # TRANSLATION
# LABEL/ID_PMTABLE # LABEL/ID_PMTABLE
#: LABEL/ID_PMTABLE #: LABEL/ID_PMTABLE

View File

@@ -8003,12 +8003,6 @@ msgstr "Enable the selected add-on"
msgid "Enable Google Drive." msgid "Enable Google Drive."
msgstr "Enable Google Drive." msgstr "Enable Google Drive."
# TRANSLATION
# LABEL/ID_ENABLE_PMGMAIL
#: LABEL/ID_ENABLE_PMGMAIL
msgid "Enable PM Gmail"
msgstr "Enable PM Gmail"
# TRANSLATION # TRANSLATION
# LABEL/ID_ENABLE_SEARCH_FILTER # LABEL/ID_ENABLE_SEARCH_FILTER
#: LABEL/ID_ENABLE_SEARCH_FILTER #: LABEL/ID_ENABLE_SEARCH_FILTER
@@ -22367,48 +22361,6 @@ msgstr "Are you sure that you want to disable Google Drive Integration? If you d
msgid "The file doesn't have any content stored on Drive." msgid "The file doesn't have any content stored on Drive."
msgstr "The file doesn't have any content stored on Drive." msgstr "The file doesn't have any content stored on Drive."
# TRANSLATION
# LABEL/ID_PMGMAIL
#: LABEL/ID_PMGMAIL
msgid "PM Gmail"
msgstr "PM Gmail"
# TRANSLATION
# LABEL/ID_PMGMAIL_DISABLE
#: LABEL/ID_PMGMAIL_DISABLE
msgid "Are you sure that you want to disable Gmail Integration? If you do this, all the mails and relabelling sent to Gmail will be disabled."
msgstr "Are you sure that you want to disable Gmail Integration? If you do this, all the mails and relabelling sent to Gmail will be disabled."
# TRANSLATION
# LABEL/ID_PMGMAIL_GENERAL_ERROR
#: LABEL/ID_PMGMAIL_GENERAL_ERROR
msgid "An error in processing Gmail requests occurred"
msgstr "An error in processing Gmail requests occurred"
# TRANSLATION
# LABEL/ID_PMGMAIL_SETTINGS
#: LABEL/ID_PMGMAIL_SETTINGS
msgid "Settings for Processmaker Gmail"
msgstr "Settings for Processmaker Gmail"
# TRANSLATION
# LABEL/ID_PMGMAIL_VALID
#: LABEL/ID_PMGMAIL_VALID
msgid "The Gmail token is not valid."
msgstr "The Gmail token is not valid."
# TRANSLATION
# LABEL/ID_PMG_EMAIL
#: LABEL/ID_PMG_EMAIL
msgid "Service Account Email"
msgstr "Service Account Email"
# TRANSLATION
# LABEL/ID_PMG_FILE
#: LABEL/ID_PMG_FILE
msgid "Service Account Certificate"
msgstr "Service Account Certificate"
# TRANSLATION # TRANSLATION
# LABEL/ID_PMG_SELECT_FILE # LABEL/ID_PMG_SELECT_FILE
#: LABEL/ID_PMG_SELECT_FILE #: LABEL/ID_PMG_SELECT_FILE

View File

@@ -8003,12 +8003,6 @@ msgstr "Habilite el plugin seleccionado"
msgid "Enable Google Drive." msgid "Enable Google Drive."
msgstr "Habilitar GoogleDrive." msgstr "Habilitar GoogleDrive."
# TRANSLATION
# LABEL/ID_ENABLE_PMGMAIL
#: LABEL/ID_ENABLE_PMGMAIL
msgid "Enable PM Gmail"
msgstr "Habilitar Gmail PM"
# TRANSLATION # TRANSLATION
# LABEL/ID_ENABLE_SEARCH_FILTER # LABEL/ID_ENABLE_SEARCH_FILTER
#: LABEL/ID_ENABLE_SEARCH_FILTER #: LABEL/ID_ENABLE_SEARCH_FILTER
@@ -22367,42 +22361,6 @@ msgstr "¿Está seguro de inhabilitar la Integración Google Drive? Si lo hace l
msgid "The file doesn't have any content stored on Drive." msgid "The file doesn't have any content stored on Drive."
msgstr "El archivo no tiene ningún contenido almacenado en Drive." msgstr "El archivo no tiene ningún contenido almacenado en Drive."
# TRANSLATION
# LABEL/ID_PMGMAIL
#: LABEL/ID_PMGMAIL
msgid "PM Gmail"
msgstr "PM Gmail"
# TRANSLATION
# LABEL/ID_PMGMAIL_DISABLE
#: LABEL/ID_PMGMAIL_DISABLE
msgid "Are you sure that you want to disable Gmail Integration? If you do this, all the mails and relabelling sent to Gmail will be disabled."
msgstr "¿Está seguro de inhabilitar la Integración Gmail? Si lo hace, todos los emails y el re-etiquetado enviado a Gmail serán inhabilitados."
# TRANSLATION
# LABEL/ID_PMGMAIL_GENERAL_ERROR
#: LABEL/ID_PMGMAIL_GENERAL_ERROR
msgid "An error in processing Gmail requests occurred"
msgstr "Ocurrió un error al procesar las solicitudes de Gmail"
# TRANSLATION
# LABEL/ID_PMGMAIL_SETTINGS
#: LABEL/ID_PMGMAIL_SETTINGS
msgid "Settings for Processmaker Gmail"
msgstr "Configuraciones para Gmail de Lurana"
# TRANSLATION
# LABEL/ID_PMGMAIL_VALID
#: LABEL/ID_PMGMAIL_VALID
msgid "The Gmail token is not valid."
msgstr "El token de gmail no es valido."
# TRANSLATION
# LABEL/ID_PMG_EMAIL
#: LABEL/ID_PMG_EMAIL
msgid "Service Account Email"
msgstr "Servicio de cuenta de correo"
# TRANSLATION # TRANSLATION
# LABEL/ID_PMG_FILE # LABEL/ID_PMG_FILE
#: LABEL/ID_PMG_FILE #: LABEL/ID_PMG_FILE

View File

@@ -8003,12 +8003,6 @@ msgstr "Enable the selected add-on"
msgid "Enable Google Drive." msgid "Enable Google Drive."
msgstr "Enable Google Drive." msgstr "Enable Google Drive."
# TRANSLATION
# LABEL/ID_ENABLE_PMGMAIL
#: LABEL/ID_ENABLE_PMGMAIL
msgid "Enable PM Gmail"
msgstr "Enable PM Gmail"
# TRANSLATION # TRANSLATION
# LABEL/ID_ENABLE_SEARCH_FILTER # LABEL/ID_ENABLE_SEARCH_FILTER
#: LABEL/ID_ENABLE_SEARCH_FILTER #: LABEL/ID_ENABLE_SEARCH_FILTER
@@ -22367,60 +22361,6 @@ msgstr "Are you sure that you want to disable Google Drive Integration? If you d
msgid "The file doesn't have any content stored on Drive." msgid "The file doesn't have any content stored on Drive."
msgstr "The file doesn't have any content stored on Drive." msgstr "The file doesn't have any content stored on Drive."
# TRANSLATION
# LABEL/ID_PMGMAIL
#: LABEL/ID_PMGMAIL
msgid "PM Gmail"
msgstr "PM Gmail"
# TRANSLATION
# LABEL/ID_PMGMAIL_DISABLE
#: LABEL/ID_PMGMAIL_DISABLE
msgid "Are you sure that you want to disable Gmail Integration? If you do this, all the mails and relabelling sent to Gmail will be disabled."
msgstr "Are you sure that you want to disable Gmail Integration? If you do this, all the mails and relabelling sent to Gmail will be disabled."
# TRANSLATION
# LABEL/ID_PMGMAIL_GENERAL_ERROR
#: LABEL/ID_PMGMAIL_GENERAL_ERROR
msgid "An error in processing Gmail requests occurred"
msgstr "An error in processing Gmail requests occurred"
# TRANSLATION
# LABEL/ID_PMGMAIL_SETTINGS
#: LABEL/ID_PMGMAIL_SETTINGS
msgid "Settings for Processmaker Gmail"
msgstr "Settings for Processmaker Gmail"
# TRANSLATION
# LABEL/ID_PMGMAIL_VALID
#: LABEL/ID_PMGMAIL_VALID
msgid "The Gmail token is not valid."
msgstr "The Gmail token is not valid."
# TRANSLATION
# LABEL/ID_PMG_EMAIL
#: LABEL/ID_PMG_EMAIL
msgid "Service Account Email"
msgstr "Service Account Email"
# TRANSLATION
# LABEL/ID_PMG_FILE
#: LABEL/ID_PMG_FILE
msgid "Service Account Certificate"
msgstr "Service Account Certificate"
# TRANSLATION
# LABEL/ID_PMG_SELECT_FILE
#: LABEL/ID_PMG_SELECT_FILE
msgid "Please select a json file to upload"
msgstr "Please select a json file to upload"
# TRANSLATION
# LABEL/ID_PMG_TYPE_ACCEPT
#: LABEL/ID_PMG_TYPE_ACCEPT
msgid "Only accepts files in JSON format"
msgstr "Only accepts files in JSON format"
# TRANSLATION # TRANSLATION
# LABEL/ID_PMTABLE # LABEL/ID_PMTABLE
#: LABEL/ID_PMTABLE #: LABEL/ID_PMTABLE

View File

@@ -1,151 +0,0 @@
<?php
/**
* pmGmail controller
* @inherits Controller
*
* @access public
*/
class pmGmail extends Controller
{
public function saveConfigPmGmail($httpData)
{
$pmGoogle = new PmGoogleApi();
$result = new StdClass();
$result->success = true;
$httpData->serviceGmailStatus = !empty($httpData->serviceGmailStatus) ? $httpData->serviceGmailStatus == 1 ? true : false : false;
$httpData->serviceDriveStatus = !empty($httpData->serviceDriveStatus) ? $httpData->serviceDriveStatus == 1 ? true : false : false;
if ($httpData->serviceGmailStatus || $httpData->serviceDriveStatus) {
$pmGoogle->setServiceGmailStatus($httpData->serviceGmailStatus);
$pmGoogle->setServiceDriveStatus($httpData->serviceDriveStatus);
$message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . ($httpData->serviceGmailStatus ? G::LoadTranslation('ID_ENABLE') : G::LoadTranslation('ID_DISABLE'));
$message .= G::LoadTranslation('ID_ENABLE_PMDRIVE') . ': ' . ($httpData->serviceDriveStatus ? G::LoadTranslation('ID_ENABLE') : G::LoadTranslation('ID_DISABLE'));
if (!empty($httpData->emailServiceAccount)) {
$pmGoogle->setServiceAccountEmail($httpData->emailServiceAccount);
$message .= ', ' . G::LoadTranslation('ID_PMG_EMAIL') . ': ' . $httpData->emailServiceAccount;
}
if (!empty($_FILES)) {
if (!empty($_FILES['googleCertificate']) && $_FILES['googleCertificate']['error'] != 1) {
if ($_FILES['googleCertificate']['tmp_name'] != '') {
G::uploadFile($_FILES['googleCertificate']['tmp_name'], PATH_DATA_SITE, $_FILES['googleCertificate']['name']);
$pmGoogle->setServiceAccountCertificate($_FILES['googleCertificate']['name']);
$message .= ', ' . G::LoadTranslation('ID_PMG_FILE') . ': ' . $_FILES['googleCertificate']['name'];
}
} else {
$result->success = false;
$result->fileError = true;
print(G::json_encode($result));
die();
}
}
} else {
$pmGoogle->setServiceGmailStatus(false);
$pmGoogle->setServiceDriveStatus(false);
$message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . G::LoadTranslation('ID_DISABLE');
}
G::auditLog("Update Settings Gmail", $message);
print(G::json_encode($result));
}
public function formPMGmail()
{
try {
$this->includeExtJS('admin/pmGmail');
if (!empty($_SESSION['__PMGMAIL_ERROR__'])) {
$this->setJSVar('__PMGMAIL_ERROR__', $_SESSION['__PMGMAIL_ERROR__']);
unset($_SESSION['__PMGMAIL_ERROR__']);
}
$pmGoogle = new PmGoogleApi();
$accountEmail = $pmGoogle->getServiceAccountEmail();
$googleCertificate = $pmGoogle->getServiceAccountCertificate();
$statusGmail = $pmGoogle->getServiceGmailStatus();
$statusDrive = $pmGoogle->getServiceDriveStatus();
$disableGmail = false;
$disableDrive = false;
$this->setJSVar('accountEmail', $accountEmail);
$this->setJSVar('googleCertificate', $googleCertificate);
$this->setJSVar('statusGmail', $statusGmail);
$this->setJSVar('statusDrive', $statusDrive);
$this->setJSVar('disableGmail', $disableGmail);
$this->setJSVar('disableDrive', $disableDrive);
G::RenderPage('publish', 'extJs');
} catch (Exception $error) {
$_SESSION['__PMGMAIL_ERROR__'] = $error->getMessage();
die();
}
}
/**
* @param $httpData
*/
public function testConfigPmGmail($httpData)
{
$pmGoogle = new PmGoogleApi();
$result = new stdClass();
$result->emailServiceAccount = empty($httpData->emailServiceAccount) ? $pmGoogle->getServiceAccountEmail() : $httpData->emailServiceAccount;
$result->pathServiceAccountCertificate = empty($_FILES['googleCertificate']['tmp_name']) ? PATH_DATA_SITE . $pmGoogle->getServiceAccountCertificate() : $_FILES['googleCertificate']['tmp_name'];
print(G::json_encode($pmGoogle->testService($result)));
}
/**
* Search users with same email
*/
public function testUserGmail()
{
$criteria = new Criteria();
$criteria->clearSelectColumns();
$criteria->addSelectColumn('COUNT(*) AS NUM_EMAIL');
$criteria->addSelectColumn(UsersPeer::USR_EMAIL);
$criteria->addGroupByColumn(UsersPeer::USR_EMAIL);
$criteria->add(UsersPeer::USR_STATUS, 'ACTIVE');
$rs = UsersPeer::doSelectRS($criteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$userRepeat = [];
while ($rs->next()) {
$row = $rs->getRow();
if ($row['NUM_EMAIL'] > 1) {
$criteriaUsers = new Criteria();
$criteriaUsers->clearSelectColumns();
$criteriaUsers->addSelectColumn(UsersPeer::USR_UID);
$criteriaUsers->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$criteriaUsers->addSelectColumn(UsersPeer::USR_LASTNAME);
$criteriaUsers->addSelectColumn(UsersPeer::USR_EMAIL);
$criteriaUsers->add(UsersPeer::USR_EMAIL, $row['USR_EMAIL']);
$criteriaUsers->add(UsersPeer::USR_STATUS, 'ACTIVE');
$rsUsers = UsersPeer::doSelectRS($criteriaUsers);
$rsUsers->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsUsers->next()) {
$rowUser = $rsUsers->getRow();
array_push(
$userRepeat,
[
'USR_UID' => $rowUser['USR_UID'],
'FULL_NAME' => $rowUser['USR_FIRSTNAME'] . ' ' . $rowUser['USR_LASTNAME'],
'EMAIL' => $rowUser['USR_EMAIL']
]
);
}
}
}
print(G::json_encode($userRepeat));
}
}

View File

@@ -58155,7 +58155,6 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_ENABLE_PLUGIN','en','Enable Plugin','2014-10-13') , ( 'LABEL','ID_ENABLE_PLUGIN','en','Enable Plugin','2014-10-13') ,
( 'LABEL','ID_ENABLE_PLUGIN_TIP','en','Enable the selected add-on','2014-10-21') , ( 'LABEL','ID_ENABLE_PLUGIN_TIP','en','Enable the selected add-on','2014-10-21') ,
( 'LABEL','ID_ENABLE_PMDRIVE','en','Enable Google Drive.','2016-01-05') , ( 'LABEL','ID_ENABLE_PMDRIVE','en','Enable Google Drive.','2016-01-05') ,
( 'LABEL','ID_ENABLE_PMGMAIL','en','Enable PM Gmail','2015-07-27') ,
( 'LABEL','ID_ENABLE_SEARCH_FILTER','en','Enable Search Filter','2021-08-13') , ( 'LABEL','ID_ENABLE_SEARCH_FILTER','en','Enable Search Filter','2021-08-13') ,
( 'LABEL','ID_ENABLE_USER','en','Enable User','2014-10-10') , ( 'LABEL','ID_ENABLE_USER','en','Enable User','2014-10-10') ,
( 'LABEL','ID_ENABLE_VERSIONING','en','Enable Versioning','2014-01-15') , ( 'LABEL','ID_ENABLE_VERSIONING','en','Enable Versioning','2014-01-15') ,
@@ -60548,15 +60547,6 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_PLUGIN_FILE','en','Plugin file','2014-09-18') , ( 'LABEL','ID_PLUGIN_FILE','en','Plugin file','2014-09-18') ,
( 'LABEL','ID_PMDRIVE_DISABLE','en','Are you sure that you want to disable Google Drive Integration? If you do this, the Input and Output Documents and attached files will only be stored in your ProcessMaker server.','2017-02-21') , ( 'LABEL','ID_PMDRIVE_DISABLE','en','Are you sure that you want to disable Google Drive Integration? If you do this, the Input and Output Documents and attached files will only be stored in your ProcessMaker server.','2017-02-21') ,
( 'LABEL','ID_PMDRIVE_NO_CONTENT_IN_FILE','en','The file doesn''t have any content stored on Drive.','2015-12-09') , ( 'LABEL','ID_PMDRIVE_NO_CONTENT_IN_FILE','en','The file doesn''t have any content stored on Drive.','2015-12-09') ,
( 'LABEL','ID_PMGMAIL','en','PM Gmail','2015-07-27') ,
( 'LABEL','ID_PMGMAIL_DISABLE','en','Are you sure that you want to disable Gmail Integration? If you do this, all the mails and relabelling sent to Gmail will be disabled.','2016-01-05') ,
( 'LABEL','ID_PMGMAIL_GENERAL_ERROR','en','An error in processing Gmail requests occurred','2015-12-09') ,
( 'LABEL','ID_PMGMAIL_SETTINGS','en','Settings for Processmaker Gmail','2015-07-27') ,
( 'LABEL','ID_PMGMAIL_VALID','en','The Gmail token is not valid.','2015-09-11') ,
( 'LABEL','ID_PMG_EMAIL','en','Service Account Email','2015-07-27') ,
( 'LABEL','ID_PMG_FILE','en','Service Account Certificate','2015-12-09') ,
( 'LABEL','ID_PMG_SELECT_FILE','en','Please select a json file to upload','2016-01-05') ,
( 'LABEL','ID_PMG_TYPE_ACCEPT','en','Only accepts files in JSON format','2016-01-04') ,
( 'LABEL','ID_PMTABLE','en','PM Table','2014-01-15') , ( 'LABEL','ID_PMTABLE','en','PM Table','2014-01-15') ,
( 'LABEL','ID_PMTABLES','en','PM Tables','2014-01-15') , ( 'LABEL','ID_PMTABLES','en','PM Tables','2014-01-15') ,
( 'LABEL','ID_PMTABLES_ALERT1','en','You can''t repeat a column name, please rename:','2014-01-15') , ( 'LABEL','ID_PMTABLES_ALERT1','en','You can''t repeat a column name, please rename:','2014-01-15') ,

View File

@@ -1,11 +1,7 @@
<script> <script>
if (typeof window.parent != 'undefined') { if (typeof window.parent != 'undefined') {
<?php <?php
$pathDerivateGmail = 'derivatedGmail';
$statusPMGmail = false;
$pmGoogle = new PmGoogleApi();
$statusPMGmail = $pmGoogle->getServiceGmailStatus();
if (isset($_GET['ux'])) { if (isset($_GET['ux'])) {
switch ($_GET['ux']) { switch ($_GET['ux']) {
@@ -17,9 +13,6 @@ if (isset($_GET['ux'])) {
default: default:
$url = 'casesListExtJs'; $url = 'casesListExtJs';
} }
} elseif ($statusPMGmail) {
$url = $pathDerivateGmail;
} else {
$url = 'casesListExtJs'; $url = 'casesListExtJs';
} }
if (isset($_GET['ux'])) { if (isset($_GET['ux'])) {
@@ -27,9 +20,6 @@ if (isset($_GET['ux'])) {
} }
echo ' parent.parent.postMessage("redirect=todo","*");'; echo ' parent.parent.postMessage("redirect=todo","*");';
if (isset($_GET['ux'])) { if (isset($_GET['ux'])) {
if ($statusPMGmail) {
echo '} else { window.parent.location.href = \''.$pathDerivateGmail.'\'; }';
} else {
echo '} else { echo '} else {
if (parent.parent.postMessage) { if (parent.parent.postMessage) {
parent.parent.postMessage("redirect=todo","*"); parent.parent.postMessage("redirect=todo","*");
@@ -38,7 +28,6 @@ if (isset($_GET['ux'])) {
} }
}'; }';
} }
}
echo "try {parent.parent.updateCasesTree();parent.parent.highlightCasesTree();} catch(e) {}"; echo "try {parent.parent.updateCasesTree();parent.parent.highlightCasesTree();} catch(e) {}";
?> ?>
} }

View File

@@ -12,7 +12,6 @@ use ProcessMaker\Model\Process;
* @see cases/open.php * @see cases/open.php
* @see controllers/Home::indexSingle() * @see controllers/Home::indexSingle()
* @see controllers/Home::startCase() * @see controllers/Home::startCase()
* @see pmGmail/sso.php
* @see webentry/access.php * @see webentry/access.php
* *
* @link https://wiki.processmaker.com/3.2/Cases/Cases#Search_Criteria * @link https://wiki.processmaker.com/3.2/Cases/Cases#Search_Criteria

View File

@@ -523,64 +523,6 @@ try {
$aProperties['report_generator'] = $aOD['OUT_DOC_REPORT_GENERATOR']; $aProperties['report_generator'] = $aOD['OUT_DOC_REPORT_GENERATOR'];
} }
$oOutputDocument->generate($_GET['UID'], $Fields['APP_DATA'], $pathOutput, $sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean)$aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'], $aProperties); $oOutputDocument->generate($_GET['UID'], $Fields['APP_DATA'], $pathOutput, $sFilename, $aOD['OUT_DOC_TEMPLATE'], (boolean)$aOD['OUT_DOC_LANDSCAPE'], $aOD['OUT_DOC_GENERATE'], $aProperties);
break;
case 'JRXML':
//creating the xml with the application data;
$xmlData = "<dynaform>\n";
foreach ($Fields['APP_DATA'] as $key => $val) {
$xmlData .= " <$key>$val</$key>\n";
}
$xmlData .= "</dynaform>\n";
$iSize = file_put_contents($javaOutput . 'addressBook.xml', $xmlData);
$JBPM = new JavaBridgePM();
$JBPM->checkJavaExtension();
$util = new Java("com.processmaker.util.pmutils");
$util->setInputPath($javaInput);
$util->setOutputPath($javaOutput);
$filter = new InputFilter();
$locationFrom = PATH_DYNAFORM . $aOD['PRO_UID'] . PATH_SEP . $aOD['OUT_DOC_UID'] . '.jrxml';
$locationFrom = $filter->validateInput($locationFrom, "path");
copy($locationFrom, $javaInput . $aOD['OUT_DOC_UID'] . '.jrxml');
$outputFile = $javaOutput . $sFilename . '.pdf';
print $util->jrxml2pdf($aOD['OUT_DOC_UID'] . '.jrxml', basename($outputFile));
$outputFile = $filter->validateInput($outputFile, "path");
copy($outputFile, $pathOutput . $sFilename . '.pdf');
break;
case 'ACROFORM':
//creating the xml with the application data;
$xmlData = "<dynaform>\n";
foreach ($Fields['APP_DATA'] as $key => $val) {
$xmlData .= " <$key>$val</$key>\n";
}
$xmlData .= "</dynaform>\n";
$JBPM = new JavaBridgePM();
$JBPM->checkJavaExtension();
$util = new Java("com.processmaker.util.pmutils");
$util->setInputPath($javaInput);
$util->setOutputPath($javaOutput);
$filter = new InputFilter();
$locationFrom = PATH_DYNAFORM . $aOD['PRO_UID'] . PATH_SEP . $aOD['OUT_DOC_UID'] . '.pdf';
$locationFrom = $filter->validateInput($locationFrom, "path");
copy($locationFrom, $javaInput . $aOD['OUT_DOC_UID'] . '.pdf');
$outputFile = $javaOutput . $sFilename . '.pdf';
print $util->writeVarsToAcroFields($aOD['OUT_DOC_UID'] . '.pdf', $xmlData);
$locationFrom = $javaOutput . $aOD['OUT_DOC_UID'] . '.pdf';
$locationFrom = $filter->validateInput($locationFrom, "path");
copy($locationFrom, $pathOutput . $sFilename . '.pdf');
break; break;
default: default:
throw (new Exception('invalid output document')); throw (new Exception('invalid output document'));

View File

@@ -44,16 +44,10 @@ try {
$aFields['PRO_UID'] = $_GET['PRO_UID']; $aFields['PRO_UID'] = $_GET['PRO_UID'];
} }
$aFields['OUT_DOC_TYPE'] = 'HTML'; $aFields['OUT_DOC_TYPE'] = 'HTML';
$enabledJavaBridge = false;
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
if (! $enabledJavaBridge) {
$xmlform = 'outputdocs/outputdocs_Properties';
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $aFields, '../outputdocs/outputdocs_Save' );
} else {
$xmlform = 'outputdocs/outputdocs_New'; $xmlform = 'outputdocs/outputdocs_New';
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $aFields, '../outputdocs/outputdocs_Save' ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', $xmlform, '', $aFields, '../outputdocs/outputdocs_Save' );
}
G::RenderPage( 'publish', 'raw' ); G::RenderPage( 'publish', 'raw' );
} catch (Exception $oException) { } catch (Exception $oException) {
$token = strtotime("now"); $token = strtotime("now");
@@ -61,4 +55,3 @@ try {
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) ); G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
die; die;
} }

View File

@@ -61,16 +61,7 @@ try {
} }
} }
if ($aData['OUT_DOC_UID'] == '') { if ($aData['OUT_DOC_UID'] == '') {
if ((isset( $aData['OUT_DOC_TYPE'] )) && ($aData['OUT_DOC_TYPE'] == 'JRXML')) {
$dynaformUid = $aData['DYN_UID'];
$outDocUid = $oOutputDocument->create( $aData ); $outDocUid = $oOutputDocument->create( $aData );
$jbpm = new JavaBridgePM();
print $jbpm->generateJrxmlFromDynaform( $outDocUid, $dynaformUid, 'classic' );
} else {
$outDocUid = $oOutputDocument->create( $aData );
}
} else { } else {
$oOutputDocument->update( $aData ); $oOutputDocument->update( $aData );
} }
@@ -87,4 +78,3 @@ try {
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) ); G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
die; die;
} }

View File

@@ -1,479 +0,0 @@
<?php
namespace ProcessMaker\BusinessModel;
use \G;
use \Criteria;
use \UsersPeer;
use \GroupUserPeer;
use \ResultSet;
use ProcessMaker\Core\System;
/**
* @copyright Colosa - Bolivia
*/
class Pmgmail {
/**
* Get User by usrGmail
*
* @param string $usr_gmail Unique id of User
*
* return uid
*
*/
public function getUserByEmail($usr_gmail)
{
//getting the user data
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Users.php");
$oUsers = new \Users();
$response['user'] = $oUsers->loadByUserEmailInArray($usr_gmail);
//getting the skin
require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.system.php");
$sysConf = new System();
$responseSysConfig = $sysConf->getSystemConfiguration( PATH_CONFIG . 'env.ini' );
$response['enviroment'] = $responseSysConfig['default_skin'];
return $response;
}
/**
* Get Application data by appUid
*
* @param string $app_uid Unique id of the app
* @param string $index
*
* return row app_cache_view
*
*/
public function getDraftApp($app_uid, $index=1)
{
$c = new \Criteria( 'workflow' );
$c->clearSelectColumns();
$c->addSelectColumn( \AppCacheViewPeer::APP_NUMBER );
$c->addSelectColumn( \AppCacheViewPeer::APP_STATUS );
$c->addSelectColumn( \AppCacheViewPeer::DEL_INDEX );
$c->addSelectColumn( \AppCacheViewPeer::APP_DEL_PREVIOUS_USER );
$c->addSelectColumn( \AppCacheViewPeer::DEL_DELEGATE_DATE );
$c->addSelectColumn( \AppCacheViewPeer::USR_UID );
$c->addSelectColumn( \AppCacheViewPeer::PRO_UID );
$c->addSelectColumn( \AppCacheViewPeer::APP_PRO_TITLE );
$c->addSelectColumn( \AppCacheViewPeer::APP_TAS_TITLE );
$c->addSelectColumn( \AppCacheViewPeer::DEL_THREAD_STATUS );
$c->addSelectColumn( \AppCacheViewPeer::TAS_UID );
$c->addSelectColumn( \AppCacheViewPeer::DEL_LAST_INDEX );
$c->addSelectColumn( \AppCacheViewPeer::APP_UID );
$c->add( \AppCacheViewPeer::APP_UID, $app_uid );
$c->add( \AppCacheViewPeer::DEL_INDEX, $index );
$rs = \AppCacheViewPeer::doSelectRS( $c );
$rs->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
$rows = Array ();
while ($rs->next()) {
$rows[] = $rs->getRow();
}
return $rows;
}
public function gmailsForRouting($sUsrUid, $sTasUid, $sAppUid, $delIndex, $isSubprocess) {
$taskProxy = new \Task();
$taskData = $taskProxy-> load($sTasUid);
//guard condition, message events do not need to send emails
if ($taskData['TAS_TYPE'] === 'START-MESSAGE-EVENT') {
return;
}
if($sUsrUid === "") {
$targetEmails = $this->targetEmailsForUnassigned($sTasUid, $sAppUid);
if ($targetEmails['to'] !== "" && $targetEmails['to'] !== null ) {
$this->sendGmail($sAppUid, $targetEmails['to'].','.$targetEmails['cc'], $delIndex, $isSubprocess, true, null, null);
}
}
else {
$userObject = new \Users();
$userData = $userObject->loadDetails($sUsrUid);
if ($userData !== null) {
$this->sendGmail($sAppUid, $userData['USR_EMAIL'], $delIndex, $isSubprocess, false, null, null);
}
}
}
public function gmailsIfSelfServiceValueBased($app_uid, $index, $arrayTask, $arrayData)
{
require_once(PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Application.php");
$resultMail = "";
foreach ($arrayTask as $aTask) {
//just self service tasks are processed in this function
if ($aTask ["TAS_ASSIGN_TYPE"] !== "SELF_SERVICE") {
continue;
}
$appData = $this->getDraftApp($app_uid, $index);
if (count($appData) === 0) {
return "appUid not found";
}
if (!isset ($aTask ["USR_UID"])) {
$aTask ["USR_UID"] = "";
}
$application = $appData[0];
$labelID = "PMUASS";
$isSelfServiceValueBased = false;
if ($aTask["TAS_ASSIGN_TYPE"] === "SELF_SERVICE") {
$task = \TaskPeer::retrieveByPK($aTask["TAS_UID"]);
if (trim($task->getTasGroupVariable()) != '') {
$isSelfServiceValueBased = true;
}
}
if ($isSelfServiceValueBased) {
$mailToAddresses = '';
$mailCcAddresses = '';
$targetIds = array();
$criteria = new \Criteria ("workflow");
$criteria->addSelectColumn(\AppAssignSelfServiceValueGroupPeer::GRP_UID);
$criteria->addJoin(\AppAssignSelfServiceValuePeer::ID, \AppAssignSelfServiceValueGroupPeer::ID, \Criteria::LEFT_JOIN);
$criteria->add(\AppAssignSelfServiceValuePeer::APP_UID, $app_uid);
$criteria->add(\AppAssignSelfServiceValuePeer::DEL_INDEX, $aTask["DEL_INDEX"]);
$rsCriteria = \AppAssignSelfServiceValuePeer::doSelectRs($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$targetIds[] = $row['GRP_UID'];
}
$usersToSend = $this->getSelfServiceValueBasedUsers($targetIds);
foreach($usersToSend as $record) {
$toAux = (($record['USR_FIRSTNAME'] != '' || $record['USR_LASTNAME'] != '')
? $record['USR_FIRSTNAME'] . ' ' . $record['USR_LASTNAME'] . ' '
: '') . '<' . $record['USR_EMAIL'] . '>';
if ($mailToAddresses == '') {
$mailToAddresses = $toAux;
} else {
$mailCcAddresses .= (($mailCcAddresses != '')? ',' : '') . $toAux;
}
}
$resultMail = $this->sendEmailWithApplicationData($application, $labelID, $mailToAddresses, $mailCcAddresses);
}
}
return $resultMail;
}
/**
* Send email using appUid and mail
*
* @param string $app_uid Unique id of the app
* @param string $mail
*
* return uid
*
*/
public function sendGmail($app_uid, $mailToAddresses, $index, $isSubprocess = false, $isSelfService = false, $arrayTask = null, $arrayData = null)
{
//getting the default email server
$defaultEmail = $this->emailAccount();
if ($defaultEmail === null) {
error_log(G::LoadTranslation('ID_EMAIL_ENGINE_IS_NOT_ENABLED'));
return false;
}
$mailCcAddresses = "";
$appData = $this->getDraftApp($app_uid, $index);
if (count($appData) === 0) {
return;
}
$application = $appData[0];
$this->sendEmailWithApplicationData($application,
$this->getEmailType($index, $isSubprocess, $isSelfService),
$mailToAddresses,
$mailCcAddresses);
}
/**
* Get if the license has the feature
*
* return uid
*
*/
public function hasGmailFeature()
{
return true;
}
/**
* Get the default 'email from account' that is used to send emails in the server email in PM
*
* return uid
*
*/
public function emailAccount()
{
$emailServer = new \EmailServer();
$response = $emailServer->loadDefaultAccount();
return $response['MESS_ACCOUNT'];
}
/**
* Business Model to delete all the labels of an acount
*
* @param string $mail
*
* return uid
*
*/
public function deleteLabels($mail)
{
$oLabels = new \LabelsGmail();
$response = $oLabels->deletePMGmailLabels($mail);
return $response;
}
public function modifyMailToPauseCase($appUid, $appDelIndex)
{
$oLabels = new \LabelsGmail();
$oResponse = $oLabels->setLabelsToPauseCase($appUid, $appDelIndex);
}
public function modifyMailToUnpauseCase($appUid, $appDelIndex)
{
$oLabels = new \LabelsGmail();
$oResponse = $oLabels->setLabelsToUnpauseCase($appUid, $appDelIndex);
}
private function getEmailType($index, $isSubprocess, $isSelfService) {
$retval = "";
if ($isSelfService) {
$retval = "PMUASS";
}
else {
$retval = ($index === 1 && !$isSubprocess) ? "PMDRFT" : "PMIBX";
}
if ($retval === "") {
throw new Exception('Is not possible to determine the email type');
}
return $retval;
}
private function createMailTemplateFile()
{
$pathTemplate = PATH_DATA_SITE . "mailTemplates" . PATH_SEP . "pmGmail.html";
if (!file_exists($pathTemplate)) {
$file = @fopen($pathTemplate, "w");
fwrite($file, '<div>');
fwrite($file, '<span style="display: none !important;">');
fwrite($file, '-**- Process Name: @#proName<br/>');
fwrite($file, '-**- Case Number: @#appNumber<br/>');
fwrite($file, '-**- Case UID: @#caseUid<br/>');
fwrite($file, '-**- Task Name: @#taskName<br/>');
fwrite($file, '-**- Index: @#index<br/>');
fwrite($file, '-**- Action: @#action<br/>');
fwrite($file, '-**- Previous User: @#prevUser<br/>');
fwrite($file, '-**- Delegate Date: @#delDate<br/>');
fwrite($file, '-**- Process Id: @#proUid<br/>');
fwrite($file, '-**- Type: @#type<br/>');
fwrite($file, '-**- FormFields: <br/>');
fwrite($file, '</span>');
fwrite($file, '</div>');
fclose($file);
}
}
private function getFormData($appUid, $index) {
$oApplication = new \Application();
$formData = $oApplication->Load($appUid);
$frmData = unserialize($formData['APP_DATA']);
$dataFormToShowString = "";
foreach ($frmData as $field => $value) {
if (($field != 'SYS_LANG') &&
($field != 'SYS_SKIN') &&
($field != 'SYS_SYS') &&
($field != 'APPLICATION') &&
($field != 'PROCESS') &&
($field != 'TASK') &&
($field != 'INDEX') &&
($field != 'USER_LOGGED') &&
($field != 'USR_USERNAME') &&
($field != 'DYN_CONTENT_HISTORY') &&
($field != 'PIN') &&
(!is_array($value))
) {
$dataFormToShowString .= " " . $field . " " . $value;
}
}
$change = array('[', ']', '"');
$fdata = str_replace($change, ' ', $dataFormToShowString);
return $fdata;
}
private function sendEmailWithApplicationData ($application, $emailTypeLabel, $mailToAddresses, $mailCcAddresses) {
$dataFormToShowString = '';
$this->createMailTemplateFile();
$change = array('[', ']', '"');
$fdata = str_replace($change, ' ', $dataFormToShowString);
$aFields = array(
'proName' => $application['APP_PRO_TITLE'],
'appNumber' => $application['APP_NUMBER'],
'caseUid' => $application['APP_UID'],
'taskName' => $application['APP_TAS_TITLE'],
'index' => $application['DEL_INDEX'],
'action' => $application['APP_STATUS'],
'prevUser' => $application['APP_DEL_PREVIOUS_USER'],
'delDate' => $application['DEL_DELEGATE_DATE'],
'proUid' => $application['PRO_UID'],
'type' => $emailTypeLabel,
'oform' => $fdata
);
$subject = "[PM] " . $application['APP_PRO_TITLE'] . " (" . $application['DEL_INDEX'] . ") Case: " . $application['APP_NUMBER'];
//getting the default email server
$defaultEmail = $this->emailAccount();
if ($defaultEmail === null) {
error_log(G::LoadTranslation('ID_EMAIL_ENGINE_IS_NOT_ENABLED'));
return false;
}
$ws = new \WsBase();
$resultMail = $ws->sendMessage(
$application['APP_UID'],
$defaultEmail, //From,
$mailToAddresses,//$To,
$mailCcAddresses,//$Cc
'',
$subject,
'pmGmail.html',//template
$aFields, //fields
array(),
true,
0,
array(),
1
);
}
private function targetEmailsForUnassigned($taskUid, $appUid)
{
$sTo = null;
$sCc = null;
$arrayResp = array ();
$task = new \Tasks ();
$group = new \Groups ();
$oUser = new \Users ();
$to = null;
$cc = null;
if (isset ( $taskUid ) && ! empty ( $taskUid )) {
$arrayTaskUser = array ();
$arrayAux1 = $task->getGroupsOfTask ( $taskUid, 1 );
foreach ( $arrayAux1 as $arrayGroup ) {
$arrayAux2 = $group->getUsersOfGroup ( $arrayGroup ["GRP_UID"] );
foreach ( $arrayAux2 as $arrayUser ) {
$arrayTaskUser [] = $arrayUser ["USR_UID"];
}
}
$arrayAux1 = $task->getUsersOfTask ( $taskUid, 1 );
foreach ( $arrayAux1 as $arrayUser ) {
$arrayTaskUser [] = $arrayUser ["USR_UID"];
}
$arrayTaskUser = array_unique($arrayTaskUser);
$criteria = new \Criteria ( "workflow" );
$criteria->addSelectColumn ( \UsersPeer::USR_UID );
$criteria->addSelectColumn ( \UsersPeer::USR_USERNAME );
$criteria->addSelectColumn ( \UsersPeer::USR_FIRSTNAME );
$criteria->addSelectColumn ( \UsersPeer::USR_LASTNAME );
$criteria->addSelectColumn ( \UsersPeer::USR_EMAIL );
$criteria->add (\UsersPeer::USR_UID, $arrayTaskUser, \Criteria::IN);
$rsCriteria = \UsersPeer::doSelectRs ( $criteria );
$rsCriteria->setFetchmode (\ResultSet::FETCHMODE_ASSOC);
$sw = 1;
while ( $rsCriteria->next () ) {
$row = $rsCriteria->getRow ();
$toAux = ((($row ["USR_FIRSTNAME"] != "") || ($row ["USR_LASTNAME"] != "")) ? $row ["USR_FIRSTNAME"] . " " . $row ["USR_LASTNAME"] . " " : "") . "<" . $row ["USR_EMAIL"] . ">";
if ($sw == 1) {
$to = $toAux;
$sw = 0;
} else {
$cc = $cc . (($cc != null) ? "," : null) . $toAux;
}
}
$arrayResp ['to'] = $to;
$arrayResp ['cc'] = $cc;
}
return $arrayResp;
}
/**
* Returns a list of users emails that are the destion of the emails
* that will be sent, based in the list of groups or users that are
* passed to this function.
* @param $targetIds, array or single value of usr ids or group ids
* @return array, list of emails
*/
private function getSelfServiceValueBasedUsers($targetIds) {
$result = [];
$criteria = new Criteria('workflow');
$criteria->setDistinct();
$criteria->addSelectColumn(UsersPeer::USR_UID);
$criteria->addSelectColumn(UsersPeer::USR_USERNAME);
$criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$criteria->addSelectColumn(UsersPeer::USR_EMAIL);
$criteria->addJoin(GroupUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
$criteria->add(UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL);
$rsCriteria = null;
if (is_array($targetIds)) {
$criteriaUid = $criteria->getNewCriterion(UsersPeer::USR_UID, $targetIds, Criteria::IN);
$criteriaUid->addOr($criteria->getNewCriterion(GroupUserPeer::GRP_UID, $targetIds, Criteria::IN));
$criteria->add($criteriaUid);
$rsCriteria = GroupUserPeer::doSelectRS($criteria);
}
else {
$criteriaUid = $criteria->getNewCriterion(UsersPeer::USR_UID, $targetIds, Criteria::EQUAL);
$criteriaUid->addOr($criteria->getNewCriterion(GroupUserPeer::GRP_UID, $targetIds, Criteria::EQUAL));
$criteria->add($criteriaUid);
$rsCriteria = GroupUserPeer::doSelectRS($criteria);
}
if (!is_null($rsCriteria)) {
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$record = $rsCriteria->getRow();
$result [] = $record;
}
}
return $result;
}
}

View File

@@ -14,7 +14,6 @@ use Exception;
use G; use G;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use ProcessMaker\BusinessModel\Cases\InputDocument; use ProcessMaker\BusinessModel\Cases\InputDocument;
use ProcessMaker\BusinessModel\Pmgmail;
use ProcessMaker\ChangeLog\ChangeLog; use ProcessMaker\ChangeLog\ChangeLog;
use stdClass; use stdClass;
use Users; use Users;
@@ -144,19 +143,6 @@ trait CasesTrait
$fromData = $fromName . ($userInfo['USR_EMAIL'] != '' ? ' <' . $userInfo['USR_EMAIL'] . '>' : ''); $fromData = $fromName . ($userInfo['USR_EMAIL'] != '' ? ' <' . $userInfo['USR_EMAIL'] . '>' : '');
if ($flagGmail === true) {
$appDel = new AppDelegation();
$actualThread = $appDel->Load($application, $index);
$appDelPrev = $appDel->LoadParallel($application);
$pmGmail = new Pmgmail();
foreach ($appDelPrev as $app) {
if (($app['DEL_INDEX'] != $index) && ($app['DEL_PREVIOUS'] != $actualThread['DEL_PREVIOUS'])) {
$pmGmail->gmailsIfSelfServiceValueBased($application, $app['DEL_INDEX'], $postForm['TASKS'], $appFields['APP_DATA']);
}
}
}
try { try {
$this->sendNotifications($tasUid, $postForm['TASKS'], $appFields['APP_DATA'], $application, $index, $fromData); $this->sendNotifications($tasUid, $postForm['TASKS'], $appFields['APP_DATA'], $application, $index, $fromData);
} catch (Exception $e) { } catch (Exception $e) {

View File

@@ -1,137 +0,0 @@
<?php
namespace ProcessMaker\Services\Api;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* GmailIntegration Api Controller
*
*
* @protected
*/
class GmailIntegration extends Api
{
/**
* Get User by usr_gmail
*
* @param string $usr_gmail {@from path}
*
*
* @url GET /userexist/:usr_gmail
*
*/
public function doGetUserbyEmail($usr_gmail)
{
try {
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$response = $Pmgmail->getUserByEmail($usr_gmail);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get Application by app_uid
*
* @param string $app_uid {@from path}
*
*
* @url GET /application/:app_uid
*
*/
public function doGetApplication($app_uid)
{
try {
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$response = $Pmgmail->getDraftApp($app_uid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Send Email
*
* @param string $app_uid {@from path}
* @param string $mail {@from path}
* @param string $index {@from path}
*
*
* @url POST /sendEmail/:app_uid/to/:mail/index/:index
*
*/
public function doPostSendMail($app_uid, $mail, $index)
{
try {
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$response = $Pmgmail->sendGmail($app_uid, $mail, $index);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get if the license has the gmail integration feature
*
*
* @url GET /verifyGmailfeature
*
*/
public function doGetVerifyGmailFeature()
{
try {
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$response = $Pmgmail->hasGmailFeature();
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get the default 'email from account' that is used to send emails in the server email in PM
*
*
* @url GET /current-email-account
*
*/
public function doGetEmailAccount()
{
try {
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$response = $Pmgmail->emailAccount();
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* End Point to delete Labels in an uninstalation of the extension
*
* @param string $mail {@from path}
*
*
* @url POST /deleteLabels/:mail
*
*/
public function doPostDeleteLabels($mail)
{
try {
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail();
$response = $Pmgmail->deleteLabels($mail);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}

View File

@@ -1,32 +0,0 @@
<?php
namespace ProcessMaker\Services\Api\Google;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
class Authentication extends Api
{
/**
* Get token for user gmail
*
* @param array $request_data
*
* @return array
*
* @url POST /gmail
*
*
*/
public function doAuthenticationAccountGmail ($request_data)
{
try{
$oGoogle = new \ProcessMaker\Services\Google\Authentication();
$response = $oGoogle->postTokenAccountGmail($request_data);
return $response;
} catch (\Exception $e){
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}

View File

@@ -1,77 +0,0 @@
<?php
namespace ProcessMaker\Services\Google;
class Authentication
{
/**
* Post Token by user Gmail
*
* @param array $request_data
*
*/
public function postTokenAccountGmail($request_data)
{
$responseToken = array('msg' => 'Upgrade');
//Lets verify the gmail token
$url = 'https://www.googleapis.com/oauth2/v1/tokeninfo?access_token='.$request_data['token'];
// init curl object
$ch = curl_init();
// define options
$optArray = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false
);
// apply those options
curl_setopt_array($ch, $optArray);
// execute request and get response
$result = curl_exec($ch);
$response = (json_decode($result));
// Check if any error occurred
if(curl_errno($ch))
{
throw (new \Exception(curl_error($ch)));
}
$info = curl_getinfo($ch);
curl_close($ch);
//If there is response
if($info['http_code'] == 200 && isset($response->email)){
//If the usermail that was send in the end point es the same of the one in the response
if($request_data['mail'] == $response->email){
$oUsers = new \Users();
$userExist = $oUsers->loadByUserEmailInArray($request_data['mail']);
if(!$userExist){
throw (new \Exception(\G::LoadTranslation( 'ID_USER_NOT_FOUND')));
}
if(count($userExist) > 1){
throw (new \Exception(\G::LoadTranslation( 'ID_EMAIL_MORE_USER')));
}
if($userExist['0']['USR_STATUS'] != "ACTIVE"){
throw (new \Exception(\G::LoadTranslation('ID_USER_NOT_ACTIVE')));
}
$userExist = $userExist['0'];
$oauthServer = new \ProcessMaker\Services\OAuth2\Server;
$server = $oauthServer->getServer();
$config = array(
'allow_implicit' => $server->getConfig('allow_implicit'),
'access_lifetime' => $server->getConfig('access_lifetime')
);
$storage = $server->getStorages();
$accessToken = new \OAuth2\ResponseType\AccessToken($storage['access_token'],$storage['refresh_token'],$config);
$responseToken = $accessToken->createAccessToken($request_data['clientid'], $userExist['USR_UID'],$request_data['scope']);
} else {
throw (new \Exception(\G::LoadTranslation( 'ID_EMAIL_NOT_CORRESPONDS_TOKEN' )));
}
}else {
throw (new \Exception(\G::LoadTranslation( 'ID_PMGMAIL_VALID' )));
}
return $responseToken;
}
}

View File

@@ -1,389 +0,0 @@
var saveButton;
var testButton;
var storeUsers;
var disableAll;
var enableInterfazCertificate;
Ext.onReady(function() {
Ext.QuickTips.init();
testButton = new Ext.Action({
text : _('ID_TEST_CONNECTION'),
disabled : true,
handler : testSettings
});
saveButton = new Ext.Action({
text : _('ID_SAVE_SETTINGS'),
disabled : true,
handler : saveSettings
});
disableAll = function () {
Ext.getCmp('emailServiceAccount').disable();
Ext.getCmp('googleCertificate').disable();
Ext.getCmp('labelFileGoogleCertificate').disable();
testButton.disable();
saveButton.disable();
Ext.getCmp('emailServiceAccount').hide();
Ext.getCmp('googleCertificate').hide();
Ext.getCmp('labelFileGoogleCertificate').hide();
Ext.getCmp('listUsers').hide();
Ext.getCmp('testPMGmail').hide();
};
enableInterfazCertificate = function () {
Ext.getCmp('emailServiceAccount').enable();
Ext.getCmp('googleCertificate').enable();
Ext.getCmp('labelFileGoogleCertificate').enable();
Ext.getCmp('emailServiceAccount').show();
Ext.getCmp('googleCertificate').show();
Ext.getCmp('labelFileGoogleCertificate').show();
testButton.enable();
};
var configurationPMGmail = new Ext.form.FieldSet({
title: _('ID_PMGMAIL_SETTINGS'),
items: [
{
xtype: 'checkbox',
id: 'serviceGmailStatus',
name: 'serviceGmailStatus',
boxLabel: _('ID_ENABLE_PMGMAIL'),
value: 0,
inputValue: 1,
uncheckedValue: 0,
disabled: disableGmail,
listeners : {
check : function(that, checked) {
disableAll();
if (checked) {
enableInterfazCertificate();
} else {
Ext.MessageBox.confirm(
_('ID_CONFIRM'),
_('ID_PMGMAIL_DISABLE'),
function (btn, text) {
if (btn == "yes") {
if (Ext.getCmp('serviceDriveStatus').getValue()) {
enableInterfazCertificate();
}
saveButton.enable();
} else {
enableInterfazCertificate();
Ext.getCmp('serviceGmailStatus').setValue(1);
}
}
);
}
}
}
},
{
xtype : 'label',
labelAlign : 'right',
fieldLabel : '',
text : _('ID_GMAIL_HELP_ENABLE'),
style : "padding-left:180px; display: inline-block;"
},
{
xtype: 'checkbox',
id: 'serviceDriveStatus',
name: 'serviceDriveStatus',
boxLabel: _('ID_ENABLE_PMDRIVE'),
value: 0,
inputValue: 1,
uncheckedValue: 0,
disabled: disableDrive,
listeners : {
check : function(that, checked) {
disableAll();
if (checked) {
enableInterfazCertificate();
} else {
Ext.MessageBox.confirm(
_('ID_CONFIRM'),
_('ID_PMDRIVE_DISABLE'),
function (btn, text) {
if (btn == "yes") {
if (Ext.getCmp('serviceGmailStatus').getValue()) {
enableInterfazCertificate();
}
saveButton.enable();
} else {
enableInterfazCertificate();
Ext.getCmp('serviceDriveStatus').setValue(1);
}
}
);
}
}
}
},
{
xtype : 'label',
labelAlign : 'right',
fieldLabel : '',
text : _('ID_DRIVE_HELP_ENABLE'),
style : "padding-left:180px; display: inline-block;"
},
{
xtype : 'textfield',
id : 'emailServiceAccount',
name : 'emailServiceAccount',
fieldLabel : _('ID_PMG_EMAIL'),
width : 400,
allowBlank : false,
value : accountEmail,
listeners : {
change: function(){
changeSettings();
},
focus : function(tb, e) {
Ext.QuickTips.register({
target: tb,
title: _('ID_PMG_EMAIL'),
text: accountEmail
});
}
}
},
{
xtype : 'fileuploadfield',
id : 'googleCertificate',
emptyText : _('ID_PMG_SELECT_FILE'),
fieldLabel : _('ID_PMG_FILE'),
name : 'googleCertificate',
buttonText : '',
width : 400,
buttonCfg : {
iconCls : 'upload-icon'
},
listeners:{
change : function(){
changeSettings();
},
afterrender:function(cmp){
changeSettings();
cmp.fileInput.set({
accept:'*/json'
});
}
},
regex : /(.)+((\.json)(\w)?)$/i,
regexText : _('ID_PMG_TYPE_ACCEPT')
},
{
xtype : 'label',
id : 'labelFileGoogleCertificate',
name : 'labelFileGoogleCertificate',
labelAlign : 'right',
fieldLabel : '',
text : googleCertificate,
width : 400,
style : "padding-left:180px;"
}
]
});
var testPMGmail = new Ext.form.FieldSet({
id : 'testPMGmail',
title : _('ID_TEST_CONNECTION'),
hidden : true,
items : [
{
id : 'currentUserName',
xtype : 'label',
labelAlign : 'right',
fieldLabel : _('ID_CURRENT_USER'),
text : '',
width : 400
},
{
id : 'rootFolderId',
xtype : 'label',
labelAlign : 'right',
fieldLabel : _('ID_ROOT_FOLDER'),
text : '',
width : 400
},
{
id : 'quotaType',
xtype : 'label',
labelAlign : 'right',
fieldLabel : _('ID_QUOTA_TYPE'),
text : '',
width : 400
},
{
id : 'quotaBytesTotal',
xtype : 'label',
labelAlign : 'right',
fieldLabel : _('ID_QUOTA_TOTAL'),
text : '',
width : 400
},
{
id : 'quotaBytesUsed',
xtype : 'label',
labelAlign : 'right',
fieldLabel : _('ID_QUOTA_USED'),
text : '',
width : 400
},
{
id : 'responseGmailTest',
xtype : 'label',
labelAlign : 'right',
labelStyle : 'font-weight:bold;',
fieldLabel : _('SERVER_RESPONSE'),
text : '',
width : 400
}
]
});
storeUsers = new Ext.data.JsonStore({
url: '../pmGmail/testUserGmail',
fields: [
'USR_UID',
'FULL_NAME',
'EMAIL'
]
});
var listViewUsers = new Ext.list.ListView({
store: storeUsers,
singleSelect: true,
emptyText: _('ID_GRID_PAGE_NO_USERS_MESSAGE'),
reserveScrollOffset: true,
columns: [
{
header: _('ID_FULL_NAME'),
width:.4,
dataIndex: 'FULL_NAME'
},{
header: _('ID_EMAIL'),
width:.4,
dataIndex: 'EMAIL'
}]
});
var listUsers = new Ext.form.FieldSet({
id : 'listUsers',
title : _('ID_USERS'),
hidden : true,
items : [
listViewUsers
]
});
var formPMGmail = new Ext.FormPanel({
title : '&nbsp',
id :'formPMGmail',
labelWidth : 170,
labelAlign :'right',
autoScroll : true,
fileUpload : true,
bodyStyle :'padding:5px',
waitMsgTarget : true,
frame : true,
defaults: {
allowBlank: false,
msgTarget: 'side',
align:'center'
},
items:[ configurationPMGmail, testPMGmail, listUsers ],
buttons : [testButton, saveButton]
});
var viewport = new Ext.Viewport({
layout: 'fit',
autoScroll: false,
items: [
formPMGmail
]
});
Ext.getCmp('serviceGmailStatus').checked = statusGmail;
Ext.getCmp('serviceGmailStatus').setValue(statusGmail);
Ext.getCmp('serviceDriveStatus').checked = statusDrive;
Ext.getCmp('serviceDriveStatus').setValue(statusDrive);
if (statusGmail || statusDrive){
enableInterfazCertificate();
}
});
var testSettings = function ()
{
storeUsers.reload();
Ext.getCmp('testPMGmail').hide();
Ext.getCmp('listUsers').hide();
Ext.getCmp('currentUserName').setText('');
Ext.getCmp('rootFolderId').setText('');
Ext.getCmp('quotaType').setText('');
Ext.getCmp('quotaBytesTotal').setText('');
Ext.getCmp('quotaBytesUsed').setText('');
Ext.getCmp('responseGmailTest').setText('');
Ext.getCmp('responseGmailTest').container.dom.style.color = 'red';
Ext.getCmp('formPMGmail').getForm().submit( {
url : '../pmGmail/testConfigPmGmail',
waitMsg : _('ID_TEST_CONNECTION'),
waitTitle : "&nbsp;",
timeout : 60000,
success : function(obj, resp) {
Ext.getCmp('testPMGmail').show();
Ext.getCmp('listUsers').show();
var response = Ext.decode(resp.response.responseText);
Ext.getCmp('currentUserName').setText(response.currentUserName);
Ext.getCmp('rootFolderId').setText(response.rootFolderId);
Ext.getCmp('quotaType').setText(response.quotaType);
Ext.getCmp('quotaBytesTotal').setText(response.quotaBytesTotal);
Ext.getCmp('quotaBytesUsed').setText(response.quotaBytesUsed);
Ext.getCmp('responseGmailTest').setText(response.responseGmailTest);
Ext.getCmp('responseGmailTest').container.dom.style.color = 'green';
if (storeUsers.data.length == 0) {
saveButton.enable();
}
},
failure: function(obj, resp) {
Ext.getCmp('testPMGmail').show();
Ext.getCmp('listUsers').hide();
saveButton.disable();
Ext.getCmp('responseGmailTest').setText(resp.result.responseGmailTest);
}
});
};
var saveSettings = function ()
{
Ext.getCmp('formPMGmail').getForm().submit( {
url : '../pmGmail/saveConfigPmGmail',
waitMsg : _('ID_SAVING_PROCESS'),
waitTitle : "&nbsp;",
timeout : 60000,
success : function(obj, resp) {
var response = Ext.decode(resp.response.responseText);
parent.PMExt.notify(_('ID_INFO'),_('ID_SAVED_SUCCESSFULLY'));
location.href = '../pmGmail/formPMGmail';
},
failure: function(obj, resp) {
PMExt.error( _('ID_ERROR'), resp.result.message);
}
});
};
var changeSettings = function()
{
disableAll();
if (Ext.getCmp('serviceGmailStatus').checked || Ext.getCmp('serviceDriveStatus').checked) {
enableInterfazCertificate();
}
};

View File

@@ -1,32 +0,0 @@
<?php
session_start();
if (!isset($_SESSION['USER_LOGGED'])) {
die( '<script type="text/javascript">
try
{
var dataToSend = {
"action": "credentials",
"operation": "refreshPmSession",
"type": "processCall",
"funParams": [
"",
""
],
"expectReturn": false
};
var x = parent.postMessage(JSON.stringify(dataToSend), "*");
}catch (err)
{
parent.location = parent.location;
}
</script>');
}
if(key_exists('form', $_GET) && $_GET['form']){
header( 'location:' . $_SESSION['server'] . $_SESSION['PMCase'] );
}else if(key_exists('processmap', $_GET) && $_GET['processmap']){
header( 'location:' . $_SESSION['server'] . $_SESSION['PMProcessmap'] );
}else if(key_exists('uploaded', $_GET) && $_GET['uploaded']){
header( 'location:' . $_SESSION['server'] . $_SESSION['PMUploadedDocuments'] );
} else if(key_exists('generated', $_GET) && $_GET['generated']){
header( 'location:' . $_SESSION['server'] . $_SESSION['PMGeneratedDocuments'] );
}

View File

@@ -1,132 +0,0 @@
<?php
session_start();
require_once __DIR__ . '/../../../bootstrap/autoload.php';
require_once (dirname(__FILE__) . '/../../../gulliver/system/class.bootstrap.php');
require_once (dirname(__FILE__) . '/../../../gulliver/system/class.g.php');
$gmailToken = $_GET['gmailToken'];
$gmail = $_GET['gmail'];
$pmtoken = $_GET['pmtoken'];
$pmws = $_GET['pmws'];
$appUid = $_GET['appUid'];
$delIndex = $_GET['delIndex'];
$action = $_GET['action'];
$proUid = $_GET['proUid'];
$server = isset($_GET['server']) ? $_GET['server'] : '';
//We do need the server to continue.
if (!isset($_GET['server']) || $server == "") {
throw new \Exception(Bootstrap::LoadTranslation('ID_GMAIL_NEED_SERVER'));
}
//First check if the feature is enabled.
$gCurl = curl_init('https://' . $server . '/api/1.0/' . $pmws . '/gmailIntegration/verifyGmailfeature/');
curl_setopt($gCurl, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $pmtoken));
curl_setopt($gCurl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($gCurl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($gCurl, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($gCurl, CURLOPT_SSL_VERIFYHOST, false);
if (curl_exec($gCurl) === false) {
echo 'Curl error: ' . curl_error($gCurl);
error_log(Bootstrap::LoadTranslation('ID_SERVER_COMMUNICATION_ERROR'));
die();
} else {
$gCurl_response = curl_exec($gCurl);
curl_close($gCurl);
$gResp = G::json_decode($gCurl_response);
if ($gResp === false) {
echo Bootstrap::LoadTranslation('ID_NOT_ENABLED');
die();
}
}
set_time_limit(60);
$curl = curl_init('https://' . $server . '/api/1.0/' . $pmws . '/gmailIntegration/userexist/' . $gmail);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $pmtoken));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
$curl_response = curl_exec($curl);
curl_close($curl);
$decodedResp = G::json_decode($curl_response);
if (!is_object($decodedResp) || property_exists($decodedResp, 'error')) {
die($decodedResp->error->message);
}
//getting the enviroment
$enviroment = $decodedResp->enviroment;
if (count($decodedResp->user) > 1) {
echo Bootstrap::LoadTranslation('ID_EMAIL_MORE_THAN_ONE_USER');
die;
} else if (count($decodedResp->user) < 1) {
echo Bootstrap::LoadTranslation('ID_USER_NOT_FOUND');
die;
}
//validationg if there is an actual PM session
if (!isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] != $decodedResp->user['0']->USR_UID) {
$url = 'https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=' . $gmailToken;
// init curl object
$ch = curl_init();
// define options
$optArray = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false
);
// apply those options
curl_setopt_array($ch, $optArray);
// execute request and get response
$result = curl_exec($ch);
$response = (G::json_decode($result));
curl_close($ch);
//First validate if this user (mail) corresponds to a PM user
if (isset($response->email) && ($gmail == $response->email)) {
//If the email corresponds I get the username and with the gmail user_id the session is created.
if ($decodedResp->user['0']->USR_STATUS == "ACTIVE") {
//User Active! lets create the Session
@session_destroy();
session_start();
session_regenerate_id();
$cookieOptions = Bootstrap::buildCookieOptions(['expires' => time() + (24 * 60 * 60), 'path' => '/sys' . $enviroment, 'httponly' => true]);
setcookie('workspaceSkin', $enviroment, $cookieOptions);
$_SESSION = array();
$_SESSION['phpLastFileFound'] = '';
$_SESSION['USERNAME_PREVIOUS1'] = $decodedResp->user['0']->USR_USERNAME;
$_SESSION['USERNAME_PREVIOUS2'] = $decodedResp->user['0']->USR_USERNAME;
$_SESSION['WORKSPACE'] = $pmws;
$_SESSION['USR_FULLNAME'] = $decodedResp->user['0']->USR_FIRSTNAME . ' ' . $decodedResp->user['0']->USR_LASTNAME;
$_SESSION['__sw__'] = 1;
initUserSession(
$decodedResp->user['0']->USR_UID, $decodedResp->user['0']->USR_USERNAME
);
//session created
} else {
echo Bootstrap::LoadTranslation('ID_USER_NOT_ACTIVE');
die;
}
} else {
echo Bootstrap::LoadTranslation('ID_USER_DOES_NOT_CORRESPOND');
die;
}
}
$_SESSION['server'] = 'https://' . $server . '/sys' . $pmws . '/en/' . $enviroment . '/';
$_SESSION['PMCase'] = 'cases/cases_Open?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex . '&action=' . $action . '&gmail=1';
$_SESSION['PMProcessmap'] = 'designer?prj_uid=' . $proUid . '&prj_readonly=true&app_uid=' . $appUid;
$_SESSION['PMUploadedDocuments'] = 'cases/ajaxListener?action=uploadedDocuments';
$_SESSION['PMGeneratedDocuments'] = 'cases/casesGenerateDocumentPage_Ajax.php?actionAjax=casesGenerateDocumentPage';
header('location:' . 'templateForm.php');

View File

@@ -1,114 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Interface Processmaker</title>
<script type="text/javascript" src="/lib/js/jquery-1.10.2.min.js"></script>
<link rel="stylesheet" href="/lib/pmUI/pmui.min.css">
<script type="text/javascript" >
jQuery(document).ready(function() {
var tid;
var addLoading = function (host, panel, message) {
panel = panel || 'PMContent';
message = message || 'Loading...';
var divLoading = document.createElement('div');
var span = document.createElement('span');
var text = document.createTextNode(message);
divLoading.setAttribute('id', 'PMGmailLoad');
divLoading.setAttribute('style', 'position:absolute; left: 0px;top: 0px;width: 100%;height: 100%;z-index: 9999;background: url('+host+'../../../lib/img/loading.gif) 50% 50% no-repeat #f9f9f9;');
span.setAttribute('style', ' margin-top: 50%; margin-left: 44%; position: absolute; font-weight: bold; font-size: 12px; margin-right: auto;');
span.appendChild(text);
divLoading.appendChild(span);
document.getElementById(panel).appendChild(divLoading);
};
var removeLoading = function () {
document.getElementById('PMGmailLoad').remove();
};
var resizePMDynadorm = function () {
var iframe = document.getElementById('iframePM');
var content = iframe.contentDocument;
if (content != null){
clearInterval(tid);
}
};
jQuery('.pmui-tab-ref').on('click', function(e) {
var currentAttrValue = jQuery(this).attr('href');
jQuery(this).parent('li').addClass('pmui-active').siblings().removeClass('pmui-active');
//url iframe
currentAttrValue = jQuery(this).attr('linkPM');
addLoading(jQuery(this).attr('PMServer'));
$('#iframePM').attr('src', currentAttrValue);
e.preventDefault();
});
$('#iframePM').load( function () {
tid = setInterval(function(){ resizePMDynadorm() }, 500);
removeLoading();
});
var currentAttrValue = jQuery('.pmui-tab-ref');
addLoading(currentAttrValue[0].attributes[3].value);
$('#iframePM').attr('src',currentAttrValue[0].attributes[2].value);
});
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
var eventer = window[eventMethod];
var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
eventer(messageEvent,function(e) {
parent.parent.postMessage(e.data, 'https://mail.google.com');
},false);
</script>
</head>
<body>
<?php
session_start();
?>
<div class="pmui-tabpanel-tabs_container" style="display: block; height: 40px;">
<ul class="pmui-tabpanel-tabs" style="display:block; float:left;">
<li class="pmui pmui-tabitem pmui-active" style="left: 0px; top: 0px; width: auto; height: auto; position: relative; z-index: auto; display: inline-block;">
<i class="pmui-tab-icon"> </i>
<a class="pmui-tab-ref" href="#PMCases" linkPM="<?php echo $_SESSION['server'] . '../../../pmGmail/lostSession.php?form=1' ?>" PMServer="<?php echo $_SESSION['server'] ?>">
Form
</a>
</li>
<li class="pmui pmui-tabitem" style="left: 0px; top: 0px; width: auto; height: auto; position: relative; z-index: auto; display: inline-block;">
<i class="pmui-tab-icon"> </i>
<a class="pmui-tab-ref" href="#PMProcessmap" linkPM="<?php echo $_SESSION['server'] . '../../../pmGmail/lostSession.php?processmap=1' ?>" PMServer="<?php echo $_SESSION['server'] ?>">
Processmap
</a>
</li>
<li class="pmui pmui-tabitem" style="left: 0px; top: 0px; width: auto; height: auto; position: relative; z-index: auto; display: inline-block;">
<i class="pmui-tab-icon"> </i>
<a class="pmui-tab-ref" href="#PMUploadedDocuments" linkPM="<?php echo $_SESSION['server'] . '../../../pmGmail/lostSession.php?uploaded=1' ?>" PMServer="<?php echo $_SESSION['server'] ?>">
Uploaded
</a>
</li>
<li class="pmui pmui-tabitem" style="left: 0px; top: 0px; width: auto; height: auto; position: relative; z-index: auto; display: inline-block;">
<i class="pmui-tab-icon"> </i>
<a class="pmui-tab-ref" href="#PMGeneratedDocuments" linkPM="<?php echo $_SESSION['server'] . '../../../pmGmail/lostSession.php?generated=1' ?>" PMServer="<?php echo $_SESSION['server'] ?>">
Generated
</a>
</li>
</ul>
<div class="tab-content">
<div class="tab active" id="PMContent">
<iframe id="iframePM" src="" width="100%" height="530" style="overflow:hidden;"></iframe>
</div>
</div>
</div>
</body>
</html>

View File

@@ -1,96 +0,0 @@
<!DOCTYPE html>
<html class="js js csstransitions" lang="en"><head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Open Source Workflow Software &amp; Business Process Management BPM</title>
<meta http-equiv="Content-Language" content="en"><meta name="description" content="Open source web based workflow software and Business Process Management software">
<meta name="keywords" content="workflow software"><meta name="googlebot" content="index, follow">
<meta name="robots" content="index, follow">
<meta name="Revisit-After" content="7 days">
<meta name="city" content="Brooklyn">
<meta name="country" content="United States of America (USA)">
<meta name="state" content="NY">
<meta name="zip code" content="11238">
<meta name="geo.region" content="US-NY">
<meta name="geo.placename" content="Brooklyn">
<meta name="DC.title" content="ProcessMaker Inc.">
<meta name="subject" content="Open Source Workflow, Business Process Management (BPM) Soft-ware.">
<meta name="author" content="ProcessMaker Inc.">
<meta name="copyright" content="ProcessMaker Inc.">
<link type="text/css" rel="stylesheet" href="../css/general.css" media="all">
<link type="text/css" rel="stylesheet" href="../css/sb-admin-2.css" media="all">
<link rel="shortcut icon" href="http://www.processmaker.com/favicon.ico" type="image/vnd.microsoft.icon">
<script>
document.onreadystatechange = function () {
var state = document.readyState
if (state == 'interactive') {
document.getElementById('main-content').style.visibility="hidden";
} else if (state == 'complete') {
document.getElementById('loading').style.visibility="hidden";
document.getElementById('loading').style.display="none";
document.getElementById('main-content').style.visibility="visible";
}
}
</script>
<body class="html front not-logged-in no-sidebars page-node" id="page-top" data-spy="scroll" data-target=".navbar-custom" style="background-color:white;">
<div id="main-content" class="container">
<div class="row">
<div class="col-lg-12" style="margin: 0 auto;">
<div style="margin: 0 auto; width:600px;padding:25px;">
<div style="margin: 0 auto; text-align:center;margin-top:40px;">
<img src = "../images/logo-processmaker-google.png">
</div>
<h2 style="margin: 0 auto; text-align:center; margin-top:40px;">ProcessMaker Google Integration</h2>
<p style="margin: 0 auto; text-align:center; margin-top:10px;">
The ProcessMaker Google Integration extension and components have been uninstalled from your Gmail Acccount.
</p>
</div>
</div>
</div>
</div>
<div id="loading" style="width:120px;margin:0 auto;margin-top:200px;text-align:center;">
<img id="loading-image" src="../images/ext/default/shared/large-loading.gif" alt="Uninstalling..." />
<div>Uninstalling ...</div>
</div>
</body>
</html>
<?php
/*
* Uninstall file to help in the uninstaling process of the PMGmail Extension.
* This deletes the labels created by the Extension in the user email.
*
*/
/**
* Call the end point to delete labels
*
* @param string $server
* @param string $pmws
* @param string $mail
* @param string $pmtoken
*/
function callEndPointDeleteLabels($server, $pmws, $mail, $pmtoken){
set_time_limit(60);
$curl = curl_init( 'https://' . $server . '/api/1.0/' . $pmws . '/gmailIntegration/deleteLabels/'. $mail );
curl_setopt( $curl, CURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' . $pmtoken ) );
curl_setopt( $curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 0);
$curl_response = curl_exec( $curl );
curl_close($curl);
}
$server = $_GET['server'];
$pmws = $_GET['pmws'];
$mail = $_GET['mail'];
$pmtoken = $_GET['pmtoken'];
callEndPointDeleteLabels($server, $pmws, $mail, $pmtoken);
?>