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 'c4ca4238a0b923820dcc509a6f75849b' :"1",
13 'ea4788705e6873b424c65e91c2846b19' :"Cancel",
14 '91412465ea9169dfd901dd5e7c96dd99' :"Upload",
15 'ea72bacd2fdfa818907bb9559e6905a1' :"Upload Image or File"
21 show : function(data, cb)
29 this.dialog.show(this.data._el);
32 this.form.setValues(data);
33 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
41 this.dialog = Roo.factory({
42 xtype : 'LayoutDialog',
50 title : _this._strings['2859a4ae58ae4e25abdfc530f814e42f'] /* Upload an Image or File */,
51 uploadComplete : false,
52 uploadProgress : function()
55 if (!dlg.haveProgress) {
56 Roo.MessageBox.progress("Uploading", "Uploading");
59 if (dlg.haveProgress == 2) {
60 // it's been closed elsewhere..
63 if (dlg.uploadComplete) {
64 Roo.MessageBox.hide();
70 var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();
72 url : baseURL + '/Core/UploadProgress.php',
77 success : function(res){
80 if (dlg.haveProgress == 2) {
81 // it's been closed elsewhere..
85 if (dlg.uploadComplete) {
86 Roo.MessageBox.hide();
91 Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
92 Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
95 Roo.MessageBox.updateProgress(1,
96 "Upload Complete - processing"
100 dlg.uploadProgress.defer(2000,dlg);
102 failure: function(data) {
103 // console.log('fail');
104 // console.log(data);
111 show : function (_self)
114 // this does not really work - escape on the borders works..
115 // resize to fit.. if we have styled stuff...
122 var pad = d.el.getSize().height - (d.header.getSize().height +
123 d.footer.getSize().height +
124 d.layout.getRegion('center').getPanel(0).el.getSize().height
129 d.header.getSize().height +
130 d.footer.getSize().height +
131 d.layout.getRegion('center').getPanel(0).el.child('div').getSize().height
133 this.resizeTo(d.el.getSize().width, height);
135 if (this.keylistener) {
138 this.keylistener = this.addKeyListener(27, this.hide, this);
145 xtype : 'LayoutRegion',
152 text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
154 click : function (_self, e)
164 text : _this._strings['91412465ea9169dfd901dd5e7c96dd99'] /* Upload */,
166 click : function (_self, e)
170 //_this.dialog.el.mask("Sending");
171 _this.dialog.uploadComplete = false;
172 _this.form.doAction('submit', {
177 _this.dialog.haveProgress = 0; // set to show..
178 _this.dialog.uploadProgress.defer(1000, _this.dialog);
188 xtype : 'ContentPanel',
199 style : 'margin:10px;',
201 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)
280 name : 'UPLOAD_IDENTIFIER',
286 name : 'post_max_size',
287 value : _this._strings['eb5d45750c7ab13aa8e6bacc80315a30'] /* 32M */,
293 name : 'upload_max_filesize',
294 value : _this._strings['eb5d45750c7ab13aa8e6bacc80315a30'] /* 32M */,
300 fieldLabel : _this._strings['ea72bacd2fdfa818907bb9559e6905a1'] /* Upload Image or File */,
302 name : 'imageUpload',