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.haveProgress = 2;
115 Roo.MessageBox.hide(); // force hiding
116 _this.dialog.el.unmask();
118 if (act.type == 'setdata') {
119 this.url = _this.data._url ? _this.data._url : baseURL + '/Roo/Images.php';
120 this.el.dom.action = this.url;
121 this.findField('UPLOAD_IDENTIFIER').setValue(
122 (new Date() * 1) + '' + Math.random());
128 if (act.type == 'load') {
129 // should this happen?
130 _this.data = act.result.data;
136 if (act.type == 'submit') { // only submitted here if we are
140 if (_this.callback) {
141 _this.callback.call(this, act.result.data);
146 rendered : function (form)
150 actionfailed : function (_self, act)
152 _this.dialog.uploadComplete = true;
153 _this.dialog.el.unmask();
156 if (act.type == 'submit') {
159 Roo.MessageBox.alert("Error", act.result.errorMsg);
162 Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");
167 // what about load failing..
168 Roo.MessageBox.alert("Error", "Error loading details");
174 style : 'margin:10px;',
175 url : baseURL + '/Roo/Images.php',
180 name : 'UPLOAD_IDENTIFIER'
185 name : 'post_max_size',
191 name : 'upload_max_filesize',
197 fieldLabel : 'Upload Image or File',
199 name : 'imageUpload',
223 xtype: 'LayoutRegion',
231 click : function (_self, e)
242 click : function (_self, e)
246 _this.dialog.el.mask("Sending");
247 _this.dialog.uploadComplete = false;
248 _this.form.doAction('submit', {
253 _this.dialog.haveProgress = 0; // set to show..
254 _this.dialog.uploadProgress.defer(1000, _this.dialog);