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"
23 show : function(data, cb)
31 this.dialog.show(this.data._el);
34 this.form.setValues(data);
35 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
43 this.dialog = Roo.factory({
44 xtype : 'LayoutDialog',
52 title : _this._strings['2859a4ae58ae4e25abdfc530f814e42f'] /* Upload an Image or File */,
53 uploadComplete : false,
54 uploadProgress : function()
57 if (!dlg.haveProgress) {
58 Roo.MessageBox.progress("Uploading", "Uploading");
61 if (dlg.haveProgress == 2) {
62 // it's been closed elsewhere..
65 if (dlg.uploadComplete) {
66 Roo.MessageBox.hide();
72 var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();
74 url : baseURL + '/Core/UploadProgress.php',
79 success : function(res){
82 if (dlg.haveProgress == 2) {
83 // it's been closed elsewhere..
87 if (dlg.uploadComplete) {
88 Roo.MessageBox.hide();
93 Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
94 Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
97 Roo.MessageBox.updateProgress(1,
98 "Upload Complete - processing"
102 dlg.uploadProgress.defer(2000,dlg);
104 failure: function(data) {
105 // console.log('fail');
106 // console.log(data);
113 show : function (_self)
116 // this does not really work - escape on the borders works..
117 // resize to fit.. if we have styled stuff...
124 var pad = d.el.getSize().height - (d.header.getSize().height +
125 d.footer.getSize().height +
126 d.layout.getRegion('center').getPanel(0).el.getSize().height
131 d.header.getSize().height +
132 d.footer.getSize().height +
133 d.layout.getRegion('center').getPanel(0).el.child('div').getSize().height
135 this.resizeTo(d.el.getSize().width, height);
137 if (this.keylistener) {
140 this.keylistener = this.addKeyListener(27, this.hide, this);
147 xtype : 'LayoutRegion',
154 text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
156 click : function (_self, e)
166 text : _this._strings['91412465ea9169dfd901dd5e7c96dd99'] /* Upload */,
168 click : function (_self, e)
172 //_this.dialog.el.mask("Sending");
173 _this.dialog.uploadComplete = false;
174 _this.form.doAction('submit', {
179 _this.dialog.haveProgress = 0; // set to show..
180 _this.dialog.uploadProgress.defer(1000, _this.dialog);
190 xtype : 'ContentPanel',
201 style : 'margin:10px;',
203 url : baseURL + '/Roo/Images.php',
205 actioncomplete : function(_self,act)
207 _this.dialog.uploadComplete = true;
208 _this.dialog.haveProgress = 2;
209 Roo.MessageBox.hide(); // force hiding
210 //_this.dialog.el.unmask();
212 if (act.type == 'setdata') {
214 _this.form.findField('imgtype').hide();
216 if(_this.data._show_image_type){
217 _this.form.findField('imgtype').show();
220 this.url = _this.data._url ? _this.data._url : baseURL + '/Roo/Images.php';
221 this.el.dom.action = this.url;
222 if (typeof(_this.data.timeout) != 'undefined') {
223 this.timeout = _this.data.timeout;
226 this.findField('UPLOAD_IDENTIFIER').setValue(
227 (new Date() * 1) + '' + Math.random());
233 if (act.type == 'load') {
234 // should this happen?
235 _this.data = act.result.data;
241 if (act.type == 'submit') { // only submitted here if we are
243 Roo.log("Upload success");
246 if (_this.callback) {
247 _this.callback.call(this, act.result.data, act.result.extra);
255 actionfailed : function (_self, act)
259 _this.dialog.uploadComplete = true;
260 // _this.dialog.el.unmask();
262 _this.dialog.haveProgress = 2;
263 if (act.type == 'submit') {
264 Roo.log("Upload error");
268 Roo.MessageBox.alert("Error", act.result.errorMsg.split(/\n/).join('<BR/>'));
271 Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");
276 // what about load failing..
277 Roo.MessageBox.alert("Error", "Error loading details");
279 rendered : function (form)
289 name : 'UPLOAD_IDENTIFIER',
295 name : 'post_max_size',
296 value : _this._strings['eb5d45750c7ab13aa8e6bacc80315a30'] /* 32M */,
302 name : 'upload_max_filesize',
303 value : _this._strings['eb5d45750c7ab13aa8e6bacc80315a30'] /* 32M */,
309 fieldLabel : _this._strings['ea72bacd2fdfa818907bb9559e6905a1'] /* Upload Image or File */,
311 name : 'imageUpload',
318 actionMode : 'fieldEl',
321 displayField : 'display_name',
322 emptyText : _this._strings['dff0c70e4c11953e4e3ee1cf268fb96d'] /* Select image type */,
323 fieldLabel : _this._strings['8e16a71b3d8217eb80b39b7d8dec4296'] /* Image Type */,
324 forceSelection : true,
325 hiddenName : 'imgtype',
327 loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
329 name : 'imgtype_name',
331 qtip : _this._strings['dff0c70e4c11953e4e3ee1cf268fb96d'] /* Select image type */,
332 queryParam : 'query[search]',
333 selectOnFocus : true,
334 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}???</b> {name}</div>',
335 triggerAction : 'all',
344 sortInfo : { direction : 'ASC', field: 'name' },
346 beforeload : function (_self, o){
347 o.params = o.params || {};
349 o.params.etype = 'ImageType';
359 url : baseURL + '/Roo/Core_enum',
364 xtype : 'JsonReader',
365 fields : [{"name":"id","type":"int"},{"name":"name","type":"string"}],
368 totalProperty : 'total',