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',
212 style : 'margin:10px;',
214 url : baseURL + '/Roo/Images.php',
216 actioncomplete : function(_self,act)
218 _this.dialog.uploadComplete = true;
219 _this.dialog.haveProgress = 2;
220 Roo.MessageBox.hide(); // force hiding
221 //_this.dialog.el.unmask();
223 if (act.type == 'setdata') {
225 _this.form.findField('imgtype').hide();
227 _this.dialog.resizeTo(500, 150);
229 if(_this.data._show_image_type){
230 _this.form.findField('imgtype').show();
231 _this.dialog.resizeTo(500, 180);
234 this.url = _this.data._url ? _this.data._url : baseURL + '/Roo/Images.php';
235 this.el.dom.action = this.url;
236 if (typeof(_this.data.timeout) != 'undefined') {
237 this.timeout = _this.data.timeout;
240 this.findField('UPLOAD_IDENTIFIER').setValue(
241 (new Date() * 1) + '' + Math.random());
247 if (act.type == 'load') {
248 // should this happen?
249 _this.data = act.result.data;
255 if (act.type == 'submit') { // only submitted here if we are
257 Roo.log("Upload success");
260 if (_this.callback) {
261 _this.callback.call(this, act.result.data, act.result.extra);
269 actionfailed : function (_self, act)
273 _this.dialog.uploadComplete = true;
274 // _this.dialog.el.unmask();
276 _this.dialog.haveProgress = 2;
277 if (act.type == 'submit') {
278 Roo.log("Upload error");
282 Roo.MessageBox.alert("Error", act.result.errorMsg.split(/\n/).join('<BR/>'));
285 Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");
290 // what about load failing..
291 Roo.MessageBox.alert("Error", "Error loading details");
293 rendered : function (form)
303 name : 'UPLOAD_IDENTIFIER',
309 name : 'post_max_size',
310 value : _this._strings['eb5d45750c7ab13aa8e6bacc80315a30'] /* 32M */,
316 name : 'upload_max_filesize',
317 value : _this._strings['eb5d45750c7ab13aa8e6bacc80315a30'] /* 32M */,
323 fieldLabel : _this._strings['ea72bacd2fdfa818907bb9559e6905a1'] /* Upload Image or File */,
325 name : 'imageUpload',
332 actionMode : 'fieldEl',
335 displayField : 'display_name',
336 emptyText : _this._strings['dff0c70e4c11953e4e3ee1cf268fb96d'] /* Select image type */,
337 fieldLabel : _this._strings['8e16a71b3d8217eb80b39b7d8dec4296'] /* Image Type */,
338 forceSelection : true,
339 hiddenName : 'imgtype',
341 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
343 name : 'imgtype_name',
345 qtip : _this._strings['dff0c70e4c11953e4e3ee1cf268fb96d'] /* Select image type */,
346 queryParam : 'query[search]',
347 selectOnFocus : true,
348 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> {name}</div>',
349 triggerAction : 'all',
358 sortInfo : { direction : 'ASC', field: 'name' },
360 beforeload : function (_self, o){
361 o.params = o.params || {};
363 o.params.etype = 'ImageType';
373 url : baseURL + '/Roo/Core_enum',
378 xtype : 'JsonReader',
379 fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
382 totalProperty : 'total',