BUG 000 Validacion para prevenir un error JS cuando el objeto parent no existe

- Cuando el contenido de un iframe (como los listados) es abierto en una ventana nueva y se accede
a los casos da un error JS porque se trata de acceder a un metodo del parent, que en este caso no existe

- Se agrego una validacion para prevenir este error
This commit is contained in:
Julio Cesar Laura
2012-04-17 12:10:57 -04:00
parent 0a84f9aed7
commit 8811f605ae
3 changed files with 29 additions and 14 deletions

View File

@@ -83,7 +83,12 @@ $G_SUB_MENU = 'caseOptions';
$G_ID_MENU_SELECTED = 'CASES';
$G_ID_SUB_MENU_SELECTED = '_';
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptCode("parent.showCaseNavigatorPanel('{$Fields['APP_STATUS']}}')");
$oHeadPublisher->addScriptCode("
if (typeof parent != 'undefined') {
if (parent.showCaseNavigatorPanel) {
parent.showCaseNavigatorPanel('{$Fields['APP_STATUS']}}');
}
}");
$oHeadPublisher->addScriptCode('
var Cse = {};
Cse.panels = {};

View File

@@ -51,7 +51,7 @@
/* Prepare page before to show */
$oCase = new Cases();
$Fields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] );
$Fields = $oCase->loadCase( $_SESSION['APPLICATION'], $_SESSION['INDEX'] );
$participated = $oCase->userParticipatedInCase($_GET['APP_UID'], $_SESSION['USER_LOGGED']);
if ($RBAC->userCanAccess('PM_ALLCASES') < 0 && $participated == 0) {
@@ -73,19 +73,24 @@
$Fields['STATUS'] = ucfirst(strtolower(G::LoadTranslation('ID_CANCELLED')));
break;
}
//$Fields['STATUS'] = $aRow['APP_TYPE'];
}
$actions = 'false';
if( $_GET['action'] == 'paused')
$actions = 'true';
/* Render page */
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptCode("parent.showCaseNavigatorPanel('{$Fields['APP_STATUS']}')");
$oHeadPublisher->addScriptCode("
if (typeof parent != 'undefined') {
if (parent.showCaseNavigatorPanel) {
parent.showCaseNavigatorPanel('{$Fields['APP_STATUS']}}');
}
}");
$oHeadPublisher->addScriptCode('
var Cse = {};
Cse.panels = {};
@@ -98,9 +103,9 @@
leimnud.Package.Load("processmap",{Type:"file",Absolute:true,Path:"/jscore/processmap/core/processmap.js"});
leimnud.exec(leimnud.fix.memoryLeak);
');
require_once 'classes/model/Process.php';
$objProc = new Process();
$aProc = $objProc->load($Fields['PRO_UID' ] );
$Fields['PRO_TITLE'] = $aProc['PRO_TITLE'];
@@ -108,7 +113,7 @@
$objTask = new Task();
$aTask = $objTask->load($Fields['TAS_UID' ] );
$Fields['TAS_TITLE'] = $aTask['TAS_TITLE'];
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptFile('/jscore/cases/core/cases_Step.js');
$G_PUBLISH = new Publisher;

View File

@@ -64,7 +64,12 @@
$Fields = $oCase->loadCase($_SESSION['APPLICATION']);
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptCode("parent.showCaseNavigatorPanel('{$Fields['APP_STATUS']}');");
$oHeadPublisher->addScriptCode("
if (typeof parent != 'undefined') {
if (parent.showCaseNavigatorPanel) {
parent.showCaseNavigatorPanel('{$Fields['APP_STATUS']}}');
}
}");
// DEPRECATED this script call is marked for removal since almost all the interface is extJS based
$oHeadPublisher->addScriptCode('
var Cse = {};
@@ -90,11 +95,11 @@
$_SESSION['STEP_POSITION'] = (int)$_GET['position'];
//Obtain previous and next step - Start
if(isset($_GET['type']))
if(isset($_GET['type']))
$sType = $_GET['type'];
else
else
$sType = '';
try {
$aNextStep = $oCase->getNextSupervisorStep($_SESSION['PROCESS'], $_SESSION['STEP_POSITION'], $sType);
$aPreviousStep = $oCase->getPreviousSupervisorStep($_SESSION['PROCESS'], $_SESSION['STEP_POSITION'], $sType);