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 uploadProgress : false,
54 uploadProgres : function()
57 if (!dlg.haveProgress) {
58 Roo.MessageBox.progress("Uploading", "Uploading");
60 if (dlg.uploadComplete) {
61 Roo.MessageBox.hide();
64 dlg.haveProgress = true;
66 var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();
68 url : baseURL + '/Core/UploadProgress.php',
73 success : function(data){
75 if (dlg.uploadComplete) {
76 Roo.MessageBox.hide();
81 Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
82 Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
85 dlg.uploadProgress.defer(2000,dlg);
87 failure: function(data) {
88 // console.log('fail');
96 xtype: 'ContentPanel',
105 actioncomplete : function(_self,act)
107 _this.dialog.uploadComplete = true;
108 _this.dialog.el.unmask();
110 if (act.type == 'setdata') {
111 this.url = _this.data._url ? _this.data._url : baseURL + '/Roo/Images.php'
112 this.findField('UPLOAD_IDENTIFIER').setValue(
113 (new Date() * 1) + '' + Math.random());
119 if (act.type == 'load') {
120 // should this happen?
121 _this.data = act.result.data;
127 if (act.type == 'submit') { // only submitted here if we are
130 if (_this.callback) {
131 _this.callback.call(this, act.result.data);
136 rendered : function (form)
140 actionfailed : function (_self, act)
142 _this.dialog.uploadComplete = true;
143 _this.dialog.el.unmask();
146 if (act.type == 'submit') {
147 Ext.MessageBox.alert("Error", "Saving failed = fix errors and try again");
151 // what about load failing..
152 Ext.MessageBox.alert("Error", "Error loading details");
157 style : 'margin:10px;',
158 url : baseURL + '/Roo/Images.php',
163 name : 'UPLOAD_IDENTIFIER'
168 fieldLabel : 'Upload Image or File',
170 name : 'imageUpload',
191 name : 'post_max_size',
197 name : 'upload_max_filesize',
206 xtype: 'LayoutRegion',
214 click : function (_self, e)
225 click : function (_self, e)
229 _this.dialog.el.mask("Sending");
230 _this.dialog.uploadComplete = false;
231 _this.form.doAction('submit', {
232 url: baseURL + '/Roo/Images.html',
239 _this.dialog.haveProgress = false,
240 _this.dialog.uploadProgress.defer(1000, _this.dialog);