BUG 9709 "Add a new option in ADMIN -> Logs for the cron" SOLVED
- New feature - Add a new option in ADMIN -> Logs for the cron - Added new feature * Available from version 2.0.44
This commit is contained in:
@@ -53,7 +53,7 @@ define ('MEMCACHED_ENABLED', $config['memcached']);
|
|||||||
define ('MEMCACHED_SERVER', $config['memcached_server']);
|
define ('MEMCACHED_SERVER', $config['memcached_server']);
|
||||||
define ('TIME_ZONE', $config['time_zone']);
|
define ('TIME_ZONE', $config['time_zone']);
|
||||||
|
|
||||||
//Default values
|
//Cron status
|
||||||
$bCronIsRunning = false;
|
$bCronIsRunning = false;
|
||||||
$sLastExecution = null;
|
$sLastExecution = null;
|
||||||
$processcTimeProcess = 0;
|
$processcTimeProcess = 0;
|
||||||
@@ -133,3 +133,4 @@ if (!$bCronIsRunning) {
|
|||||||
} else {
|
} else {
|
||||||
eprintln("The cron is running, please wait for it to finish.\nStarted in $sLastExecution");
|
eprintln("The cron is running, please wait for it to finish.\nStarted in $sLastExecution");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -212,9 +212,10 @@ if (!defined('SYS_SYS')) {
|
|||||||
|
|
||||||
function processWorkspace()
|
function processWorkspace()
|
||||||
{
|
{
|
||||||
global $sLastExecution;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
global $sObject;
|
||||||
|
global $sLastExecution;
|
||||||
|
|
||||||
resendEmails();
|
resendEmails();
|
||||||
unpauseApplications();
|
unpauseApplications();
|
||||||
calculateDuration();
|
calculateDuration();
|
||||||
@@ -444,13 +445,13 @@ function executeScheduledCases($sNow=null)
|
|||||||
|
|
||||||
function executeUpdateAppTitle()
|
function executeUpdateAppTitle()
|
||||||
{
|
{
|
||||||
global $sFilter;
|
|
||||||
|
|
||||||
if ($sFilter != "" && strpos($sFilter, "update-case-labels") === false) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
global $sFilter;
|
||||||
|
|
||||||
|
if ($sFilter != "" && strpos($sFilter, "update-case-labels") === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$criteriaConf = new Criteria("workflow");
|
$criteriaConf = new Criteria("workflow");
|
||||||
|
|
||||||
$criteriaConf->addSelectColumn(ConfigurationPeer::OBJ_UID);
|
$criteriaConf->addSelectColumn(ConfigurationPeer::OBJ_UID);
|
||||||
@@ -496,27 +497,21 @@ function executeUpdateAppTitle()
|
|||||||
function saveLog($sSource, $sType, $sDescription)
|
function saveLog($sSource, $sType, $sDescription)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
global $sObject;
|
||||||
global $isDebug;
|
global $isDebug;
|
||||||
|
|
||||||
if ($isDebug) {
|
if ($isDebug) {
|
||||||
print date('H:i:s') ." ($sSource) $sType $sDescription <br />\n";
|
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);
|
||||||
|
|
||||||
G::verifyPath(PATH_DATA . 'log' . PATH_SEP, true);
|
|
||||||
|
|
||||||
//setExecutionMessage( PATH_DATA."log".PATH_SEP);
|
//setExecutionMessage( PATH_DATA."log".PATH_SEP);
|
||||||
|
|
||||||
if ($sType == 'action') {
|
$oFile = @fopen(PATH_DATA . "log" . PATH_SEP . "cron.log", "a+");
|
||||||
$oFile = @fopen(PATH_DATA . 'log' . PATH_SEP . 'cron.log', 'a+');
|
@fwrite($oFile, date("Y-m-d H:i:s") . " | $sObject | " . $sSource . " | $sType | " . $sDescription . "\n");
|
||||||
} 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);
|
@fclose($oFile);
|
||||||
} catch (Exception $oError) {
|
} catch (Exception $e) {
|
||||||
//CONTINUE
|
//CONTINUE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -548,3 +543,4 @@ function setExecutionResultMessage($m, $t='')
|
|||||||
|
|
||||||
eprintln("[$m]", $c);
|
eprintln("[$m]", $c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,6 @@ if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') == 1) {
|
|||||||
if ($RBAC->userCanAccess('PM_SETUP') == 1) {
|
if ($RBAC->userCanAccess('PM_SETUP') == 1) {
|
||||||
$G_TMP_MENU->AddIdRawOption('EVENT', '../events/eventList', G::LoadTranslation('ID_EVENTS'), '', '', 'logs');
|
$G_TMP_MENU->AddIdRawOption('EVENT', '../events/eventList', G::LoadTranslation('ID_EVENTS'), '', '', 'logs');
|
||||||
$G_TMP_MENU->AddIdRawOption('LOG_CASE_SCHEDULER', '../cases/cases_Scheduler_Log', G::LoadTranslation('ID_CASE_SCHEDULER'), "icon-logs-list.png",'', 'logs');
|
$G_TMP_MENU->AddIdRawOption('LOG_CASE_SCHEDULER', '../cases/cases_Scheduler_Log', G::LoadTranslation('ID_CASE_SCHEDULER'), "icon-logs-list.png",'', 'logs');
|
||||||
|
$G_TMP_MENU->AddIdRawOption("CRON", "../setup/cron", G::LoadTranslation("ID_CRON_ACTIONS"), null, null, "logs");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
90
workflow/engine/methods/setup/cron.php
Normal file
90
workflow/engine/methods/setup/cron.php
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
G::LoadClass("system");
|
||||||
|
G::LoadClass("wsTools");
|
||||||
|
G::LoadClass("configuration");
|
||||||
|
|
||||||
|
global $RBAC;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($RBAC->userCanAccess("PM_SETUP_ADVANCE") != 1) {
|
||||||
|
G::SendTemporalMessage("ID_USER_HAVENT_RIGHTS_PAGE", "error", "labels");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Cron status
|
||||||
|
$bCronIsRunning = false;
|
||||||
|
$sLastExecution = null;
|
||||||
|
$processcTimeProcess = 0;
|
||||||
|
$processcTimeStart = 0;
|
||||||
|
|
||||||
|
if (file_exists(PATH_DATA . "cron")) {
|
||||||
|
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
|
||||||
|
$bCronIsRunning = (boolean)($arrayCron["bCronIsRunning"]);
|
||||||
|
$sLastExecution = $arrayCron["sLastExecution"];
|
||||||
|
$processcTimeProcess = (isset($arrayCron["processcTimeProcess"]))? intval($arrayCron["processcTimeProcess"]) : 10;
|
||||||
|
$processcTimeStart = (isset($arrayCron["processcTimeStart"]))? $arrayCron["processcTimeStart"] : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($bCronIsRunning && $processcTimeStart != 0) {
|
||||||
|
if ((time() - $processcTimeStart) > ($processcTimeProcess * 60)) {
|
||||||
|
//Cron finished his execution for some reason
|
||||||
|
$bCronIsRunning = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Data
|
||||||
|
$c = new Configurations();
|
||||||
|
$configPage = $c->getConfiguration("cronList", "pageSize", null, $_SESSION["USER_LOGGED"]);
|
||||||
|
|
||||||
|
$config = array();
|
||||||
|
$config["pageSize"] = (isset($configPage["pageSize"]))? $configPage["pageSize"] : 20;
|
||||||
|
|
||||||
|
$cronInfo = array();
|
||||||
|
$fileLog = PATH_DATA . "log" . PATH_SEP . "cron.log";
|
||||||
|
$fileLogSize = (file_exists($fileLog))? number_format(filesize($fileLog) * (1 / 1024) * (1 / 1024), 4, ".", "") : 0;
|
||||||
|
|
||||||
|
$cronInfo["status"] = G::LoadTranslation((($bCronIsRunning)? "ID_CRON_STATUS_ACTIVE" : "ID_CRON_STATUS_INACTIVE"));
|
||||||
|
$cronInfo["lastExecution"] = (!empty($sLastExecution))? $sLastExecution : "";
|
||||||
|
$cronInfo["fileLogName"] = "cron.log";
|
||||||
|
$cronInfo["fileLogSize"] = $fileLogSize;
|
||||||
|
$cronInfo["fileLogPath"] = $fileLog;
|
||||||
|
|
||||||
|
|
||||||
|
//Workspaces
|
||||||
|
$workspaces = System::listWorkspaces();
|
||||||
|
$arrayAux = array();
|
||||||
|
|
||||||
|
foreach ($workspaces as $index => $workspace) {
|
||||||
|
$arrayAux[] = $workspace->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
sort($arrayAux);
|
||||||
|
|
||||||
|
$arrayWorkspace = array();
|
||||||
|
|
||||||
|
foreach ($arrayAux as $index => $value) {
|
||||||
|
$arrayWorkspace[] = array($value, $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
array_unshift($arrayWorkspace, array("ALL", G::LoadTranslation("ID_ALL_WORKSPACES")));
|
||||||
|
|
||||||
|
//Status
|
||||||
|
$arrayStatus = array(
|
||||||
|
array("ALL", G::LoadTranslation("ID_ALL")),
|
||||||
|
array("COMPLETED", G::LoadTranslation("COMPLETED")),
|
||||||
|
array("FAILED", G::LoadTranslation("ID_FAILED"))
|
||||||
|
);
|
||||||
|
|
||||||
|
$oHeadPublisher = &headPublisher::getSingleton();
|
||||||
|
$oHeadPublisher->addContent("setup/cron"); //Adding a html file .html
|
||||||
|
$oHeadPublisher->addExtJsScript("setup/cron", false); //Adding a javascript file .js
|
||||||
|
$oHeadPublisher->assign("CONFIG", $config);
|
||||||
|
$oHeadPublisher->assign("CRON", $cronInfo);
|
||||||
|
$oHeadPublisher->assign("WORKSPACE", $arrayWorkspace);
|
||||||
|
$oHeadPublisher->assign("STATUS", $arrayStatus);
|
||||||
|
|
||||||
|
G::RenderPage("publish", "extJs");
|
||||||
|
|
||||||
215
workflow/engine/methods/setup/cronAjax.php
Normal file
215
workflow/engine/methods/setup/cronAjax.php
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
<?php
|
||||||
|
function mktimeDate($date)
|
||||||
|
{
|
||||||
|
$arrayAux = getdate(strtotime($date));
|
||||||
|
|
||||||
|
$mktDate = mktime(
|
||||||
|
$arrayAux["hours"],
|
||||||
|
$arrayAux["minutes"],
|
||||||
|
$arrayAux["seconds"],
|
||||||
|
$arrayAux["mon"],
|
||||||
|
$arrayAux["mday"],
|
||||||
|
$arrayAux["year"]
|
||||||
|
);
|
||||||
|
|
||||||
|
return $mktDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
function cronArraySet($str, $filter)
|
||||||
|
{
|
||||||
|
$arrayAux = explode("|", $str);
|
||||||
|
|
||||||
|
$date = "";
|
||||||
|
$workspace = "";
|
||||||
|
$action = "";
|
||||||
|
$status = "";
|
||||||
|
$description = trim($arrayAux[0]);
|
||||||
|
|
||||||
|
if (count($arrayAux) > 1) {
|
||||||
|
$date = (isset($arrayAux[0]))? trim($arrayAux[0]) : "";
|
||||||
|
$workspace = (isset($arrayAux[1]))? trim($arrayAux[1]) : "";
|
||||||
|
$action = (isset($arrayAux[2]))? trim($arrayAux[2]) : "";
|
||||||
|
$status = (isset($arrayAux[3]))? trim($arrayAux[3]) : "";
|
||||||
|
$description = (isset($arrayAux[4]))? trim($arrayAux[4]) : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$mktDate = (!empty($date))? mktimeDate($date) : 0;
|
||||||
|
|
||||||
|
//Filter
|
||||||
|
$sw = 1;
|
||||||
|
|
||||||
|
if ($filter["workspace"] != "ALL" && $workspace != $filter["workspace"]) {
|
||||||
|
$sw = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($filter["status"] != "ALL") {
|
||||||
|
switch ($filter["status"]) {
|
||||||
|
case "COMPLETED":
|
||||||
|
if ($status != "action") {
|
||||||
|
$sw = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "FAILED":
|
||||||
|
if ($status == "action") {
|
||||||
|
$sw = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($filter["dateFrom"]) && $mktDate > 0) {
|
||||||
|
if (!(mktimeDate($filter["dateFrom"]) <= $mktDate)) {
|
||||||
|
$sw = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($filter["dateTo"]) && $mktDate > 0) {
|
||||||
|
if (!($mktDate <= mktimeDate($filter["dateTo"] . " 23:59:59"))) {
|
||||||
|
$sw = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$arrayData = array();
|
||||||
|
|
||||||
|
if ($sw == 1) {
|
||||||
|
$arrayData = array(
|
||||||
|
"DATE" => $date,
|
||||||
|
"WORKSPACE" => $workspace,
|
||||||
|
"ACTION" => $action,
|
||||||
|
"STATUS" => $status,
|
||||||
|
"DESCRIPTION" => $description
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arrayData;
|
||||||
|
}
|
||||||
|
|
||||||
|
function cronDataGet($filter, $r, $i)
|
||||||
|
{
|
||||||
|
$r = $r + 1; //+ 1, to determine the next page
|
||||||
|
$i = $i + 1;
|
||||||
|
|
||||||
|
$arrayData = array();
|
||||||
|
$strAux = null;
|
||||||
|
$numRec = 0;
|
||||||
|
$cont = 0;
|
||||||
|
|
||||||
|
$file = PATH_DATA . "log" . PATH_SEP . "cron.log";
|
||||||
|
|
||||||
|
if (file_exists($file)) {
|
||||||
|
$fh = fopen($file, "r");
|
||||||
|
|
||||||
|
for($pos = 0; fseek($fh, $pos, SEEK_END) !== -1; $pos--) {
|
||||||
|
$char = fgetc($fh);
|
||||||
|
|
||||||
|
if ($char == "\n") {
|
||||||
|
$strAux = trim($strAux);
|
||||||
|
|
||||||
|
if (!empty($strAux)) {
|
||||||
|
$arrayAux = cronArraySet($strAux, $filter);
|
||||||
|
|
||||||
|
if (count($arrayAux) > 0) {
|
||||||
|
$cont = $cont + 1;
|
||||||
|
|
||||||
|
if ($cont >= $i && count($arrayData) + 1 <= $r) {
|
||||||
|
$arrayData[] = $arrayAux;
|
||||||
|
$numRec = $cont;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($arrayData) == $r) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$strAux = null;
|
||||||
|
$char = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$strAux = $char . $strAux;
|
||||||
|
}
|
||||||
|
|
||||||
|
$strAux = trim($strAux);
|
||||||
|
|
||||||
|
if (!empty($strAux)) {
|
||||||
|
$arrayAux = cronArraySet($strAux, $filter);
|
||||||
|
|
||||||
|
if (count($arrayAux) > 0) {
|
||||||
|
$cont = $cont + 1;
|
||||||
|
|
||||||
|
if ($cont >= $i && count($arrayData) + 1 <= $r) {
|
||||||
|
$arrayData[] = $arrayAux;
|
||||||
|
$numRec = $cont;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($fh);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Delete element
|
||||||
|
$r = $r - 1;
|
||||||
|
|
||||||
|
if (count($arrayData) > $r) {
|
||||||
|
$arrayAux = array_pop($arrayData);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array($numRec, $arrayData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$option = (isset($_REQUEST["option"]))? $_REQUEST["option"] : null;
|
||||||
|
|
||||||
|
$response = array();
|
||||||
|
|
||||||
|
switch ($option) {
|
||||||
|
case "LST":
|
||||||
|
$pageSize = $_REQUEST["pageSize"];
|
||||||
|
$workspace = $_REQUEST["workspace"];
|
||||||
|
$status = $_REQUEST["status"];
|
||||||
|
$dateFrom = $_REQUEST["dateFrom"];
|
||||||
|
$dateTo = $_REQUEST["dateTo"];
|
||||||
|
|
||||||
|
$arrayFilter = array(
|
||||||
|
"workspace" => $workspace,
|
||||||
|
"status" => $status,
|
||||||
|
"dateFrom" => str_replace("T00:00:00", null, $dateFrom),
|
||||||
|
"dateTo" => str_replace("T00:00:00", null, $dateTo)
|
||||||
|
);
|
||||||
|
|
||||||
|
$limit = isset($_REQUEST["limit"])? $_REQUEST["limit"] : $pageSize;
|
||||||
|
$start = isset($_REQUEST["start"])? $_REQUEST["start"] : 0;
|
||||||
|
|
||||||
|
list($numRec, $data) = cronDataGet($arrayFilter, $limit, $start);
|
||||||
|
|
||||||
|
$response = array("success" => true, "resultTotal" => $numRec, "resultRoot" => $data);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "EMPTY":
|
||||||
|
$status = 1;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$file = PATH_DATA . "log" . PATH_SEP . "cron.log";
|
||||||
|
|
||||||
|
if (file_exists($file)) {
|
||||||
|
//file_put_contents($file, null);
|
||||||
|
unlink($file);
|
||||||
|
}
|
||||||
|
|
||||||
|
$response["status"] = "OK";
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$response["message"] = $e->getMessage();
|
||||||
|
$status = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($status == 0) {
|
||||||
|
$response["status"] = "ERROR";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo G::json_encode($response);
|
||||||
|
|
||||||
@@ -775,6 +775,12 @@ antes funcionaba.
|
|||||||
background-position:0 -15517px !important;
|
background-position:0 -15517px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ICON_CRON {
|
||||||
|
/*ss_time*/
|
||||||
|
background-image: url(/images/icons_silk/sprites.png) !important;
|
||||||
|
background-position: 0 -16939px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.ICON_PROCESS_CATEGORY{
|
.ICON_PROCESS_CATEGORY{
|
||||||
/*ss_sitemap_color*/
|
/*ss_sitemap_color*/
|
||||||
background-image:url( /images/icons_silk/sprites.png) !important;
|
background-image:url( /images/icons_silk/sprites.png) !important;
|
||||||
@@ -1509,7 +1515,7 @@ td.x-cnotes-label {
|
|||||||
background: none repeat scroll 0 0 #32405a;
|
background: none repeat scroll 0 0 #32405a;
|
||||||
background-image: url("/images/canvastile_bg2.jpg");
|
background-image: url("/images/canvastile_bg2.jpg");
|
||||||
}
|
}
|
||||||
#loading-message
|
#loading-message
|
||||||
{
|
{
|
||||||
padding-left: 10px !important;
|
padding-left: 10px !important;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
@@ -1521,7 +1527,7 @@ td.x-cnotes-label {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
bottom : 0;
|
bottom : 0;
|
||||||
}
|
}
|
||||||
.x-pm-footer-text
|
.x-pm-footer-text
|
||||||
{
|
{
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font: 8pt Tahoma,sans-serif,MiscFixed;
|
font: 8pt Tahoma,sans-serif,MiscFixed;
|
||||||
@@ -1530,7 +1536,7 @@ td.x-cnotes-label {
|
|||||||
padding-left: 3px;
|
padding-left: 3px;
|
||||||
padding-right: 3px;
|
padding-right: 3px;
|
||||||
}
|
}
|
||||||
.x-pm-footer-advisetext
|
.x-pm-footer-advisetext
|
||||||
{
|
{
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font: 6pt Tahoma,sans-serif,MiscFixed;
|
font: 6pt Tahoma,sans-serif,MiscFixed;
|
||||||
|
|||||||
@@ -793,12 +793,19 @@ antes funcionaba.
|
|||||||
background-image:url( /images/icons_silk/sprites.png) !important;
|
background-image:url( /images/icons_silk/sprites.png) !important;
|
||||||
background-position:0 -17011px !important;
|
background-position:0 -17011px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ICON_EVENT{
|
.ICON_EVENT{
|
||||||
/*ss_table_gear*/
|
/*ss_table_gear*/
|
||||||
background-image:url( /images/icons_silk/sprites.png) !important;
|
background-image:url( /images/icons_silk/sprites.png) !important;
|
||||||
background-position:0 -15517px !important;
|
background-position:0 -15517px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ICON_CRON {
|
||||||
|
/*ss_time*/
|
||||||
|
background-image: url(/images/icons_silk/sprites.png) !important;
|
||||||
|
background-position: 0 -16939px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.ICON_PROCESS_CATEGORY{
|
.ICON_PROCESS_CATEGORY{
|
||||||
/*ss_sitemap_color*/
|
/*ss_sitemap_color*/
|
||||||
background-image:url( /images/icons_silk/sprites.png) !important;
|
background-image:url( /images/icons_silk/sprites.png) !important;
|
||||||
@@ -1029,7 +1036,7 @@ antes funcionaba.
|
|||||||
}
|
}
|
||||||
|
|
||||||
table.x-pm-headerbar td, table th {
|
table.x-pm-headerbar td, table th {
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.headerRightSection
|
.headerRightSection
|
||||||
@@ -1530,7 +1537,7 @@ td.x-cnotes-label {
|
|||||||
background: none repeat scroll 0 0 #32405a;
|
background: none repeat scroll 0 0 #32405a;
|
||||||
background-image: url("/images/canvastile_bg2.jpg");
|
background-image: url("/images/canvastile_bg2.jpg");
|
||||||
}
|
}
|
||||||
#loading-message
|
#loading-message
|
||||||
{
|
{
|
||||||
padding-left: 10px !important;
|
padding-left: 10px !important;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
@@ -1542,7 +1549,7 @@ td.x-cnotes-label {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
bottom : 0;
|
bottom : 0;
|
||||||
}
|
}
|
||||||
.x-pm-footer-text
|
.x-pm-footer-text
|
||||||
{
|
{
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font: 8pt Tahoma,sans-serif,MiscFixed;
|
font: 8pt Tahoma,sans-serif,MiscFixed;
|
||||||
@@ -1551,7 +1558,7 @@ td.x-cnotes-label {
|
|||||||
padding-left: 3px;
|
padding-left: 3px;
|
||||||
padding-right: 3px;
|
padding-right: 3px;
|
||||||
}
|
}
|
||||||
.x-pm-footer-advisetext
|
.x-pm-footer-advisetext
|
||||||
{
|
{
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font: 6pt Tahoma,sans-serif,MiscFixed;
|
font: 6pt Tahoma,sans-serif,MiscFixed;
|
||||||
|
|||||||
@@ -772,6 +772,12 @@ antes funcionaba.
|
|||||||
background-position:0 -15517px !important;
|
background-position:0 -15517px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ICON_CRON {
|
||||||
|
/*ss_time*/
|
||||||
|
background-image: url(/images/icons_silk/sprites.png) !important;
|
||||||
|
background-position: 0 -16939px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.ICON_PROCESS_CATEGORY{
|
.ICON_PROCESS_CATEGORY{
|
||||||
/*ss_sitemap_color*/
|
/*ss_sitemap_color*/
|
||||||
background-image:url( /images/icons_silk/sprites.png) !important;
|
background-image:url( /images/icons_silk/sprites.png) !important;
|
||||||
|
|||||||
1
workflow/engine/templates/setup/cron.html
Normal file
1
workflow/engine/templates/setup/cron.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<div></div>
|
||||||
459
workflow/engine/templates/setup/cron.js
Normal file
459
workflow/engine/templates/setup/cron.js
Normal file
@@ -0,0 +1,459 @@
|
|||||||
|
Ext.namespace("cron");
|
||||||
|
|
||||||
|
cron.application = {
|
||||||
|
init: function ()
|
||||||
|
{
|
||||||
|
var loadMaskCron = new Ext.LoadMask(Ext.getBody(), {msg: _("ID_LOADING_GRID")});
|
||||||
|
|
||||||
|
cronProcessAjax = function (option)
|
||||||
|
{
|
||||||
|
var p;
|
||||||
|
|
||||||
|
switch (option) {
|
||||||
|
case "EMPTY":
|
||||||
|
p = {
|
||||||
|
"option": option
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ext.Ajax.request({
|
||||||
|
url: "cronAjax",
|
||||||
|
method: "POST",
|
||||||
|
params: p,
|
||||||
|
|
||||||
|
success: function (response, opts)
|
||||||
|
{
|
||||||
|
var dataResponse = eval("(" + response.responseText + ")"); //json
|
||||||
|
|
||||||
|
switch (option) {
|
||||||
|
case "EMPTY":
|
||||||
|
if (dataResponse.status && dataResponse.status == "OK") {
|
||||||
|
pagingCron.moveFirst();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
failure: function (response, opts)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
infoView = function ()
|
||||||
|
{
|
||||||
|
var strData = "<b>" + _("ID_CRON_INFO") + "</b><br />";
|
||||||
|
strData = strData + "<b>" + _("ID_STATUS") + ":</b> " + CRON.status + "<br />";
|
||||||
|
strData = strData + "<b>" + _("ID_EVENT_LAST_EXECUTION_DATE") + ":</b> " + CRON.lastExecution + "<br /><br />";
|
||||||
|
strData = strData + "<b>" + _("ID_LOG_INFO") + "</b><br />";
|
||||||
|
strData = strData + "<b>" + _("ID_FILENAME") + ":</b> " + CRON.fileLogName + "<br />";
|
||||||
|
strData = strData + "<b>" + _("ID_SIZE") + ":</b> " + CRON.fileLogSize + " MB<br />";
|
||||||
|
strData = strData + "<b>" + _("ID_PATH") + ":</b> " + CRON.fileLogPath + "<br />";
|
||||||
|
|
||||||
|
var formItems = Ext.getCmp("frmInfoView").form.items;
|
||||||
|
formItems.items[0].setValue(strData);
|
||||||
|
|
||||||
|
winInfo.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
logView = function ()
|
||||||
|
{
|
||||||
|
var record = grdpnlMain.getSelectionModel().getSelected();
|
||||||
|
|
||||||
|
var strData = "<b>" + _("ID_DATE_LABEL") + "</b><br />" + record.get("DATE") + "<br />";
|
||||||
|
strData = strData + "<b>" + _("ID_WORKSPACE") + "</b><br />" + record.get("WORKSPACE") + "<br />";
|
||||||
|
strData = strData + "<b>" + _("ID_ACTION") + "</b><br />" + record.get("ACTION") + "<br />";
|
||||||
|
strData = strData + "<b>" + _("ID_STATUS") + "</b><br />" + record.get("STATUS") + "<br />";
|
||||||
|
strData = strData + "<b>" + _("ID_DESCRIPTION") + "</b><br />" + record.get("DESCRIPTION") + "<br />";
|
||||||
|
|
||||||
|
var formItems = Ext.getCmp("frmLogView").form.items;
|
||||||
|
formItems.items[0].setValue(strData);
|
||||||
|
|
||||||
|
winLog.setTitle("Log - " + _("ID_WORKSPACE") + " " + record.get("WORKSPACE"));
|
||||||
|
winLog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Variables
|
||||||
|
var pageSize = parseInt(CONFIG.pageSize);
|
||||||
|
|
||||||
|
var expander = new Ext.ux.grid.RowExpander({
|
||||||
|
tpl: new Ext.Template(
|
||||||
|
"<b>" + _("ID_DESCRIPTION") + "</b><br />{DESCRIPTION}"
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
//Stores
|
||||||
|
var storeCron = new Ext.data.Store({
|
||||||
|
proxy: new Ext.data.HttpProxy({
|
||||||
|
url: "cronAjax",
|
||||||
|
method: "POST"
|
||||||
|
}),
|
||||||
|
|
||||||
|
reader: new Ext.data.JsonReader({
|
||||||
|
root: "resultRoot",
|
||||||
|
totalProperty: "resultTotal",
|
||||||
|
fields: [
|
||||||
|
{name: "DATE"},
|
||||||
|
{name: "WORKSPACE"},
|
||||||
|
{name: "ACTION"},
|
||||||
|
{name: "STATUS"},
|
||||||
|
{name: "DESCRIPTION"}
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
|
||||||
|
//autoLoad: true, //First call
|
||||||
|
|
||||||
|
listeners: {
|
||||||
|
beforeload: function (store)
|
||||||
|
{
|
||||||
|
loadMaskCron.show();
|
||||||
|
|
||||||
|
this.baseParams = {
|
||||||
|
"option": "LST",
|
||||||
|
"pageSize": pageSize,
|
||||||
|
"workspace": Ext.getCmp("cboWorkspace").getValue(),
|
||||||
|
"status": Ext.getCmp("cboStatus").getValue(),
|
||||||
|
"dateFrom": Ext.getCmp("dateFrom").getValue(),
|
||||||
|
"dateTo": Ext.getCmp("dateTo").getValue()
|
||||||
|
};
|
||||||
|
|
||||||
|
//btnView.setDisabled(true);
|
||||||
|
},
|
||||||
|
load: function (store, record, opt)
|
||||||
|
{
|
||||||
|
loadMaskCron.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var storeWorkspace = new Ext.data.ArrayStore({
|
||||||
|
idIndex: 0,
|
||||||
|
fields: ["id", "value"],
|
||||||
|
data: WORKSPACE
|
||||||
|
});
|
||||||
|
|
||||||
|
var storeStatus = new Ext.data.ArrayStore({
|
||||||
|
idIndex: 0,
|
||||||
|
fields: ["id", "value"],
|
||||||
|
data: STATUS
|
||||||
|
});
|
||||||
|
|
||||||
|
var storePageSize = new Ext.data.SimpleStore({
|
||||||
|
fields: ["size"],
|
||||||
|
data: [["20"], ["30"], ["40"], ["50"], ["100"]],
|
||||||
|
autoLoad: true
|
||||||
|
});
|
||||||
|
|
||||||
|
//Components
|
||||||
|
var dateFrom = new Ext.form.DateField({
|
||||||
|
id: "dateFrom",
|
||||||
|
|
||||||
|
format: "Y-m-d",
|
||||||
|
editable: false,
|
||||||
|
width: 90,
|
||||||
|
value: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
var dateTo = new Ext.form.DateField({
|
||||||
|
id: "dateTo",
|
||||||
|
|
||||||
|
format: "Y-m-d",
|
||||||
|
editable: false,
|
||||||
|
width: 90,
|
||||||
|
value: ""
|
||||||
|
});
|
||||||
|
|
||||||
|
var cboWorkspace = new Ext.form.ComboBox({
|
||||||
|
id: "cboWorkspace",
|
||||||
|
|
||||||
|
valueField: "id",
|
||||||
|
displayField: "value",
|
||||||
|
value: "ALL",
|
||||||
|
store: storeWorkspace,
|
||||||
|
|
||||||
|
triggerAction: "all",
|
||||||
|
mode: "local",
|
||||||
|
editable: false,
|
||||||
|
|
||||||
|
width: 150,
|
||||||
|
|
||||||
|
listeners: {
|
||||||
|
select: function (combo, record, index)
|
||||||
|
{
|
||||||
|
pagingCron.moveFirst();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var cboStatus = new Ext.form.ComboBox({
|
||||||
|
id: "cboStatus",
|
||||||
|
|
||||||
|
valueField: "id",
|
||||||
|
displayField: "value",
|
||||||
|
value: "ALL",
|
||||||
|
store: storeStatus,
|
||||||
|
|
||||||
|
triggerAction: "all",
|
||||||
|
mode: "local",
|
||||||
|
editable: false,
|
||||||
|
|
||||||
|
width: 90,
|
||||||
|
|
||||||
|
listeners: {
|
||||||
|
select: function (combo, record, index)
|
||||||
|
{
|
||||||
|
pagingCron.moveFirst();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var cboPageSize = new Ext.form.ComboBox({
|
||||||
|
id: "cboPageSize",
|
||||||
|
|
||||||
|
mode: "local",
|
||||||
|
triggerAction: "all",
|
||||||
|
store: storePageSize,
|
||||||
|
valueField: "size",
|
||||||
|
displayField: "size",
|
||||||
|
width: 50,
|
||||||
|
editable: false,
|
||||||
|
|
||||||
|
listeners: {
|
||||||
|
select: function (combo, record, index)
|
||||||
|
{
|
||||||
|
pageSize = parseInt(record.data["size"]);
|
||||||
|
|
||||||
|
pagingCron.pageSize = pageSize;
|
||||||
|
pagingCron.moveFirst();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var btnInfoView = new Ext.Action({
|
||||||
|
id: "btnInfoView",
|
||||||
|
|
||||||
|
text: _("ID_VIEW_INFO"),
|
||||||
|
iconCls: "button_menu_ext ss_sprite ss_zoom",
|
||||||
|
|
||||||
|
handler: function ()
|
||||||
|
{
|
||||||
|
infoView();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var btnLogClear = new Ext.Action({
|
||||||
|
id: "btnLogClear",
|
||||||
|
|
||||||
|
text: _("ID_CLEAR_LOG"),
|
||||||
|
iconCls: "button_menu_ext ss_sprite ss_bin_empty",
|
||||||
|
|
||||||
|
handler: function ()
|
||||||
|
{
|
||||||
|
Ext.MessageBox.confirm(
|
||||||
|
_("ID_CONFIRM"),
|
||||||
|
_("ID_CRON_LOG_CLEAR"),
|
||||||
|
function (btn, text)
|
||||||
|
{
|
||||||
|
if (btn == "yes") {
|
||||||
|
cronProcessAjax("EMPTY");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
var btnView = new Ext.Action({
|
||||||
|
id: "btnView",
|
||||||
|
|
||||||
|
text: _("ID_VIEW"),
|
||||||
|
iconCls: "button_menu_ext ss_sprite ss_zoom",
|
||||||
|
disabled: true,
|
||||||
|
|
||||||
|
handler: function ()
|
||||||
|
{
|
||||||
|
logView();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
|
var pagingCron = new Ext.PagingToolbar({
|
||||||
|
id: "pagingCron",
|
||||||
|
|
||||||
|
pageSize: pageSize,
|
||||||
|
store: storeCron,
|
||||||
|
displayInfo: true,
|
||||||
|
displayMsg: _("ID_CRON_GRID_PAGE_DISPLAYING_MESSAGE"),
|
||||||
|
emptyMsg: _("ID_NO_RECORDS_FOUND"),
|
||||||
|
items: ["-", _("ID_PAGE_SIZE") + " ", cboPageSize]
|
||||||
|
});
|
||||||
|
|
||||||
|
var cmodel = new Ext.grid.ColumnModel({
|
||||||
|
defaults: {
|
||||||
|
width: 50,
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
expander,
|
||||||
|
{id: "ID", dataIndex: "DATE", hidden: true, hideable: false},
|
||||||
|
{header: _("ID_DATE_LABEL"), dataIndex: "DATE", width: 10, align: "center"},
|
||||||
|
{header: _("ID_WORKSPACE"), dataIndex: "WORKSPACE", width: 10},
|
||||||
|
{header: _("ID_ACTION"), dataIndex: "ACTION", width: 10},
|
||||||
|
{header: _("ID_STATUS"), dataIndex: "STATUS", width: 7, align: "center"},
|
||||||
|
{header: _("ID_DESCRIPTION"), dataIndex: "DESCRIPTION"}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
var smodel = new Ext.grid.RowSelectionModel({
|
||||||
|
singleSelect: true,
|
||||||
|
listeners: {
|
||||||
|
rowselect: function (sm)
|
||||||
|
{
|
||||||
|
//btnView.setDisabled(false);
|
||||||
|
},
|
||||||
|
rowdeselect: function (sm)
|
||||||
|
{
|
||||||
|
//btnView.setDisabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var winInfo = new Ext.Window({
|
||||||
|
layout: "fit",
|
||||||
|
width: 500,
|
||||||
|
height: 250,
|
||||||
|
title: _("ID_CRON_INFO"),
|
||||||
|
modal: true,
|
||||||
|
closeAction: "hide",
|
||||||
|
|
||||||
|
items: [
|
||||||
|
new Ext.FormPanel({
|
||||||
|
id: "frmInfoView",
|
||||||
|
|
||||||
|
frame: true,
|
||||||
|
labelAlign: "right",
|
||||||
|
labelWidth: 1,
|
||||||
|
autoWidth: true,
|
||||||
|
//height: 395,
|
||||||
|
autoScroll: true,
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
xtype: "displayfield",
|
||||||
|
fieldLabel: ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
var winLog = new Ext.Window({
|
||||||
|
layout: "fit",
|
||||||
|
width: 500,
|
||||||
|
height: 250,
|
||||||
|
title: "",
|
||||||
|
modal: true,
|
||||||
|
closeAction: "hide",
|
||||||
|
|
||||||
|
items: [
|
||||||
|
new Ext.FormPanel({
|
||||||
|
id: "frmLogView",
|
||||||
|
|
||||||
|
frame: true,
|
||||||
|
labelAlign: "right",
|
||||||
|
labelWidth: 1,
|
||||||
|
autoWidth: true,
|
||||||
|
//height: 395,
|
||||||
|
autoScroll: true,
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
xtype: "displayfield",
|
||||||
|
fieldLabel: ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
var grdpnlMain = new Ext.grid.GridPanel({
|
||||||
|
id: "grdpnlMain",
|
||||||
|
|
||||||
|
store: storeCron,
|
||||||
|
colModel: cmodel,
|
||||||
|
selModel: smodel,
|
||||||
|
|
||||||
|
columnLines: true,
|
||||||
|
viewConfig: {forceFit: true},
|
||||||
|
enableColumnResize: true,
|
||||||
|
enableHdMenu: false,
|
||||||
|
plugins: expander,
|
||||||
|
|
||||||
|
tbar: [
|
||||||
|
{xtype: "tbtext", text: _("ID_CRON_STATUS") + ": "},
|
||||||
|
{xtype: "tbtext", html: "<b>" + CRON.status + "</b>"},
|
||||||
|
"-",
|
||||||
|
btnInfoView,
|
||||||
|
btnLogClear,
|
||||||
|
//"-",
|
||||||
|
//btnView,
|
||||||
|
"->",
|
||||||
|
{xtype: "tbtext", text: _("ID_WORKSPACE") + " "},
|
||||||
|
cboWorkspace,
|
||||||
|
"-",
|
||||||
|
{xtype: "tbtext", text: _("ID_STATUS") + " "},
|
||||||
|
cboStatus,
|
||||||
|
"-",
|
||||||
|
{xtype: "tbtext", text: _("ID_FROM") + " "},
|
||||||
|
dateFrom,
|
||||||
|
" ",
|
||||||
|
{xtype: "tbtext", text: _("ID_TO") + " "},
|
||||||
|
dateTo,
|
||||||
|
" ",
|
||||||
|
{
|
||||||
|
xtype: "button",
|
||||||
|
text: _("ID_FILTER"),
|
||||||
|
|
||||||
|
handler: function ()
|
||||||
|
{
|
||||||
|
pagingCron.moveFirst();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
" ",
|
||||||
|
{
|
||||||
|
xtype: "button",
|
||||||
|
text: _("ID_RESET"),
|
||||||
|
|
||||||
|
handler: function ()
|
||||||
|
{
|
||||||
|
Ext.getCmp("dateFrom").reset(),
|
||||||
|
Ext.getCmp("dateTo").reset()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
bbar: pagingCron,
|
||||||
|
|
||||||
|
title: _("ID_CRON_ACTIONS_LOG"),
|
||||||
|
|
||||||
|
listeners: {
|
||||||
|
rowdblclick: function ()
|
||||||
|
{
|
||||||
|
logView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//Initialize events
|
||||||
|
storeCron.load();
|
||||||
|
|
||||||
|
cboPageSize.setValue(pageSize);
|
||||||
|
|
||||||
|
//Load all panels
|
||||||
|
var viewport = new Ext.Viewport({
|
||||||
|
layout: "fit",
|
||||||
|
autoScroll: false,
|
||||||
|
items: [grdpnlMain]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ext.onReady(cron.application.init, cron.application);
|
||||||
Reference in New Issue
Block a user