1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-19 18:29:23 +00:00

Disable shared link in encrypt repo, and fix bug when deleteing home page in personal wiki.

This commit is contained in:
zhengxie
2013-04-23 17:19:26 +08:00
parent 08e1ab63aa
commit d0e9dbd86d
3 changed files with 11 additions and 3 deletions

View File

@@ -30,11 +30,13 @@
<button id="recycle-btn" data="{% url 'repo_recycle_view' repo.id %}" class="repo-top-op-btn"><span class="icon-trash"></span>{% trans "Trash"%}</button>
{% endif %}
{% else %}
{% if not repo.encrypted %}
<input id="shared-link" class="hide" type="text" readonly="readonly" value="{{ dir_shared_link }}" />
<button data="{% url 'get_shared_link' %}?repo_id={{ repo.id }}&p={{ path|urlencode }}&type=d" id="get-shared-link" class="hide">{% trans "Share link"%}</button>
<button id="send-shared-link" class="hide">{% trans "Send"%}</button>
<button data="{% url 'remove_shared_link' %}?t={{ fileshare.token }}" id="rm-shared-link" class="hide">{% trans "Delete"%}</button>
{% endif %}
{% endif %}
</div>
</div>
{% if user_perm == 'r' %}
@@ -135,7 +137,9 @@
<div class="repo-file-op vh">
<div class="displayed-op">
<a class="op" href="{% url 'repo_download_dir' repo.id %}?p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}">{% trans 'Download' %}</a>
{% if not repo.encrypted %}
<a class="op file-share" href="#" data-name="{{ dirent.obj_name }}" data-link="{{ dirent.sharelink }}" data-token="{{ dirent.sharetoken }}" data-type="d">{% trans "Share" %}</a>
{% endif %}
</div>
{% if user_perm == 'rw' %}
<img src="{{ MEDIA_URL }}img/dropdown-arrow.png" title="{% trans 'More operations'%}" alt="{% trans 'More operations'%}" class="more-op-icon" data="no-popup" />
@@ -180,8 +184,10 @@
<a class="op" href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/{{ dirent.props.obj_id }}/?file_name={{ dirent.props.obj_name }}&op=download">{% trans "Download"%}</a>
{% if user_perm == 'rw' %}
<a class="op update-file" data-target="{{ path }}{{dirent.obj_name}}" href="#">{% trans "Update"%}</a>
{% if not repo.encrypted %}
<a class="op file-share" href="#" data-name="{{ dirent.obj_name }}" data-link="{{ dirent.sharelink }}" data-token="{{ dirent.sharetoken }}">{% trans "Share" %}</a>
{% endif %}
{% endif %}
</div>
{% if user_perm == 'rw' %}
<img src="{{ MEDIA_URL }}img/dropdown-arrow.png" title="{% trans "More Operations"%}" alt="{% trans "More Operations"%}" class="more-op-icon" data="no-popup" />

View File

@@ -29,10 +29,12 @@
</p>
<div class="file-op fright">
{% if not repo.encrypted %}
<input id="shared-link" class="hide" type="text" readonly="readonly" value="{{ file_shared_link }}" />
<button data="{% url 'get_shared_link' %}?repo_id={{ repo.id }}&p={{ path|urlencode }}" id="get-shared-link" class="hide">{% trans "Share link"%}</button>
<button id="send-shared-link" class="hide">{% trans "Send"%}</button>
<button data="{% url 'remove_shared_link' %}?t={{ fileshare.token }}" id="rm-shared-link" class="hide">{% trans "Delete"%}</button>
{% endif %}
{% if is_starred %}
<button id="star" data-status="starred">{% trans "Unstar"%}</button>
{% else %}

View File

@@ -51,7 +51,7 @@ def personal_wiki(request, page_name="home"):
except WikiPageMissing:
repo = get_personal_wiki_repo(username)
filename = clean_page_name(page_name) + '.md'
if not post_empty_file(repo.id, "/", filename, username):
if not seaserv.post_empty_file(repo.id, "/", filename, username):
return render_error(request, _("Failed to create wiki page. Please retry later."))
return HttpResponseRedirect(reverse('personal_wiki', args=[page_name]))
else: