1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 07:55:36 +00:00

clean code and icons

This commit is contained in:
Daniel Pan
2016-03-09 15:12:53 +08:00
parent 8c59095071
commit b75e8e8d9c
32 changed files with 8 additions and 761 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 B

View File

@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="156px" height="39px" viewBox="0 0 156 39" enable-background="new 0 0 156 39" xml:space="preserve">
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-126.5828" y1="-224.8" x2="-126.5828" y2="-289.873" gradientTransform="matrix(0.5469 0 0 -0.5469 102.2969 -121.9375)">
<stop offset="0" style="stop-color:#FAD956"/>
<stop offset="1" style="stop-color:#FFA10F"/>
</linearGradient>
<path fill="url(#SVGID_1_)" d="M5.453,16.546c0-0.92,0.746-1.658,1.667-1.658c0.439,0,0.829,0.174,1.128,0.448
c-0.008-0.149-0.017-0.29-0.017-0.439c0-3.076,2.487-5.564,5.564-5.564c0.796,0,1.55,0.166,2.239,0.473
c-0.008-0.158-0.017-0.315-0.017-0.464c0-4.61,3.731-8.341,8.341-8.341c4.577,0,8.291,3.69,8.341,8.258
c-1.509,1.327-2.711,3.001-3.482,4.892c-1.492-0.929-3.25-1.484-5.132-1.484c-3.88,0-7.23,2.206-8.797,5.539H9.342H7.12
C6.199,18.188,5.453,17.467,5.453,16.546z M49.373,11.563c-2.065-2.065-4.909-3.341-8.059-3.341c-5.746,0-10.505,4.254-11.285,9.792
c-1.418-1.89-3.681-3.118-6.227-3.118c-4.303,0-7.786,3.491-7.786,7.786c0,1.252,0.298,2.429,0.821,3.482
c-2.703,0.547-4.71,2.645-4.71,5.141c0,2.919,2.736,5.282,6.119,5.282c1.492,0,2.861-0.464,3.922-1.235L34.68,23.047
c1.385-1.269,3.225-2.04,5.248-2.04c4.229,0,7.67,3.375,7.786,7.578c0,0,0-0.008-0.008-0.008c0.066,1.244-0.58,2.496-1.774,3.184
c-1.667,0.962-3.756,0.448-4.668-1.136c-0.92-1.592-0.315-3.657,1.352-4.618c0.39-0.224,0.796-0.365,1.211-0.439
c-0.357-0.075-0.73-0.108-1.111-0.108c-3.068,0-5.564,2.487-5.564,5.564c0,3.076,2.487,5.564,5.564,5.564
c0.133,0,0.274-0.008,0.406-0.017l-0.008-0.017l0.158-0.017h10.92v0.041c3.341-0.149,6.5-3.225,6.5-6.973
c0-3.839-3.283-6.973-7.122-6.973c-0.008,0-0.008,0-0.017,0c-0.622,1.111-1.376,1.758-2.23,2.454c0.895-1.633,1.41-3.491,1.41-5.481
C52.714,16.464,51.437,13.628,49.373,11.563z"/>
<g>
<g>
<path fill="#464646" d="M78.55,23.369l-1.413-0.477c-1.791-0.592-2.728-1.282-2.728-2.678c0-1.43,1.117-2.432,2.547-2.481
c0.904-0.049,1.972,0.329,2.925,1.216l1.709-1.955c-1.331-1.347-3.023-1.988-4.634-2.021c-2.859-0.049-5.455,1.923-5.455,5.34
c0,2.777,2.202,4.157,4.404,4.864l1.364,0.509c1.545,0.542,2.728,1.397,2.728,3.04c0,1.495-1.331,2.629-3.073,2.662
c-1.265,0.049-2.761-0.509-4.108-1.955l-1.709,2.054c1.725,1.791,3.862,2.613,5.833,2.629c3.138,0.016,5.8-2.054,5.8-5.39
C82.724,25.719,80.654,24.027,78.55,23.369z M92.271,31.47c-2.005,0-3.829-1.183-3.829-3.237h7.263
c4.552,0,2.531-7.887-3.681-7.887c-3.73,0-6.721,3.089-6.721,6.885c0,4.519,3.533,6.852,7.099,6.885
c1.742,0,3.5-0.444,4.798-1.561l-1.955-1.972C94.407,31.257,93.29,31.47,92.271,31.47z M92.024,22.909
c1.347,0,2.317,0.608,2.777,1.232c0.592,0.723,0.46,1.512-0.542,1.512h-5.8C88.524,24.339,89.938,22.909,92.024,22.909z
M109.672,33.902h2.432v-7.822c0-3.171-1.988-5.751-5.883-5.751c-1.988,0-3.681,0.411-5.012,1.38l0.969,2.185
c0.805-0.542,2.12-0.953,3.697-0.953c2.202,0,3.418,1.216,3.451,3.007c-1.265-0.509-2.366-0.723-3.451-0.756
c-3.385-0.066-5.209,1.791-5.209,4.322c0,3.106,2.038,4.601,4.847,4.585c1.725,0,3.5-0.657,4.157-1.347V33.902z M109.327,30.484
c-1.265,0.575-2.547,0.887-3.5,0.887c-1.709,0-2.448-0.69-2.448-1.758c0-0.953,0.69-1.84,2.498-1.873
c0.92,0,2.12,0.164,3.434,0.674v2.07H109.327z M124.198,18.506c0.559,0,1.035-0.477,1.035-1.052s-0.46-1.052-1.035-1.052
c-0.559,0-1.035,0.477-1.035,1.052C123.179,18.045,123.64,18.506,124.198,18.506z M123.409,33.902h1.594V20.56h-1.594V33.902z
M121.766,20.56h-3.122v-2.415c0-1.085,0.969-1.66,1.955-1.66h1.413v-1.479H120.6c-2.054,0-3.599,1.2-3.599,3.155v2.415h-2.136
v1.577h2.136v11.749h1.627V22.153h3.122V20.56H121.766z M131.247,15.236h-1.594v18.667h1.594V15.236z M146.25,32.456l-1.167-1.167
c-1.101,1.052-2.514,1.232-3.714,1.232c-2.728,0-5.061-2.005-5.061-4.782h8.577c4.404,0,2.366-7.378-3.697-7.378
c-3.714,0-6.721,3.089-6.721,6.885c0,4.157,3.319,6.869,6.967,6.869C143.062,34.116,144.853,33.787,146.25,32.456z
M141.189,21.907c2.021,0,3.369,1.035,3.944,2.087c0.624,1.085,0.378,2.202-0.871,2.202h-7.92
C136.489,23.895,138.527,21.907,141.189,21.907z"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

