diff --git a/media/css/seahub.css b/media/css/seahub.css
index a05e0adc7e..55c87cbd97 100644
--- a/media/css/seahub.css
+++ b/media/css/seahub.css
@@ -11,10 +11,13 @@ form,input,textarea,button,img {
}
body,
input, textarea, button, select {
- font: 13px/19px Arial, Helvetica, sans-serif;/* 19px : for ff*/
+ font: 13px/1.5 Arial, Helvetica, sans-serif;
color: #333;
word-wrap:break-word; /* for en */
}
+input, button, select {
+ line-height:19px;/*for ff*/
+}
h1 {
font-size:1.9em;
margin:1.1em 0 0.5em;
@@ -303,7 +306,33 @@ textarea:-moz-placeholder {/* for FF */
.center-contents {
text-align: center;
}
-
+.tabnav {
+ height:37px;
+ border-bottom:1px solid #ddd;
+}
+.tabnav-tabs {
+ display:inline-block;
+}
+.tabnav-tab {
+ display:inline-block;
+ font-size:14px;
+ padding:8px 10px;
+ border:1px solid transparent;
+ border-bottom:0;
+}
+.tabnav-tab a {
+ color:#666;
+ font-weight:normal;
+}
+.tabnav-tab a:hover {
+}
+.tabnav-tab-cur {
+ font-weight:bold;
+ border-color:#ddd;
+ border-radius:3px 3px 0 0;
+ background:#fff;
+ margin-bottom:-1px;
+}
/* container */
#main, #footer { width:950px; }
#main { margin:0 auto; }
@@ -1180,19 +1209,23 @@ textarea:-moz-placeholder {/* for FF */
height:80px;
}
/* group, org */
-.group-list {
- margin-top:20px;
+.group-list,
+.user-list {
+ margin-top:30px;
}
-.group-list .group {
+.group-list .group,
+.user-list .user {
display:inline-block; /*to handle different height of items*/
vertical-align:top;
width:315px;
margin:0 17px 25px 0;
}
-.group-list .group {
+.group-list .group,
+.user-list .user {
*display:inline; /* for ie 6,7 */
}
-.group .txt {
+.group .txt,
+.user-list .user .txt {
color:#333;
width:250px;
}
@@ -1745,3 +1778,17 @@ textarea:-moz-placeholder {/* for FF */
.diff-chg {
color: #c3f;
}
+.pubinfo-item {
+ display:inline-block;
+ min-width:66px;
+}
+.pubinfo-item .amount {
+ font-size:28px;
+ line-height:1;
+ font-weight:bold;
+ color:#222;
+}
+.pubinfo-item .obj {
+ font-size:11px;
+ color:#999;
+}
diff --git a/templates/myhome_base.html b/templates/myhome_base.html
index 0f4e8dab80..8eda7a0196 100644
--- a/templates/myhome_base.html
+++ b/templates/myhome_base.html
@@ -18,7 +18,7 @@
{% if not cloud_mode %}
- {% trans "Public Info" %}
+ {% trans "Public Info" %}
{% endif %}
diff --git a/templates/pubgrp.html b/templates/pubgrp.html
new file mode 100644
index 0000000000..1da8c7c6d5
--- /dev/null
+++ b/templates/pubgrp.html
@@ -0,0 +1,38 @@
+{% extends "myhome_base.html" %}
+{% load seahub_tags avatar_tags group_avatar_tags i18n %}
+{% load url from future %}
+
+{% block nav_pubinfo_class %}class="cur"{% endblock %}
+
+{% block left_panel %}
+{% include 'snippets/pubinfo.html' %}
+{% endblock %}
+
+{% block right_panel %}
+
+{% if groups %}
+
+ {% for group in groups %}
+ -
+ {% grp_avatar group.props.id 48 %}
+
+
+
{% trans "Creator: "%}{{ group.props.creator_name }}
+
{% trans "Time: "%}{{ group.props.timestamp|tsstr_sec }}
+
+
+ {% endfor %}
+
+{% else %}
+
+
{% trans "No one has created any groups yet" %}
+
{% blocktrans %}You can click "Add Group" button under "Group" label to create a group. {% endblocktrans %}
+
+{% endif %}
+{% endblock %}
diff --git a/templates/pubinfo.html b/templates/pubinfo.html
deleted file mode 100644
index b054ee0867..0000000000
--- a/templates/pubinfo.html
+++ /dev/null
@@ -1,113 +0,0 @@
-{% extends "myhome_base.html" %}
-{% load seahub_tags avatar_tags group_avatar_tags i18n %}
-{% load url from future %}
-
-{% block nav_pubinfo_class %}class="cur"{% endblock %}
-
-{% block left_panel %}
-{% trans "Users" %}
-{% if users %}
-
-{% include "snippets/user_profile_html.html" %}
-{% else %}
-{% trans "None"%}
-{% endif %}
-{% endblock %}
-
-{% block right_panel %}
-{% trans "Libraries & Groups" %}
-
-
-
-
-
-
- {% if public_repos %}
-
-
- |
- {% trans "Name"%} |
- {% trans "Description"%} |
- {% trans "Last Update"%} |
- {% trans "Share From"%} |
- {% trans "Operations"%} |
-
- {% for repo in public_repos %}
-
-
- {% if repo.user_perm == 'rw' %}
-
- {% else %}
-
- {% endif %}
- |
- {{ repo.props.repo_name }} |
- {{ repo.props.repo_desc }} |
- {% if repo.props.last_modified %}{{ repo.props.last_modified|translate_seahub_time }}{% else %}--{% endif %} |
- {{ repo.props.user|email2nickname }} |
-
-
- |
-
- {% endfor %}
-
- {% else %}
-
-
{% trans "No public library" %}
-
{% blocktrans %}You can create a public library by clicking "New Library" button, others can view and download this library.{% endblocktrans %}
-
- {% endif %}
- {% include "snippets/repo_create_form.html" %}
-
-
- {% if groups %}
-
- {% for group in groups %}
- -
- {% grp_avatar group.props.id 48 %}
-
-
-
{% trans "Creator: "%}{{ group.props.creator_name }}
-
{% trans "Time: "%}{{ group.props.timestamp|tsstr_sec }}
-
-
- {% endfor %}
-
- {% else %}
-
-
{% trans "No one has created any groups yet" %}
-
{% blocktrans %}You can click "Add Group" button under "Group" label to create a group. {% endblocktrans %}
-
- {% endif %}
-
-
-{% endblock %}
-
-{% block extra_script %}
-{% include "snippets/user_profile_js.html" %}
-
-{% endblock %}
diff --git a/templates/pubrepo.html b/templates/pubrepo.html
new file mode 100644
index 0000000000..30186cbdfe
--- /dev/null
+++ b/templates/pubrepo.html
@@ -0,0 +1,77 @@
+{% extends "myhome_base.html" %}
+{% load seahub_tags avatar_tags group_avatar_tags i18n %}
+{% load url from future %}
+
+{% block nav_pubinfo_class %}class="cur"{% endblock %}
+
+{% block left_panel %}
+{% include 'snippets/pubinfo.html' %}
+{% endblock %}
+
+{% block right_panel %}
+
+
+
+
+{% if public_repos %}
+
+
+ |
+ {% trans "Name"%} |
+ {% trans "Description"%} |
+ {% trans "Last Update"%} |
+ {% trans "Share From"%} |
+ {% trans "Operations"%} |
+
+ {% for repo in public_repos %}
+
+
+ {% if repo.user_perm == 'rw' %}
+
+ {% else %}
+
+ {% endif %}
+ |
+ {{ repo.props.repo_name }} |
+ {{ repo.props.repo_desc }} |
+ {% if repo.props.last_modified %}{{ repo.props.last_modified|translate_seahub_time }}{% else %}--{% endif %} |
+ {{ repo.props.user|email2nickname }} |
+
+
+ |
+
+ {% endfor %}
+
+{% else %}
+
+
{% trans "No public library" %}
+
{% blocktrans %}You can create a public library by clicking "New Library" button, others can view and download this library.{% endblocktrans %}
+
+{% endif %}
+{% include "snippets/repo_create_form.html" %}
+{% endblock %}
+
+{% block extra_script %}
+
+{% endblock %}
diff --git a/templates/pubuser.html b/templates/pubuser.html
new file mode 100644
index 0000000000..e74c956f1c
--- /dev/null
+++ b/templates/pubuser.html
@@ -0,0 +1,34 @@
+{% extends "myhome_base.html" %}
+{% load seahub_tags avatar_tags group_avatar_tags i18n %}
+{% load url from future %}
+
+{% block nav_pubinfo_class %}class="cur"{% endblock %}
+
+{% block left_panel %}
+{% include 'snippets/pubinfo.html' %}
+{% endblock %}
+
+{% block right_panel %}
+
+{% if users %}
+
+{% else %}
+{% trans "None"%}
+{% endif %}
+{% endblock %}
diff --git a/templates/registration/login.html b/templates/registration/login.html
index c306d92f33..4c6a1cc691 100644
--- a/templates/registration/login.html
+++ b/templates/registration/login.html
@@ -9,14 +9,14 @@
+
+ {% if form.errors %}
+ {% trans "Incorrect email or password" %}
+ {% else %}
+ {% endif %}
{% trans "Forgot password?" %}
-{% if next %}
-
-{% else %}
-
-{% endif %}
{% endblock %}
@@ -24,17 +24,14 @@
{% block extra_script %}
{% endblock %}
diff --git a/templates/snippets/pubinfo.html b/templates/snippets/pubinfo.html
new file mode 100644
index 0000000000..7f1cae0c50
--- /dev/null
+++ b/templates/snippets/pubinfo.html
@@ -0,0 +1,9 @@
+{% load i18n %}
+
+
{% trans "Organization Info"%}
+
+ - {{ pubrepos_count }}
{% trans 'Libraries' %}
+ - {{ groups_count }}
{% trans 'Groups' %}
+ - {{ emailusers_count}}
{% trans 'Users' %}
+
+
diff --git a/thirdpart/seaserv/__init__.py b/thirdpart/seaserv/__init__.py
index 646480b424..3dba510b4d 100644
--- a/thirdpart/seaserv/__init__.py
+++ b/thirdpart/seaserv/__init__.py
@@ -3,7 +3,7 @@ import service
from service import ccnet_rpc, monitor_rpc, seafserv_rpc, \
seafserv_threaded_rpc, ccnet_threaded_rpc
from service import send_command, check_quota, web_get_access_token, unset_repo_passwd
-from service import get_emailusers, get_session_info
+from service import get_emailusers, count_emailusers, get_session_info
from service import get_org_groups, get_personal_groups_by_user, \
get_group_repoids, get_personal_groups, list_share_repos, remove_share, \
check_group_staff, remove_group_user, get_group, get_org_id_by_group, \
@@ -18,7 +18,8 @@ from service import get_repos, get_repo, get_commits, get_branches, remove_repo,
is_org_repo_owner, get_org_repo_owner, is_org_repo, get_file_size,\
list_personal_repos_by_owner, get_repo_token_nonnull, get_repo_owner, \
server_repo_size, get_file_id_by_path, get_commit, set_repo_history_limit,\
- get_repo_history_limit, list_inner_pub_repos_by_owner, unset_inner_pub_repo
+ get_repo_history_limit, list_inner_pub_repos_by_owner, unset_inner_pub_repo,\
+ count_inner_pub_repos
from service import get_binding_peerids, is_valid_filename, check_permission,\
is_passwd_set
diff --git a/thirdpart/seaserv/service.py b/thirdpart/seaserv/service.py
index 91bcca9916..1a5b7c4632 100644
--- a/thirdpart/seaserv/service.py
+++ b/thirdpart/seaserv/service.py
@@ -153,6 +153,13 @@ def get_emailusers(start, limit):
users = []
return users
+def count_emailusers():
+ try:
+ ret = ccnet_threaded_rpc.count_emailusers()
+ except SearpcError:
+ ret = 0
+ return ret
+
def get_session_info():
return ccnet_rpc.get_session_info()
@@ -647,6 +654,13 @@ def list_inner_pub_repos(username):
shared_repos.sort(lambda x, y: cmp(y.props.last_modified, x.props.last_modified))
return shared_repos
+def count_inner_pub_repos():
+ try:
+ ret = seafserv_threaded_rpc.count_inner_pub_repos()
+ except SearpcError:
+ ret = 0
+ return ret
+
def is_inner_pub_repo(repo_id):
"""
Check whether a repo is public.
diff --git a/urls.py b/urls.py
index ed50a39f9e..360186ef2e 100644
--- a/urls.py
+++ b/urls.py
@@ -114,7 +114,9 @@ if CLOUD_MODE:
)
else:
urlpatterns += patterns('',
- (r'^pubinfo/$', pubinfo),
+ url(r'^pubinfo/libraries/$', pubrepo, name='pubrepo'),
(r'^publicrepo/create/$', public_repo_create),
+ url(r'^pubinfo/groups/$', pubgrp, name='pubgrp'),
+ url(r'^pubinfo/users/$', pubuser, name='pubuser'),
)
diff --git a/views.py b/views.py
index e1e95be29a..7b2c20fd46 100644
--- a/views.py
+++ b/views.py
@@ -42,7 +42,8 @@ from seaserv import ccnet_rpc, ccnet_threaded_rpc, get_repos, get_emailusers, \
get_related_users_by_repo, get_related_users_by_org_repo, HtmlDiff, \
get_session_info, get_group_repoids, get_repo_owner, get_file_id_by_path, \
get_repo_history_limit, set_repo_history_limit, MAX_UPLOAD_FILE_SIZE, \
- get_commit, MAX_DOWNLOAD_DIR_SIZE, CALC_SHARE_USAGE, unset_inner_pub_repo
+ get_commit, MAX_DOWNLOAD_DIR_SIZE, CALC_SHARE_USAGE, count_emailusers, \
+ count_inner_pub_repos, unset_inner_pub_repo
from pysearpc import SearpcError
from base.accounts import User
@@ -2735,24 +2736,66 @@ def demo(request):
return HttpResponseRedirect(redirect_to)
@login_required
-def pubinfo(request):
+def pubrepo(request):
"""
- Show public information.
+ Show public libraries.
"""
if request.cloud_mode:
# Users are not allowed to see public information when in cloud mode.
raise Http404
else:
public_repos = list_inner_pub_repos(request.user.username)
- groups = get_personal_groups(-1, -1)
- users = get_emailusers(-1, -1)
- return render_to_response('pubinfo.html', {
- 'groups': groups,
- 'users': users,
+ pubrepos_count = len(public_repos)
+ groups_count = len(get_personal_groups(-1, -1))
+ emailusers_count = count_emailusers()
+ return render_to_response('pubrepo.html', {
'public_repos': public_repos,
'create_shared_repo': True,
+ 'pubrepos_count': pubrepos_count,
+ 'groups_count': groups_count,
+ 'emailusers_count': emailusers_count,
}, context_instance=RequestContext(request))
-
+
+@login_required
+def pubgrp(request):
+ """
+ Show public groups.
+ """
+ if request.cloud_mode:
+ # Users are not allowed to see public information when in cloud mode.
+ raise Http404
+ else:
+ groups = get_personal_groups(-1, -1)
+ pubrepos_count = count_inner_pub_repos()
+ groups_count = len(groups)
+ emailusers_count = count_emailusers()
+ return render_to_response('pubgrp.html', {
+ 'groups': groups,
+ 'pubrepos_count': pubrepos_count,
+ 'groups_count': groups_count,
+ 'emailusers_count': emailusers_count,
+ }, context_instance=RequestContext(request))
+
+@login_required
+def pubuser(request):
+ """
+ Show public users.
+ """
+ if request.cloud_mode:
+ # Users are not allowed to see public information when in cloud mode.
+ raise Http404
+ else:
+ users = get_emailusers(-1, -1)
+ pubrepos_count = count_inner_pub_repos()
+ groups_count = len(get_personal_groups(-1, -1))
+ emailusers_count = count_emailusers()
+ return render_to_response('pubuser.html', {
+ 'users': users,
+ 'pubrepos_count': pubrepos_count,
+ 'groups_count': groups_count,
+ 'emailusers_count': emailusers_count,
+ }, context_instance=RequestContext(request))
+
def repo_set_password(request):
content_type = 'application/json; charset=utf-8'