Merge branch 'cxt_course' into develop

Conflicts:
	app/views/users/_course_homework.html.erb
	db/schema.rb
This commit is contained in:
cxt 2016-11-11 16:53:20 +08:00
commit cb5ca96bb5
59 changed files with 327 additions and 178 deletions

View File

@ -558,6 +558,35 @@ class CoursesController < ApplicationController
end
end
def delete_member
member = @course.members.find params[:member_id]
student_role = member.member_roles.where("role_id = 10").first
if member && member.deletable? && student_role
user_admin = CourseInfos.where("user_id = ? and course_id = ?", member.user_id, @course.id)
if user_admin.size > 0
user_admin.destroy_all
end
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@course.id)
joined.destroy_all
if member.member_roles.count > 1
student_role.destroy
member.update_attribute("course_group_id", 0)
else
member.destroy
end
#移出课程发送消息
CourseMessage.create(:user_id => member.user_id, :course_id => @course.id, :course_message_type => "RemoveFromCourse", :viewed => false, :course_message_id => User.current.id)
@course_groups = @course.course_groups
@no_group_count = @course.student.count - @course.members.where("course_group_id != 0").count
@canShowCode = isCourseTeacher(User.current.id,@course)
respond_to do |format|
format.js
end
end
end
def handle_course courses, activities
course_activity_count_array=activities.values()
course_array=[]
@ -800,11 +829,11 @@ class CoursesController < ApplicationController
end
if @course
#发送微信消息
count = ShieldWechatMessage.where("container_type='User' and container_id=#{User.current.id} and shield_type='Course' and shield_id=#{@course.id}").count
if count == 0
ss = SyllabusesService.new
ss.send_wechat_create_class_notice User.current,@course
end
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{User.current.id} and shield_type='Course' and shield_id=#{@course.id}").count
# if count == 0
# ss = SyllabusesService.new
# ss.send_wechat_create_class_notice User.current,@course
# end
respond_to do |format|
flash[:notice] = l(:notice_successful_create)
format.html {redirect_to course_url(@course)}

View File

@ -337,7 +337,7 @@ class MembersController < ApplicationController
else
joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id)
joined.each do |join|
join.delete
join.destroy
end
@member.course_group_id = 0
end
@ -423,7 +423,7 @@ class MembersController < ApplicationController
end
joined = StudentsForCourse.where('student_id = ? and course_id = ?', @member.user_id,@course.id)
joined.each do |join|
join.delete
join.destroy
end
@roles = Role.givable.all[3..5]
@members = @course.member_principals.includes(:roles, :principal).all.sort

View File

@ -597,14 +597,14 @@ class StudentWorkController < ApplicationController
@student_work_project.student_work_id = student_work.id
@student_work_project.save
elsif @homework.homework_detail_group.base_on_project == 0
stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => student_work.project_id, :user_id => student_work.user_id, :is_leader => 1)
stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => student_work.project_id, :user_id => student_work.user_id, :is_leader => 1, :course_id => @homework.course_id)
stu_project.save
end
members = params[:group_member_ids].split(',')
for i in 1 .. members.count-1
stu_work = StudentWork.new(:name => student_work.name, :description => student_work.description,:user_id =>members[i].to_i, :homework_common_id => @homework.id,:project_id => student_work.project_id, :late_penalty => student_work.late_penalty,:work_status => 3, :commit_time => student_work.commit_time)
if stu_work.save
stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0)
stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0, :course_id => @homework.course_id)
stu_project.save
end
end
@ -662,7 +662,7 @@ class StudentWorkController < ApplicationController
for i in 1 .. members.count-1
stu_work = StudentWork.new(:name => @work.name, :description => @work.description,:user_id=> members[i].to_i, :homework_common_id => @homework.id, :project_id => @work.project_id, :late_penalty => @work.late_penalty,:work_status => 3, :commit_time => @work.commit_time)
if stu_work.save
stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => @work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0)
stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => @work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0, :course_id => @homework.course_id)
stu_project.save
end
end
@ -1095,6 +1095,7 @@ class StudentWorkController < ApplicationController
@project.project_id = params[:projectName].to_i
@project.user_id = User.current.id
@project.is_leader = 1
@project.course_id = @homework.course_id
if @project.save
@user_activity_id = params[:user_activity_id].to_i
@hw_status = params[:hw_status].to_i
@ -1180,7 +1181,7 @@ class StudentWorkController < ApplicationController
unless work
stu_work = StudentWork.new(:name => student_work.name, :description => student_work.description,:user_id =>params[:member_id][i].to_i, :homework_common_id => @homework.id,:project_id => student_work.project_id, :late_penalty => student_work.late_penalty,:work_status => 3, :commit_time => Time.now)
if stu_work.save
stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => params[:member_id][i].to_i, :is_leader => 0)
stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => params[:member_id][i].to_i, :is_leader => 0, :course_id => @homework.course_id)
stu_project.save
end
end

View File

@ -125,7 +125,7 @@ class WatchersController < ApplicationController
joined = StudentsForCourse.where('student_id = ? and course_id = ?', User.current.id, params[:object_id])
joined.each do |join|
join.delete
join.destroy
end
end
respond_to do |format|

View File

@ -102,7 +102,11 @@ class WordsController < ApplicationController
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
@activity = JournalsForMessage.where("id = #{params[:activity_id].to_i}").first if params[:activity_id]
unless @activity
redirect_to feedback_path(@user)
if params[:user_activity_id] == params[:activity_id]
redirect_to feedback_path(@user)
else
redirect_to user_path(@user)
end
return
end
elsif @journal_destroyed.jour_type == 'HomeworkCommon'

View File

@ -2896,7 +2896,7 @@ module ApplicationHelper
end
#根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量
def user_for_homework_common homework,is_teacher
def user_for_homework_common homework,is_teacher,work
count = homework.student_works.has_committed.count
if User.current.member_of_course?(homework.course)
if is_teacher #老师显示作品数量

View File

