| 1 | <?xml version="1.0" encoding="utf-8"?> | 
|---|
| 2 | <!--tracking.mxml --> | 
|---|
| 3 |  | 
|---|
| 4 | <mx:Application | 
|---|
| 5 | xmlns:mx="http://www.adobe.com/2006/mxml" | 
|---|
| 6 | xmlns:control="gov.va.med.edp.control.*" | 
|---|
| 7 | xmlns:business="gov.va.med.edp.business.*" | 
|---|
| 8 | xmlns:view="gov.va.med.edp.view.*" | 
|---|
| 9 | xmlns:log="gov.va.med.edp.view.log.*" | 
|---|
| 10 | pageTitle="Patient Tracking" | 
|---|
| 11 | height="100%" width="100%" frameRate="100" | 
|---|
| 12 | paddingLeft="0" paddingRight="0" paddingBottom="0" paddingTop="6" | 
|---|
| 13 | creationComplete="initApp()" xmlns:debug="gov.va.med.edp.view.debug.*" | 
|---|
| 14 | initialize="callJSmaxBrowser();"> | 
|---|
| 15 |  | 
|---|
| 16 | <mx:Style source="edp.css"/> | 
|---|
| 17 |  | 
|---|
| 18 | <mx:Script> | 
|---|
| 19 | <![CDATA[ | 
|---|
| 20 | import mx.managers.FocusManager; | 
|---|
| 21 | import mx.managers.IFocusManagerContainer; | 
|---|
| 22 | import mx.accessibility.ButtonAccImpl; | 
|---|
| 23 | import gov.va.med.edp.widget.LinkButtonTab; | 
|---|
| 24 | import gov.va.med.edp.util.AccessibilityTools; | 
|---|
| 25 | import gov.va.med.edp.control.ModalDialogEvent; | 
|---|
| 26 | import flash.utils.getTimer; | 
|---|
| 27 | import gov.va.med.edp.control.ClearUnsavedViewsModelEvent; | 
|---|
| 28 | import mx.binding.utils.ChangeWatcher; | 
|---|
| 29 | import mx.core.Container; | 
|---|
| 30 | import mx.utils.URLUtil; | 
|---|
| 31 | import com.adobe.cairngorm.control.CairngormEventDispatcher; | 
|---|
| 32 | import com.adobe.cairngorm.control.CairngormEvent; | 
|---|
| 33 | import gov.va.med.edp.model.TrackingModelLocator; | 
|---|
| 34 | import gov.va.med.edp.control.InitAppEvent; | 
|---|
| 35 | import gov.va.med.edp.control.SwitchAppViewEvent; | 
|---|
| 36 | import gov.va.med.edp.control.TrackingEvent; | 
|---|
| 37 | import com.adobe.cairngorm.business.ServiceLocator; | 
|---|
| 38 | import gov.va.med.edp.business.Services; | 
|---|
| 39 | import gov.va.med.edp.vo.LookupVO; | 
|---|
| 40 | import gov.va.med.edp.util.InactivityTimeout; | 
|---|
| 41 | import gov.va.med.edp.view.DisconnectedDialog; | 
|---|
| 42 | import gov.va.med.edp.widget.InfoDialog; | 
|---|
| 43 |  | 
|---|
| 44 | [Bindable] | 
|---|
| 45 | public var model:TrackingModelLocator = TrackingModelLocator.getInstance(); | 
|---|
| 46 |  | 
|---|
| 47 | [Bindable] | 
|---|
| 48 | private var inactivityTimeout:InactivityTimeout = new InactivityTimeout(); | 
|---|
| 49 |  | 
|---|
| 50 | private var modalCount: int = 0; | 
|---|
| 51 |  | 
|---|
| 52 | /** | 
|---|
| 53 | *  Function: callJSmaxBrowser() | 
|---|
| 54 | *  Parameters: | 
|---|
| 55 | *                        NA | 
|---|
| 56 | *  Description: | 
|---|
| 57 | *       Calls external javascript to maximize browser and makescreen | 
|---|
| 58 | *       component visible if screen reader is activated | 
|---|
| 59 | * | 
|---|
| 60 | *  Created by: jtorreno | 
|---|
| 61 | * | 
|---|
| 62 | *  Date: 2008.05.12 | 
|---|
| 63 | * | 
|---|
| 64 | **/ | 
|---|
| 65 | private function callJSmaxBrowser():void { | 
|---|
| 66 | trace("** Is screen reader active: " + AccessibilityTools.isAccessibilityActive()); | 
|---|
| 67 |  | 
|---|
| 68 | if (AccessibilityTools.isAccessibilityActive()) { | 
|---|
| 69 | trace("** Calls external javascript to maximize browser and " + | 
|---|
| 70 | "makescreen component visible") | 
|---|
| 71 | ExternalInterface.call("maximizeBrowser"); | 
|---|
| 72 | } | 
|---|
| 73 | } | 
|---|
| 74 |  | 
|---|
| 75 |  | 
|---|
| 76 | private function initApp():void | 
|---|
| 77 | { | 
|---|
| 78 | ChangeWatcher.watch(model, "disconnected", connectionStatusChanged); | 
|---|
| 79 | model.reconnectFunction = reconnect; | 
|---|
| 80 |  | 
|---|
| 81 | var e: InitAppEvent = new InitAppEvent(InitAppEvent.EVENT_INIT_APP); | 
|---|
| 82 | e.appName = TrackingModelLocator.APP_NAME_TRACKING; | 
|---|
| 83 | e.contextRoot = Application.application.parameters.contextRoot; | 
|---|
| 84 | e.helpContextRoot = Application.application.parameters.helpContextRoot; | 
|---|
| 85 | e.protocol = URLUtil.getProtocol(Application.application.url); | 
|---|
| 86 | if (e.protocol == "file") e.protocol = "http"; | 
|---|
| 87 |  | 
|---|
| 88 | // first check the vljServ parameter | 
|---|
| 89 | if (Application.application.parameters.hasOwnProperty("vljServ")) { | 
|---|
| 90 | e.server = Application.application.parameters.vljServ; | 
|---|
| 91 | e.mode = InitAppEvent.SERVICE_USE_VLJ; | 
|---|
| 92 | } | 
|---|
| 93 | // then check the cspServ parameter | 
|---|
| 94 | if ((e.server.length == 0) && Application.application.parameters.hasOwnProperty("cspServ")) { | 
|---|
| 95 | e.server = Application.application.parameters.cspServ; | 
|---|
| 96 | e.mode = InitAppEvent.SERVICE_USE_CSP; | 
|---|
| 97 | e.token = Application.application.parameters.cspToken; | 
|---|
| 98 | } | 
|---|
| 99 | // if running in development mode try localhost | 
|---|
| 100 | if ((e.server.length == 0) && (Application.application.url.substr(0, 7) == "file://")) { | 
|---|
| 101 | e.server = "localhost:7001"; | 
|---|
| 102 | e.mode = InitAppEvent.SERVICE_USE_VLJ; | 
|---|
| 103 | } | 
|---|
| 104 | // default:  use the server and port of the HTML wrapper with VLJ | 
|---|
| 105 | if (e.server.length == 0) { | 
|---|
| 106 | e.server = URLUtil.getServerNameWithPort(Application.application.url); | 
|---|
| 107 | e.mode = InitAppEvent.SERVICE_USE_VLJ; | 
|---|
| 108 | } | 
|---|
| 109 | e.dispatch(); | 
|---|
| 110 |  | 
|---|
| 111 | Application.application.pageTitle = "Tracking System: " + e.server; | 
|---|
| 112 |  | 
|---|
| 113 | if (AccessibilityTools.isAccessibilityActive()) { | 
|---|
| 114 | this.addEventListener(gov.va.med.edp.control.ModalDialogEvent.OPEN, setModalBackground); | 
|---|
| 115 | this.addEventListener(gov.va.med.edp.control.ModalDialogEvent.CLOSE, clearModalBackground); | 
|---|
| 116 | } | 
|---|
| 117 |  | 
|---|
| 118 | if (ExternalInterface.available) { | 
|---|
| 119 | ExternalInterface.addCallback("getUnsavedDataWarning", | 
|---|
| 120 | function(): String { | 
|---|
| 121 | var x: String = model.modifiedViews(); | 
|---|
| 122 | if (x.length > 0) { | 
|---|
| 123 | x = "The following views have unsaved changes: \n\n" + x + | 
|---|
| 124 | "\nDo you want to continue and lose these changes?"; | 
|---|
| 125 | return x; | 
|---|
| 126 | } | 
|---|
| 127 | return ""; | 
|---|
| 128 | } | 
|---|
| 129 | ); | 
|---|
| 130 | } | 
|---|
| 131 | } | 
|---|
| 132 |  | 
|---|
| 133 | private function connectionStatusChanged(e:Event):void { | 
|---|
| 134 | if (model.disconnected) | 
|---|
| 135 | DisconnectedDialog.show(); | 
|---|
| 136 | else | 
|---|
| 137 | DisconnectedDialog.hide(); | 
|---|
| 138 | } | 
|---|
| 139 |  | 
|---|
| 140 | private function reconnect():void { | 
|---|
| 141 | new TrackingEvent(TrackingEvent.EVENT_INIT_TRACKING).dispatch(); | 
|---|
| 142 | } | 
|---|
| 143 |  | 
|---|
| 144 | private function proceed(): void { | 
|---|
| 145 | var e:SwitchAppViewEvent = new SwitchAppViewEvent(SwitchAppViewEvent.EVENT_SWITCH_APP_VIEW); | 
|---|
| 146 | if (model.appViewList.length > 0) { | 
|---|
| 147 | e.view = (model.appViewList[0] as LookupVO).data; | 
|---|
| 148 | } | 
|---|
| 149 | e.dispatch(); | 
|---|
| 150 | } | 
|---|
| 151 |  | 
|---|
| 152 | private function getView(view:Number): Container | 
|---|
| 153 | { | 
|---|
| 154 | if (view == TrackingModelLocator.VIEW_APP_INTRO) { | 
|---|
| 155 | return introView; | 
|---|
| 156 | } else if (view == TrackingModelLocator.VIEW_APP_VERSION_INCOMPATIBILITY) { | 
|---|
| 157 | return versionIncompatibilityView; | 
|---|
| 158 | } else { | 
|---|
| 159 | return trackingViews; | 
|---|
| 160 | } | 
|---|
| 161 | } | 
|---|
| 162 |  | 
|---|
| 163 | private function set initSessionTimeout(value: uint):void | 
|---|
| 164 | { | 
|---|
| 165 | inactivityTimeout.start(); | 
|---|
| 166 | } | 
|---|
| 167 |  | 
|---|
| 168 | public function set workingStatus(bText:String):void | 
|---|
| 169 | { | 
|---|
| 170 | if (bText.length > 0) { | 
|---|
| 171 | /*                              if (lblWorkingStatus.text == "") {   // true when starting timeout | 
|---|
| 172 | ExternalInterface.call("indicateTimeout"); | 
|---|
| 173 | trace("done calling indicate timeout"); | 
|---|
| 174 | } */ | 
|---|
| 175 | currentState = 'sessionTimeOutState'; | 
|---|
| 176 | lblWorkingStatus.text = bText; | 
|---|
| 177 | } else { | 
|---|
| 178 | currentState = ""; | 
|---|
| 179 | lblWorkingStatus.text = ""; | 
|---|
| 180 | } | 
|---|
| 181 | } | 
|---|
| 182 |  | 
|---|
| 183 | private function setModalBackground(e: ModalDialogEvent): void | 
|---|
| 184 | { | 
|---|
| 185 | if (modalCount == 0) { | 
|---|
| 186 | if (e.dialogPanel != null) { | 
|---|
| 187 | //                                                                              if (e.dialogPanel is IFocusManagerContainer) { | 
|---|
| 188 | //                                              if (IFocusManagerContainer(e.dialogPanel).focusManager) | 
|---|
| 189 | //                                                      e.dialogPanel.systemManager.addFocusManager(IFocusManagerContainer(e.dialogPanel)); | 
|---|
| 190 | //                                              else // Popups get their own focus loop | 
|---|
| 191 | //                                                      IFocusManagerContainer(e.dialogPanel).focusManager = new FocusManager(IFocusManagerContainer(e.dialogPanel)); | 
|---|
| 192 | //                                      } | 
|---|
| 193 |  | 
|---|
| 194 | e.dialogPanel.setStyle("horizontalCenter", 0); | 
|---|
| 195 | e.dialogPanel.setStyle("verticalCenter", 0); | 
|---|
| 196 | emptyBackground.addChild(e.dialogPanel); | 
|---|
| 197 |  | 
|---|
| 198 | } | 
|---|
| 199 | appView.selectedChild = emptyBackground; | 
|---|
| 200 |  | 
|---|
| 201 | } | 
|---|
| 202 | modalCount++; | 
|---|
| 203 | } | 
|---|
| 204 |  | 
|---|
| 205 | private function clearModalBackground(e: ModalDialogEvent): void | 
|---|
| 206 | { | 
|---|
| 207 | modalCount--; | 
|---|
| 208 | if (modalCount == 0) { | 
|---|
| 209 |  | 
|---|
| 210 | emptyBackground.removeAllChildren(); | 
|---|
| 211 | appView.selectedChild = getView(model.appViewState); | 
|---|
| 212 | callLater(resetSelectionForJaws); | 
|---|
| 213 | } | 
|---|
| 214 | } | 
|---|
| 215 |  | 
|---|
| 216 | private function resetSelectionForJaws(): void | 
|---|
| 217 | { | 
|---|
| 218 | if (trackingViews != null && trackingViews.appList != null) { | 
|---|
| 219 |  | 
|---|
| 220 | //            var selectedIndex:int = trackingViews.appList.selectedIndex; | 
|---|
| 221 | //            var dispObj:DisplayObject = trackingViews.appList.getChildAt(selectedIndex); | 
|---|
| 222 | //                    var lbt:LinkButtonTab = LinkButtonTab(dispObj); | 
|---|
| 223 | //                        lbt.setFocus(); | 
|---|
| 224 | trackingViews.appList.setFocus(); | 
|---|
| 225 | } | 
|---|
| 226 | } | 
|---|
| 227 |  | 
|---|
| 228 |  | 
|---|
| 229 | ]]> | 
|---|
| 230 | </mx:Script> | 
|---|
| 231 |  | 
|---|
| 232 | <!-- ========================================================================== --> | 
|---|
| 233 |  | 
|---|
| 234 | <!-- the ServiceLocator where we specify the remote services --> | 
|---|
| 235 | <business:Services id="services"/> | 
|---|
| 236 |  | 
|---|
| 237 | <!-- the FrontController, containing Commands specific to this appliation --> | 
|---|
| 238 | <control:TrackingController id="controller"/> | 
|---|
| 239 |  | 
|---|
| 240 | <!-- ========================================================================== --> | 
|---|
| 241 |  | 
|---|
| 242 | <mx:ViewStack | 
|---|
| 243 | id="appView" | 
|---|
| 244 | width="100%" | 
|---|
| 245 | height="100%" | 
|---|
| 246 | selectedChild="{getView(model.appViewState)}"> | 
|---|
| 247 |  | 
|---|
| 248 | <mx:TitleWindow id="introView" title="Emergency Department Integration Software"/> | 
|---|
| 249 | <mx:Canvas id="emptyBackground" width="100%" height="100%"/> | 
|---|
| 250 | <mx:Canvas id="versionIncompatibilityView"> | 
|---|
| 251 | <mx:Panel title="EDIS Version Incompatibility" | 
|---|
| 252 | paddingTop="10" paddingLeft="10" paddingRight="10" horizontalCenter="0" verticalCenter="0" | 
|---|
| 253 | width="75%"> | 
|---|
| 254 | <mx:Text width="100%"> | 
|---|
| 255 | <mx:text> | 
|---|
| 256 | This is EDIS client version '{model.appClientVersion}'. | 
|---|
| 257 | The EDIS server package version running in your VistA account is | 
|---|
| 258 | '{model.session.serverPackageVersion}'. | 
|---|
| 259 | It appears that the web server has served you the wrong version of the user interface for your | 
|---|
| 260 | configuration. | 
|---|
| 261 | </mx:text> | 
|---|
| 262 | </mx:Text> | 
|---|
| 263 | <mx:ControlBar horizontalAlign="right"> | 
|---|
| 264 | <mx:Button label="Proceed (Not Recommended)" click="proceed()"/> | 
|---|
| 265 | <mx:Button label="Exit" click="model.logout()"/> | 
|---|
| 266 | </mx:ControlBar> | 
|---|
| 267 | </mx:Panel> | 
|---|
| 268 | </mx:Canvas> | 
|---|
| 269 | <view:TrackingViews id="trackingViews"/> | 
|---|
| 270 | </mx:ViewStack> | 
|---|
| 271 |  | 
|---|
| 272 | <mx:states> | 
|---|
| 273 | <mx:State name="sessionTimeOutState"> | 
|---|
| 274 | <mx:AddChild relativeTo="{appView}" position="after"> | 
|---|
| 275 | <mx:target> | 
|---|
| 276 | <mx:Label id="lblWorkingStatus" width="90%" text="" textAlign="center" | 
|---|
| 277 | styleName="sessionTimeoutLabel"/> | 
|---|
| 278 | </mx:target> | 
|---|
| 279 | </mx:AddChild> | 
|---|
| 280 | </mx:State> | 
|---|
| 281 | </mx:states> | 
|---|
| 282 | <mx:Binding source="model.session.timeOut" destination="initSessionTimeout"/> | 
|---|
| 283 | <mx:Binding source="inactivityTimeout.status" destination="workingStatus"/> | 
|---|
| 284 | </mx:Application> | 
|---|