1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-22 11:57:34 +00:00

[fileupload] added option for 'add folder'

This commit is contained in:
llj
2014-12-02 18:54:41 +08:00
parent d2d7c72e99
commit 07a400e6a1
5 changed files with 11 additions and 1 deletions

View File

@@ -205,6 +205,9 @@ ENABLE_MAKE_GROUP_PUBLIC = False
# show or hide library 'download' button
SHOW_REPO_DOWNLOAD_BUTTON = False
# enable 'upload folder' or not
ENABLE_UPLOAD_FOLDER = False
# mininum length for password of encrypted library
REPO_PASSWORD_MIN_LENGTH = 8

View File

@@ -1170,6 +1170,7 @@ $('#upload-file').click(function () {
$('#upload-file-dialog').modal();
});
{% else %}
{% if enable_upload_folder %}
if ('webkitdirectory' in $('#upload-file input[type="file"]')[0]) {
$('#upload-file').find('input').remove().end().addClass('cspt');
$('#upload-menu .item').click(function() {
@@ -1201,6 +1202,7 @@ $('#upload-file').click(function () {
closePopup($('#upload-menu'), $('#upload-file'));
});
}
{% endif %}
{% endif %}
{% endif %}

View File

@@ -22,6 +22,7 @@
<span class="icon-upload-alt"></span><span>{% trans "Upload"%}</span>
<input type="file" name="file" multiple />
</div>
{% if enable_upload_folder %}
<ul id="upload-menu" class="hide">
<li class="item">
<span>{% trans "Upload Files" %}</span>
@@ -32,6 +33,7 @@
<input type="file" name="file" multiple directory webkitdirectory />
</li>
</ul>
{% endif %}
{% endif %}
{% endif %}
<button id="add-new-dir" class="op-btn"><span class="icon-plus-sign-alt"></span>{% trans "New Directory"%}</button>

View File

@@ -290,6 +290,7 @@ def list_dir(request, repo_id):
'more_start': more_start,
'ENABLE_SUB_LIBRARY': settings.ENABLE_SUB_LIBRARY,
"sub_lib_enabled": sub_lib_enabled,
"enable_upload_folder": settings.ENABLE_UPLOAD_FOLDER,
'current_commit': head_commit,
'info_commit': info_commit,
}

View File

@@ -29,7 +29,8 @@ from seahub.utils import gen_file_upload_url, is_org_context, \
get_fileserver_root, gen_dir_share_link, gen_shared_upload_link, \
get_max_upload_file_size, new_merge_with_no_conflict, \
get_commit_before_new_merge, user_traffic_over_limit
from seahub.settings import ENABLE_SUB_LIBRARY, FORCE_SERVER_CRYPTO
from seahub.settings import ENABLE_SUB_LIBRARY, FORCE_SERVER_CRYPTO, \
ENABLE_UPLOAD_FOLDER
# Get an instance of a logger
logger = logging.getLogger(__name__)
@@ -268,6 +269,7 @@ def render_repo(request, repo):
'ENABLE_SUB_LIBRARY': ENABLE_SUB_LIBRARY,
'server_crypto': server_crypto,
"sub_lib_enabled": sub_lib_enabled,
"enable_upload_folder": ENABLE_UPLOAD_FOLDER,
}, context_instance=RequestContext(request))
@login_required