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');
84 show : function (_self)
91 xtype: 'ContentPanel',
100 actioncomplete : function(_self,act)
102 _this.dialog.uploadComplete = true;
103 _this.dialog.el.unmask();
105 if (act.type == 'setdata') {
107 this.findField('UPLOAD_IDENTIFIER').setValue(
108 (new Date() * 1) + '' + Math.random());
113 if (act.type == 'load') {
114 // should this happen?
115 _this.data = act.result.data;
121 if (act.type == 'submit') { // only submitted here if we are
124 if (_this.callback) {
125 _this.callback.call(this, act.result.data);
130 rendered : function (form)
134 actionfailed : function (_self, act)
136 _this.dialog.uploadComplete = true;
137 _this.dialog.el.unmask();
140 if (act.type == 'submit') {
141 Ext.MessageBox.alert("Error", "Saving failed = fix errors and try again");
145 // what about load failing..
146 Ext.MessageBox.alert("Error", "Error loading details");
151 style : 'margin:10px;',
152 url : baseURL + '/Roo/Images.php',
157 name : 'UPLOAD_IDENTIFIER'
162 fieldLabel : 'Upload Image or File',
185 name : 'post_max_size',
191 name : 'upload_max_filesize',
200 xtype: 'LayoutRegion',
208 click : function (_self, e)
219 click : function (_self, e)
223 _this.dialog.el.mask("Sending");
224 _this.dialog.uploadComplete = false;
225 _this.form.doAction('submit', {
226 url: baseURL + '/Roo/Images.html',
233 _this.dialog.haveProgress = false,
234 _this.dialog.uploadProgress.defer(1000, _this.dialog);