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({
41 xtype : 'LayoutDialog',
49 title : _this._strings['2859a4ae58ae4e25abdfc530f814e42f'] /* Upload an Image or File */,
50 uploadComplete : false,
51 uploadProgress : function()
54 if (!dlg.haveProgress) {
55 Roo.MessageBox.progress("Uploading", "Uploading");
58 if (dlg.haveProgress == 2) {
59 // it's been closed elsewhere..
62 if (dlg.uploadComplete) {
63 Roo.MessageBox.hide();
69 var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();
71 url : baseURL + '/Core/UploadProgress.php',
76 success : function(res){
79 if (dlg.haveProgress == 2) {
80 // it's been closed elsewhere..
84 if (dlg.uploadComplete) {
85 Roo.MessageBox.hide();
90 Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
91 Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
94 Roo.MessageBox.updateProgress(1,
95 "Upload Complete - processing"
99 dlg.uploadProgress.defer(2000,dlg);
101 failure: function(data) {
102 // console.log('fail');
103 // console.log(data);
110 show : function (_self)
113 // this does not really work - escape on the borders works..
114 // resize to fit.. if we have styled stuff...
121 var pad = d.el.getSize().height - (d.header.getSize().height +
122 d.footer.getSize().height +
123 d.layout.getRegion('center').getPanel(0).el.getSize().height
128 d.header.getSize().height +
129 d.footer.getSize().height +
130 d.layout.getRegion('center').getPanel(0).el.child('div').getSize().height
132 this.resizeTo(d.el.getSize().width, height);
134 if (this.keylistener) {
137 this.keylistener = this.addKeyListener(27, this.hide, this);
144 xtype : 'LayoutRegion',
151 text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
153 click : function (_self, e)
163 text : _this._strings['91412465ea9169dfd901dd5e7c96dd99'] /* Upload */,
165 click : function (_self, e)
169 //_this.dialog.el.mask("Sending");
170 _this.dialog.uploadComplete = false;
171 _this.form.doAction('submit', {
176 _this.dialog.haveProgress = 0; // set to show..
177 _this.dialog.uploadProgress.defer(1000, _this.dialog);
187 xtype : 'ContentPanel',
198 style : 'margin:10px;',
200 url : baseURL + '/Roo/Images.php',
202 actioncomplete : function(_self,act)
204 _this.dialog.uploadComplete = true;
205 _this.dialog.haveProgress = 2;
206 Roo.MessageBox.hide(); // force hiding
207 //_this.dialog.el.unmask();
209 if (act.type == 'setdata') {
210 this.url = _this.data._url ? _this.data._url : baseURL + '/Roo/Images.php';
211 this.el.dom.action = this.url;
212 if (typeof(_this.data.timeout) != 'undefined') {
213 this.timeout = _this.data.timeout;
216 this.findField('UPLOAD_IDENTIFIER').setValue(
217 (new Date() * 1) + '' + Math.random());
223 if (act.type == 'load') {
224 // should this happen?
225 _this.data = act.result.data;
231 if (act.type == 'submit') { // only submitted here if we are
233 Roo.log("Upload success");
236 if (_this.callback) {
237 _this.callback.call(this, act.result.data, act.result.extra);
245 actionfailed : function (_self, act)
249 _this.dialog.uploadComplete = true;
250 // _this.dialog.el.unmask();
252 _this.dialog.haveProgress = 2;
253 if (act.type == 'submit') {
254 Roo.log("Upload error");
258 Roo.MessageBox.alert("Error", act.result.errorMsg.split(/\n/).join('<BR/>'));
261 Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");
266 // what about load failing..
267 Roo.MessageBox.alert("Error", "Error loading details");
269 rendered : function (form)
279 name : 'UPLOAD_IDENTIFIER',
285 name : 'post_max_size',
286 value : _this._strings['eb5d45750c7ab13aa8e6bacc80315a30'] /* 32M */,
292 name : 'upload_max_filesize',
293 value : _this._strings['eb5d45750c7ab13aa8e6bacc80315a30'] /* 32M */,
299 fieldLabel : _this._strings['ea72bacd2fdfa818907bb9559e6905a1'] /* Upload Image or File */,
301 name : 'imageUpload',