Merge branch 'sw_new_course' of http://repository.trustie.net/xianbo/trustie2 into sw_new_course

This commit is contained in:
z9hang 2015-03-26 11:02:35 +08:00
commit 94fd3060ae
8 changed files with 227 additions and 252 deletions

View File

@ -178,22 +178,19 @@ class CoursesController < ApplicationController
def searchmembers
@subPage_title = l :label_student_list
@render_file = 'member_list'
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
@is_remote = true
@canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1'
# @is_remote = true
@score_sort_by = "desc"
q = "#{params[:name].strip}"
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
if params[:incourse]
@results = searchmember_by_name(student_homework_score(0,0,0,"desc"), q)
results = searchmember_by_name(student_homework_score(0,0,0,"desc"), q)
elsif params[:ingroup]
@group = CourseGroup.find(params[:search_group_id])
@results = searchmember_by_name(student_homework_score(@group.id,0,0,"desc"), q)
results = searchmember_by_name(student_homework_score(@group.id,0,0,"desc"), q)
end
@is_remote = true
@result_count = @results.count
@results = paginateHelper @results, 10
@result_count = results.count
@results = paginateHelper results, 10
@search_name = q
end
@ -298,7 +295,7 @@ class CoursesController < ApplicationController
@render_file = 'member_list'
@score_sort_by = "desc"
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
@canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1'
@role = params[:role].nil? ? '2':params[:role]
@is_remote = true
@course_groups = @course.course_groups if @course.course_groups
@ -311,8 +308,8 @@ class CoursesController < ApplicationController
when '2'
@subPage_title = l :label_student_list
page = params[:page].nil? ? 0 : (params['page'].to_i - 1)
# @all_members = student_homework_score(0,page, 10,"desc")
@all_members = @course.members
@all_members = student_homework_score(0,page, 10,"desc")
# @all_members = @course.members
@members = paginateHelper_for_members @all_members, 10
end
respond_to do |format|
@ -798,38 +795,38 @@ class CoursesController < ApplicationController
if groupid == 0
if nums == 0
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id}) GROUP BY members.user_id
UNION all
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id} AND
students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
)
GROUP BY members.user_id ORDER BY score #{score_sort_by}"
WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id}) GROUP BY members.user_id
UNION all
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id} AND
students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
)
GROUP BY members.user_id ORDER BY score #{score_sort_by}"
else
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id}) GROUP BY members.user_id
UNION all
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id} AND
students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
)
GROUP BY members.user_id ORDER BY score #{score_sort_by} limit #{start_from}, #{nums}"
WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id}) GROUP BY members.user_id
UNION all
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id} AND
students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
)
GROUP BY members.user_id ORDER BY score #{score_sort_by} limit #{start_from}, #{nums}"
end
else
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
and members.course_group_id = #{groupid} AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id})
GROUP BY members.user_id
UNION all
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id}
and members.course_group_id = #{groupid} AND
students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
)
GROUP BY members.user_id ORDER BY score #{score_sort_by}"
WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
and members.course_group_id = #{groupid} AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id})
GROUP BY members.user_id
UNION all
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id}
and members.course_group_id = #{groupid} AND
students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
)
GROUP BY members.user_id ORDER BY score #{score_sort_by}"
end
sql = ActiveRecord::Base.connection()
homework_scores = Member.find_by_sql(sql_select)

View File

