Merge remote branch 'upstream/master' into BUG-5359
This commit is contained in:
@@ -8,379 +8,496 @@ error_reporting(E_ALL);
|
||||
ini_set('memory_limit', '128M');
|
||||
|
||||
if (!defined('SYS_LANG')) {
|
||||
define('SYS_LANG', 'en');
|
||||
define('SYS_LANG', 'en');
|
||||
}
|
||||
|
||||
if (!defined('PATH_HOME')) {
|
||||
if ( !defined('PATH_SEP') ) {
|
||||
define('PATH_SEP', ( substr(PHP_OS, 0, 3) == 'WIN' ) ? '\\' : '/');
|
||||
}
|
||||
$docuroot = explode(PATH_SEP, str_replace('engine' . PATH_SEP . 'methods' . PATH_SEP . 'services', '', dirname(__FILE__)));
|
||||
array_pop($docuroot);
|
||||
array_pop($docuroot);
|
||||
$pathhome = implode(PATH_SEP, $docuroot) . PATH_SEP;
|
||||
//try to find automatically the trunk directory where are placed the RBAC and Gulliver directories
|
||||
//in a normal installation you don't need to change it.
|
||||
array_pop($docuroot);
|
||||
$pathTrunk = implode(PATH_SEP, $docuroot) . PATH_SEP ;
|
||||
array_pop($docuroot);
|
||||
$pathOutTrunk = implode( PATH_SEP, $docuroot) . PATH_SEP ;
|
||||
// to do: check previous algorith for Windows $pathTrunk = "c:/home/";
|
||||
if (!defined('PATH_SEP')) {
|
||||
define('PATH_SEP', (substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/');
|
||||
}
|
||||
|
||||
define('PATH_HOME', $pathhome);
|
||||
define('PATH_TRUNK', $pathTrunk);
|
||||
define('PATH_OUTTRUNK', $pathOutTrunk);
|
||||
$pathServices = 'engine' . PATH_SEP . 'methods' . PATH_SEP . 'services';
|
||||
$docuroot = explode(PATH_SEP, str_replace($pathServices, '', dirname(__FILE__)));
|
||||
|
||||
require_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
|
||||
array_pop($docuroot);
|
||||
array_pop($docuroot);
|
||||
|
||||
G::LoadThirdParty('pear/json','class.json');
|
||||
G::LoadThirdParty('smarty/libs','Smarty.class');
|
||||
G::LoadSystem('error');
|
||||
G::LoadSystem('dbconnection');
|
||||
G::LoadSystem('dbsession');
|
||||
G::LoadSystem('dbrecordset');
|
||||
G::LoadSystem('dbtable');
|
||||
G::LoadSystem('rbac' );
|
||||
G::LoadSystem('publisher');
|
||||
G::LoadSystem('templatePower');
|
||||
G::LoadSystem('xmlDocument');
|
||||
G::LoadSystem('xmlform');
|
||||
G::LoadSystem('xmlformExtension');
|
||||
G::LoadSystem('form');
|
||||
G::LoadSystem('menu');
|
||||
G::LoadSystem("xmlMenu");
|
||||
G::LoadSystem('dvEditor');
|
||||
G::LoadSystem('table');
|
||||
G::LoadSystem('pagedTable');
|
||||
G::LoadClass ( 'system' );
|
||||
require_once ( "propel/Propel.php" );
|
||||
require_once ( "creole/Creole.php" );
|
||||
$pathHome = implode(PATH_SEP, $docuroot) . PATH_SEP;
|
||||
|
||||
//try to find automatically the trunk directory where are placed the RBAC and Gulliver directories
|
||||
//in a normal installation you don't need to change it.
|
||||
|
||||
array_pop($docuroot);
|
||||
|
||||
$pathTrunk = implode(PATH_SEP, $docuroot) . PATH_SEP;
|
||||
|
||||
array_pop($docuroot);
|
||||
|
||||
$pathOutTrunk = implode(PATH_SEP, $docuroot) . PATH_SEP;
|
||||
|
||||
//to do: check previous algorith for Windows $pathTrunk = "c:/home/";
|
||||
|
||||
define('PATH_HOME', $pathHome);
|
||||
define('PATH_TRUNK', $pathTrunk);
|
||||
define('PATH_OUTTRUNK', $pathOutTrunk);
|
||||
|
||||
require_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
|
||||
|
||||
G::LoadThirdParty('pear/json','class.json');
|
||||
G::LoadThirdParty('smarty/libs','Smarty.class');
|
||||
G::LoadSystem('error');
|
||||
G::LoadSystem('dbconnection');
|
||||
G::LoadSystem('dbsession');
|
||||
G::LoadSystem('dbrecordset');
|
||||
G::LoadSystem('dbtable');
|
||||
G::LoadSystem('rbac' );
|
||||
G::LoadSystem('publisher');
|
||||
G::LoadSystem('templatePower');
|
||||
G::LoadSystem('xmlDocument');
|
||||
G::LoadSystem('xmlform');
|
||||
G::LoadSystem('xmlformExtension');
|
||||
G::LoadSystem('form');
|
||||
G::LoadSystem('menu');
|
||||
G::LoadSystem("xmlMenu");
|
||||
G::LoadSystem('dvEditor');
|
||||
G::LoadSystem('table');
|
||||
G::LoadSystem('pagedTable');
|
||||
G::LoadClass ( 'system' );
|
||||
require_once ( "propel/Propel.php" );
|
||||
require_once ( "creole/Creole.php" );
|
||||
}
|
||||
|
||||
require_once 'classes/model/AppDelegation.php';
|
||||
require_once 'classes/model/Event.php';
|
||||
require_once 'classes/model/AppEvent.php';
|
||||
require_once 'classes/model/CaseScheduler.php';
|
||||
//G::loadClass('pmScript');
|
||||
require_once ("classes/model/Configuration.php");
|
||||
require_once ("classes/model/AppCacheView.php");
|
||||
require_once ("classes/model/AppDelegation.php");
|
||||
require_once ("classes/model/Event.php");
|
||||
require_once ("classes/model/AppEvent.php");
|
||||
require_once ("classes/model/CaseScheduler.php");
|
||||
//G::loadClass("pmScript");
|
||||
|
||||
//default values
|
||||
//default values
|
||||
$bCronIsRunning = false;
|
||||
$sLastExecution = '';
|
||||
if ( file_exists(PATH_DATA . 'cron') ) {
|
||||
$aAux = unserialize( trim( @file_get_contents(PATH_DATA . 'cron')) );
|
||||
$bCronIsRunning = (boolean)$aAux['bCronIsRunning'];
|
||||
$sLastExecution = $aAux['sLastExecution'];
|
||||
}
|
||||
else {
|
||||
//if not exists the file, just create a new one with current date
|
||||
@file_put_contents(PATH_DATA . 'cron', serialize(array('bCronIsRunning' => '1', 'sLastExecution' => date('Y-m-d H:i:s'))));
|
||||
|
||||
if (file_exists(PATH_DATA . 'cron')) {
|
||||
$arrayAux = unserialize(trim(@file_get_contents(PATH_DATA . 'cron')));
|
||||
$bCronIsRunning = (boolean)($arrayAux['bCronIsRunning']);
|
||||
$sLastExecution = $arrayAux['sLastExecution'];
|
||||
} else {
|
||||
//if not exists the file, just create a new one with current date
|
||||
$arrayAux = array('bCronIsRunning' => '1', 'sLastExecution' => date('Y-m-d H:i:s'));
|
||||
|
||||
@file_put_contents(PATH_DATA . 'cron', serialize($arrayAux));
|
||||
}
|
||||
|
||||
if (!defined('SYS_SYS')) {
|
||||
$sObject = $argv[1];
|
||||
$sNow = $argv[2];
|
||||
$sFilter = '';
|
||||
|
||||
for($i=3; $i<count($argv); $i++){
|
||||
$sFilter .= ' '.$argv[$i];
|
||||
}
|
||||
$sObject = $argv[1];
|
||||
$sNow = $argv[2];
|
||||
$sFilter = '';
|
||||
|
||||
$oDirectory = dir(PATH_DB);
|
||||
|
||||
if (is_dir(PATH_DB . $sObject)) {
|
||||
saveLog ( 'main', 'action', "checking folder " . PATH_DB . $sObject );
|
||||
if (file_exists(PATH_DB . $sObject . PATH_SEP . 'db.php')) {
|
||||
|
||||
define('SYS_SYS', $sObject);
|
||||
|
||||
include_once(PATH_HOME.'engine'.PATH_SEP.'config'.PATH_SEP.'paths_installed.php');
|
||||
include_once(PATH_HOME.'engine'.PATH_SEP.'config'.PATH_SEP.'paths.php');
|
||||
|
||||
//***************** PM Paths DATA **************************
|
||||
define( 'PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/');
|
||||
define( 'PATH_DOCUMENT', PATH_DATA_SITE . 'files/' );
|
||||
define( 'PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/' );
|
||||
define( 'PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/' );
|
||||
define( 'PATH_DATA_REPORTS', PATH_DATA_SITE . 'reports/' );
|
||||
define( 'PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/' );
|
||||
define( 'PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles'.PATH_SEP);
|
||||
define( 'PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies'.PATH_SEP);
|
||||
|
||||
if(is_file(PATH_DATA_SITE.PATH_SEP.'.server_info')){
|
||||
$SERVER_INFO = file_get_contents(PATH_DATA_SITE.PATH_SEP.'.server_info');
|
||||
$SERVER_INFO = unserialize($SERVER_INFO);
|
||||
//print_r($SERVER_INFO);
|
||||
define( 'SERVER_NAME', $SERVER_INFO ['SERVER_NAME']);
|
||||
define( 'SERVER_PORT', $SERVER_INFO ['SERVER_PORT']);
|
||||
} else {
|
||||
eprintln("WARNING! No server info found!", 'red');
|
||||
}
|
||||
|
||||
$sContent = file_get_contents(PATH_DB . $sObject . PATH_SEP . 'db.php');
|
||||
|
||||
$sContent = str_replace('<?php', '', $sContent);
|
||||
$sContent = str_replace('<?', '', $sContent);
|
||||
$sContent = str_replace('?>', '', $sContent);
|
||||
$sContent = str_replace('define', '', $sContent);
|
||||
$sContent = str_replace("('", "$", $sContent);
|
||||
$sContent = str_replace("',", '=', $sContent);
|
||||
$sContent = str_replace(");", ';', $sContent);
|
||||
|
||||
eval($sContent);
|
||||
$dsn = $DB_ADAPTER . '://' . $DB_USER . ':' . $DB_PASS . '@' . $DB_HOST . '/' . $DB_NAME;
|
||||
$dsnRbac = $DB_ADAPTER . '://' . $DB_RBAC_USER . ':' . $DB_RBAC_PASS . '@' . $DB_RBAC_HOST . '/' . $DB_RBAC_NAME;
|
||||
$dsnRp = $DB_ADAPTER . '://' . $DB_REPORT_USER . ':' . $DB_REPORT_PASS . '@' . $DB_REPORT_HOST . '/' . $DB_REPORT_NAME;
|
||||
switch ($DB_ADAPTER) {
|
||||
case 'mysql':
|
||||
$dsn .= '?encoding=utf8';
|
||||
$dsnRbac .= '?encoding=utf8';
|
||||
break;
|
||||
case 'mssql':
|
||||
//$dsn .= '?sendStringAsUnicode=false';
|
||||
//$dsnRbac .= '?sendStringAsUnicode=false';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
$pro['datasources']['workflow']['connection'] = $dsn;
|
||||
$pro['datasources']['workflow']['adapter'] = $DB_ADAPTER;
|
||||
$pro['datasources']['rbac']['connection'] = $dsnRbac;
|
||||
$pro['datasources']['rbac']['adapter'] = $DB_ADAPTER;
|
||||
$pro['datasources']['rp']['connection'] = $dsnRp;
|
||||
$pro['datasources']['rp']['adapter'] = $DB_ADAPTER;
|
||||
//$pro['datasources']['dbarray']['connection'] = 'dbarray://user:pass@localhost/pm_os';
|
||||
//$pro['datasources']['dbarray']['adapter'] = 'dbarray';
|
||||
$oFile = fopen(PATH_CORE . 'config/_databases_.php', 'w');
|
||||
fwrite($oFile, '<?php global $pro;return $pro; ?>');
|
||||
fclose($oFile);
|
||||
Propel::init(PATH_CORE . 'config/_databases_.php');
|
||||
//Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection');
|
||||
|
||||
eprintln("Processing workspace: " . $sObject, 'green');
|
||||
try{
|
||||
processWorkspace();
|
||||
}catch(Exception $e){
|
||||
echo $e->getMessage();
|
||||
eprintln("Probelm in workspace: " . $sObject.' it was omitted.', 'red');
|
||||
}
|
||||
eprintln();
|
||||
for ($i = 3; $i < count($argv); $i++) {
|
||||
$sFilter .= ' ' . $argv[$i];
|
||||
}
|
||||
}
|
||||
unlink(PATH_CORE . 'config/_databases_.php');
|
||||
}
|
||||
else {
|
||||
processWorkspace();
|
||||
|
||||
$oDirectory = dir(PATH_DB);
|
||||
|
||||
if (is_dir(PATH_DB . $sObject)) {
|
||||
saveLog('main', 'action', "checking folder " . PATH_DB . $sObject);
|
||||
|
||||
if (file_exists(PATH_DB . $sObject . PATH_SEP . 'db.php')) {
|
||||
define('SYS_SYS', $sObject);
|
||||
|
||||
include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php');
|
||||
include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
|
||||
|
||||
//***************** PM Paths DATA **************************
|
||||
define('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/');
|
||||
define('PATH_DOCUMENT', PATH_DATA_SITE . 'files/');
|
||||
define('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/');
|
||||
define('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/');
|
||||
define('PATH_DATA_REPORTS', PATH_DATA_SITE . 'reports/');
|
||||
define('PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/');
|
||||
define('PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP);
|
||||
define('PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP);
|
||||
|
||||
if (is_file(PATH_DATA_SITE.PATH_SEP . '.server_info')) {
|
||||
$SERVER_INFO = file_get_contents(PATH_DATA_SITE.PATH_SEP.'.server_info');
|
||||
$SERVER_INFO = unserialize($SERVER_INFO);
|
||||
|
||||
define('SERVER_NAME', $SERVER_INFO ['SERVER_NAME']);
|
||||
define('SERVER_PORT', $SERVER_INFO ['SERVER_PORT']);
|
||||
} else {
|
||||
eprintln("WARNING! No server info found!", 'red');
|
||||
}
|
||||
|
||||
$sContent = file_get_contents(PATH_DB . $sObject . PATH_SEP . 'db.php');
|
||||
|
||||
$sContent = str_replace('<?php', '', $sContent);
|
||||
$sContent = str_replace('<?', '', $sContent);
|
||||
$sContent = str_replace('?>', '', $sContent);
|
||||
$sContent = str_replace('define', '', $sContent);
|
||||
$sContent = str_replace("('", "$", $sContent);
|
||||
$sContent = str_replace("',", '=', $sContent);
|
||||
$sContent = str_replace(");", ';', $sContent);
|
||||
|
||||
eval($sContent);
|
||||
|
||||
$dsn = $DB_ADAPTER . '://' . $DB_USER . ':' . $DB_PASS . '@' . $DB_HOST . '/' . $DB_NAME;
|
||||
|
||||
$dsnRbac = $DB_ADAPTER . '://' . $DB_RBAC_USER . ':' . $DB_RBAC_PASS . '@' . $DB_RBAC_HOST . '/';
|
||||
$dsnRbac = $dsnRbac . $DB_RBAC_NAME;
|
||||
|
||||
$dsnRp = $DB_ADAPTER . '://' . $DB_REPORT_USER . ':' . $DB_REPORT_PASS . '@' . $DB_REPORT_HOST . '/';
|
||||
$dsnRp = $dsnRp . $DB_REPORT_NAME;
|
||||
|
||||
switch ($DB_ADAPTER) {
|
||||
case 'mysql':
|
||||
$dsn .= '?encoding=utf8';
|
||||
$dsnRbac .= '?encoding=utf8';
|
||||
break;
|
||||
case 'mssql':
|
||||
//$dsn .= '?sendStringAsUnicode=false';
|
||||
//$dsnRbac .= '?sendStringAsUnicode=false';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
$pro['datasources']['workflow']['connection'] = $dsn;
|
||||
$pro['datasources']['workflow']['adapter'] = $DB_ADAPTER;
|
||||
$pro['datasources']['rbac']['connection'] = $dsnRbac;
|
||||
$pro['datasources']['rbac']['adapter'] = $DB_ADAPTER;
|
||||
$pro['datasources']['rp']['connection'] = $dsnRp;
|
||||
$pro['datasources']['rp']['adapter'] = $DB_ADAPTER;
|
||||
//$pro['datasources']['dbarray']['connection'] = 'dbarray://user:pass@localhost/pm_os';
|
||||
//$pro['datasources']['dbarray']['adapter'] = 'dbarray';
|
||||
|
||||
$oFile = fopen(PATH_CORE . 'config/_databases_.php', 'w');
|
||||
fwrite($oFile, '<?php global $pro;return $pro; ?>');
|
||||
fclose($oFile);
|
||||
|
||||
Propel::init(PATH_CORE . 'config/_databases_.php');
|
||||
//Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection');
|
||||
|
||||
eprintln("Processing workspace: " . $sObject, "green");
|
||||
|
||||
try {
|
||||
processWorkspace();
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
|
||||
eprintln("Probelm in workspace: " . $sObject . " it was omitted.", "red");
|
||||
}
|
||||
|
||||
eprintln();
|
||||
}
|
||||
}
|
||||
|
||||
unlink(PATH_CORE . 'config/_databases_.php');
|
||||
} else {
|
||||
processWorkspace();
|
||||
}
|
||||
|
||||
//finally update the file
|
||||
@file_put_contents(PATH_DATA . 'cron', serialize(array('bCronIsRunning' => '0', 'sLastExecution' => date('Y-m-d H:i:s'))));
|
||||
$arrayAux = array('bCronIsRunning' => '0', 'sLastExecution' => date('Y-m-d H:i:s'));
|
||||
@file_put_contents(PATH_DATA . 'cron', serialize($arrayAux));
|
||||
|
||||
function processWorkspace()
|
||||
{
|
||||
global $sLastExecution;
|
||||
|
||||
function processWorkspace() {
|
||||
global $sLastExecution;
|
||||
try {
|
||||
resendEmails();
|
||||
unpauseApplications();
|
||||
calculateDuration();
|
||||
executePlugins();
|
||||
executeEvents($sLastExecution);
|
||||
executeScheduledCases();
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
saveLog ("main", "error", "Error processing workspace : " . $oError->getMessage() . "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
function resendEmails() {
|
||||
global $sFilter;
|
||||
if($sFilter!='' && strpos($sFilter, 'emails') === false) return false;
|
||||
|
||||
setExecutionMessage("Resending emails");
|
||||
|
||||
try {
|
||||
G::LoadClass('spool');
|
||||
$oSpool = new spoolRun();
|
||||
$oSpool->resendEmails();
|
||||
saveLog('resendEmails', 'action', 'Resending Emails', "c");
|
||||
|
||||
$aSpoolWarnings = $oSpool->getWarnings();
|
||||
if( $aSpoolWarnings !== false ) {
|
||||
foreach($aSpoolWarnings as $sWarning){
|
||||
print('MAIL SPOOL WARNING: ' . $sWarning."\n");
|
||||
saveLog('resendEmails', 'warning', 'MAIL SPOOL WARNING: ' . $sWarning);
|
||||
}
|
||||
try {
|
||||
resendEmails();
|
||||
unpauseApplications();
|
||||
calculateDuration();
|
||||
executePlugins();
|
||||
executeEvents($sLastExecution);
|
||||
executeScheduledCases();
|
||||
executeUpdateAppTitle();
|
||||
} catch (Exception $oError) {
|
||||
saveLog("main", "error", "Error processing workspace : " . $oError->getMessage() . "\n");
|
||||
}
|
||||
setExecutionResultMessage('DONE');
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
setExecutionResultMessage('WITH ERRORS', 'error');
|
||||
eprintln(" '-".$oError->getMessage(), 'red');
|
||||
saveLog('resendEmails', 'error', 'Error Resending Emails: ' . $oError->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
function unpauseApplications() {
|
||||
global $sFilter;
|
||||
global $sNow;
|
||||
if($sFilter!='' && strpos($sFilter, 'unpause') === false) return false;
|
||||
setExecutionMessage("Unpausing applications");
|
||||
function resendEmails()
|
||||
{
|
||||
global $sFilter;
|
||||
|
||||
try {
|
||||
G::LoadClass('case');
|
||||
$oCases = new Cases();
|
||||
$oCases->ThrowUnpauseDaemon($sNow);
|
||||
setExecutionResultMessage('DONE');
|
||||
saveLog('unpauseApplications', 'action', 'Unpausing Applications');
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
setExecutionResultMessage('WITH ERRORS', 'error');
|
||||
eprintln(" '-".$oError->getMessage(), 'red');
|
||||
saveLog('unpauseApplications', 'error', 'Error Unpausing Applications: ' . $oError->getMessage());
|
||||
}
|
||||
}
|
||||
if ($sFilter != '' && strpos($sFilter, 'emails') === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function executePlugins(){
|
||||
global $sFilter;
|
||||
if($sFilter!='' && strpos($sFilter, 'plugins') === false) return false;
|
||||
setExecutionMessage("Resending emails");
|
||||
|
||||
$pathCronPlugins = PATH_CORE.'bin'.PATH_SEP.'plugins'.PATH_SEP;
|
||||
|
||||
//erik: verify if the plugin dir exists
|
||||
if (!is_dir($pathCronPlugins)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($handle = opendir( $pathCronPlugins )) {
|
||||
while ( false !== ($file = readdir($handle))) {
|
||||
if ( strpos($file, '.php',1) && is_file($pathCronPlugins . $file) ) {
|
||||
$filename = str_replace('.php' , '', $file) ;
|
||||
$className = $filename . 'ClassCron';
|
||||
try {
|
||||
G::LoadClass('spool');
|
||||
|
||||
include_once ( $pathCronPlugins . $file ); //$filename. ".php"
|
||||
$oPlugin = new $className();
|
||||
if (method_exists($oPlugin, 'executeCron')) {
|
||||
$oPlugin->executeCron();
|
||||
setExecutionMessage("Executing Plugins");
|
||||
setExecutionResultMessage('DONE');
|
||||
$oSpool = new spoolRun();
|
||||
$oSpool->resendEmails();
|
||||
|
||||
saveLog('resendEmails', 'action', 'Resending Emails', "c");
|
||||
|
||||
$aSpoolWarnings = $oSpool->getWarnings();
|
||||
|
||||
if ( $aSpoolWarnings !== false ) {
|
||||
foreach ($aSpoolWarnings as $sWarning) {
|
||||
print('MAIL SPOOL WARNING: ' . $sWarning."\n");
|
||||
saveLog('resendEmails', 'warning', 'MAIL SPOOL WARNING: ' . $sWarning);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setExecutionResultMessage('DONE');
|
||||
} catch (Exception $oError) {
|
||||
setExecutionResultMessage('WITH ERRORS', 'error');
|
||||
eprintln(" '-".$oError->getMessage(), 'red');
|
||||
saveLog('resendEmails', 'error', 'Error Resending Emails: ' . $oError->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
function calculateDuration() {
|
||||
global $sFilter;
|
||||
if($sFilter!='' && strpos($sFilter, 'calculate') === false) return false;
|
||||
setExecutionMessage("Calculating Duration");
|
||||
|
||||
try {
|
||||
$oAppDelegation = new AppDelegation();
|
||||
$oAppDelegation->calculateDuration();
|
||||
setExecutionResultMessage('DONE');
|
||||
saveLog('calculateDuration', 'action', 'Calculating Duration');
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
setExecutionResultMessage('WITH ERRORS', 'error');
|
||||
eprintln(" '-".$oError->getMessage(), 'red');
|
||||
saveLog('calculateDuration', 'error', 'Error Calculating Duration: ' . $oError->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
function executeEvents($sLastExecution, $sNow=null) {
|
||||
|
||||
global $sFilter;
|
||||
global $sNow;
|
||||
$log = array();
|
||||
|
||||
if($sFilter!='' && strpos($sFilter, 'events') === false) return false;
|
||||
|
||||
setExecutionMessage("Executing events");
|
||||
setExecutionResultMessage('PROCESSING');
|
||||
try {
|
||||
$oAppEvent = new AppEvent();
|
||||
saveLog('executeEvents', 'action', "Executing Events $sLastExecution, $sNow ");
|
||||
$n = $oAppEvent->executeEvents($sNow, false, $log);
|
||||
foreach ($log as $value) {
|
||||
saveLog('executeEvents', 'action', "Execute Events : $value, $sNow ");
|
||||
}
|
||||
setExecutionMessage("|- End Execution events");
|
||||
setExecutionResultMessage("Processed $n");
|
||||
//saveLog('executeEvents', 'action', $res );
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
setExecutionResultMessage('WITH ERRORS', 'error');
|
||||
eprintln(" '-".$oError->getMessage(), 'red');
|
||||
saveLog('calculateAlertsDueDate', 'Error', 'Error Executing Events: ' . $oError->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
function executeScheduledCases($sNow=null){
|
||||
try{
|
||||
function unpauseApplications()
|
||||
{
|
||||
global $sFilter;
|
||||
global $sNow;
|
||||
$log = array();
|
||||
|
||||
if($sFilter!='' && strpos($sFilter, 'scheduler') === false) return false;
|
||||
|
||||
setExecutionMessage("Executing the scheduled starting cases");
|
||||
if ($sFilter != '' && strpos($sFilter, 'unpause') === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
setExecutionMessage("Unpausing applications");
|
||||
|
||||
try {
|
||||
G::LoadClass('case');
|
||||
|
||||
$oCases = new Cases();
|
||||
$oCases->ThrowUnpauseDaemon($sNow);
|
||||
|
||||
setExecutionResultMessage('DONE');
|
||||
saveLog('unpauseApplications', 'action', 'Unpausing Applications');
|
||||
} catch (Exception $oError) {
|
||||
setExecutionResultMessage('WITH ERRORS', 'error');
|
||||
eprintln(" '-".$oError->getMessage(), 'red');
|
||||
saveLog('unpauseApplications', 'error', 'Error Unpausing Applications: ' . $oError->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
function executePlugins()
|
||||
{
|
||||
global $sFilter;
|
||||
|
||||
if ($sFilter!='' && strpos($sFilter, 'plugins') === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$pathCronPlugins = PATH_CORE.'bin'.PATH_SEP.'plugins'.PATH_SEP;
|
||||
|
||||
//erik: verify if the plugin dir exists
|
||||
if (!is_dir($pathCronPlugins)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($handle = opendir($pathCronPlugins)) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if (strpos($file, '.php',1) && is_file($pathCronPlugins . $file)) {
|
||||
$filename = str_replace('.php' , '', $file);
|
||||
$className = $filename . 'ClassCron';
|
||||
|
||||
include_once ( $pathCronPlugins . $file ); //$filename. ".php"
|
||||
|
||||
$oPlugin = new $className();
|
||||
|
||||
if (method_exists($oPlugin, 'executeCron')) {
|
||||
$oPlugin->executeCron();
|
||||
setExecutionMessage("Executing Plugins");
|
||||
setExecutionResultMessage('DONE');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function calculateDuration()
|
||||
{
|
||||
global $sFilter;
|
||||
|
||||
if ($sFilter != '' && strpos($sFilter, 'calculate') === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
setExecutionMessage("Calculating Duration");
|
||||
|
||||
try {
|
||||
$oAppDelegation = new AppDelegation();
|
||||
$oAppDelegation->calculateDuration();
|
||||
|
||||
setExecutionResultMessage('DONE');
|
||||
saveLog('calculateDuration', 'action', 'Calculating Duration');
|
||||
} catch (Exception $oError) {
|
||||
setExecutionResultMessage('WITH ERRORS', 'error');
|
||||
eprintln(" '-".$oError->getMessage(), 'red');
|
||||
saveLog('calculateDuration', 'error', 'Error Calculating Duration: ' . $oError->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
function executeEvents($sLastExecution, $sNow=null)
|
||||
{
|
||||
global $sFilter;
|
||||
global $sNow;
|
||||
|
||||
$log = array();
|
||||
|
||||
if ($sFilter != '' && strpos($sFilter, 'events') === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
setExecutionMessage("Executing events");
|
||||
setExecutionResultMessage('PROCESSING');
|
||||
|
||||
$sNow = isset($sNow)? $sNow: date('Y-m-d H:i:s');
|
||||
$oCaseScheduler = new CaseScheduler;
|
||||
|
||||
$oCaseScheduler->caseSchedulerCron($sNow, $log);
|
||||
|
||||
foreach ($log as $value) {
|
||||
saveLog('executeScheduledCases', 'action', "OK Case# $value");
|
||||
try {
|
||||
$oAppEvent = new AppEvent();
|
||||
saveLog('executeEvents', 'action', "Executing Events $sLastExecution, $sNow ");
|
||||
$n = $oAppEvent->executeEvents($sNow, false, $log);
|
||||
|
||||
foreach ($log as $value) {
|
||||
saveLog('executeEvents', 'action', "Execute Events : $value, $sNow ");
|
||||
}
|
||||
|
||||
setExecutionMessage("|- End Execution events");
|
||||
setExecutionResultMessage("Processed $n");
|
||||
//saveLog('executeEvents', 'action', $res );
|
||||
} catch (Exception $oError) {
|
||||
setExecutionResultMessage('WITH ERRORS', 'error');
|
||||
eprintln(" '-".$oError->getMessage(), 'red');
|
||||
saveLog('calculateAlertsDueDate', 'Error', 'Error Executing Events: ' . $oError->getMessage());
|
||||
}
|
||||
setExecutionResultMessage('DONE');
|
||||
} catch(Exception $oError){
|
||||
setExecutionResultMessage('WITH ERRORS', 'error');
|
||||
eprintln(" '-".$oError->getMessage(), 'red');
|
||||
}
|
||||
}
|
||||
|
||||
function saveLog($sSource, $sType, $sDescription) {
|
||||
try {
|
||||
global $isDebug;
|
||||
if ( $isDebug )
|
||||
print date('H:i:s') ." ($sSource) $sType $sDescription <br>\n";
|
||||
@fwrite($oFile, date('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n");
|
||||
|
||||
G::verifyPath(PATH_DATA . 'log' . PATH_SEP, true);
|
||||
if ($sType == 'action') {
|
||||
$oFile = @fopen(PATH_DATA . 'log' . PATH_SEP . 'cron.log', 'a+');
|
||||
function executeScheduledCases($sNow=null)
|
||||
{
|
||||
try {
|
||||
global $sFilter;
|
||||
global $sNow;
|
||||
|
||||
$log = array();
|
||||
|
||||
if ($sFilter != '' && strpos($sFilter, 'scheduler') === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
setExecutionMessage("Executing the scheduled starting cases");
|
||||
setExecutionResultMessage('PROCESSING');
|
||||
|
||||
$sNow = isset($sNow)? $sNow : date('Y-m-d H:i:s');
|
||||
|
||||
$oCaseScheduler = new CaseScheduler();
|
||||
$oCaseScheduler->caseSchedulerCron($sNow, $log);
|
||||
|
||||
foreach ($log as $value) {
|
||||
saveLog('executeScheduledCases', 'action', "OK Case# $value");
|
||||
}
|
||||
|
||||
setExecutionResultMessage('DONE');
|
||||
} catch (Exception $oError) {
|
||||
setExecutionResultMessage('WITH ERRORS', 'error');
|
||||
eprintln(" '-".$oError->getMessage(), 'red');
|
||||
}
|
||||
else {
|
||||
$oFile = @fopen(PATH_DATA . 'log' . PATH_SEP . 'cronError.log', 'a+');
|
||||
}
|
||||
|
||||
function executeUpdateAppTitle()
|
||||
{
|
||||
try {
|
||||
$criteriaConf = new Criteria("workflow");
|
||||
|
||||
$criteriaConf->addSelectColumn(ConfigurationPeer::OBJ_UID);
|
||||
$criteriaConf->addSelectColumn(ConfigurationPeer::CFG_VALUE);
|
||||
$criteriaConf->add(ConfigurationPeer::CFG_UID, "TAS_APP_TITLE_UPDATE");
|
||||
|
||||
$rsCriteriaConf = ConfigurationPeer::doSelectRS($criteriaConf);
|
||||
$rsCriteriaConf->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
setExecutionMessage("Update case labels");
|
||||
saveLog("updateCaseLabels", "action", "Update case labels", "c");
|
||||
|
||||
while ($rsCriteriaConf->next()) {
|
||||
$row = $rsCriteriaConf->getRow();
|
||||
|
||||
$taskUid = $row["OBJ_UID"];
|
||||
$lang = $row["CFG_VALUE"];
|
||||
|
||||
//Update case labels
|
||||
$appcv = new AppCacheView();
|
||||
$appcv->appTitleByTaskCaseLabelUpdate($taskUid, $lang);
|
||||
|
||||
//Delete record
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$criteria->add(ConfigurationPeer::CFG_UID, "TAS_APP_TITLE_UPDATE");
|
||||
$criteria->add(ConfigurationPeer::OBJ_UID, $taskUid);
|
||||
$criteria->add(ConfigurationPeer::CFG_VALUE, $lang);
|
||||
|
||||
$numRowDeleted = ConfigurationPeer::doDelete($criteria);
|
||||
|
||||
saveLog("updateCaseLabels", "action", "OK Task $taskUid");
|
||||
}
|
||||
|
||||
setExecutionResultMessage("DONE");
|
||||
} catch (Exception $e) {
|
||||
setExecutionResultMessage("WITH ERRORS", "error");
|
||||
eprintln(" '-" . $e->getMessage(), "red");
|
||||
saveLog("updateCaseLabels", "error", "Error updating case labels: " . $e->getMessage());
|
||||
}
|
||||
@fwrite($oFile, date('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n");
|
||||
@fclose($oFile);
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
//CONTINUE
|
||||
}
|
||||
}
|
||||
|
||||
function saveLog($sSource, $sType, $sDescription)
|
||||
{
|
||||
try {
|
||||
global $isDebug;
|
||||
|
||||
function setExecutionMessage($m){
|
||||
$len = strlen($m);
|
||||
$linesize = 60;
|
||||
$rOffset = $linesize - $len;
|
||||
if ($isDebug) {
|
||||
print date('H:i:s') ." ($sSource) $sType $sDescription <br />\n";
|
||||
}
|
||||
|
||||
eprint("* $m");
|
||||
for($i=0; $i<$rOffset; $i++) eprint('.');
|
||||
@fwrite($oFile, date('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n");
|
||||
|
||||
G::verifyPath(PATH_DATA . 'log' . PATH_SEP, true);
|
||||
|
||||
if ($sType == 'action') {
|
||||
$oFile = @fopen(PATH_DATA . 'log' . PATH_SEP . 'cron.log', 'a+');
|
||||
} else {
|
||||
$oFile = @fopen(PATH_DATA . 'log' . PATH_SEP . 'cronError.log', 'a+');
|
||||
}
|
||||
|
||||
@fwrite($oFile, date('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n");
|
||||
@fclose($oFile);
|
||||
} catch (Exception $oError) {
|
||||
//CONTINUE
|
||||
}
|
||||
}
|
||||
|
||||
function setExecutionResultMessage($m, $t=''){
|
||||
$c='green';
|
||||
if($t=='error') $c = 'red';
|
||||
if($t=='info') $c = 'yellow';
|
||||
eprintln("[$m]", $c);
|
||||
function setExecutionMessage($m)
|
||||
{
|
||||
$len = strlen($m);
|
||||
$linesize = 60;
|
||||
$rOffset = $linesize - $len;
|
||||
|
||||
eprint("* $m");
|
||||
|
||||
for ($i = 0; $i < $rOffset; $i++) {
|
||||
eprint('.');
|
||||
}
|
||||
}
|
||||
|
||||
function setExecutionResultMessage($m, $t='')
|
||||
{
|
||||
$c = 'green';
|
||||
|
||||
if ($t == 'error') {
|
||||
$c = 'red';
|
||||
}
|
||||
|
||||
if ($t == 'info') {
|
||||
$c = 'yellow';
|
||||
}
|
||||
|
||||
|
||||
|
||||
eprintln("[$m]", $c);
|
||||
}
|
||||
|
||||
|
||||
@@ -465,7 +465,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
|
||||
$script = null;
|
||||
$fileTmp = G::decrypt($A , URL_KEY);
|
||||
$form = new Form($fileTmp, PATH_DYNAFORM, SYS_LANG, true);
|
||||
|
||||
|
||||
//Navigation Bar
|
||||
$form->fields = G::array_merges(
|
||||
array("__DYNAFORM_OPTIONS" => new XmlForm_Field_XmlMenu(
|
||||
@@ -486,14 +486,14 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
|
||||
//Loads the stored HTML or the default Template if
|
||||
//it doesn't exist.
|
||||
$filename = substr($form->fileName, 0, -3) . ($form->type === "xmlform" ? "" : "." . $form->type) . "html";
|
||||
|
||||
|
||||
if (!file_exists($filename)) {
|
||||
$html = $form->printTemplate($form->template, $script);
|
||||
}
|
||||
else {
|
||||
$html = implode("", file($filename));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* It adds the new fields automatically at the bottom of the form.
|
||||
* TODO: <20>TOP OR BOTTOM?
|
||||
@@ -527,7 +527,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
|
||||
self::_setTmpData($tmp);
|
||||
//$html=str_replace('{$form_className}','formDefault', $html );
|
||||
$html=str_replace('{$form_className}','formDefault', $aAux[0] . '</form>' );
|
||||
|
||||
|
||||
return $html;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
@@ -544,7 +544,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
|
||||
$script = null;
|
||||
$fileTmp = G::decrypt($A, URL_KEY);
|
||||
$form = new Form($fileTmp, PATH_DYNAFORM, SYS_LANG, true);
|
||||
|
||||
|
||||
//Navigation Bar
|
||||
$form->fields = G::array_merges(
|
||||
array("__DYNAFORM_OPTIONS" => new XmlForm_Field_XmlMenu(
|
||||
@@ -561,7 +561,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
|
||||
),
|
||||
$form->fields
|
||||
);
|
||||
|
||||
|
||||
$form->enableTemplate = false;
|
||||
$html = $form->printTemplate( $form->template , $script );
|
||||
$html = str_replace('{$form_className}','formDefault', $html );
|
||||
@@ -571,7 +571,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
|
||||
$fp=fopen(PATH_DYNAFORM . $fileTmp . '.html','w');
|
||||
fwrite($fp, $html);
|
||||
fclose($fp);
|
||||
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
@@ -665,12 +665,12 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
|
||||
* @param string $sCode
|
||||
* @return array
|
||||
*/
|
||||
function set_javascript($A,$fieldName,$sCode,$meta)
|
||||
function set_javascript($A,$fieldName,$sCode,$meta='')
|
||||
{
|
||||
if ($fieldName == '___pm_boot_strap___') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
$sCode = urldecode($sCode) ;
|
||||
try {
|
||||
$sCode = rtrim($sCode);
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
// License: LGPL, see LICENSE
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
if (!class_exists('PMScript')) {
|
||||
G::LoadClass('pmScript');
|
||||
}
|
||||
|
||||
/**
|
||||
* ProcessMaker has made a number of its PHP functions available be used in triggers and conditions.
|
||||
@@ -2091,4 +2094,4 @@ function PMFGetCaseNotes ($applicationID, $type='array', $userUid='')
|
||||
$response = Cases::getCaseNotes($applicationID, $type, $userUid);
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -76,7 +76,7 @@ var saveDataTaskTemporal = function(iForm)
|
||||
oTaskData.TAS_TYPE_DAY = getField('TAS_TYPE_DAY').value;
|
||||
oTaskData.TAS_CALENDAR = getField('TAS_CALENDAR').value;
|
||||
oTaskData.TAS_TRANSFER_FLY = (getField('TAS_TRANSFER_FLY').checked ? 'TRUE' : 'FALSE');
|
||||
|
||||
|
||||
var fieldEval = new input(getField('TAS_DURATION'));
|
||||
if (getField('TAS_DURATION').value.trim() == '') {
|
||||
fieldEval.failed();
|
||||
@@ -178,45 +178,73 @@ var saveDataTaskTemporal = function(iForm)
|
||||
var saveTaskData = function(oForm, iForm, iType)
|
||||
{
|
||||
iLastTab = iForm;
|
||||
if ( !saveDataTaskTemporal(iForm)) {
|
||||
|
||||
if (!saveDataTaskTemporal(iForm)) {
|
||||
return false;
|
||||
}
|
||||
oTaskData.TAS_UID = getField('TAS_UID').value;
|
||||
/* while (oTaskData.TAS_TITLE.charAt(0)==' '){
|
||||
oTaskData.TAS_TITLE = oTaskData.TAS_TITLE.substring(1,oTaskData.TAS_TITLE.length) ;
|
||||
} */
|
||||
oTaskData.TAS_TITLE=oTaskData.TAS_TITLE.trim();
|
||||
if(oTaskData.TAS_TITLE==''){
|
||||
alert(G_STRINGS.ID_REQ_TITLE );
|
||||
return false;
|
||||
}
|
||||
|
||||
var sParameters = 'function=saveTaskData';
|
||||
oTaskData.TAS_UID = getField("TAS_UID").value;
|
||||
|
||||
/*
|
||||
while (oTaskData.TAS_TITLE.charAt(0)==" "){
|
||||
oTaskData.TAS_TITLE = oTaskData.TAS_TITLE.substring(1,oTaskData.TAS_TITLE.length) ;
|
||||
}
|
||||
*/
|
||||
|
||||
oTaskData.TAS_TITLE = oTaskData.TAS_TITLE.trim();
|
||||
|
||||
if (oTaskData.TAS_TITLE == "") {
|
||||
alert(G_STRINGS.ID_REQ_TITLE );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//Set AJAX
|
||||
var sParameters = "function=saveTaskData";
|
||||
|
||||
var oRPC = new leimnud.module.rpc.xmlhttp({
|
||||
url : '../tasks/tasks_Ajax',
|
||||
async : false,
|
||||
method: 'POST',
|
||||
args : sParameters + '&oData=' + oTaskData.toJSONString()
|
||||
url: "../tasks/tasks_Ajax",
|
||||
method: "POST",
|
||||
args: sParameters + "&oData=" + oTaskData.toJSONString()
|
||||
});
|
||||
|
||||
oRPC.callback = function (rpc) {
|
||||
var res = rpc.xmlhttp.responseText.parseJSON();
|
||||
|
||||
if (oTaskData.TAS_TITLE) {
|
||||
Pm.data.db.task[getField("INDEX").value].label = Pm.data.db.task[getField("INDEX").value].object.elements.label.innerHTML = oTaskData.TAS_TITLE.replace(re2, "&");
|
||||
}
|
||||
|
||||
if (oTaskData.TAS_START) {
|
||||
oTaskData.TAS_START = ((oTaskData.TAS_START == "TRUE")? true : false);
|
||||
Pm.data.render.setTaskINI({task: oTaskData.TAS_UID, value: oTaskData.TAS_START});
|
||||
}
|
||||
|
||||
try {
|
||||
var option = {
|
||||
label: changesSavedLabel
|
||||
}
|
||||
|
||||
switch (res.status) {
|
||||
case "CRONCL":
|
||||
option = {
|
||||
label: changesSavedLabel + "<br /><br />" + _("APP_TITLE_CASE_LABEL_UPDATE"),
|
||||
width: 350,
|
||||
height: 175
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
new leimnud.module.app.info().make(option);
|
||||
}
|
||||
catch (e) {
|
||||
//No show confirmation
|
||||
}
|
||||
|
||||
Pm.tmp.propertiesPanel.remove();
|
||||
}.extend(this);
|
||||
|
||||
oRPC.make();
|
||||
if (oTaskData.TAS_TITLE)
|
||||
{
|
||||
Pm.data.db.task[getField('INDEX').value].label = Pm.data.db.task[getField('INDEX').value].object.elements.label.innerHTML = oTaskData.TAS_TITLE.replace(re2, "&");
|
||||
}
|
||||
if (oTaskData.TAS_START)
|
||||
{
|
||||
oTaskData.TAS_START = (oTaskData.TAS_START == 'TRUE' ? true : false);
|
||||
Pm.data.render.setTaskINI({task: oTaskData.TAS_UID, value: oTaskData.TAS_START});
|
||||
}
|
||||
try {
|
||||
new leimnud.module.app.info().make( {
|
||||
label: changesSavedLabel
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
// No show confirmation
|
||||
}
|
||||
Pm.tmp.propertiesPanel.remove();
|
||||
};
|
||||
|
||||
var showTriggers = function(sStep, sType)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,87 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* tasks_Ajax.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.
|
||||
*
|
||||
*/
|
||||
try {
|
||||
global $RBAC;
|
||||
switch ($RBAC->userCanAccess('PM_FACTORY')) {
|
||||
case -2:
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
break;
|
||||
case -1:
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
break;
|
||||
}
|
||||
global $RBAC;
|
||||
|
||||
$oJSON = new Services_JSON();
|
||||
$aData = get_object_vars($oJSON->decode($_POST['oData']));
|
||||
if(isset($_POST['function']))
|
||||
$sAction = $_POST['function'];
|
||||
else
|
||||
$sAction = $_POST['functions'];
|
||||
switch ($RBAC->userCanAccess('PM_FACTORY')) {
|
||||
case -2:
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
break;
|
||||
case -1:
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
break;
|
||||
}
|
||||
|
||||
switch ($sAction) {
|
||||
case 'saveTaskData':
|
||||
require_once 'classes/model/Task.php';
|
||||
$oTask = new Task();
|
||||
|
||||
/**
|
||||
* routine to replace @amp@ by &
|
||||
* that why the char "&" can't be passed by XmlHttpRequest directly
|
||||
* @autor erik <erik@colosa.com>
|
||||
*/
|
||||
foreach($aData as $k=>$v) {
|
||||
$aData[$k] = str_replace('@amp@', '&', $v);
|
||||
}
|
||||
|
||||
if (isset($aData['SEND_EMAIL'])) {
|
||||
$aData['TAS_SEND_LAST_EMAIL'] = $aData['SEND_EMAIL'] == 'TRUE' ? 'TRUE' : 'FALSE';
|
||||
} else {
|
||||
$aData['TAS_SEND_LAST_EMAIL'] = 'FALSE';
|
||||
}
|
||||
|
||||
// Additional configuration
|
||||
if (isset($aData['TAS_DEF_MESSAGE_TYPE']) && isset($aData['TAS_DEF_MESSAGE_TEMPLATE'])) {
|
||||
G::loadClass('configuration');
|
||||
$oConf = new Configurations;
|
||||
$oConf->aConfig = Array(
|
||||
'TAS_DEF_MESSAGE_TYPE' => $aData['TAS_DEF_MESSAGE_TYPE'],
|
||||
'TAS_DEF_MESSAGE_TEMPLATE'=> $aData['TAS_DEF_MESSAGE_TEMPLATE']
|
||||
);
|
||||
$oConf->saveConfig('TAS_EXTRA_PROPERTIES', $aData['TAS_UID'], '', '');
|
||||
unset($aData['TAS_DEF_MESSAGE_TYPE']);
|
||||
unset($aData['TAS_DEF_MESSAGE_TEMPLATE']);
|
||||
}
|
||||
$oJSON = new Services_JSON();
|
||||
$aData = get_object_vars($oJSON->decode($_POST['oData']));
|
||||
|
||||
$oTask->update($aData);
|
||||
break;
|
||||
}
|
||||
if (isset($_POST['function'])) {
|
||||
$sAction = $_POST['function'];
|
||||
} else {
|
||||
$sAction = $_POST['functions'];
|
||||
}
|
||||
|
||||
switch ($sAction) {
|
||||
case "saveTaskData":
|
||||
require_once ("classes/model/Task.php");
|
||||
|
||||
$response = array();
|
||||
|
||||
$oTask = new Task();
|
||||
|
||||
/**
|
||||
* routine to replace @amp@ by &
|
||||
* that why the char "&" can't be passed by XmlHttpRequest directly
|
||||
* @autor erik <erik@colosa.com>
|
||||
*/
|
||||
|
||||
foreach ($aData as $k => $v) {
|
||||
$aData[$k] = str_replace('@amp@', '&', $v);
|
||||
}
|
||||
|
||||
if (isset($aData['SEND_EMAIL'])) {
|
||||
$aData['TAS_SEND_LAST_EMAIL'] = $aData['SEND_EMAIL'] == 'TRUE' ? 'TRUE' : 'FALSE';
|
||||
} else {
|
||||
$aData['TAS_SEND_LAST_EMAIL'] = 'FALSE';
|
||||
}
|
||||
|
||||
//Additional configuration
|
||||
if (isset($aData['TAS_DEF_MESSAGE_TYPE']) && isset($aData['TAS_DEF_MESSAGE_TEMPLATE'])) {
|
||||
G::LoadClass('configuration');
|
||||
|
||||
$oConf = new Configurations();
|
||||
$oConf->aConfig = array(
|
||||
'TAS_DEF_MESSAGE_TYPE' => $aData['TAS_DEF_MESSAGE_TYPE'],
|
||||
'TAS_DEF_MESSAGE_TEMPLATE' => $aData['TAS_DEF_MESSAGE_TEMPLATE']
|
||||
);
|
||||
|
||||
$oConf->saveConfig('TAS_EXTRA_PROPERTIES', $aData['TAS_UID'], '', '');
|
||||
|
||||
unset($aData['TAS_DEF_MESSAGE_TYPE']);
|
||||
unset($aData['TAS_DEF_MESSAGE_TEMPLATE']);
|
||||
}
|
||||
|
||||
$result = $oTask->update($aData);
|
||||
|
||||
$response["status"] = "OK";
|
||||
|
||||
if ($result == 3) {
|
||||
$response["status"] = "CRONCL";
|
||||
}
|
||||
|
||||
echo G::json_encode($response);
|
||||
break;
|
||||
}
|
||||
} catch (Exception $oException) {
|
||||
die($oException->getMessage());
|
||||
}
|
||||
catch (Exception $oException) {
|
||||
die($oException->getMessage());
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* usersGroups.php
|
||||
*
|
||||
@@ -22,33 +23,34 @@
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*/
|
||||
if (($RBAC_Response=$RBAC->userCanAccess("PM_LOGIN"))!=1) return $RBAC_Response;
|
||||
if (($RBAC_Response = $RBAC->userCanAccess("PM_LOGIN")) != 1) {
|
||||
return $RBAC_Response;
|
||||
}
|
||||
global $RBAC;
|
||||
|
||||
$access = $RBAC->userCanAccess('PM_USERS');
|
||||
if( $access != 1 ){
|
||||
switch ($access)
|
||||
{
|
||||
case -1:
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
break;
|
||||
case -2:
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
break;
|
||||
default:
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
break;
|
||||
}
|
||||
if ($access != 1) {
|
||||
switch ($access) {
|
||||
case -1:
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
break;
|
||||
case -2:
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
break;
|
||||
default:
|
||||
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
|
||||
G::header('location: ../login/login');
|
||||
die;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
$G_SUB_MENU = 'users';
|
||||
$G_ID_MENU_SELECTED = 'USERS';
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
$G_SUB_MENU = 'users';
|
||||
$G_ID_MENU_SELECTED = 'USERS';
|
||||
$G_ID_SUB_MENU_SELECTED = 'USERS';
|
||||
|
||||
$G_PUBLISH = new Publisher;
|
||||
@@ -69,10 +71,16 @@ $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
switch($_REQUEST['type']){
|
||||
case 'summary': $ctab = 0; break;
|
||||
case 'group': $ctab = 1; break;
|
||||
case 'auth': $ctab = 2; break;
|
||||
switch ($_REQUEST['type']) {
|
||||
case 'summary':
|
||||
$ctab = 0;
|
||||
break;
|
||||
case 'group':
|
||||
$ctab = 1;
|
||||
break;
|
||||
case 'auth':
|
||||
$ctab = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
$users = Array();
|
||||
@@ -83,11 +91,12 @@ $users['USR_USERNAME'] = $aRow['USR_USERNAME'];
|
||||
$users['fullNameFormat'] = $Config['fullNameFormat'];
|
||||
$users['CURRENT_TAB'] = $ctab;
|
||||
|
||||
$oHeadPublisher =& headPublisher::getSingleton();
|
||||
$oHeadPublisher = & headPublisher::getSingleton();
|
||||
$oHeadPublisher->addExtJsScript('users/usersGroups', false); //adding a javascript file .js
|
||||
// $oHeadPublisher->addContent('users/usersGroups'); //adding a html file .html.
|
||||
$oHeadPublisher->assign('USERS', $users);
|
||||
|
||||
$oHeadPublisher->assign('hasAuthPerm', ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1));
|
||||
$oHeadPublisher->assign('hasAuthPerm', ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1));
|
||||
|
||||
G::RenderPage('publish', 'extJs');
|
||||
G::RenderPage('publish', 'extJs');
|
||||
|
||||
@@ -10,6 +10,7 @@ var infoMode;
|
||||
var global = {};
|
||||
var readMode;
|
||||
var usernameText;
|
||||
var previousUsername = '';
|
||||
var canEdit = true;
|
||||
var flagPoliciesPassword = false;
|
||||
var flagValidateUsername = false;
|
||||
@@ -21,23 +22,23 @@ global.aux = '';
|
||||
Ext.onReady(function() {
|
||||
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
|
||||
Ext.QuickTips.init();
|
||||
|
||||
|
||||
box = new Ext.BoxComponent({
|
||||
width : 100,
|
||||
height : 80,
|
||||
fieldLabel : ' ',
|
||||
labelSeparator : ' ',
|
||||
autoEl : {
|
||||
tag : 'img',
|
||||
tag : 'img',
|
||||
src : 'users_ViewPhotoGrid?h=' + Math.random() +'&pUID=' + USR_UID + '',
|
||||
align : 'left'
|
||||
align : 'left'
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
if (MODE == 'edit')
|
||||
|
||||
if (MODE == 'edit' || MODE == '')
|
||||
flagPoliciesPassword = true;
|
||||
|
||||
|
||||
//EDIT MODE
|
||||
if (USR_UID != '') {
|
||||
allowBlackStatus = true;
|
||||
@@ -52,16 +53,16 @@ Ext.onReady(function() {
|
||||
readMode = true;
|
||||
box.setVisible(false);
|
||||
box.disable();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
displayPreferences = 'display:none;';
|
||||
loadUserData();
|
||||
readMode = false;
|
||||
canEdit = false;
|
||||
}
|
||||
|
||||
canEdit = false;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
allowBlackStatus=false;
|
||||
@@ -74,7 +75,7 @@ Ext.onReady(function() {
|
||||
|
||||
|
||||
profileFields = new Ext.form.FieldSet({
|
||||
title : _('ID_PROFILE'),
|
||||
title : _('ID_PROFILE'),
|
||||
items : [
|
||||
box,
|
||||
{
|
||||
@@ -90,12 +91,12 @@ Ext.onReady(function() {
|
||||
}
|
||||
|
||||
},{
|
||||
xtype : 'label',
|
||||
xtype : 'label',
|
||||
id : 'lblMaxFileSize',
|
||||
fieldLabel : _('ID_MAX_FILE_SIZE'),
|
||||
text : MAX_FILES_SIZE,
|
||||
width : 400
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
,{
|
||||
@@ -112,7 +113,7 @@ Ext.onReady(function() {
|
||||
}
|
||||
*/
|
||||
|
||||
]
|
||||
]
|
||||
});
|
||||
storeCountry = new Ext.data.Store( {
|
||||
proxy : new Ext.data.HttpProxy( {
|
||||
@@ -143,11 +144,11 @@ Ext.onReady(function() {
|
||||
mode : 'local',
|
||||
listeners : {
|
||||
select : function(combo,record,index){
|
||||
global.IC_UID = this.getValue();
|
||||
global.IC_UID = this.getValue();
|
||||
comboRegion.store.removeAll();
|
||||
comboLocation.store.removeAll();
|
||||
comboRegion.clearValue();
|
||||
storeRegion.load({
|
||||
comboRegion.clearValue();
|
||||
storeRegion.load({
|
||||
params : {
|
||||
action : 'stateList',
|
||||
IC_UID : global.IC_UID
|
||||
@@ -163,7 +164,7 @@ Ext.onReady(function() {
|
||||
storeCountry.load({
|
||||
params : {"action" : "countryList"}
|
||||
});
|
||||
|
||||
|
||||
storeRegion = new Ext.data.Store( {
|
||||
proxy : new Ext.data.HttpProxy( {
|
||||
url : 'usersAjax',
|
||||
@@ -173,7 +174,7 @@ Ext.onReady(function() {
|
||||
fields : [ {
|
||||
name : 'IS_UID'
|
||||
}, {
|
||||
name : 'IS_NAME'
|
||||
name : 'IS_NAME'
|
||||
} ]
|
||||
})
|
||||
});
|
||||
@@ -194,18 +195,18 @@ Ext.onReady(function() {
|
||||
listeners : {
|
||||
select : function(combo, record, index) {
|
||||
global.IS_UID = this.getValue();
|
||||
comboLocation.enable();
|
||||
comboLocation.clearValue();
|
||||
storelocation.load({
|
||||
comboLocation.enable();
|
||||
comboLocation.clearValue();
|
||||
storelocation.load({
|
||||
params : {
|
||||
action : 'locationList',
|
||||
IC_UID : global.IC_UID,
|
||||
IS_UID : global.IS_UID
|
||||
}
|
||||
IS_UID : global.IS_UID
|
||||
}
|
||||
});
|
||||
comboLocation.store.on('load', function(store) {
|
||||
comboLocation.setValue('');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -236,13 +237,13 @@ Ext.onReady(function() {
|
||||
autocomplete : true,
|
||||
typeAhead : true,
|
||||
mode : 'local'
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
comboReplacedBy = new Ext.form.ComboBox({
|
||||
fieldLabel : _('ID_REPLACED_BY'),
|
||||
hiddenName : 'USR_REPLACED_BY',
|
||||
id : 'USR_REPLACED_BY',
|
||||
id : 'USR_REPLACED_BY',
|
||||
store : new Ext.data.Store( {
|
||||
proxy : new Ext.data.HttpProxy( {
|
||||
url : 'usersAjax',
|
||||
@@ -257,11 +258,11 @@ Ext.onReady(function() {
|
||||
} ]
|
||||
}),
|
||||
autoLoad:true
|
||||
}),
|
||||
}),
|
||||
valueField : 'USR_UID',
|
||||
displayField : 'USER_FULLNAME',
|
||||
emptyText : TRANSLATIONS.ID_SELECT,
|
||||
width : 180,
|
||||
width : 180,
|
||||
selectOnFocus : true,
|
||||
editable : false,
|
||||
triggerAction: 'all',
|
||||
@@ -301,7 +302,7 @@ Ext.onReady(function() {
|
||||
}),
|
||||
autoLoad : true
|
||||
}),
|
||||
|
||||
|
||||
valueField : 'CALENDAR_UID',
|
||||
displayField : 'CALENDAR_NAME',
|
||||
emptyText : TRANSLATIONS.ID_SELECT,
|
||||
@@ -311,7 +312,7 @@ Ext.onReady(function() {
|
||||
allowBlank : false,
|
||||
triggerAction : 'all',
|
||||
mode : 'local'
|
||||
|
||||
|
||||
});
|
||||
comboCalendar.store.on('load', function(store) {
|
||||
comboCalendar.setValue(store.getAt(0).get('CALENDAR_UID'));
|
||||
@@ -320,7 +321,7 @@ Ext.onReady(function() {
|
||||
var status = new Ext.data.SimpleStore({
|
||||
fields : ['USR_STATUS', 'status'],
|
||||
data : [['ACTIVE', 'ACTIVE'], ['INACTIVE', 'INACTIVE'], ['VACATION', 'ON VACATION']]
|
||||
});
|
||||
});
|
||||
comboStatus = new Ext.form.ComboBox({
|
||||
xtype : 'combo',
|
||||
name : 'status',
|
||||
@@ -339,7 +340,7 @@ Ext.onReady(function() {
|
||||
readOnly : readMode
|
||||
});
|
||||
|
||||
|
||||
|
||||
comboRole = new Ext.form.ComboBox({
|
||||
fieldLabel : _('ID_ROLE'),
|
||||
hiddenName : 'USR_ROLE',
|
||||
@@ -360,7 +361,7 @@ Ext.onReady(function() {
|
||||
}),
|
||||
autoLoad : true
|
||||
}),
|
||||
|
||||
|
||||
valueField : 'ROL_UID',
|
||||
displayField : 'ROL_CODE',
|
||||
emptyText : TRANSLATIONS.ID_SELECT,
|
||||
@@ -370,30 +371,30 @@ Ext.onReady(function() {
|
||||
allowBlank : false,
|
||||
triggerAction : 'all',
|
||||
mode : 'local'
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
comboRole.store.on('load',function(store) {
|
||||
comboRole.setValue(store.getAt(0).get('ROL_UID'));
|
||||
})
|
||||
|
||||
informationFields = new Ext.form.FieldSet({
|
||||
title : _('ID_PERSONAL_INFORMATION'),
|
||||
title : _('ID_PERSONAL_INFORMATION'),
|
||||
items : [
|
||||
{
|
||||
id : 'USR_FIRSTNAME',
|
||||
fieldLabel : _('ID_FIRSTNAME'),
|
||||
fieldLabel : _('ID_FIRSTNAME'),
|
||||
xtype : 'textfield',
|
||||
width : 260,
|
||||
allowBlank : false
|
||||
},
|
||||
},
|
||||
{
|
||||
id : 'USR_LASTNAME',
|
||||
fieldLabel : _('ID_LASTNAME'),
|
||||
xtype : 'textfield',
|
||||
width : 260,
|
||||
allowBlank : false
|
||||
},
|
||||
},
|
||||
{
|
||||
id : 'USR_USERNAME',
|
||||
fieldLabel : _('ID_USER_ID'),
|
||||
@@ -406,7 +407,7 @@ Ext.onReady(function() {
|
||||
// trim
|
||||
this.value = this.getValue().replace(/^\s+|\s+$/g,"");
|
||||
document.getElementById('USR_USERNAME').value = this.getValue().replace(/^\s+|\s+$/g,"");
|
||||
|
||||
|
||||
Ext.getCmp('saveB').disable();
|
||||
Ext.getCmp('cancelB').disable();
|
||||
|
||||
@@ -426,10 +427,10 @@ Ext.onReady(function() {
|
||||
}
|
||||
},
|
||||
{
|
||||
xtype: 'label',
|
||||
xtype: 'label',
|
||||
fieldLabel: ' ',
|
||||
id:'usernameReview',
|
||||
width: 300,
|
||||
width: 300,
|
||||
labelSeparator: ''
|
||||
},
|
||||
{
|
||||
@@ -453,7 +454,7 @@ Ext.onReady(function() {
|
||||
fieldLabel : _('ID_ZIP_CODE'),
|
||||
xtype : 'textfield',
|
||||
width : 260
|
||||
},
|
||||
},
|
||||
comboCountry,
|
||||
comboRegion,
|
||||
comboLocation,
|
||||
@@ -508,15 +509,15 @@ Ext.onReady(function() {
|
||||
'action' : 'testPassword',
|
||||
'PASSWORD_TEXT' : passwordText
|
||||
},
|
||||
success: function(r,o){
|
||||
success: function(r,o){
|
||||
var resp = Ext.util.JSON.decode(r.responseText);
|
||||
|
||||
if (resp.STATUS) {
|
||||
flagPoliciesPassword = true;
|
||||
} else {
|
||||
flagPoliciesPassword = false;
|
||||
flagPoliciesPassword = false;
|
||||
}
|
||||
|
||||
|
||||
Ext.getCmp('passwordReview').setText(resp.DESCRIPTION, false);
|
||||
Ext.getCmp('saveB').enable();
|
||||
Ext.getCmp('cancelB').enable();
|
||||
@@ -544,10 +545,10 @@ Ext.onReady(function() {
|
||||
}
|
||||
},
|
||||
{
|
||||
xtype: 'label',
|
||||
xtype: 'label',
|
||||
fieldLabel: ' ',
|
||||
id:'passwordReview',
|
||||
width: 300,
|
||||
width: 300,
|
||||
labelSeparator: ''
|
||||
},
|
||||
{
|
||||
@@ -577,13 +578,13 @@ Ext.onReady(function() {
|
||||
}
|
||||
},
|
||||
{
|
||||
xtype: 'label',
|
||||
xtype: 'label',
|
||||
fieldLabel: ' ',
|
||||
id:'passwordConfirm',
|
||||
width: 300,
|
||||
width: 300,
|
||||
labelSeparator: ''
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
});
|
||||
|
||||
@@ -605,7 +606,7 @@ Ext.onReady(function() {
|
||||
} ]
|
||||
}),
|
||||
autoLoad : true
|
||||
}),
|
||||
}),
|
||||
valueField : 'id',
|
||||
displayField : 'name',
|
||||
emptyText : TRANSLATIONS.ID_SELECT,
|
||||
@@ -636,7 +637,7 @@ Ext.onReady(function() {
|
||||
} ]
|
||||
}),
|
||||
autoLoad : true
|
||||
}),
|
||||
}),
|
||||
valueField : 'id',
|
||||
displayField : 'name',
|
||||
emptyText : TRANSLATIONS.ID_SELECT,
|
||||
@@ -658,7 +659,7 @@ Ext.onReady(function() {
|
||||
xtype : 'hidden',
|
||||
name : 'PREF_DEFAULT_LANG',
|
||||
value : ''
|
||||
},
|
||||
},
|
||||
comboDefaultMainMenuOption,
|
||||
comboDefaultCasesMenuOption
|
||||
]
|
||||
@@ -693,28 +694,28 @@ Ext.onReady(function() {
|
||||
id : 'saveB',
|
||||
handler: saveUser
|
||||
|
||||
|
||||
|
||||
},
|
||||
{
|
||||
{
|
||||
text : _('ID_CANCEL'),
|
||||
id : 'cancelB',
|
||||
handler : function(){
|
||||
if (!infoMode) {
|
||||
if (!infoMode) {
|
||||
location.href = 'users_List';
|
||||
}
|
||||
else{
|
||||
frmDetails.hide();
|
||||
frmSumary.show();
|
||||
}
|
||||
//location.href = 'users_List';
|
||||
//location.href = 'users_List';
|
||||
}
|
||||
//hidden:readMode
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
//USERS SUMMARY
|
||||
box2 = new Ext.BoxComponent({
|
||||
width: 100,
|
||||
@@ -722,12 +723,12 @@ Ext.onReady(function() {
|
||||
fieldLabel : ' ',
|
||||
labelSeparator : ' ',
|
||||
autoEl : {
|
||||
tag : 'img',
|
||||
src : 'users_ViewPhotoGrid?h=' + Math.random() +'&pUID=' + USR_UID + '',
|
||||
tag : 'img',
|
||||
src : 'users_ViewPhotoGrid?h=' + Math.random() +'&pUID=' + USR_UID + '',
|
||||
align : 'left'}
|
||||
});
|
||||
profileFields2 = new Ext.form.FieldSet({
|
||||
title : _('ID_PROFILE'),
|
||||
title : _('ID_PROFILE'),
|
||||
items : [
|
||||
box2
|
||||
]
|
||||
@@ -737,15 +738,15 @@ Ext.onReady(function() {
|
||||
items : [
|
||||
{
|
||||
id : 'USR_FIRSTNAME2',
|
||||
fieldLabel : _('ID_FIRSTNAME'),
|
||||
fieldLabel : _('ID_FIRSTNAME'),
|
||||
xtype : 'label',
|
||||
width : 260
|
||||
},
|
||||
},
|
||||
{
|
||||
id : 'USR_LASTNAME2',
|
||||
fieldLabel : _('ID_LASTNAME'),
|
||||
xtype : 'label',
|
||||
width : 260
|
||||
width : 260
|
||||
},
|
||||
{
|
||||
id : 'USR_USERNAME2',
|
||||
@@ -757,7 +758,7 @@ Ext.onReady(function() {
|
||||
id : 'USR_EMAIL2',
|
||||
fieldLabel : _('ID_EMAIL'),
|
||||
xtype : 'label',
|
||||
width : 260
|
||||
width : 260
|
||||
},
|
||||
{
|
||||
xtype : 'label',
|
||||
@@ -865,10 +866,10 @@ Ext.onReady(function() {
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
frmSumary = new Ext.FormPanel({
|
||||
id : 'frmSumary',
|
||||
labelWidth : 320,
|
||||
labelWidth : 320,
|
||||
labelAlign : 'right',
|
||||
autoScroll : true,
|
||||
fileUpload : true,
|
||||
@@ -890,7 +891,7 @@ Ext.onReady(function() {
|
||||
handler : editUser,
|
||||
hidden : canEdit
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
|
||||
});
|
||||
@@ -920,7 +921,7 @@ Ext.onReady(function() {
|
||||
|
||||
function defineUserPanel()
|
||||
{
|
||||
|
||||
|
||||
var isIE = ( navigator.userAgent.indexOf('MSIE')>0 ) ? true : false;
|
||||
var eDivPanel = document.createElement("div");
|
||||
var eDivUsersPanel = document.createElement("div");
|
||||
@@ -962,7 +963,7 @@ function validateUserName() {
|
||||
'USR_UID' : USR_UID,
|
||||
'NEW_USERNAME' : usernameText
|
||||
},
|
||||
success: function(r,o){
|
||||
success: function(r,o){
|
||||
var resp = Ext.util.JSON.decode(r.responseText);
|
||||
|
||||
if (resp.exists) {
|
||||
@@ -972,7 +973,7 @@ function validateUserName() {
|
||||
} else {
|
||||
flagValidateUsername = true;
|
||||
}
|
||||
|
||||
|
||||
Ext.getCmp('usernameReview').setText(resp.descriptionText, false);
|
||||
Ext.getCmp('saveB').enable();
|
||||
Ext.getCmp('cancelB').enable();
|
||||
@@ -993,18 +994,27 @@ function validateUserName() {
|
||||
|
||||
function saveUser()
|
||||
{
|
||||
if (flagValidateUsername != true) {
|
||||
validateUserName();
|
||||
if ( Ext.getCmp('USR_USERNAME').getValue() == '') {
|
||||
Ext.Msg.alert( _('ID_ERROR'), _('ID_MSG_ERROR_USR_USERNAME'));
|
||||
if (Ext.getCmp('USR_USERNAME').getValue() != '') {
|
||||
if (previousUsername != '') {
|
||||
if (Ext.getCmp('USR_USERNAME').getValue() != previousUsername) {
|
||||
if (!flagValidateUsername) {
|
||||
Ext.Msg.alert( _('ID_ERROR'), Ext.getCmp('usernameReview').html);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Ext.Msg.alert( _('ID_ERROR'), Ext.getCmp('usernameReview').html);
|
||||
if (!flagValidateUsername) {
|
||||
Ext.Msg.alert( _('ID_ERROR'), Ext.getCmp('usernameReview').html);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Ext.Msg.alert( _('ID_ERROR'), _('ID_MSG_ERROR_USR_USERNAME'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (flagPoliciesPassword != true) {
|
||||
if ( Ext.getCmp('USR_NEW_PASS').getValue() == '') {
|
||||
if (!flagPoliciesPassword) {
|
||||
if (Ext.getCmp('USR_NEW_PASS').getValue() == '') {
|
||||
Ext.Msg.alert( _('ID_ERROR'), _('ID_PASSWD_REQUIRED'));
|
||||
} else {
|
||||
Ext.Msg.alert( _('ID_ERROR'), Ext.getCmp('passwordReview').html);
|
||||
@@ -1013,7 +1023,7 @@ function saveUser()
|
||||
}
|
||||
|
||||
var newPass = frmDetails.getForm().findField('USR_NEW_PASS').getValue();
|
||||
var confPass = frmDetails.getForm().findField('USR_CNF_PASS').getValue();
|
||||
var confPass = frmDetails.getForm().findField('USR_CNF_PASS').getValue();
|
||||
if (confPass === newPass) {
|
||||
Ext.getCmp('frmDetails').getForm().submit( {
|
||||
|
||||
@@ -1026,7 +1036,7 @@ function saveUser()
|
||||
waitMsg : _('ID_SAVING_PROCESS'),
|
||||
timeout : 36000,
|
||||
success : function(obj, resp) {
|
||||
if (!infoMode) {
|
||||
if (!infoMode) {
|
||||
location.href = 'users_List';
|
||||
}
|
||||
else {
|
||||
@@ -1058,8 +1068,8 @@ function saveUser()
|
||||
else
|
||||
Ext.Msg.alert( _('ID_ERROR'), _('ID_PASSWORDS_DONT_MATCH'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Load data for Edit mode
|
||||
function loadUserData()
|
||||
{
|
||||
@@ -1069,12 +1079,12 @@ function loadUserData()
|
||||
'action' : 'userData',
|
||||
USR_UID : USR_UID
|
||||
},
|
||||
waitMsg : _('ID_UPLOADING_PROCESS_FILE'),
|
||||
success : function(r,o){
|
||||
waitMsg : _('ID_UPLOADING_PROCESS_FILE'),
|
||||
success : function(r,o){
|
||||
var data = Ext.util.JSON.decode(r.responseText);
|
||||
|
||||
Ext.getCmp('frmDetails').getForm().setValues({
|
||||
USR_FIRSTNAME : data.user.USR_FIRSTNAME,
|
||||
USR_FIRSTNAME : data.user.USR_FIRSTNAME,
|
||||
USR_LASTNAME : data.user.USR_LASTNAME,
|
||||
USR_USERNAME : data.user.USR_USERNAME,
|
||||
USR_EMAIL : data.user.USR_EMAIL,
|
||||
@@ -1085,8 +1095,8 @@ function loadUserData()
|
||||
USR_DUE_DATE : data.user.USR_DUE_DATE,
|
||||
USR_STATUS : data.user.USR_STATUS
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
storeCountry.load({
|
||||
params : {
|
||||
action : 'countryList'
|
||||
@@ -1104,23 +1114,23 @@ function loadUserData()
|
||||
params : {
|
||||
action : 'locationList',
|
||||
IC_UID : data.user.USR_COUNTRY,
|
||||
IS_UID : data.user.USR_CITY
|
||||
}
|
||||
IS_UID : data.user.USR_CITY
|
||||
}
|
||||
});
|
||||
comboCountry.store.on('load',function(store) {
|
||||
comboCountry.setValue(data.user.USR_COUNTRY);
|
||||
});
|
||||
global.IC_UID = data.user.USR_COUNTRY;
|
||||
|
||||
|
||||
comboRegion.store.on('load',function(store) {
|
||||
comboRegion.setValue(data.user.USR_CITY);
|
||||
});
|
||||
|
||||
|
||||
global.IS_UID = data.user.USR_CITY;
|
||||
comboLocation.store.on('load',function(store) {
|
||||
comboLocation.setValue(data.user.USR_LOCATION);
|
||||
});
|
||||
|
||||
|
||||
comboReplacedBy.store.on('load',function(store) {
|
||||
comboReplacedBy.setValue(data.user.USR_REPLACED_BY);
|
||||
});
|
||||
@@ -1130,7 +1140,9 @@ function loadUserData()
|
||||
comboCalendar.store.on('load',function(store) {
|
||||
comboCalendar.setValue(data.user.USR_CALENDAR);
|
||||
});
|
||||
|
||||
|
||||
previousUsername = Ext.getCmp('USR_USERNAME').getValue();
|
||||
|
||||
},
|
||||
|
||||
failure : function(r, o) {
|
||||
@@ -1147,12 +1159,12 @@ function loadUserView()
|
||||
'action' : 'userData',
|
||||
USR_UID : USR_UID
|
||||
},
|
||||
waitMsg : _('ID_UPLOADING_PROCESS_FILE'),
|
||||
success : function(r,o){
|
||||
waitMsg : _('ID_UPLOADING_PROCESS_FILE'),
|
||||
success : function(r,o){
|
||||
var data = Ext.util.JSON.decode(r.responseText);
|
||||
|
||||
|
||||
Ext.getCmp('frmDetails').getForm().setValues({
|
||||
USR_FIRSTNAME : data.user.USR_FIRSTNAME,
|
||||
USR_FIRSTNAME : data.user.USR_FIRSTNAME,
|
||||
USR_LASTNAME : data.user.USR_LASTNAME,
|
||||
USR_USERNAME : data.user.USR_USERNAME,
|
||||
USR_EMAIL : data.user.USR_EMAIL,
|
||||
@@ -1169,19 +1181,19 @@ function loadUserView()
|
||||
Ext.getCmp('USR_EMAIL2').setText(data.user.USR_EMAIL);
|
||||
Ext.getCmp('USR_ADDRESS2').setText(data.user.USR_ADDRESS);
|
||||
Ext.getCmp('USR_ZIP_CODE2').setText(data.user.USR_ZIP_CODE);
|
||||
|
||||
|
||||
Ext.getCmp('USR_COUNTRY2').setText(data.user.USR_COUNTRY_NAME);
|
||||
Ext.getCmp('USR_CITY2').setText(data.user.USR_CITY_NAME);
|
||||
Ext.getCmp('USR_LOCATION2').setText(data.user.USR_LOCATION_NAME);
|
||||
|
||||
|
||||
Ext.getCmp('USR_PHONE2').setText(data.user.USR_PHONE);
|
||||
Ext.getCmp('USR_POSITION2').setText(data.user.USR_POSITION);
|
||||
Ext.getCmp('USR_REPLACED_BY2').setText(data.user.REPLACED_NAME);
|
||||
Ext.getCmp('USR_DUE_DATE2').setText(data.user.USR_DUE_DATE);
|
||||
Ext.getCmp('USR_STATUS2').setText(data.user.USR_STATUS);
|
||||
Ext.getCmp('USR_ROLE2').setText(data.user.USR_ROLE);
|
||||
|
||||
|
||||
|
||||
|
||||
Ext.getCmp('PREF_DEFAULT_MAIN_MENU_OPTION2').setText(data.user.MENUSELECTED_NAME);
|
||||
Ext.getCmp('PREF_DEFAULT_CASES_MENUSELECTED2').setText(data.user.CASES_MENUSELECTED_NAME);
|
||||
|
||||
@@ -1202,23 +1214,23 @@ function loadUserView()
|
||||
params : {
|
||||
action : 'locationList',
|
||||
IC_UID : data.user.USR_COUNTRY,
|
||||
IS_UID : data.user.USR_CITY
|
||||
}
|
||||
IS_UID : data.user.USR_CITY
|
||||
}
|
||||
});
|
||||
comboCountry.store.on('load',function(store) {
|
||||
comboCountry.setValue(data.user.USR_COUNTRY);
|
||||
});
|
||||
global.IC_UID = data.user.USR_COUNTRY;
|
||||
|
||||
|
||||
comboRegion.store.on('load',function(store) {
|
||||
comboRegion.setValue(data.user.USR_CITY);
|
||||
});
|
||||
|
||||
|
||||
global.IS_UID = data.user.USR_CITY;
|
||||
comboLocation.store.on('load',function(store) {
|
||||
comboLocation.setValue(data.user.USR_LOCATION);
|
||||
});
|
||||
|
||||
|
||||
comboReplacedBy.store.on('load',function(store) {
|
||||
comboReplacedBy.setValue(data.user.USR_REPLACED_BY);
|
||||
});
|
||||
@@ -1228,7 +1240,7 @@ function loadUserView()
|
||||
comboCalendar.store.on('load',function(store) {
|
||||
comboCalendar.setValue(data.user.USR_CALENDAR);
|
||||
});
|
||||
|
||||
|
||||
//for preferences on the configurations table
|
||||
comboDefaultMainMenuOption.store.on('load',function(store) {
|
||||
comboDefaultMainMenuOption.setValue(data.user.PREF_DEFAULT_MENUSELECTED);
|
||||
@@ -1237,6 +1249,8 @@ function loadUserView()
|
||||
//comboDefaultCasesMenuOption.setValue('');
|
||||
comboDefaultCasesMenuOption.setValue(data.user.PREF_DEFAULT_CASES_MENUSELECTED);
|
||||
});
|
||||
|
||||
previousUsername = Ext.getCmp('USR_USERNAME').getValue();
|
||||
},
|
||||
failure:function(r,o) {
|
||||
//viewport.getEl().unmask();
|
||||
|
||||
Reference in New Issue
Block a user