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