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 show : function (_self)
36 if (this.keylistener) {
39 this.keylistener = this.addKeyListener(27, this.hide, this);
48 title : "Upload an Image or File",
49 uploadProgress : false,
52 uploadProgres : function()
55 if (!dlg.haveProgress) {
56 Roo.MessageBox.progress("Uploading", "Uploading");
58 if (dlg.uploadComplete) {
59 Roo.MessageBox.hide();
62 dlg.haveProgress = true;
64 var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();
66 url : baseURL + '/Core/UploadProgress.php',
71 success : function(data){
73 if (dlg.uploadComplete) {
74 Roo.MessageBox.hide();
79 Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
80 Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
83 dlg.uploadProgress.defer(2000,dlg);
85 failure: function(data) {
86 // console.log('fail');
94 xtype: 'ContentPanel',
103 actioncomplete : function(_self,act)
105 _this.dialog.uploadComplete = true;
106 _this.dialog.el.unmask();
108 if (act.type == 'setdata') {
110 this.findField('UPLOAD_IDENTIFIER').setValue(
111 (new Date() * 1) + '' + Math.random());
116 if (act.type == 'load') {
117 // should this happen?
118 _this.data = act.result.data;
124 if (act.type == 'submit') { // only submitted here if we are
127 if (_this.callback) {
128 _this.callback.call(this, act.result.data);
133 rendered : function (form)
137 actionfailed : function (_self, act)
139 _this.dialog.uploadComplete = true;
140 _this.dialog.el.unmask();
143 if (act.type == 'submit') {
144 Ext.MessageBox.alert("Error", "Saving failed = fix errors and try again");
148 // what about load failing..
149 Ext.MessageBox.alert("Error", "Error loading details");
154 style : 'margin:10px;',
155 url : baseURL + '/Roo/Images.php',
160 name : 'UPLOAD_IDENTIFIER'
165 fieldLabel : 'Upload Image or File',
167 name : 'imageUpload',
188 name : 'post_max_size',
194 name : 'upload_max_filesize',
203 xtype: 'LayoutRegion',
211 click : function (_self, e)
222 click : function (_self, e)
226 _this.dialog.el.mask("Sending");
227 _this.dialog.uploadComplete = false;
228 _this.form.doAction('submit', {
229 url: baseURL + '/Roo/Images.html',
236 _this.dialog.haveProgress = false,
237 _this.dialog.uploadProgress.defer(1000, _this.dialog);