Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
lizanle 2015-10-29 17:09:18 +08:00
commit 0815cde772
7 changed files with 65 additions and 26 deletions

View File

@ -163,9 +163,9 @@ class MembersController < ApplicationController
#给新成员和老师发送加入课程的消息发送者id放在CourseMessage的course_message_id字段中 #给新成员和老师发送加入课程的消息发送者id放在CourseMessage的course_message_id字段中
#course_message_type设置为JoinCourse #course_message_type设置为JoinCourse
#status = 0 表示给学生发status = 1表示给老师发 #status = 0 表示给学生发status = 1表示给老师发
course_join = CourseMessage.new(:user_id =>user_id, :course_message_id=>User.current.id,:course_id => @course.id,:course_message_type=>"JoinCourse", :viewed => false, :status => 0) course_join = CourseMessage.new(:user_id =>user_id, :course_message_id=>User.current.id,:course_id => @course.id,:course_message_type=>"JoinCourse", :content => role, :viewed => false, :status => 0)
course_join.save course_join.save
CourseMessage.create(:user_id => User.current.id, :course_message_id => user_id, :course_id => @course.id, :course_message_type => "JoinCourse", :viewed => false, status => 1) CourseMessage.create(:user_id => User.current.id, :course_message_id => user_id, :course_id => @course.id, :course_message_type => "JoinCourse",:content => role, :viewed => false, :status => 1)
members << member members << member
#user_grades << UserGrade.new(:user_id => user_id, :course_id => @course.id) #user_grades << UserGrade.new(:user_id => user_id, :course_id => @course.id)

View File

@ -628,10 +628,10 @@ module CoursesHelper
#重启、关闭课程按钮 #重启、关闭课程按钮
def set_course_time course def set_course_time course
id = "finish_course_#{course.id}" # id = "finish_course_#{course.id}"
linkPath = course_endTime_timeout?(course) ? restartcourse_course_path(course) : finishcourse_course_path(course, format: :js) # linkPath = course_endTime_timeout?(course) ? restartcourse_course_path(course) : finishcourse_course_path(course, format: :js)
desc = course_endTime_timeout?(course) ? l(:label_course_reload) : l(:label_course_closed) # desc = course_endTime_timeout?(course) ? l(:label_course_reload) : l(:label_course_closed)
link_to "<span class='pr_close'></span>#{desc}".html_safe, linkPath, :remote => true, :method => :post, :id => id, :confirm => l(:label_course_closed_tips, :desc => desc), :class => "pr_join_a" # link_to "<span class='pr_close'></span>#{desc}".html_safe, linkPath, :remote => true, :method => :post, :id => id, :confirm => l(:label_course_closed_tips, :desc => desc), :class => "pr_join_a"
end end
#加入课程、退出课程按钮 #加入课程、退出课程按钮

View File

@ -327,7 +327,7 @@ class CoursesService
end end
else else
if params[:course_password] == course.password if params[:course_password] == course.password
if params[:role] == "10" if params[:role] == "10" || params[:role] == nil
members = [] members = []
members << Member.new(:role_ids => [10], :user_id => current_user.id) members << Member.new(:role_ids => [10], :user_id => current_user.id)
course.members << members course.members << members

View File

