Merge pull request #835 from ralpheav/master

Code Style change  workflow/engine/methods/cases/
This commit is contained in:
ferOnti
2012-10-19 08:44:28 -07:00
5 changed files with 1145 additions and 1171 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,157 +1,149 @@
<?php
/**
* processes_List.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
$actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null;
if ($actionAjax == 'historyGridList_JXP') {
G::LoadClass( 'case' );
G::LoadClass( "BasePeer" );
global $G_PUBLISH;
$c = Cases::getTransferHistoryCriteria( $_SESSION['APPLICATION'] );
$result = new stdClass();
$aProcesses = Array ();
$rs = GulliverBasePeer::doSelectRs( $c );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rs->next();
for ($j = 0; $j < $rs->getRecordCount(); $j ++) {
$result = $rs->getRow();
$result["ID_HISTORY"] = $result["PRO_UID"] . '_' . $result["APP_UID"] . '_' . $result["TAS_UID"];
$aProcesses[] = $result;
$rs->next();
}
$newDir = '/tmp/test/directory';
$r = G::verifyPath( $newDir );
$r->data = $aProcesses;
$r->totalCount = 2;
echo G::json_encode( $r );
}
if ($actionAjax == 'historyGridListChangeLogPanelBody_JXP') {
//!dataInput
$idHistory = $_REQUEST["idHistory"];
//!dataInput
//!dataSytem
$idHistoryArray = explode( "*", $idHistory );
$_REQUEST["PRO_UID"] = $idHistoryArray[0];
$_REQUEST["APP_UID"] = $idHistoryArray[1];
$_REQUEST["TAS_UID"] = $idHistoryArray[2];
$_REQUEST["DYN_UID"] = "";
?>
<table bgcolor="white" height=100% width=100%>
<tr>
<td height=99%>
<div
style="width: 100%; overflow-y: scroll; overflow-x: hidden; max-height: 310px; _height: 310px; height: 310px; visibility: inherit;">
<?php
require_once 'classes/model/AppHistory.php';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'view', 'cases/cases_DynaformHistory' );
G::RenderPage( 'publish', 'raw' );
?>
</div>
</td>
</tr>
<tr>
<td height=30 valign=top>
<table align=center cellspacing="0" class="x-btn x-btn-noicon"
id="ext-comp-1043" style="width: 75px; margin-top: 0px;">
<tbody class="x-btn-small x-btn-icon-small-left">
<tr>
<td class="x-btn-tl"><i>&nbsp;</i></td>
<td class="x-btn-tc"></td>
<td class="x-btn-tr"><i>&nbsp;</i></td>
</tr>
<tr>
<td class="x-btn-ml"><i>&nbsp;</i></td>
<td class="x-btn-mc"><em unselectable="on" class="">
<button type="button" id="ext-gen105" class=" x-btn-text">OK</button>
</em></td>
<td class="x-btn-mr"><i>&nbsp;</i></td>
</tr>
<tr>
<td class="x-btn-bl"><i>&nbsp;</i></td>
<td class="x-btn-bc"></td>
<td class="x-btn-br"><i>&nbsp;</i></td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
<?php
}
if ($actionAjax == "showDynaformHistoryGetNomDynaform_JXP") {
require_once 'classes/model/ContentPeer.php';
//!dataInput
$idDin = $_REQUEST['idDin'];
$dynDate = $_REQUEST["dynDate"];
//!dataOuput
$md5Hash = "";
$dynTitle = '';
$c = new Criteria();
$c0 = $c->getNewCriterion( ContentPeer::CON_ID, $idDin );
$c1 = $c->getNewCriterion( ContentPeer::CON_CATEGORY, 'DYN_TITLE' );
$c0->addAnd( $c1 );
$c->add( $c0 );
$contentObjeto = ContentPeer::doSelectOne( $c );
if (is_object( $contentObjeto )) {
$dynTitle = $contentObjeto->getConValue();
}
$md5Hash = md5( $idDin . $dynDate );
//assign task
$result = new stdClass();
$result->dynTitle = $dynTitle;
$result->md5Hash = $md5Hash;
echo G::json_encode( $result );
}
<?php
/**
* processes_List.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
$actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null;
if ($actionAjax == 'historyGridList_JXP') {
G::LoadClass( 'case' );
G::LoadClass( "BasePeer" );
global $G_PUBLISH;
$c = Cases::getTransferHistoryCriteria( $_SESSION['APPLICATION'] );
$result = new stdClass();
$aProcesses = Array ();
$rs = GulliverBasePeer::doSelectRs( $c );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rs->next();
for ($j = 0; $j < $rs->getRecordCount(); $j ++) {
$result = $rs->getRow();
$result["ID_HISTORY"] = $result["PRO_UID"] . '_' . $result["APP_UID"] . '_' . $result["TAS_UID"];
$aProcesses[] = $result;
$rs->next();
}
$newDir = '/tmp/test/directory';
$r = G::verifyPath( $newDir );
$r->data = $aProcesses;
$r->totalCount = 2;
echo G::json_encode( $r );
}
if ($actionAjax == 'historyGridListChangeLogPanelBody_JXP') {
//!dataInput
$idHistory = $_REQUEST["idHistory"];
//!dataInput
//!dataSytem
$idHistoryArray = explode( "*", $idHistory );
$_REQUEST["PRO_UID"] = $idHistoryArray[0];
$_REQUEST["APP_UID"] = $idHistoryArray[1];
$_REQUEST["TAS_UID"] = $idHistoryArray[2];
$_REQUEST["DYN_UID"] = "";
?>
<table bgcolor="white" height=100% width=100%>
<tr>
<td height=99%>
<div
style="width: 100%; overflow-y: scroll; overflow-x: hidden; max-height: 310px; _height: 310px; height: 310px; visibility: inherit;">
<?php
require_once 'classes/model/AppHistory.php';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'view', 'cases/cases_DynaformHistory' );
G::RenderPage( 'publish', 'raw' );
?>
</div>
</td>
</tr>
<tr>
<td height=30 valign=top>
<table align=center cellspacing="0" class="x-btn x-btn-noicon"
id="ext-comp-1043" style="width: 75px; margin-top: 0px;">
<tbody class="x-btn-small x-btn-icon-small-left">
<tr>
<td class="x-btn-tl"><i>&nbsp;</i></td>
<td class="x-btn-tc"></td>
<td class="x-btn-tr"><i>&nbsp;</i></td>
</tr>
<tr>
<td class="x-btn-ml"><i>&nbsp;</i></td>
<td class="x-btn-mc"><em unselectable="on" class="">
<button type="button" id="ext-gen105" class=" x-btn-text">OK</button>
</em></td>
<td class="x-btn-mr"><i>&nbsp;</i></td>
</tr>
<tr>
<td class="x-btn-bl"><i>&nbsp;</i></td>
<td class="x-btn-bc"></td>
<td class="x-btn-br"><i>&nbsp;</i></td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
<?php
}
if ($actionAjax == "showDynaformHistoryGetNomDynaform_JXP") {
require_once 'classes/model/ContentPeer.php';
//!dataInput
$idDin = $_REQUEST['idDin'];
$dynDate = $_REQUEST["dynDate"];
//!dataOuput
$md5Hash = "";
$dynTitle = '';
$c = new Criteria();
$c0 = $c->getNewCriterion( ContentPeer::CON_ID, $idDin );
$c1 = $c->getNewCriterion( ContentPeer::CON_CATEGORY, 'DYN_TITLE' );
$c0->addAnd( $c1 );
$c->add( $c0 );
$contentObjeto = ContentPeer::doSelectOne( $c );
if (is_object( $contentObjeto )) {
$dynTitle = $contentObjeto->getConValue();
}
$md5Hash = md5( $idDin . $dynDate );
//assign task
$result = new stdClass();
$result->dynTitle = $dynTitle;
$result->md5Hash = $md5Hash;
echo G::json_encode( $result );
}

View File

@@ -1,175 +1,175 @@
<?php
/**
* processes_List.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
$actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null;
if ($actionAjax == 'messageHistoryGridList_JXP') {
G::LoadClass( 'case' );
G::LoadClass( "BasePeer" );
global $G_PUBLISH;
$oCase = new Cases();
$appMessageArray = $oCase->getHistoryMessagesTrackerExt( $_SESSION['APPLICATION'] );
$result = new stdClass();
$aProcesses = Array ();
$totalCount = 0;
foreach ($appMessageArray as $index => $value) {
$appMessageArray[$index]['ID_MESSAGE'] = $appMessageArray[$index]['APP_UID'] . '_' . $appMessageArray[$index]['APP_MSG_UID'];
$aProcesses[] = $appMessageArray[$index];
$totalCount ++;
}
$newDir = '/tmp/test/directory';
$r = G::verifyPath( $newDir );
$r->data = $aProcesses;
$r->totalCount = $totalCount;
echo G::json_encode( $r );
}
if ($actionAjax == 'showHistoryMessage') {
?>
<link rel="stylesheet" type="text/css" href="/css/classic.css" />
<style type="text/css">
html {
color: black !important;
}
body {
color: black !important;
}
</style>
<script language="Javascript">
//!Code that simulated reload library javascript maborak
var leimnud = {};
leimnud.exec = "";
leimnud.fix = {};
leimnud.fix.memoryLeak = "";
leimnud.browser = {};
leimnud.browser.isIphone = "";
leimnud.iphone = {};
leimnud.iphone.make = function(){};
function ajax_function(ajax_server, funcion, parameters, method){
}
//!
</script>
<?php
G::LoadClass( 'case' );
$oCase = new Cases();
$_POST["APP_UID"] = $_REQUEST["APP_UID"];
$_POST['APP_MSG_UID'] = $_REQUEST["APP_MSG_UID"];
$G_PUBLISH = new Publisher();
$oCase = new Cases();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_MessagesView', '', $oCase->getHistoryMessagesTrackerView( $_POST['APP_UID'], $_POST['APP_MSG_UID'] ) );
?>
<script language="javascript">
<?php
global $G_FORM;
?>
function loadForm_<?php echo $G_FORM->id;?>(parametro1){
}
</script>
<?php
G::RenderPage( 'publish', 'raw' );
}
if ($actionAjax == 'sendMailMessage_JXP') {
//!dataSystem
$errorMessage = "";
try {
//!dataInput
$_POST['APP_UID'] = $_REQUEST['APP_UID'];
$_POST['APP_MSG_UID'] = $_REQUEST['APP_MSG_UID'];
G::LoadClass( 'case' );
$oCase = new Cases();
require_once 'classes/model/Configuration.php';
G::LoadClass( 'spool' );
$oCase = new Cases();
$data = $oCase->getHistoryMessagesTrackerView( $_POST['APP_UID'], $_POST['APP_MSG_UID'] );
//print_r($data);
$oConfiguration = new Configuration();
$sDelimiter = DBAdapter::getStringDelimiter();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ConfigurationPeer::CFG_UID, 'Emails' );
$oCriteria->add( ConfigurationPeer::OBJ_UID, '' );
$oCriteria->add( ConfigurationPeer::PRO_UID, '' );
$oCriteria->add( ConfigurationPeer::USR_UID, '' );
$oCriteria->add( ConfigurationPeer::APP_UID, '' );
if (ConfigurationPeer::doCount( $oCriteria ) == 0) {
$oConfiguration->create( array ('CFG_UID' => 'Emails','OBJ_UID' => '','CFG_VALUE' => '','PRO_UID' => '','USR_UID' => '','APP_UID' => ''
) );
$aConfiguration = array ();
} else {
$aConfiguration = $oConfiguration->load( 'Emails', '', '', '', '' );
if ($aConfiguration['CFG_VALUE'] != '') {
$aConfiguration = unserialize( $aConfiguration['CFG_VALUE'] );
} else {
$aConfiguration = array ();
}
}
$passwd = $aConfiguration['MESS_PASSWORD'];
$passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' );
$auxPass = explode( 'hash:', $passwdDec );
if (count( $auxPass ) > 1) {
if (count( $auxPass ) == 2) {
$passwd = $auxPass[1];
} else {
array_shift( $auxPass );
$passwd = implode( '', $auxPass );
}
}
$aConfiguration['MESS_PASSWORD'] = $passwd;
$oSpool = new spoolRun();
$oSpool->setConfig( array ('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'],'MESS_SERVER' => $aConfiguration['MESS_SERVER'],'MESS_PORT' => $aConfiguration['MESS_PORT'],'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'],'MESS_PASSWORD' => $passwd,'SMTPAuth' => $aConfiguration['MESS_RAUTH']
) );
$oSpool->create( array ('msg_uid' => $data['MSG_UID'],'app_uid' => $data['APP_UID'],'del_index' => $data['DEL_INDEX'],'app_msg_type' => $data['APP_MSG_TYPE'],'app_msg_subject' => $data['APP_MSG_SUBJECT'],'app_msg_from' => $data['APP_MSG_FROM'],'app_msg_to' => $data['APP_MSG_TO'],'app_msg_body' => $data['APP_MSG_BODY'],'app_msg_cc' => $data['APP_MSG_CC'],'app_msg_bcc' => $data['APP_MSG_BCC'],'app_msg_attach' => $data['APP_MSG_ATTACH'],'app_msg_template' => $data['APP_MSG_TEMPLATE'],'app_msg_status' => 'pending'
) );
$oSpool->sendMail();
} catch (Exception $e) {
$errorMessage = $e->getMessage();
}
echo $errorMessage;
}
<?php
/**
* processes_List.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
$actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null;
if ($actionAjax == 'messageHistoryGridList_JXP') {
G::LoadClass( 'case' );
G::LoadClass( "BasePeer" );
global $G_PUBLISH;
$oCase = new Cases();
$appMessageArray = $oCase->getHistoryMessagesTrackerExt( $_SESSION['APPLICATION'] );
$result = new stdClass();
$aProcesses = Array ();
$totalCount = 0;
foreach ($appMessageArray as $index => $value) {
$appMessageArray[$index]['ID_MESSAGE'] = $appMessageArray[$index]['APP_UID'] . '_' . $appMessageArray[$index]['APP_MSG_UID'];
$aProcesses[] = $appMessageArray[$index];
$totalCount ++;
}
$newDir = '/tmp/test/directory';
$r = G::verifyPath( $newDir );
$r->data = $aProcesses;
$r->totalCount = $totalCount;
echo G::json_encode( $r );
}
if ($actionAjax == 'showHistoryMessage') {
?>
<link rel="stylesheet" type="text/css" href="/css/classic.css" />
<style type="text/css">
html {
color: black !important;
}
body {
color: black !important;
}
</style>
<script language="Javascript">
//!Code that simulated reload library javascript maborak
var leimnud = {};
leimnud.exec = "";
leimnud.fix = {};
leimnud.fix.memoryLeak = "";
leimnud.browser = {};
leimnud.browser.isIphone = "";
leimnud.iphone = {};
leimnud.iphone.make = function(){};
function ajax_function(ajax_server, funcion, parameters, method){
}
//!
</script>
<?php
G::LoadClass( 'case' );
$oCase = new Cases();
$_POST["APP_UID"] = $_REQUEST["APP_UID"];
$_POST['APP_MSG_UID'] = $_REQUEST["APP_MSG_UID"];
$G_PUBLISH = new Publisher();
$oCase = new Cases();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_MessagesView', '', $oCase->getHistoryMessagesTrackerView( $_POST['APP_UID'], $_POST['APP_MSG_UID'] ) );
?>
<script language="javascript">
<?php
global $G_FORM;
?>
function loadForm_<?php echo $G_FORM->id;?>(parametro1){
}
</script>
<?php
G::RenderPage( 'publish', 'raw' );
}
if ($actionAjax == 'sendMailMessage_JXP') {
//!dataSystem
$errorMessage = "";
try {
//!dataInput
$_POST['APP_UID'] = $_REQUEST['APP_UID'];
$_POST['APP_MSG_UID'] = $_REQUEST['APP_MSG_UID'];
G::LoadClass( 'case' );
$oCase = new Cases();
require_once 'classes/model/Configuration.php';
G::LoadClass( 'spool' );
$oCase = new Cases();
$data = $oCase->getHistoryMessagesTrackerView( $_POST['APP_UID'], $_POST['APP_MSG_UID'] );
//print_r($data);
$oConfiguration = new Configuration();
$sDelimiter = DBAdapter::getStringDelimiter();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ConfigurationPeer::CFG_UID, 'Emails' );
$oCriteria->add( ConfigurationPeer::OBJ_UID, '' );
$oCriteria->add( ConfigurationPeer::PRO_UID, '' );
$oCriteria->add( ConfigurationPeer::USR_UID, '' );
$oCriteria->add( ConfigurationPeer::APP_UID, '' );
if (ConfigurationPeer::doCount( $oCriteria ) == 0) {
$oConfiguration->create( array ('CFG_UID' => 'Emails','OBJ_UID' => '','CFG_VALUE' => '','PRO_UID' => '','USR_UID' => '','APP_UID' => ''
) );
$aConfiguration = array ();
} else {
$aConfiguration = $oConfiguration->load( 'Emails', '', '', '', '' );
if ($aConfiguration['CFG_VALUE'] != '') {
$aConfiguration = unserialize( $aConfiguration['CFG_VALUE'] );
} else {
$aConfiguration = array ();
}
}
$passwd = $aConfiguration['MESS_PASSWORD'];
$passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' );
$auxPass = explode( 'hash:', $passwdDec );
if (count( $auxPass ) > 1) {
if (count( $auxPass ) == 2) {
$passwd = $auxPass[1];
} else {
array_shift( $auxPass );
$passwd = implode( '', $auxPass );
}
}
$aConfiguration['MESS_PASSWORD'] = $passwd;
$oSpool = new spoolRun();
$oSpool->setConfig( array ('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'],'MESS_SERVER' => $aConfiguration['MESS_SERVER'],'MESS_PORT' => $aConfiguration['MESS_PORT'],'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'],'MESS_PASSWORD' => $passwd,'SMTPAuth' => $aConfiguration['MESS_RAUTH']
) );
$oSpool->create( array ('msg_uid' => $data['MSG_UID'],'app_uid' => $data['APP_UID'],'del_index' => $data['DEL_INDEX'],'app_msg_type' => $data['APP_MSG_TYPE'],'app_msg_subject' => $data['APP_MSG_SUBJECT'],'app_msg_from' => $data['APP_MSG_FROM'],'app_msg_to' => $data['APP_MSG_TO'],'app_msg_body' => $data['APP_MSG_BODY'],'app_msg_cc' => $data['APP_MSG_CC'],'app_msg_bcc' => $data['APP_MSG_BCC'],'app_msg_attach' => $data['APP_MSG_ATTACH'],'app_msg_template' => $data['APP_MSG_TEMPLATE'],'app_msg_status' => 'pending'
) );
$oSpool->sendMail();
} catch (Exception $e) {
$errorMessage = $e->getMessage();
}
echo $errorMessage;
}

View File

@@ -1,76 +1,76 @@
<?php
if (! isset( $_REQUEST['action'] )) {
$res['success'] = 'failure';
$res['message'] = 'You may request an action';
print G::json_encode( $res );
die();
}
if (! function_exists( $_REQUEST['action'] )) {
$res['success'] = 'failure';
$res['message'] = 'The requested action does not exist';
header( "Content-Type: application/json" );
print G::json_encode( $res );
die();
}
$functionName = $_REQUEST['action'];
$functionParams = isset( $_REQUEST['params'] ) ? $_REQUEST['params'] : array ();
$functionName( $functionParams );
function getExtJSParams ()
{
$validParams = array ('callback' => '','dir' => 'DESC','sort' => '','start' => 0,'limit' => 25,'filter' => '','search' => '','action' => '','xaction' => '','data' => '','status' => '','query' => '','fields' => ""
);
$result = array ();
foreach ($validParams as $paramName => $paramDefault) {
$result[$paramName] = isset( $_REQUEST[$paramName] ) ? $_REQUEST[$paramName] : isset( $_REQUEST[$paramName] ) ? $_REQUEST[$paramName] : $paramDefault;
}
return $result;
}
function sendJsonResultGeneric ($response, $callback)
{
header( "Content-Type: application/json" );
$finalResponse = G::json_encode( $response );
if ($callback != '') {
print $callback . "($finalResponse);";
} else {
print $finalResponse;
}
}
function getNotesList ()
{
extract( getExtJSParams() );
require_once ("classes/model/AppNotes.php");
if ((isset( $_REQUEST['appUid'] )) && (trim( $_REQUEST['appUid'] ) != "")) {
$appUid = $_REQUEST['appUid'];
} else {
$appUid = $_SESSION['APPLICATION'];
}
$usrUid = (isset( $_SESSION['USER_LOGGED'] )) ? $_SESSION['USER_LOGGED'] : "";
$appNotes = new AppNotes();
$response = $appNotes->getNotesList( $appUid, '', $start, $limit );
sendJsonResultGeneric( $response['array'], $callback );
}
function postNote ()
{
extract( getExtJSParams() );
if ((isset( $_REQUEST['appUid'] )) && (trim( $_REQUEST['appUid'] ) != "")) {
$appUid = $_REQUEST['appUid'];
} else {
$appUid = $_SESSION['APPLICATION'];
}
$usrUid = (isset( $_SESSION['USER_LOGGED'] )) ? $_SESSION['USER_LOGGED'] : "";
require_once ("classes/model/AppNotes.php");
$noteContent = addslashes( $_POST['noteText'] );
$appNotes = new AppNotes();
$response = $appNotes->postNewNote( $appUid, $usrUid, $noteContent );
sendJsonResultGeneric( $response, $callback );
}
<?php
if (! isset( $_REQUEST['action'] )) {
$res['success'] = 'failure';
$res['message'] = 'You may request an action';
print G::json_encode( $res );
die();
}
if (! function_exists( $_REQUEST['action'] )) {
$res['success'] = 'failure';
$res['message'] = 'The requested action does not exist';
header( "Content-Type: application/json" );
print G::json_encode( $res );
die();
}
$functionName = $_REQUEST['action'];
$functionParams = isset( $_REQUEST['params'] ) ? $_REQUEST['params'] : array ();
$functionName( $functionParams );
function getExtJSParams ()
{
$validParams = array ('callback' => '','dir' => 'DESC','sort' => '','start' => 0,'limit' => 25,'filter' => '','search' => '','action' => '','xaction' => '','data' => '','status' => '','query' => '','fields' => "");
$result = array ();
foreach ($validParams as $paramName => $paramDefault) {
$result[$paramName] = isset( $_REQUEST[$paramName] ) ? $_REQUEST[$paramName] : isset( $_REQUEST[$paramName] ) ? $_REQUEST[$paramName] : $paramDefault;
}
return $result;
}
function sendJsonResultGeneric ($response, $callback)
{
header( "Content-Type: application/json" );
$finalResponse = G::json_encode( $response );
if ($callback != '') {
print $callback . "($finalResponse);";
} else {
print $finalResponse;
}
}
function getNotesList ()
{
extract( getExtJSParams() );
require_once ("classes/model/AppNotes.php");
if ((isset( $_REQUEST['appUid'] )) && (trim( $_REQUEST['appUid'] ) != "")) {
$appUid = $_REQUEST['appUid'];
} else {
$appUid = $_SESSION['APPLICATION'];
}
$usrUid = (isset( $_SESSION['USER_LOGGED'] )) ? $_SESSION['USER_LOGGED'] : "";
$appNotes = new AppNotes();
$response = $appNotes->getNotesList( $appUid, '', $start, $limit );
sendJsonResultGeneric( $response['array'], $callback );
}
function postNote ()
{
extract( getExtJSParams() );
if ((isset( $_REQUEST['appUid'] )) && (trim( $_REQUEST['appUid'] ) != "")) {
$appUid = $_REQUEST['appUid'];
} else {
$appUid = $_SESSION['APPLICATION'];
}
$usrUid = (isset( $_SESSION['USER_LOGGED'] )) ? $_SESSION['USER_LOGGED'] : "";
require_once ("classes/model/AppNotes.php");
$noteContent = addslashes( $_POST['noteText'] );
$appNotes = new AppNotes();
$response = $appNotes->postNewNote( $appUid, $usrUid, $noteContent );
sendJsonResultGeneric( $response, $callback );
}

View File

@@ -1,81 +1,82 @@
<?php
/**
* cases_advancedSearch.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
* by The Answer
*/
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'cases';
$G_ID_MENU_SELECTED = 'CASES';
$G_ID_SUB_MENU_SELECTED = 'CASES_ADVANCEDSEARCH';
$G_PUBLISH = new Publisher();
global $RBAC;
$permisse = $RBAC->userCanAccess( 'PM_ALLCASES' );
$userlogged = $_SESSION['USER_LOGGED'];
require_once ("classes/model/ProcessUser.php");
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( ProcessUserPeer::PU_UID );
$oCriteria->addSelectColumn( ProcessUserPeer::PRO_UID );
$oCriteria->add( ProcessUserPeer::USR_UID, $userlogged );
$oCriteria->add( ProcessUserPeer::PU_TYPE, "SUPERVISOR" );
$oDataset = ProcessUserPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aSupervisor = array ();
while ($aRow = $oDataset->getRow()) {
$aSupervisor[] = $aRow['PRO_UID'];
$oDataset->next();
}
G::LoadClass( 'case' );
$oCases = new Cases();
if (isset( $_POST['form'] )) {
$fields['CASE_NUMBER'] = $_POST['form']['CASE_NUMBER'];
$fields['PROCESS'] = $_POST['form']['PROCESS'];
$fields['TASKS'] = $_POST['form']['TASKS'];
$fields['CURRENT_USER'] = $_POST['form']['CURRENT_USER'];
$fields['SENT_BY'] = $_POST['form']['SENT_BY'];
$fields['LAST_MODIFICATION_F'] = $_POST['form']['LAST_MODIFICATION_F'];
$fields['LAST_MODIFICATION_T'] = $_POST['form']['LAST_MODIFICATION_T'];
$fields['APP_STATUS'] = $_POST['form']['APP_STATUS'];
$Criteria = $oCases->getAdvancedSearch( $fields['CASE_NUMBER'], $fields['PROCESS'], $fields['TASKS'], $fields['CURRENT_USER'], $fields['SENT_BY'], $fields['LAST_MODIFICATION_F'], $fields['LAST_MODIFICATION_T'], $fields['APP_STATUS'], $permisse, $userlogged, $aSupervisor );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_advancedSearchFilter', '', $fields );
} else {
//list($Criteria,$xmlform) = $oCases->getConditionCasesList('gral');
$Criteria = $oCases->getAdvancedSearch( '', '', '', '', '', '', '', '', $permisse, $userlogged, $aSupervisor );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_advancedSearchFilter' );
}
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'cases/cases_advancedSearch', $Criteria );
G::RenderPage( 'publish', 'blank' );
?>
<script>
parent.outerLayout.hide('east');
parent.PANEL_EAST_OPEN = false;
</script>
<?php
/**
* cases_advancedSearch.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
* by The Answer
*/
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'cases';
$G_ID_MENU_SELECTED = 'CASES';
$G_ID_SUB_MENU_SELECTED = 'CASES_ADVANCEDSEARCH';
$G_PUBLISH = new Publisher();
global $RBAC;
$permisse = $RBAC->userCanAccess( 'PM_ALLCASES' );
$userlogged = $_SESSION['USER_LOGGED'];
require_once ("classes/model/ProcessUser.php");
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( ProcessUserPeer::PU_UID );
$oCriteria->addSelectColumn( ProcessUserPeer::PRO_UID );
$oCriteria->add( ProcessUserPeer::USR_UID, $userlogged );
$oCriteria->add( ProcessUserPeer::PU_TYPE, "SUPERVISOR" );
$oDataset = ProcessUserPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aSupervisor = array ();
while ($aRow = $oDataset->getRow()) {
$aSupervisor[] = $aRow['PRO_UID'];
$oDataset->next();
}
G::LoadClass( 'case' );
$oCases = new Cases();
if (isset( $_POST['form'] )) {
$fields['CASE_NUMBER'] = $_POST['form']['CASE_NUMBER'];
$fields['PROCESS'] = $_POST['form']['PROCESS'];
$fields['TASKS'] = $_POST['form']['TASKS'];
$fields['CURRENT_USER'] = $_POST['form']['CURRENT_USER'];
$fields['SENT_BY'] = $_POST['form']['SENT_BY'];
$fields['LAST_MODIFICATION_F'] = $_POST['form']['LAST_MODIFICATION_F'];
$fields['LAST_MODIFICATION_T'] = $_POST['form']['LAST_MODIFICATION_T'];
$fields['APP_STATUS'] = $_POST['form']['APP_STATUS'];
$Criteria = $oCases->getAdvancedSearch( $fields['CASE_NUMBER'], $fields['PROCESS'], $fields['TASKS'], $fields['CURRENT_USER'], $fields['SENT_BY'], $fields['LAST_MODIFICATION_F'], $fields['LAST_MODIFICATION_T'], $fields['APP_STATUS'], $permisse, $userlogged, $aSupervisor );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_advancedSearchFilter', '', $fields );
} else {
//list($Criteria,$xmlform) = $oCases->getConditionCasesList('gral');
$Criteria = $oCases->getAdvancedSearch( '', '', '', '', '', '', '', '', $permisse, $userlogged, $aSupervisor );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_advancedSearchFilter' );
}
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'cases/cases_advancedSearch', $Criteria );
G::RenderPage( 'publish', 'blank' );
?>
<script>
parent.outerLayout.hide('east');
parent.PANEL_EAST_OPEN = false;
</script>
<?php