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');
7 Pman.Dialog.Image= function() {}
8 Roo.apply(Pman.Dialog.Image.prototype, {
11 'ef797d5638c2e1c6b6225b2247541ea5' :"Upload Image or File:",
12 '2859a4ae58ae4e25abdfc530f814e42f' :"Upload an Image or File",
13 'ea4788705e6873b424c65e91c2846b19' :"Cancel",
14 '91412465ea9169dfd901dd5e7c96dd99' :"Upload"
20 show : function(data, cb)
28 this.dialog.show(this.data._el);
31 this.form.setValues(data);
32 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
40 this.dialog = Roo.factory({
43 title : _this._strings['2859a4ae58ae4e25abdfc530f814e42f'] /* Upload an Image or File */,
44 uploadComplete : false,
45 uploadProgress : function()
48 if (!dlg.haveProgress) {
49 Roo.MessageBox.progress("Uploading", "Uploading");
52 if (dlg.haveProgress == 2) {
53 // it's been closed elsewhere..
56 if (dlg.uploadComplete) {
57 Roo.MessageBox.hide();
63 var uid = _this.form.findField('UPLOAD_IDENTIFIER').getValue();
65 url : baseURL + '/Core/UploadProgress.php',
70 success : function(res){
72 if (dlg.haveProgress == 2) {
76 if (dlg.uploadComplete) {
77 Roo.MessageBox.hide();
82 Roo.MessageBox.updateProgress(data.bytes_uploaded/data.bytes_total,
83 Math.floor((data.bytes_total - data.bytes_uploaded)/1000) + 'k remaining'
86 Roo.MessageBox.updateProgress(1,
87 "Upload Complete - processing"
91 dlg.uploadProgress.defer(2000,dlg);
93 failure: function(data) {
99 '|xns' : 'Roo.bootstrap',
103 html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
106 click : function (_self, e)
112 '|xns' : 'Roo.bootstrap'
116 html : _this._strings['91412465ea9169dfd901dd5e7c96dd99'] /* Upload */,
119 click : function (_self, e)
123 //_this.dialog.el.mask("Sending");
125 _this.dialog.uploadComplete = false;
126 _this.form.doAction('submit', {
132 _this.dialog.haveProgress = 0; // set to show..
133 _this.dialog.uploadProgress.defer(1000, _this.dialog);
137 '|xns' : 'Roo.bootstrap'
143 style : 'width: 100%',
145 '|xns' : 'Roo.bootstrap',
152 url : baseURL + '/Roo/Images.php',
154 actioncomplete : function(_self,action)
156 _this.dialog.uploadComplete = true;
158 _this.dialog.haveProgress = 2;
160 Roo.MessageBox.hide();
162 if (action.type == 'setdata') {
165 _this.form.findField('imgtype').hide();
167 if(_this.data._show_image_type){
168 _this.form.findField('imgtype').show();
172 this.url = _this.data._url ? _this.data._url : baseURL + '/Roo/Images.php';
173 this.el.dom.action = this.url;
174 if (typeof(_this.data.timeout) != 'undefined') {
175 this.timeout = _this.data.timeout;
178 this.findField('UPLOAD_IDENTIFIER').setValue(
179 (new Date() * 1) + '' + Math.random());
185 if (action.type == 'load') {
187 _this.data = action.result.data;
193 if (action.type == 'submit') { // only submitted here if we are
195 Roo.log("Upload success");
197 if (_this.callback) {
198 _this.callback.call(this, action.result.data, action.result.extra);
206 actionfailed : function (_self, action)
208 _this.dialog.uploadComplete = true;
210 _this.dialog.haveProgress = 2;
212 if (action.type == 'submit') {
213 Roo.log("Upload error");
218 Roo.MessageBox.alert("Error", action.result.errorMsg.split(/\n/).join('<BR/>'));
222 Roo.MessageBox.alert("Error", "Saving failed = fix errors and try again");
227 Roo.MessageBox.alert("Error", "Error loading details");
229 render : function (_self)
235 '|xns' : 'Roo.bootstrap',
239 fieldLabel : _this._strings['ef797d5638c2e1c6b6225b2247541ea5'] /* Upload Image or File: */,
242 name : 'imageUpload',
244 '|xns' : 'Roo.bootstrap'
248 inputType : 'hidden',
249 name : 'UPLOAD_IDENTIFIER',
251 '|xns' : 'Roo.bootstrap'
255 inputType : 'hidden',
256 name : 'post_max_size',
258 '|xns' : 'Roo.bootstrap'
262 inputType : 'hidden',
263 name : 'upload_max_filesize',
265 '|xns' : 'Roo.bootstrap'
269 inputType : 'hidden',
272 '|xns' : 'Roo.bootstrap'
276 inputType : 'hidden',
279 '|xns' : 'Roo.bootstrap'
283 inputType : 'hidden',
286 '|xns' : 'Roo.bootstrap'
296 Roo.apply(Pman.Dialog.Image, Pman.Dialog.Image.prototype);