@ -895,7 +895,7 @@ module CoursesHelper
desc.html_safe
end
# 学生按作业总分排序,取前3
# 学生按作业总分排序,取前6
def hero_homework_score(course, score_sort_by)
sql_select = "SELECT members.*,(
SELECT SUM(work_score)
@ -907,14 +907,15 @@ module CoursesHelper
FROM members
JOIN students_for_courses
ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id
WHERE members.course_id = #{course.id} ORDER BY score #{score_sort_by} limit 3"
WHERE members.course_id = #{course.id} ORDER BY score #{score_sort_by} limit 6"
homework_scores = Member.find_by_sql(sql_select)
end
def contributor_course_scor(course_id)
ccs = CourseContributorScore.find_by_sql("SELECT * FROM `course_contributor_scores` where course_id = #{course_id} order by
(message_num*2 + message_reply_num + news_reply_num + news_num +
resource_num*5 + journal_num + homework_journal_num ) desc limit 3;")
ccs = CourseContributorScore.find_by_sql("SELECT ccs.*, (message_num*2 + message_reply_num + news_reply_num + news_num +
resource_num*5 + journal_num + homework_journal_num ) as con_score FROM `course_contributor_scores` ccs JOIN students_for_courses sfs
ON sfs.student_id = ccs.user_id AND sfs.course_id = ccs.course_id where ccs.course_id = #{course_id} order by
con_score desc limit 6;")
end
#用户在该课程是否具有某个角色

View File

@ -49,6 +49,7 @@ class Course < ActiveRecord::Base
#has_many :course_journals_for_messages, :class_name => 'CourseJournalsForMessage', :as => :jour, :dependent => :destroy
has_many :news, :dependent => :destroy, :include => :author
has_one :course_status, :class_name => "CourseStatus", :dependent => :destroy
has_many :student_work_projects, :dependent => :destroy
has_many :homework_commons, :dependent => :destroy
has_many :student_works, :through => :homework_commons, :dependent => :destroy

View File

@ -7,5 +7,13 @@ class StudentsForCourse < ActiveRecord::Base
validates_presence_of :course_id, :student_id
validates_uniqueness_of :student_id, :scope => :course_id
after_destroy :delete_student_works
def delete_student_works
course = self.course
homework_ids = course.homework_commons.blank? ? "(-1)" : "(" + course.homework_commons.map{|hw| hw.id}.join(",") + ")"
student_works = StudentWork.where("user_id = #{self.student_id} && homework_common_id in #{homework_ids}")
student_works.destroy_all
end
end

View File

@ -966,8 +966,12 @@ class User < Principal
#是否具有老师角色
def has_teacher_role(course)
member = course.members.where("user_id = #{self.id}").first
role = MemberRole.where("member_id = #{member.id} and role_id in (3, 7, 9)")
!role.blank?
if !member.nil?
role = MemberRole.where("member_id = #{member.id} and role_id in (3, 7, 9)")
!role.blank?
else
return false
end
end
#是否具有学生角色
@ -992,6 +996,13 @@ class User < Principal
# Admin users are authorized for anything else
return true if admin?
course_ids = context.student_work_projects.blank? ? "(-1)" : "(" + context.student_work_projects.map{|swp| swp.course_id}.join(",") + ")"
courses = Course.where("id in #{course_ids}")
courses.each do |course|
if self.has_teacher_role(course)
return true
end
end
roles = roles_for_project(context)
return false unless roles
roles.any? {|role|

View File

@ -207,7 +207,7 @@ class CoursesService
unless member.role_ids.include?(10)
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,c.id)
joined.each do |join|
join.delete
join.destroy
end
end
@ -460,7 +460,7 @@ class CoursesService
@member.first.destroy
joined = StudentsForCourse.where('student_id = ? and course_id = ?', user.id, params[:object_id])
joined.each do |join|
join.delete
join.destroy
end
@state = 0
@state
@ -837,7 +837,7 @@ class CoursesService
member = Member.new(:role_ids =>[7], :user_id => params[:user_id],:course_id=>params[:course_id])
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,course.id)
joined.each do |join|
join.delete
join.destroy
end
member.course_group_id = 0
members << member
@ -858,7 +858,7 @@ class CoursesService
end
joined = StudentsForCourse.where('student_id = ? and course_id = ?', params[:user_id],params[:course_id])
joined.each do |join|
join.delete
join.destroy
end
end
@ -1261,7 +1261,7 @@ class CoursesService
else
joined = StudentsForCourse.where('student_id = ? and course_id = ?', params[:user_id],params[:id])
joined.each do |join|
join.delete
join.destroy
end
member.course_group_id = 0
end
@ -1305,7 +1305,7 @@ class CoursesService
end
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,course.id)
joined.each do |join|
join.delete
join.destroy
end
roles = Role.givable.all[3..5]
#移出课程发送消息

View File

@ -23,11 +23,8 @@
总得分为以上得分之和</div>
</div>
<% contributor_course_scor(course.id).each do |contributor_score| %>
<% total_score = contributor_score.resource_num.to_i * 5 + contributor_score.message_num.to_i * 2 +
contributor_score.message_reply_num.to_i * 1 + contributor_score.journal_num.to_i * 1 +
+ contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_num.to_i * 1 +
contributor_score.news_num.to_i * 1 %>
<% unless total_score ==0 %>
<% total_score = contributor_score.con_score %>
<% if !total_score.nil? && total_score !=0 %>
<li>
<%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "50", :height => "50", :class=> "rankPortrait"),user_path(contributor_score.user) %>
<p><%=link_to contributor_score.user.show_name, user_path(contributor_score.user.id), :title => contributor_score.user.show_name %></p>

View File

