acoount.html对齐了一下
学校列表school/index.html默认显示全部学校
没有填写工作单位的用户强行跳转到修改资料页面
This commit is contained in:
yanxd 2014-05-09 17:08:42 +08:00
parent 845186a600
commit 4d8701220b
8 changed files with 578 additions and 606 deletions

View File

@ -111,8 +111,7 @@ class AccountController < ApplicationController
user_params = params[:user] || {} user_params = params[:user] || {}
@user = User.new @user = User.new
@user.safe_attributes = user_params @user.safe_attributes = user_params
#这里判断 if params[:identity] == "2" # 2 企业
if params[:identity] == "2"
@user.firstname = params[:enterprise_name] @user.firstname = params[:enterprise_name]
@user.lastname = l(:field_enterprise) @user.lastname = l(:field_enterprise)
end end
@ -132,16 +131,6 @@ class AccountController < ApplicationController
@user.login = params[:user][:login] @user.login = params[:user][:login]
unless user_params[:identity_url].present? && user_params[:password].blank? && user_params[:password_confirmation].blank? unless user_params[:identity_url].present? && user_params[:password].blank? && user_params[:password_confirmation].blank?
@user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation] @user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation]
# system "htpasswd -mb "+@root_path+"user.passwd "+params[:user][:login]+" "+user_params[:password]
# system "echo -e '\n"+params[:user][:login]+"-write:"+
# " "+params[:user][:login]+"' >> "+@root_path+"group.passwd"
# system "mkdir "+@root_path+"htdocs/"+params[:user][:login]
#
# system "echo -e 'Allow from all \n Order Deny,Allow \n "+
# "<Limit PUT POST DELETE PROPPATCH MKCOL COPY MOVE LOCK UNLOCK> \n"+
# "Require group "+params[:user][:login]+"-write \n "+
# "</Limit> \n ' >>"+
# @root_path+"htdocs/"+params[:user][:login]+"/.htaccess"
end end
case Setting.self_registration case Setting.self_registration

View File

@ -41,8 +41,21 @@ class SchoolController < ApplicationController
@provinces.each do |p| @provinces.each do |p|
options << "<option value = '#{p.province}' >#{p.province}</option>" options << "<option value = '#{p.province}' >#{p.province}</option>"
end end
@school = School.all
options_s = ""
@school.each do |s|
#options << "<option value=#{s.id}>#{s.name}</option>"
options_s << "<li style = 'width: 33%; float: left'><a id=#{s.id} onclick='test(this.id, this.text)'>#{s.name}</a></li>"
end
res = Hash.new
res[:text] = options
res[:text_s] = options_s
render :json => res
render :text => options
end end
@ -74,8 +87,11 @@ class SchoolController < ApplicationController
end end
def search_school def search_school
if params[:province].nil? or params[:province] == "0"
@school = School.where("name LIKE '%"+params[:key_word]+"%'");
else
@school = School.where("province = ? AND name LIKE '%"+params[:key_word]+"%'", params[:province]); @school = School.where("province = ? AND name LIKE '%"+params[:key_word]+"%'", params[:province]);
end
options = "" options = ""
@school.each do |s| @school.each do |s|
options << "<li style = 'width: 33%; float: left'><a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>" options << "<li style = 'width: 33%; float: left'><a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>"

View File

@ -38,6 +38,7 @@ class UsersController < ApplicationController
:user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
:watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:activity_score_index, :influence_score_index, :score_index] :activity_score_index, :influence_score_index, :score_index]
before_filter :auth_user_extension, only: :show
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save accept_api_auth :index, :show, :create, :update, :destroy,:tag_save
#william #william
@ -735,4 +736,11 @@ class UsersController < ApplicationController
def setting_layout(default_base='base_users') def setting_layout(default_base='base_users')
User.current.admin? ? 'base_admin' : default_base User.current.admin? ? 'base_admin' : default_base
end end
def auth_user_extension
if @user.user_extensions.school.nil?
flash[:error] = l(:error_complete_occupation)
redirect_to my_account_path
end
end
end end

View File