@ -1,173 +1,26 @@
<div class="st_list">
<div class="st_search">
<form class="f_l"><input type="text" name="" value="输入学生姓名、学号进行搜索" class="st_search_input"/></form>
<a href="#" class="f_l">搜索</a>
<%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:remote=>true,:id => "search_student") do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 'st_search_input', :placeholder => '输入学生姓名、学号进行搜索'%>
<% if @group %>
<%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %>
<input type="hidden" name="ingroup">
<% else %>
<input type="hidden" name="incourse">
<% end %>
<% end %>
<a href="javascript:" class="f_l" onclick="$('#search_student').submit();">搜索</a>
<%= link_to l(:label_export_excel), export_course_member_excel_course_path(@course,:format => 'xls'),:class=>'xls'%>
</div>
<div class="cl"></div>
<div class="st_addclass">
<ul>
<li style=" color:#8b8b8b;">分班:</li>
<li class="classbox">
<a href="#">全部</a>
</li>
<li class="classbox_on">
<a href="#">A班<span class="c_red">29人</span></a><a href="#" onClick="sAlert('温馨提示:已有学生加入该班级,不能删除该班级,仅可编辑班级名称。');" style="margin-right:5px;" ><img src="images/courses/pic_del.gif" width="11" height="12" alt="删除班级" title="删除该班级" /></a>
<a href="javascript:void(0)" class="f_l" onclick="$('#add_tag01').slideToggle();"><img src="images/courses/pic_edit.png" width="14" height="15" alt="编辑班级 "title="编辑该班级" /></a>
</li>
<li>
<span id="add_tag01" style="display:none; vertical-align: middle;" class=" f_l">
<input type="text" id="" name="" size="20" class="isTxt w90 f_l" maxlength="100" />
<input type="button" class="submit f_l" onclick="addTag();"/>
</span>
</li>
<li class="classbox">
<a href="#">B班<span class="c_red">29人</span></a><a href="#" style="margin-right:5px;" ><img src="images/courses/pic_del.gif" width="11" height="12" alt="删除班级" title="删除该班级"/></a>
<a href="javascript:void(0)" class="f_l" onclick="$('#add_tag02').slideToggle();"><img src="images/courses/pic_edit.png" width="14" height="15" alt="编辑班级" title="编辑该班级" /></a>
</li>
<li>
<span id="add_tag02" style="display:none; vertical-align: middle;" class=" f_l">
<input type="text" id="" name="" size="20" class="isTxt w90 f_l" maxlength="100" />
<input type="button" class="submit f_l" onclick="addTag();"/>
</span>
</li>
<li class="classbox">
<a href="#">C班<span class="c_red">29人</span></a><a href="#" style="margin-right:5px;" ><img src="images/courses/pic_del.gif" width="11" height="12" alt="删除班级" title="删除该班级"/></a>
<a href="javascript:void(0)" class="f_l" onclick="$('#add_tag03').slideToggle();"><img src="images/courses/pic_edit.png" width="14" height="15" alt="编辑班级" title="编辑该班级" /></a>
</li>
<li>
<span id="add_tag03" style="display:none; vertical-align: middle;" class=" f_l">
<input type="text" id="" name="" size="20" class="isTxt w90 f_l" maxlength="100" />
<input type="button" class="submit f_l" onclick="addTag();"/>
</span>
</li>
<li style="margin-left:15px;">
<a href="javascript:void(0)" class="st_add f_l" onclick="$('#add_tag04').slideToggle();">+添加分班</a>
</li>
<li>
<span id="add_tag04" style="display:none; vertical-align: middle;" class="ml10 f_l">
<input type="text" id="" name="" size="20" class="isTxt w90 f_l" maxlength="100" />
<input type="button" class="submit f_l" onclick="addTag();"/>
</span>
</li>
</ul>
<%= render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups} %>
</div>
<div class="cl"></div>
<div class="st_box">
<ul class="st_box_top">
<li class="ml50"><a href="#">姓名</a><a href="#" class="st_up"></a></li>
<li class="ml10"><a href="#">学号</a><a href="#" class="st_down"></a></li>
<li class="ml358"><a href="#" >作业积分</a><a href="#" class="st_down"></a></li>
<li class="ml50"><a href="#" >加入时间</a></li>
</ul>
<div class="cl"></div><!--st_box_top end-->
<div class="st_boxlist">
<a href="#" class="st_img"><img src="images/courses/pic_01.jpg" width="32" height="32" alt="学生" /></a>
<ul>
<li ><a href="#">姓名:<span >阿里巴巴</span></a></li><br />
<li><a href="#">学号:<span>123456</span></a></li>
</ul>
<a href="#" class="ml258 c_red">4.2</a>
<span class="ml65 c_grey">2014-11-27</span>
</div>
<div class="cl"></div><!--st_boxlist end-->
<div class="st_boxlist">
<a href="#" class="st_img"><img src="images/courses/pic_01.jpg" width="32" height="32" alt="学生" /></a>
<ul>
<li ><a href="#">姓名:<span >阿里巴巴</span></a></li><br />
<li><a href="#">学号:<span>123456</span></a></li>
</ul>
<a href="#" class="ml258 c_red">4.2</a>
<span class="ml65 c_grey">2014-11-27</span>
</div>
<div class="cl"></div><!--st_boxlist end-->
<div class="st_boxlist">
<a href="#" class="st_img"><img src="images/courses/pic_01.jpg" width="32" height="32" alt="学生" /></a>
<ul>
<li ><a href="#">姓名:<span >阿里巴巴</span></a></li><br />
<li><a href="#">学号:<span>123456</span></a></li>
</ul>
<a href="#" class="ml258 c_red">4.2</a>
<span class="ml65 c_grey">2014-11-27</span>
</div>
<div class="cl"></div><!--st_boxlist end-->
<div class="st_boxlist">
<a href="#" class="st_img"><img src="images/courses/pic_01.jpg" width="32" height="32" alt="学生" /></a>
<ul>
<li ><a href="#">姓名:<span >阿里巴巴</span></a></li><br />
<li><a href="#">学号:<span>123456</span></a></li>
</ul>
<a href="#" class="ml258 c_red">4.2</a>
<span class="ml65 c_grey">2014-11-27</span>
</div>
<div class="cl"></div><!--st_boxlist end-->
<div class="st_boxlist">
<a href="#" class="st_img"><img src="images/courses/pic_01.jpg" width="32" height="32" alt="学生" /></a>
<ul>
<li ><a href="#">姓名:<span >阿里巴巴</span></a></li><br />
<li><a href="#">学号:<span>123456</span></a></li>
</ul>
<a href="#" class="ml258 c_red">4.2</a>
<span class="ml65 c_grey">2014-11-27</span>
</div>
<div class="cl"></div><!--st_boxlist end-->
<div class="st_boxlist">
<a href="#" class="st_img"><img src="images/courses/pic_01.jpg" width="32" height="32" alt="学生" /></a>
<ul>
<li ><a href="#">姓名:<span >阿里巴巴</span></a></li><br />
<li><a href="#">学号:<span>123456</span></a></li>
</ul>
<a href="#" class="ml258 c_red">4.2</a>
<span class="ml65 c_grey">2014-11-27</span>
</div>
<div class="cl"></div><!--st_boxlist end-->
<div class="st_boxlist">
<a href="#" class="st_img"><img src="images/courses/pic_01.jpg" width="32" height="32" alt="学生" /></a>
<ul>
<li ><a href="#">姓名:<span >阿里巴巴</span></a></li><br />
<li><a href="#">学号:<span>123456</span></a></li>
</ul>
<a href="#" class="ml258 c_red">4.2</a>
<span class="ml65 c_grey">2014-11-27</span>
</div>
<div class="cl"></div><!--st_boxlist end-->
<div class="st_boxlist">
<a href="#" class="st_img"><img src="images/courses/pic_01.jpg" width="32" height="32" alt="学生" /></a>
<ul>
<li ><a href="#">姓名:<span >阿里巴巴</span></a></li><br />
<li><a href="#">学号:<span>123456</span></a></li>
</ul>
<a href="#" class="ml258 c_red">4.2</a>
<span class="ml65 c_grey">2014-11-27</span>
</div>
<div class="cl"></div><!--st_boxlist end-->
<div class="st_boxlist">
<a href="#" class="st_img"><img src="images/courses/pic_01.jpg" width="32" height="32" alt="学生" /></a>
<ul>
<li ><a href="#">姓名:<span >阿里巴巴</span></a></li><br />
<li><a href="#">学号:<span>123456</span></a></li>
</ul>
<a href="#" class="ml258 c_red">4.2</a>
<span class="ml65 c_grey">2014-11-27</span>
</div>
<div class="cl"></div><!--st_boxlist end-->
<div class="st_boxlist">
<a href="#" class="st_img"><img src="images/courses/pic_01.jpg" width="32" height="32" alt="学生" /></a>
<ul>
<li ><a href="#">姓名:<span >阿里巴巴</span></a></li><br />
<li><a href="#">学号:<span>123456</span></a></li>
</ul>
<a href="#" class="ml258 c_red">4.2</a>
<span class="ml65 c_grey">2014-11-27</span>
</div>
<div class="cl"></div><!--st_boxlist end-->
<div id="member_content">
<%= render :partial => 'new_member_list', :locals => {:members => members} %>
</div>
</div> <!-- st_list end-->
<ul class="wlist" >
<li><a href="#">下一页</a></li>
<li><a href="#">...</a></li>
<li><a href="#">2</a></li>
<li class="wlist_select" ><a href="#">1</a></li>
<li><a href="#">上一页</a></li>
</ul>
<div class="cl"></div>