@ -1,8 +1,9 @@
<% is_teacher = User.current.allowed_to?(:as_teacher, @course) || User.current.admin? %>
<% if members.any? %>
<table class="sy_new_table clear sy_new_table_width" cellpadding="0" cellspacing="0">
<thead>
<tr class="clear">
<th class="sy_th7">序号</th>
<th class="sy_th6">序号</th>
<th class="sy_th15">姓名</th>
<th class="sy_th15">
<%= link_to '学号', member_score_sort_course_path(:sort_type => 'student_id', :sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? (@group == -1 ? -1 : @group.id) : 0), :search_name => (@search_name ? @search_name : nil)), :result => members, method: 'get', remote: true, :style => 'color:#000000;'%>
@ -12,7 +13,7 @@
<a href="javascript:void(0)" class="sy_sortdownbtn"></a>
<% end %>
</th>
<th class="sy_th0 sy_fenban_tap">
<th class="<%= is_teacher ? 'sy_th0' : 'sy_th1' %> sy_fenban_tap">
<%= link_to '作业得分', member_score_sort_course_path(:sort_type => 'score', :sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? (@group == -1 ? -1 : @group.id) : 0), :search_name => (@search_name ? @search_name : nil)), :result => members, method: 'get', remote: true, :style => 'color:#000000;'%>
<% if @sort_type == "score" && @score_sort_by == 'desc' %>
<a href="javascript:void(0)" class="sy_sortupbtn"></a>
@ -24,7 +25,7 @@
班级作业的得分总和</p>
</div>
</th>
<th class="sy_th0 sy_fenban_tap">
<th class="<%= is_teacher ? 'sy_th0' : 'sy_th1' %> sy_fenban_tap">
<%= link_to '测评得分', member_score_sort_course_path(:sort_type => 'ex_score', :sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? (@group == -1 ? -1 : @group.id) : 0), :search_name => (@search_name ? @search_name : nil)), :result => members, method: 'get', remote: true, :style => 'color:#000000;'%>
<% if @sort_type == "ex_score" && @score_sort_by == 'desc' %>
<a href="javascript:void(0)" class="sy_sortupbtn"></a>
@ -36,7 +37,7 @@
班级测验的得分总和</p>
</div>
</th>
<th class="sy_th0 sy_fenban_tap">
<th class="<%= is_teacher ? 'sy_th0' : 'sy_th1' %> sy_fenban_tap">
<%= link_to '社区得分', member_score_sort_course_path(:sort_type => 'act_score', :sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? (@group == -1 ? -1 : @group.id) : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true, :style => 'color:#000000;'%>
<% if @sort_type == "act_score" && @score_sort_by == 'desc' %>
<a href="javascript:" class= "sy_sortupbtn"></a>
@ -56,13 +57,16 @@
</p>
</div>
</th>
<th class="sy_th0 sy_fenban_tap">总得分
<th class="<%= is_teacher ? 'sy_th0' : 'sy_th1' %> sy_fenban_tap">总得分
<div class="sy_fenban_show undis" style="width:180px;">
<p>积分规则<br/>
作业得分+测评得分+社区得分</p>
</div>
</th>
<th class="sy_th13">分班</th>
<% if is_teacher %>
<th class="sy_th3"></th>
<% end %>
</tr>
</thead>
<tbody>
@ -98,10 +102,10 @@
</td>
<td class="pr">
<span class="sum_score_tip"><%= format("%0.2f", sum) %></span>
<div class="sy_tips_box_inner undis" style="left: 215px; top: -60px; text-align: left;">
<div class="sy_tips_box_inner undis" style="left: <%=is_teacher ? '230px' : '215px' %>; top: -60px; text-align: left;">
<span style="top: 75px;"></span>
<p >
<font class="fb"><%= user.show_name %></font><br/>
<font class="fb"><%= user.show_name %>(<%=user.login %>)</font><br/>
资源&nbsp;&nbsp;&nbsp;&nbsp;发布数:<%= member.resource_num.nil? ? 0 : member.resource_num %><br/>
<font class="mr15">问答&nbsp;&nbsp;&nbsp;&nbsp;发布数:<%= member.message_num.nil? ? 0 : member.message_num %></font>回复数:<%= member.message_reply_num.nil? ? 0 : member.message_reply_num %><br/>
<font class="mr15">通知&nbsp;&nbsp;&nbsp;&nbsp;提交数:<%= member.news_num.nil? ? 0 : member.news_num %></font>留言数:<%= member.news_reply_num.nil? ? 0 : member.news_reply_num %><br/>
@ -112,7 +116,7 @@
</div>
</td>
<td>
<% if User.current.allowed_to?(:as_teacher, @course) || User.current.admin? || User.current == user %>
<% if is_teacher || User.current == user %>
<% if @course.course_groups.empty? %>
<%=member.course_group_id == 0 ? "暂无" : member.course_group.name %>
<% else %>
@ -130,6 +134,11 @@
<%=member.course_group_id == 0 ? "暂无" : member.course_group.name %>
<% end %>
</td>
<% if is_teacher %>
<td>
<a href="javascript:void(0)" onClick="delete_confirm_box('<%=delete_member_course_path(@course, :member_id => member.id) %>', '确认删除该成员吗?');" class="sy_icons_del fl"></a>
</td>
<% end %>
</tr>
<% end %>
</tbody>

View File

@ -5,8 +5,6 @@
<li>
<span class="sy_sq_orange fl mr5 mt5"><%= i+1 %></span>
<div class="fl" style="width:185px;">
<%= link_to e_course.syllabus.title, syllabus_path(e_course.syllabus_id), :target => '_blank', :class => "sy_class_ltitle"%>
&nbsp;<font class="fb c_grey">·</font>&nbsp;
<%=link_to e_course.name, course_path(e_course.id), :class => "sy_class_ltitle mb10" %>
</div>
<div class="cl"></div>

View File

@ -0,0 +1,4 @@
hideModal();
$("#member_li_<%=params[:member_id] %>").html("");
$("#st_groups").html("<%=escape_javascript(render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups}) %>");
$("#group_children_list").html("<%= escape_javascript( render :partial => 'layouts/group_children_list', :locals => {:course => @course})%>");

View File

@ -18,13 +18,13 @@
<div class="cl"></div>
<li class="mt10 ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="new_course_name" class="courses_input w289" maxlength="100" placeholder="例如计算机系2016秋季A班" onkeyup="regex_course_name('new');">
<input type="text" name="course[name]" id="new_course_name" class="courses_input w289" maxlength="100" placeholder="例如:软件工程计算机系2016秋季A班" onkeyup="regex_course_name('new');">
<div class="cl"></div>
<span class="c_red ml80" id="new_course_name_notice" style="display: none;">班级名称不能为空且至少有两个字符</span>
</li>
<div class="cl"></div>
<li class="ml125 mb5 fontGrey3"><span class="success-icon mr25">正确示例计算机系2016秋季A班</span></li>
<li class="ml125 mb10 fontGrey3"><span class="error-icon">错误示例:软件工程 - 计算机系2016秋季A班</span></li>
<li class="ml125 mb5 fontGrey3"><span class="success-icon mr25">正确示例:软件工程计算机系2016秋季A班</span></li>
<li class="ml125 mb10 fontGrey3"><span class="error-icon">错误示例计算机系2016秋季A班</span></li>
<!--<li class="ml125 mt10 mb10 fontGrey2" style="max-width: 544px;">班级是一个由教师、助教(教辅)和学生组成的临时的教学群体,在规定的时间内(如一个学期)完成一门课程规定的教学任务。本质上,一门课程就是一个教学计划。</li>-->
<li class="mt10 ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_class_period)%>&nbsp;&nbsp;</label>

View File

@ -39,14 +39,15 @@
</li>
<li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_syllabus_name)%>&nbsp;&nbsp;</label>
<span><%=@course.syllabus.title %></span>
<span id="edit_syllabus_id"><%=@course.syllabus.title %></span>
<%#= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:210px'} %>
<!--<span class="c_red" id="edit_syllabus_notice">如果列表中没有对应的课程,请您先<%#=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>,然后【刷新】</span>-->
</li>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="edit_course_name" autocomplete="off" class="courses_input" maxlength="100" onkeyup="regex_course_name('edit');" value="<%= @course.name%>">
<span class="c_red" id="edit_course_name_notice" style="display: none;">班级名称不能为空</span>
<div class="cl"></div>
<span class="c_red ml80" id="edit_course_name_notice" style="display: none;">班级名称不能为空</span>
</li>
<div class="cl"></div>
<li class="ml45">

View File

