1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
10 show : function(data, cb)
18 this.dialog.show(this.data._el);
21 this.form.setValues(data);
22 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
30 this.dialog = Roo.factory({
31 xtype: 'LayoutDialog',
34 show : function (_self)
36 // this does not really work - escape on the borders works..
37 if (this.keylistener) {
40 this.keylistener = this.addKeyListener(27, this.hide, this);
50 title : "Upload an Image or File",
51 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(data){
81 if (dlg.uploadComplete) {
82 Roo.MessageBox.hide();
87 Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
88 Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
91 dlg.uploadProgress.defer(2000,dlg);
93 failure: function(data) {
94 // console.log('fail');
102 xtype: 'ContentPanel',
111 actioncomplete : function(_self,act)
113 _this.dialog.uploadComplete = true;
114 _this.dialog.el.unmask();
116 if (act.type == 'setdata') {
117 this.url = _this.data._url ? _this.data._url : baseURL + '/Roo/Images.php';
118 this.el.dom.action = this.url;
119 this.findField('UPLOAD_IDENTIFIER').setValue(
120 (new Date() * 1) + '' + Math.random());
126 if (act.type == 'load') {
127 // should this happen?
128 _this.data = act.result.data;
134 if (act.type == 'submit') { // only submitted here if we are
138 if (_this.callback) {
139 _this.callback.call(this, act.result.data);
144 rendered : function (form)
148 actionfailed : function (_self, act)
150 _this.dialog.uploadComplete = true;
151 _this.dialog.el.unmask();
154 if (act.type == 'submit') {
157 Roo.MessageBox.alert("Error", act.result.errorMsg);
160 Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");
165 // what about load failing..
166 Roo.MessageBox.alert("Error", "Error loading details");
172 style : 'margin:10px;',
173 url : baseURL + '/Roo/Images.php',
178 name : 'UPLOAD_IDENTIFIER'
183 name : 'post_max_size',
189 name : 'upload_max_filesize',
195 fieldLabel : 'Upload Image or File',
197 name : 'imageUpload',
221 xtype: 'LayoutRegion',
229 click : function (_self, e)
240 click : function (_self, e)
244 _this.dialog.el.mask("Sending");
245 _this.dialog.uploadComplete = false;
246 _this.form.doAction('submit', {
251 _this.dialog.haveProgress = false,
252 _this.dialog.uploadProgress.defer(1000, _this.dialog);