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 '1243daf593fa297e07ab03bf06d925af' :"Searching...",
13 'ea4788705e6873b424c65e91c2846b19' :"Cancel",
14 '8e16a71b3d8217eb80b39b7d8dec4296' :"Image Type",
15 'dff0c70e4c11953e4e3ee1cf268fb96d' :"Select image type",
16 '91412465ea9169dfd901dd5e7c96dd99' :"Upload",
17 'ea72bacd2fdfa818907bb9559e6905a1' :"Upload Image or File"
20 'imgtype_name_fieldLabel' : '8e16a71b3d8217eb80b39b7d8dec4296' /* Image Type */ ,
21 'imgtype_name_loadingText' : '1243daf593fa297e07ab03bf06d925af' /* Searching... */ ,
22 'imgtype_name_emptyText' : 'dff0c70e4c11953e4e3ee1cf268fb96d' /* Select image type */ ,
23 'upload_max_filesize_value' : 'eb5d45750c7ab13aa8e6bacc80315a30' /* 32M */ ,
24 'imgtype_name_qtip' : 'dff0c70e4c11953e4e3ee1cf268fb96d' /* Select image type */ ,
25 'post_max_size_value' : 'eb5d45750c7ab13aa8e6bacc80315a30' /* 32M */ ,
26 'imageUpload_fieldLabel' : 'ea72bacd2fdfa818907bb9559e6905a1' /* Upload Image or File */
32 show : function(data, cb)
40 this.dialog.show(this.data._el);
43 this.form.setValues(data);
44 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
52 this.dialog = Roo.factory({
53 xtype : 'LayoutDialog',
61 title : _this._strings['2859a4ae58ae4e25abdfc530f814e42f'] /* Upload an Image or File */,
62 uploadComplete : false,
63 uploadProgress : function()
66 if (!dlg.haveProgress) {
67 Roo.MessageBox.progress("Uploading", "Uploading");
70 if (dlg.haveProgress == 2) {
71 // it's been closed elsewhere..
74 if (dlg.uploadComplete) {
75 Roo.MessageBox.hide();
81 var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();
83 url : baseURL + '/Core/UploadProgress.php',
88 success : function(res){
91 if (dlg.haveProgress == 2) {
92 // it's been closed elsewhere..
96 if (dlg.uploadComplete) {
97 Roo.MessageBox.hide();
102 Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
103 Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
106 Roo.MessageBox.updateProgress(1,
107 "Upload Complete - processing"
111 dlg.uploadProgress.defer(2000,dlg);
113 failure: function(data) {
114 // console.log('fail');
115 // console.log(data);
122 show : function (_self)
125 // this does not really work - escape on the borders works..
126 // resize to fit.. if we have styled stuff...
133 var pad = d.el.getSize().height - (d.header.getSize().height +
134 d.footer.getSize().height +
135 d.layout.getRegion('center').getPanel(0).el.getSize().height
140 d.header.getSize().height +
141 d.footer.getSize().height +
142 d.layout.getRegion('center').getPanel(0).el.child('div').getSize().height
144 this.resizeTo(d.el.getSize().width, height);
146 if (this.keylistener) {
149 this.keylistener = this.addKeyListener(27, this.hide, this);
156 xtype : 'LayoutRegion',
163 text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
165 click : function (_self, e)
175 text : _this._strings['91412465ea9169dfd901dd5e7c96dd99'] /* Upload */,
177 click : function (_self, e)
181 //_this.dialog.el.mask("Sending");
182 _this.dialog.uploadComplete = false;
183 _this.form.doAction('submit', {
188 _this.dialog.haveProgress = 0; // set to show..
189 _this.dialog.uploadProgress.defer(1000, _this.dialog);
199 xtype : 'ContentPanel',
210 style : 'margin:10px;',
212 url : baseURL + '/Roo/Images.php',
214 actioncomplete : function(_self,act)
216 _this.dialog.uploadComplete = true;
217 _this.dialog.haveProgress = 2;
218 Roo.MessageBox.hide(); // force hiding
219 //_this.dialog.el.unmask();
221 if (act.type == 'setdata') {
223 _this.form.findField('imgtype').hide();
225 if(_this.data._show_image_type){
226 _this.form.findField('imgtype').show();
229 this.url = _this.data._url ? _this.data._url : baseURL + '/Roo/Images.php';
230 this.el.dom.action = this.url;
231 if (typeof(_this.data.timeout) != 'undefined') {
232 this.timeout = _this.data.timeout;
235 this.findField('UPLOAD_IDENTIFIER').setValue(
236 (new Date() * 1) + '' + Math.random());
242 if (act.type == 'load') {
243 // should this happen?
244 _this.data = act.result.data;
250 if (act.type == 'submit') { // only submitted here if we are
252 Roo.log("Upload success");
255 if (_this.callback) {
256 _this.callback.call(this, act.result.data, act.result.extra);
264 actionfailed : function (_self, act)
268 _this.dialog.uploadComplete = true;
269 // _this.dialog.el.unmask();
271 _this.dialog.haveProgress = 2;
272 if (act.type == 'submit') {
273 Roo.log("Upload error");
277 Roo.MessageBox.alert("Error", act.result.errorMsg.split(/\n/).join('<BR/>'));
280 Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");
285 // what about load failing..
286 Roo.MessageBox.alert("Error", "Error loading details");
288 rendered : function (form)
298 name : 'UPLOAD_IDENTIFIER',
304 name : 'post_max_size',
305 value : _this._strings['eb5d45750c7ab13aa8e6bacc80315a30'] /* 32M */,
311 name : 'upload_max_filesize',
312 value : _this._strings['eb5d45750c7ab13aa8e6bacc80315a30'] /* 32M */,
318 fieldLabel : _this._strings['ea72bacd2fdfa818907bb9559e6905a1'] /* Upload Image or File */,
320 name : 'imageUpload',
327 actionMode : 'fieldEl',
330 displayField : 'display_name',
331 emptyText : _this._strings['dff0c70e4c11953e4e3ee1cf268fb96d'] /* Select image type */,
332 fieldLabel : _this._strings['8e16a71b3d8217eb80b39b7d8dec4296'] /* Image Type */,
333 forceSelection : true,
334 hiddenName : 'imgtype',
336 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
338 name : 'imgtype_name',
340 qtip : _this._strings['dff0c70e4c11953e4e3ee1cf268fb96d'] /* Select image type */,
341 queryParam : 'query[search]',
342 selectOnFocus : true,
343 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> {name}</div>',
344 triggerAction : 'all',
353 sortInfo : { direction : 'ASC', field: 'name' },
355 beforeload : function (_self, o){
356 o.params = o.params || {};
358 o.params.etype = 'ImageType';
368 url : baseURL + '/Roo/Core_enum',
373 xtype : 'JsonReader',
374 fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
377 totalProperty : 'total',