File size: 2,689 Bytes
1abfaca | 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 | /*
* Copyright (C) 2010 Camptocamp
*
* This file is part of Studio
*
* Studio is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Studio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Studio. If not, see <http://www.gnu.org/licenses/>.
*/
Ext.namespace('Studio', 'Studio.DataMgr');
Studio.DataMgr.AddDatasourceWindow = Ext.extend(Ext.Window, {
title: OpenLayers.i18n('Add a datasource'),
layout: 'form',
modal: true,
width: 400,
datastoreId: null,
initComponent: function() {
var form = new Ext.form.FormPanel({
bodyStyle: 'padding:5px',
fileUpload: true,
border: false,
items: [{
fieldLabel: OpenLayers.i18n('datasource'),
labelWidth: 120, // FIXME: do not works ...
xtype: 'fileuploadfield',
name: 'datasources',
listeners: {
fileselected: function(fb, v) {
Ext.getCmp(this.id + '_add_button').setDisabled(false);
},
scope: this
}
}],
buttons: [{
text: OpenLayers.i18n('add'),
id: this.id + '_add_button',
disabled: true,
handler: function() {
form.getForm().submit({
url: subString(Studio.datastoreStore.datasourceUrlScheme, {
DATASTORE_ID: this.datastoreId
}),
waitMsg: OpenLayers.i18n('Uploading file...'),
success: function(fp, o) {
this.fireEvent('fileuploaded');
this.close();
},
scope: this
});
},
scope: this
}, {
text: OpenLayers.i18n('Cancel'),
handler: function() {
this.close();
},
scope: this
}]
});
this.items = [form];
Studio.DataMgr.AddDatasourceWindow.superclass.initComponent.apply(this, arguments);
}
});
|