HstUI.js
2.41 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
/**
* Project : AMDA-NG
* Name : HstUI.js
* @plugin amdaUI.HstUI
* @extends Ext.panel.Panel
* @brief Hst view
* @author Benjamin
* @version $Id: HstUI.js 1123 2012-10-31 13:47:03Z benjamin $
********************************************************************************
* FT Id : Date : Name - Description
*******************************************************************************
* :
*/
Ext.define('amdaUI.HstUI', {
extend: 'amdaUI.AstroImagesUI',
alias: 'widget.panelHst',
getPreviewUrl : function(image)
{
return 'http://archive.stsci.edu/cgi-bin/hst_preview_search?ne=on&shrink=on&imfmt=gif&name='+image.get('name');
},
getImageLink : function(image)
{
return 'http://archive.stsci.edu/cgi-bin/mastpreview?mission=hst&dataid='+image.get('id');
},
getImageToSendUrl : function(image)
{
return 'http://archive.stsci.edu/cgi-bin/hst_preview_search?ne=on&imfmt=fits&name='+image.get('id');
},
getAcknowledgement : function()
{
return '<br/><a target="_blank" href="http://archive.stsci.edu/">Mikulski Archive for Space Telescopes (MAST)</a>';
},
getTargetList : function()
{
return [
["saturn", "Saturn"],
["jupiter", "Jupiter"],
["uranus", "Uranus"]];
},
onFinishGetImages : function(result, e)
{
var t = e.getTransaction();
if (e.status && result)
{
if (result.success)
{
this.createTree(result.result);
}
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 = Ext.Date.format(this.timeSelector.getStartTime(),"Y-m-d H:i:s");
var stopTime = Ext.Date.format(this.timeSelector.getStopTime(),"Y-m-d H:i:s");
var planet = this.getTargetCombo().getValue();
var obj = {
startTime : startTime,
stopTime : stopTime,
planet : planet
};
this.getImageTreePanel().setLoading(true);
AmdaAction.getHstImagesUrl(obj,this.onFinishGetImages,this);
}
});