summaryrefslogtreecommitdiff
path: root/air/js/openpcr_update.js
blob: 404e0bf313c1b65f5a3a67231df30e4c0205c0bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
		
// UPDATE APPLICATION. Uses config/updater-descriptor.xml
// XML file includes a "version" tag, which I think is no longer in use by Air 2, but is needed for the Updater we use. Otherwise the "Currently Installed Version" on the update screen will read blank.
/**
			 * Click event handler for the Check for Update button. Checks for an update
			 * version of the application posted on the update server. If there is 
			 * and update version, the updater proceeds with the update, based on 
			 * the settings in the update configuration file.
			 */
			function checkForUpdate()
			{
				appUpdater.checkNow();
			}
			/**
			 * Displays the current application version in the UI. 
			 */
			function setApplicationNameAndVersion() 
			{
				var xmlString = air.NativeApplication.nativeApplication.applicationDescriptor;
				
				var appXml = new DOMParser();
				var xmlObject = appXml.parseFromString(xmlString, "text/xml");
				var root = xmlObject.getElementsByTagName('application')[0];

				
				var lblAppVersion = "";
				var lblAppName = "";

				lblAppVersion.value = root.getElementsByTagName("versionNumber")[0].firstChild.data;
				lblAppName.value = root.getElementsByTagName("filename")[0].firstChild.data;
			}
			/**
			 * Displays an error message when the updater dispatches an error event.
			 */
			function onError(event)
			{
            			alert(event.toString());
			}