修改了身份

增加了职称、学号
This commit is contained in:
baiyu 2013-09-23 09:41:36 +08:00
parent a7b500f5e7
commit 6ce27271e3
11 changed files with 299 additions and 53 deletions

View File

@ -148,7 +148,11 @@ class AccountController < ApplicationController
#added by bai
unless @user.id.nil?
UserExtensions.create(:identity => params[:identity].to_i,:gender => params[:gender].to_i,:location => params[:province]+params[:city], :user_id => @user.id)
ue = UserExtensions.create(:identity => params[:identity].to_i,:technical_title => params[:technical_title], :gender => params[:gender].to_i, :user_id => @user.id, :student_id => params[:no])
unless params[:province].nil? || params[:city].nil?
ue.location = params[:province]+params[:city]
ue.save
end
end
#end

View File

@ -83,14 +83,34 @@ class MyController < ApplicationController
se.user_id = @user.id
se.occupation = params[:occupation]
se.gender = params[:gender]
se.location = params[:province]+params[:city]
if params[:province] && params[:city]
se.location = params[:province]+params[:city]
end
if params[:identity]
se.identity = params[:identity].to_i
end
if params[:technical_title]
se.technical_title = params[:technical_title]
end
if params[:no]
se.student_id = params[:no]
end
se.save
else
se = @user.user_extensions
se.occupation = params[:occupation]
se.gender = params[:gender]
if params[:province] && params[:city]
se.location = params[:province]+params[:city]
se.location = params[:province]+params[:city]
end
if params[:identity]
se.identity= params[:identity].to_i
end
if params[:technical_title]
se.technical_title = params[:technical_title]
end
if params[:no]
se.student_id = params[:no]
end
se.save
end

View File

@ -1,6 +1,6 @@
class UserExtensions < ActiveRecord::Base
belongs_to :user
attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity
attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity, :technical_title,:student_id
#this method was used to update the table user_extensions
def update_user_extensions(birthday=nil,brief_introduction=nil,
gender=nil,location=nil,occupation=nil,work_experience=nil,zip_code=nil)

View File

@ -187,6 +187,48 @@
}
</script>
<!-- added by bai 增加职称-->
<script type="text/javascript" language="javascript">
function showtechnical_title(identity, technical_titleField) {
switch (identity) {
case '0' :
$('#technical_title').show()
$('#no').hide()
var technical_titleOptions = new Array(
"教授","副教授","讲师","助教");
break;
case '1' :
$('#technical_title').hide()
$('#no').show()
var titleOptions = new Array("");
break;
default:
$('#technical_title').hide()
$('#no').hide()
var titleOptions = new Array("");
break;
}
technical_titleField.options.length = 0;
for(var i = 0; i < technical_titleOptions.length; i++) {
technical_titleField.options[i]=new Option(technical_titleOptions[i],technical_titleOptions[i]);
/*
if (cityField.options[i].value==city)
{
//alert("here put City ok!");
document.oblogform["city"].selectedIndex = i;
}*/
}
}
</script>
<!-- end -->
<h3><%=l(:label_register)%> <%=link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %></h3>
@ -211,14 +253,29 @@
<em class="info"><%="#{l(:label_mail_attention)} "%></em></p>
<p><%= f.select :language, lang_options_for_select %></p>
<!-- added by bai 增加了身份、性别和地区-->
<!-- added by bai 增加了身份、性别、地区和教师的职称-->
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_identity) %><span class="required"> *</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'identity', "<option value = '0'>#{l(:label_teacher)}</option>
<option value = '1'>#{l(:label_student)}</option>
<option value = '2'>#{l(:label_other)}</option>".html_safe %></td></tr></table></p>
<select onchange="showtechnical_title(this.value, document.getElementById(&#39;userTechnical_title&#39;));" name="identity" id="userProvince">
<option value="">--请选择身份--</option>
<option value="0">教师</option>
<option value="1">学生</option>
<option value="2">企业</option>
<option value="3">开发者</option>
</select></td>
<td class="info" style="width: 100px">
<span id = 'technical_title' style = 'display:none'>
<select name="technical_title" id="userTechnical_title"></select></span>
<span id = 'no' style = 'display:none'>
<input name="no" id="no" placeholder="请输入学号"></select></span>
</td></tr></table></p>
<!-- end -->
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_gender) %></strong></td>
@ -226,7 +283,7 @@
<%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option>
<option value = '1'>#{l(:label_gender_female)}</option>".html_safe %></td></tr></table></p>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_location) %><span class="required"> *</span></strong></td>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_location) %></strong></td>
<td class="info" style="width: 80px">
<select onchange="showcity(this.value, document.getElementById(&#39;userCity&#39;));" name="province" id="userProvince">
<option value="">--请选择省份--</option>
@ -271,9 +328,11 @@
<!-- end -->
</div>
<p><table><tr><td><%= submit_tag l(:button_submit) %></td></tr></table></p>
<% end %>
<% if Setting.openid? %>
<p><%= f.text_field :identity_url %></p>
<% end %>