@ -6,7 +6,7 @@
<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cgrey') %>
&nbsp;&gt;&nbsp;
<% if @course.syllabus %>
<%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey' %>
<%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey', :title => '课程名称' %>
&nbsp;&gt;&nbsp;
<% end %>
<%=link_to @course.name, course_path(@course), :class => 'sy_cgrey' %>
@ -55,8 +55,6 @@
<div class="sy_class_info fl ml15">
<div class="sy_class_titbox">
<h3 class="fl sy_class_title">
<%= link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class =>'c_dark', :target => '_blank'%>
&nbsp;<font class="fb">·</font>&nbsp;
<%=@course.name %>
</h3>
<span class="<%= @course.is_public == 0 ? 'hw_icon_private' : 'hw_icon_open' %> fl mr20 mt3"></span>

View File

@ -3,7 +3,7 @@
<span class="user_icons_class"></span>
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
<p href="javascript:void(0);" id="show_course_<%= course.id %>" class="course_list_menu" >
<%= link_to course.syllabus.title + course.name, course_path(course.id,:host=>Setting.host_course), :target => '_blank', :class => 'hidden', :style => 'display:block;'%>
<%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :target => '_blank', :class => 'hidden', :style => 'display:block;'%>
</p>
<div class="sub-menu-title c_dark">
<em></em>

View File

@ -1,19 +1,26 @@
<div id="popbox_upload" style="margin-top: -30px;margin-left: -20px;margin-right: -10px;">
<div class="upload_con">
<h2>选择问卷导入本班级</h2>
<div class="upload_box">
<div id="error_show" style="color: red;"></div>
<%= form_tag import_other_poll_poll_index_path,
method: :post,
id: "relation_file_form" do %>
<input type="hidden" name="course_id" value="<%= polls_group_id%>" />
<%= content_tag('div', poll_check_box_tags('polls[]', polls,polls_group_id), :id => 'courses',:style=> 'width: 300px;')%>
<a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" style="margin-left: 0px !important;" onclick="submit_quote();">导&nbsp;&nbsp;入</a>
<a href="javascript:void(0)" class="grey_btn fl c_white ml10" onclick="closeModal();">取&nbsp;&nbsp;消</a>
<% end -%>
<div id="muban_popup_box" style="width:500px;">
<div class="muban_popup_top">
<h3 class="fl">选择问卷导入本班级</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con clear">
<%= form_tag import_other_poll_poll_index_path,
method: :post,
id: "relation_file_form" do %>
<input type="hidden" name="course_id" value="<%= polls_group_id%>" />
<div class="import_poll_div">
<% polls.each do |poll| %>
<li>
<input style="vertical-align:middle" type="checkbox" name="polls[]" id="poll_check_box_<%=poll.id %>" value="<%=poll.id %>"/>
<label style="vertical-align:middle" for="poll_check_box_<%=poll.id %>" class="break_word"><%=h poll.polls_name.blank? ? l(:label_poll_new) : poll.polls_name %> [<%=h Course.find(poll.polls_group_id).name %>]</label>
</li>
<% end %>
</div>
<div class="cl"></div>
<a href="javascript:void(0);" class="fr sy_btn_blue mr35" onclick="submit_quote();">导&nbsp;&nbsp;入</a>
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="hideModal();">取&nbsp;&nbsp;消</a>
<% end -%>
</div>
</div>

View File

@ -566,6 +566,8 @@ function insert_MCQ(quest_type,quest_id){
var forms = $("form.new_poll_question");
if($("#polls_head_edit").is(":visible")){
alert("请先保存问卷标题及问卷描述。");
}else if($.trim($("#polls_name_h").html()) == ""){
alert("问卷标题不能为空");
}else if(forms.length > 0){
alert("请先保存正在编辑的题目。");
} else {
@ -585,6 +587,8 @@ function insert_MCQ(quest_type,quest_id){
var forms = $("form.new_poll_question");
if($("#polls_head_edit").is(":visible")){
alert("请先保存问卷标题及问卷描述。");
}else if($.trim($("#polls_name_h").html()) == ""){
alert("问卷标题不能为空");
}else if(forms.length > 0){
alert("请先保存正在编辑的题目再发布。");
} else{

View File

@ -4,6 +4,7 @@
<span class="c_red questionLabel ml5" title="必答">*</span>
<%end%>
</p>
<div id="toolbar" class="undis">
<% poll = poll_question.poll %>
<% count = poll.poll_questions.count %>
<% unless poll_question.question_number == 1 %>
@ -21,4 +22,13 @@
</div>
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "poll-delete", :title => "删除") %>
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "poll-delete", :title => "删除") %>
</div>
<script>
$('.poll-container').mouseover(function(){
$(this).find("#toolbar, .poll-edit").show();
})
$('.poll-container').mouseout(function(){
$(this).find("#toolbar, .poll-edit").hide();
})
</script>

View File

@ -7,7 +7,7 @@
<span class="formatContainer m_w500"><%= poll_question.question_title %></span>
<span class="fontBlue">[单选题]</span>
</div>
<a class="poll-edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class="poll-edit" style="display:none;" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<div class="cl"></div>
<div class="ur_inputs">

View File

@ -18,7 +18,7 @@
</p>
<% end %>
</div>
<a class="poll-edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class="poll-edit" style="display:none;" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<div class="cl"></div>
<div class="ur_inputs">
<table class="ur_table" style="width:647px;">

View File

@ -1,5 +1,5 @@
<div class="testStatus" onmouseover="$('#poll_head_edit_pen').show();" onmouseout="$('#poll_head_edit_pen').hide();"><!--头部显示 start-->
<a href="javascript:" class="testEdit undis" id="poll_head_edit_pen" title="编辑" onclick="pollsEdit();" style="top:0;"></a>
<a href="javascript:" class="testEdit" id="poll_head_edit_pen" title="编辑" onclick="pollsEdit();" style="top:0;display:none"></a>
<!-- <a class='ur_icon_add' title='导入' id="import_btn" onclick="importPoll();"></a> -->
<h1 class="ur_page_title" id="polls_name_h" style="width:668px; margin:0 auto;"><%= poll.polls_name%></h1>
<div class="testDesEdit mt5"><%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%></div>

View File

@ -8,7 +8,7 @@
<span class="fontBlue">[多行主观题]</span>
</div>
<a class="poll-edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class="poll-edit" style="display:none;" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<div class="cl"></div>
<% poll_question.poll_answers.reorder("answer_position").each_with_index do |poll_answer, i| %>
<div class="ml20 mb10">

View File

@ -8,7 +8,7 @@
<span class="fontBlue">[主观题]</span>
</div>
<a class="poll-edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class="poll-edit" style="display:none;" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<div class="cl"></div>
<div class="ur_inputs">
<textarea type="text" size="" maxlength="" value="" style="width:640px; border:1px solid #ddd;" rows="3" readonly="readonly"></textarea>

View File

@ -1,13 +1,14 @@
<% if @polls.empty? %>
alert('您的其它班级下没有问卷可供导入');
<% else %>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>');
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
var html_value = '<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>';
pop_box_new(html_value, 510, 550);
// $('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>');
//
//
// showModal('ajax-modal', '513px');
// $('#ajax-modal').siblings().remove();
// $('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
// $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
// $('#ajax-modal').parent().addClass("popbox_polls");
<% end %>

View File

@ -241,7 +241,7 @@
}
}
</script>
<input class="fillInput" placeholder="在此填入答案" type="text" value="<%= get_anwser_vote_text(pq.id, User.current.id).html_safe %>" onblur="onblur_<%= pq.id %>(this);" <%= @can_edit_poll ? "" : "disabled=disabled" %>>
<textarea class="fillInput" placeholder="在此填入答案" type="text" style="height:54px" value="<%= get_anwser_vote_text(pq.id, User.current.id).html_safe %>" onblur="onblur_<%= pq.id %>(this);" <%= @can_edit_poll ? "" : "disabled=disabled" %>></textarea>
</div>
</div>
</div>

