BUG 5488 "case inbox refresh time should be configurable..." SOLVED

- New feature
- Case inbox refresh time should be configurable
- Added new feature
* Available from version 2.0.45
This commit is contained in:
Victor Saisa Lopez
2012-09-26 16:28:33 -04:00
parent ea6f57fc3c
commit d3ae88672f
5 changed files with 386 additions and 321 deletions

View File

@@ -311,34 +311,44 @@ class Configurations // extends Configuration
* @author Enrique Ponce de Leon enrique@colosa.com
* @return FORMATS array
*/
function getFormats(){
public function getFormats()
{
if (!isset($this->UserConfig)) {
$this->UserConfig = $this->getConfiguration('ENVIRONMENT_SETTINGS', '');
$this->UserConfig = $this->getConfiguration("ENVIRONMENT_SETTINGS", "");
}
// setting defaults
if (!isset($this->UserConfig['format'])) {
$this->UserConfig['format'] = '@lastName, @firstName (@userName)';
//Setting defaults
if (!isset($this->UserConfig["format"])) {
$this->UserConfig["format"] = "@lastName, @firstName (@userName)";
}
if (!isset($this->UserConfig['dateFormat'])) {
$this->UserConfig['dateFormat'] = 'Y-m-d H:i:s';
if (!isset($this->UserConfig["dateFormat"])) {
$this->UserConfig["dateFormat"] = "Y-m-d H:i:s";
}
if (!isset($this->UserConfig['casesListDateFormat'])) {
$this->UserConfig['casesListDateFormat'] = 'Y-m-d H:i:s';
if (!isset($this->UserConfig["startCaseHideProcessInf"])) {
$this->UserConfig["startCaseHideProcessInf"] = false;
}
if (!isset($this->UserConfig['casesListRowNumber'])) {
$this->UserConfig['CasesListRowNumber'] = '25';
if (!isset($this->UserConfig["casesListDateFormat"])) {
$this->UserConfig["casesListDateFormat"] = "Y-m-d H:i:s";
}
if (!isset($this->UserConfig['startCaseHideProcessInf'])) {
$this->UserConfig['startCaseHideProcessInf'] = false;
if (!isset($this->UserConfig["casesListRowNumber"])) {
$this->UserConfig["casesListRowNumber"] = 25;
}
$this->UserConfig['TimeZone'] = date('T');
if (!isset($this->UserConfig["casesListRefreshTime"]) ||
(isset($this->UserConfig["casesListRefreshTime"]) && empty($this->UserConfig["casesListRefreshTime"]))
) {
$this->UserConfig["casesListRefreshTime"] = 120; //2 minutes
}
$this->UserConfig["TimeZone"] = date("T");
return $this->UserConfig;
}
/**
* setConfig
*
@@ -545,4 +555,4 @@ class Configurations // extends Configuration
return $this->aConfig;
}
}
?>

View File

@@ -23,53 +23,64 @@
*
*/
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('cases/main', false ); //adding a javascript file .js
$oHeadPublisher->addContent( 'cases/main'); //adding a html file .html.
G::LoadClass("configuration");
$keyMem = 'USER_PREFERENCES'.$_SESSION['USER_LOGGED'];
$memcache = & PMmemcached::getSingleton(SYS_SYS);
if ( ($arrayConfig = $memcache->get($keyMem)) === false ) {
G::loadClass('configuration');
$oConf = new Configurations;
$oConf->loadConfig($x, 'USER_PREFERENCES','','',$_SESSION['USER_LOGGED'],'');
$arrayConfig = $oConf->aConfig;
$memcache->set( $keyMem, $arrayConfig, PMmemcached::ONE_HOUR);
}
$confDefaultOption='';
if( isset($arrayConfig['DEFAULT_CASES_MENU']) ){ #this user has a configuration record
$confDefaultOption = $arrayConfig['DEFAULT_CASES_MENU'];
$conf = new Configurations();
$oHeadPublisher = &headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript("cases/main", false); //Adding a javascript file .js
$oHeadPublisher->addContent("cases/main"); //Adding a html file .html.
$keyMem = "USER_PREFERENCES" . $_SESSION["USER_LOGGED"];
$memcache = &PMmemcached::getSingleton(SYS_SYS);
if (($arrayConfig = $memcache->get($keyMem)) === false) {
$conf->loadConfig($x, "USER_PREFERENCES", "", "", $_SESSION["USER_LOGGED"], "");
$arrayConfig = $conf->aConfig;
$memcache->set($keyMem, $arrayConfig, PMmemcached::ONE_HOUR);
}
$confDefaultOption = "";
if (isset($arrayConfig["DEFAULT_CASES_MENU"])) { //this user has a configuration record
$confDefaultOption = $arrayConfig["DEFAULT_CASES_MENU"];
global $G_TMP_MENU;
$oMenu = new Menu();
$oMenu->load('cases');
$defaultOption = '';
foreach($oMenu->Id as $i=>$id){
if( $id == $confDefaultOption ){
$oMenu->load("cases");
$defaultOption = "";
foreach ($oMenu->Id as $i => $id) {
if ($id == $confDefaultOption) {
$defaultOption = $oMenu->Options[$i];
break;
}
}
$defaultOption = $defaultOption != '' ? $defaultOption : 'casesListExtJs';
$defaultOption = ($defaultOption != "")? $defaultOption : "casesListExtJs";
} else {
$defaultOption = "casesListExtJs";
$confDefaultOption = "CASES_INBOX";
}
if (isset($_GET["id"]) && isset($_GET["id"])) {
$defaultOption = "../cases/open?APP_UID=" . $_GET["id"] . "&DEL_INDEX=" . $_GET["i"];
if (isset($_GET["a"])) {
$defaultOption .= "&action=" . $_GET["a"];
}
else {
$defaultOption = 'casesListExtJs';
$confDefaultOption = 'CASES_INBOX';
}
}
if (isset($_GET['id']) && isset($_GET['id'])) {
$defaultOption = '../cases/open?APP_UID=' . $_GET['id'] . '&DEL_INDEX=' . $_GET['i'];
$oHeadPublisher->assign("defaultOption", $defaultOption); //User menu permissions
$oHeadPublisher->assign("_nodeId", isset($confDefaultOption)? $confDefaultOption : "PM_USERS"); //User menu permissions
$oHeadPublisher->assign("FORMATS", $conf->getFormats());
if (isset($_GET['a'])) {
$defaultOption .= '&action=' . $_GET['a'];
}
}
$_SESSION["current_ux"] = "NORMAL";
$oHeadPublisher->assign( 'defaultOption', $defaultOption); // user menu permissions
$oHeadPublisher->assign( '_nodeId', isset($confDefaultOption)?$confDefaultOption:'PM_USERS'); // user menu permissions
$_SESSION['current_ux'] = 'NORMAL';
G::RenderPage('publish', 'extJs');
G::RenderPage("publish", "extJs");

View File

@@ -1,58 +1,62 @@
<?php
/**
/**
* @author Erik A.O. <erik@colosa.com>
* @date Sept 13th, 2010
*
*/
$request = isset($_POST['request'])? $_POST['request']: (isset($_GET['request'])? $_GET['request']: null);
G::LoadClass("configuration");
switch($request){
case 'getUserMaskList':
G::loadClass('configuration');
$request = isset($_POST["request"])? $_POST["request"] : (isset($_GET["request"])? $_GET["request"] : null);
switch ($request) {
case "getUserMaskList":
$result->rows = Configurations::getUserNameFormats();
print(G::json_encode($result));
break;
case 'getDateFormats':
G::loadClass('configuration');
case "getDateFormats":
$result->rows = Configurations::getDateFormats();
print(G::json_encode($result));
break;
case 'getCasesListDateFormat':
G::loadClass('configuration');
case "getCasesListDateFormat":
$result->rows = Configurations::getDateFormats();;
print(G::json_encode($result));
break;
case 'getCasesListRowNumber':
for($i=10; $i<=50; $i+=5){
$formats[] = Array('id'=>"$i", 'name'=>"$i");
case "getCasesListRowNumber":
for ($i = 10; $i <= 50; $i+=5) {
$formats[] = array("id" => "$i", "name" => "$i");
}
$result->rows = $formats;
print(G::json_encode($result));
break;
case 'save':
case "save":
$conf = new Configurations();
G::LoadClass('configuration');
$conf = new Configurations;
$conf->aConfig = Array(
'format'=>$_POST['userFormat'],
'dateFormat'=>$_POST['dateFormat'],
'casesListDateFormat' =>$_POST['casesListDateFormat'],
'casesListRowNumber' =>$_POST['casesListRowNumber']
$conf->aConfig = array(
"format" => $_POST["userFormat"],
"dateFormat" => $_POST["dateFormat"],
"startCaseHideProcessInf" => ((isset($_POST["hideProcessInf"]))? true : false),
"casesListDateFormat" => $_POST["casesListDateFormat"],
"casesListRowNumber" => intval($_POST["casesListRowNumber"]),
"casesListRefreshTime" => intval($_POST["txtCasesRefreshTime"])
);
$conf->aConfig['startCaseHideProcessInf'] = isset($_POST['hideProcessInf']) ? true : false;
$conf->saveConfig('ENVIRONMENT_SETTINGS', '');
$conf->saveConfig("ENVIRONMENT_SETTINGS", "");
$response = new StdClass();
$response = new stdclass();
$response->success = true;
$response->msg = G::LoadTranslation('ID_SAVED_SUCCESSFULLY');
$response->msg = G::LoadTranslation("ID_SAVED_SUCCESSFULLY");
echo G::json_encode($response);
break;
}
}

View File

@@ -1,5 +1,4 @@
var PANEL_EAST_OPEN = false;
var timerMinutes = 2*60*1000; //every 2 minutes, this should be customized also,
var currentSelectedTreeMenuItem = null;
var centerPanel;
var menuTree;
@@ -313,7 +312,7 @@ Ext.onReady(function(){
treeMenuItemDetail
]
});
mainMenu.setTitle('<a href="#"><img id="refreshNotifiers" src="/images/refresh.gif" onClick="updateCasesTree(); updateCasesView();" /></a>');
mainMenu.setTitle("<div style=\"height: 18px;\"><a href=\"javascript:;\"><img id=\"refreshNotifiers\" src=\"/images/refresh.gif\" onclick=\"updateCasesTree(); updateCasesView();\" /></a></div>");
/**
* Triggers Panel
@@ -529,8 +528,8 @@ Ext.onReady(function(){
menuPanelDetail.hide();
menuPanelDetail.ownerCt.doLayout();
//the starting timer will be triggered after timerMinutes
setTimeout('Timer()', timerMinutes );
//FORMATS.casesListRefreshTime is in seconds
setTimeout("timer()", parseInt(FORMATS.casesListRefreshTime) * 1000);
});
function updateCasesView() {
@@ -583,10 +582,13 @@ function updateCasesTree() {
}
//the timer function will be called after 2 minutes;
function Timer(){
function timer()
{
//FORMATS.casesListRefreshTime is in seconds
updateCasesTree();
updateCasesView();
setTimeout('Timer()', timerMinutes);
setTimeout("timer()", parseInt(FORMATS.casesListRefreshTime) * 1000);
}
Ext.data.DynamicJsonReader = function(config){

View File

@@ -5,6 +5,8 @@ var fsDates;
var fsCases;
var _firstName, _lastName, _userName, _dateSample;
var txtCasesRefreshTime;
Ext.onReady(function() {
Ext.QuickTips.init();
@@ -21,8 +23,10 @@ Ext.onReady(function() {
items: [
{xtype: 'label', fieldLabel: _('IS_USER_NAME_DISPLAY_FORMAT'), id: 'lblFullName', width: 400},
{xtype: 'label', fieldLabel: _('ID_GLOBAL_DATE_FORMAT'), id: 'lblDateFormat', width: 400},
{xtype: 'label', fieldLabel: _('ID_CASE_LIST') +': '+_('ID_CASES_DATE_MASK'), id: 'lblCasesDateFormat', width: 400},
{xtype: 'label', fieldLabel: _('ID_CASE_LIST') +': '+_('ID_CASES_ROW_NUMBER'), id: 'lblCasesRowsList', width: 400}
{xtype: 'label', fieldLabel: _('ID_CASE_LIST') +': '+_('ID_CASES_DATE_MASK'), id: 'lblCasesDateFormat', width: 400}
//,
//{xtype: "label", fieldLabel: _("ID_CASE_LIST") + ": " +_("ID_CASES_ROW_NUMBER"), id: "lblCasesRowsList", width: 400},
//{xtype: "label", fieldLabel: _("ID_CASE_LIST") + ": " + _("ID_REFRESH_TIME_SECONDS"), id: "lblCasesRefreshTime", width: 400}
]
});
@@ -37,14 +41,14 @@ Ext.onReady(function() {
listeners:{
load: function(){
default_format = FORMATS.format;
i = cmbUsernameFormats.store.findExact('id', default_format, 0);
cmbUsernameFormats.setValue(cmbUsernameFormats.store.getAt(i).data.id);
cmbUsernameFormats.setRawValue(cmbUsernameFormats.store.getAt(i).data.name);
i = cmbUsernameFormat.store.findExact('id', default_format, 0);
cmbUsernameFormat.setValue(cmbUsernameFormat.store.getAt(i).data.id);
cmbUsernameFormat.setRawValue(cmbUsernameFormat.store.getAt(i).data.name);
}
}
});
cmbUsernameFormats = new Ext.form.ComboBox({
cmbUsernameFormat = new Ext.form.ComboBox({
fieldLabel : _('IS_USER_NAME_DISPLAY_FORMAT'),
hiddenName : 'userFormat',
store : storeUsernameFormat,
@@ -59,9 +63,12 @@ Ext.onReady(function() {
mode:'local',
listeners:{
afterrender:function(){
cmbUsernameFormats.store.load();
cmbUsernameFormat.store.load();
},
select: function(){ChangeSettings('1');}
select: function ()
{
changeSettings(1);
}
}
});
@@ -80,14 +87,14 @@ Ext.onReady(function() {
listeners:{
load: function(){
default_date_format = FORMATS.dateFormat,
i = cmbDateFormats.store.findExact('id', default_date_format, 0);
cmbDateFormats.setValue(cmbDateFormats.store.getAt(i).data.id);
cmbDateFormats.setRawValue(cmbDateFormats.store.getAt(i).data.name);
i = cmbDateFormat.store.findExact('id', default_date_format, 0);
cmbDateFormat.setValue(cmbDateFormat.store.getAt(i).data.id);
cmbDateFormat.setRawValue(cmbDateFormat.store.getAt(i).data.name);
}
}
});
cmbDateFormats = new Ext.form.ComboBox({
cmbDateFormat = new Ext.form.ComboBox({
fieldLabel : _('ID_GLOBAL_DATE_FORMAT'),
hiddenName : 'dateFormat',
store : storeDateFormat,
@@ -102,13 +109,16 @@ Ext.onReady(function() {
mode:'local',
listeners:{
afterrender:function(){
cmbDateFormats.store.load();
cmbDateFormat.store.load();
},
select: function(){ChangeSettings('2');}
select: function ()
{
changeSettings(2);
}
}
});
storeCaseUserNameFormat = new Ext.data.Store({
storeCasesDateFormat = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : 'environmentSettingsAjax?request=getCasesListDateFormat',
method : 'POST'
@@ -123,17 +133,17 @@ Ext.onReady(function() {
listeners:{
load: function(){
default_caseslist_date_format = FORMATS.casesListDateFormat;
i = cmbCasesDateFormats.store.findExact('id', default_caseslist_date_format, 0);
cmbCasesDateFormats.setValue(cmbCasesDateFormats.store.getAt(i).data.id);
cmbCasesDateFormats.setRawValue(cmbCasesDateFormats.store.getAt(i).data.name);
i = cmbCasesDateFormat.store.findExact('id', default_caseslist_date_format, 0);
cmbCasesDateFormat.setValue(cmbCasesDateFormat.store.getAt(i).data.id);
cmbCasesDateFormat.setRawValue(cmbCasesDateFormat.store.getAt(i).data.name);
}
}
});
cmbCasesDateFormats = new Ext.form.ComboBox({
cmbCasesDateFormat = new Ext.form.ComboBox({
fieldLabel : _('ID_CASES_DATE_MASK'),
hiddenName : 'casesListDateFormat',
store : storeCaseUserNameFormat,
store : storeCasesDateFormat,
valueField : 'id',
displayField : 'name',
triggerAction : 'all',
@@ -144,13 +154,16 @@ Ext.onReady(function() {
mode:'local',
listeners:{
afterrender:function(){
cmbCasesDateFormats.store.load();
cmbCasesDateFormat.store.load();
},
select: function(){ChangeSettings('3');}
select: function ()
{
changeSettings(4);
}
}
});
storeCaseListNumber = new Ext.data.Store({
storeCasesRowNumber = new Ext.data.Store({
proxy : new Ext.data.HttpProxy( {
url : 'environmentSettingsAjax?request=getCasesListRowNumber',
method : 'POST'
@@ -163,21 +176,17 @@ Ext.onReady(function() {
]
}),
listeners:{
load: function(){
default_caseslist_row_number = FORMATS.casesListRowNumber;
i = cmbCasesRowsPerPage.store.findExact('id', default_caseslist_row_number, 0);
if( i != -1 ){
cmbCasesRowsPerPage.setValue(cmbCasesRowsPerPage.store.getAt(i).data.id);
cmbCasesRowsPerPage.setRawValue(cmbCasesRowsPerPage.store.getAt(i).data.name);
}
load: function ()
{
cmbCasesRowNumber.setValue(FORMATS.casesListRowNumber + "");
}
}
});
cmbCasesRowsPerPage = new Ext.form.ComboBox({
cmbCasesRowNumber = new Ext.form.ComboBox({
fieldLabel : _('ID_CASES_ROW_NUMBER'),
hiddenName : 'casesListRowNumber',
store : storeCaseListNumber,
store : storeCasesRowNumber,
valueField : 'id',
displayField : 'name',
triggerAction : 'all',
@@ -188,22 +197,42 @@ Ext.onReady(function() {
mode:'local',
listeners:{
afterrender:function(){
cmbCasesRowsPerPage.store.load();
cmbCasesRowNumber.store.load();
},
select: function(){ChangeSettings('4');}
select: function ()
{
changeSettings(5);
}
}
});
txtCasesRefreshTime = new Ext.form.TextField({
id: "txtCasesRefreshTime",
name: "txtCasesRefreshTime",
value: FORMATS.casesListRefreshTime,
fieldLabel: _("ID_REFRESH_TIME_SECONDS"),
maskRe: /^\d*$/,
enableKeyEvents: true,
listeners: {
keyup: function (txt, e)
{
changeSettings(6);
}
}
});
fsNames = new Ext.form.FieldSet({
title: _('ID_PM_ENV_SETTINGS_USERFIELDSET_TITLE'),
labelAlign: 'right',
items: [cmbUsernameFormats]
items: [cmbUsernameFormat]
});
fsDates = new Ext.form.FieldSet({
title: _('ID_PM_ENV_SETTINGS_REGIONFIELDSET_TITLE'),
labelAlign: 'right',
items: [cmbDateFormats]
items: [cmbDateFormat]
});
fsCases = new Ext.form.FieldSet({
@@ -228,9 +257,9 @@ Ext.onReady(function() {
]
}),
new Ext.form.FieldSet({
title: _('ID_CASES_LIST_SETUP'),
labelAlign: 'right',
items: [cmbCasesDateFormats,cmbCasesRowsPerPage]
title: _("ID_CASES_LIST_SETUP"),
labelAlign: "right",
items: [cmbCasesDateFormat, cmbCasesRowNumber, txtCasesRefreshTime]
})
]
});
@@ -265,7 +294,7 @@ Ext.onReady(function() {
buttons : [saveButton]
});
LoadSamples();
loadSamples();
/*viewport = new Ext.Viewport({
layout: 'fit',
@@ -279,32 +308,41 @@ Ext.onReady(function() {
});
//Load Samples Label
LoadSamples = function(){
Ext.getCmp('lblFullName').setText(_FNF(_userName, _firstName, _lastName, FORMATS.format));
Ext.getCmp('lblDateFormat').setText(_DF(_dateSample, FORMATS.dateFormat));
Ext.getCmp('lblCasesDateFormat').setText(_DF(_dateSample, FORMATS.casesListDateFormat, FORMATS.casesListDateFormat));
Ext.getCmp('lblCasesRowsList').setText(FORMATS.casesListRowNumber);
loadSamples = function ()
{
Ext.getCmp("lblFullName").setText(_FNF(_userName, _firstName, _lastName, FORMATS.format));
Ext.getCmp("lblDateFormat").setText(_DF(_dateSample, FORMATS.dateFormat));
Ext.getCmp("lblCasesDateFormat").setText(_DF(_dateSample, FORMATS.casesListDateFormat, FORMATS.casesListDateFormat));
//Ext.getCmp("lblCasesRowsList").setText(FORMATS.casesListRowNumber);
//Ext.getCmp("lblCasesRefreshTime").setText(FORMATS.casesListRefreshTime);
};
//Change Some Setting
ChangeSettings = function(iType){
changeSettings = function (iType)
{
saveButton.enable();
switch (iType){
case '1':
_format = cmbUsernameFormats.getValue();
Ext.getCmp('lblFullName').setText(_FNF(_userName,_firstName,_lastName, _format));
switch (iType) {
case 1:
var f = FORMATS.format;
FORMATS.format = cmbUsernameFormat.getValue();
Ext.getCmp("lblFullName").setText(_FNF(_userName, _firstName, _lastName, cmbUsernameFormat.getValue()));
FORMATS.format = f;
break;
case '2':
_format = cmbDateFormats.getValue();
Ext.getCmp('lblDateFormat').setText(_DF(_dateSample,_format));
case 2:
Ext.getCmp("lblDateFormat").setText(_DF(_dateSample, cmbDateFormat.getValue()));
break;
case '3':
_format = cmbCasesDateFormats.getValue();
Ext.getCmp('lblCasesDateFormat').setText(_DF(_dateSample,_format));
case 3:
break;
case '4':
_format = cmbCasesRowsPerPage.getValue();
Ext.getCmp('lblCasesRowsList').setText(_format);
case 4:
Ext.getCmp("lblCasesDateFormat").setText(_DF(_dateSample, cmbCasesDateFormat.getValue()));
break;
case 5:
//Ext.getCmp("lblCasesRowsList").setText(cmbCasesRowNumber.getValue());
break;
case 6:
//Ext.getCmp("lblCasesRefreshTime").setText(txtCasesRefreshTime.getValue());
break;
}
};