mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 23:20:51 +00:00
update zip download dir
This commit is contained in:
@@ -952,7 +952,60 @@ define([
|
||||
} else {
|
||||
return input.setSelectionRange(pos, pos);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
zipDownloadDirents:function(repo_id, parent_dir, dirents) {
|
||||
var _this = this;
|
||||
var interval;
|
||||
var zip_token;
|
||||
var packagingTip = gettext("Packaging...");
|
||||
var $tip = $('<p></p>');
|
||||
var queryZipProgress = function() {
|
||||
$.ajax({
|
||||
url: _this.getUrl({name: 'query_zip_progress'}) + '?token=' + zip_token,
|
||||
dataType: 'json',
|
||||
cache: false,
|
||||
success: function(data) {
|
||||
var progress = data.total == 0 ? '100%' : (data.zipped/data.total*100).toFixed(0) + '%';
|
||||
$tip.html(packagingTip + ' ' + progress);
|
||||
if (data['total'] == data['zipped']) {
|
||||
setTimeout(function() { $.modal.close(); }, 500);
|
||||
clearInterval(interval);
|
||||
location.href = _this.getUrl({
|
||||
name: 'download_dir_zip_url',
|
||||
zip_token: zip_token
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
_this.ajaxErrorHandler(xhr);
|
||||
clearInterval(interval);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: _this.getUrl({
|
||||
name: 'zip_task',
|
||||
repo_id: repo_id
|
||||
}),
|
||||
data: {
|
||||
'parent_dir': parent_dir,
|
||||
'dirents': dirents
|
||||
},
|
||||
traditional: true,
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
zip_token = data['zip_token'];
|
||||
$tip.html(packagingTip).modal();
|
||||
$('#simplemodal-container').css({'width':'auto'});
|
||||
queryZipProgress();
|
||||
interval = setInterval(queryZipProgress, 1000);
|
||||
},
|
||||
error: function(xhr) {
|
||||
_this.ajaxErrorHandler(xhr);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user