@ -1,8 +1,6 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready( $(document).ready(
function(){ function () {
$("#province").attr("href", "#WOpenWindow") $("#province").attr("href", "#WOpenWindow")
$("#province").leanModal({top: 100, closeButton: ".modal_close"}); $("#province").leanModal({top: 100, closeButton: ".modal_close"});
} }
@ -11,133 +9,116 @@
<script type="text/javascript"> <script type="text/javascript">
function get_options(value){ function get_options(value) {
$.ajax({ $.ajax({
type :"POST", type: "POST",
url :'/school/get_options/'+encodeURIComponent(value), url: '/school/get_options/' + encodeURIComponent(value),
data :'text', data: 'text',
success: function(data){ success: function (data) {
$("#province").val(value)
$("#schoollist").html(data); $("#schoollist").html(data);
} }
});
} }
</script>
)
}
</script> <div class="contextual" style="padding-right: 10px;">
<div class="contextual" style="padding-right: 10px;">
<%= link_to(l(:button_change_password), {:action => 'password'}, :class => 'icon icon-passwd') if @user.change_password_allowed? %> <%= link_to(l(:button_change_password), {:action => 'password'}, :class => 'icon icon-passwd') if @user.change_password_allowed? %>
<%= call_hook(:view_my_account_contextual, :user => @user)%> <%= call_hook(:view_my_account_contextual, :user => @user) %>
</div> </div>
<h3 style="padding-left: 10px;"><%= l(:label_my_account)%></h3> <h3 style="padding-left: 10px;"><%= l(:label_my_account) %></h3>
<fieldset class="box" style="margin:10px;"> <fieldset class="box" style="margin:10px;">
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;"> <fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
<legend onclick="toggleFieldset(this);"> <legend onclick="toggleFieldset(this);">
<%= l(:label_my_photo)%> <%= l(:label_my_photo) %>
</legend> </legend>
<div> <div>
<!--upload profiles--> <!--upload profiles-->
<%= render :partial=> "avatar/avatar_form", :locals=>{source:@user} %> <%= render :partial => "avatar/avatar_form", :locals => {source: @user} %>
<!--upload--> <!--upload-->
</div> </div>
</fieldset> </fieldset>
<%= labelled_form_for :user, @user, <%= labelled_form_for :user, @user,
:url => { :action => "account" }, :url => {:action => "account"},
:html => { :id => 'my_account_form', :html => {:id => 'my_account_form',
:method => :post } do |f| %> :method => :post} do |f| %>
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;"> <fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
<legend onclick="toggleFieldset(this);"> <legend onclick="toggleFieldset(this);">
<%= l(:label_information_plural)%> <%= l(:label_information_plural) %>
</legend> </legend>
<div> <div>
<span id = 'name' style = 'display:none'> <span id='name' style='display:none'>
<p style="width:530px;padding-left: 26px;"> <p style="width:530px;padding-left: 26px;">
<%= f.text_field :lastname, :required => true %> <%= f.text_field :lastname, :required => true %>
<span class='font_lighter'><%=l(:field_lastname_eg)%></span> <span class='font_lighter'><%= l(:field_lastname_eg) %></span>
</p> </p>
<p style="width:530px;padding-left: 26px;"> <p style="width:530px;padding-left: 26px;">
<%= f.text_field :firstname, :required => true %> <%= f.text_field :firstname, :required => true %>
<span class='font_lighter'><%=l(:field_firstname_eg)%></span> <span class='font_lighter'><%= l(:field_firstname_eg) %></span>
</p> </p>
</span> </span>
<span id = 'enterprise' style = 'display:none'> <span id='enterprise' style='display:none'>
<p style="width:400px;padding-left: 26px;">企业名<%= text_field_tag :enterprise_name, @user.firstname %> <p style="width:400px;padding-left: 26px;">企业名<%= text_field_tag :enterprise_name, @user.firstname %>
</p> </p>
</span> </span>
<!-- added by bai 增加账户里的性别--> <!-- added by bai 增加账户里的性别-->
<span id = 'gender' style = 'display:none'> <span id='gender' style='display:none'>
<% unless @user.user_extensions.nil? %> <% if @user.user_extensions.nil? %>
<% if @user.user_extensions.gender == 0 %>
<p style="width:400px;padding-left: 26px;"> <p style="width:400px;padding-left: 26px;">
<%= l(:label_gender) %>&nbsp;&nbsp;<%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option><option value = '1'>#{l(:label_gender_female)}</option>".html_safe ,:class =>'gender' %> <%= l(:label_gender) %>&nbsp;&nbsp;
<%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option><option value = '1'>#{l(:label_gender_female)}</option>".html_safe, :class => 'gender' %>
</p>
<% else %>
<% if @user.user_extensions.gender == 0 %><!-- label_gender_male -->
<p style="width:400px;padding-left: 26px;">
<%= l(:label_gender) %>&nbsp;&nbsp;
<%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option><option value = '1'>#{l(:label_gender_female)}</option>".html_safe, :class => 'gender' %>
</p> </p>
<% else %> <% else %>
<p style="width:400px;padding-left: 26px;"> <p style="width:400px;padding-left: 26px;">
<%= l(:label_gender) %>&nbsp;&nbsp;<%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option><option value = '1' selected='selected'>#{l(:label_gender_female)}</option>".html_safe ,:class =>'gender' %> <%= l(:label_gender) %>&nbsp;&nbsp;
</p> <%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option><option value = '1' selected='selected'>#{l(:label_gender_female)}</option>".html_safe, :class => 'gender' %>
<% end %>
<% else %>
<p style="width:400px;padding-left: 26px;"><%= l(:label_gender) %>&nbsp;&nbsp;<%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option><option value = '1'>#{l(:label_gender_female)}</option>".html_safe ,:class =>'gender' %></p>
</p> </p>
<% end %> <% end %>
<% end %>
<!-- added by bai 单位--> </span>
<!--<% unless @user.user_extensions.nil?%>
<p style="width:400px;padding-left: 26px;"><%= l(:field_occupation)%>&nbsp;<span class="required">*</span><%= text_field_tag "occupation", @user.user_extensions.occupation, :class => 'occupation' %>
</p>
<%else%>
<p style="width:400px;padding-left: 26px;"><%= l(:field_occupation)%><span class="required">*</span><%= text_field_tag "occupation", nil, :class => 'occupation' %>
</p>
<%end%>
-->
<!-- added by Wen --> <!-- added by Wen -->
<p style="padding-left: 26px;"> <p style="padding-left: 26px;">
<% unless User.current.user_extensions.school.nil? %> <% if User.current.user_extensions.school.nil? %>
<%= l(:field_occupation) %>&nbsp;<span class="required">*</span> <%= l(:field_occupation) %>&nbsp;<span class="required">*</span>
<input id="province" name="province" type="text" value="请单击选择省份及学校" readonly>
<input id="province" name="province" type="text" value="<%=User.current.user_extensions.school.province%>" readonly /> <input id="occupation" name="occupation" type="hidden"/>
<input id="occupation" name="occupation" type="hidden" value="<%=User.current.user_extensions.school.id%>" /> <input id="occupation_name" type="text" readonly/>
<input id="occupation_name" type="text" value="<%=User.current.user_extensions.school.name%>" readonly />
<% else %> <% else %>
<%= l(:field_occupation) %>&nbsp;<span class="required">*</span> <%= l(:field_occupation) %>&nbsp;<span class="required">*</span>
<input id="province" name="province" type="text" value="请单击选择省份及学校" readonly > <input id="province" name="province" type="text" value="<%= User.current.user_extensions.school.province %>" readonly/>
<input id="occupation" name="occupation" type="hidden" /> <input id="occupation" name="occupation" type="hidden" value="<%= User.current.user_extensions.school.id %>"/>
<input id="occupation_name" type="text" readonly /> <input id="occupation_name" type="text" value="<%= User.current.user_extensions.school.name %>" readonly/>
<% end %> <% end %>
<!-- <input id="occupation" readonly />-->
</p> </p>
<div id="WOpenWindow"> <div id="WOpenWindow">
<a class="modal_close" href="#"></a> <a class="modal_close" href="#"></a>
<h2>学校列表</h2> <h2>学校列表</h2>
<div class="pcontent"> <div class="pcontent">
<ul id="provincelist" class="school_list"> <ul id="provincelist" class="school_list">
<% @ss = School.find_by_sql("select distinct province from schools") %> <% @ss = School.find_by_sql("select distinct province from schools") %>
<% @ss.each do |s| %> <% @ss.each do |s| %>
<li style="width: 15%; float: left;"> <li style="width: 15%; float: left;">
<a style="cursor: pointer;" onclick = "get_options('<%= s.province %>')"><%= s.province %> <a style="cursor: pointer;" onclick="get_options('<%= s.province %>')"><%= s.province %>
</a> </a>
</li> </li>
<% end %> <% end %>
@ -149,272 +130,51 @@
</ul> </ul>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
function test(id, name){ function test(id, name) {
//$("#occupation").html("<option value='"+id+"'>"+name+"</option>"); //$("#occupation").html("<option value='"+id+"'>"+name+"</option>");
$("#occupation").val(id); $("#occupation").val(id);
$("#occupation_name").val(name); $("#occupation_name").val(name);
$("#lean_overlay").hide(); $("#lean_overlay").hide();
$("#WOpenWindow").hide(); $("#WOpenWindow").hide();
} }
</script> </script>
<!-- added by bai 增加了地区 --> <!-- added by bai 增加了地区 -->
</span>
<!-- end --> <!-- end -->
<p style="width:357px;padding-left: 26px;"> <p style="width:357px;padding-left: 26px;">
<%= f.text_field :mail, :required => true %> <%= f.text_field :mail, :required => true %>
</p> </p>
<p style="width:426px;padding-left:26px;"> <p style="width:426px;padding-left:26px;">
<%= f.select :language, :Chinese简体中文 => :zh, :English => :en%> <%= f.select :language, :Chinese => :zh, :English => :en %>
</p> </p>
<script type="text/javascript" language="javascript"> <% province = User.current.user_extensions.location %>
function showcity(province, cityField) { <% city = User.current.user_extensions.location_city %>
switch (province) { <% identity = User.current.user_extensions.identity %>
case "北京" : <% title = User.current.user_extensions.technical_title %>
var cityOptions = new Array( <script type="text/javascript" language="javascript">
"东城","西城","朝阳","丰台","石景山","海淀","门头沟", $().ready(function () {
"房山","通州","顺义","昌平","大兴","平谷","怀柔","密云","延庆");
break;
case "上海" :
var cityOptions = new Array(
"崇明","黄浦","卢湾","徐汇","长宁","静安","普陀","闸北","虹口","杨浦","闵行",
"宝山","嘉定","浦东","金山","松江","青浦","南汇","奉贤");
break;
case "广东" :
var cityOptions = new Array(
"广州","深圳","珠海","东莞","中山","佛山","惠州","河源","潮州","江门","揭阳","茂名",
"梅州","清远","汕头","汕尾","韶关","顺德","阳江","云浮","湛江","肇庆");
break;
case "江苏" :
var cityOptions = new Array(
"南京","常熟","常州","海门","淮安","江都","江阴","昆山","连云港","南通",
"启东","沭阳","宿迁","苏州","太仓","泰州","同里","无锡","徐州","盐城",
"扬州","宜兴","仪征","张家港","镇江","周庄");
break;
case "重庆" :
var cityOptions = new Array(
"万州","涪陵","渝中","大渡口","江北","沙坪坝","九龙坡","南岸","北碚","万盛",
"双挢","渝北","巴南","黔江","长寿","綦江","潼南","铜梁","大足","荣昌","壁山",
"梁平","城口","丰都","垫江","武隆","忠县","开县","云阳","奉节","巫山","巫溪",
"石柱","秀山","酉阳","彭水","江津","合川","永川","南川");
break;
case "安徽" :
var cityOptions = new Array(
"合肥","安庆","蚌埠","亳州","巢湖","滁州","阜阳","贵池","淮北","淮化","淮南",
"黄山","九华山","六安","马鞍山","宿州","铜陵","屯溪","芜湖","宣城");
break;
case "福建" :
var cityOptions = new Array(
"福州","厦门","泉州","漳州","龙岩","南平","宁德","莆田","三明");
break;
case "甘肃" :
var cityOptions = new Array(
"兰州","白银","定西","敦煌","甘南","金昌","酒泉","临夏","平凉","天水",
"武都","武威","西峰","张掖");
break;
case "广西" :
var cityOptions = new Array(
"南宁","百色","北海","桂林","防城港","贵港","河池","贺州","柳州","钦州","梧州","玉林");
break;
case "贵州" :
var cityOptions = new Array(
"贵阳","安顺","毕节","都匀","凯里","六盘水","铜仁","兴义","玉屏","遵义");
break;
case "海南" :
var cityOptions = new Array(
"海口","儋县","陵水","琼海","三亚","通什","万宁");
break;
case "河北" :
var cityOptions = new Array(
"石家庄","保定","北戴河","沧州","承德","丰润","邯郸","衡水","廊坊","南戴河","秦皇岛",
"唐山","新城","邢台","张家口");
break;
case "黑龙江" :
var cityOptions = new Array(
"哈尔滨","北安","大庆","大兴安岭","鹤岗","黑河","佳木斯","鸡西","牡丹江","齐齐哈尔",
"七台河","双鸭山","绥化","伊春");
break;
case "河南" :
var cityOptions = new Array(
"郑州","安阳","鹤壁","潢川","焦作","济源","开封","漯河","洛阳","南阳","平顶山",
"濮阳","三门峡","商丘","新乡","信阳","许昌","周口","驻马店");
break;
case "香港" :
var cityOptions = new Array(
"香港","九龙","新界");
break;
case "湖北" :
var cityOptions = new Array(
"武汉","恩施","鄂州","黄冈","黄石","荆门","荆州","潜江","十堰","随州","武穴",
"仙桃","咸宁","襄阳","襄樊","孝感","宜昌");
break;
case "湖南" :
var cityOptions = new Array(
"长沙","常德","郴州","衡阳","怀化","吉首","娄底","邵阳","湘潭","益阳","岳阳",
"永州","张家界","株洲");
break;
case "江西" :
var cityOptions = new Array(
"南昌","抚州","赣州","吉安","景德镇","井冈山","九江","庐山","萍乡",
"上饶","新余","宜春","鹰潭");
break;
case "吉林" :
var cityOptions = new Array(
"长春","吉林","白城","白山","珲春","辽源","梅河","四平","松原","通化","延吉");
break;
case "辽宁" :
var cityOptions = new Array(
"沈阳","鞍山","本溪","朝阳","大连","丹东","抚顺","阜新","葫芦岛","锦州",
"辽阳","盘锦","铁岭","营口");
break;
case "澳门" :
var cityOptions = new Array("澳门");
break;
case "内蒙古" :
var cityOptions = new Array(
"呼和浩特","阿拉善盟","包头","赤峰","东胜","海拉尔","集宁","临河","通辽","乌海",
"乌兰浩特","锡林浩特");
break;
case "宁夏" :
var cityOptions = new Array(
"银川","固源","石嘴山","吴忠");
break;
case "青海" :
var cityOptions = new Array(
"西宁","德令哈","格尔木","共和","海东","海晏","玛沁","同仁","玉树");
break;
case "山东" :
var cityOptions = new Array(
"济南","滨州","兖州","德州","东营","菏泽","济宁","莱芜","聊城","临沂",
"蓬莱","青岛","曲阜","日照","泰安","潍坊","威海","烟台","枣庄","淄博");
break;
case "山西" :
var cityOptions = new Array(
"太原","长治","大同","候马","晋城","离石","临汾","宁武","朔州","忻州",
"阳泉","榆次","运城");
break;
case "陕西" :
var cityOptions = new Array(
"西安","安康","宝鸡","汉中","渭南","商州","绥德","铜川","咸阳","延安","榆林");
break;
case "四川" :
var cityOptions = new Array(
"成都","巴中","达川","德阳","都江堰","峨眉山","涪陵","广安","广元","九寨沟",
"康定","乐山","泸州","马尔康","绵阳","眉山","南充","内江","攀枝花","遂宁",
"汶川","西昌","雅安","宜宾","自贡","资阳");
break;
case "台湾" :
var cityOptions = new Array(
"台北","基隆","台南","台中","高雄","屏东","南投","云林","新竹","彰化","苗栗",
"嘉义","花莲","桃园","宜兰","台东","金门","马祖","澎湖");
break;
case "天津" :
var cityOptions = new Array(
"天津","和平","东丽","河东","西青","河西","津南","南开","北辰","河北","武清","红挢",
"塘沽","汉沽","大港","宁河","静海","宝坻","蓟县");
break;
case "新疆" :
var cityOptions = new Array(
"乌鲁木齐","阿克苏","阿勒泰","阿图什","博乐","昌吉","东山","哈密","和田","喀什",
"克拉玛依","库车","库尔勒","奎屯","石河子","塔城","吐鲁番","伊宁");
break;
case "西藏" :
var cityOptions = new Array(
"拉萨","阿里","昌都","林芝","那曲","日喀则","山南");
break;
case "云南" :
var cityOptions = new Array(
"昆明","大理","保山","楚雄","大理","东川","个旧","景洪","开远","临沧","丽江",
"六库","潞西","曲靖","思茅","文山","西双版纳","玉溪","中甸","昭通");
break;
case "浙江" :
var cityOptions = new Array(
"杭州","安吉","慈溪","定海","奉化","海盐","黄岩","湖州","嘉兴","金华","临安",
"临海","丽水","宁波","瓯海","平湖","千岛湖","衢州","江山","瑞安","绍兴","嵊州",
"台州","温岭","温州","余姚","舟山");
break;
case "海外" :
var cityOptions = new Array(
"美国","日本","英国","法国","德国","其他");
break;
default:
var cityOptions = new Array("");
break;
}
cityField.options.length = 0;
for(var i = 0; i < cityOptions.length; i++) {
cityField.options[i]=new Option(cityOptions[i],cityOptions[i]);
/*
if (cityField.options[i].value==city)
{
//alert("here put City ok!");
document.oblogform["city"].selectedIndex = i;
}*/
}
}
function init_province_and_city(pField, province, cField, city) {
for(var i = 0; i < pField.options.length; i++) {
if (pField.options[i].value==province)
{
pField.selectedIndex = i;
}
}
showcity(province, cField);
for(var i = 0; i < cField.options.length; i++) {
if (cField.options[i].value==city)
{
cField.selectedIndex = i;
}
}
}
function init_identity_and_title(pField, identity, cField, title) {
for(var i = 0; i < pField.options.length; i++) {
if (pField.options[i].value==identity)
{
pField.selectedIndex = i;
}
}
showtechnical_title(identity, cField);
for(var i = 0; i < cField.options.length; i++) {
if (cField.options[i].value==title)
{
cField.selectedIndex = i;
}
}
}
</script>
<% province = User.current.user_extensions.location %>
<% city = User.current.user_extensions.location_city %>
<% identity = User.current.user_extensions.identity %>
<% title = User.current.user_extensions.technical_title %>
<script type="text/javascript" language="javascript">
$().ready(function(){
var province = "<%= "#{province}" %>" var province = "<%= "#{province}" %>"
var city = "<%= "#{city}" %>" var city = "<%= "#{city}" %>"
init_province_and_city(document.getElementById('userProvince'),province, document.getElementById('userCity'),city); init_province_and_city(document.getElementById('userProvince'), province, document.getElementById('userCity'), city);
var identity = "<%= "#{identity}" %>" var identity = "<%= "#{identity}" %>"
var title = "<%= "#{title}" %>" var title = "<%= "#{title}" %>"
init_identity_and_title(document.getElementById('userIdentity'),identity, document.getElementById('userTechnical_title'),title); init_identity_and_title(document.getElementById('userIdentity'), identity, document.getElementById('userTechnical_title'), title);
}); });
</script> </script>
<p style="width:400px;padding-left: 26px;"><%= l(:label_location) %> <p style="width:400px;padding-left: 26px;"><%= l(:label_location) %>
<select onchange="showcity(this.value, document.getElementById(&#39;userCity&#39;));" name="province" id="userProvince" class="location"> <select onchange="showcity(this.value, document.getElementById('userCity'));" name="province" id="userProvince" class="location">
<option value="">--请选择省份--</option> <option value="">--请选择省份--</option>
<option value="北京">北京</option> <option value="北京">北京</option>
<option value="上海">上海</option> <option value="上海">上海</option>
@ -451,12 +211,296 @@ $().ready(function(){
<option value="澳门">澳门特别行政区</option> <option value="澳门">澳门特别行政区</option>
<option value="台湾">台湾</option> <option value="台湾">台湾</option>
<option value="海外">海外</option> <option value="海外">海外</option>
</select> </select>
<select name="city" id="userCity" class="location"></select></p> <select name="city" id="userCity" class="location"></select>
<!-- end --> </p>
<% unless @user.user_extensions.identity == 2 %>
<p style="width:400px;padding-left: 26px;">
<%= l(:label_identity) %>
<select onchange="showtechnical_title(this.value, document.getElementById('userTechnical_title'));" name="identity" id="userIdentity" class="location">
<option value=""><%= l(:label_account_identity_choose) %></option>
<option value="0"><%= l(:label_account_identity_teacher) %></option>
<option value="1"><%= l(:label_account_identity_student) %></option>
<option value="3"><%= l(:label_account_identity_developer) %></option>
</select>
</p>
<span id='technical_title' style='display:none'>
<select name="technical_title" id="userTechnical_title"></select>
</span>
<span id='no' style='display:none'>
<!-- modified by fq -->
<% unless User.current.user_extensions.student_id.nil? %>
<%= text_field_tag :no, User.current.user_extensions.student_id, :placeholder => "请输入学号" %>
<% else %>
<%= text_field_tag :no, nil, :placeholder => "请输入学号" %></span>
<% end %>
<!-- end -->
</span>
<% else %>
<span style="display:none">
<select onchange="showtechnical_title(this.value, document.getElementById('userTechnical_title'));" name="identity" id="userIdentity" class="location">
<option value=""><%= l(:label_account_identity_choose) %></option>
<option value="0"><%= l(:label_account_identity_teacher) %></option>
<option value="1"><%= l(:label_account_identity_student) %></option>
<option value="2"><%= l(:label_account_identity_enterprise) %></option>
<option value="3"><%= l(:label_account_identity_developer) %></option>
</select>
</span>
<% end %>
</div>
<% if Setting.openid? %>
<p> <%= f.text_field :identity_url %> </p>
<% end %>
<% @user.custom_field_values.select(&:editable?).each do |value| %>
<p> <%= custom_field_tag_with_label :user, value %> </p>
<% end %>
<%= call_hook(:view_my_account, :user => @user, :form => f) %>
</fieldset>
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
<legend onclick="toggleFieldset(this);">
<%= l(:field_mail_notification) %>
</legend>
<div style="padding-left: 26px;"> <!-- modified by ming -->
<p style="width:380px;">
<%= render :partial => 'users/mail_notifications' %>
</p></div>
</fieldset>
<!-- added by william -->
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;display: none">
<legend onclick="toggleFieldset(this);">
<%= l(:label_user_extensions) %>
</legend>
<div>
<%= render :partial => 'users/user_extensions' %></div>
</fieldset>
<!-- end -->
<%= submit_tag l(:button_save) %>
</fieldset>
<% end %>
<% html_title(l(:label_my_account)) -%>
<!-- added by bai 增加职称-->
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
function showcity(province, cityField) {
switch (province) {
case "北京" :
var cityOptions = new Array(
"东城", "西城", "朝阳", "丰台", "石景山", "海淀", "门头沟",
"房山", "通州", "顺义", "昌平", "大兴", "平谷", "怀柔", "密云", "延庆");
break;
case "上海" :
var cityOptions = new Array(
"崇明", "黄浦", "卢湾", "徐汇", "长宁", "静安", "普陀", "闸北", "虹口", "杨浦", "闵行",
"宝山", "嘉定", "浦东", "金山", "松江", "青浦", "南汇", "奉贤");
break;
case "广东" :
var cityOptions = new Array(
"广州", "深圳", "珠海", "东莞", "中山", "佛山", "惠州", "河源", "潮州", "江门", "揭阳", "茂名",
"梅州", "清远", "汕头", "汕尾", "韶关", "顺德", "阳江", "云浮", "湛江", "肇庆");
break;
case "江苏" :
var cityOptions = new Array(
"南京", "常熟", "常州", "海门", "淮安", "江都", "江阴", "昆山", "连云港", "南通",
"启东", "沭阳", "宿迁", "苏州", "太仓", "泰州", "同里", "无锡", "徐州", "盐城",
"扬州", "宜兴", "仪征", "张家港", "镇江", "周庄");
break;
case "重庆" :
var cityOptions = new Array(
"万州", "涪陵", "渝中", "大渡口", "江北", "沙坪坝", "九龙坡", "南岸", "北碚", "万盛",
"双挢", "渝北", "巴南", "黔江", "长寿", "綦江", "潼南", "铜梁", "大足", "荣昌", "壁山",
"梁平", "城口", "丰都", "垫江", "武隆", "忠县", "开县", "云阳", "奉节", "巫山", "巫溪",
"石柱", "秀山", "酉阳", "彭水", "江津", "合川", "永川", "南川");
break;
case "安徽" :
var cityOptions = new Array(
"合肥", "安庆", "蚌埠", "亳州", "巢湖", "滁州", "阜阳", "贵池", "淮北", "淮化", "淮南",
"黄山", "九华山", "六安", "马鞍山", "宿州", "铜陵", "屯溪", "芜湖", "宣城");
break;
case "福建" :
var cityOptions = new Array(
"福州", "厦门", "泉州", "漳州", "龙岩", "南平", "宁德", "莆田", "三明");
break;
case "甘肃" :
var cityOptions = new Array(
"兰州", "白银", "定西", "敦煌", "甘南", "金昌", "酒泉", "临夏", "平凉", "天水",
"武都", "武威", "西峰", "张掖");
break;
case "广西" :
var cityOptions = new Array(
"南宁", "百色", "北海", "桂林", "防城港", "贵港", "河池", "贺州", "柳州", "钦州", "梧州", "玉林");
break;
case "贵州" :
var cityOptions = new Array(
"贵阳", "安顺", "毕节", "都匀", "凯里", "六盘水", "铜仁", "兴义", "玉屏", "遵义");
break;
case "海南" :
var cityOptions = new Array(
"海口", "儋县", "陵水", "琼海", "三亚", "通什", "万宁");
break;
case "河北" :
var cityOptions = new Array(
"石家庄", "保定", "北戴河", "沧州", "承德", "丰润", "邯郸", "衡水", "廊坊", "南戴河", "秦皇岛",
"唐山", "新城", "邢台", "张家口");
break;
case "黑龙江" :
var cityOptions = new Array(
"哈尔滨", "北安", "大庆", "大兴安岭", "鹤岗", "黑河", "佳木斯", "鸡西", "牡丹江", "齐齐哈尔",
"七台河", "双鸭山", "绥化", "伊春");
break;
case "河南" :
var cityOptions = new Array(
"郑州", "安阳", "鹤壁", "潢川", "焦作", "济源", "开封", "漯河", "洛阳", "南阳", "平顶山",
"濮阳", "三门峡", "商丘", "新乡", "信阳", "许昌", "周口", "驻马店");
break;
case "香港" :
var cityOptions = new Array(
"香港", "九龙", "新界");
break;
case "湖北" :
var cityOptions = new Array(
"武汉", "恩施", "鄂州", "黄冈", "黄石", "荆门", "荆州", "潜江", "十堰", "随州", "武穴",
"仙桃", "咸宁", "襄阳", "襄樊", "孝感", "宜昌");
break;
case "湖南" :
var cityOptions = new Array(
"长沙", "常德", "郴州", "衡阳", "怀化", "吉首", "娄底", "邵阳", "湘潭", "益阳", "岳阳",
"永州", "张家界", "株洲");
break;
case "江西" :
var cityOptions = new Array(
"南昌", "抚州", "赣州", "吉安", "景德镇", "井冈山", "九江", "庐山", "萍乡",
"上饶", "新余", "宜春", "鹰潭");
break;
case "吉林" :
var cityOptions = new Array(
"长春", "吉林", "白城", "白山", "珲春", "辽源", "梅河", "四平", "松原", "通化", "延吉");
break;
case "辽宁" :
var cityOptions = new Array(
"沈阳", "鞍山", "本溪", "朝阳", "大连", "丹东", "抚顺", "阜新", "葫芦岛", "锦州",
"辽阳", "盘锦", "铁岭", "营口");
break;
case "澳门" :
var cityOptions = new Array("澳门");
break;
case "内蒙古" :
var cityOptions = new Array(
"呼和浩特", "阿拉善盟", "包头", "赤峰", "东胜", "海拉尔", "集宁", "临河", "通辽", "乌海",
"乌兰浩特", "锡林浩特");
break;
case "宁夏" :
var cityOptions = new Array(
"银川", "固源", "石嘴山", "吴忠");
break;
case "青海" :
var cityOptions = new Array(
"西宁", "德令哈", "格尔木", "共和", "海东", "海晏", "玛沁", "同仁", "玉树");
break;
case "山东" :
var cityOptions = new Array(
"济南", "滨州", "兖州", "德州", "东营", "菏泽", "济宁", "莱芜", "聊城", "临沂",
"蓬莱", "青岛", "曲阜", "日照", "泰安", "潍坊", "威海", "烟台", "枣庄", "淄博");
break;
case "山西" :
var cityOptions = new Array(
"太原", "长治", "大同", "候马", "晋城", "离石", "临汾", "宁武", "朔州", "忻州",
"阳泉", "榆次", "运城");
break;
case "陕西" :
var cityOptions = new Array(
"西安", "安康", "宝鸡", "汉中", "渭南", "商州", "绥德", "铜川", "咸阳", "延安", "榆林");
break;
case "四川" :
var cityOptions = new Array(
"成都", "巴中", "达川", "德阳", "都江堰", "峨眉山", "涪陵", "广安", "广元", "九寨沟",
"康定", "乐山", "泸州", "马尔康", "绵阳", "眉山", "南充", "内江", "攀枝花", "遂宁",
"汶川", "西昌", "雅安", "宜宾", "自贡", "资阳");
break;
case "台湾" :
var cityOptions = new Array(
"台北", "基隆", "台南", "台中", "高雄", "屏东", "南投", "云林", "新竹", "彰化", "苗栗",
"嘉义", "花莲", "桃园", "宜兰", "台东", "金门", "马祖", "澎湖");
break;
case "天津" :
var cityOptions = new Array(
"天津", "和平", "东丽", "河东", "西青", "河西", "津南", "南开", "北辰", "河北", "武清", "红挢",
"塘沽", "汉沽", "大港", "宁河", "静海", "宝坻", "蓟县");
break;
case "新疆" :
var cityOptions = new Array(
"乌鲁木齐", "阿克苏", "阿勒泰", "阿图什", "博乐", "昌吉", "东山", "哈密", "和田", "喀什",
"克拉玛依", "库车", "库尔勒", "奎屯", "石河子", "塔城", "吐鲁番", "伊宁");
break;
case "西藏" :
var cityOptions = new Array(
"拉萨", "阿里", "昌都", "林芝", "那曲", "日喀则", "山南");
break;
case "云南" :
var cityOptions = new Array(
"昆明", "大理", "保山", "楚雄", "大理", "东川", "个旧", "景洪", "开远", "临沧", "丽江",
"六库", "潞西", "曲靖", "思茅", "文山", "西双版纳", "玉溪", "中甸", "昭通");
break;
case "浙江" :
var cityOptions = new Array(
"杭州", "安吉", "慈溪", "定海", "奉化", "海盐", "黄岩", "湖州", "嘉兴", "金华", "临安",
"临海", "丽水", "宁波", "瓯海", "平湖", "千岛湖", "衢州", "江山", "瑞安", "绍兴", "嵊州",
"台州", "温岭", "温州", "余姚", "舟山");
break;
case "海外" :
var cityOptions = new Array(
"美国", "日本", "英国", "法国", "德国", "其他");
break;
default:
var cityOptions = new Array("");
break;
}
cityField.options.length = 0;
for (var i = 0; i < cityOptions.length; i++) {
cityField.options[i] = new Option(cityOptions[i], cityOptions[i]);
/*
if (cityField.options[i].value==city)
{
//alert("here put City ok!");
document.oblogform["city"].selectedIndex = i;
}*/
}
}
function init_province_and_city(pField, province, cField, city) {
for (var i = 0; i < pField.options.length; i++) {
if (pField.options[i].value == province) {
pField.selectedIndex = i;
}
}
showcity(province, cField);
for (var i = 0; i < cField.options.length; i++) {
if (cField.options[i].value == city) {
cField.selectedIndex = i;
}
}
}
function init_identity_and_title(pField, identity, cField, title) {
for (var i = 0; i < pField.options.length; i++) {
if (pField.options[i].value == identity) {
pField.selectedIndex = i;
}
}
showtechnical_title(identity, cField);
for (var i = 0; i < cField.options.length; i++) {
if (cField.options[i].value == title) {
cField.selectedIndex = i;
}
}
}
function showtechnical_title(identity, technical_titleField) { function showtechnical_title(identity, technical_titleField) {
switch (identity) { switch (identity) {
@ -467,7 +511,7 @@ $().ready(function(){
$('#enterprise').hide() $('#enterprise').hide()
$('#gender').show() $('#gender').show()
var technical_titleOptions = new Array( var technical_titleOptions = new Array(
"<%= l(:label_technicl_title_professor) %>","<%= l(:label_technicl_title_associate_professor) %>","<%= l(:label_technicl_title_lecturer) %>","<%= l(:label_technicl_title_teaching_assistant) %>"); "<%= l(:label_technicl_title_professor) %>", "<%= l(:label_technicl_title_associate_professor) %>", "<%= l(:label_technicl_title_lecturer) %>", "<%= l(:label_technicl_title_teaching_assistant) %>");
break; break;
case '1' : case '1' :
@ -499,8 +543,8 @@ $().ready(function(){
} }
technical_titleField.options.length = 0; technical_titleField.options.length = 0;
for(var i = 0; i < technical_titleOptions.length; i++) { for (var i = 0; i < technical_titleOptions.length; i++) {
technical_titleField.options[i]=new Option(technical_titleOptions[i],technical_titleOptions[i]); technical_titleField.options[i] = new Option(technical_titleOptions[i], technical_titleOptions[i]);
/* /*
if (cityField.options[i].value==city) if (cityField.options[i].value==city)
{ {
@ -508,97 +552,5 @@ $().ready(function(){
document.oblogform["city"].selectedIndex = i; document.oblogform["city"].selectedIndex = i;
}*/ }*/
} }
} }
</script> </script>
<!-- end -->
<% unless @user.user_extensions.identity == 2 %>
<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=""><%= l(:label_account_identity_choose) %></option>
<option value="0"><%= l(:label_account_identity_teacher) %></option>
<option value="1"><%= l(:label_account_identity_student) %></option>
<option value="3"><%= l(:label_account_identity_developer) %></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'>
<!-- modified by fq -->
<% unless User.current.user_extensions.student_id.nil? %>
<%= text_field_tag :no, User.current.user_extensions.student_id, :placeholder => "请输入学号" %></span>
<!-- <input name="no" id="no" value=<%= "#{User.current.user_extensions.student_id}" %> placeholder="请输入学号"></span> -->
<% else %>
<%= text_field_tag :no, nil, :placeholder => "请输入学号" %></span>
<!-- <input name="no" id="no" placeholder="请输入学号"></span> -->
<% end %>
<!-- end -->
</td></tr></table></p>
<% else %>
<span style="display:none">
<select onchange="showtechnical_title(this.value, document.getElementById(&#39;userTechnical_title&#39;));" name="identity" id="userIdentity" class="location">
<option value=""><%= l(:label_account_identity_choose) %></option>
<option value="0"><%= l(:label_account_identity_teacher) %></option>
<option value="1"><%= l(:label_account_identity_student) %></option>
<option value="2"><%= l(:label_account_identity_enterprise) %></option>
<option value="3"><%= l(:label_account_identity_developer) %></option>
</select>
</span>
<% end %>
<!-- end -->
</div>
<% if Setting.openid? %>
<p>
<%= f.text_field :identity_url %>
</p></div>
<% end %>
<% @user.custom_field_values.select(&:editable?).each do |value| %>
<p>
<%= custom_field_tag_with_label :user, value %>
</p>
<% end %>
<%= call_hook(:view_my_account, :user => @user, :form => f) %>
</fieldset>
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
<legend onclick="toggleFieldset(this);">
<%= l(:field_mail_notification)%>
</legend>
<div style="padding-left: 26px;"> <!-- modified by ming -->
<p style="width:380px;>
<%= render :partial => 'users/mail_notifications' %>
</p></div>
</fieldset>
<!-- <fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;">
<legend onclick="toggleFieldset(this);">
<%= l(:label_preferences)%>
</legend>
<div style="padding-left: 26px;">
<%= render :partial => 'users/preferences' %></div>
</fieldset> -->
<!-- added by william -->
<fieldset class="collapsible collapsed" style="width:800px;margin-left: 10px;display: none">
<legend onclick="toggleFieldset(this);">
<%= l(:label_user_extensions)%>
</legend>
<div>
<%= render :partial => 'users/user_extensions' %></div>
</fieldset>
<!-- end -->
<%= submit_tag l(:button_save) %>
</fieldset>
<% end %>
<% html_title(l(:label_my_account)) -%>

View File

@ -4,12 +4,17 @@
$(document).ready(function() { $(document).ready(function() {
$("#province").html("<option value='0' selected = true style='display: none;'></option>"); $("#province").html("<option value='0' selected = true style='display: none;'></option>");
$.ajax({ $.ajax({
type :"POST", type :"POST",
url :'/school/get_province', url :'/school/get_province',
data :'text', data: "send",
success: function(data){ success: function(data, textStatus){
$("#province").append(data);
$("#province").append(data.text);
$("#schoollist").html(data.text_s);
} }
}) })

View File

@ -1,5 +1,5 @@
<p> <p>
<%= label_tag "user_mail_notification", l(:description_user_mail_notification), :class => "hidden-for-sighted" %> <%= label_tag "user_mail_notification", l(:description_user_mail_notification), :class => "hidden-for-sighted_bak" %>
<%= select_tag( <%= select_tag(
'user[mail_notification]', 'user[mail_notification]',
options_for_select( options_for_select(

View File

@ -244,7 +244,7 @@
</div> </div>
<div class="pagination" style="float:left;"> <div class="pagination" style="float:left;">
<ul> <%= pagination_links_full @info_pages %> <ul> <ul> <%= pagination_links_full @info_pages %> </ul>
</div> </div>
<% else %> <% else %>

View File

@ -186,6 +186,8 @@ zh:
notice_issue_done_ratios_updated: 问题完成度已更新。 notice_issue_done_ratios_updated: 问题完成度已更新。
notice_gantt_chart_truncated: "这个表是截断的因为它超过了可以显示的最大数量(%{max})" notice_gantt_chart_truncated: "这个表是截断的因为它超过了可以显示的最大数量(%{max})"
error_complete_occupation: "请您填写工作单位,否则本系统的部分功能将无法正常使用。"
error_can_t_load_default_data: "无法载入默认设置:%{value}" error_can_t_load_default_data: "无法载入默认设置:%{value}"
error_scm_not_found: "版本库中不存在该条目和(或)其修订版本。" error_scm_not_found: "版本库中不存在该条目和(或)其修订版本。"
error_scm_command_failed: "访问版本库时发生错误:%{value}" error_scm_command_failed: "访问版本库时发生错误:%{value}"