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',
34 keydown : function (_self, e)
45 title : "Upload an Image or File",
46 uploadProgress : false,
49 uploadProgres : function()
52 if (!dlg.haveProgress) {
53 Roo.MessageBox.progress("Uploading", "Uploading");
55 if (dlg.uploadComplete) {
56 Roo.MessageBox.hide();
59 dlg.haveProgress = true;
61 var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();
63 url : baseURL + '/Core/UploadProgress.php',
68 success : function(data){
70 if (dlg.uploadComplete) {
71 Roo.MessageBox.hide();
76 Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
77 Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
80 dlg.uploadProgress.defer(2000,dlg);
82 failure: function(data) {
83 // console.log('fail');
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);