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.apply(this.dialog, Array.prototype.slice.call(arguments).slice(2));
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',
211 style : 'margin:10px;',
213 url : baseURL + '/Roo/Images.php',
215 actioncomplete : function(_self,act)
217 _this.dialog.uploadComplete = true;
218 _this.dialog.haveProgress = 2;
219 Roo.MessageBox.hide(); // force hiding
220 //_this.dialog.el.unmask();
222 if (act.type == 'setdata') {
224 _this.form.findField('imgtype').hide();
226 _this.dialog.resizeTo(500, 140);
228 if(_this.data._show_image_type){
229 _this.form.findField('imgtype').show();
230 _this.dialog.resizeTo(500, 170);
233 this.url = _this.data._url ? _this.data._url : baseURL + '/Roo/Images.php';
234 this.el.dom.action = this.url;
235 if (typeof(_this.data.timeout) != 'undefined') {
236 this.timeout = _this.data.timeout;
239 this.findField('UPLOAD_IDENTIFIER').setValue(
240 (new Date() * 1) + '' + Math.random());
246 if (act.type == 'load') {
247 // should this happen?
248 _this.data = act.result.data;
254 if (act.type == 'submit') { // only submitted here if we are
256 Roo.log("Upload success");
259 if (_this.callback) {
260 _this.callback.call(this, act.result.data, act.result.extra);
268 actionfailed : function (_self, act)
272 _this.dialog.uploadComplete = true;
273 // _this.dialog.el.unmask();
275 _this.dialog.haveProgress = 2;
276 if (act.type == 'submit') {
277 Roo.log("Upload error");
281 Roo.MessageBox.alert("Error", act.result.errorMsg.split(/\n/).join('<BR/>'));
284 Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");
289 // what about load failing..
290 Roo.MessageBox.alert("Error", "Error loading details");
292 rendered : function (form)
302 name : 'UPLOAD_IDENTIFIER',
308 name : 'post_max_size',
309 value : _this._strings['eb5d45750c7ab13aa8e6bacc80315a30'] /* 32M */,
315 name : 'upload_max_filesize',
316 value : _this._strings['eb5d45750c7ab13aa8e6bacc80315a30'] /* 32M */,
322 fieldLabel : _this._strings['ea72bacd2fdfa818907bb9559e6905a1'] /* Upload Image or File */,
324 name : 'imageUpload',
331 actionMode : 'fieldEl',
334 displayField : 'display_name',
335 emptyText : _this._strings['dff0c70e4c11953e4e3ee1cf268fb96d'] /* Select image type */,
336 fieldLabel : _this._strings['8e16a71b3d8217eb80b39b7d8dec4296'] /* Image Type */,
337 forceSelection : true,
338 hiddenName : 'imgtype',
340 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
342 name : 'imgtype_name',
344 qtip : _this._strings['dff0c70e4c11953e4e3ee1cf268fb96d'] /* Select image type */,
345 queryParam : 'query[search]',
346 selectOnFocus : true,
347 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b> {name}</div>',
348 triggerAction : 'all',
357 sortInfo : { direction : 'ASC', field: 'name' },
359 beforeload : function (_self, o){
360 o.params = o.params || {};
362 o.params.etype = 'ImageType';
372 url : baseURL + '/Roo/Core_enum',
377 xtype : 'JsonReader',
378 fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
381 totalProperty : 'total',