InfoModule.js
2.2 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
/**
* Project : AMDA-NG4
* Name : InfoModule.js
* @class amdaDesktop.InfoModule
* @extends amdaDesktop.AmdaModule
* @brief Info Module controller definition
* This Module describe new functionalities of AMDA-NG4
* @author CDA
* @version $Id: InfoModule.js 2397 2014-06-03 10:21:28Z elena $
*/
Ext.define('amdaDesktop.InfoModule',
{
extend: 'amdaDesktop.AmdaModule',
contentId : 'infoUI',
file : 'releaseNotes.md',
createWindow : function(type)
{
var desktop = myDesktopApp.getDesktop();
var win = desktop.getWindow(this.id);
if (!win) {
win = desktop.createWindow({
id: this.id,
width: 650,
height: 570,
autoScroll : true,
minimizable: false,
maximizable: false,
bodyStyle: 'background:#ffffee; padding:15px 15px 15px 15px;',
bodyCls : 'infoWindow',
iconCls: this.icon,
animCollapse:false,
constrainHeader:true
});
win.on({
show : function(win, eOpts) {
this.updateInfo(win, type);
},
scope : this
});
win.show();
}
else {
this.updateInfo(win, type);
}
win.toFront();
},
updateInfo : function(win, type) {
var file = '';
var title = '';
switch (type) {
case 'release-notes':
file = 'releaseNotes.md';
title = 'AMDA Release Notes';
break;
default:
file = 'about';
title = "About AMDA";
}
Ext.Ajax.request({
url: helpDir + file,
success: function(response){
var text = response.responseText;
switch (type) {
case 'release-notes':
var converter = new showdown.Converter(),
text = converter.makeHtml(text);
break;
default:
text = text.replace('{AMDA_VERSION}', AMDA_VERSION).replace('{AMDA_RELEASE_DATE}', AMDA_RELEASE_DATE);
}
win.update(text);
win.setTitle(title);
}
});
}
});