View File

@ -1,9 +1,7 @@
<div style="margin-left: 15px" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
<div style="margin-left: 15px">
<% if User.current.logged? && User.current.member_of_course?(@course) && @group %>
<% if !@canShowCode %>
<%= join_in_course_group(@course.course_groups,@group, User.current) %>
<% end %>
<%= join_in_course_group(@course.course_groups,@group, User.current) unless @canShowCode %>
<span style="font-size: 12px; float: left; margin-right: 5px">
<%= l(:label_current_group)%>:&nbsp;
<%= @group.name %>

View File

@ -0,0 +1,52 @@
<ul>
<li style=" color:#8b8b8b;">分班:</li>
<li class="classbox">
<%= link_to l(:label_all), searchgroupmembers_course_path(@course,:group_id => 0), :onclick => "checkclass('group_name_0')", method: 'get', remote: true%>
</li>
<% unless course_groups.nil? %>
<% course_groups.each do |group| %>
<% group_name = " #{ group.name}( <span class='c_red'>#{group.members.count.to_s}人</span>)".html_safe %>
<li class="classbox" style="margin-bottom: 5px;">
<%= link_to group_name, searchgroupmembers_course_path(@course,:group_id => group.id), method: 'get', remote: true,:onclick => "checkclass('group_name_#{group.id}')"%>
<% if @canShowCode%>
<%= link_to '', deletegroup_course_path(:group_id => group.id), :method => 'delete', :remote => true,
:data => {confirm: l(:label_delete_group)},
:class => 'f_1',
:style => "width: 11px;height: 16px;margin-top:3px;margin-left:5px;background: url(/images/pic_del.gif) no-repeat 0 0;"
%>
<% else%>
<a href="javascript:" onClick="alert('温馨提示:已有学生加入该班级,不能删除该班级,仅可编辑班级名称。');" style="margin-right:4px;" >
<img src="/images/pic_del.gif" width="11" height="12" alt="删除班级" title="删除该班级" />
</a>
<% end %>
<a href="javascript:void(0)" class="f_l" style="padding-left: 5px;" onclick="$('#group_name_<%= group.id %>').value='';$('#edit_group_<%= group.id %>').slideToggle();">
<img src="/images/pic_edit.png" width="14" height="15" alt="编辑班级" />
</a>
</li>
<!-- 编辑分班 -->
<li>
<%= form_tag(updategroupname_course_path(@course,:group_id => group.id), method: 'get', remote:true, update: 'group_name') do %>
<span id="edit_group_<%= group.id %>" style="display:none; vertical-align: middle;" class=" f_l">
<input type="text" id="group_name_<%= group.id%>" name="group_name" size="20" class="isTxt w90 f_l" maxlength="100" />
<input type="button" class="submit f_l" onclick="edit_group('edit_group_<%= group.id%>');"/>
</span>
<% end %>
</li>
<% end %>
<% end %>
<% if @canShowCode %>
<li style="margin-left:15px;margin-top: 2px;">
<a href="javascript:void(0)" class="st_add f_l" onclick="$('#group_name').value='';$('#new_group_name').slideToggle();">+添加分班</a>
</li>
<li >
<span id="new_group_name" style="display:none; vertical-align: middle;" class="ml10 f_l">
<%= form_tag( addgroups_course_path(@course), method: 'get',:remote=>true) do %>
<input type="text" id="group_name" name="group_name" size="20" class="isTxt w90 f_l" maxlength="100" />
<input type="button" class="submit f_l" onclick="edit_group('group_name');"/>
<% end %>
</span>
</li>
<% end %>
</ul>

