1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Dialog');
10 'eb5d45750c7ab13aa8e6bacc80315a30' :"32M",
11 '2859a4ae58ae4e25abdfc530f814e42f' :"Upload an Image or File",
12 'ea4788705e6873b424c65e91c2846b19' :"Cancel",
13 '91412465ea9169dfd901dd5e7c96dd99' :"Upload"
19 show : function(data, cb)
27 this.dialog.show(this.data._el);
30 this.form.setValues(data);
31 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
39 this.dialog = Roo.factory({
43 xtype : 'LayoutRegion'
53 title : _this._strings['2859a4ae58ae4e25abdfc530f814e42f'],
54 uploadComplete : false,
55 uploadProgress : function()
58 if (!dlg.haveProgress) {
59 Roo.MessageBox.progress("Uploading", "Uploading");
62 if (dlg.haveProgress == 2) {
63 // it's been closed elsewhere..
66 if (dlg.uploadComplete) {
67 Roo.MessageBox.hide();
73 var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();
75 url : baseURL + '/Core/UploadProgress.php',
80 success : function(res){
83 if (dlg.haveProgress == 2) {
84 // it's been closed elsewhere..
88 if (dlg.uploadComplete) {
89 Roo.MessageBox.hide();
94 Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
95 Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
98 Roo.MessageBox.updateProgress(1,
99 "Upload Complete - processing"
103 dlg.uploadProgress.defer(2000,dlg);
105 failure: function(data) {
106 // console.log('fail');
107 // console.log(data);
114 xtype : 'LayoutDialog',
118 text : _this._strings['ea4788705e6873b424c65e91c2846b19'],
122 click : function (_self, e)
130 text : _this._strings['91412465ea9169dfd901dd5e7c96dd99'],
134 click : function (_self, e)
138 //_this.dialog.el.mask("Sending");
139 _this.dialog.uploadComplete = false;
140 _this.form.doAction('submit', {
145 _this.dialog.haveProgress = 0; // set to show..
146 _this.dialog.uploadProgress.defer(1000, _this.dialog);
153 show : function (_self)
156 // this does not really work - escape on the borders works..
157 // resize to fit.. if we have styled stuff...
164 var pad = d.el.getSize().height - (d.header.getSize().height +
165 d.footer.getSize().height +
166 d.layout.getRegion('center').getPanel(0).el.getSize().height
171 d.header.getSize().height +
172 d.footer.getSize().height +
173 d.layout.getRegion('center').getPanel(0).el.child('div').getSize().height
175 this.resizeTo(d.el.getSize().width, height);
177 if (this.keylistener) {
180 this.keylistener = this.addKeyListener(27, this.hide, this);
190 xtype : 'ContentPanel',
197 style : 'margin:10px;',
199 url : baseURL + '/Roo/Images.php',
203 actioncomplete : function(_self,act)
205 _this.dialog.uploadComplete = true;
206 _this.dialog.haveProgress = 2;
207 Roo.MessageBox.hide(); // force hiding
208 //_this.dialog.el.unmask();
210 if (act.type == 'setdata') {
211 this.url = _this.data._url ? _this.data._url : baseURL + '/Roo/Images.php';
212 this.el.dom.action = this.url;
213 if (typeof(_this.data.timeout) != 'undefined') {
214 this.timeout = _this.data.timeout;
217 this.findField('UPLOAD_IDENTIFIER').setValue(
218 (new Date() * 1) + '' + Math.random());
224 if (act.type == 'load') {
225 // should this happen?
226 _this.data = act.result.data;
232 if (act.type == 'submit') { // only submitted here if we are
234 Roo.log("Upload success");
237 if (_this.callback) {
238 _this.callback.call(this, act.result.data, act.result.extra);
246 actionfailed : function (_self, act)
250 _this.dialog.uploadComplete = true;
251 // _this.dialog.el.unmask();
253 _this.dialog.haveProgress = 2;
254 if (act.type == 'submit') {
255 Roo.log("Upload error");
259 Roo.MessageBox.alert("Error", act.result.errorMsg.split(/\n/).join('<BR/>'));
262 Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");
267 // what about load failing..
268 Roo.MessageBox.alert("Error", "Error loading details");
270 rendered : function (form)
278 name : 'UPLOAD_IDENTIFIER',
284 name : 'post_max_size',
285 value : _this._strings['eb5d45750c7ab13aa8e6bacc80315a30'],
291 name : 'upload_max_filesize',
292 value : _this._strings['eb5d45750c7ab13aa8e6bacc80315a30'],
298 fieldLabel : 'Upload Image or File',
300 name : 'imageUpload',