1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
10 show : function(data, cb)
18 this.dialog.show(this.data._el);
21 this.form.setValues(data);
22 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
30 this.dialog = Roo.factory({
31 xtype: 'LayoutDialog',
34 show : function (_self)
36 // this does not really work - escape on the borders works..
37 if (this.keylistener) {
40 this.keylistener = this.addKeyListener(27, this.hide, this);
50 title : "Upload an Image or File",
51 uploadComplete : false,
54 uploadProgress : function()
57 if (!dlg.haveProgress) {
58 Roo.MessageBox.progress("Uploading", "Uploading");
61 if (dlg.haveProgress == 2) {
62 // it's been closed elsewhere..
65 if (dlg.uploadComplete) {
66 Roo.MessageBox.hide();
72 var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();
74 url : baseURL + '/Core/UploadProgress.php',
79 success : function(res){
82 if (dlg.haveProgress == 2) {
83 // it's been closed elsewhere..
87 if (dlg.uploadComplete) {
88 Roo.MessageBox.hide();
93 Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
94 Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
97 Roo.MessageBox.updateProgress(1,
98 "Upload Complete - processing"
102 dlg.uploadProgress.defer(2000,dlg);
104 failure: function(data) {
105 // console.log('fail');
106 // console.log(data);
113 xtype: 'ContentPanel',
122 actioncomplete : function(_self,act)
124 _this.dialog.uploadComplete = true;
125 _this.dialog.haveProgress = 2;
126 Roo.MessageBox.hide(); // force hiding
127 //_this.dialog.el.unmask();
129 if (act.type == 'setdata') {
130 this.url = _this.data._url ? _this.data._url : baseURL + '/Roo/Images.php';
131 this.el.dom.action = this.url;
132 if (typeof(_this.data.timeout) != 'undefined') {
133 this.timeout = _this.data.timeout;
136 this.findField('UPLOAD_IDENTIFIER').setValue(
137 (new Date() * 1) + '' + Math.random());
143 if (act.type == 'load') {
144 // should this happen?
145 _this.data = act.result.data;
151 if (act.type == 'submit') { // only submitted here if we are
153 Roo.log("Upload success");
156 if (_this.callback) {
157 _this.callback.call(this, act.result.data, act.result.extra);
165 rendered : function (form)
169 actionfailed : function (_self, act)
173 _this.dialog.uploadComplete = true;
174 // _this.dialog.el.unmask();
176 _this.dialog.haveProgress = 2;
177 if (act.type == 'submit') {
178 Roo.log("Upload error");
182 Roo.MessageBox.alert("Error", act.result.errorMsg.split(/\n/).join('<BR/>'));
185 Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");
190 // what about load failing..
191 Roo.MessageBox.alert("Error", "Error loading details");
197 style : 'margin:10px;',
199 url : baseURL + '/Roo/Images.php',
204 name : 'UPLOAD_IDENTIFIER'
209 name : 'post_max_size',
215 name : 'upload_max_filesize',
221 fieldLabel : 'Upload Image or File',
223 name : 'imageUpload',
252 xtype: 'LayoutRegion',
260 click : function (_self, e)
271 click : function (_self, e)
275 //_this.dialog.el.mask("Sending");
276 _this.dialog.uploadComplete = false;
277 _this.form.doAction('submit', {
282 _this.dialog.haveProgress = 0; // set to show..
283 _this.dialog.uploadProgress.defer(1000, _this.dialog);