comparison app/view/window/FileUpload.js @ 890:def27cdd0dfa

Added Documentation to Windows
author Dustin Demuth <dustin@intevation.de>
date Thu, 23 Jul 2015 16:40:50 +0200
parents 3bc19188fc3a
children f73ca04d73a7
comparison
equal deleted inserted replaced
889:81fc61545638 890:def27cdd0dfa
5 * and comes with ABSOLUTELY NO WARRANTY! Check out 5 * and comes with ABSOLUTELY NO WARRANTY! Check out
6 * the documentation coming with IMIS-Labordaten-Application for details. 6 * the documentation coming with IMIS-Labordaten-Application for details.
7 */ 7 */
8 8
9 /** 9 /**
10 * This is a simple Fileupload Window, used to upload LAF-Files
10 */ 11 */
11 Ext.define('Lada.view.window.FileUpload', { 12 Ext.define('Lada.view.window.FileUpload', {
12 extend: 'Ext.window.Window', 13 extend: 'Ext.window.Window',
13 14
14 layout: 'hbox', 15 layout: 'hbox',
15 16
16 file: null, 17 file: null,
17 18
19 /**
20 * This function initialises the Window
21 */
18 initComponent: function() { 22 initComponent: function() {
19 var me = this; 23 var me = this;
20 this.browseButton = Ext.create('Ext.ux.upload.BrowseButton', { 24 this.browseButton = Ext.create('Ext.ux.upload.BrowseButton', {
21 buttonText: 'Durchsuchen...', 25 buttonText: 'Durchsuchen...',
22 margin: '3, 3, 3, 3' 26 margin: '3, 3, 3, 3'
43 }, this); 47 }, this);
44 this.browseButton.on('fileselected', this.fileSelected, this); 48 this.browseButton.on('fileselected', this.fileSelected, this);
45 this.callParent(arguments); 49 this.callParent(arguments);
46 }, 50 },
47 51
52 /**
53 * @private
54 * A handler for a Abort-Button
55 */
48 abort: function(button) { 56 abort: function(button) {
49 var win = button.up('window'); 57 var win = button.up('window');
50 win.close(); 58 win.close();
51 }, 59 },
52 60
61 /**
62 * @private
63 * A handler for the Input field
64 */
53 fileSelected: function(input, file) { 65 fileSelected: function(input, file) {
54 var item = Ext.create('Ext.ux.upload.Item', { 66 var item = Ext.create('Ext.ux.upload.Item', {
55 fileApiObject: file[0] 67 fileApiObject: file[0]
56 }); 68 });
57 this.fileInput.setValue(item.getName()); 69 this.fileInput.setValue(item.getName());
58 this.file = item; 70 this.file = item;
59 }, 71 },
60 72
73 /**
74 * @private
75 * A handler for the Upload-Button
76 */
61 uploadFile: function(button) { 77 uploadFile: function(button) {
62 // TODO Error handling ? 78 // TODO Error handling ?
63 var win = button.up('window'); 79 var win = button.up('window');
64 var uploader = Ext.create('Ext.ux.upload.uploader.ExtJsUploader', { 80 var uploader = Ext.create('Ext.ux.upload.uploader.ExtJsUploader', {
65 extraHeaders: { 81 extraHeaders: {
73 if (button.up('window').file !== null) { 89 if (button.up('window').file !== null) {
74 uploader.uploadItem(button.up('window').file); 90 uploader.uploadItem(button.up('window').file);
75 } 91 }
76 }, 92 },
77 93
94 /**
95 * @private
96 */
78 uploadSuccess: function(file, response) { 97 uploadSuccess: function(file, response) {
79 this.close(); 98 this.close();
80 var win = Ext.create('Lada.view.window.ImportResponse', { 99 var win = Ext.create('Lada.view.window.ImportResponse', {
81 data: response.response.responseText, 100 data: response.response.responseText,
82 message: response.message, 101 message: response.message,
84 title: 'Importergebnis' 103 title: 'Importergebnis'
85 }); 104 });
86 win.show(); 105 win.show();
87 }, 106 },
88 107
108 /**
109 * @private
110 */
89 uploadFailure: function(file, response) { 111 uploadFailure: function(file, response) {
90 // TODO handle Errors correctly, especially AuthenticationTimeouts 112 // TODO handle Errors correctly, especially AuthenticationTimeouts
91 this.close(); 113 this.close();
92 var win = Ext.create('Lada.view.window.ImportResponse', { 114 var win = Ext.create('Lada.view.window.ImportResponse', {
93 data: response.response.responseText, 115 data: response.response.responseText,

http://lada.wald.intevation.org