diff --git a/js/app/controllers/UploadModule.js b/js/app/controllers/UploadModule.js
index 677cdf8..7c2f25f 100644
--- a/js/app/controllers/UploadModule.js
+++ b/js/app/controllers/UploadModule.js
@@ -20,8 +20,8 @@ Ext.define('amdaDesktop.UploadModule', {
* @cfg {String} window definitions
* @required
*/
- width: 320,
- height: 510,
+ width: 330,
+ height: 520,
uiType : 'panelTabUpload',
helpTitle : 'Help on Upload Module',
helpFile : 'uploadHelp',
diff --git a/js/app/views/UploadPanelUI.js b/js/app/views/UploadPanelUI.js
index 661beb4..c35db0e 100644
--- a/js/app/views/UploadPanelUI.js
+++ b/js/app/views/UploadPanelUI.js
@@ -15,15 +15,16 @@ Ext.define('amdaUI.UploadPanelUI', {
requires : [
'amdaUI.RemoteSearchPlugin'
],
-
- isFile : true,
- isTimeTable : false,
- tmpNode : null,
+ tmpNode : null,
+ specialItems : null,
+ formats : null,
+ localName : null,
+
constructor: function(config)
{
this.init(config);
- this.callParent(arguments);
+ this.callParent(arguments);
},
/*
@@ -39,8 +40,7 @@ Ext.define('amdaUI.UploadPanelUI', {
var me = this;
myDesktopApp.getLoadedModule(this.tmpNode.get('moduleId'), true, function (module){
// myData
- if (me.tmpNode.get('nodeType') == amdaModel.MyDataParamNode.nodeType)
- {
+ if (me.tmpNode.get('nodeType') == amdaModel.MyDataParamNode.nodeType) {
var linkedFile = Ext.create('amdaModel.MyDataNode', {leaf : true, text : me.tmpNode.get('text')});
linkedFile.create(result.mask, result.description, result.maskDesc);
@@ -53,37 +53,33 @@ Ext.define('amdaUI.UploadPanelUI', {
linkedFile.set('object',paramObj);
me.tmpNode.set('fileObject',paramObj);
}
- else
- {
+ else {
// Time Table or Catalog
var paramObj = Ext.create(me.tmpNode.get('objectDataModel'), result);
paramObj.set('fromPlugin',true);
- if (result.intervals)
- {
+ if (result.intervals) {
paramObj.set('intervals',result.intervals);
paramObj.set('nbIntervals',result.intervals.length);
}
me.tmpNode.set('object',paramObj);
}
- if (module)
- {
+ if (module) {
module.setLinkedNode(me.tmpNode);
module.linkedNode.editInModule();
}
});
}
- else
- {
+ else {
// EXCEPTION : parameter not found !
myDesktopApp.errorMsg(t.action + "." + t.method + " : No parameter '"+this.tmpNode.get('text')+"' found!");
}
+
loadMask.hide();
},
/*
* form validation
-* TODO markInvalid()?
*/
validate : function()
{
@@ -91,59 +87,43 @@ Ext.define('amdaUI.UploadPanelUI', {
if (values['filesrc'] == 'LOCAL')
{
- if (this.isFile) var locFile = this.getForm().findField('localFileName').getValue();
- else if (this.isTimeTable) var locFile = this.getForm().findField('localTTName').getValue();
- else var locFile = this.getForm().findField('localCatName').getValue();
-
- if (!locFile)
- {
+ var locFile = this.getForm().findField(this.localName).getValue();
+
+ if (!locFile) {
myDesktopApp.warningMsg("Select File to Upload");
return false;
}
}
else
{
- if (!values['remoteFile'] && !values['remoteTT'] && !values['remoteCat'])
- {
+ if (!values['remoteFile'] && !values['remoteTT'] && !values['remoteCat']) {
myDesktopApp.warningMsg("Select File to Upload");
return false;
}
- }
+ }
+
return true;
},
- //TODO proper parsing
+/*
+ * Upadte format if user didn't do this himself
+ */
updateFormat: function(value)
{
var arrayOfStr = value.split('.');
- //TODO use down method?
- if (this.isFile)
- {
- var radios = Ext.getCmp('filefrmt');
- var user_format_obj = radios.getValue();
- var user_format = user_format_obj.filefrmt;
- }
- else if (this.isTimeTable)
- {
- var radios = Ext.getCmp('ttfrmt');
- var user_format_obj = radios.getValue();
- var user_format = user_format_obj.ttfrmt;
- }
- else
- {
- var radios = Ext.getCmp('catfrmt');
- var user_format_obj = radios.getValue();
- var user_format = user_format_obj.catfrmt;
- }
-
- var auto_format = user_format;
+
+ var radios = Ext.getCmp(this.radioId);
+ var user_format_obj = radios.getValue();
+
+ var user_format = user_format_obj[this.radioId];
// auto define format in some special cases
//TODO name without extention => ASCII?
- if (arrayOfStr.length == 1) auto_format = 'ASCII';
- else
- {
+ if (arrayOfStr.length == 1) {
+ auto_format = 'ASCII';
+ }
+ else {
var suffix = arrayOfStr[arrayOfStr.length - 1].toLowerCase();
if (suffix == 'gz')
suffix = arrayOfStr[arrayOfStr.length - 2].toLowerCase() + '.gz';
@@ -155,35 +135,30 @@ Ext.define('amdaUI.UploadPanelUI', {
case 'cef' : auto_format = 'CEF'; break;
case 'xml' : auto_format = 'VOT';
case 'vot' : auto_format = 'VOT'; break;
- case 'nc' : auto_format = 'NC'; break;
+ case 'nc' : auto_format = 'NC'; break;
case 'asc' :
case 'txt' :
default : auto_format = 'ASCII';
}
}
// set auto format : case when format was not set by user before
- if (this.isFile && user_format !== auto_format) {
- user_format_obj.filefrmt = auto_format;
- } else if (this.isTimeTable && user_format !== auto_format) {
- user_format_obj.ttfrmt = auto_format;
- } else if (!this.isFile && !this.isTimeTable && user_format !== auto_format) {
- user_format_obj.catfrmt = auto_format;
- }
-
+ if (user_format !== auto_format) {
+ user_format_obj[this.radioId] = auto_format;
+ }
+
radios.setValue(user_format_obj);
},
- /*
- *
- */
+/*
+*
+*/
forceUpload : function (url,format,onFinish)
{
var me = this;
var re = /http:\/\/127.0.0.1:/;
var isRemoteUrl = !re.test(url);
- switch (format)
- {
+ switch (format) {
case 'votable' :
this.getForm().findField('filefrmt').setValue('VOT');
break;
@@ -230,14 +205,14 @@ Ext.define('amdaUI.UploadPanelUI', {
this.postUpload(onFinish);
},
- /*
- *
- */
+/*
+*
+*/
postUpload : function(onFinish)
{
// 'global' form containing 'partial' forms
var form = this.getForm();
-
+
// special validation
if(this.validate())
{
@@ -246,16 +221,14 @@ Ext.define('amdaUI.UploadPanelUI', {
scope: this,
url: 'php/uploadFile.php',
waitMsg: 'Uploading your file...',
- success: function(form, o)
- {
+ success: function(form, o) {
if (onFinish)
onFinish();
this.tmpNode = Ext.create(this.nodeType,{leaf : true, text : o.result.file});
AmdaAction.getUploadedObject(o.result.file, o.result.format, this.tmpNode.get('nodeType'), this.getObjectCallback, this);
loadMask.hide();
},
- failure: function(form, o)
- {
+ failure: function(form, o) {
if (onFinish)
onFinish();
loadMask.hide();
@@ -265,25 +238,19 @@ Ext.define('amdaUI.UploadPanelUI', {
}
},
- /*
- * panel config
- */
- init : function(config)
- {
- this.isFile = config.panelType == 'file'? true : false;
- this.isTimeTable = config.panelType == 'timetable'? true : false;
-
- // file / time table / catalog settings
- if (this.isFile)
- {
- var title = 'File';
- var items = [
+ initFileUpload : function()
+ {
+ this.formats = [
{ boxLabel: 'ASCII', name: 'filefrmt', inputValue: 'ASCII', checked: true,
- listeners:
- {
+ listeners: {
change: function (cb, nv, ov) {
- if (nv) Ext.getCmp('tf').show();
- else Ext.getCmp('tf').hide();
+ if (nv) {
+ Ext.getCmp('tf').show();
+ }
+ else {
+ Ext.getCmp('tf').hide();
+ Ext.getCmp('nfs').hide();
+ }
}
}
},
@@ -291,143 +258,88 @@ Ext.define('amdaUI.UploadPanelUI', {
{ boxLabel: 'CDF 0) {
this.nextSibling().show();
@@ -446,65 +357,147 @@ Ext.define('amdaUI.UploadPanelUI', {
}
}
}
- },
- dayStart,
- {
- fieldLabel : 'define max time length',
- name : 'timelength',
- value: 'auto'
+ },{
+ xtype: 'checkbox',
+ name : 'doy',
+ fieldLabel: 'DOY starts from 1',
+ hidden : true,
+ inputValue: '1'
+ },{
+ fieldLabel : 'define max time length',
+ name : 'timelength',
+ value: 'auto'
}],
- listeners :
- {
+ listeners : {
hide : function() {
this.items.getAt(1).hide();
+ },
+ show : function() {
+ if (this.items.getAt(0).getValue().indexOf('z') > 0)
+ this.items.getAt(1).show();
}
}
- };
-
- var timeFormat = Ext.create('Ext.form.FieldSet', {
- id: timeFormatId,
+ };
+
+/*
+ * TimeFormat Fieldset : Global form
+ */
+ var timeFormat = Ext.create('Ext.form.FieldSet', {
title: 'Time Settings',
- hidden : !this.isFile,
- items : [
- {
+ items : [{
+ id: 'tf',
xtype: 'radiogroup',
fieldLabel: 'Time Format',
labelWidth: 90,
cls: 'x-check-group-alt',
defaults : { name : 'timefrmt'},
items: [
- { boxLabel: 'standard