Merge branch 'szzh' into develop

This commit is contained in:
sw 2014-12-19 14:46:56 +08:00
commit 63c773bea0
23 changed files with 250 additions and 92 deletions

View File

@ -202,7 +202,16 @@ class AccountController < ApplicationController
def email_valid
end
def resendmail
user = User.find(params[:user]) if params[:user]
token = Token.new(:user => user, :action => "register")
if token.save
Mailer.register(token).deliver
else
yield if block_given?
end
end
private
def authenticate_user

View File

@ -23,7 +23,7 @@ class CoursesController < ApplicationController
before_filter :require_login, :only => [:join, :unjoin]
#before_filter :allow_join, :only => [:join]
@@result = nil
def join
if User.current.logged?
course = Course.find_by_id params[:object_id]
@ -296,6 +296,7 @@ class CoursesController < ApplicationController
else
@results = searchStudent(@course)
end
@@result = @results
@members = searchStudent(@course)
@membercount = @members.count
@results = paginateHelper @results
@ -308,6 +309,7 @@ class CoursesController < ApplicationController
@members = searchStudent(@course)
@membercount = @members.count
@results = searchStudent_by_group(group, @course)
@@result = @results
@results = paginateHelper @results
end
def member
@ -326,13 +328,14 @@ class CoursesController < ApplicationController
when '2'
@subPage_title = l :label_student_list
@members = searchStudent(@course)
@members = searchStudent_sort(@course, 'desc')
@membercount = @members.count
else
@subPage_title = ''
@members = @course.member_principals.includes(:roles, :principal).all.sort
end
@@result = @members
@members = paginateHelper @members
render :layout => 'base_courses'
else
@ -340,6 +343,21 @@ class CoursesController < ApplicationController
end
end
def member_score_sort
@teachers= searchTeacherAndAssistant(@course)
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
@role = params[:role]
@course_groups = @course.course_groups if @course.course_groups
@show_serch = params[:role] == '2'
@subPage_title = l :label_student_list
@render_file = 'member_list'
unless @@result.nil?
@results = @@result.reverse
@@result = @results
end
@results = paginateHelper @results
end
# 显示每个学生的作业评分详情
def show_member_score
@member_score = Member.find(params[:member_id]) if params[:member_id]

View File

@ -175,18 +175,24 @@ module CoursesHelper
end
members
end
def search_student_and_score project
def searchStudent_sort project, sort_by
#searchPeopleByRoles(project, StudentRoles)
members = []
scores = []
project.members.each do |m|
if m && m.user && m.user.allowed_to?(:as_student,project)
members << m
end
end
members.sort!{ |mem1, mem2| mem1.student_homework_score[1].to_f <=> mem2.student_homework_score[1].to_f}
if sort_by == "desc"
members.reverse!
end
members
end
def searchStudent_by_name project, name
#searchPeopleByRoles(project, StudentRoles)
members = []

View File

@ -4,7 +4,7 @@
<title>注册帐号</title>
<style type="text/css">
#jihuo {
background-image: url("./images/jingtanhao.JPG");
background-image: url("/images/jingtanhao.JPG");
}
</style>
</head>
@ -32,7 +32,9 @@
border: none;
padding: 10px 16px;
line-height: 1.33;" target="_blank">立即查收邮件</a></p>
line-height: 1.33;" target="_blank">立即查收邮件</a>
&nbsp; &nbsp; <%= link_to l(:label_mail_resend), { :controller => 'account', :action => 'resendmail',:user => @user}, :remote => true, :method => 'get' %>
</p>

View File

@ -22,7 +22,7 @@
<%= error_messages_for 'bid' %>
<p>
<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :onblur => "regexName();" %>
<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :onkeyup => "regexName();" %>
</p>
<p>
<span id="bid_name_span"></span>
@ -48,7 +48,7 @@
<span id='open_anonymous_evaluation_span' style="display: none">未开启匿评作业将直接进入众评点赞阶段</span>
</p>
<p id="evaluation_num_p">
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%>
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onkeyup => "regexEvaluationNum();" , :maxlength => 4%>
<span id="bid_evaluation_num_span">即每份作业被允许匿评的人数</span>
</p>
<p>

View File

@ -60,7 +60,7 @@
:size => 60,
:maxlength => 60,
:style => "width:488px;",
:onblur => "regexTitle();"
:onkeyup => "regexTitle();"
%>
</p>
<span id="title_span" style="padding-left: 100px;"></span>
@ -71,7 +71,7 @@
:rows => 11,
:class => 'wiki-edit',
:style => "width:490px;",
:onblur => "regexDescription();"
:onkeyup => "regexDescription();"
%>
</p>
<span id="description_span" style="padding-left: 100px;"></span>

View File

