commit 272fc89c744e4d3709c7448ca97b7b32c1acafbe
parent aada482b521b6ebd69f850c577b7a5f4aba49ec5
Author: Felicitus <felicitus@felicitus.org>
Date: Thu, 16 Jun 2011 14:42:33 +0800
Some small fixes:
- When a file was uploaded, pass the whole response and not only the id
- Make the window modal
Diffstat:
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/frontend/js/Components/Manufacturer/ManufacturerEditor.js b/frontend/js/Components/Manufacturer/ManufacturerEditor.js
@@ -102,10 +102,10 @@ Ext.define('PartKeepr.ManufacturerEditor', {
this.iclogoGrid.getStore().sync();
},
- onFileUploaded: function (id) {
+ onFileUploaded: function (response) {
this.iclogoGrid.getStore().add({
type: 'tmp',
- tmp_id: id,
+ tmp_id: response.id,
manufacturer_id: this.record.get("id")
});
},
diff --git a/frontend/js/Dialogs/FileUploadDialog.js b/frontend/js/Dialogs/FileUploadDialog.js
@@ -4,9 +4,14 @@ Ext.define('PartKeepr.FileUploadDialog', {
title: i18n("File Upload"),
fileFieldLabel: i18n("File"),
uploadButtonText: i18n('Select File...'),
-
+ uploadURL: "rest.php/TempFile",
+ modal: true,
initComponent: function () {
+ if (this.imageUpload) {
+ this.uploadURL = "rest.php/TempImage";
+ }
+
this.addEvents("fileUploaded");
this.uploadButton = Ext.create("Ext.button.Button",
@@ -16,13 +21,13 @@ Ext.define('PartKeepr.FileUploadDialog', {
var form = this.form.getForm();
if(form.isValid()){
form.submit({
- url: 'rest.php/TempImage',
+ url: this.uploadURL,
params: {
call: "upload",
session: PartKeepr.getApplication().getSession()
},
success: Ext.bind(function(fp, o) {
- this.fireEvent("fileUploaded", o.result.response.id);
+ this.fireEvent("fileUploaded", o.result.response);
this.close();
},this),
failure: function(form, action) {
@@ -35,6 +40,7 @@ Ext.define('PartKeepr.FileUploadDialog', {
this.tbButtons = [ this.uploadButton ];
if (this.imageUpload) {
+
this.title = i18n("Image Upload");
this.fileFieldLabel = i18n("Image");
this.uploadButtonText = i18n("Select Image...");