don't pop window when export file 🐨

This commit is contained in:
Liang Ding 2014-12-18 22:50:24 +08:00
parent c896602207
commit 20ac7c89d4
2 changed files with 9 additions and 3 deletions

View File

@ -43,7 +43,7 @@ func GetZip(w http.ResponseWriter, r *http.Request) {
filename := filepath.Base(path) filename := filepath.Base(path)
w.Header().Set("Content-Disposition", "attachment; filename="+filename) w.Header().Set("Content-Disposition", "attachment; filename="+filename)
w.Header().Set("Content-type", "application/zip") w.Header().Set("Content-Type", "application/zip")
http.ServeFile(w, r, path) http.ServeFile(w, r, path)
os.Remove(path) os.Remove(path)

View File

@ -145,10 +145,12 @@ var tree = {
$("#dialogRenamePrompt").dialog("open"); $("#dialogRenamePrompt").dialog("open");
}, },
export: function () { export: function () {
var request = newWideRequest(); var request = newWideRequest(),
isSucc = false;
request.path = wide.curNode.path; request.path = wide.curNode.path;
$.ajax({ $.ajax({
async: false,
type: 'POST', type: 'POST',
url: config.context + '/file/zip/new', url: config.context + '/file/zip/new',
data: JSON.stringify(request), data: JSON.stringify(request),
@ -160,9 +162,13 @@ var tree = {
return false; return false;
} }
window.open(config.context + '/file/zip?path=' + wide.curNode.path + '.zip'); isSucc = true;
} }
}); });
if (isSucc) {
window.open(config.context + '/file/zip?path=' + wide.curNode.path + ".zip");
}
}, },
refresh: function (it) { refresh: function (it) {
if (it) { if (it) {