@ -4,7 +4,7 @@ $("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(@c
<% if @state %> <% if @state %>
<% if @state == 0 %> <% if @state == 0 %>
alert("加入成功"); alert("加入成功");
hidden_join_course_form(); hideModal();
$("#try_join_course_link").replaceWith("<a href='<%=url_for(:controller => 'homework_common', :action => 'index',:course=>@course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品</a>"); $("#try_join_course_link").replaceWith("<a href='<%=url_for(:controller => 'homework_common', :action => 'index',:course=>@course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品</a>");
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% elsif @state == 1 %> <% elsif @state == 1 %>

View File

@ -18,13 +18,6 @@
<script type="text/javascript"> <script type="text/javascript">
function clickCanel(){hideModal("#popbox02");} function clickCanel(){hideModal("#popbox02");}
function clickSure()
{
if ($('#new_join_course').submit())
{
hideModal("#popbox02");
}
}
</script> </script>
</head> </head>
@ -40,7 +33,7 @@
<label>请输入课程密码:</label> <label>请输入课程密码:</label>
<%= text_field_tag 'course_password', nil, :style=>'width:300px;'%> <%= text_field_tag 'course_password', nil, :style=>'width:300px;'%>
<div class="ni_btn"> <div class="ni_btn">
<a href="javascript:" class="tijiao" onclick="clickSure();" > <a href="javascript:" class="tijiao" onclick="$('#new_join_course').submit();" >
确&nbsp;&nbsp;定 确&nbsp;&nbsp;定
</a> </a>
<a href="javascript:" class="tijiao" onclick="clickCanel();"> <a href="javascript:" class="tijiao" onclick="clickCanel();">

View File

@ -426,10 +426,16 @@
</p> </p>
<p>课程名称:<%= ma.course_message.name %></p> <p>课程名称:<%= ma.course_message.name %></p>
<p>开课学期:<%= ma.course_message.time.to_s + '年' + ma.course_message.term %></p> <p>开课学期:<%= ma.course_message.time.to_s + '年' + ma.course_message.term %></p>
<div class="fl">课程描述:</div> <p>课程ID<span style="color:red;"><%= ma.course_message.id %></span></p>
<div class="ml60"><%= ma.course_message.description.html_safe %></div> <p>课程密码:<span style="color:red;"><%= ma.course_message.password %></span></p>
<p>学时总数:<%= ma.course_message.class_period %></p> <p>学时总数:<%= ma.course_message.class_period %></p>
<p>创建时间:<%= format_time(ma.course_message.created_at) %></p> <p>创建时间:<%= format_time(ma.course_message.created_at) %></p>
<p>您可以点击左上角的“配置”按钮修改课程基本信息添加及删除课程成员。您也可以把课程ID及密码告诉学生和其他成员让他们输入ID及密码加入课程。</p>
<% if ma.course_message.is_public %>
<p>您的课程是公开的,所有人都能访问您的课程。若不想设置为公开,您可以在配置中设置。</p>
<% else %>
<p>您的课程是私有的,非课程成员不能访问您的课程。如果想设置为公开,您可以在配置中设置。</p>
<% end %>
</div> </div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul> </ul>
@ -505,7 +511,7 @@
<% end %> <% end %>
<!--被老师拉入课程--> <!--被老师拉入课程-->
<% if ma.course_message_type == "JoinCourse" %> <% if ma.course_message_type == "JoinCourse" and ma.status == 0 %>
<ul class="homepageNewsList fl"> <ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"> <li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %></a> <a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %></a>
@ -521,8 +527,44 @@
</li> </li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %> <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
<p>课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)</p> <% teacher = User.find(ma.course_message_id) %>
<p>课程描述:<%= ma.course.description.blank? ? '无':ma.course.description %></p> <p><%= teacher.show_name %>(<%= teacher %>)老师把您加入了课程,详情如下:</p>
<p>课程名称:<%= ma.course.name %></p>
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
<p>课程ID<%= ma.course.id %></p>
<p>课时总数:<%= ma.course.class_period %></p>
<% else %>
<p>
您已经被移出该私有课程,非课程成员没有权限访问私有课程
</p>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<!--被老师拉入课程-->
<% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"></a>
</li>
<li class="homepageNewsPubType fl">
<span class="newsBlue homepageNewsPublisher">系统提示</span>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">您增加了新的课程成员:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to User.find(ma.course_message_id), user_path(ma.course_message_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover => "message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
<p>您增加了新的课程成员,详情如下:</p>
<p>成员:<%= User.find(ma.course_message_id) %></p>
<p>课程名称:<%= ma.course.name %></p>
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
<p>课程ID<%= ma.course.id %></p>
<p>课时总数:<%= ma.course.class_period %></p> <p>课时总数:<%= ma.course.class_period %></p>
<% else %> <% else %>
<p> <p>
@ -551,8 +593,12 @@
</li> </li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<% if ma.course.is_public? || User.current.member_of?(ma.course) || User.current.admin? %> <% if ma.course.is_public? || User.current.member_of?(ma.course) || User.current.admin? %>
<p>课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)</p> <p>您已被<%= User.find(ma.course_message_id).show_name %>老师移出了课程,详情如下:</p>
<p>课程描述:<%= ma.course.description.blank? ? '无' : ma.course.description %></p> <p>课程名称:<%= ma.course.name %></p>
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
<% if !ma.content.nil? %>
<p>担任角色:<%= ma.content %></p>
<% end %>
<p>学时总数:<%= ma.course.class_period %></p> <p>学时总数:<%= ma.course.class_period %></p>
<% else %> <% else %>
<p> <p>

View File

@ -36,7 +36,7 @@
:onmouseout => "message_titile_hide($(this))" %></a> :onmouseout => "message_titile_hide($(this))" %></a>
</li> </li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<% if ma.project.is_public? || User.current.member_of?(ma.project) %> <% if ma.project.is_public? || User.current.member_of?(ma.project) || User.current.admin? %>
<p> <p>
项目名称:<%= ma.project.name %> 项目名称:<%= ma.project.name %>
</p> </p>
@ -69,7 +69,7 @@
:onmouseout => "message_titile_hide($(this))" %></a> :onmouseout => "message_titile_hide($(this))" %></a>
</li> </li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<% if ma.project.is_public? || User.current.member_of?(ma.project) %> <% if ma.project.is_public? || User.current.member_of?(ma.project) || User.current.admin? %>
<p> <p>
项目名称:<%= ma.project.name %> 项目名称:<%= ma.project.name %>
</p> </p>