diff --git a/media/css/seahub.css b/media/css/seahub.css
index 9b76581589..2426040253 100644
--- a/media/css/seahub.css
+++ b/media/css/seahub.css
@@ -1,4 +1,4 @@
-body,h1,h2,h3,h4,h5,h6,p,ul,ol,li,dl,dt,dd,blockquote,form,input,button,img { margin:0; padding:0; }
+body,h1,h2,h3,h4,h5,h6,p,ul,ol,li,dl,dt,dd,blockquote,form,input,textarea,button,img { margin:0; padding:0; }
ul > li { list-style:none; }
a { color:#ee8833; text-decoration:none; font-weight:bold; }
a:hover { color: #ff9933; text-decoration: underline; }
@@ -185,7 +185,7 @@ p.path, p.access-notice { margin: 12px 0 6px 0; }
line-height:20px;
background: #fff url('../img/li.gif') no-repeat scroll left 6px;
}
-/* profile */
+/* avatar */
.avatar-op {
width:321px;
margin:45px 0 0 300px;
@@ -199,13 +199,34 @@ p.path, p.access-notice { margin: 12px 0 6px 0; }
.avatar-op-con {
padding-left:5px;
}
-.avatar-op .avatar {
+.avatar-op .avatar,
+.home-profile .avatar {
border-radius: 10px;
-moz-border-radius: 10px;
}
.upload-new-avatar-hd {
margin-top:15px;
}
+/*user-basic-info*/
+#user-basic-info h2 {
+ margin:12px 0 15px;
+}
+#user-basic-info label {
+ width:5em;
+}
+#user-basic-info .text-input,
+#user-basic-info textarea {
+ width:260px;
+ margin-bottom:5px;
+}
+#user-basic-info textarea {
+ vertical-align:text-top;
+ height:150px;
+}
+#user-basic-info .submit {
+ margin-left:5em;
+}
+
/*narrow-panel: for form pages*/
.narrow-panel {
width:25em;
@@ -279,6 +300,13 @@ p.path, p.access-notice { margin: 12px 0 6px 0; }
background-image:none;
}
/*myhome*/
+.home-profile {
+ margin:3px 0 15px;
+}
+.home-profile .avatar {
+ float:left;
+ margin-right:20px;
+}
.mygroup {
display:inline-block;
width:70px;
diff --git a/profile/models.py b/profile/models.py
index e69de29bb2..f4e493b393 100644
--- a/profile/models.py
+++ b/profile/models.py
@@ -0,0 +1,8 @@
+from django.db import models
+from django.contrib.auth.models import User
+
+class Profile(models.Model):
+ user = models.EmailField(unique=True)
+ nickname = models.CharField(max_length=256, blank=True)
+ intro = models.TextField(max_length=256, blank=True)
+
diff --git a/profile/templates/profile/set_profile.html b/profile/templates/profile/set_profile.html
index be433eb04c..7321f61e49 100644
--- a/profile/templates/profile/set_profile.html
+++ b/profile/templates/profile/set_profile.html
@@ -1,16 +1,21 @@
{% extends "profile/profile_base.html" %}
+{% block left_panel %}
+
操作
+
+{% endblock %}
{% block right_panel %}
-绑定个人 ID
-
+
{% endblock %}
diff --git a/profile/templates/profile/user_ids.html b/profile/templates/profile/user_ids.html
index 6b6e8d849f..415d00e5ac 100644
--- a/profile/templates/profile/user_ids.html
+++ b/profile/templates/profile/user_ids.html
@@ -3,8 +3,9 @@
{% block left_panel %}
操作
{% endblock %}
diff --git a/profile/urls.py b/profile/urls.py
index bc1e6a2a06..50e1e4088d 100644
--- a/profile/urls.py
+++ b/profile/urls.py
@@ -1,6 +1,7 @@
from django.conf.urls.defaults import *
urlpatterns = patterns('profile.views',
- url(r'^$', 'list_userids', name="list_userids"),
+ url(r'^list_user/$', 'list_userids', name="list_userids"),
+ url(r'^$', 'edit_profile', name="edit_profile"),
url(r'^logout/$', 'logout_relay', name="logout_relay"),
)
diff --git a/profile/views.py b/profile/views.py
index 6c2925bac1..ba35d2d143 100644
--- a/profile/views.py
+++ b/profile/views.py
@@ -8,6 +8,7 @@ from seaserv import ccnet_rpc, get_binding_peerids
from pysearpc import SearpcError
from utils import go_error
+from models import Profile
@login_required
def list_userids(request):
@@ -30,3 +31,30 @@ def logout_relay(request):
return go_error(request, e.msg)
return HttpResponseRedirect(reverse('list_userids'))
+
+def edit_profile(request):
+ profile = Profile.objects.filter(user=request.user.username)
+ if not profile:
+ Profile.objects.create(user=request.user.username, nickname='', intro='')
+
+ profile = Profile.objects.filter(user=request.user.username)[0]
+ if request.method == 'GET':
+ pass
+
+ if request.method == 'POST':
+ new_nickname = request.POST.get('nickname', '')
+ new_intro = request.POST.get('intro', '')
+
+ if new_nickname != profile.nickname:
+ profile.nickname = new_nickname
+ profile.save()
+
+ if new_intro != profile.intro:
+ profile.intro = new_intro
+ profile.save()
+
+ return render_to_response('profile/set_profile.html', {
+ 'nickname':profile.nickname,
+ 'intro':profile.intro,
+ },
+ context_instance=RequestContext(request))
diff --git a/templates/myhome.html b/templates/myhome.html
index 53413f51e2..381a83fda9 100644
--- a/templates/myhome.html
+++ b/templates/myhome.html
@@ -4,14 +4,20 @@
{% block nav_myhome_class %}class="cur"{% endblock %}
{% block left_panel %}
+我的基本信息
+
+{% avatar myname 80 %}
+
昵称:{{ nickname }}
+
+
+已用空间
+{{ quota_usage|filesizeformat }} / 2 GB
+
{% if request.user.org %}
所属企业
{{ request.user.org.org_name }}
{% endif %}
-已用空间
-{{ quota_usage|filesizeformat }} / 2 GB
-
我管理的小组
{% if groups_manage %}
diff --git a/views.py b/views.py
index f3447a889e..bf3d7e979a 100644
--- a/views.py
+++ b/views.py
@@ -29,6 +29,7 @@ from seahub.contacts.models import Contact
from forms import AddUserForm
from utils import go_permission_error, go_error, list_to_string, \
get_httpserver_root, get_ccnetapplet_root, gen_token
+from seahub.profile.models import Profile
@login_required
def root(request):
@@ -552,8 +553,19 @@ def myhome(request):
groups_manage.append(group)
else:
groups_join.append(group)
+
+ #get nickname
+ if not Profile.objects.filter(user=request.user.username):
+ nickname = '暂无'
+ else:
+ profile = Profile.objects.filter(user=request.user.username)[0]
+ nickname = profile.nickname
+ if not nickname:
+ nickname = '暂无'
return render_to_response('myhome.html', {
+ "myname": email,
+ "nickname": nickname,
"owned_repos": owned_repos,
"quota_usage": quota_usage,
"in_repos": in_repos,