APISImagesUI.js
5 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
178
179
/**
* Project : AMDA-NG
* Name : APISImagesUI.js
* @plugin amdaUI.APISImagesUI
* @extends Ext.panel.Panel
* @brief APIS view
* @author Benjamin
* @version $Id: APISImagesUI.js 1664 2013-07-03 11:37:37Z benjamin $
********************************************************************************
* FT Id : Date : Name - Description
*******************************************************************************
* :
*/
Ext.define('amdaUI.APISImagesUI', {
extend: 'amdaUI.AstroImagesUI',
alias: 'widget.panelAPIS',
getPreviewUrl : function(image)
{
return image.get('preview_url');
},
getImageLink : function(image)
{
return image.get('image_url');
},
getImageToSendUrl : function(image)
{
if (image.get('fits_url'))
return image.get('fits_url');
return image.get('image_url');
},
getAcknowledgement : function()
{
return '<br/><a target="_blank" href="http://lesia.obspm.fr/apis/">APIS database by Laurent Lamy - Lesia-Observatoire de Paris</a>';
},
getAdditionalRequestConfig : function(panelId)
{
return {
xtype: 'checkboxgroup',
fieldLabel: 'Datasets selection',
labelAlign: 'top',
columns: 2,
flex: 1,
vertical: true,
id: panelId+'-checkgroup-datasetid',
items: [
{ boxLabel: 'Original Data', inputValue: 'original_data', checked: true },
{ boxLabel: 'Processed Data', inputValue: 'processed_data', checked: true },
{ boxLabel: 'Cylindric Proj.', inputValue: 'cylindric_proj', checked: true },
{ boxLabel: 'Polar Proj. North', inputValue: 'polar_proj_north', checked: true },
{ boxLabel: 'Polar Proj. South', inputValue: 'polar_proj_south', checked: true }
]
};
},
getTargetList : function()
{
return [
["saturn", "Saturn"],
["jupiter", "Jupiter"],
["uranus", "Uranus"],
["europa", "Europa"],
["ganymede", "Ganymede"],
["io", "Io"],
["titan", "Titan"]];
},
onFinishGetImages : function(result, e)
{
var t = e.getTransaction();
if (e.status && result)
{
if (result.success)
{
var imgs = new Array();
var crtStartTime = 0.0;
var crtFolder;
Ext.each(result.result,function(folder)
{
var rec = {
name : folder.date,
start : folder.date,
images : new Array()
};
imgs.push(rec);
Ext.each(folder.images, function(image)
{
var additional_text = '';
switch (image.dataset_id)
{
case 'cylindric_proj' :
additional_text = 'Cylindric Proj.';
break;
case 'original_data' :
additional_text = 'Original data';
break;
case 'polar_proj_north' :
additional_text = 'Polar Proj. North';
break;
case 'polar_proj_south' :
additional_text = 'Polar Proj. South';
break;
case 'processed_data' :
additional_text = 'Processed data';
break;
}
rec.images.push({
name : image.name,
target : image.target_name,
ra : image.ra,
dec : image.dec,
ref : image.reference,
start : image.time_min,
stop : image.time_max,
exposure : image.time_exp_max,
instrument : image.instrument_name,
preview_url : image.preview_url,
fits_url : image.native_access_url,
image_url : image.access_url,
additional_text : additional_text
});
});
});
this.createTree(imgs);
if (result.warning)
myDesktopApp.warningMsg(result.warning);
}
else
{
//ERROR
if (result.message)
Ext.Msg.show({title:'Error', msg: result.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
else
Ext.Msg.show({title:'Error', msg: 'Unknown error', icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
}
}
else
{
// FAILURE
Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
}
},
refreshTree : function(o)
{
var startTime = this.timeSelector.getStartTime();
var stopTime = this.timeSelector.getStopTime();
var target = this.getTargetCombo().getValue();
var datasetsGroup = this.queryById(this.id+'-checkgroup-datasetid');
var datasets = [];
Ext.each(datasetsGroup.getChecked(), function (check, index) {
datasets.push(check.inputValue);
});
var obj = {
startTime : startTime,
stopTime : stopTime,
target : target,
datasets : datasets
};
this.getImageTreePanel().setLoading(true);
AmdaAction.getAPISImagesUrl(obj,this.onFinishGetImages,this);
}
});