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");
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.el.dom.action = this.url;
113 this.findField('UPLOAD_IDENTIFIER').setValue(
114 (new Date() * 1) + '' + Math.random());
120 if (act.type == 'load') {
121 // should this happen?
122 _this.data = act.result.data;
128 if (act.type == 'submit') { // only submitted here if we are
132 if (_this.callback) {
133 _this.callback.call(this, act.result.data);
138 rendered : function (form)
142 actionfailed : function (_self, act)
144 _this.dialog.uploadComplete = true;
145 _this.dialog.el.unmask();
148 if (act.type == 'submit') {
150 Ext.MessageBox.alert("Error", "Saving failed = fix errors and try again");
154 // what about load failing..
155 Ext.MessageBox.alert("Error", "Error loading details");
161 style : 'margin:10px;',
162 url : baseURL + '/Roo/Images.php',
167 name : 'UPLOAD_IDENTIFIER'
172 name : 'post_max_size',
178 name : 'upload_max_filesize',
184 fieldLabel : 'Upload Image or File',
186 name : 'imageUpload',
210 xtype: 'LayoutRegion',
218 click : function (_self, e)
229 click : function (_self, e)
233 _this.dialog.el.mask("Sending");
234 _this.dialog.uploadComplete = false;
235 _this.form.doAction('submit', {
240 _this.dialog.haveProgress = false,
241 _this.dialog.uploadProgress.defer(1000, _this.dialog);