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",
14 'ea72bacd2fdfa818907bb9559e6905a1' :"Upload Image or File"
20 show : function(data, cb)
28 this.dialog.show(this.data._el);
31 this.form.setValues(data);
32 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
40 this.dialog = Roo.factory({
48 title : _this._strings['2859a4ae58ae4e25abdfc530f814e42f'] /* Upload an Image or File */,
49 uploadComplete : false,
50 uploadProgress : function()
53 if (!dlg.haveProgress) {
54 Roo.MessageBox.progress("Uploading", "Uploading");
57 if (dlg.haveProgress == 2) {
58 // it's been closed elsewhere..
61 if (dlg.uploadComplete) {
62 Roo.MessageBox.hide();
68 var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();
70 url : baseURL + '/Core/UploadProgress.php',
75 success : function(res){
78 if (dlg.haveProgress == 2) {
79 // it's been closed elsewhere..
83 if (dlg.uploadComplete) {
84 Roo.MessageBox.hide();
89 Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
90 Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
93 Roo.MessageBox.updateProgress(1,
94 "Upload Complete - processing"
98 dlg.uploadProgress.defer(2000,dlg);
100 failure: function(data) {
101 // console.log('fail');
102 // console.log(data);
110 xtype : 'LayoutDialog',
112 show : function (_self)
115 // this does not really work - escape on the borders works..
116 // resize to fit.. if we have styled stuff...
123 var pad = d.el.getSize().height - (d.header.getSize().height +
124 d.footer.getSize().height +
125 d.layout.getRegion('center').getPanel(0).el.getSize().height
130 d.header.getSize().height +
131 d.footer.getSize().height +
132 d.layout.getRegion('center').getPanel(0).el.child('div').getSize().height
134 this.resizeTo(d.el.getSize().width, height);
136 if (this.keylistener) {
139 this.keylistener = this.addKeyListener(27, this.hide, this);
146 xtype : 'LayoutRegion'
150 text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
155 click : function (_self, e)
162 text : _this._strings['91412465ea9169dfd901dd5e7c96dd99'] /* Upload */,
167 click : function (_self, e)
171 //_this.dialog.el.mask("Sending");
172 _this.dialog.uploadComplete = false;
173 _this.form.doAction('submit', {
178 _this.dialog.haveProgress = 0; // set to show..
179 _this.dialog.uploadProgress.defer(1000, _this.dialog);
191 xtype : 'ContentPanel',
197 style : 'margin:10px;',
199 url : baseURL + '/Roo/Images.php',
204 actioncomplete : function(_self,act)
206 _this.dialog.uploadComplete = true;
207 _this.dialog.haveProgress = 2;
208 Roo.MessageBox.hide(); // force hiding
209 //_this.dialog.el.unmask();
211 if (act.type == 'setdata') {
212 this.url = _this.data._url ? _this.data._url : baseURL + '/Roo/Images.php';
213 this.el.dom.action = this.url;
214 if (typeof(_this.data.timeout) != 'undefined') {
215 this.timeout = _this.data.timeout;
218 this.findField('UPLOAD_IDENTIFIER').setValue(
219 (new Date() * 1) + '' + Math.random());
225 if (act.type == 'load') {
226 // should this happen?
227 _this.data = act.result.data;
233 if (act.type == 'submit') { // only submitted here if we are
235 Roo.log("Upload success");
238 if (_this.callback) {
239 _this.callback.call(this, act.result.data, act.result.extra);
247 actionfailed : function (_self, act)
251 _this.dialog.uploadComplete = true;
252 // _this.dialog.el.unmask();
254 _this.dialog.haveProgress = 2;
255 if (act.type == 'submit') {
256 Roo.log("Upload error");
260 Roo.MessageBox.alert("Error", act.result.errorMsg.split(/\n/).join('<BR/>'));
263 Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");
268 // what about load failing..
269 Roo.MessageBox.alert("Error", "Error loading details");
271 rendered : function (form)
278 name : 'UPLOAD_IDENTIFIER',
284 name : 'post_max_size',
285 value : _this._strings['eb5d45750c7ab13aa8e6bacc80315a30'] /* 32M */,
291 name : 'upload_max_filesize',
292 value : _this._strings['eb5d45750c7ab13aa8e6bacc80315a30'] /* 32M */,
298 fieldLabel : _this._strings['ea72bacd2fdfa818907bb9559e6905a1'] /* Upload Image or File */,
300 name : 'imageUpload',