APISImagesUI.js
3.55 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
/**
* 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');
},
getFITSUrl : function(image)
{
return image.get('fits_url');
},
getAcknowledgement : function()
{
return '<br/><a target="_blank" href="http://lesia.obspm.fr/apis/">APIS database by Laurent Lamy - Lesia-Observatoire de Paris</a>';
},
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)
{
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.access_url_calibrated_thumbnail,
fits_url : image.access_url,
image_url : image.access_url_calibrated_preview,
additional_text : 'Original data'
});
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.access_url_processed_filename,
image_url : image.access_url_processed_preview,
additional_text : 'Processed data'
});
});
});
this.createTree(imgs);
}
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 planet = this.getTargetCombo().getValue();
var obj = {
startTime : startTime,
stopTime : stopTime,
planet : planet
};
this.getImageTreePanel().setLoading(true);
AmdaAction.getAPISImagesUrl(obj,this.onFinishGetImages,this);
}
});