View File

@ -0,0 +1,74 @@
<!-- 加入分班 -->
<div style="margin-left: 15px">
<% if User.current.logged? && User.current.member_of_course?(@course) && @group %>
<%= join_in_course_group(@course.course_groups,@group, User.current) unless @canShowCode %>
<span style="font-size: 12px; float: left; margin-right: 5px">
<%= l(:label_current_group)%>:&nbsp;
<%= @group.name %>
</span>
<% end %>
</div>
<div class="cl"></div>
<% if members.any? %>
<% if @result_count %>
<p style="font-size: 18px;">
<%= l(:label_search_member_count) %>
<%= @result_count %>
<%= l(:label_member_people) %>
</p>
<div class="cl"></div>
<% end %>
<div class="st_box">
<ul class="st_box_top">
<li class="ml50" style="padding-right: 5px;"><a href="">姓名</a></li>
<li class="ml10" style="padding-right: 15px;"><a href="">学号</a></li>
<li class="ml358"><a href="#" >作业积分</a><a href="#" class="st_down"></a></li>
<li class="ml50"><a href="#" >加入时间</a></li>
</ul>
<div class="cl"></div><!--st_box_top end-->
<% members.each do |member| %>
<div class="st_boxlist">
<a href="javascript:" class="st_img">
<%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 32, :height => 32)) %>
</a>
<ul>
<% if @canShowCode %>
<li>
<% if member.user.show_name == ''%>
<%= link_to("#{l(:label_bidding_user_studentname)}<span >#{member.user.name}</span>".html_safe,user_path(member.user)) %>
<% else%>
<%= link_to("#{l(:label_bidding_user_studentname)}<span >#{member.user.show_name}</span>".html_safe,user_path(member.user)) %>
<%end%>
</li>
<% else %>
<li><%= link_to("#{l(:label_bidding_user_studentname)}<span >#{member.user.name}</span>".html_safe, user_path(member.user)) %></li>
<% end %>
<br/>
<% unless member.user.user_extensions.student_id == ''%>
<li><%= link_to("#{l(:label_bidding_user_studentcode)}<span >#{member.user.user_extensions.student_id}</span>".html_safe,user_path(member.user)) %></li>
<% end%>
</ul>
<%= link_to format("%0.2f",member.score.nil? ? 0 : member.score.to_s), {
:action => 'show_member_score',
:member_id => member.id,
:remote => true},
:class => 'ml258 c_red' %>
<span class="ml65 c_grey"><%= format_date(member.created_on)%></span>
<%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %>
</div>
<div class="cl"></div>
<% end; reset_cycle %>
</div>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul>
<% else%>
<p class="nodata">
<%= l(:label_no_data) %>
</p>
<% end%>

