From 991709f17f567c97cbb74abda6fb8f726531c7c9 Mon Sep 17 00:00:00 2001 From: Fabio Guachalla Date: Thu, 5 Apr 2018 09:53:33 -0400 Subject: [PATCH] PMC-60 --- .../methods/cases/cases_CatchSelfService.php | 169 ++++----- workflow/engine/methods/cases/open.php | 56 +-- .../skinEngine/base/css/pmos-xtheme-gray.css | 70 ++++ .../neoclassic/css/pmos-xtheme-gray.css | 70 ++++ .../uxmodern/css/pmos-xtheme-gray.css | 71 ++++ .../skinEngine/uxs/css/pmos-xtheme-gray.css | 71 ++++ workflow/engine/templates/cases/open.js | 332 ++++++++++++------ 7 files changed, 609 insertions(+), 230 deletions(-) diff --git a/workflow/engine/methods/cases/cases_CatchSelfService.php b/workflow/engine/methods/cases/cases_CatchSelfService.php index 4c7f1f55f..d033f4c65 100644 --- a/workflow/engine/methods/cases/cases_CatchSelfService.php +++ b/workflow/engine/methods/cases/cases_CatchSelfService.php @@ -1,103 +1,110 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - */ -/* Permissions */ +/** Permissions */ switch ($RBAC->userCanAccess('PM_CASES')) { - case - 2: + case -2: G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); G::header('location: ../login/login'); die(); break; - case - 1: + case -1: G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); G::header('location: ../login/login'); die(); break; } -$oCase = new Cases(); -$Fields = $oCase->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX']); - -/* Render page */ +/** Render page */ require_once 'classes/model/Process.php'; require_once 'classes/model/Task.php'; +//Get information about the case +$case = new Cases(); +$fieldsCase = $case->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX']); + +//Get the user logged +$userLogged = isset($RBAC->aUserInfo['USER_INFO']['USR_UID']) ? $RBAC->aUserInfo['USER_INFO']['USR_UID'] : ''; + +//Check the authorization +$objCase = new \ProcessMaker\BusinessModel\Cases(); +$userCanAccess = $objCase->userAuthorization( + $userLogged, + $fieldsCase['PRO_UID'], + $fieldsCase['APP_UID'], + ['PM_ALLCASES'], + ['SUMMARY_FORM' => 'VIEW'] +); + $objProc = new Process(); -$aProc = $objProc->load($Fields['PRO_UID']); -$Fields['PRO_TITLE'] = $aProc['PRO_TITLE']; +$fieldsProcess = $objProc->load($fieldsCase['PRO_UID']); +$fieldsCase['PRO_TITLE'] = $fieldsProcess['PRO_TITLE']; -$objTask = new Task(); -$aTask = $objTask->load($Fields['TAS_UID']); -$Fields['TAS_TITLE'] = $aTask['TAS_TITLE']; +if ( + isset($fieldsProcess['PRO_DYNAFORMS']['PROCESS']) && + !empty($fieldsProcess['PRO_DYNAFORMS']['PROCESS']) && + $userCanAccess['objectPermissions']['SUMMARY_FORM'] && + $objProc->isBpmnProcess($fieldsCase['PRO_UID']) +) { + /**We will to show the custom summary form only for BPMN process*/ + $_REQUEST['APP_UID'] = $fieldsCase['APP_UID']; + $_REQUEST['DEL_INDEX'] = $fieldsCase['DEL_INDEX']; + $_REQUEST['DYN_UID'] = $fieldsProcess['PRO_DYNAFORMS']['PROCESS']; + require_once(PATH_METHODS . 'cases' . PATH_SEP . 'summary.php'); + exit(); +} else { + /**We will to show the default claim case form*/ + $objTask = new Task(); + $fieldsTask = $objTask->load($fieldsCase['TAS_UID']); + $fieldsCase['TAS_TITLE'] = $fieldsTask['TAS_TITLE']; + $fieldsCase['STATUS'] .= ' ( ' . G::LoadTranslation('ID_UNASSIGNED') . ' )'; -$Fields['STATUS'] .= ' ( ' . G::LoadTranslation('ID_UNASSIGNED') . ' )'; + //Now getting information about the PREVIOUS task. If is the first task then no previous, use 1 + $appDelegation = new AppDelegation(); + $appDelegation->Load( + $fieldsCase['APP_UID'], + ($fieldsCase['DEL_PREVIOUS'] == 0 ? $fieldsCase['DEL_PREVIOUS'] = 1 : $fieldsCase['DEL_PREVIOUS']) + ); + $fieldsDelegation = $appDelegation->toArray(BasePeer::TYPE_FIELDNAME); -//now getting information about the PREVIOUS task. If is the first task then no preious, use 1 -$oAppDel = new AppDelegation(); -$oAppDel->Load($Fields['APP_UID'], ($Fields['DEL_PREVIOUS'] == 0 ? $Fields['DEL_PREVIOUS'] = 1 : $Fields['DEL_PREVIOUS'])); + try { + $userInfo = new Users(); + $userInfo->load($fieldsDelegation['USR_UID']); + $fieldsCase['PREVIOUS_USER'] = $userInfo->getUsrFirstname() . ' ' . $userInfo->getUsrLastname(); + } catch (Exception $error) { + $fieldsCase['PREVIOUS_USER'] = G::LoadTranslation('ID_NO_PREVIOUS_USR_UID'); + } -$aAppDel = $oAppDel->toArray(BasePeer::TYPE_FIELDNAME); -try { - $oCurUser = new Users(); - $oCurUser->load($aAppDel['USR_UID']); - $Fields['PREVIOUS_USER'] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname(); -} catch (Exception $oError) { - $Fields['PREVIOUS_USER'] = G::LoadTranslation('ID_NO_PREVIOUS_USR_UID'); + //To enable information (dynaforms, steps) before claim a case + $_SESSION['bNoShowSteps'] = true; + $G_MAIN_MENU = 'processmaker'; + $G_SUB_MENU = 'caseOptions'; + $G_ID_MENU_SELECTED = 'CASES'; + $G_ID_SUB_MENU_SELECTED = '_'; + $headPublisher = headPublisher::getSingleton(); + $headPublisher->addScriptCode(" + if (typeof parent != 'undefined') { + if (parent.showCaseNavigatorPanel) { + parent.showCaseNavigatorPanel('{$fieldsCase['APP_STATUS']}'); + } + } + "); + $headPublisher->addScriptCode(' + var Cse = {}; + Cse.panels = {}; + var leimnud = new maborak(); + leimnud.make(); + leimnud.Package.Load("rpc,drag,drop,panel,app,validator,fx,dom,abbr",{Instance:leimnud,Type:"module"}); + leimnud.Package.Load("cases",{Type:"file",Absolute:true,Path:"/jscore/cases/core/cases.js"}); + leimnud.Package.Load("cases_Step",{Type:"file",Absolute:true,Path:"/jscore/cases/core/cases_Step.js"}); + leimnud.Package.Load("processmap",{Type:"file",Absolute:true,Path:"/jscore/processmap/core/processmap.js"}); + leimnud.exec(leimnud.fix.memoryLeak); + '); + $headPublisher = headPublisher::getSingleton(); + $headPublisher->addScriptFile('/jscore/cases/core/cases_Step.js'); + + $fieldsCase['isIE'] = Bootstrap::isIE(); + + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_CatchSelfService.xml', '', $fieldsCase, 'cases_CatchExecute'); + G::RenderPage('publish', 'blank'); } -$objTask = new Task(); -$aTask = $objTask->load($aAppDel['TAS_UID']); -$Fields['PREVIOUS_TASK'] = $aTask['TAS_TITLE']; - -//To enable information (dynaforms, steps) before claim a case -$_SESSION['bNoShowSteps'] = true; -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'caseOptions'; -$G_ID_MENU_SELECTED = 'CASES'; -$G_ID_SUB_MENU_SELECTED = '_'; -$oHeadPublisher = headPublisher::getSingleton(); -$oHeadPublisher->addScriptCode(" -if (typeof parent != 'undefined') { - if (parent.showCaseNavigatorPanel) { - parent.showCaseNavigatorPanel('{$Fields['APP_STATUS']}'); - } -}"); -$oHeadPublisher->addScriptCode(' - var Cse = {}; - Cse.panels = {}; - var leimnud = new maborak(); - leimnud.make(); - leimnud.Package.Load("rpc,drag,drop,panel,app,validator,fx,dom,abbr",{Instance:leimnud,Type:"module"}); - leimnud.Package.Load("cases",{Type:"file",Absolute:true,Path:"/jscore/cases/core/cases.js"}); - leimnud.Package.Load("cases_Step",{Type:"file",Absolute:true,Path:"/jscore/cases/core/cases_Step.js"}); - leimnud.Package.Load("processmap",{Type:"file",Absolute:true,Path:"/jscore/processmap/core/processmap.js"}); - leimnud.exec(leimnud.fix.memoryLeak); - '); -$oHeadPublisher = headPublisher::getSingleton(); -$oHeadPublisher->addScriptFile('/jscore/cases/core/cases_Step.js'); - -$Fields['isIE'] = Bootstrap::isIE(); - -$G_PUBLISH = new Publisher(); -$G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_CatchSelfService.xml', '', $Fields, 'cases_CatchExecute'); -G::RenderPage('publish', 'blank'); diff --git a/workflow/engine/methods/cases/open.php b/workflow/engine/methods/cases/open.php index 26ee94eec..0b2b9685a 100644 --- a/workflow/engine/methods/cases/open.php +++ b/workflow/engine/methods/cases/open.php @@ -1,32 +1,4 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - */ - -/** - * - * @author Erik Amaru Ortiz - * @date Jan 3th, 2010 - */ $tBarGmail = false; if (isset($_GET['gmail']) && $_GET['gmail'] == 1) { @@ -121,22 +93,29 @@ if (isset($_GET['actionFromList']) && ($_GET['actionFromList'] === 'to_revise')) $script = 'cases_Open?'; } -// getting bpmn projects -$c = new Criteria('workflow'); -$c->addSelectColumn(BpmnProjectPeer::PRJ_UID); -$ds = ProcessPeer::doSelectRS($c); -$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC); -$bpmnProjects = array(); +$process = new Process(); +$fields = $process->load($case['PRO_UID']); +$isBpmn = $fields['PRO_BPMN'] === 1 ? true : false; -while ($ds->next()) { - $row = $ds->getRow(); - $bpmnProjects[] = $row['PRJ_UID']; +$showCustomForm = false; + +/*----------------------------------********---------------------------------*/ + +$respView = $oCase->getAllObjectsFrom($case['PRO_UID'], $appUid, $case['TAS_UID'], $_SESSION['USER_LOGGED'], 'VIEW'); +$viewSummaryForm = isset($respView['SUMMARY_FORM']) && $respView['SUMMARY_FORM'] === 1 ? true : false; +$isNoEmpty = isset($fields['PRO_DYNAFORMS']['PROCESS']) && !empty($fields['PRO_DYNAFORMS']['PROCESS']); + +if ($isBpmn && $viewSummaryForm && $isNoEmpty) { + $showCustomForm = true; } + +/*----------------------------------********---------------------------------*/ + $oStep = new Step(); $oStep = $oStep->loadByProcessTaskPosition($case['PRO_UID'], $case['TAS_UID'], 1); $oHeadPublisher->assign('uri', $script . $uri); $oHeadPublisher->assign('_APP_NUM', '#: ' . $case['APP_NUMBER']); -$oHeadPublisher->assign('_PROJECT_TYPE', in_array($case['PRO_UID'], $bpmnProjects) ? 'bpmn' : 'classic'); +$oHeadPublisher->assign('_PROJECT_TYPE', $isBpmn ? 'bpmn' : 'classic'); $oHeadPublisher->assign('_PRO_UID', $case['PRO_UID']); $oHeadPublisher->assign('_APP_UID', $appUid); $oHeadPublisher->assign('_ENV_CURRENT_DATE', $conf->getSystemDate(date('Y-m-d'))); @@ -144,6 +123,7 @@ $oHeadPublisher->assign('_ENV_CURRENT_DATE_NO_FORMAT', date('Y-m-d-h-i-A')); $oHeadPublisher->assign('idfirstform', is_null($oStep) ? '-1' : $oStep->getStepUidObj()); $oHeadPublisher->assign('appStatus', $case['APP_STATUS']); $oHeadPublisher->assign('tbarGmail', $tBarGmail); +$oHeadPublisher->assign('showCustomForm', $showCustomForm); if (!isset($_SESSION['APPLICATION']) || !isset($_SESSION['TASK']) || !isset($_SESSION['INDEX'])) { $_SESSION['PROCESS'] = $case['PRO_UID']; diff --git a/workflow/engine/skinEngine/base/css/pmos-xtheme-gray.css b/workflow/engine/skinEngine/base/css/pmos-xtheme-gray.css index 87b8593e3..22e902609 100644 --- a/workflow/engine/skinEngine/base/css/pmos-xtheme-gray.css +++ b/workflow/engine/skinEngine/base/css/pmos-xtheme-gray.css @@ -1603,3 +1603,73 @@ padding:3px 3px 3px 5px; white-space:normal; } + +.cancelSummary { + color: #333; + background: #fff; + border:1px #ccc solid; +} +.claimCaseSummary { + color: #ffffff; + background-color: #337ab7; + border:1px #2e6da4 solid; +} +.claimCaseSummary .x-btn-text { + color: #fff; + padding: 6px 6px 6px 6px; + height: 28px !important; + -moz-border-radius: 20px; + -webkit-border-radius: 20px; + border-radius: 20px; +} +.cancelSummary .x-btn-text { + padding: 6px 6px 6px 6px; + height: 25px !important; + -moz-border-radius: 20px; + -webkit-border-radius: 20px; + border-radius: 20px; +} +.claimCaseSummary td { + color: #ffffff; + background: #337ab7; + border-color: #2e6da4; +} +.claimCaseSummary tbody:hover td { + color: #ffffff; + background: #286090; + border-color: #204d74; +} +.cancelSummary td { + color: #333; + background: #fff; +} +.cancelSummary tbody:hover td { + color: #333333; + background: #e6e6e6; + border-color: #adadad; +} +.cancelSummary .claimCaseSummary { + display: inline-block; + padding: 6px 12px; + margin-bottom: 0; + font-size: 12px !important; + font-weight: 400; + line-height: 1.42857143; + text-align: center; + white-space: nowrap; + vertical-align: middle; + -ms-touch-action: manipulation; + touch-action: manipulation; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-image: none; + border: 1px solid transparent; + border-radius: 4px; +} +.navPanelBottom .x-toolbar-cell { + clear: both; + height: 50px; +} \ No newline at end of file diff --git a/workflow/engine/skinEngine/neoclassic/css/pmos-xtheme-gray.css b/workflow/engine/skinEngine/neoclassic/css/pmos-xtheme-gray.css index 17b6db332..d450c5eb9 100644 --- a/workflow/engine/skinEngine/neoclassic/css/pmos-xtheme-gray.css +++ b/workflow/engine/skinEngine/neoclassic/css/pmos-xtheme-gray.css @@ -1795,3 +1795,73 @@ white-space:normal; -moz-border-radius: 5px; vertical-align: middle; } + +.cancelSummary { + color: #333; + background: #fff; + border:1px #ccc solid; +} +.claimCaseSummary { + color: #ffffff; + background-color: #337ab7; + border:1px #2e6da4 solid; +} +.claimCaseSummary .x-btn-text { + color: #fff; + padding: 6px 6px 6px 6px; + height: 28px !important; + -moz-border-radius: 20px; + -webkit-border-radius: 20px; + border-radius: 20px; +} +.cancelSummary .x-btn-text { + padding: 6px 6px 6px 6px; + height: 25px !important; + -moz-border-radius: 20px; + -webkit-border-radius: 20px; + border-radius: 20px; +} +.claimCaseSummary td { + color: #ffffff; + background-color: #337ab7; + border-color: #2e6da4; +} +.claimCaseSummary tbody:hover td { + color: #ffffff; + background-color: #286090; + border-color: #204d74; +} +.cancelSummary td { + color: #333; + background: #fff; +} +.cancelSummary tbody:hover td { + color: #333333; + background-color: #e6e6e6; + border-color: #adadad; +} +.cancelSummary .claimCaseSummary { + display: inline-block; + padding: 6px 12px; + margin-bottom: 0; + font-size: 12px !important; + font-weight: 400; + line-height: 1.42857143; + text-align: center; + white-space: nowrap; + vertical-align: middle; + -ms-touch-action: manipulation; + touch-action: manipulation; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-image: none; + border: 1px solid transparent; + border-radius: 4px; +} +.navPanelBottom .x-toolbar-cell { + clear: both; + height: 50px; +} diff --git a/workflow/engine/skinEngine/uxmodern/css/pmos-xtheme-gray.css b/workflow/engine/skinEngine/uxmodern/css/pmos-xtheme-gray.css index ea0c5ab9a..61a38943a 100644 --- a/workflow/engine/skinEngine/uxmodern/css/pmos-xtheme-gray.css +++ b/workflow/engine/skinEngine/uxmodern/css/pmos-xtheme-gray.css @@ -1631,3 +1631,74 @@ td.x-cnotes-label { color:#848484; text-decoration: none; } + + +.cancelSummary { + color: #333; + background: #fff; + border:1px #ccc solid; +} +.claimCaseSummary { + color: #ffffff; + background-color: #337ab7; + border:1px #2e6da4 solid; +} +.claimCaseSummary .x-btn-text { + color: #fff; + padding: 6px 6px 6px 6px; + height: 28px !important; + -moz-border-radius: 20px; + -webkit-border-radius: 20px; + border-radius: 20px; +} +.cancelSummary .x-btn-text { + padding: 6px 6px 6px 6px; + height: 25px !important; + -moz-border-radius: 20px; + -webkit-border-radius: 20px; + border-radius: 20px; +} +.claimCaseSummary td { + color: #ffffff; + background: #337ab7; + border-color: #2e6da4; +} +.claimCaseSummary tbody:hover td { + color: #ffffff; + background: #286090; + border-color: #204d74; +} +.cancelSummary td { + color: #333; + background: #fff; +} +.cancelSummary tbody:hover td { + color: #333333; + background: #e6e6e6; + border-color: #adadad; +} +.cancelSummary .claimCaseSummary { + display: inline-block; + padding: 6px 12px; + margin-bottom: 0; + font-size: 12px !important; + font-weight: 400; + line-height: 1.42857143; + text-align: center; + white-space: nowrap; + vertical-align: middle; + -ms-touch-action: manipulation; + touch-action: manipulation; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-image: none; + border: 1px solid transparent; + border-radius: 4px; +} +.navPanelBottom .x-toolbar-cell { + clear: both; + height: 50px; +} \ No newline at end of file diff --git a/workflow/engine/skinEngine/uxs/css/pmos-xtheme-gray.css b/workflow/engine/skinEngine/uxs/css/pmos-xtheme-gray.css index a3ec295bd..806279eae 100644 --- a/workflow/engine/skinEngine/uxs/css/pmos-xtheme-gray.css +++ b/workflow/engine/skinEngine/uxs/css/pmos-xtheme-gray.css @@ -1176,3 +1176,74 @@ td.x-cnotes-label { font: 11px arial,tahoma,helvetica,sans-serif; color: #465070; } + + +.cancelSummary { + color: #333; + background: #fff; + border:1px #ccc solid; +} +.claimCaseSummary { + color: #ffffff; + background-color: #337ab7; + border:1px #2e6da4 solid; +} +.claimCaseSummary .x-btn-text { + color: #fff; + padding: 6px 6px 6px 6px; + height: 28px !important; + -moz-border-radius: 20px; + -webkit-border-radius: 20px; + border-radius: 20px; +} +.cancelSummary .x-btn-text { + padding: 6px 6px 6px 6px; + height: 25px !important; + -moz-border-radius: 20px; + -webkit-border-radius: 20px; + border-radius: 20px; +} +.claimCaseSummary td { + color: #ffffff; + background: #337ab7; + border-color: #2e6da4; +} +.claimCaseSummary tbody:hover td { + color: #ffffff; + background: #286090; + border-color: #204d74; +} +.cancelSummary td { + color: #333; + background: #fff; +} +.cancelSummary tbody:hover td { + color: #333333; + background: #e6e6e6; + border-color: #adadad; +} +.cancelSummary .claimCaseSummary { + display: inline-block; + padding: 6px 12px; + margin-bottom: 0; + font-size: 12px !important; + font-weight: 400; + line-height: 1.42857143; + text-align: center; + white-space: nowrap; + vertical-align: middle; + -ms-touch-action: manipulation; + touch-action: manipulation; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-image: none; + border: 1px solid transparent; + border-radius: 4px; +} +.navPanelBottom .x-toolbar-cell { + clear: both; + height: 50px; +} \ No newline at end of file diff --git a/workflow/engine/templates/cases/open.js b/workflow/engine/templates/cases/open.js index 8b8feb00f..dba8e8f7b 100644 --- a/workflow/engine/templates/cases/open.js +++ b/workflow/engine/templates/cases/open.js @@ -1,11 +1,14 @@ -var Actions = {}; -var showCaseNavigatorPanel; -var hideCaseNavigatorPanel; -var informationMenu; -var caseMenuOpen = false; -var menuSelectedTitle = []; -var _ENV_CURRENT_DATE; -var winTree; +var Actions = {}, + hideCaseNavigatorPanel, + informationMenu, + caseMenuOpen = false, + menuSelectedTitle = [], + _ENV_CURRENT_DATE, + winTree, + buttonCancel, + buttonClaimCase, + navPanelBottom, + navPanel; historyGridListChangeLogGlobal = {}; historyGridListChangeLogGlobal.idHistory = ''; @@ -157,7 +160,7 @@ Ext.onReady(function(){ tb.add(menu); } } - + var olink = document.location.href; if(olink.search("gmail") != -1){ Ext.getCmp('stepsMenu').hide(); @@ -350,109 +353,217 @@ Ext.onReady(function(){ setNode(idfirstform); } - var navPanelWest = { - id: 'navPanelWest', - region: 'west', - xtype:'panel', - width: 250, - height: 500, - maxSize: 400, - split: true, - collapsible: false, - margins: '0 0 0 0', - items:[casesStepTree] - } - - var fnChangeStatus =function(){ - alert('loaded'); - } - - var screenWidth = (PMExt.getBrowser().screen.width-140).toString() + 'px'; - - var navPanelCenter = { - id: 'navPanelCenter', - region: 'center', layout:'fit',forceLayout: true, - xtype:'panel', - items:[{ - xtype:"tabpanel", - id: 'caseTabPanel', - deferredRender:false, - defaults:{autoScroll: true}, - defaultType:"iframepanel", - activeTab: 0, - enableTabScroll: true, - //defaults: Ext.apply({}, Ext.isGecko? {style:{position:'absolute'},hideMode:'visibility'}:false), - - items:[{ - id: 'casesTab', - title: _('ID_CASE') +' ' + _APP_NUM, - frameConfig:{name:'openCaseFrame', id:'openCaseFrame'}, - defaultSrc : uri, - loadMask:{msg: _('ID_LOADING_GRID') }, - bodyStyle:{height: (PMExt.getBrowser().screen.height-60) + 'px', overflow:'hidden'}, - width:screenWidth - - } - ], - listeners: { - tabchange: function(panel){ - panel.ownerCt.doLayout(); - }, - render : function(panel){ - Ext.each([this.el, this[this.collapseEl]] , - function( elm ) { - elm.setVisibilityMode(Ext.Element.VISIBILITY).originalDisplay ='visible'; - }); - } - } - }] - }; - - var navPanel = { - id: 'navPanel', - region: 'center', - layout: 'border', - items:[navPanelWest, navPanelCenter], - tbar:[{ - id: 'stepsMenu', - text: '  '+_('ID_STEPS'), - pressed: false, - enableToggle:true, - tooltip: { - title: _('ID_CASES_STEPS'), - text:_('ID_SHOW_HIDE_CASES_STEPS') - }, - iconCls: 'ICON_STEPS', - toggleHandler: togglePreview, - disabled: true - }, { - id: 'informationMenu', - text: _('ID_INFORMATION'), - menu: [] - }, { - id: 'actionMenu', - text: _('ID_ACTIONS'), - menu: [] - }, { - id: 'caseNotes', - pressed: false, - enableToggle:true, - text: '  '+_('ID_CASES_NOTES'), - iconCls: 'button_menu_ext ICON_CASES_NOTES', - tooltip: { - title: _('ID_CASES_NOTES'), - text:_('ID_SHOW_CASES_NOTES') - }, - toggleHandler:function(btn, pressed){ - if(pressed){ - openCaseNotesWindow(); - }else{ - closeCaseNotesWindow(); - } + var navPanelWest = { + id: 'navPanelWest', + region: 'west', + xtype:'panel', + width: 250, + height: 500, + maxSize: 400, + split: true, + collapsible: false, + margins: '0 0 0 0', + items:[casesStepTree] } - }] - } + var fnChangeStatus =function(){ + alert('loaded'); + } + + var screenWidth = (PMExt.getBrowser().screen.width-140).toString() + 'px'; + + var navPanelCenter = { + id: 'navPanelCenter', + region: 'center', layout:'fit',forceLayout: true, + xtype:'panel', + items:[{ + xtype:"tabpanel", + id: 'caseTabPanel', + deferredRender:false, + defaults:{autoScroll: true}, + defaultType:"iframepanel", + activeTab: 0, + enableTabScroll: true, + //defaults: Ext.apply({}, Ext.isGecko? {style:{position:'absolute'},hideMode:'visibility'}:false), + + items:[{ + id: 'casesTab', + title: _('ID_CASE') +' ' + _APP_NUM, + frameConfig:{name:'openCaseFrame', id:'openCaseFrame'}, + defaultSrc : uri, + loadMask:{msg: _('ID_LOADING_GRID') }, + bodyStyle:{height: (PMExt.getBrowser().screen.height-60) + 'px', overflow:'hidden'}, + width:screenWidth + + } + ], + listeners: { + tabchange: function(panel){ + panel.ownerCt.doLayout(); + }, + render : function(panel){ + Ext.each([this.el, this[this.collapseEl]] , + function( elm ) { + elm.setVisibilityMode(Ext.Element.VISIBILITY).originalDisplay ='visible'; + }); + } + } + }] + }; + + buttonCancel = new Ext.Button({ + buttonAlign: 'center', + text: 'Cancel', + handler: redirectHistory, + cls: 'cancelSummary', + width: '100px', + flex: 1, + style: "height:36px" + }); + + buttonClaimCase = new Ext.Button({ + buttonAlign: 'center', + ui: 'round', + text: 'Claim this case', + handler: claimCase, + cls: 'claimCaseSummary', + width: '120px', + flex: 1, + style: "height:36px" + }); + + navPanelBottom = { + id: 'navPanelBottom', + name: 'navPanelBottom', + cls: 'navPanelBottom', + region: 'south', + layout: 'column', + dock: 'bottom', + border: false, + margin: '0 0 0 0', + split: false, + collapsible: false, + hidden: false, + buttonAlign: 'center', + buttonHeight: 200, + buttons: [buttonCancel, buttonClaimCase] + }; + + /** + * Claim the case. + */ + function claimCase() { + Ext.Ajax.request({ + url: 'cases_CatchExecute', + success: function (response, opts) { + Ext.Ajax.request({ + url: 'ajaxListener', + params: {action : 'steps'}, + success: function (response, opts) { + Ext.getCmp('navPanelBottom').hide(); + Ext.getCmp('navPanel').doLayout(); + //Reload frame pmDynaform + if (isBrowserIE()) { + document.getElementById('openCaseFrame').contentWindow.location.reload(true); + } else { + Ext.getCmp('navPanelCenter').getUpdater().getEl().update(); + } + } + }); + } + }); + } + + /** + * Redirect to unassigned inbox. + */ + function redirectHistory() { + if (isBrowserIE()) { + if (top.opener) { + //Is open the claim case in another tab + top.opener.location.reload(); + top.close(); + } else { + //When isIE with ux skin is not open another tab + javascript:history.back(); + } + } else { + javascript:history.back(); + } + } + + navPanel = { + id: 'navPanel', + region: 'center', + layout: 'border', + items: [navPanelWest, navPanelCenter], + tbar: [{ + id: 'stepsMenu', + text: '  ' + _('ID_STEPS'), + pressed: false, + enableToggle: true, + tooltip: { + title: _('ID_CASES_STEPS'), + text: _('ID_SHOW_HIDE_CASES_STEPS') + }, + iconCls: 'ICON_STEPS', + toggleHandler: togglePreview, + disabled: true + }, { + id: 'informationMenu', + text: _('ID_INFORMATION'), + menu: [] + }, { + id: 'actionMenu', + text: _('ID_ACTIONS'), + menu: [] + }, { + id: 'caseNotes', + pressed: false, + enableToggle: true, + text: '  ' + _('ID_CASES_NOTES'), + iconCls: 'button_menu_ext ICON_CASES_NOTES', + tooltip: { + title: _('ID_CASES_NOTES'), + text: _('ID_SHOW_CASES_NOTES') + }, + toggleHandler: function (btn, pressed) { + if (pressed) { + openCaseNotesWindow(); + } else { + closeCaseNotesWindow(); + } + } + }] + }; + + /** + * Get Parameters from URL + * @returns {*} + */ + function getParameterURL() { + var item, + key = false, + result = {}, + url = location.search.substring(1), + regExp = /([^&=]+)=([^&]*)/g; + if (arguments.length > 0 && arguments[0].length > 1) { + key = arguments[0]; + } + while (item = regExp.exec(url)) { + if (key !== false && decodeURIComponent(item[1]) === key) { + return decodeURIComponent(item[2]); + } + else if (key === false) { + result[decodeURIComponent(item[1])] = decodeURIComponent(item[2]); + } + } + return key === false ? result : null; + } + + if (this.showCustomForm && this.showCustomForm === true && getParameterURL('action') === 'unassigned') { + navPanel.items[navPanel.items.length] = navPanelBottom; + } var viewport = new Ext.Viewport({ layout: 'border', @@ -1891,4 +2002,3 @@ Ext.onReady(function(){ node.select(); } -