@ -121,7 +121,7 @@
:required => true,
:size => 60,
:style => "width:320px;",
:onblur => "regexName();"
:onkeyup => "regexName();"
%>
<span style="font-size: 10px;" id="spane_name_notice">(<%= l(:label_workname_lengthlimit) %>)</span>
@ -143,7 +143,7 @@
:required => true,
:size => 60,
:rows => 3,
:onblur => 'regexDescription();',
:onkeyup => 'regexDescription();',
:style => "width:320px; "
%>
<span style="font-size: 10px;" id="span_sofapplication_description">(<%= l(:label_work_description_lengthlimit) %>)</span>
@ -162,7 +162,7 @@
:required => true,
:size => 60,
:style => "width:320px;",
:onblur => 'regexDevelopers();'
:onkeyup => 'regexDevelopers();'
%>
<span style="font-size: 10px; " id="span_softapplication_application_developers">

View File

@ -43,10 +43,10 @@
if(regexName()){$("#contests_serch").submit();}
}
</script>
<%= text_field_tag 'name', params[:name], :size => 30, :onblur => 'regexName();' %>
<%= text_field_tag 'name', params[:name], :size => 30, :onkeyup => 'regexName();' %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10">
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="padding-top: 7px !important;">
<%= l(:label_search)%>
</a>
<br />

View File

@ -24,7 +24,7 @@
<p>
<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;",
:maxlength => Bid::NAME_LENGTH_LIMIT,
:onblur => "regexName();" %>
:onkeyup => "regexName();" %>
</p>
<p>
@ -53,7 +53,7 @@
<span id='open_anonymous_evaluation_span' style="display: none">未开启匿评作业将直接进入众评点赞阶段</span>
</p>
<p id="evaluation_num_p">
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%>
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onkeyup => "regexEvaluationNum();" , :maxlength => 4%>
<span id="bid_evaluation_num_span">即每份作业被允许匿评的人数</span>
</p>
<p>

View File

@ -1,3 +1,13 @@
<script type=" text/javascript" charset="utf-8">
function change_pic(id){
var classname = document.getElementById(id).className
if(classname == 'st_up') {
document.getElementById(id).className = 'st_down'
}
else
document.getElementById(id).className = 'st_up'
}
</script>
<div style="margin-left: 15px" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
<% if User.current.logged? && User.current.member_of_course?(@course) && @group %>
<% if !@canShowCode %>
@ -30,13 +40,15 @@
<div class="st_box">
<ul class="st_box_top">
<% if @subPage_title == l(:label_student_list) %>
<li class="ml358"><a href="#" >作业积分</a><a href="#" class="st_down"></a></li>
<li class="ml358"><%= link_to '作业积分', member_score_sort_course_path ,method: 'get', remote: true, :onclick => "change_pic('pic')"%>
<a id="pic" href="#" class="st_down"></a></li>
<li class="ml50"><a href="#" >加入时间</a></li>
<% else %>
<li class="ml50" style="margin-left: 470px"><a href="#" >加入时间</a></li>
<li class="ml50" style="margin-left: 470px"><li class="ml50"><a href="#" >加入时间</a></li>
<% end %>
</ul>
<div id="list_detail">
<% members.each do |member| %>
<div class="cl"></div><!--st_box_top end-->
@ -86,6 +98,7 @@
</div>
<% end; reset_cycle %>
</div>
</div>
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>
<% else %>
<p class="nodata">

View File

@ -0,0 +1,48 @@
<% members.each do |member| %>
<div class="cl"></div><!--st_box_top end-->
<div class="st_boxlist">
<% next if member.new_record? %>
<a href="#" class="st_img" style="float:left;"> <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 40, :height => 40)) %></a>
<ul style="margin-left: 15px">
<% if @canShowCode %>
<li>
<%= l(:label_bidding_user_studentname) %> :
<%= link_to member.user.show_name, user_path(member.user) %>
</li> </br>
<%#= content_tag "li", "#{l(:label_bidding_user_studentname)}#{' : '}"link_to(member.user.show_name, user_path(member.user)) %>
<% else %>
<%= content_tag "li", link_to(member.user.name, user_path(member.user)) %>
<% end %>
<!--teacher's code disapeared moified by huang-->
<% if @canShowCode %>
<li>
<%= l(:label_bidding_user_studentcode) %> :
<%= link_to member.user.user_extensions.student_id, user_path(member.user) %>
</li>
<%#= content_tag "li", "#{l(:label_bidding_user_studentcode)}#{' : '}#{member.user.user_extensions.student_id}", :style=> "color:#1c9ec7;" %>
<% end %>
</ul>
<% if @subPage_title == l(:label_student_list) %>
<%= link_to member.student_homework_score[1].to_s, {
:action => 'show_member_score',
:member_id => member.id,
:remote => true},
:class => 'ml258 c_red', :style => "color:red;" %>
<% unless member.created_on.nil? %>
<%= content_tag "span", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "ml65 c_grey" %>
<% end %>
<% else %>
<% unless member.created_on.nil? %>
<%= content_tag "span", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "ml65 c_grey", :style=>"margin-left:195px" %>
<% end %>
<% end %>
<%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %>
</div>
<% end; reset_cycle %>

