-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
177 lines (156 loc) · 4.95 KB
/
app.js
File metadata and controls
177 lines (156 loc) · 4.95 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
/*
This file is generated and updated by Sencha Cmd. You can edit this file as
needed for your application, but these edits will have to be merged by
Sencha Cmd when it performs code generation tasks such as generating new
models, controllers or views and when running "sencha app upgrade".
Ideally changes to this file would be limited and most work would be done
in other places (such as Controllers). If Sencha Cmd cannot merge your
changes and its generated code, it will produce a "merge conflict" that you
will need to resolve manually.
*/
// DO NOT DELETE - this directive is required for Sencha Cmd packages to work.
//@require @packageOverrides
//<debug>
Ext.Loader.setPath({
'Ext': 'touch/src'
//'org': 'org'
});
//</debug>
Ext.application({
name: 'SensorDevice',
requires: [
'Ext.MessageBox'
//'org.s2.syncEngine.SyncManager'
],
models: [
'Sensor',
'Picture',
'Contact',
'Position'
//'NoteSync',
//'AuthorSync',
//'Device'
],
stores: [
'Sensors',
'Pictures',
'Contacts',
'Positions'
//'DevicesSync'
],
controllers: [
'SensorDevices'
//'NotesSync'
],
views: [
'Main',
'GalleryDemo'
//'MyNotes',
],
icon: {
'57': 'resources/icons/Icon.png',
'72': 'resources/icons/Icon~ipad.png',
'114': 'resources/icons/Icon@2x.png',
'144': 'resources/icons/Icon~ipad@2x.png'
},
isIconPrecomposed: true,
startupImage: {
'320x460': 'resources/startup/320x460.jpg',
'640x920': 'resources/startup/640x920.png',
'768x1004': 'resources/startup/768x1004.png',
'748x1024': 'resources/startup/748x1024.png',
'1536x2008': 'resources/startup/1536x2008.png',
'1496x2048': 'resources/startup/1496x2048.png'
},
launch: function() {
// Destroy the #appLoadingIndicator element
Ext.fly('appLoadingIndicator').destroy();
/*
* creazione dello storeManager da utilizzarsi per la gestione degli store
*
var storeManager = Ext.create('SyncManager', {
dbName: 'SensorDeviceDb',
appName: this.getName(),
deviceID: 'Marco'
});
/*
* creazione dello store relativo agli autori
*
storeManager.createSyncStore({
model: 'SensorDevice.model.AuthorSync',
tableID: 'authorID',
remoteURL: 'http://srv1.soluzioni-sw.it/NotesWeb/Author.aspx',
storeId: 'Authors'
});
/*
* impostazione dei sorter e grouper degli autori
*
var authorsStore = Ext.getStore('Authors');
authorsStore.setSorters({
property: 'surname',
direction: 'ASC'
});
authorsStore.setGrouper({
sortProperty: 'surname',
direction: 'ASC',
groupFn: function(record) {
if (record && record.data.surname) {
return record.data.surname.substr(0,1).toUpperCase();
} else {
return '';
}
}
});
/*
* creazione dello store relativo alle note
*
storeManager.createSyncStore({
model: 'SensorDevice.model.NoteSync',
tableID: 'noteID',
remoteURL: 'http://srv1.soluzioni-sw.it/NotesWeb/Note.aspx',
storeId: 'Notes'
});
/*
* impostazione dei sorter e grouper delle note
*
var notesStore = Ext.getStore('Notes');
notesStore.setSorters({
property: 'dateCreated',
direction: 'DESC'
});
notesStore.setGrouper({
sortProperty: 'dateCreated',
direction: 'DESC',
groupFn: function(record) {
if (record && record.data.dateCreated) {
var dataString = record.data.dateCreated;
var data = new Date(dataString);
return data.toDateString();
} else {
return '';
}
}
});
/*
* impostazione dello storeManager come proprietà del controller
*
var controller = this.getController('NotesSync');
controller.setManager(storeManager);
*/
// Initialize the main view
Ext.Viewport.add([
Ext.create('SensorDevice.view.Main')
]);
},
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();
}
}
);
}
});