diff --git a/core/page/data_import_tool/data_import_tool.js b/core/page/data_import_tool/data_import_tool.js
index 580fbaaa1f..eb13aaab3d 100644
--- a/core/page/data_import_tool/data_import_tool.js
+++ b/core/page/data_import_tool/data_import_tool.js
@@ -141,7 +141,7 @@ wn.pages['data-import-tool'].onload = function(wrapper) {
});
// add overwrite option
- var $submit_btn = $('#dit-upload-area form input[type="submit"]');
+ var $submit_btn = $('#dit-upload-area input[type="submit"]');
$('\
Overwrite\
If you are uploading a child table (for example Item Price), the all the entries of that table will be deleted (for that parent record) and new entries will be made.
')
diff --git a/public/js/wn/form/attachments.js b/public/js/wn/form/attachments.js
index 26743f821b..d70fc38193 100644
--- a/public/js/wn/form/attachments.js
+++ b/public/js/wn/form/attachments.js
@@ -114,6 +114,7 @@ wn.ui.form.Attachments = Class.extend({
});
},
new_attachment: function() {
+ var me = this;
if(!this.dialog) {
this.dialog = new wn.ui.Dialog({
title: wn._('Upload Attachment'),
@@ -132,38 +133,27 @@ wn.ui.form.Attachments = Class.extend({
doctype: this.frm.doctype,
docname: this.frm.docname
},
- callback: wn.ui.form.file_upload_done
+ callback: function(fileid, filename) {
+ me.add_to_file_list(fileid, filename);
+ me.dialog.hide();
+ me.refresh();
+ }
});
},
+ add_to_file_list: function(fileid, filename) {
+ var doc = this.frm.doc;
+ if(doc.file_list) {
+ var fl = doc.file_list.split('\n');
+ fl.push(filename + ',' + fileid);
+ doc.file_list = fl.join('\n');
+ } else {
+ doc.file_list = filename + ',' + fileid;
+ }
+
+ },
remove_fileid: function(fileid) {
this.frm.doc.file_list = $.map(this.get_filelist(), function(f) {
if(f.split(',')[1]!=fileid) return f;
}).join('\n');
}
-});
-
-
-// this function will be called after the upload is done
-// from webnotes.utils.file_manager
-wn.ui.form.file_upload_done = function(doctype, docname, fileid, filename, at_id,
- new_timestamp) {
-
- // add to file_list
- var doc = locals[doctype][docname];
- if(doc.file_list) {
- var fl = doc.file_list.split('\n');
- fl.push(filename + ',' + fileid);
- doc.file_list = fl.join('\n');
- } else {
- doc.file_list = filename + ',' + fileid;
- }
-
- // update timestamp
- doc.modified = new_timestamp;
-
- // update file_list
- var frm = wn.views.formview[doctype].frm;
- frm.attachments.dialog.hide();
- msgprint(wn._('File Uploaded Sucessfully.'));
- frm.refresh();
-};
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/public/js/wn/upload.js b/public/js/wn/upload.js
index 5822dbe6b3..bc2bb46a27 100644
--- a/public/js/wn/upload.js
+++ b/public/js/wn/upload.js
@@ -5,44 +5,67 @@
wn.upload = {
make: function(opts) {
var id = wn.dom.set_unique_id();
- $(opts.parent).append(repl('\
- ', {
+ $(opts.parent).append();
+
+ var $upload = $("