2016-07-06 15:43:48 +08:00
|
|
|
|
|
2016-07-06 15:52:18 +08:00
|
|
|
|
<div id="RSide" style="margin-left:0px; margin-bottom:0px; width:728px;">
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<div id="users_tb_" class="users_tb_">
|
|
|
|
|
<ul>
|
|
|
|
|
<li id="users_tb_1" class="users_hovertab" onclick="x:HoverLi(1);">基本资料</li>
|
|
|
|
|
<li id="users_tb_2" class="users_normaltab" onclick="i:HoverLi(2);">账号管理</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div><!--tb_ end-->
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
<div class="users_ctt">
|
|
|
|
|
<%= labelled_form_for :user, @user, :url => {:action => "account"}, :html => {:id => 'my_account_form', :method => :post} do |f| %>
|
|
|
|
|
<div class="users_dis" id="users_tbc_01">
|
2015-07-13 16:44:53 +08:00
|
|
|
|
<% if( @act.nil? || @act != 'password') %>
|
|
|
|
|
<%= render_flash_messages %>
|
2015-07-18 12:50:44 +08:00
|
|
|
|
<%= error_messages_for 'user',@user.user_extensions %>
|
2015-07-13 16:44:53 +08:00
|
|
|
|
<% end %>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<ul class="setting_left">
|
2016-06-29 08:48:13 +08:00
|
|
|
|
<li><span style="color:red;">*</span> 登录名 : </li>
|
|
|
|
|
<li><span style="color:red;">*</span> 邮箱 : </li>
|
|
|
|
|
<li><span style="color:red;">*</span> 职业 : </li>
|
|
|
|
|
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><span style="color:red;">*</span> 姓名 : </li>
|
2015-07-18 15:12:59 +08:00
|
|
|
|
<li nhname="tag" nh_tag_2="true" style="display:none;">组织名 : <span style="color:red;">*</span></li>
|
2016-06-30 16:08:36 +08:00
|
|
|
|
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><span style="color:red;">*</span> 性别 : </li>
|
|
|
|
|
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;" ><span style="color:red;">*</span> 单位名称 : </li>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<li>地区 : </li>
|
|
|
|
|
<li>邮件通知 : </li>
|
2015-08-26 09:11:03 +08:00
|
|
|
|
<!--<li>个人签名 : </li>-->
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<li>个人简介 : </li>
|
|
|
|
|
<li> </li>
|
|
|
|
|
</ul>
|
|
|
|
|
<ul class="setting_right ">
|
2015-12-11 15:36:59 +08:00
|
|
|
|
<li><%= f.text_field :login,:no_label=>true, :required => true,:style=>"color:grey", :nh_required=>"1",:disabled=>'disabled', :name => "login",:class=>"w210"%></li>
|
2015-07-18 15:12:59 +08:00
|
|
|
|
<li><%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%></li>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
|
|
|
|
|
<li>
|
2015-11-02 14:51:56 +08:00
|
|
|
|
<select onchange="showtechnical_title(this.value);" required = true, nh_required="1" name="identity" id="userIdentity" class="location" class="w70" style="height:28px;margin-left:2px;">
|
|
|
|
|
<option value="-1">
|
|
|
|
|
<%= l(:label_account_identity_choose) %>
|
|
|
|
|
</option>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<option value="0">
|
|
|
|
|
<%= l(:label_account_identity_teacher) %>
|
|
|
|
|
</option>
|
|
|
|
|
<option value="1">
|
|
|
|
|
<%= l(:label_account_identity_student) %>
|
|
|
|
|
</option>
|
2016-01-05 15:59:13 +08:00
|
|
|
|
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<option value="3">
|
|
|
|
|
<%= l(:label_account_identity_developer) %>
|
|
|
|
|
</option>
|
|
|
|
|
</select>
|
|
|
|
|
<select nhname="tag" nh_tag_0="true" name="technical_title" id="userTechnical_title" class="w70" style='display:none;height:28px;'>
|
|
|
|
|
<option value="教授">教授</option>
|
|
|
|
|
<option value="副教授">副教授</option>
|
|
|
|
|
<option value="讲师">讲师</option>
|
|
|
|
|
<option value="助教">助教</option>
|
|
|
|
|
</select>
|
|
|
|
|
<span nhname="tag" nh_tag_1="true" style='display:none;'>
|
2014-11-19 17:25:10 +08:00
|
|
|
|
<% if !User.current.user_extensions.nil? && !User.current.user_extensions.student_id.nil? %>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<%= text_field_tag :no, User.current.user_extensions.student_id, :placeholder => l(:label_account_identity_studentID),:style=>"width:127px;" %>
|
2014-11-13 09:13:44 +08:00
|
|
|
|
<% else %>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<%= text_field_tag :no, nil, :placeholder => l(:label_account_identity_studentID),:style=>"60px" %></span>
|
2014-11-13 09:13:44 +08:00
|
|
|
|
<% end %>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
</span>
|
2015-11-02 14:51:56 +08:00
|
|
|
|
<span id="identity_hint" style="display: none"></span>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
</li>
|
|
|
|
|
|
2016-06-30 16:08:36 +08:00
|
|
|
|
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><%= text_field_tag :lastname,@user.lastname+@user.firstname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %>
|
2016-06-29 08:48:13 +08:00
|
|
|
|
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">
|
2016-06-30 16:08:36 +08:00
|
|
|
|
<% if User.current.user_extensions && User.current.user_extensions.gender && User.current.user_extensions.gender == 1 %>
|
|
|
|
|
<input type="radio" id="sex" value="0" name="sex" class="fl "><label class="fl mr10">男</label> <input type="radio" id="sex" value="1" name="sex" checked="checked" class="fl "><label class="fl ">女</label>
|
|
|
|
|
<% else %>
|
|
|
|
|
<input type="radio" id="sex" value="0" name="sex" checked="checked" class="fl "><label class="fl mr10">男</label> <input type="radio" id="sex" value="1" name="sex" class="fl "><label class="fl ">女</label>
|
|
|
|
|
<% end %>
|
|
|
|
|
<select style = "display: none;" class="w70" style="height:28px;margin-left:2px;" id="gender" name="gender"><option value="0">男</option><option value="1">女</option></select>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
</li>
|
|
|
|
|
|
2016-06-30 16:08:36 +08:00
|
|
|
|
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">
|
|
|
|
|
<% if User.current.user_extensions.nil? %>
|
|
|
|
|
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
|
|
|
|
|
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="" placeholder=" --请选择您所属的单位--"/>
|
|
|
|
|
<p class="fl ml10">
|
2016-08-03 10:36:03 +08:00
|
|
|
|
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
|
2016-06-30 16:08:36 +08:00
|
|
|
|
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
|
|
|
|
|
</p>
|
|
|
|
|
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
|
|
|
|
|
<% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %>
|
|
|
|
|
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
|
|
|
|
|
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.occupation %>" />
|
|
|
|
|
<p class="fl ml10">
|
2016-08-03 10:36:03 +08:00
|
|
|
|
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
|
2016-06-30 16:08:36 +08:00
|
|
|
|
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
|
|
|
|
|
</p>
|
|
|
|
|
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
|
|
|
|
|
<% elsif User.current.user_extensions.school.nil? %>
|
|
|
|
|
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
|
|
|
|
|
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" placeholder=" --请选择您所属的单位--" />
|
|
|
|
|
<p class="fl ml10">
|
2016-08-03 10:36:03 +08:00
|
|
|
|
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
|
2016-06-30 16:08:36 +08:00
|
|
|
|
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
|
|
|
|
|
</p>
|
|
|
|
|
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
|
|
|
|
|
<% else %>
|
|
|
|
|
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" value="<%= User.current.user_extensions.school %>" />
|
|
|
|
|
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" type="text" style="display: none;" class="w210" value="<%= User.current.user_extensions.school.id %>"/>
|
|
|
|
|
<p class="fl ml10">
|
2016-08-03 10:36:03 +08:00
|
|
|
|
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
|
2016-06-30 16:08:36 +08:00
|
|
|
|
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
|
|
|
|
|
</p>
|
|
|
|
|
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" value="<%#= User.current.user_extensions.school.name %>" readonly="true" style="background-color: #E2E2E2;"/>-->
|
|
|
|
|
<% end %>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
<li>
|
|
|
|
|
<select onchange="showcity(this.value, document.getElementById('userCity'));" name="province" id="userProvince" class="location" style="height:28px;margin-left:2px;">
|
|
|
|
|
<option value="">--请选择省份--</option>
|
|
|
|
|
<option value="北京">北京</option>
|
|
|
|
|
<option value="上海">上海</option>
|
|
|
|
|
<option value="广东">广东</option>
|
|
|
|
|
<option value="江苏">江苏</option>
|
|
|
|
|
<option value="浙江">浙江</option>
|
|
|
|
|
<option value="重庆">重庆</option>
|
|
|
|
|
<option value="安徽">安徽</option>
|
|
|
|
|
<option value="福建">福建</option>
|
|
|
|
|
<option value="甘肃">甘肃</option>
|
|
|
|
|
<option value="广西">广西</option>
|
|
|
|
|
<option value="贵州">贵州</option>
|
|
|
|
|
<option value="海南">海南</option>
|
|
|
|
|
<option value="河北">河北</option>
|
|
|
|
|
<option value="黑龙江">黑龙江</option>
|
|
|
|
|
<option value="河南">河南</option>
|
|
|
|
|
<option value="湖北">湖北</option>
|
|
|
|
|
<option value="湖南">湖南</option>
|
|
|
|
|
<option value="江西">江西</option>
|
|
|
|
|
<option value="吉林">吉林</option>
|
|
|
|
|
<option value="辽宁">辽宁</option>
|
|
|
|
|
<option value="内蒙古">内蒙古</option>
|
|
|
|
|
<option value="宁夏">宁夏</option>
|
|
|
|
|
<option value="青海">青海</option>
|
|
|
|
|
<option value="山东">山东</option>
|
|
|
|
|
<option value="山西">山西</option>
|
|
|
|
|
<option value="陕西">陕西</option>
|
|
|
|
|
<option value="四川">四川</option>
|
|
|
|
|
<option value="天津">天津</option>
|
|
|
|
|
<option value="新疆">新疆</option>
|
|
|
|
|
<option value="西藏">西藏</option>
|
|
|
|
|
<option value="云南">云南</option>
|
|
|
|
|
<option value="香港">香港特别行政区</option>
|
|
|
|
|
<option value="澳门">澳门特别行政区</option>
|
|
|
|
|
<option value="台湾">台湾</option>
|
|
|
|
|
<option value="海外">海外</option>
|
|
|
|
|
</select>
|
|
|
|
|
<select name="city" id="userCity" class="location" style="height:28px;"></select>
|
|
|
|
|
</li>
|
|
|
|
|
|
|
|
|
|
<li>
|
|
|
|
|
<%= select_tag( 'user[mail_notification]', options_for_select( user_mail_notification_options(@user), @user.mail_notification) ) %>
|
2016-06-29 08:48:13 +08:00
|
|
|
|
<label class="ml10"><%= check_box_tag 'no_self_notified', 1, @user.pref[:no_self_notified],:style=>"height:14px;" %>不要发送对我自己提交的修改的通知</label>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
</li>
|
2015-08-26 09:11:03 +08:00
|
|
|
|
<!--<li><input name="brief_introduction" class="w450" type="text" maxlength="255" value="<%#= (@user.user_extensions.nil?) ? '' : @user.user_extensions.brief_introduction %>"></li>-->
|
2015-07-18 12:50:44 +08:00
|
|
|
|
<li style="height:auto;"><textarea name="description" class="w450 h200" maxlength="255" style="resize:none;"><%= (@user.user_extensions.nil?) ? '' : @user.user_extensions.description %></textarea></li>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<li style="display:none;"><%= f.select :language, :Chinese => :zh, :English => :en %></li>
|
|
|
|
|
<li class="ml2">
|
2016-06-29 08:48:13 +08:00
|
|
|
|
<a href="javascript:void(0);" id="my_account_form_link" class="blue_btn fl" style="background: #3b94d6; padding: 0 25px;">确定</a>
|
2015-07-13 16:44:53 +08:00
|
|
|
|
<input type="submit" id="my_account_form_btn" style="display:none;"/>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<!--<a href="javascript:void(0);" class="grey_btn ml10 fl">取消</a>-->
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</div><!--tbc_01 end-->
|
|
|
|
|
<% end %>
|
2015-07-18 15:12:59 +08:00
|
|
|
|
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<%= form_tag({:action => "password"},:id => 'my_password_form') do %>
|
|
|
|
|
<div class="users_undis" id="users_tbc_02">
|
2015-07-13 16:44:53 +08:00
|
|
|
|
<% if( !@act.nil? && @act == 'password') %>
|
|
|
|
|
<%= render_flash_messages %>
|
|
|
|
|
<%= error_messages_for 'user' %>
|
|
|
|
|
<% end %>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<ul class="setting_left">
|
|
|
|
|
<li>原始密码 : </li>
|
|
|
|
|
<li>新密码 : </li>
|
|
|
|
|
<li>确认密码 : </li>
|
|
|
|
|
</ul>
|
|
|
|
|
<ul class="setting_right ">
|
2015-07-18 15:12:59 +08:00
|
|
|
|
<li><input id="password" name="password" class="w210" type="password" required="true" nh_required="1"></li>
|
2015-12-10 15:54:44 +08:00
|
|
|
|
<li><input id="new_password" name="new_password" class="w210" type="password" required="true" nh_required="1"><span class="c_red ml5">请输入8-12个字符</span></li>
|
2015-07-18 15:12:59 +08:00
|
|
|
|
<li><input id="new_password_confirmation" name="new_password_confirmation" class="w210" type="password" required="true" nh_required="1"></li>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<li class="ml2">
|
2015-07-18 11:36:12 +08:00
|
|
|
|
<a href="javascript:;" id="my_password_form_link" class="blue_btn fl">确认</a>
|
2015-11-02 10:30:51 +08:00
|
|
|
|
<input type="submit" id="my_password_form_btn" style="display:none;"/>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<!--<a href="javascript:void(0);" class="grey_btn ml10 fl">取消</a>-->
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</div><!--tbc_02 end-->
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div><!--ctt end-->
|
|
|
|
|
|
2016-07-06 15:43:48 +08:00
|
|
|
|
<!--users_setting end-->
|
2014-10-23 11:30:34 +08:00
|
|
|
|
|
2015-07-09 15:27:49 +08:00
|
|
|
|
</div>
|
2016-07-06 15:52:18 +08:00
|
|
|
|
<div id="search_school_result_list" style="width: 205px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display: none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;">
|
2015-10-15 12:04:55 +08:00
|
|
|
|
</div>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<div id="WOpenWindow">
|
|
|
|
|
<a class="modal_close" href="#"></a>
|
|
|
|
|
<h2 style="margin: 10px"><%= l(:lable_school_list)%></h2>
|
|
|
|
|
|
|
|
|
|
<div class="pcontent">
|
|
|
|
|
<ul id="provincelist" class="school_list">
|
|
|
|
|
<% @ss = School.find_by_sql("select distinct province from schools") %>
|
|
|
|
|
<% @ss.each do |s| %>
|
|
|
|
|
<li style="width: 15%; float: left;">
|
|
|
|
|
<a style="cursor: pointer;" onclick="get_options('<%= s.province %>')"><%= s.province %>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<% end %>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="content" style="font-size: 13px">
|
|
|
|
|
<ul id="schoollist" class="school_list">
|
|
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
2015-10-15 12:04:55 +08:00
|
|
|
|
|
2015-07-09 15:27:49 +08:00
|
|
|
|
</div>
|
2014-10-23 11:30:34 +08:00
|
|
|
|
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<%= stylesheet_link_tag 'nyan' %>
|
|
|
|
|
<%= javascript_include_tag '/javascripts/jquery.leanModal.min.js' %>
|
|
|
|
|
<% if !User.current.user_extensions.nil? %>
|
|
|
|
|
<% province = User.current.user_extensions.location %>
|
|
|
|
|
<% city = User.current.user_extensions.location_city %>
|
|
|
|
|
<% identity = User.current.user_extensions.identity %>
|
|
|
|
|
<% occupation1 = User.current.user_extensions.occupation %>
|
|
|
|
|
<% occupation = User.current.user_extensions.occupation %>
|
|
|
|
|
<% title = User.current.user_extensions.technical_title %>
|
2015-09-10 15:01:59 +08:00
|
|
|
|
<% gender = User.current.user_extensions.gender %>
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<% language = User.current.language %>
|
|
|
|
|
<% else %>
|
|
|
|
|
<% province = "湖南省" %>
|
|
|
|
|
<% city = "长沙"%>
|
|
|
|
|
<% identity = ""%>
|
|
|
|
|
<% occupation1 = ""%>
|
|
|
|
|
<% title = "" %>
|
|
|
|
|
<% language = ""%>
|
2014-10-23 11:30:34 +08:00
|
|
|
|
<% end %>
|
|
|
|
|
|
2015-07-09 15:27:49 +08:00
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
function showtechnical_title(val){
|
2015-07-18 15:12:59 +08:00
|
|
|
|
$("*[nhname='tag']").each(function(){
|
|
|
|
|
$("*[nh_required='1']",$(this)).attr("required",false);
|
|
|
|
|
$(this).hide()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("*[nh_tag_"+val+"='true']").each(function(){
|
|
|
|
|
$("*[nh_required='1']",$(this)).attr("required",true);
|
|
|
|
|
$(this).show()
|
|
|
|
|
});
|
2016-06-30 16:08:36 +08:00
|
|
|
|
$("#identity_hint").hide();
|
2015-07-09 15:27:49 +08:00
|
|
|
|
}
|
|
|
|
|
function init_identity_and_title(pField, identity, cField, title, language) {
|
|
|
|
|
for (var i = 0; i < pField.options.length; i++) {
|
|
|
|
|
if (pField.options[i].value == identity) {
|
|
|
|
|
pField.selectedIndex = i;
|
|
|
|
|
}
|
2014-10-23 11:30:34 +08:00
|
|
|
|
}
|
2015-07-09 15:27:49 +08:00
|
|
|
|
showtechnical_title(identity, cField);
|
|
|
|
|
|
|
|
|
|
if(language == 'zh') {
|
|
|
|
|
switch (title) {
|
|
|
|
|
case 'Professor' :
|
|
|
|
|
title1 = '教授';
|
|
|
|
|
break;
|
|
|
|
|
case 'Associate professor' :
|
|
|
|
|
title1 = '副教授';
|
|
|
|
|
break;
|
|
|
|
|
case 'Lecturer' :
|
|
|
|
|
title1 = '讲师';
|
|
|
|
|
break;
|
|
|
|
|
case 'Teaching assistant' :
|
|
|
|
|
title1 = '助教';
|
|
|
|
|
break;
|
|
|
|
|
default :
|
|
|
|
|
title1 = title;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
switch (title) {
|
|
|
|
|
case '教授' :
|
|
|
|
|
title1 = 'Professor';
|
|
|
|
|
break;
|
|
|
|
|
case '副教授' :
|
|
|
|
|
title1 = 'Associate professor';
|
|
|
|
|
break;
|
|
|
|
|
case '讲师' :
|
|
|
|
|
title1 = 'Lecturer';
|
|
|
|
|
break;
|
|
|
|
|
case '助教' :
|
|
|
|
|
title1 = 'Teaching assistant';
|
|
|
|
|
break;
|
|
|
|
|
default :
|
|
|
|
|
title1 = title;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2014-10-23 11:30:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-09 15:27:49 +08:00
|
|
|
|
for (var i = 0; i < cField.options.length; i++) {
|
|
|
|
|
if (cField.options[i].value == title1) {
|
|
|
|
|
cField.selectedIndex = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function get_options(value) {
|
|
|
|
|
var prefix = "";
|
|
|
|
|
if(location.href.indexOf('ros')>=0)
|
|
|
|
|
{
|
|
|
|
|
prefix = "/ros"
|
2014-10-23 11:30:34 +08:00
|
|
|
|
}
|
2015-07-09 15:27:49 +08:00
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
url: prefix + '/school/get_options/' + encodeURIComponent(value),
|
|
|
|
|
data: 'text',
|
|
|
|
|
success: function (data) {
|
|
|
|
|
$("#province").val(value);
|
|
|
|
|
$("#schoollist").html(data);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function test(id, name) {
|
|
|
|
|
//$("#occupation").html("<option value='"+id+"'>"+name+"</option>");
|
|
|
|
|
$("#occupation").val(id);
|
|
|
|
|
$("#occupation_name").val(name);
|
|
|
|
|
|
|
|
|
|
$("#lean_overlay").hide();
|
|
|
|
|
$("#WOpenWindow").hide();
|
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-09-10 15:01:59 +08:00
|
|
|
|
function init_gender(pField, gender) {
|
|
|
|
|
for (var i=0; i<pField.options.length; i++) {
|
|
|
|
|
if (pField.options[i].value == gender) {
|
|
|
|
|
pField.selectedIndex = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-10-15 12:04:55 +08:00
|
|
|
|
function changeValue(value,data){
|
|
|
|
|
//console.log(value+","+data)
|
2015-10-16 16:56:27 +08:00
|
|
|
|
$("input[name='province']").val(value);
|
2015-10-15 12:04:55 +08:00
|
|
|
|
$("input[name='occupation']").val(data);
|
|
|
|
|
$("#search_school_result_list").hide();
|
|
|
|
|
$("#hint").hide();
|
2016-06-30 16:08:36 +08:00
|
|
|
|
$("#errortip").hide();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function apply_add_school(){
|
|
|
|
|
var htmlvalue = "<%= escape_javascript( render :partial => 'my/apply_add_school' )%>";
|
|
|
|
|
pop_up_box(htmlvalue,580,20,48);
|
2016-07-29 16:11:26 +08:00
|
|
|
|
$("#schoolname").val($("input[name='province']").val());
|
2015-10-15 12:04:55 +08:00
|
|
|
|
}
|
2015-10-15 17:06:42 +08:00
|
|
|
|
function add_school(name){
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: '<%= url_for(:controller => 'school',:action => 'add_school') %>' + '?name=' + name,
|
|
|
|
|
type: 'post',
|
|
|
|
|
success: function (data) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2015-10-15 12:04:55 +08:00
|
|
|
|
var lastSearchCondition = '';
|
2015-10-20 10:11:07 +08:00
|
|
|
|
var page = 1; //唯一控制页码 变量
|
|
|
|
|
var count = 0; //查询结果的总量
|
|
|
|
|
var maxPage = 0 ;//最大页面值
|
2015-10-15 12:04:55 +08:00
|
|
|
|
$(function() {
|
2015-10-20 10:11:07 +08:00
|
|
|
|
$("#search_school_result_list").scroll(function(e){
|
|
|
|
|
nScrollHight = $(this)[0].scrollHeight;
|
|
|
|
|
nScrollTop = $(this)[0].scrollTop;
|
|
|
|
|
var nDivHight = $(this).height();
|
|
|
|
|
if(nScrollTop + nDivHight >= nScrollHight) //到底部了,
|
|
|
|
|
{
|
|
|
|
|
//判断页码是否是最大值,如果是的,就不去请求了
|
|
|
|
|
if(page >= maxPage){
|
|
|
|
|
return;
|
|
|
|
|
}else{ //如果不是,那就请求下一页,请求数据处理
|
|
|
|
|
page ++;
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + $("input[name='province']").val() + '&page=' + page,
|
|
|
|
|
type: 'post',
|
|
|
|
|
success: function (data) {
|
|
|
|
|
schoolsResult = data.schools;
|
|
|
|
|
if (schoolsResult.length != undefined && schoolsResult.length != 0) {
|
|
|
|
|
var i = 0;
|
|
|
|
|
for (; i < schoolsResult.length; i++) {
|
|
|
|
|
link = '<a onclick="window.changeValue(\'' + schoolsResult[i].school.name.replace(/\s/g, " ") + '\',\'' + schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + schoolsResult[i].school.name + '</a><br/>';
|
|
|
|
|
$("#search_school_result_list").append(link);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
2015-10-15 12:04:55 +08:00
|
|
|
|
//查询学校
|
|
|
|
|
$("input[name='province']").on('input', function (e) {
|
2015-10-19 09:55:19 +08:00
|
|
|
|
throttle(shcool_search_fn,window,e);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function throttle(method,context,e){
|
|
|
|
|
clearTimeout(method.tId);
|
|
|
|
|
method.tId=setTimeout(function(){
|
|
|
|
|
method.call(context,e);
|
|
|
|
|
},500);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function shcool_search_fn(e){
|
2015-10-20 10:11:07 +08:00
|
|
|
|
|
|
|
|
|
if($(e.target).val().trim() == lastSearchCondition && $(e.target).val().trim() != ''){//如果输入框没有改变或者输入框为空就返回
|
2015-10-15 12:04:55 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
2015-10-20 10:11:07 +08:00
|
|
|
|
$("input[name='occupation']").val(''); //一旦有输入就清空id。
|
2015-10-15 12:04:55 +08:00
|
|
|
|
lastSearchCondition = $(e.target).val().trim();
|
2015-10-20 10:11:07 +08:00
|
|
|
|
page = 1; //有新的搜索,页面重置为1
|
2015-10-15 12:04:55 +08:00
|
|
|
|
$.ajax({
|
2015-10-20 10:11:07 +08:00
|
|
|
|
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value+'&page='+page,
|
2015-10-15 12:04:55 +08:00
|
|
|
|
type: 'post',
|
|
|
|
|
success: function (data) {
|
2015-10-20 10:11:07 +08:00
|
|
|
|
schoolsResult = data.schools;
|
|
|
|
|
count = data.count;
|
2015-10-20 14:38:24 +08:00
|
|
|
|
maxPage = Math.ceil(count/100) //最大页码值
|
2015-10-20 10:11:07 +08:00
|
|
|
|
if(schoolsResult.length != undefined && schoolsResult.length != 0) {
|
2015-10-15 12:04:55 +08:00
|
|
|
|
var i = 0;
|
|
|
|
|
$("#search_school_result_list").html('');
|
2015-10-20 10:11:07 +08:00
|
|
|
|
for (; i < schoolsResult.length; i++) {
|
|
|
|
|
link = '<a onclick="window.changeValue(\'' + schoolsResult[i].school.name.replace(/\s/g," ") + '\',\'' + schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + schoolsResult[i].school.name + '</a><br/>';
|
2015-10-15 12:04:55 +08:00
|
|
|
|
$("#search_school_result_list").append(link);
|
|
|
|
|
}
|
|
|
|
|
$("#search_school_result_list").css('left', $(e.target).offset().left);
|
|
|
|
|
$("#search_school_result_list").css('top', $(e.target).offset().top + 28);
|
|
|
|
|
$("#search_school_result_list").css("position", "absolute");
|
|
|
|
|
$("#search_school_result_list").show();
|
|
|
|
|
if($(e.target).val().trim() != '') {
|
2015-10-15 17:06:42 +08:00
|
|
|
|
str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value;
|
2016-06-30 16:08:36 +08:00
|
|
|
|
$("#hint").html('找到了' + count + '个包含"' + str + '"的高校(单位)');
|
2015-10-15 12:04:55 +08:00
|
|
|
|
$("#hint").show();
|
2016-06-30 16:08:36 +08:00
|
|
|
|
$("#errortip").hide();
|
2015-10-15 12:04:55 +08:00
|
|
|
|
}else{
|
|
|
|
|
$("#hint").hide();
|
2016-06-30 16:08:36 +08:00
|
|
|
|
$("#errortip").hide();
|
2015-10-15 12:04:55 +08:00
|
|
|
|
}
|
|
|
|
|
}else{
|
2015-10-15 17:06:42 +08:00
|
|
|
|
$("#search_school_result_list").html('');
|
|
|
|
|
str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value;
|
2016-08-03 10:36:03 +08:00
|
|
|
|
$("#hint").html('如果找不到自己的单位,您可以<a style="color:#64bdd9" onclick="apply_add_school();" href="javascript:void(0);">添加单位</a>');
|
2015-10-15 12:04:55 +08:00
|
|
|
|
$("#hint").show();
|
2016-06-30 16:08:36 +08:00
|
|
|
|
$("#errortip").show();
|
2015-10-15 12:04:55 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2015-10-19 09:55:19 +08:00
|
|
|
|
}
|
2015-10-15 12:04:55 +08:00
|
|
|
|
$(document.body).click(function(e){
|
2015-10-15 13:54:37 +08:00
|
|
|
|
if($(e.target).attr("id") != 'search_school_result_list' && $(e.target).attr("id") != 'province')
|
2015-10-15 12:04:55 +08:00
|
|
|
|
{
|
|
|
|
|
$("#search_school_result_list").hide();
|
|
|
|
|
$("#hint").hide();
|
2016-06-30 16:08:36 +08:00
|
|
|
|
$("#errortip").hide();
|
2015-10-15 12:04:55 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
2015-12-18 15:22:29 +08:00
|
|
|
|
$("input[name='province']").on('focus', function (e) {
|
|
|
|
|
if( $("input[name='occupation']").val() != ''){ //如果已经有id了。肯定存在,不用去找了。
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value+'&page='+page,
|
|
|
|
|
type: 'post',
|
|
|
|
|
success: function (data) {
|
|
|
|
|
schoolsResult = data.schools;
|
|
|
|
|
count = data.count;
|
|
|
|
|
maxPage = Math.ceil(count/100) //最大页码值
|
|
|
|
|
if(schoolsResult.length != undefined && schoolsResult.length != 0) {
|
|
|
|
|
var i = 0;
|
|
|
|
|
$("#search_school_result_list").html('');
|
|
|
|
|
for (; i < schoolsResult.length; i++) {
|
|
|
|
|
link = '<a onclick="window.changeValue(\'' + schoolsResult[i].school.name.replace(/\s/g," ") + '\',\'' + schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + schoolsResult[i].school.name + '</a><br/>';
|
|
|
|
|
$("#search_school_result_list").append(link);
|
|
|
|
|
}
|
|
|
|
|
$("#search_school_result_list").css('left', $(e.target).offset().left);
|
|
|
|
|
$("#search_school_result_list").css('top', $(e.target).offset().top + 28);
|
|
|
|
|
$("#search_school_result_list").css("position", "absolute");
|
|
|
|
|
$("#search_school_result_list").show();
|
|
|
|
|
if($(e.target).val().trim() != '') {
|
|
|
|
|
str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value;
|
2016-06-30 16:08:36 +08:00
|
|
|
|
$("#hint").html('找到了' + count + '个包含"' + str + '"的高校(单位)');
|
2015-12-18 15:22:29 +08:00
|
|
|
|
$("#hint").show();
|
2016-06-30 16:08:36 +08:00
|
|
|
|
$("#errortip").hide();
|
2015-12-18 15:22:29 +08:00
|
|
|
|
}else{
|
|
|
|
|
$("#hint").hide();
|
2016-06-30 16:08:36 +08:00
|
|
|
|
$("#errortip").hide();
|
2015-12-18 15:22:29 +08:00
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
$("#search_school_result_list").html('');
|
|
|
|
|
str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value;
|
2016-06-30 16:08:36 +08:00
|
|
|
|
$("#hint").html('您输入的名称尚不存在,<a style="color:#64bdd9" onclick="apply_add_school();" href="javascript:void(0);">申请添加</a>');
|
2015-12-18 15:22:29 +08:00
|
|
|
|
$("#hint").show();
|
2016-06-30 16:08:36 +08:00
|
|
|
|
$("#errortip").show();
|
2015-12-18 15:22:29 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
2015-10-15 12:04:55 +08:00
|
|
|
|
|
|
|
|
|
// $("#province").leanModal({top: 100, closeButton: ".modal_close"});
|
2015-07-09 15:27:49 +08:00
|
|
|
|
|
|
|
|
|
//地区
|
|
|
|
|
var province = "<%= "#{province}" %>"
|
|
|
|
|
var city = "<%= "#{city}" %>"
|
|
|
|
|
init_province_and_city(document.getElementById('userProvince'), province, document.getElementById('userCity'), city);
|
|
|
|
|
|
|
|
|
|
//select
|
|
|
|
|
var identity = "<%= "#{identity}" %>"
|
|
|
|
|
var title = "<%= "#{title}" %>"
|
|
|
|
|
var language = "<%= "#{language}" %>"
|
|
|
|
|
var occupation1 = "<%= "#{occupation}" %>"
|
|
|
|
|
init_identity_and_title(document.getElementById('userIdentity'), identity, document.getElementById('userTechnical_title'), title, language);
|
|
|
|
|
|
2015-09-10 15:01:59 +08:00
|
|
|
|
//sex
|
|
|
|
|
var gender = "<%= "#{gender}" %>"
|
|
|
|
|
init_gender(document.getElementById('gender'), gender);
|
|
|
|
|
|
2015-07-09 15:27:49 +08:00
|
|
|
|
$("#userIdentity").change();
|
|
|
|
|
<% if( !@act.nil? && @act == 'password') %>
|
|
|
|
|
$("#users_tb_2").click();
|
|
|
|
|
<% end %>
|
2016-06-30 16:08:36 +08:00
|
|
|
|
|
|
|
|
|
$('#my_account_form_link').on("click",(function(e){
|
|
|
|
|
//$('#my_account_form_link').click(function(e){
|
2015-11-02 14:51:56 +08:00
|
|
|
|
if($("#userIdentity").val() == -1 ) {
|
|
|
|
|
$("#identity_hint").html('<span style="color:red">请选择身份</span>').show();
|
|
|
|
|
e.stopImmediatePropagation();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2015-10-15 12:04:55 +08:00
|
|
|
|
if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话
|
2016-06-30 16:08:36 +08:00
|
|
|
|
$("#hint").html('<span style="color:red">单位名称必须是从下拉列表中选择的,不能手动修改</span>').show();
|
|
|
|
|
e.stopImmediatePropagation();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//姓名不能为空
|
|
|
|
|
if( $("#lastname").val() == '' ){
|
|
|
|
|
$("#lastname").focus();
|
|
|
|
|
e.stopImmediatePropagation();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( $("input[name='province']").val().trim() == '' ){ //学校名字必须填写
|
|
|
|
|
$("#hint").html('<span style="color:red">高校(单位)名称不能为空</span>').show();
|
2015-10-16 16:56:27 +08:00
|
|
|
|
e.stopImmediatePropagation();
|
2015-10-15 12:04:55 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
2016-06-30 16:08:36 +08:00
|
|
|
|
|
|
|
|
|
if($("#no").is(":visible") == true && $("#no").val() == ""){
|
|
|
|
|
$("#no").focus();
|
|
|
|
|
e.stopImmediatePropagation();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-18 11:36:12 +08:00
|
|
|
|
$('#my_account_form_btn').click();
|
2016-06-30 16:08:36 +08:00
|
|
|
|
}));
|
2015-07-18 11:36:12 +08:00
|
|
|
|
$('#my_password_form_link').click(function(){
|
|
|
|
|
$('#my_password_form_btn').click();
|
|
|
|
|
});
|
2015-07-09 15:27:49 +08:00
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
function g(o){return document.getElementById(o);}
|
|
|
|
|
function HoverLi(n){
|
|
|
|
|
for(var i=1;i<=2;i++){g('users_tb_'+i).className='users_normaltab';g('users_tbc_0'+i).className='users_undis';}g('users_tbc_0'+n).className='users_dis';g('users_tb_'+n).className='users_hovertab';
|
|
|
|
|
}
|
2014-05-09 17:08:42 +08:00
|
|
|
|
</script>
|