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)
37 // this does not really work - escape on the borders works..
38 // resize to fit.. if we have styled stuff...
41 if (this.keylistener) {
44 this.keylistener = this.addKeyListener(27, this.hide, this);
54 title : "Upload an Image or File",
55 uploadComplete : false,
58 uploadProgress : function()
61 if (!dlg.haveProgress) {
62 Roo.MessageBox.progress("Uploading", "Uploading");
65 if (dlg.haveProgress == 2) {
66 // it's been closed elsewhere..
69 if (dlg.uploadComplete) {
70 Roo.MessageBox.hide();
76 var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();
78 url : baseURL + '/Core/UploadProgress.php',
83 success : function(res){
86 if (dlg.haveProgress == 2) {
87 // it's been closed elsewhere..
91 if (dlg.uploadComplete) {
92 Roo.MessageBox.hide();
97 Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
98 Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
101 Roo.MessageBox.updateProgress(1,
102 "Upload Complete - processing"
106 dlg.uploadProgress.defer(2000,dlg);
108 failure: function(data) {
109 // console.log('fail');
110 // console.log(data);
117 xtype: 'ContentPanel',
126 actioncomplete : function(_self,act)
128 _this.dialog.uploadComplete = true;
129 _this.dialog.haveProgress = 2;
130 Roo.MessageBox.hide(); // force hiding
131 //_this.dialog.el.unmask();
133 if (act.type == 'setdata') {
134 this.url = _this.data._url ? _this.data._url : baseURL + '/Roo/Images.php';
135 this.el.dom.action = this.url;
136 if (typeof(_this.data.timeout) != 'undefined') {
137 this.timeout = _this.data.timeout;
140 this.findField('UPLOAD_IDENTIFIER').setValue(
141 (new Date() * 1) + '' + Math.random());
147 if (act.type == 'load') {
148 // should this happen?
149 _this.data = act.result.data;
155 if (act.type == 'submit') { // only submitted here if we are
157 Roo.log("Upload success");
160 if (_this.callback) {
161 _this.callback.call(this, act.result.data, act.result.extra);
169 rendered : function (form)
173 actionfailed : function (_self, act)
177 _this.dialog.uploadComplete = true;
178 // _this.dialog.el.unmask();
180 _this.dialog.haveProgress = 2;
181 if (act.type == 'submit') {
182 Roo.log("Upload error");
186 Roo.MessageBox.alert("Error", act.result.errorMsg.split(/\n/).join('<BR/>'));
189 Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");
194 // what about load failing..
195 Roo.MessageBox.alert("Error", "Error loading details");
201 style : 'margin:10px;',
203 url : baseURL + '/Roo/Images.php',
208 name : 'UPLOAD_IDENTIFIER'
213 name : 'post_max_size',
219 name : 'upload_max_filesize',
225 fieldLabel : 'Upload Image or File',
227 name : 'imageUpload',
256 xtype: 'LayoutRegion',
264 click : function (_self, e)
275 click : function (_self, e)
279 //_this.dialog.el.mask("Sending");
280 _this.dialog.uploadComplete = false;
281 _this.form.doAction('submit', {
286 _this.dialog.haveProgress = 0; // set to show..
287 _this.dialog.uploadProgress.defer(1000, _this.dialog);