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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//@require js/mootools-1.2.5-core-nc.js
//@require js/mootools-1.2.5.1-more-nc.js
//@require js/soundmanager2-nodebug-jsmin.js
//@require js/init.js

Ext.application({
	name : 'WebIM',

	requires : [
		'WebIM.view.ActionPanel', 
		'WebIM.view.ChatPanel', 
		'Ext.field.Password', 
		'Ext.carousel.Carousel',
		'Ext.MessageBox',
		'Ext.dataview.List',
		'WebIM.view.ContactPanel',
		'WebIM.store.ContactPanelStore',
		'WebIM.model.ChatWindow'
	],

	views : [
		'Main',
		'Login'
	],
	models : ['Contact'],

	onUpdated : function() {
		Ext.Msg.confirm("Application Update", "This application has just successfully been updated to the latest version. Reload now?", function(buttonId) {
			if (buttonId === 'yes') {
				window.location.reload();
			}
		});
	},
	isIconPrecomposed : true,

	launch : function() {
		// Destroy the #appLoadingIndicator element
		Ext.fly('appLoadingIndicator').destroy();

		// load the sound options.

		Ext.Ajax.request({
			method: 'GET',
		    url: 'sound/sound.json',
		    success: function(resp){
		        EI.sound.opt = Ext.JSON.decode(resp.responseText, true);
		    }
		});

		// Initialize the main view
		Ext.Viewport.add(Ext.create('WebIM.view.Login'));
		Ext.Viewport.add(Ext.create('WebIM.view.ActionPanel', {
			itemId : 'action-panel'
		}));
	},
});