fixes for IE compatibility

This commit is contained in:
Erik Amaru Ortiz
2011-02-09 21:21:33 +00:00
parent fc057e5a68
commit 4d87945eaf
5 changed files with 212 additions and 83 deletions

View File

@@ -59,6 +59,30 @@ PMExtJSCommon = function() {
{
Ext.msgBoxSlider.msg(title, msg);
}
this.getBrowser = function()
{
var browsersList = new Array("opera", "msie", "firefox", "opera", "safari");
var browserMeta = navigator.userAgent.toLowerCase();
var name = 'Unknow';
var version = '';
var screen = {
width : Ext.getBody().getViewSize().width,
height : Ext.getBody().getViewSize().height
};
var so = Ext.isLinux ? 'Linux' : ( Ext.isWindows ? 'Windows' : (Ext.isMac ? 'Mac OS' : 'Unknow') );
for (var i = 0; i < browsersList.length; i++){
if ((name == "") && (browserMeta.indexOf(browsersList[i]) != -1)){
name = browsersList[i];
version = String(parseFloat(browserMeta.substr(browserMeta.indexOf(browsersList[i]) + browsersList[i].length + 1)));
break;
}
}
return {name:name, version:version, screen: screen}
}
}
var PMExt = new PMExtJSCommon();
@@ -117,31 +141,37 @@ function _(ID_LABEL)
return trn;
}
var getBrowserInf = function(){
var getBrowserInf = function()
{
var sBrowser = "";
var screen;
var aBrowFull = new Array("opera", "msie", "firefox", "opera", "safari");
var sInfo = navigator.userAgent.toLowerCase();
var sBrowser = "";
var screen;
var screen;
var wSize = [0, 0];
if (typeof window.innerWidth != 'undefined'){
wSize = [
window.innerWidth,
window.innerHeight
];
} else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0){
wSize = [
document.documentElement.clientWidth,
document.documentElement.clientHeight
];
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
width = window.innerWidth;
height = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
width = document.documentElement.clientWidth;
height = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
width = document.body.clientWidth;
height = document.body.clientHeight;
} else {
wSize = [
document.getElementsByTagName('body')[0].clientWidth,
document.getElementsByTagName('body')[0].clientHeight
];
width = document.getElementsByTagName('body')[0].clientWidth;
height = document.getElementsByTagName('body')[0].clientHeight;
}
screen = {width:wSize[0], height:wSize[1]};
screen = {width:width, height:height};
//screen = { width: Ext.getBody().getViewSize().width, height:Ext.getBody().getViewSize().height};
for (var i = 0; i < aBrowFull.length; i++){
if ((sBrowser == "") && (sInfo.indexOf(aBrowFull[i]) != -1)){
@@ -153,7 +183,6 @@ var getBrowserInf = function(){
return {name:'unknow', version:'', screen: screen}
};
var _BROWSER = getBrowserInf();
/**
* Environment Formats function for full name

View File

@@ -28,6 +28,14 @@
* @date Jan 3th, 2010
*/
require_once 'classes/model/Application.php';
require_once 'classes/model/Users.php';
require_once 'classes/model/AppThread.php';
require_once 'classes/model/AppDelay.php';
require_once 'classes/model/Process.php';
require_once 'classes/model/Task.php';
G::LoadClass('case');
$action = $_REQUEST['action'];
$ajax = new Ajax();
$ajax->$action();
@@ -193,11 +201,6 @@ class Ajax
function getActionOptions()
{
require_once 'classes/model/AppThread.php';
require_once 'classes/model/AppDelay.php';
G::LoadClass('tree');
G::LoadClass('case');
$APP_UID = $_SESSION['APPLICATION'];
$c = new Criteria('workflow');
@@ -210,16 +213,6 @@ class Ajax
$oCase = new Cases();
$aFields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] );
$oCriteria = new Criteria('workflow');
$oCriteria->add(AppDelayPeer::APP_UID, $_SESSION['APPLICATION']);
$oCriteria->add(AppDelayPeer::APP_DEL_INDEX, $_SESSION['INDEX']);
$oCriteria->add(AppDelayPeer::APP_TYPE, 'PAUSE');
$oCriteria->add(AppDelayPeer::APP_DISABLE_ACTION_USER, null);
$oDataset = AppDelayPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aRow = $oDataset->getRow();
GLOBAL $RBAC;
$options = Array();
@@ -227,7 +220,7 @@ class Ajax
switch($aFields['APP_STATUS'])
{
case 'DRAFT':
if( !$aRow ) {
if( ! AppDelay::isPaused($_SESSION['APPLICATION'], $_SESSION['INDEX']) ) {
$options[] = Array('text'=>G::LoadTranslation('ID_PAUSED_CASE'), 'fn'=>'setUnpauseCaseDate');
} else {
$options[] = Array('text'=>G::LoadTranslation('ID_UNPAUSE'), 'fn'=>'unpauseCase');
@@ -241,7 +234,7 @@ class Ajax
break;
case 'TO_DO':
if(!$aRow) {
if( ! AppDelay::isPaused($_SESSION['APPLICATION'], $_SESSION['INDEX']) ) {
$options[] = Array('text'=>G::LoadTranslation('ID_PAUSED_CASE'), 'fn'=>'setUnpauseCaseDate');
if ($cant == 1) {
@@ -261,12 +254,13 @@ class Ajax
break;
}
if( $_SESSION['TASK'] != '-1' ) {
$oTask = new Task();
$aTask = $oTask->load($_SESSION['TASK']);
if ($aTask['TAS_TYPE'] == 'ADHOC') {
$options[] = Array('text'=>G::LoadTranslation('ID_ADHOC_ASSIGNMENT'), 'fn'=>'');
}
}
print(G::json_encode($options));
}
@@ -372,7 +366,6 @@ class Ajax
function getProcessInformation()
{
require_once 'classes/model/Process.php';
$process = new Process();
$processData = $process->load($_SESSION['PROCESS']);
require_once 'classes/model/Users.php';
@@ -391,7 +384,6 @@ class Ajax
function getTaskInformation()
{
require_once 'classes/model/Task.php';
$task = new Task();
$taskData = $task->getDelegatedTaskData($_SESSION['TASK'], $_SESSION['APPLICATION'], $_SESSION['INDEX']);
@@ -401,7 +393,6 @@ class Ajax
function caseHistory()
{
global $G_PUBLISH;
G::LoadClass("case");
$c = Cases::getTransferHistoryCriteria($_SESSION['APPLICATION']);
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'cases/cases_TransferHistory', $c, array());
@@ -411,7 +402,6 @@ class Ajax
function messageHistory()
{
global $G_PUBLISH;
G::LoadClass("case");
$oCase = new Cases();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'cases/cases_Messages', $oCase->getHistoryMessagesTracker($_SESSION['APPLICATION']));
@@ -421,7 +411,6 @@ class Ajax
function dynaformHistory()
{
global $G_PUBLISH;
G::LoadClass("case");
$oCase = new Cases();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'cases/cases_AllDynaformsList', $oCase->getallDynaformsCriteria($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['TASK'], $_SESSION['USER_LOGGED']));
@@ -431,7 +420,6 @@ class Ajax
function uploadedDocuments()
{
global $G_PUBLISH;
G::LoadClass("case");
$oCase = new Cases();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'cases/cases_AllInputdocsList', $oCase->getAllUploadedDocumentsCriteria($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['TASK'], $_SESSION['USER_LOGGED']));
@@ -441,7 +429,6 @@ class Ajax
function generatedDocuments()
{
global $G_PUBLISH;
G::LoadClass("case");
$oCase = new Cases();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'cases/cases_AllOutputdocsList', $oCase->getAllGeneratedDocumentsCriteria($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['TASK'], $_SESSION['USER_LOGGED']));
@@ -450,7 +437,6 @@ class Ajax
function cancelCase()
{
G::LoadClass("case");
$oCase = new Cases();
$multiple = false;
@@ -479,7 +465,6 @@ class Ajax
function getUsersToReassign()
{
G::LoadClass("case");
$case = new Cases();
$result->data = $case->getUsersToReassign($_SESSION['TASK'], $_SESSION['USER_LOGGED']);
@@ -489,9 +474,6 @@ class Ajax
function reassignCase()
{
require_once 'classes/model/Application.php';
require_once 'classes/model/Users.php';
G::LoadClass("case");
$cases = new Cases();
$user = new Users();
$app = new Application();
@@ -518,7 +500,6 @@ class Ajax
function pauseCase()
{
try{
G::LoadClass("case");
$unpauseDate = $_REQUEST['unpauseDate'];
$oCase = new Cases();
if( isset($_POST['APP_UID']) && isset($_POST['DEL_INDEX']) ) {
@@ -547,4 +528,69 @@ class Ajax
echo G::json_encode($result);
}
function unpauseCase()
{
try{
$applicationUID = (isset($_POST['APP_UID'])) ? $_POST['APP_UID'] : $_SESSION['APPLICATION'];
$delIndex = (isset($_POST['DEL_INDEX'])) ? $_POST['DEL_INDEX'] : $_SESSION['INDEX'];
$oCase = new Cases();
$oCase->unpauseCase($applicationUID, $delIndex, $_SESSION['USER_LOGGED']);
$app = new Application();
$caseData = $app->load($applicationUID);
$data['APP_NUMBER'] = $caseData['APP_NUMBER'];
$result->success = true;
$result->msg = G::LoadTranslation('ID_CASE_UNPAUSED_SUCCESSFULLY', SYS_LANG, $data);
} catch(Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
print G::json_encode($result);
}
function deleteCase()
{
try{
$applicationUID = (isset($_POST['APP_UID'])) ? $_POST['APP_UID'] : $_SESSION['APPLICATION'];
$app = new Application();
$caseData = $app->load($applicationUID);
$data['APP_NUMBER'] = $caseData['APP_NUMBER'];
$oCase = new Cases();
$oCase->removeCase($applicationUID);
$result->success = true;
$result->msg = G::LoadTranslation('ID_CASE_DELETED_SUCCESSFULLY', SYS_LANG, $data);
} catch(Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
print G::json_encode($result);
}
function reactivateCase()
{
try{
$applicationUID = (isset($_POST['APP_UID'])) ? $_POST['APP_UID'] : $_SESSION['APPLICATION'];
$delIndex = (isset($_POST['DEL_INDEX'])) ? $_POST['DEL_INDEX'] : $_SESSION['INDEX'];
$app = new Application();
$caseData = $app->load($applicationUID);
$data['APP_NUMBER'] = $caseData['APP_NUMBER'];
$oCase = new Cases();
$oCase->reactivateCase($applicationUID, $delIndex, $_SESSION['USER_LOGGED']);
$result->success = true;
$result->msg = G::LoadTranslation('ID_CASE_REACTIVATED_SUCCESSFULLY', SYS_LANG, $data);
} catch(Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
print G::json_encode($result);
}
}

View File

@@ -77,9 +77,13 @@
//$Fields['STATUS'] = $aRow['APP_TYPE'];
}
$actions = 'false';
if( $_GET['action'] == 'paused' || $_GET['action'] == 'search')
$actions = 'true';
/* Render page */
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptCode("parent.showCaseNavigatorPanel(false, true, false)");
$oHeadPublisher->addScriptCode("parent.showCaseNavigatorPanel(false, true, $actions)");
$oHeadPublisher->addScriptCode('
var Cse = {};
Cse.panels = {};

View File

@@ -16,6 +16,7 @@ new Ext.KeyMap(document, {
});
Ext.onReady ( function() {
var _BROWSER = getBrowserInf();
workflow = new MyWorkflow("paintarea");
workflow.setEnableSmoothFigureHandling(false);
@@ -135,7 +136,7 @@ Ext.onReady ( function() {
frameConfig:{name:'designerFrame', id:'designerFrame'},
defaultSrc : 'designer?PRO_UID=' + pro_uid,
loadMask:{msg:'Loading...'},
bodyStyle:{height: (_BROWSER.screen.height-55) + 'px'},
bodyStyle:{height: (PMExt.getBrowser().screen.height-55) + 'px'},
width:'1024px'
};

View File

@@ -182,7 +182,7 @@ Ext.onReady(function(){
frameConfig:{name:'openCaseFrame', id:'openCaseFrame'},
defaultSrc : uri,
loadMask:{msg:'Loading...'},
bodyStyle:{height: (_BROWSER.screen.height-55) + 'px', overflow:'scroll'},
bodyStyle:{height: (PMExt.getBrowser().screen.height-55) + 'px', overflow:'scroll'},
width:'1024px'
}/*{
@@ -549,7 +549,7 @@ Ext.onReady(function(){
id: 'submitPauseCase',
text : 'Pause Case',
handler : Actions.pauseCase,
disabled:false,
disabled:false
},{
text : 'Cancel',
handler : function() {
@@ -602,7 +602,7 @@ Ext.onReady(function(){
parent.notify('PAUSE CASE', req.result.msg);
location.href = 'casesListExtJs';
} else {
PMExt.error('Error', req.result.msg);
PMExt.error(_('ID_ERROR'), req.result.msg);
}
}
});
@@ -610,18 +610,47 @@ Ext.onReady(function(){
Actions.unpauseCase = function()
{
PMExt.confirm(_('ID_CONFIRM'), _('ID_CONFIRM_UNPAUSE_CASE'), function(){
var loadMask = new Ext.LoadMask(document.body, {msg:'Unpausing case...'});
loadMask.show();
Ext.Ajax.request({
url : 'ajaxListener' ,
params : { action : 'unpauseCase' },
success: function ( result, request ) {
loadMask.hide();
var data = Ext.util.JSON.decode(result.responseText);
if( data.success ) {
parent.PMExt.notify(_('ID_UNPAUSE_ACTION'), data.msg);
location.href = 'casesListExtJs';
} else {
PMExt.error(_('ID_ERROR'), data.msg);
}
},
failure: function ( result, request) {
Ext.MessageBox.alert('Failed', result.responseText);
}
});
});
}
Actions.deleteCase = function()
{
PMExt.confirm(_('ID_CONFIRM'), _('ID_CONFIRM_DELETE_CASE'), function(){
var loadMask = new Ext.LoadMask(document.body, {msg:'Deleting case...'});
loadMask.show();
Ext.Ajax.request({
url : 'ajaxListener' ,
params : { action : 'deleteCase' },
success: function ( result, request ) {
parent.notify('', 'The case ' + parent._CASE_TITLE + ' was cancelled!');
loadMask.hide();
var data = Ext.util.JSON.decode(result.responseText);
if( data.success ) {
parent.PMExt.notify(_('ID_DELETE_ACTION'), data.msg);
location.href = 'casesListExtJs';
} else {
PMExt.error(_('ID_ERROR'), data.msg);
}
},
failure: function ( result, request) {
Ext.MessageBox.alert('Failed', result.responseText);
@@ -632,7 +661,27 @@ Ext.onReady(function(){
Actions.reactivateCase = function()
{
PMExt.confirm(_('ID_CONFIRM'), _('ID_CONFIRM_REACTIVATE_CASE'), function(){
var loadMask = new Ext.LoadMask(document.body, {msg:'Reactivating case...'});
loadMask.show();
Ext.Ajax.request({
url : 'ajaxListener' ,
params : { action : 'reactivateCase' },
success: function ( result, request ) {
loadMask.hide();
var data = Ext.util.JSON.decode(result.responseText);
if( data.success ) {
parent.PMExt.notify(_('ID_REACTIVATE_ACTION'), data.msg);
location.href = 'casesListExtJs';
} else {
PMExt.error(_('ID_ERROR'), data.msg);
}
},
failure: function ( result, request) {
Ext.MessageBox.alert('Failed', result.responseText);
}
});
});
}
//