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...
45 var pad = d.el.getSize().height - (d.header.getSize().height +
46 d.footer.getSize().height +
47 d.layout.getRegion('center').getPanel(0).el.getSize().height
52 d.header.getSize().height +
53 d.footer.getSize().height +
54 d.layout.getRegion('center').getPanel(0).el.child('div').getSize().height
56 this.resizeTo(d.el.getSize().width, height);
58 if (this.keylistener) {
61 this.keylistener = this.addKeyListener(27, this.hide, this);
71 title : "Upload an Image or File",
72 uploadComplete : false,
75 uploadProgress : function()
78 if (!dlg.haveProgress) {
79 Roo.MessageBox.progress("Uploading", "Uploading");
82 if (dlg.haveProgress == 2) {
83 // it's been closed elsewhere..
86 if (dlg.uploadComplete) {
87 Roo.MessageBox.hide();
93 var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();
95 url : baseURL + '/Core/UploadProgress.php',
100 success : function(res){
103 if (dlg.haveProgress == 2) {
104 // it's been closed elsewhere..
108 if (dlg.uploadComplete) {
109 Roo.MessageBox.hide();
114 Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
115 Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
118 Roo.MessageBox.updateProgress(1,
119 "Upload Complete - processing"
123 dlg.uploadProgress.defer(2000,dlg);
125 failure: function(data) {
126 // console.log('fail');
127 // console.log(data);
134 xtype: 'ContentPanel',
143 actioncomplete : function(_self,act)
145 _this.dialog.uploadComplete = true;
146 _this.dialog.haveProgress = 2;
147 Roo.MessageBox.hide(); // force hiding
148 //_this.dialog.el.unmask();
150 if (act.type == 'setdata') {
151 this.url = _this.data._url ? _this.data._url : baseURL + '/Roo/Images.php';
152 this.el.dom.action = this.url;
153 if (typeof(_this.data.timeout) != 'undefined') {
154 this.timeout = _this.data.timeout;
157 this.findField('UPLOAD_IDENTIFIER').setValue(
158 (new Date() * 1) + '' + Math.random());
164 if (act.type == 'load') {
165 // should this happen?
166 _this.data = act.result.data;
172 if (act.type == 'submit') { // only submitted here if we are
174 Roo.log("Upload success");
177 if (_this.callback) {
178 _this.callback.call(this, act.result.data, act.result.extra);
186 rendered : function (form)
190 actionfailed : function (_self, act)
194 _this.dialog.uploadComplete = true;
195 // _this.dialog.el.unmask();
197 _this.dialog.haveProgress = 2;
198 if (act.type == 'submit') {
199 Roo.log("Upload error");
203 Roo.MessageBox.alert("Error", act.result.errorMsg.split(/\n/).join('<BR/>'));
206 Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");
211 // what about load failing..
212 Roo.MessageBox.alert("Error", "Error loading details");
218 style : 'margin:10px;',
220 url : baseURL + '/Roo/Images.php',
225 name : 'UPLOAD_IDENTIFIER'
230 name : 'post_max_size',
236 name : 'upload_max_filesize',
242 fieldLabel : 'Upload Image or File',
244 name : 'imageUpload',
273 xtype: 'LayoutRegion',
281 click : function (_self, e)
292 click : function (_self, e)
296 //_this.dialog.el.mask("Sending");
297 _this.dialog.uploadComplete = false;
298 _this.form.doAction('submit', {
303 _this.dialog.haveProgress = 0; // set to show..
304 _this.dialog.uploadProgress.defer(1000, _this.dialog);