1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
|
10
|
|
11
|
|
12
|
|
13
|
|
14
|
|
15
|
|
16
|
|
17
|
|
18
|
|
19
|
|
20
|
|
21
|
|
22
|
|
23
|
|
24
|
Ext.define("sitools.admin.gui",{
|
25
|
singleton : true
|
26
|
});
|
27
|
|
28
|
var user = null;
|
29
|
var viewport = null;
|
30
|
var treePanel = null;
|
31
|
var dataViewMenu = null;
|
32
|
var seeAlsoMenu = null;
|
33
|
var dataViewWin = null;
|
34
|
var mainPanel = null;
|
35
|
var seeAlsoPanel = null;
|
36
|
var helpUrl = null;
|
37
|
var componentsPanel = null;
|
38
|
SHOW_HELP = true;
|
39
|
|
40
|
function onMenuSelect(but) {
|
41
|
if (Ext.isEmpty(but.getItemId())) {
|
42
|
return;
|
43
|
}
|
44
|
if (but.getItemId() == 'menu_logout') {
|
45
|
sitools.public.utils.Logout.logout();
|
46
|
} else {
|
47
|
Ext.Msg.alert('Click on Menu: ', but.getItemId());
|
48
|
}
|
49
|
}
|
50
|
|
51
|
function showHelp(helpUrl) {
|
52
|
if (Ext.isEmpty(helpUrl)) {
|
53
|
Ext.Msg.alert(i18n.get('label.warning'), i18n.get('label.noHelpUrl'));
|
54
|
return;
|
55
|
}
|
56
|
var winHelp = Ext.getCmp(ID.WIN.HELP);
|
57
|
if (!winHelp) {
|
58
|
|
59
|
var helpPanel = Ext.create('Ext.container.Container', {
|
60
|
id : ID.WIN.HELP,
|
61
|
layout : 'fit',
|
62
|
defaultSrc : helpUrl,
|
63
|
items : [{
|
64
|
xtype : 'component',
|
65
|
autoEl: {
|
66
|
tag: 'iframe',
|
67
|
border : false,
|
68
|
src: helpUrl
|
69
|
}
|
70
|
}],
|
71
|
defaults : {
|
72
|
padding : 10
|
73
|
}
|
74
|
});
|
75
|
|
76
|
winHelp = Ext.create('Ext.window.Window', {
|
77
|
title : i18n.get('label.help'),
|
78
|
width : DEFAULT_HELP_WIDTH,
|
79
|
modal : true,
|
80
|
id : 'winHelpId',
|
81
|
height : DEFAULT_HELP_HEIGHT,
|
82
|
layout : 'fit',
|
83
|
items : [ helpPanel ],
|
84
|
buttons : [{
|
85
|
text : 'close',
|
86
|
handler : function () {
|
87
|
this.ownerCt.ownerCt.close();
|
88
|
}
|
89
|
}]
|
90
|
});
|
91
|
|
92
|
winHelp.show();
|
93
|
winHelp.doLayout(false, true);
|
94
|
helpPanel.setHeight(winHelp.getHeight() - 65);
|
95
|
} else {
|
96
|
winHelp.show();
|
97
|
}
|
98
|
|
99
|
}
|
100
|
|
101
|
|
102
|
|
103
|
var clientAdmin = {
|
104
|
initGui : function (callback) {
|
105
|
|
106
|
var menuLogout = {
|
107
|
xtype : 'button',
|
108
|
tooltip : i18n.get('label.logout'),
|
109
|
text : i18n.get('label.logout'),
|
110
|
itemId : 'menu_logout',
|
111
|
icon : loadUrl.get('APP_URL') + loadUrl.get('APP_CLIENT_PUBLIC_URL')+'/res/images/icons/logout.png',
|
112
|
cls : 'x-custom-button-color',
|
113
|
handler : function () {
|
114
|
sitools.public.utils.LoginUtils.logout();
|
115
|
}
|
116
|
};
|
117
|
var toolbar = {
|
118
|
xtype : 'toolbar',
|
119
|
id : ID.CMP.TOOLBAR,
|
120
|
cls : 'admin-bg',
|
121
|
items : [ {
|
122
|
xtype : 'label',
|
123
|
html : '<img src=res/images/cnes.png width=92 height=28>'
|
124
|
}, {
|
125
|
xtype : 'label',
|
126
|
style : "text-shadow: 1px 1px #F2F8FF;font-size: 12px; color: #526572; font-weight: bold; padding-left : 15px",
|
127
|
text : i18n.get('label.title')
|
128
|
}, '->', {
|
129
|
xtype : 'label',
|
130
|
style : "text-shadow: 1px 1px #F2F8FF; font-size: 12px; color: #526572;",
|
131
|
html : i18n.get('label.welcome') + ' <b>' + Ext.util.Cookies.get('userLogin') + '</b>'
|
132
|
}, '-', {
|
133
|
id : 'quickStart',
|
134
|
tooltip : 'Quick Start',
|
135
|
text : 'Quick Start',
|
136
|
icon : loadUrl.get('APP_URL') + loadUrl.get('APP_CLIENT_PUBLIC_URL')+'/res/images/icons/quick_start.png',
|
137
|
style : 'padding:2px',
|
138
|
cls : 'x-custom-button-color',
|
139
|
handler : function () {
|
140
|
mainPanel.removeAll();
|
141
|
|
142
|
var quickStartPanel = Ext.create('sitools.admin.quickstart.Qs', {
|
143
|
id : ID.PANEL.QUICKSTART,
|
144
|
width : "100%",
|
145
|
flex : 1
|
146
|
});
|
147
|
|
148
|
var containerPanel = Ext.create('Ext.panel.Panel', {
|
149
|
name : 'containerPanel',
|
150
|
width : "100%",
|
151
|
layout : 'fit',
|
152
|
bodyCls : 'admin-bg',
|
153
|
border : false,
|
154
|
bodyBorder : false,
|
155
|
flex : 1
|
156
|
});
|
157
|
mainPanel.add(containerPanel);
|
158
|
mainPanel.add(quickStartPanel);
|
159
|
mainPanel.doLayout();
|
160
|
|
161
|
}
|
162
|
}, {
|
163
|
|
164
|
id : 'versionButtonId',
|
165
|
tooltip : 'Version',
|
166
|
text : 'Version',
|
167
|
icon : loadUrl.get('APP_URL') + loadUrl.get('APP_CLIENT_PUBLIC_URL')+'/res/images/icons/version.png',
|
168
|
style : 'padding:2px',
|
169
|
cls : 'x-custom-button-color',
|
170
|
handler : function () {
|
171
|
Ext.create('sitools.public.version.Version').show();
|
172
|
}
|
173
|
},
|
174
|
"|", menuLogout
|
175
|
]
|
176
|
};
|
177
|
|
178
|
var menuPanel = Ext.create("Ext.Panel", {
|
179
|
id : ID.PANEL.MENU,
|
180
|
region : 'north',
|
181
|
layout : 'fit',
|
182
|
height : 36,
|
183
|
border : false,
|
184
|
bodyBorder : false,
|
185
|
items : [ toolbar ]
|
186
|
});
|
187
|
|
188
|
treePanel = Ext.create("Ext.Panel", {
|
189
|
id : ID.PANEL.TREE,
|
190
|
region : 'west',
|
191
|
title : i18n.get('label.menu'),
|
192
|
autoScroll : true,
|
193
|
width : 300,
|
194
|
layout : 'fit',
|
195
|
border : false,
|
196
|
bodyBorder : false,
|
197
|
header : {
|
198
|
cls : 'x-toolbar-shadow'
|
199
|
},
|
200
|
defaults : {
|
201
|
padding : 10
|
202
|
}
|
203
|
});
|
204
|
|
205
|
var pan_config = Ext.create("sitools.admin.menu.dataView");
|
206
|
|
207
|
var mainPanelItems = [];
|
208
|
|
209
|
if (Ext.util.Cookies.get('showQuickStart') == "true") {
|
210
|
var quickStartPanel = Ext.create('sitools.admin.quickstart.Qs', {
|
211
|
id : ID.PANEL.QUICKSTART,
|
212
|
border : false,
|
213
|
bodyBorder : false,
|
214
|
flex : 1
|
215
|
});
|
216
|
|
217
|
var containerPanel = Ext.create('Ext.container.Container', {
|
218
|
name : 'containerPanel',
|
219
|
|
220
|
layout : 'fit',
|
221
|
bodyCls : 'admin-bg',
|
222
|
autoScroll : false,
|
223
|
border : false,
|
224
|
flex : 1,
|
225
|
items : [{
|
226
|
xtype : 'component',
|
227
|
autoEl: {
|
228
|
tag: 'iframe',
|
229
|
border : false,
|
230
|
src: 'res/html/' + LOCALE + '/welcome.html'
|
231
|
}
|
232
|
}]
|
233
|
});
|
234
|
mainPanelItems.push(containerPanel);
|
235
|
mainPanelItems.push(quickStartPanel);
|
236
|
} else {
|
237
|
var welcomePanel = Ext.create('Ext.container.Container', {
|
238
|
xtype : 'panel',
|
239
|
layout : 'fit',
|
240
|
flex : 1,
|
241
|
items : [{
|
242
|
xtype : 'component',
|
243
|
autoEl: {
|
244
|
tag: 'iframe',
|
245
|
border : false,
|
246
|
src: 'res/html/' + LOCALE + '/welcome.html'
|
247
|
}
|
248
|
}]
|
249
|
});
|
250
|
mainPanelItems.push(welcomePanel);
|
251
|
}
|
252
|
|
253
|
mainPanel = Ext.create('Ext.panel.Panel', {
|
254
|
bodyCls : 'admin-bg',
|
255
|
header : {
|
256
|
cls : 'x-toolbar-shadow'
|
257
|
},
|
258
|
layout : {
|
259
|
type : 'vbox',
|
260
|
align : 'stretch',
|
261
|
pack : 'start'
|
262
|
},
|
263
|
border : false,
|
264
|
bodyBorder : false,
|
265
|
xtype : 'panel',
|
266
|
id : ID.PANEL.MAIN,
|
267
|
items : mainPanelItems,
|
268
|
region : 'center'
|
269
|
});
|
270
|
|
271
|
|
272
|
viewport = Ext.create('Ext.container.Viewport', {
|
273
|
layout : 'border',
|
274
|
items : [ menuPanel, treePanel, mainPanel],
|
275
|
listeners : {
|
276
|
scope : this,
|
277
|
resize : function () {
|
278
|
if (dataViewWin) {
|
279
|
dataViewWin.setSize({
|
280
|
height : Ext.getBody().getSize().height - 87,
|
281
|
width : Ext.getBody().getSize().width - 5
|
282
|
});
|
283
|
dataViewWin.setPosition(0, 82);
|
284
|
}
|
285
|
}
|
286
|
}
|
287
|
});
|
288
|
|
289
|
var menu = Ext.create("sitools.admin.menu.TreeMenu", 'res/json/menu.json');
|
290
|
treePanel.add(menu);
|
291
|
|
292
|
if (Ext.isFunction(callback)) {
|
293
|
callback.call(this);
|
294
|
}
|
295
|
}
|
296
|
};
|
297
|
|
298
|
|
299
|
|
300
|
|
301
|
|
302
|
function initAppli(callback) {
|
303
|
if (Ext.isEmpty(Ext.util.Cookies.get('showQuickStart'))) {
|
304
|
Ext.util.Cookies.set('showQuickStart', true);
|
305
|
}
|
306
|
|
307
|
sql2ext.load(loadUrl.get('APP_URL') + loadUrl.get('APP_CLIENT_PUBLIC_URL') + "/conf/sql2ext.properties");
|
308
|
clientAdmin.initGui(callback);
|
309
|
}
|
310
|
|