/** * 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 '
APIS database by Laurent Lamy - Lesia-Observatoire de Paris'; }, 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); } });