View File

@@ -476,7 +476,7 @@ class RegistrationBackend(object):
account activation.
"""
return ('myhome', (), {})
return ('libraries', (), {})
class RegistrationForm(forms.Form):

View File

@@ -1,11 +1,10 @@
from django.conf.urls import patterns, url
from views import msg_reply, msg_reply_new, group_recommend, \
create_group_repo, attention, group_message_remove, \
from views import msg_reply, msg_reply_new, \
group_message_remove, \
group_discuss, group_wiki, group_wiki_create, \
group_wiki_page_new, group_wiki_page_edit, group_wiki_pages, \
group_wiki_page_delete, group_wiki_use_lib, group_remove, \
group_toggle_modules, \
group_add_discussion, group_add
urlpatterns = patterns('',
@@ -21,11 +20,7 @@ urlpatterns = patterns('',
url(r'^reply/(?P<msg_id>[\d]+)/$', msg_reply, name='msg_reply'),
url(r'^reply/new/$', msg_reply_new, name='msg_reply_new'),
url(r'^(?P<group_id>\d+)/remove/$', group_remove, name='group_remove'),
url(r'^(?P<group_id>[\d]+)/create-repo/$', create_group_repo, name='create_group_repo'),
url(r'^(?P<group_id>\d+)/msgdel/(?P<msg_id>\d+)/$', group_message_remove, name='group_message_remove'),
url(r'^recommend/$', group_recommend, name='group_recommend'),
#url(r'^attention/$', attention, name='group_attention'),
url(r'^(?P<group_id>\d+)/modules/toggle/$', group_toggle_modules, name='group_toggle_modules'),
url(r'^(?P<group_id>\d+)/discussion/add/$', group_add_discussion, name='group_add_discussion'),
url(r'^add/$', group_add, name='group_add'),
)

View File

@@ -422,114 +422,6 @@ def send_group_member_add_mail(request, group, from_user, to_user):
subject = _(u'You are invited to join a group on %s') % SITE_NAME
send_html_email(subject, 'group/add_member_email.html', c, None, [to_user])
@login_required_ajax
def group_recommend(request):
"""
Get or post file/directory discussions to a group.
"""
content_type = 'application/json; charset=utf-8'
result = {}
if request.method == 'POST':
form = GroupRecommendForm(request.POST)
if form.is_valid():
repo_id = form.cleaned_data['repo_id']
attach_type = form.cleaned_data['attach_type']
path = form.cleaned_data['path']
message = form.cleaned_data['message']
# groups is a group_id list, e.g. [u'1', u'7']
groups = request.POST.getlist('groups')
username = request.user.username
groups_not_in = []
groups_posted_to = []
for group_id in groups:
# Check group id format
try:
group_id = int(group_id)
except ValueError:
result['error'] = _(u'Error: wrong group id')
return HttpResponse(json.dumps(result), status=400,
content_type=content_type)
group = get_group(group_id)
if not group:
result['error'] = _(u'Error: the group does not exist.')
return HttpResponse(json.dumps(result), status=400,
content_type=content_type)
# TODO: Check whether repo is in the group and Im in the group
if not is_group_user(group_id, username):
groups_not_in.append(group.group_name)
continue
# save message to group
gm = GroupMessage(group_id=group_id, from_email=username,
message=message)
gm.save()
# send signal
grpmsg_added.send(sender=GroupMessage, group_id=group_id,
from_email=username, message=message)
# save attachment
ma = MessageAttachment(group_message=gm, repo_id=repo_id,
attach_type=attach_type, path=path,
src='recommend')
ma.save()
# save discussion
fd = FileDiscuss(group_message=gm, repo_id=repo_id, path=path)
fd.save()
group_url = reverse('group_discuss', args=[group_id])
groups_posted_to.append(u'<a href="%(url)s" target="_blank">%(name)s</a>' % \
{'url':group_url, 'name':group.group_name})
if len(groups_posted_to) > 0:
result['success'] = _(u'Successfully posted to %(groups)s.') % {'groups': ', '.join(groups_posted_to)}
if len(groups_not_in) > 0:
result['error'] = _(u'Error: you are not in group %s.') % (', '.join(groups_not_in))
else:
result['error'] = str(form.errors)
return HttpResponse(json.dumps(result), status=400, content_type=content_type)
# request.method == 'GET'
else:
repo_id = request.GET.get('repo_id')
path = request.GET.get('path', None)
repo = get_repo(repo_id)
if not repo:
result['error'] = _(u'Error: the library does not exist.')
return HttpResponse(json.dumps(result), status=400, content_type=content_type)
if path is None:
result['error'] = _(u'Error: no path.')
return HttpResponse(json.dumps(result), status=400, content_type=content_type)
# get discussions & replies
path_hash = calc_file_path_hash(path)
discussions = FileDiscuss.objects.filter(path_hash=path_hash, repo_id=repo_id)
msg_ids = [ e.group_message_id for e in discussions ]
grp_msgs = GroupMessage.objects.filter(id__in=msg_ids).order_by('-timestamp')
msg_replies = MessageReply.objects.filter(reply_to__in=grp_msgs)
for msg in grp_msgs:
msg.replies = []
for reply in msg_replies:
if msg.id == reply.reply_to_id:
msg.replies.append(reply)
msg.reply_cnt = len(msg.replies)
msg.replies = msg.replies[-3:]
ctx = {}
ctx['messages'] = grp_msgs
html = render_to_string("group/discussion_list.html", ctx)
result['html'] = html
return HttpResponse(json.dumps(result), content_type=content_type)
@login_required_ajax
def create_group_repo(request, group_id):
"""Create a repo and share it to current group"""
@@ -609,53 +501,6 @@ def create_group_repo(request, group_id):
return HttpResponse(json.dumps({'success': True}),
content_type=content_type)
@login_required_ajax
def attention(request):
"""
Handle ajax request to query group members used in autocomplete.
"""
user = request.user.username
name_str = request.GET.get('name_startsWith')
gids = request.GET.get('gids', '')
result = []
members = []
for gid in gids.split('_'):
try:
gid = int(gid)
except ValueError:
continue
if not is_group_user(gid, user):
continue
# Get all group users
members += get_group_members(gid)
member_names = []
for m in members:
if len(result) == 10: # Return at most 10 results.
break
if m.user_name == user:
continue
if m.user_name in member_names:
# Remove duplicated member names
continue
else:
member_names.append(m.user_name)
from seahub.base.templatetags.seahub_tags import email2nickname, char2pinyin
nickname = email2nickname(m.user_name)
pinyin = char2pinyin(nickname)
if nickname.startswith(name_str) or pinyin.startswith(name_str):
result.append({'contact_name': nickname})
content_type = 'application/json; charset=utf-8'
return HttpResponse(json.dumps(result), content_type=content_type)
@group_check
def group_add_discussion(request, group):
if not request.is_ajax() or request.method != 'POST':
@@ -802,30 +647,6 @@ def group_discuss(request, group):
"mods_available": mods_available,
}, context_instance=RequestContext(request))
@group_staff_required
@group_check
def group_toggle_modules(request, group):
"""Enable or disable modules.
"""
if request.method != 'POST':
raise Http404
referer = request.META.get('HTTP_REFERER', None)
next = SITE_ROOT if referer is None else referer
username = request.user.username
group_wiki = request.POST.get('group_wiki', 'off')
if group_wiki == 'on':
enable_mod_for_group(group.id, MOD_GROUP_WIKI)
messages.success(request, _('Successfully enable "Wiki".'))
else:
disable_mod_for_group(group.id, MOD_GROUP_WIKI)
if referer.find('wiki') > 0:
next = reverse('group_info', args=[group.id])
messages.success(request, _('Successfully disable "Wiki".'))
return HttpResponseRedirect(next)
########## wiki
@group_check

View File

@@ -1,9 +0,0 @@
{% extends "myhome_base.html" %}
{% block title %}{% endblock %}
{% block main_panel %}
<div class="text-panel">
<p>该访问链接已失效,如有需要,请联系资料库拥有者 {{ repo_owner }}</p>
</div>
{% endblock %}

View File

@@ -1,12 +0,0 @@
{% autoescape off %}
亲爱的 {{ anon_email }}
{{ email }} 在SeaCloud上共享了一个资料库给你请点击以下链接查看
{{ protocol }}://{{ domain }}{% url share.views.anonymous_share_confirm token=token %}
注册后,就可以在首页查看该资料库。感谢使用我们的网站!
Seafile团队
{% endautoescape %}

View File

@@ -1,11 +0,0 @@
{% autoescape off %}
亲爱的 {{ to_email }}
{{ user }} 在SeaCloud上共享了一个资料库给你。注册帐号后请点击以下链接查看
{{ protocol }}://{{ domain }}{% url myhome %}
感谢使用我们的网站!
Seafile团队
{% endautoescape %}

View File

@@ -1,35 +0,0 @@
{% extends "home_base.html" %}
{% load seahub_tags avatar_tags i18n %}
{% block sub_title %}{% trans "Activities" %} - {% endblock %}
{% block cur_activities %}tab-cur{% endblock %}
{% block right_panel %}
<div id="events">
<div id="events-body">
{% include 'snippets/events_body.html' %}
</div>
<div id="events-loading" class="hide"><img src="{{MEDIA_URL}}img/loading-icon.gif" alt="{% trans 'Loading...' %}" /></div>
{% if events_more %}
<button id="events-more" data-start="{{new_start}}">{% trans 'More' %}</button>
{% endif %}
<p id="events-error" class="error hide"></p>
<form id="repo-decrypt-form" class="hide">{% csrf_token %}
<h3>{% trans 'Library' %} <span class="op-target"></span> {% trans 'is encrypted' %}</h3>
<input type="hidden" name="repo_id" value="" />
<label>{% trans 'Password' %}</label><br />
<input type="password" name="password" class="input" />
<p class="tip">{% trans 'The password will be kept in the server for only 1 hour.' %}</p>
<p class="error"></p>
<input type="submit" class="submit" value="{% trans 'Submit' %}" />
<button class="simplemodal-close">{% trans 'Cancel' %}</button>
</form>
</div>
{% endblock %}
{% block extra_script %}{{block.super}}
<script type="text/javascript">
{% include "snippets/events_js.html" %}
</script>
{% endblock %}

View File

@@ -36,9 +36,6 @@
<div class="hd w100 ovhd">
<h3 class="fleft">{% trans "Tools" %}</h3>
{% if user.permissions.can_add_repo %}
<span id="enable-mods" class="sf2-icon-cog2 op-icon fright" title="{% trans "Enable Modules" %}"></span>
{% endif %}
</div>
<ul class="side-tabnav-tabs">
<li class="tab {% block cur_stars %}{% endblock %}"><a href="{{ SITE_ROOT }}#starred/"><span class="sf2-icon-star"></span>{% trans "Starred" %}</a></li>
@@ -65,39 +62,9 @@
{% endblock %}
{% block main_panel %}
{% if user.permissions.can_add_repo %}
<form id="mods-enable-form" method="post" action="{% url 'toggle_modules' %}" class="hide">{% csrf_token%}
<h3>{% trans "Enable Modules"%}</h3>
<ul>
{% for mod in request.user.mods_available %}
{% if mod == 'personal wiki' %}
<li>
<label class="checkbox-label">
<span class="checkbox {% if mod in request.user.mods_enabled %}checkbox-checked{% endif %}"><input type="checkbox" name="personal_wiki" class="checkbox-orig" {%if mod in request.user.mods_enabled%}checked{% endif%} /></span>
<span class="checkbox-option">{% trans "Personal Wiki" %}</span>
</label>
</li>
{% endif %}
{% endfor %}
</ul>
<input type="submit" id="mods-enable-submit" value="{% trans "Submit"%}" class="submit"/>
</form>
{% endif %}
{% endblock %}
{% block extra_script %}
<script type="text/javascript">
{% if user.permissions.can_add_repo %}
$('#enable-mods').click(function() {
$('#mods-enable-form').modal({appendTo: "#main"});
$('#simplemodal-container').css('height', 'auto');
return false;
});
$('#group-nav a:first').click(function() {
$('#group-nav .toggle-icon').toggleClass('icon-caret-left icon-caret-down');
$('#group-nav .grp-list').slideToggle();
return false;
});
{% endif %}
</script>
{% endblock %}

View File

@@ -621,23 +621,7 @@
<td><%= mtime_relative %></td>
<td><span title="<%- owner %>"><%- owner_nickname %></span></td>
</script>
<script type="text/template" id="sub-lib-tmpl">
<td>
<% if (encrypted) { %>
<img src="{{ MEDIA_URL }}img/sync-folder-encrypt-20.png" title="{% trans "Read-Write" %}" alt="" />
<% } else { %>
<img src="{{ MEDIA_URL }}img/sync-folder-20.png" title="{% trans "Read-Write" %}" alt="" />
<% } %>
</td>
<td><a href="#my-sub-libs/lib/<%= id %>"><%- name %></a></td>
<td>
<div class="op-container">
<img src="{{MEDIA_URL}}img/delete-orange.png" class="repo-delete-btn op-icon vh" title="{% trans "Delete" %}" />
</div>
</td>
<td><a href="#my-libs/lib/<%= origin_repo_id %><%- origin_path %>"><%- abbrev_origin_path %></a></td>
<td><%= mtime_relative %></td>
</script>
<script type="text/template" id="side-nav-tmpl">
<h3 class="hd">{% trans "Files" %}</h3>
<ul class="side-tabnav-tabs">

View File

@@ -34,33 +34,6 @@
</div>
{% endif %}
{% if user.permissions.can_add_repo and sub_lib_enabled %}
<div id="my-sub-repos" class="hide">
<div class="hd ovhd">
<h3 class="fleft">{% trans "Sub-libraries" %}</h3>
<button id="sub-lib-create" class="fright"><span class="icon-plus-square add vam"></span><span class="vam">{% trans "New Sub-library" %}</span></button>
</div>
<table class="hide">
<thead>
<tr>
<th width="4%"><!--icon--></th>
<th width="38%">{% trans "Name" %}</th>
<th width="6%"><!--op--></th>
<th width="30%">{% trans "Origin" %}</th>
<th width="22%">{% trans "Last Update" %}</th>
</tr>
</thead>
<tbody></tbody>
</table>
<div class="empty-tips hide">
<h2 class="center-contents">{% trans "You have not created any sub-libraries" %}</h2>
<p>{% trans "You can create a sub-library from a directory inside a library. A sub-library can be independently synced and shared. Files in the sub-library will be automatically kept in sync with those in the directory of the origin library." %}</p>
</div>
<span class="loading-icon loading-tip"></span>
<p class="error error-tip hide"></p>
</div>
{% endif %}
<div id="repos-shared-to-me" class="hide">
<h3 class="hd">{% trans "Shared" %}</h3>
<table class="hide">

View File

@@ -1,68 +0,0 @@
{% extends 'base_for_backbone.html' %}
{% load seahub_tags avatar_tags i18n %}
{% load url from future %}
{% load staticfiles %}
{% block sub_title %}{% trans "Organization" %} - {% endblock %}
{% block left_panel %}
<div class="side-tabnav">
<h3 class="hd">{% trans "Organization" %}</h3>
<ul class="side-tabnav-tabs">
<li class="tab tab-cur"><a href="{% url 'pubrepo' %}" class="lib">{% trans "Libraries" %}</a></li>
<li class="tab {% block cur_user %}{% endblock %}"><a href="{% url 'pubuser' %}" class="members">{% trans "Members" %}</a></li>
</ul>
</div>
{% endblock %}
{% block right_panel %}
<div id="organization-repos">
<div class="hd ovhd">
<h3 class="fleft">{% trans "Libraries" %}</h3>
<button id="repo-create" class="fright"><img src="{{ MEDIA_URL }}img/add.png" alt="" class="add vam" /><span class="vam">{% trans "New Library"%}</span></button>
</div>
<table class="repo-list hide">
<thead>
<tr>
<th width="4%"></th>
<th width="38%">{% trans "Name"%} <span class="by-name icon-caret-up cspt"></span></th>
<th width="10%"><!--op--></th>
<th width="14%">{% trans "Size"%}</th>
<th width="18%">{% trans "Last Update"%} <span class="by-time icon-caret-down cspt"></span></th>
<th width="16%">{% trans "Shared By"%}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<img src="{{MEDIA_URL}}img/loading-icon.gif" alt="" class="loading-tip" />
<div class="empty-tips hide">
<h2 class="alc">{% trans "No public library" %}</h2>
<p>{% blocktrans %}You can create a public library by clicking "New Library" button, others can view and download this library.{% endblocktrans %}</p>
</div>
</div>
{% include "js/dir-view.html" %}
{% endblock %}
{% block extra_script %}
{% include "js/lib-op-popups.html" %}
<script>
app["pageOptions"] = {
site_root: "{{ SITE_ROOT }}",
base_url: "{{ SITE_ROOT }}" + "home/my/",
reposUrl: "{% url 'api2-repos' %}",
pubReposUrl: "{% url 'api2-pub-repos' %}",
current_user: "{{ request.user.username }}",
csrfToken: "{{csrf_token}}",
is_staff: {% if request.user.is_staff %} true {% else %} false {% endif %}
};
</script>
{% if debug %}
<script data-main="{% static "scripts/organization.js" %}" src="{% static "scripts/lib/require.js" %}"></script>
{% else %}
<script data-main="{% static "scripts/dist/group.js" %}" src="{% static "scripts/lib/require.js" %}"></script>
{% endif %}
{% endblock %}

View File

@@ -1,64 +0,0 @@
{% extends "pub_base.html" %}
{% load seahub_tags avatar_tags i18n %}
{% load url from future %}
{% block cur_user %}tab-cur{% endblock %}
{% block left_panel %}{{block.super}}
{% if has_file_search %}
<form action="{% url "pubuser_search" %}" method="get" class="side-search-form">
<input type="text" name="search" value="{{search}}" placeholder="{% trans "Search members..." %}" class="input" />
</form>
{% endif %}
{% endblock %}
{% block right_panel %}
{% if search %}
<h3 class="hd">{% trans "Search Results" %}</h3>
{% else %}
<div class="tabnav ovhd">
<ul class="tabnav-tabs fleft">
<li class="tabnav-tab {% if not ldap %}tabnav-tab-cur{%endif%}"><a href="{% url 'pubuser' %}">{% trans "Database" %}</a></li>
{% if have_ldap_user %}
<li class="tabnav-tab {% if ldap %}tabnav-tab-cur{%endif%}"><a href="{% url 'pubuser' %}?ldap=1">{% trans "LDAP" %}</a></li>
{% endif %}
</ul>
</div>
{% endif %}
{% if users %}
<ul class="user-list">
{% for u in users %}
{% with e=u.email id=u.email %}
<li class="user ovhd">
<a href="{% url 'user_profile' id %}" class="pic fleft">{% avatar e 48 %}</a>
<div class="txt fright">
<a class="name" href="{% url 'user_profile' id %}">{{ e|email2nickname }}</a>
<p>{{ e }}</p>
</div>
</li>
{% endwith %}
{% endfor %}
</ul>
{% if show_paginator %}
<div id="paginator">
{% if has_prev %}
<a href="?page={{ current_page|add:"-1" }}{% if ldap %}&ldap=1{%endif%}">{% trans "Previous" %}</a>
{% endif %}
{% for pr in page_range %}
{% if pr == current_page %}
<span class="cur">{{ pr }}</span>
{% else %}
<a href="?page={{ pr }}{% if ldap %}&ldap=1{%endif%}" class="pg">{{ pr }}</a>
{% endif %}
{% endfor %}
{% if has_next %}
<a href="?page={{ current_page|add:"1" }}{% if ldap %}&ldap=1{%endif%}">{% trans "Next" %}</a>
{% endif %}
</div>
{% endif %}
{% else %}
<p>{% trans "None"%}</p>
{% endif %}
{% endblock %}

View File

@@ -47,7 +47,6 @@ urlpatterns = patterns(
url(r'^$', libraries, name='libraries'),
#url(r'^home/$', direct_to_template, { 'template': 'home.html' } ),
url(r'^robots\.txt$', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')),
url(r'^home/my/$', myhome, name='myhome'),
url(r'^home/wiki/$', personal_wiki, name='personal_wiki'),
url(r'^home/wiki/(?P<page_name>[^/]+)$', personal_wiki, name='personal_wiki'),
url(r'^home/wiki_pages/$', personal_wiki_pages, name='personal_wiki_pages'),
@@ -98,7 +97,6 @@ urlpatterns = patterns(
url(r'^#group/(?P<group_id>\d+)/members/$', fake_view, name='group_members'),
url(r'^#groups/', fake_view, name='group_list'),
url(r'^#group/(?P<group_id>\d+)/settings/$', fake_view, name='group_manage'),
# url(r'^home/my/lib/(?P<repo_id>[-0-9a-f]{36})/dir/(?P<path>.*)$', myhome_lib, name='myhome_lib'),
### share file/dir, upload link ###
# url(r'^repo/(?P<repo_id>[-0-9a-f]{36})/privshare/$', gen_private_file_share, name='gen_private_file_share'),
@@ -114,14 +112,11 @@ urlpatterns = patterns(
### Misc ###
url(r'^image-view/(?P<filename>.*)$', image_view, name='image_view'),
(r'^file_upload_progress_page/$', file_upload_progress_page),
url(r'^activities/$', activities, name='activities'),
url(r'^starred/$', starred, name='starred'),
url(r'^i18n/$', i18n, name='i18n'),
url(r'^convert_cmmt_desc_link/$', convert_cmmt_desc_link, name='convert_cmmt_desc_link'),
url(r'^user/(?P<id_or_email>[^/]+)/msgs/$', user_msg_list, name='user_msg_list'),
url(r'^user/(?P<msg_id>\d+)/msgdel/$', user_msg_remove, name='user_msg_remove'),
url(r'^user/(?P<msg_id>\d+)/remsgdel/$', user_received_msg_remove, name='user_received_msg_remove'),
url(r'^modules/toggle/$', toggle_modules, name="toggle_modules"),
url(r'^download_client_program/$', TemplateView.as_view(template_name="download.html"), name="download_client"),
url(r'^choose_register/$', TemplateView.as_view(template_name="choose_register.html"), name="choose_register"),

View File

@@ -846,11 +846,6 @@ def get_virtual_repos_by_owner(request):
else:
return seafile_api.get_virtual_repos_by_owner(username)
@login_required
@user_mods_check
def myhome(request):
return HttpResponseRedirect(reverse('libraries'))
@login_required
@user_mods_check
def libraries(request):
@@ -891,23 +886,6 @@ def libraries(request):
'can_add_pub_repo': can_add_pub_repo,
}, context_instance=RequestContext(request))
@login_required
@user_mods_check
def starred(request):
"""List starred files.
Arguments:
- `request`:
"""
username = request.user.username
starred_files = UserStarredFiles.objects.get_starred_files_by_username(
username)
return render_to_response('starred.html', {
"starred_files": starred_files,
}, context_instance=RequestContext(request))
@login_required
@user_mods_check
def devices(request):
@@ -1457,31 +1435,6 @@ def repo_download_dir(request, repo_id):
url = gen_file_get_url(token, dirname)
return redirect(url)
@login_required
@user_mods_check
def activities(request):
if not EVENTS_ENABLED:
raise Http404
events_count = 15
username = request.user.username
start = int(request.GET.get('start', 0))
if is_org_context(request):
org_id = request.user.org.org_id
events, start = get_org_user_events(org_id, username, start, events_count)
else:
events, start = get_user_events(username, start, events_count)
events_more = True if len(events) == events_count else False
event_groups = group_events_data(events)
return render_to_response('activities.html', {
'event_groups': event_groups,
'events_more': events_more,
'new_start': start,
}, context_instance=RequestContext(request))
def group_events_data(events):
"""
@@ -1554,29 +1507,6 @@ def convert_cmmt_desc_link(request):
logger.warn('diff_result: %s' % (d.__dict__))
raise Http404
@login_required
def toggle_modules(request):
"""Enable or disable modules.
"""
if request.method != 'POST':
raise Http404
referer = request.META.get('HTTP_REFERER', None)
next = settings.SITE_ROOT if referer is None else referer
username = request.user.username
personal_wiki = request.POST.get('personal_wiki', 'off')
if personal_wiki == 'on':
enable_mod_for_user(username, MOD_PERSONAL_WIKI)
messages.success(request, _('Successfully enable "Personal Wiki".'))
else:
disable_mod_for_user(username, MOD_PERSONAL_WIKI)
if referer.find('wiki') > 0:
next = reverse('myhome')
messages.success(request, _('Successfully disable "Personal Wiki".'))
return HttpResponseRedirect(next)
storage = get_avatar_file_storage()
def latest_entry(request, filename):
@@ -1612,7 +1542,7 @@ def image_view(request, filename):
return response
def shib_login(request):
return HttpResponseRedirect(request.GET.get("next",reverse('myhome')))
return HttpResponseRedirect(request.GET.get("next", reverse('libraries')))
def underscore_template(request, template):
"""Serve underscore template through Django, mainly for I18n.

View File

@@ -1,170 +0,0 @@
define([
'jquery',
'underscore',
'backbone',
'common',
'file-tree',
'app/collections/repos',
'app/views/sub-lib',
'app/views/add-repo',
], function($, _, Backbone, Common, FileTree, RepoCollection, RepoView, AddRepoView) {
'use strict';
var ReposView = Backbone.View.extend({
el: $('#my-sub-repos'),
events: {
'click #sub-lib-create': 'createRepo'
},
initialize: function(options) {
this.$table = this.$('table');
this.$tableHead = $('thead', this.$table);
this.$tableBody = $('tbody', this.$table);
this.$loadingTip = this.$('.loading-tip');
this.$emptyTip = this.$('.empty-tips');
this.repos = new RepoCollection({type: 'sub'});
this.listenTo(this.repos, 'add', this.addOne);
this.listenTo(this.repos, 'reset', this.reset);
},
addOne: function(repo, collection, options) {
var view = new RepoView({model: repo});
if (options.prepend) {
this.$tableBody.prepend(view.render().el);
} else {
this.$tableBody.append(view.render().el);
}
},
reset: function() {
this.$('.error').hide();
this.$tableBody.empty();
this.repos.each(this.addOne, this);
if (this.repos.length) {
this.$emptyTip.hide();
this.$table.show();
} else {
this.$emptyTip.show();
this.$table.hide();
}
this.$loadingTip.hide();
},
showSubRepos: function() {
this.$el.show();
this.$table.hide();
var $loadingTip = this.$loadingTip;
$loadingTip.show();
var _this = this;
this.repos.fetch({
reset: true,
success: function (collection, response, opts) {
},
error: function (collection, response, opts) {
$loadingTip.hide();
var $error = _this.$('.error');
var err_msg;
if (response.responseText) {
if (response['status'] == 401 || response['status'] == 403) {
err_msg = gettext("Permission error");
} else {
err_msg = gettext("Error");
}
} else {
err_msg = gettext('Please check the network.');
}
$error.html(err_msg).show();
}
});
},
show: function() {
this.showSubRepos();
},
hide: function() {
this.$el.hide();
},
createRepo: function() {
var _this = this;
var sublib_create_form = $('#sublib-create-form');
var dir_tree_cont = $('.dir-tree-cont', sublib_create_form);
sublib_create_form.modal();
$.ajax({
url: Common.getUrl({'name': 'get_my_unenc_repos'}),
cache: false,
dataType: 'json',
success: function(data) {
var repos = FileTree.formatRepoData(data);
if (repos.length > 0) {
FileTree.renderDirTree(dir_tree_cont, sublib_create_form, repos);
} else {
dir_tree_cont.html('<p class="error">' + gettext("You don't have any library at present.") + '</p>');
}
},
error: function(jqXHR, textStatus, errorThrown) {
var error;
if (jqXHR.responseText) {
error = $.parseJSON(jqXHR.responseText).error;
} else {
error = gettext("Failed. Please check the network.");
}
dir_tree_cont.html('<p class="error">' + error + '</p>');
}
});
$('.submit', sublib_create_form).click(function() {
var ori_repo_id = $('[name="dst_repo"]', sublib_create_form).val();
var path = $('[name="dst_path"]', sublib_create_form).val();
if (!path || path == '/') {
$('.error', sublib_create_form).html(gettext("Please choose a directory")).removeClass('hide');
return false;
}
// path ends with '/', rm it here
path = path.substr(0, path.length - 1);
$.ajax({
url: Common.getUrl({'name':'sub_repo', 'repo_id':ori_repo_id}) + '?p=' + encodeURIComponent(path),
dataType: 'json',
success: function(data) {
$.modal.close();
var new_sub_lib = {
'id': data["sub_repo_id"],
'name': data["name"],
'origin_repo_id': ori_repo_id,
'origin_path': path,
'abbrev_origin_path': data["abbrev_origin_path"],
'mtime': new Date().getTime() / 1000,
'mtime_relative': gettext("Just now")
};
if (_this.repos.length > 0) {
_this.repos.add(new_sub_lib , {prepend: true});
} else {
_this.repos.reset([new_sub_lib]);
}
},
error: function(xhr, textStatus, errorThrown) {
var err;
if (xhr.responseText) {
err = jQuery.parseJSON(xhr.responseText).error;
} else {
err = gettext("Failed. Please check the network.");
}
$('.error', sublib_create_form).html(err).removeClass('hide');
}
});
return false;
});
}
});
return ReposView;
});

View File

@@ -4,11 +4,10 @@ define([
'backbone',
'common',
'app/views/myhome-repos',
'app/views/myhome-sub-repos',
'app/views/myhome-shared-repos',
'app/views/starred-file',
'app/views/activities'
], function($, _, Backbone, Common, ReposView, SubReposView,
], function($, _, Backbone, Common, ReposView,
SharedReposView, StarredFileView, ActivitiesView) {
'use strict';
@@ -17,7 +16,6 @@ define([
initialize: function(options) {
this.reposView = new ReposView();
this.subReposView = new SubReposView();
this.sharedReposView = new SharedReposView();
this.starredFileView = new StarredFileView();
this.activitiesView = new ActivitiesView();

View File

@@ -65,7 +65,7 @@ else:
url(r'^login/$',
auth_views.login,
{'template_name': 'registration/login.html',
'redirect_if_logged_in': 'myhome'},
'redirect_if_logged_in': 'libraries'},
name='auth_login'),
url(r'^logout/$',
auth_views.logout,