View File

@ -105,7 +105,7 @@
<td valign="top" style="padding-left: 8px;"><%= l(:label_user_mail) %></td><td class="font_lighter_sidebar" style="padding-left: 0px; word-wrap: break-word; word-break: break-all"><%= mail_to(h(@user.mail), nil, :encode => 'javascript') %></td>
</tr>
<!-- added by bai 在个人主页里显示“工作单位”“地区”-->
<!-- added by bai 在个人主页里显示“工作单位”“地区”"教师的职称"-->
@ -116,6 +116,12 @@
<tr>
<td style="padding-left: 8px" width="70px"><%= l(:label_location) %></td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.location %></td>
</tr>
<tr>
<td style="padding-left: 8px" width="70px">
<% if @user.user_extensions.identity == 0 %>
<%= l(:label_technical_title) %></td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.technical_title %></td>
<% end %>
</tr>
<% else%>
<tr>
<td style="padding-left: 8px" width="70px"><%= l(:field_occupation) %></td>

View File

@ -325,6 +325,76 @@ $().ready(funtion(){
</select>
<select name="city" id="userCity" class="location"></select></p>
<!-- end -->
<!-- added by bai 增加职称-->
<script type="text/javascript" language="javascript">
function showtechnical_title(identity, technical_titleField) {
switch (identity) {
case '0' :
$('#technical_title').show()
$('#no').hide()
var technical_titleOptions = new Array(
"教授","副教授","讲师","助教");
break;
case '1' :
$('#technical_title').hide()
$('#no').show()
var titleOptions = new Array("");
break;
default:
$('#technical_title').hide()
$('#no').hide()
var titleOptions = new Array("");
break;
}
technical_titleField.options.length = 0;
for(var i = 0; i < technical_titleOptions.length; i++) {
technical_titleField.options[i]=new Option(technical_titleOptions[i],technical_titleOptions[i]);
/*
if (cityField.options[i].value==city)
{
//alert("here put City ok!");
document.oblogform["city"].selectedIndex = i;
}*/
}
}
</script>
<!-- end -->
<p style="width:400px;padding-left: 26px;"><%= l(:label_identity) %>
<td class="info" style="width: 10px">
<select onchange="showtechnical_title(this.value, document.getElementById(&#39;userTechnical_title&#39;));" name="identity" id="userIdentity" class="location">
<option value="">--请选择身份--</option>
<option value="0">教师</option>
<option value="1">学生</option>
<option value="2">企业</option>
<option value="3">开发者</option>
</select></td>
<span id = 'technical_title' style = 'display:none'>
<select name="technical_title" id="userTechnical_title"></select></span>
<span id = 'no' style = 'display:none'>
<input name="no" id="no" placeholder="请输入学号"></span>
</td></tr></table></p>
<!-- end -->
</div>
<% if Setting.openid? %>
<p>

View File

@ -5,22 +5,22 @@
production:
adapter: mysql2
database: bitnami_redmine
host: 192
socket: /home/pdl/redmine-2.3.1-2/mysql/tmp/mysql.sock
database: redmine
host: 10.0.47.245
#socket: /home/pdl/redmine-2.3.1-2/mysql/tmp/mysql.sock
port: 3306
username: root
password: "1234"
password: "bitnami"
encoding: utf8
development:
adapter: mysql2
database: redmine
host: 10.0.47.98
database: bitnami_redmine
host: 10.0.47.245
#socket: /home/pdl/redmine-2.3.1-2/mysql/tmp/mysql.sock
port: 3306
username: root
password: "1234"
password: "bitnami"
encoding: utf8
# Warning: The database defined as "test" will be erased and

View File

@ -1416,7 +1416,8 @@ en:
label_identity: Identity
label_teacher: Teacher
label_student: Student
label_other: Other
label_enterprise: Enterprise
label_developer: Developer
label_gender: Gender
label_gender_male: male
label_gender_female: female

View File

@ -1356,7 +1356,6 @@ zh:
field_birthday: 生日
field_brief_introduction: 个人简介
field_location: 现住址
field_occupation: 工作单位
field_work_experience: 工作经验(年)
field_zip_code: 邮编
label_reward: 奖励:
@ -1425,11 +1424,15 @@ zh:
label_identity: 身份
label_teacher: 教师
label_student: 学生
label_other: 其他
label_enterprise: 企业
label_developer: 开发者
label_technical_title: "职称:"
label_gender: 性别
label_gender_male:
label_gender_female:
label_location: 地区
label_location: "地区:"
field_occupation: "工作单位:"
notice_lost_location: 请选择地区信息
label_brief_introduction: 修改我的状态
label_my_brief_introduction: 今天的心情如何?留下你的脚印吧~
#end

View File

@ -11,7 +11,15 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130828080407) do
ActiveRecord::Schema.define(:version => 20130922123849) do
create_table "a_user_watchers", :force => true do |t|
t.string "name"
t.text "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "member_id"
end
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -69,18 +77,20 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
t.string "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "reward"
end
create_table "bids", :force => true do |t|
t.string "name"
t.string "budget", :null => false
t.string "budget", :null => false
t.integer "author_id"
t.date "deadline"
t.string "description"
t.datetime "created_on", :null => false
t.datetime "updated_on", :null => false
t.datetime "created_on", :null => false
t.datetime "updated_on", :null => false
t.integer "commit"
t.integer "reward_type"
t.integer "homework_type"
end
create_table "boards", :force => true do |t|
@ -153,6 +163,20 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
add_index "comments", ["author_id"], :name => "index_comments_on_author_id"
add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type"
create_table "courses", :force => true do |t|
t.integer "tea_id"
t.string "name"
t.integer "state"
t.string "code"
t.integer "time"
t.string "extra"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "location"
t.string "term"
t.string "string"
end
create_table "custom_fields", :force => true do |t|
t.string "type", :limit => 30, :default => "", :null => false
t.string "name", :limit => 30, :default => "", :null => false
@ -238,6 +262,18 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true
create_table "homework_attaches", :force => true do |t|
t.integer "bid_id"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "homework_for_courses", :force => true do |t|
t.integer "project_id"
t.integer "bid_id"
end
create_table "issue_categories", :force => true do |t|
t.integer "project_id", :default => 0, :null => false
t.string "name", :limit => 30, :default => "", :null => false
@ -248,9 +284,9 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id"
create_table "issue_relations", :force => true do |t|
t.integer "issue_from_id", :null => false
t.integer "issue_to_id", :null => false
t.string "relation_type", :default => "", :null => false
t.integer "issue_from_id", :null => false
t.integer "issue_to_id", :null => false
t.string "relation_type", :null => false
t.integer "delay"
end
@ -392,6 +428,22 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
add_index "messages", ["parent_id"], :name => "messages_parent_id"
create_table "messages_for_bids", :force => true do |t|
t.string "message"
t.integer "user_id"
t.integer "bid_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "messages_for_users", :force => true do |t|
t.integer "messager_id"
t.integer "user_id"
t.string "message"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "news", :force => true do |t|
t.integer "project_id"
t.string "title", :limit => 60, :default => "", :null => false
@ -452,6 +504,18 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
t.integer "project_id"
end
add_index "project_statuses", ["changesets_count"], :name => "index_project_statuses_on_changesets_count"
add_index "project_statuses", ["watchers_count"], :name => "index_project_statuses_on_watchers_count"
create_table "project_tags", :force => true do |t|
t.integer "project_id"
t.integer "tag_id"
t.string "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "user_id"
end
create_table "projects", :force => true do |t|
t.string "name", :default => "", :null => false
t.text "description"
@ -465,6 +529,7 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
t.integer "lft"
t.integer "rgt"
t.boolean "inherit_members", :default => false, :null => false
t.integer "project_type"
end
add_index "projects", ["lft"], :name => "index_projects_on_lft"
@ -518,26 +583,6 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
t.string "issues_visibility", :limit => 30, :default => "default", :null => false
end
create_table "seems_rateable_cached_ratings", :force => true do |t|
t.integer "cacheable_id", :limit => 8
t.string "cacheable_type"
t.float "avg", :null => false
t.integer "cnt", :null => false
t.string "dimension"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "seems_rateable_rates", :force => true do |t|
t.integer "rater_id", :limit => 8
t.integer "rateable_id"
t.string "rateable_type"
t.float "stars", :null => false
t.string "dimension"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "settings", :force => true do |t|
t.string "name", :default => "", :null => false
t.text "value"
@ -548,13 +593,27 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
create_table "shares", :force => true do |t|
t.date "created_on"
t.string "url"
t.string "title"
t.integer "share_type"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "share_type"
t.string "url"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "project_id"
t.integer "user_id"
t.string "description"
end
create_table "students", :force => true do |t|
t.string "name"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "students_for_courses", :force => true do |t|
t.integer "student_id"
t.integer "course_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "taggings", :force => true do |t|
@ -574,6 +633,16 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
t.string "name"
end
create_table "teachers", :force => true do |t|
t.string "tea_name"
t.string "location"
t.integer "couurse_time"
t.integer "course_code"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "extra"
end
create_table "time_entries", :force => true do |t|
t.integer "project_id", :null => false
t.integer "user_id", :null => false
@ -598,7 +667,7 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
create_table "tokens", :force => true do |t|
t.integer "user_id", :default => 0, :null => false
t.string "action", :limit => 30, :default => "", :null => false
t.string "value", :limit => 40, :default => "", :null => false
t.string "value", :limit => 40
t.datetime "created_on", :null => false
end
@ -624,6 +693,11 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
t.integer "zip_code"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "identity"
t.string "technical_title"
t.integer "student_id"
t.string "teacher_realname"
t.string "student_realname"
end
create_table "user_preferences", :force => true do |t|
@ -646,6 +720,14 @@ ActiveRecord::Schema.define(:version => 20130828080407) do
add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count"
add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count"
create_table "user_tags", :force => true do |t|
t.integer "user_id"
t.integer "tag_id"
t.string "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "users", :force => true do |t|
t.string "login", :default => "", :null => false
t.string "hashed_password", :limit => 40, :default => "", :null => false

View File

@ -1194,6 +1194,7 @@ textarea#custom_field_default_value {width: 99%}
input#content_comments {width: 99%}
p.pagination {margin-top:8px; font-size: 90%}
/***** Tabular forms ******/