diff --git a/media/css/seahub.css b/media/css/seahub.css index c18843fda6..356c736173 100644 --- a/media/css/seahub.css +++ b/media/css/seahub.css @@ -385,6 +385,8 @@ table img { .new-reply { padding: 5px; background-color: #FDF; + margin-bottom: 5px; + display: block; } .new-reply a { color: #000; diff --git a/organizations/__init__.py b/organizations/__init__.py index e69de29bb2..f344c1e1d4 100644 --- a/organizations/__init__.py +++ b/organizations/__init__.py @@ -0,0 +1,4 @@ +from signals import * +from handlers import * + +org_user_added.connect(org_user_added_cb, sender=None) diff --git a/organizations/templates/organizations/org_useradmin.html b/organizations/templates/organizations/org_useradmin.html index f297a050ea..b570978f31 100644 --- a/organizations/templates/organizations/org_useradmin.html +++ b/organizations/templates/organizations/org_useradmin.html @@ -32,7 +32,7 @@ {% for user in users %} - {{ user.props.email }} + {{ user.props.email }} {% if not user.is_self %} @@ -69,8 +69,9 @@

- +

可以是非网站注册用户,我们会以邮件通知对方。

+

(如未收到,请检查垃圾邮件)

输入不能为空。

diff --git a/organizations/urls.py b/organizations/urls.py index 6bdf041a43..0915da394c 100644 --- a/organizations/urls.py +++ b/organizations/urls.py @@ -7,6 +7,8 @@ from seahub.views import repo, repo_history, org_seafadmin, \ urlpatterns = patterns('', url(r'^create/$', create_org, name='create_org'), (r'^change_account/$', change_account), + url(r'^messages/$', org_msg, name='org_msg'), + url(r'^(?P[^/]+)/$', org_info, name='org_info'), url(r'^(?P[^/]+)/groups/$', org_groups, name='org_groups'), diff --git a/organizations/views.py b/organizations/views.py index 62a6faf57b..4fdf4c5a7b 100644 --- a/organizations/views.py +++ b/organizations/views.py @@ -15,8 +15,10 @@ from seaserv import ccnet_threaded_rpc, get_orgs_by_user, get_org_repos, \ get_ccnetuser, remove_org_user, get_org_groups from forms import OrgCreateForm +from signals import org_user_added from settings import ORG_CACHE_PREFIX from utils import set_org_ctx +from notifications.models import UserNotification from registration.models import RegistrationProfile import seahub.settings as seahub_settings from seahub.utils import go_error, go_permission_error, validate_group_name, \ @@ -142,7 +144,7 @@ def org_useradmin(request, url_prefix): raise Http404 if request.method == 'POST': - emails = request.POST.get('emails') + emails = request.POST.get('added-member-name') email_list = emails2list(emails) for email in email_list: @@ -154,6 +156,11 @@ def org_useradmin(request, url_prefix): email = email.strip(' ') org_id = request.user.org['org_id'] add_org_user(org_id, email, 0) + + # send signal + org_user_added.send(sender=None, org_id=org_id, + from_email=request.user.username, + to_email=email) else: # User is not registered, just create account and # add that account to org @@ -211,3 +218,22 @@ def org_user_remove(request, user): remove_org_user(org_id, user) return HttpResponseRedirect(reverse('org_useradmin', args=[url_prefix])) + +def org_msg(request): + """ + Show organization user added messages + """ + orgmsg_list = [] + notes = UserNotification.objects.filter(to_user=request.user.username) + for n in notes: + if n.msg_type == 'org_msg': + orgmsg_list.append(n.detail) + + # remove new org msg notification + UserNotification.objects.filter(to_user=request.user.username, + msg_type='org_msg').delete() + print orgmsg_list + return render_to_response('organizations/new_msg.html', { + 'orgmsg_list': orgmsg_list, + }, context_instance=RequestContext(request)) + diff --git a/templates/base.html b/templates/base.html index 049c83c100..3b354dfcdf 100644 --- a/templates/base.html +++ b/templates/base.html @@ -27,7 +27,9 @@
{% if request.user.is_authenticated %} - 团体帐号 + + {% if org %} {{ org.org_name }} {% else %} 个人帐号 {% endif %} +
  • 个人帐号
  • {% for org in request.user.orgs %} diff --git a/templates/myhome.html b/templates/myhome.html index 8c96e8048a..07b75584f4 100644 --- a/templates/myhome.html +++ b/templates/myhome.html @@ -17,15 +17,13 @@ {% if grpmsg_reply_list %} {{ grpmsg_reply_list|length }}条留言有新回复 {% endif %} +{% if orgmsg_list %} +你有{{ orgmsg_list|length }}条团体消息 +{% endif %}

    已用空间

    {{ quota_usage|filesizeformat }} / 2 GB

    -{% if request.user.org %} -

    所属企业

    -

    {{ request.user.org.org_name }}

    -{% endif %} -

    我管理的小组

    {% if groups_manage %}
      @@ -159,6 +157,7 @@

      可以是非网站注册用户,我们会以邮件通知对方。

      +

      (如未收到,请检查垃圾邮件)

      输入不能为空。

      diff --git a/templates/org_admin_base.html b/templates/org_admin_base.html index 38d58938ae..f49bdbd8d1 100644 --- a/templates/org_admin_base.html +++ b/templates/org_admin_base.html @@ -4,10 +4,10 @@