1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-31 14:42:10 +00:00

rm ajax get file op url

This commit is contained in:
lian
2016-08-30 18:03:33 +08:00
committed by lian
parent 6d577d83e3
commit 06bc49d17b
5 changed files with 39 additions and 65 deletions

View File

@@ -155,16 +155,16 @@ define([
var upload_file = function() {
$.ajax({
url: Common.getUrl({
name: 'get_file_op_url',
name: 'repo_upload_link',
repo_id: dirents.repo_id
}),
data: {
'op_type': 'upload',
'from': 'web',
'path': dirents.path
},
cache: false,
dataType: 'json',
success: function(ret) {
success: function(returned_url) {
if (enable_upload_folder && file.relative_path) { // 'add folder'
var file_path = file.relative_path,
r_path = file_path.substring(0, file_path.lastIndexOf('/') + 1),
@@ -173,7 +173,7 @@ define([
popup.fileupload('option', {
'formData': formData
});
data.url = ret['url'];
data.url = returned_url;
data.jqXHR = popup.fileupload('send', data);
} else {
@@ -194,13 +194,13 @@ define([
dataType: 'json',
success: function(file_uploaded_data) {
popup.fileupload('option', 'uploadedBytes', file_uploaded_data.uploadedBytes);
data.url = ret['url'];
data.url = returned_url;
data.jqXHR = popup.fileupload('send', data);
}
});
} else {
data.url = ret['url'];
data.url = returned_url;
data.jqXHR = popup.fileupload('send', data);
}
}
@@ -219,23 +219,23 @@ define([
var update_file = function() {
$.ajax({
url: Common.getUrl({
name: 'get_file_op_url',
name: 'repo_update_link',
repo_id: dirents.repo_id
}),
data: {
'op_type': 'update',
'from': 'web',
'path': dirents.path
},
cache: false,
dataType: 'json',
success: function(ret) {
success: function(returned_url) {
var formData = popup.fileupload('option', 'formData');
formData.target_file = formData.parent_dir + file.name;
popup.fileupload('option', 'formData', formData);
file.to_update = true;
data.url = ret['url'];
data.url = returned_url;
data.jqXHR = popup.fileupload('send', data);
},
error: function() {

View File

@@ -94,7 +94,6 @@ define([
case 'del_dirents': return siteRoot + 'ajax/repo/' + options.repo_id + '/dirents/delete/';
case 'mv_dirents': return siteRoot + 'ajax/repo/' + options.repo_id + '/dirents/move/';
case 'cp_dirents': return siteRoot + 'ajax/repo/' + options.repo_id + '/dirents/copy/';
case 'get_file_op_url': return siteRoot + 'ajax/repo/' + options.repo_id + '/file_op_url/';
case 'get_file_uploaded_bytes': return siteRoot + 'ajax/repo/' + options.repo_id + '/get-file-uploaded-bytes/';
case 'get_dirents': return siteRoot + 'ajax/repo/' + options.repo_id + '/dirents/';
@@ -116,6 +115,8 @@ define([
case 'repo_shared_upload_link': return siteRoot + 'api2/repos/' + options.repo_id + '/upload-shared-links/' + options.token + '/';
case 'repo_user_folder_perm': return siteRoot + 'api2/repos/' + options.repo_id + '/user-folder-perm/';
case 'repo_group_folder_perm': return siteRoot + 'api2/repos/' + options.repo_id + '/group-folder-perm/';
case 'repo_upload_link': return siteRoot + 'api2/repos/' + options.repo_id + '/upload-link/';
case 'repo_update_link': return siteRoot + 'api2/repos/' + options.repo_id + '/update-link/';
// Share admin
case 'share_admin_repos': return siteRoot + 'api/v2.1/shared-repos/';