View File

@ -0,0 +1,4 @@
/**
* Created by Administrator on 2014/12/3.
*/
$("#list_detail").html("<%= escape_javascript( render :partial => 'member_list_detail', :locals => {:members => @results})%>");

View File

@ -69,7 +69,7 @@
<%= f.text_area 'user_message', :rows => 3, :cols => 65,
:value => "#{comprehensive_evaluation.nil? ? l(:label_leave_a_message) : comprehensive_evaluation}",
:onfocus => "clearInfo('new_form_user_message','#{l(:label_leave_a_message)}')",
:onblur => "showInfo('new_form_user_message','#{l(:label_leave_a_message)}')",
:onkeyup => "showInfo('new_form_user_message','#{l(:label_leave_a_message)}')",
:style => "resize: none;", :class => 'noline'%>
</td>
</tr>

View File

@ -64,7 +64,7 @@
<span class="c_red">*</span>
&nbsp;&nbsp;作品名称&nbsp;&nbsp;&nbsp;&nbsp;
</label>
<%= f.text_field :name, :required => true, :name => "homework_name", :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称", :onblur => "regexName();"%>
<%= f.text_field :name, :required => true, :name => "homework_name", :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称", :onkeyup => "regexName();"%>
<span id="homework_attach_name_span"></span>
</p>
<p>

View File

@ -68,7 +68,7 @@
</span>
&nbsp;&nbsp;作品名称&nbsp;&nbsp;&nbsp;&nbsp;
</label>
<%= f.text_field "name", :required => true, :size => 60, :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称", :onblur => "regexName();" %>
<%= f.text_field "name", :required => true, :size => 60, :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称", :onkeyup => "regexName();" %>
<span id="homework_attach_name_span"></span>
</p>
<p>
@ -78,7 +78,7 @@
</span>
&nbsp;&nbsp;作品描述&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</label>
<%= f.text_area "description", :class => "w620", :maxlength => 3000, :placeholder => "最多3000个汉字", :onblur => "regexDescription();"%>
<%= f.text_area "description", :class => "w620", :maxlength => 3000, :placeholder => "最多3000个汉字", :onkeyup => "regexDescription();"%>
<span id="homework_attach_description_span" style="padding-left: 100px;"></span>
</p>
<div class="cl"></div>

View File