View File

@ -1,49 +1,3 @@
<script type="text/javascript">
function check_groupname() {
var $group_name = $('#group_name');
$.get(
'<%=valid_ajax_course_path%>',
{ valid: "name",
value: document.getElementById('group_name').value,
course_id: <%= @course.id %> },
function (data) {
if (!data.valid) {
alert(data.message);
}
});
}
function validate_groupname(value1) {
if(value1.length > 20) {
alert('<%= l(:label_limit_groupname) %>');
}
}
function checkclass(value) {
for(var i = 0; i < document.getElementsByName("check_group_name").length; i++) {
if(document.getElementsByName("check_group_name")[i].id == value) {
document.getElementById(value).className = "selected";
}
else {
document.getElementsByName("check_group_name")[i].className = "classbox";
}
}
}
function validate_groupname_null(value1) {
value1 = value1.trim();
if(value1.length == 0 ) {
alert('<%= l(:label_limit_groupname_null) %>');
}
}
function validate_update(name) {
value1 = document.getElementById(name).value;
validate_groupname(value1);
}
function validate_add_group() {
check_groupname();
}
</script>
<div class="project_r_h">
<h2 class="project_h2"><%= @subPage_title%></h2>
</div>

View File

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

View File

@ -1,3 +1,50 @@
///////////////////////////////////////////////////////////////
function check_groupname(course_id) {
var $group_name = $('#group_name');
$.get(
'<%=valid_ajax_course_path%>',
{ valid: "name",
value: document.getElementById('group_name').value,
course_id: course_id },
function (data) {
if (!data.valid) {
alert(data.message);
}
});
}
function validate_groupname(value1) {
if(value1.length > 20) {
alert('<%= l(:label_limit_groupname) %>');
}
}
function checkclass(value) {
for(var i = 0; i < document.getElementsByName("check_group_name").length; i++) {
if(document.getElementsByName("check_group_name")[i].id == value) {
document.getElementById(value).className = "selected";
}
else {
document.getElementsByName("check_group_name")[i].className = "classbox";
}
}
}
function validate_groupname_null(value1) {
value1 = value1.trim();
if(value1.length == 0 ) {
alert('<%= l(:label_limit_groupname_null) %>');
}
}
function validate_update(name) {
value1 = document.getElementById(name).value;
validate_groupname(value1);
}
function validate_add_group() {
check_groupname();
}
///////////////////////////////////////////////////////////////
//验证搜索时输入名字
function regexName(content)
{