1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Dialog.ImageUpload = {
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',
39 title : "Upload an Image or File",
40 uploadProgress : false,
43 uploadProgres : function()
46 if (!dlg.haveProgress) {
47 Roo.MessageBox.progress("Uploading", "Uploading");
49 if (dlg.uploadComplete) {
50 Roo.MessageBox.hide();
53 dlg.haveProgress = true;
55 var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();
57 url : baseURL + '/Core/UploadProgress.php',
62 success : function(data){
64 if (dlg.uploadComplete) {
65 Roo.MessageBox.hide();
70 Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
71 Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
74 dlg.uploadProgress.defer(2000,dlg);
76 failure: function(data) {
77 // console.log('fail');
85 xtype: 'ContentPanel',
94 actioncomplete : function(_self,act)
96 _this.dialog.uploadComplete = true;
97 _this.dialog.el.unmask();
99 if (act.type == 'setdata') {
101 this.findField('UPLOAD_IDENTIFIER').setValue(
102 (new Date() * 1) + '' + Math.random());
107 if (act.type == 'load') {
108 // should this happen?
109 _this.data = act.result.data;
115 if (act.type == 'submit') { // only submitted here if we are
118 if (_this.callback) {
119 _this.callback.call(this, act.result.data);
124 rendered : function (form)
128 actionfailed : function (_self, act)
130 _this.dialog.uploadComplete = true;
131 _this.dialog.el.unmask();
134 if (act.type == 'submit') {
135 Ext.MessageBox.alert("Error", "Saving failed = fix errors and try again");
139 // what about load failing..
140 Ext.MessageBox.alert("Error", "Error loading details");
145 style : 'margin:10px;',
146 url : baseURL + '/Roo/Images.php',
151 name : 'UPLOAD_IDENTIFIER'
156 fieldLabel : 'Upload Image or File',
179 name : 'post_max_size',
185 name : 'upload_max_filesize',
194 xtype: 'LayoutRegion',
202 click : function (_self, e)
213 click : function (_self, e)
217 _this.dialog.el.mask("Sending");
218 _this.dialog.uploadComplete = false;
219 _this.form.doAction('submit', {
220 url: baseURL + '/Roo/Images.html',
227 _this.dialog.haveProgress = false,
228 _this.dialog.uploadProgress.defer(1000, _this.dialog);