View File

@ -13,10 +13,8 @@
<div class="pr">
<span class="fl ml25 fontGrey2">关联项目:</span>
<div class="fl projectName">
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? || User.current.allowed_to?(:as_teacher, @homework.course) %>
<%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fl hidden', :style => "max-width:550px;", :title => "项目名称", :target => "_blank" %>
<% elsif User.current.allowed_to?(:as_teacher, @homework.course) %>
<%= link_to student_work.project.name, applied_join_project_path(:object_id => student_work.project.id, :is_teacher => 1), :remote => true, :method => "post", :class => 'link-blue fl hidden', :style => "max-width:550px;", :title => "项目名称" %>
<% else %>
<span class="fontBlue fr hidden" style="max-width:550px;" title="该项目是私有的"><%= student_work.project.name %></span>
<% end %>

View File

@ -5,8 +5,6 @@
<div class="homepagePostTo break_word mt-4">
<%= link_to homework.user.show_name, user_activities_path(homework.user_id), :class => "newsBlue mr15"%>
TO
<%=link_to homework.course.syllabus.title, syllabus_path(homework.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
<span class="fb" style="color: #269ac9"> • </span>
<%= link_to homework.course.name, course_path(homework.course_id), :class => "newsBlue"%>
</div>
<div class="homepagePostTitle hidden fl m_w505">

View File

@ -0,0 +1,31 @@
<div class="syllabus_courses_box">
<% projects.each do |project|%>
<% allow_visit = project.is_public || User.current.member_of?(project) || User.current.admin? || User.current.allowed_to?(:as_teacher, @homework.course) %>
<div class="syllabus_courses_list" style="cursor: default">
<div class="sy_courses_open">
<h3>
<% if allow_visit %>
<%= link_to "#{project.name}", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "new_project_title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
<% else %>
<a href="javascript:void(0)" class="new_project_title fl" title="私有项目不可访问"><%=project.name %></a>
<% end %>
</h3>
<span class="<%= project.is_public? ? 'syllabus_class_open' : 'syllabus_class_private' %> fl ml10 mt3 syllabus_class_property"><%= project.is_public? ? '公开' : '私有' %></span>
<% projectUser = User.where("id=?",project.user_id).first %>
<%=link_to "<span class='fr grayTxt'>创建者:#{projectUser.try(:realname) != " " ? projectUser.lastname + projectUser.firstname : projectUser.try(:login)}</span>".html_safe, user_path(projectUser) %>
<div class="cl"></div>
</div>
<div>
<p class="fl sy_p_grey" style="margin-left: 0">更新时间:<%= format_date(project.updated_on) %></p>
<div class=" fr">
<p class="list-info fr grayTxt">
<%= link_to project.members.count, allow_visit ? member_project_path(project) : 'javascript:void(0)', :class => "c_blue" %><span class="mr5">成员&nbsp;&nbsp;|</span>
<%= link_to project.project_score.issue_num, allow_visit ? project_issues_path(project) : 'javascript:void(0)', :class => "c_blue" %><span class="mr5">问题&nbsp;&nbsp;|</span>
<%= link_to project.project_score.attach_num, allow_visit ? file_project_path(project) : 'javascript:void(0)', :class => "c_blue" %><span>资源</span>
</p>
</div>
</div>
<div class="cl"></div>
</div>
<% end %>
</div><!--syllabus_courses_box end-->

View File

@ -4,6 +4,7 @@
<%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<% is_group_project_homework = @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<script type="text/javascript">
$(function(){
@ -12,12 +13,14 @@
$("#Container").css("width","1000px");
<% if @tab == 2%>
$("#student_work_tab2").click();
<% elsif @tab == 3 %>
$("#student_work_tab3").click();
<% end %>
sd_create_editor_from_data(<%= @homework.id %>, null, "100%", "<%= @homework.class.to_s %>");
});
function HoverLi(n){
for(var i=1;i<=2;i++){
for(var i=1;i<=3;i++){
$('#student_work_tab'+i).removeClass('selected');
$('#student_work_con'+i).addClass('undis');
}
@ -156,7 +159,14 @@
<li onclick="HoverLi(2);" id="student_work_tab2">
<a href="javascript:void(0);" class="fontGrey3">作品列表</a>
</li>
<li style="width:515px;">&nbsp;</li>
<% if is_group_project_homework %>
<li onclick="HoverLi(3);" id="student_work_tab3">
<a href="javascript:void(0);" class="fontGrey3">关联项目列表</a>
</li>
<li style="width:415px;">&nbsp;</li>
<% else %>
<li style="width:515px;">&nbsp;</li>
<% end %>
</ul>
<div id="student_work_con1">
@ -176,6 +186,14 @@
</div>
</div>
</div>
<% if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<div class="undis" id="student_work_con3">
<% project_ids = @homework.student_work_projects.blank? ? "(-1)" : "(" + @homework.student_work_projects.map{|pro| pro.project_id}.join(",") + ")" %>
<% projects = Project.where("id in #{project_ids}") %>
<%= render :partial => "student_work/relate_projects", :locals => {:projects => projects}%>
</div>
<% end %>
</div>
</div>
<div class="cl"></div>

View File

@ -20,14 +20,10 @@
<div class="fl">
<% if course.is_public == 0 && !User.current.member_of_course?(course) && !User.current.admin? %>
<h3 class="sy_classlist_title fl">
<%= link_to @syllabus.title, syllabus_path(@syllabus.id), :style => 'color:#000', :target => '_blank' %>
<font class="fb"> · </font>
<%=course.name %><%=current_time_and_term_short(course) %>
</h3>
<% else %>
<h3 class="sy_classlist_title fl">
<%= link_to @syllabus.title, syllabus_path(@syllabus.id), :style => 'color:#000', :target => '_blank' %>
<font class="fb"> · </font>
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course),
:style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+""+current_time_and_term(course)+""%>
</h3>

View File

@ -12,8 +12,6 @@
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% end %>
TO
<%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
<span class="fb" style="color: #269ac9"> • </span>
<%= link_to activity.course.name.to_s+" | 班级资源", course_files_path(activity.course), :class => "newsBlue" %>
</div>
<div class="homepagePostTitle break_word" >

View File

@ -12,8 +12,6 @@
<%= link_to activity.try(:teacher).try(:realname), user_path(activity.teacher), :class => "newsBlue mr15" %>
<% end %>
TO
<%=link_to activity.syllabus.title, syllabus_path(activity.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
<span class="fb" style="color: #269ac9"> • </span>
<%= link_to activity.name.to_s+" | 班级", course_path(activity.id,:host=>Setting.host_course), :class => "newsBlue" %>
</div>
<div class="homepagePostTitle break_word" >

View File

@ -3,14 +3,12 @@
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
<%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word">
<%= link_to activity.user.show_name, user_path(activity.user,:host=>Setting.host_user), :class => "newsBlue mr15" %>
TO <!--+"(课程名称)" -->
<%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
<span class="fb" style="color: #269ac9"> • </span>
<% if hw_status == 3 || hw_status == 5 %>
<%= link_to activity.course.name, course_path(activity.course_id), :class => "newsBlue"%>
<% else %>
@ -63,17 +61,3 @@
<%= render :partial => 'users/homework_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id, :hw_status => hw_status, :is_teacher => is_teacher} %>
</div>
<script type="text/javascript">
$("#moreProject_<%=user_activity_id %>").click(function(){
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
$("#relatePWrap_<%=user_activity_id %>").css("height","auto");
$(this).hide();
});
$("#hideProject_<%=user_activity_id %>").click(function(){
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
$("#moreProject_<%=user_activity_id %>").show();
});
$(function(){
user_card_show_hide();
});
</script>

View File

@ -9,8 +9,6 @@
<%= link_to activity.user.show_name, user_path(activity.user), :class => "newsBlue mr15" %>
TO
<% course=Course.find(activity.jour_id) %>
<%=link_to course.syllabus.title, syllabus_path(course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
<span class="fb" style="color: #269ac9"> • </span>
<%= link_to course.name.to_s+" | 班级留言", course_feedback_path(course), :class => "newsBlue" %>
</div>
<!--<div class="homepagePostTitle break_word list_style upload_img">

View File

@ -8,8 +8,6 @@
<div class="homepagePostTo break_word">
<%= link_to activity.author.show_name, user_path(activity.author, :host=>Setting.host_user), :class => "newsBlue mr15" %>
TO
<%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
<span class="fb" style="color: #269ac9"> • </span>
<%= link_to activity.course.name.to_s+" | #{activity.board.parent.nil? ? '班级讨论区' : activity.board.name}", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue mr5"%>
</div>
<div class="homepagePostTitle hidden m_w530 fl">

View File

@ -8,8 +8,6 @@
<div class="homepagePostTo break_word">
<%= link_to activity.author.show_name, user_path(activity.author), :class => "newsBlue mr15" %>
TO <!--+"(课程名称)"-->
<%=link_to activity.course.syllabus.title, syllabus_path(activity.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
<span class="fb" style="color: #269ac9"> • </span>
<%= link_to activity.course.name.to_s+" | 班级通知", course_news_index_path(activity.course), :class => "newsBlue" %>
</div>
<div class="homepagePostTitle break_word hidden fl m_w600"> <!--+"(通知标题)"-->

View File

@ -17,8 +17,6 @@
<% end %>
TO
<% course = Course.find(activity.polls_group_id) %>
<%=link_to course.syllabus.title, syllabus_path(course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
<span class="fb" style="color: #269ac9"> • </span>
<%= link_to course.name.to_s+" | 问卷", poll_index_path(:polls_type => "Course", :polls_group_id => activity.polls_group_id), :class => "newsBlue" %>
<!--<a href="javascript:void(0);" class="newsBlue ml15">分布式计算环境(课程名称)</a>-->
</div>

View File

@ -14,8 +14,6 @@
<div class="homepagePostDeadline">
缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
</div>
<% end %>
<% if activity.anonymous_comment == 0%>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;" id="evaluation_end_time_<%=user_activity_id %>">
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%>&nbsp;23:59
</div>
@ -27,9 +25,7 @@
<div class="mt10 homepagePostDeadline">
#&nbsp;<%=time_from_now sw.commit_time %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
</div>
<% end %>
<div class="cl"></div>
<% if activity.student_works.has_committed.count != 0 %>
<div class="cl"></div>
<% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %>
<%# student_work_scores = StudentWorksScore.find_by_sql("select max(created_at) as created_at, student_work_id, user_id from student_works_scores where student_work_id in #{sw_id} group by student_work_id order by max(created_at) desc") %>
<% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id} and score is not null").reorder("created_at desc") %>
@ -42,13 +38,8 @@
</div>
<% end %>
<div>
<% if activity.homework_type != 2 %>
<% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
<% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").where("student_works.id in #{ids}").order("score desc") %>
<% else %>
<% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").order("score desc") %>
<% end %>
<% student_works.includes(:user).each_with_index do |sw, i| %>
<% student_works = activity.student_works.select("student_works.*,student_works.work_score as score").where("work_score is not null and work_status != 0").order("score desc").limit(5) %>
<% student_works.includes(:user).each do |sw| %>
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue">
<% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %>
@ -63,14 +54,11 @@
</p>
<% end %>
</a>
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
<% score = sw.respond_to?("score") ? sw.score : sw.work_score %>
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_f < 0 ? 0 : score.to_f) %>分</span></p>
</div>
<% if i == 4 %>
<% break %>
<% end %>
<% end %>
<% if student_works.count > 5 %>
<% if student_works.count == 5 %>
<%= link_to "更多>>", student_work_index_url_in_org(activity.id, 2),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
<% end %>
<div class="cl"></div>
@ -83,11 +71,11 @@
<% sort_projects = project_sort_update projects %>
<div class="mt10 relatePWrap" id="relatePWrap_<%=user_activity_id %>">
<div class="mr5 fontGrey2">
<%# first_pro = sort_projects.first %>
<% first_pro = Project.find sort_projects.first.project_id %>
<% first_pro_act = sort_projects.first %>
<% first_pro = Project.find first_pro_act.project_id %>
<% commit_time = first_pro.project_score.commit_time %>
<% one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %>
#&nbsp;<%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_forge_time) ? commit_time : one_forge_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目
<%# one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %>
#&nbsp;<%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(first_pro_act.updated_at) ? commit_time : first_pro_act.updated_at %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目
</div>
<div class="cl"></div>
</div>

View File

@ -1,20 +1,19 @@
<% work = cur_user_works_for_homework activity %>
<% if activity.homework_type == 3 && !is_teacher && activity.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(activity.course)%>
<% projects = cur_user_projects_for_homework activity %>
<% works = cur_user_works_for_homework activity %>
<% if works.nil? && projects.nil? %>
<% if work.nil? && projects.nil? %>
<div class="homepagePostSubmit">
<%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
</div>
<% elsif works.nil? %>
<% elsif work.nil? %>
<div class="homepagePostSubmit">
<%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:hw_status=>hw_status,:user_activity_id=>user_activity_id), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
</div>
<% end %>
<% end %>
<div class="homepagePostSubmit">
<%= user_for_homework_common activity,is_teacher %>
<%= user_for_homework_common activity,is_teacher,work %>
</div>
<% work = cur_user_works_for_homework activity %>
<% if !is_teacher && !work.nil? && work.user == User.current && activity.end_time < Date.today %>
<div class="homepagePostSubmit">
<%=link_to "追加附件", student_work_index_url_in_org(activity.id, 2, 1), :class => 'c_blue', :title => "可追加作品修订附件" %>
@ -35,11 +34,10 @@
语言:
<%= activity.language_name%>
</div>
<% end %>
<% if activity.homework_type == 3 && activity.homework_detail_group%>
<% elsif activity.homework_type == 3 && activity.homework_detail_group%>
<% if activity.homework_detail_group.base_on_project == 1 %>
<div class="homepagePostDeadline mr15">
项目(<%=activity.student_work_projects.where("is_leader = 1").count %>)
<div class="homepagePostSubmit mr15">
<%=link_to "项目(#{activity.student_work_projects.where('is_leader = 1').count})",student_work_index_url_in_org(activity.id, 3),:class => "c_blue" %>
</div>
<% end %>
<div class="homepagePostDeadline mr15">

View File

@ -18,8 +18,6 @@
<div class="sy_cgrey">
<span class="fl">来源:</span>
<p class="fl hw_list_classname mr15">
<%=link_to homework.course.syllabus.title, syllabus_path(homework.course.syllabus_id), :class => 'hw_cgrey', :target => '_blank' %>
<span> • </span>
<%=link_to homework.course.name.to_s + "#{current_time_and_term_short(homework.course)}", course_path(homework.course), :class => 'hw_cgrey', :target => '_blank' %>
</p>
<% if type == "2" %>

View File

@ -14,8 +14,6 @@
<p class="sy_cgrey clear">
<span class="fl">来源:</span>
<span class="hw_classname mr15 fl">
<%=link_to homework.course.syllabus.title, syllabus_path(homework.course.syllabus_id), :class => 'hw_cgrey', :target => '_blank' %>
<span> • </span>
<%= link_to homework.course.name, course_path(homework.course), :target => '_blank', :class => 'hw_cgrey' %>
</span>
<span class="mr15 fl">类别:<%=homework.homework_type_ch %></span>

View File

@ -14,8 +14,6 @@
<p class="sy_cgrey clear">
<span class=" fl">来源:</span>
<span class="hw_classname fl mr15">
<%=link_to homework.course.syllabus.title, syllabus_path(homework.course.syllabus_id), :class => 'hw_cgrey', :target => '_blank' %>
<span> • </span>
<%= link_to homework.course.name, course_path(homework.course), :target => '_blank', :class => 'hw_cgrey' %>
</span>
<span class="mr15 fl">类别:<%=homework.homework_type_ch %></span>

View File

@ -8,8 +8,6 @@
<div class="homepagePostTo">
<%= link_to homework_common.user.show_name, user_activities_path(homework_common.user_id), :class => "newsBlue mr15"%>
TO
<%=link_to homework_common.course.syllabus.title, syllabus_path(homework_common.course.syllabus_id), :class => 'newsBlue ml15', :target => '_blank' %>
<span class="fb" style="color: #269ac9"> • </span>
<%= link_to homework_common.course.name, course_path(homework_common.course_id), :class => "newsBlue"%>
</div>
<span class="homepagePostTitle hidden fl m_w505">

View File

@ -4,14 +4,14 @@
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
<div class="recall" id='word_li_<%=reply.id.to_s%>' onmouseover="$('#<%= ids_r %>').show()" onmouseout="$('#<%= ids_r %>').hide()">
<div class="recall_head">
<div class="fl">
<% if show_name %>
<%= image_tag url_to_avatar(reply.user),:width => '30',:height => '30' %>
<%= link_to image_tag(url_to_avatar(reply.user),:width => '30',:height => '30'), user_path(reply.user) %>
<% else %>
<%= image_tag url_to_avatar(nil),:width => '30',:height => '30' %>
<%= link_to image_tag(url_to_avatar(nil),:width => '30',:height => '30'), user_path(reply.user) %>
<% end %>
</div>
<div class="recall_con f14" style="width:630px;">
<div class="recall_con f14 fl" style="width:630px;">
<% id = 'project_respond_form_'+ reply.id.to_s %>
<%= link_to reply.user.show_name, user_path(reply.user) %>
<%= l(:label_reply_to)%>

View File

@ -1239,6 +1239,7 @@ RedmineApp::Application.routes.draw do
get "switch_role"
get 'search_not_group_member'
post 'add_members'
get 'delete_member'
end
collection do
match 'join_private_courses', :via => [:get, :post]

View File

@ -0,0 +1,19 @@
class UpdateCourseName < ActiveRecord::Migration
def up
count = Course.all.count / 30 + 2
transaction do
for i in 1 ... count do i
Course.page(i).per(30).each do |course|
if course.syllabus && !course.syllabus.title.nil?
if course.name.index(course.syllabus.title) != 0
course.update_column("name", course.syllabus.title+course.name)
end
end
end
end
end
end
def down
end
end

View File

@ -0,0 +1,15 @@
class AddCourseIdToSwp < ActiveRecord::Migration
def change
add_column :student_work_projects, :course_id, :integer
count = StudentWorkProject.all.count / 30 + 2
transaction do
for i in 1 ... count do i
StudentWorkProject.page(i).per(30).each do |swp|
if swp.homework_common && swp.homework_common.course
swp.update_column("course_id", swp.homework_common.course_id)
end
end
end
end
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20161111064007) do
ActiveRecord::Schema.define(:version => 20161111070615) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -518,6 +518,20 @@ ActiveRecord::Schema.define(:version => 20161111064007) do
t.integer "container_id", :default => 0
end
create_table "course_class_post", :id => false, :force => true do |t|
t.integer "班级id", :default => 0, :null => false
t.string "班级名"
t.integer "帖子id", :default => 0, :null => false
t.integer "主贴id"
t.string "帖子标题", :default => "", :null => false
t.text "帖子内容"
t.integer "帖子用户id"
t.integer "帖子回复数", :default => 0, :null => false
t.integer "最后回帖id"
t.datetime "发帖时间", :null => false
t.datetime "帖子更新时间", :null => false
end
create_table "course_contributor_scores", :force => true do |t|
t.integer "course_id"
t.integer "user_id"

View File

@ -1768,6 +1768,15 @@ function expand_course_list(id, target, btnid, count) {
btn.parent().show();
}
}
//点击删除时的确认弹框
function delete_confirm_box(url, str){
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f16">' + str + '</p><div class="cl"></div><a href="'+ url +'" class="fr sy_btn_blue mr10 mt10" data-remote="true">确定</a>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取消</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
}
//删除组织成员
function ifDeleteOrgMember(id,name){
var htmlvalue = "</br><div style='width:550px;text-align:center'>您确定要删除"+name+"吗?</div></br><div style='width:164px; margin:0 auto; text-align:center'><a href='javascript:void(0);' class='Blue-btn fl' onclick='deleteOrgMember("+id+")'>确定</a><a href='javascript:void(0);' class='Blue-btn fl' onclick='hideModal()'>取消</a></div>" +

View File

@ -77,11 +77,22 @@ function hidden_homework_score_form()
function regex_course_name(str)
{
var name = $.trim($("#"+str+"_course_name").val());
var syl_title = "";
if($("#new_syllabus_id").length > 0){
syl_title = $("#new_syllabus_id").find("option:selected").text();
} else{
syl_title = $("#edit_syllabus_id").html();
}
if(name.length < 2)
{
$("#"+str+"_course_name_notice").show();
return false;
}
else if(name.indexOf(syl_title) != 0){
$("#"+str+"_course_name_notice").html("请参照正确示例规范,应该以课程名称开头命名");
$("#"+str+"_course_name_notice").show();
return false;
}
else
{
$("#"+str+"_course_name_notice").hide();
@ -185,7 +196,7 @@ function regex_course_password(str)
}
//验证课程大纲
function regex_syllabus_option(str) {
if(document.getElementById(str + "_syllabus_id")) {
if(str == "new" && document.getElementById(str + "_syllabus_id")) {
var obj = document.getElementById(str + "_syllabus_id");
var syllabus = obj.options[obj.selectedIndex];
if(parseInt(syllabus.value) == 0) {

View File

@ -159,6 +159,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.mr25 {margin-right:25px;}
.mr27 {margin-right:27px;}
.mr30{ margin-right:30px !important;}
.mr35{ margin-right:35px;}
.mr40{ margin-right:40px !important;}
.mr45{margin-right: 45px;}
.mr50{margin-right: 50px;}

View File

@ -544,14 +544,6 @@ a:hover.upload_btn_grey{background:#8a8a8a;}
.merge-discussion-input {margin:0 -10px; padding:10px; background-color:#f8f8f8;}
.merge-discussion-input textarea {width:720px; height:80px; font-size:13px; line-height:16px; color:#484848; padding:5px;}
/*新版项目列表新增*/
.new_project_title{ font-size:16px; color:#333; max-width:480px; font-weight:normal;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.icons_project_list{ width:8px; height:8px; border:2px solid #fff; background:#3b94d6;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px;-webkit-box-shadow: 0px 2px 5px rgba(146, 153, 169, 0.5);-moz-box-shadow: 0px 2px 5px rgba(146, 153, 169, 0.5);box-shadow: 0px 2px 5px rgba(146, 153, 169, 0.5); }
.icons_project_favorite {background: url(/images/syllabus/sy_icons_star.png) 0px 0px no-repeat; width:20px; height:20px; display:block; float:left;}
.icons_project_star{background: url(/images/syllabus/sy_icons_star.png) 0px -27px no-repeat; width:20px; height:20px; display:block; float:left;}
.new_projectlist_more{ text-align:center;}
.new_projectlist_more a:hover{ color:#3b94d6;}
/*发布新样式*/
.publish-icon {background:url("/images/new_project/icons_issue.png") 0px -82px no-repeat; width:18px; height:18px; display:block;}
.publish-icon:hover {background:url("/images/new_project/icons_issue.png") -25px -82px no-repeat;}

View File

@ -1529,4 +1529,12 @@ a.syllabusbox_a_blue{
/*模拟title*/
.simulation-title {position:absolute; background-color:#fff; padding:5px 10px; z-index:99; white-space:nowrap; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); display:none; color:#666; border:1px solid #666; line-height:1;}
/*项目创建*/
.project_new_input {border: 1px solid #ddd;height: 20px;width: 794px;background: #fff;padding: 5px;}
.project_new_input {border: 1px solid #ddd;height: 20px;width: 794px;background: #fff;padding: 5px;}
/*新版项目列表新增*/
.new_project_title{ font-size:16px; color:#333; max-width:480px; font-weight:normal;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.icons_project_list{ width:8px; height:8px; border:2px solid #fff; background:#3b94d6;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px;-webkit-box-shadow: 0px 2px 5px rgba(146, 153, 169, 0.5);-moz-box-shadow: 0px 2px 5px rgba(146, 153, 169, 0.5);box-shadow: 0px 2px 5px rgba(146, 153, 169, 0.5); }
.icons_project_favorite {background: url(/images/syllabus/sy_icons_star.png) 0px 0px no-repeat; width:20px; height:20px; display:block; float:left;}
.icons_project_star{background: url(/images/syllabus/sy_icons_star.png) 0px -27px no-repeat; width:20px; height:20px; display:block; float:left;}
.new_projectlist_more{ text-align:center;}
.new_projectlist_more a:hover{ color:#3b94d6;}

View File

@ -151,4 +151,6 @@ a:hover.btn_pu{ background:#3cb761;}
.polls_alert_upload_box{ width:120px; margin:15px auto;}
.polls_alert_box_p{ font-size:14px; padding-left: 45px;padding-top: 10px;}
.import_poll_div{width: 430px; max-height: 550px; overflow-x:hidden; overflow-y: auto; margin: 10px auto;}

View File

@ -629,9 +629,11 @@ a:hover.sy_class_ltitle{ color:#333;}
.sy_class_users_st img{ width:30px;height:30px; border: 1px solid #fff;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px;}
.sy_fenban_select{height: 28px; background-color: #fff; border: 1px solid #d1d1d1;-webkit-border-radius:3px;-moz-border-radius:3px;-o-border-radius:3px;border-radius:3px; border:1px solid #d3d3d3;padding-left:5px; color:#888; box-shadow: inset 0px 0px 5px #dcdcdc; }
.sy_new_table_width tr th.sy_th10{ width: 10%; }
.sy_new_table_width tr th.sy_th0{ width: 12.5%; }
.sy_new_table_width tr th.sy_th0{ width: 12%; }
.sy_new_table_width tr th.sy_th1{ width: 12.5%; }
.sy_new_table_width tr th.sy_th15{ width: 15%; }
.sy_new_table_width tr th.sy_th7{ width: 7%;}
.sy_new_table_width tr th.sy_th6{ width: 6%;}
.sy_new_table_width tr th.sy_th3{ width: 3%;}
.sy_new_table_width tr th.sy_th13{ width: 13%;}
.sy_fenban_tap{ cursor: pointer; position: relative;}
.sy_fenban_tap:hover .sy_fenban_show{ display: block;}