@ -36,11 +36,38 @@
<strong><%= l(:label_user_location) %> : </strong>
</td>
<td rowspan="2" width="250px">
<script type="text/javascript">
function regexName()
{
var name = $.trim($("#name").val());
if(name.length == 0)
{
$("#contest_name_span").text("<%= l(:label_search_conditions_not_null) %>");
$("#contest_name_span").css('color','#ff0000');
$("#contest_name_span").focus();
return false;
}
else
{
$("#contest_name_span").text("");
return true;
}
}
function submitSerch()
{
if(regexName()){$("#contst_search_form").submit();}
}
</script>
<div class="project-search">
<%= form_tag({controller: 'contests', action: 'index'}, method: :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20 %>
<%= form_tag({controller: 'contests', action: 'index'}, method: :get, :id => "contst_search_form") do %>
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => 'regexName();' %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="padding-top: 7px !important;">
<%= l(:label_search)%>
</a>
<span id="contest_name_span"></span>
<% end %>
</div>
</td>

View File

@ -40,10 +40,38 @@
</td>
<td rowspan="2" width="250px">
<div class="top-content-search">
<%= form_tag(projects_search_path, :method => :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20 %>
<script type="text/javascript">
function regexName()
{
var name = $.trim($("#name").val());
if(name.length == 0)
{
$("#project_name_span").text("<%= l(:label_search_conditions_not_null) %>");
$("#project_name_span").css('color','#ff0000');
$("#project_name_span").focus();
return false;
}
else
{
$("#project_name_span").text("");
return true;
}
}
function submitSerch()
{
if(regexName()){$("#project_search_form").submit();}
}
</script>
<%= form_tag(projects_search_path, :method => :get, :id => "project_search_form") do %>
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => "regexName();" %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="padding-top: 7px !important;">
<%= l(:label_search)%>
</a>
<br />
<span id="project_name_span"></span>
<% end %>
</div>
</td>

View File

@ -49,7 +49,7 @@
<% if replying %>
<%= f.text_field :subject, { size: 60, style: "width: 99%;", id: "message_subject" }.merge(extra_option) %>
<% else %>
<%= f.text_field :subject, { size: 60, style: "width: 99%;", id: "message_subject", onblur: "regexSubject();" }.merge(extra_option) %>
<%= f.text_field :subject, { size: 60, style: "width: 99%;", id: "message_subject", onkeyup: "regexSubject();" }.merge(extra_option) %>
<% end %>
<span id="subject_span"></span>
</p>
@ -75,7 +75,7 @@
</p>
<p>
<%= label_tag "message_content", l(:description_message_content), :class => "hidden-for-sighted" %>
<%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content', :onblur => "regexContent();", :maxlength => 5000 %>
<%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000 %>
<span id="message_content_span"></span>
</p>
<p>

View File

@ -3,10 +3,10 @@
<%= is_new ? l(:bale_news_notice):l(:bale_edit_notice)%>
</div>
<div class="box tabular">
<p><%= f.text_field :title, :required => true, :size => 60, :style => "width:468px;", :onblur => "regexTitle();" %></p>
<p><%= f.text_field :title, :required => true, :size => 60, :style => "width:468px;", :onkeyup => "regexTitle();" %></p>
<P><span id="title_notice_span">(60个字符以内)</span></P>
<!-- <p style="margin-left:-10px;"><%#= f.text_area :summary, :cols => 60, :rows => 2, :style => "width:490px;margin-left:10px;" %></p> -->
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:470px;", :onblur => "regexDescription();" %></p>
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:470px;", :onkeyup => "regexDescription();" %></p>
<P><span id="description_notice_span"></span></P>
<p id="attachments_form" style="margin-left:-10px;"><label style="padding-right: 15px;"><%= l(:label_attachment_plural) %></label><%= render :partial => 'attachments/form', :locals => {:container => @news} %></p>
</div>

View File

@ -3,10 +3,10 @@
<%= @project ? l(:label_news_new) : l(:bale_news_notice) %>
</div>
<div class="box tabular">
<p><%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;", :onblur => "regexTitle();" %></p>
<p><%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;", :onkeyup => "regexTitle();" %></p>
<P><span id="title_notice_span">(60个字符以内)</span></P>
<!-- <p style="margin-left:-10px;"><%#= f.text_area :summary, :cols => 60, :rows => 2, :style => "width:490px;margin-left:10px;" %></p> -->
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;", :onblur => "regexDescription();" %></p>
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;", :onkeyup => "regexDescription();" %></p>
<P><span id="description_notice_span"></span></P>
<p id="attachments_form" style="margin-left:-10px;"><label style="padding-right: 15px;"><%= l(:label_attachment_plural) %></label><%= render :partial => 'attachments/form', :locals => {:container => @news} %></p>
</div>

View File

@ -1609,6 +1609,7 @@ zh:
label_tags_user_mail: 用户邮箱:
label_tags_user_name: 用户名:
label_tags_numbers: Tag统计
label_mail_resend: 重新发送激活邮件
label_max_number: 登录名是在网站中显示的您的公开标识,只能为英文和数字。
label_mail_attention: qq邮箱可能收不到此邮件其他邮箱如果没有收到可能在垃圾邮件中
label_mail_attention1: 其中gmail与教育网邮箱的激活邮件有时比较慢请耐心等待。

View File

@ -207,8 +207,8 @@ RedmineApp::Application.routes.draw do
match 'account/lost_password', :via => [:get, :post], :as => 'lost_password'
match 'account/activate', :via => :get
match 'account/valid_ajax', :via => :get
get 'account/email_valid', :to => 'account#email_valid'
match 'account/email_valid', :to => 'account#email_valid', :via => :get
match 'account/resendmail', :to => 'account#resendmail', :via=> :get
match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post
match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post]
@ -646,6 +646,7 @@ RedmineApp::Application.routes.draw do
post 'restartcourse'
match "searchmembers", :controller => 'courses', :action => 'searchmembers', :via => [:post,:get]
match "searchgroupmembers", :via => [:post, :get]
match 'member_score_sort', :via => [:get]
match "updategroupname", :via => [:post, :get]
match "addgroups", :via => [:post, :get]
match 'deletegroup', :via => [:delete]

View File

@ -856,10 +856,10 @@ table.content-text-list tbody tr td.locked, div.memo-section .locked {
*******************************************************************************/
.line_block {
display: inline-block;
width: 49%;
margin: 10px auto;
width: 47%;
/*margin: 10px auto;*/
vertical-align: top;
padding: 0px 2%;
padding: 0px 1%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-box-sizing: border-box;
@ -869,6 +869,7 @@ table.content-text-list tbody tr td.locked, div.memo-section .locked {
.resource_sum {
height: auto;
width: 100%;
}
.line_block p {