socialforge/app/views/layouts/base_courses.html.erb

354 lines
19 KiB
Plaintext
Raw Normal View History

<%# course_model %>
<% course_file_num = visable_attachemnts_incourse(@course).count%>
2015-03-18 15:18:06 +08:00
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,@course) %>
<% homework_num = @course.homework_commons.count %>
<% else %>
<% homework_num = @course.homework_commons.where("publish_time <= '#{Date.today}'").count %>
<% end %>
2013-12-11 10:00:38 +08:00
<!DOCTYPE html>
2016-03-04 21:10:45 +08:00
<html lang="en" xmlns="http://www.w3.org/1999/html">
2014-05-19 17:56:39 +08:00
<head>
<meta charset="utf-8">
<title>
<%= h html_title %>
</title>
2014-05-19 17:56:39 +08:00
<meta name="description" content="<%= Redmine::Info.app_name %>"/>
<meta name="keywords" content="issue,bug,tracker"/>
<%= csrf_meta_tag %>
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'header','jquery/jquery-ui-1.9.2','public', 'leftside','prettify', 'courses','share'%>
<%= javascript_include_tag "course","header","attachments",'prettify' %>
2014-05-19 17:56:39 +08:00
<!-- page specific tags -->
<%= yield :header_tags -%>
2015-11-17 15:24:01 +08:00
<!-- MathJax的配置 -->
<script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
2015-11-17 15:24:01 +08:00
</script>
<!--<script type="text/javascript"-->
<!--src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">-->
<!--</script>-->
2015-11-17 15:24:01 +08:00
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
2015-11-17 15:24:01 +08:00
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
2014-05-19 17:56:39 +08:00
</head>
<!--add by huang-->
2015-09-29 15:13:05 +08:00
<body onload="prettyPrint();">
<div class="navContainer mb10">
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>
<% else%>
<%= render :partial => 'layouts/unlogin_header' %>
<% end%>
</div>
<div class="cl"></div>
<div id="Container">
2015-03-18 10:47:30 +08:00
<div id="content">
<div id="LSide" class="fl">
<div class="project_info" style="position: relative" id="project_info_<%=@course.id %>">
<%=render :partial=>'layouts/project_info' %>
</div><!--课程信息 end-->
<div class="info_box">
<ul>
2015-03-18 15:18:06 +08:00
<li><%= l(:label_main_teacher)%> :&nbsp;&nbsp;<%= link_to(@course.teacher.lastname+@course.teacher.firstname, user_path(@course.teacher), :class => 'c_dblue') %></li>
<li><%= l(:label_class_period)%> :&nbsp;&nbsp;<span ><%= @course.class_period %> <%= l(:label_class_hour) %></span></li>
<li><%= l(:label_main_term)%> :&nbsp;&nbsp;<span><%= current_time_and_term @course %></span></li>
<% if @course.school%>
<li><%= l(:label_course_organizers)%> :&nbsp;&nbsp;<%= @course.school%></li>
<% end%>
</ul>
</div>
<div class="subNavBox">
<% unless show_nav?(@course.course_activities.count) %>
2015-03-18 15:18:06 +08:00
<div class="subNav">
<%= link_to l(:label_activity), course_path(@course), :class => "f14 c_blue02" %>
<!--暂时不显示课程动态数,优化后在显示-->
<%= link_to "(#{@course.course_activities.count})", course_path(@course), :class => "subnav_num c_orange"%>
</div>
<% end %>
<% unless show_nav?(@course.homework_commons.count) %>
2015-03-18 15:18:06 +08:00
<div class="subNav">
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%>
<%= link_to "(#{homework_num})", homework_common_index_path(:course => @course.id), :class => "subnav_num c_orange"%>
2015-11-26 21:17:04 +08:00
<%= link_to( "", homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_homework_new)}") if is_teacher %>
</div>
<% end %>
<% unless show_nav?(@course.news.count) %>
2015-03-18 15:18:06 +08:00
<div class="subNav">
2016-03-07 11:27:47 +08:00
<%= link_to "通知", course_news_index_path(@course), :class => "f14 c_blue02" %>
2015-03-18 15:18:06 +08:00
<%= link_to "(#{@course.news.count})", course_news_index_path(@course), :class => "subnav_num c_orange"%>
<%= link_to( "", new_course_news_path(@course,:is_new=>1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_news_new)}") if is_teacher %>
</div>
<% end %>
<% unless show_nav?(course_file_num) %>
2015-03-18 15:18:06 +08:00
<div class="subNav">
<%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{course_file_num})", course_files_path(@course), :class => "subnav_num c_orange",:id=>'courses_files_count_nav' %>
2015-11-18 10:18:54 +08:00
<% if is_teacher || (@course.publish_resource == 1 && User.current.member_of_course?(@course)) %>
<!--link_to( "+#{l(:label_upload_files)}", course_files_path(@course), :class => 'subnav_green ml95 c_white')-->
2015-11-26 21:17:04 +08:00
<a class="courseMenuSetting" title="上传资源" href="javascript:void(0);" onclick="course_files_upload();"> </a>
<% end %>
</div>
<% end %>
<% unless show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
2015-03-18 15:18:06 +08:00
<div class="subNav">
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %>
2016-01-15 16:30:17 +08:00
<%= link_to "(#{@course.boards.first ? (@course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", @course.boards.first.id, nil).count) : 0})", course_boards_path(@course), :class => "subnav_num c_orange" %>
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") %>
</div>
<% end %>
<% unless show_nav?(course_feedback_count) %>
2015-03-18 15:18:06 +08:00
<div class="subNav">
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{course_feedback_count})", course_feedback_path(@course), :class => "subnav_num c_orange", :id => "course_jour_count"%>
<%= link_to "", course_feedback_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%>
</div>
<% end %>
<% unless show_nav?(course_poll_count) %>
2015-03-18 15:18:06 +08:00
<div class="subNav">
2015-03-19 15:04:44 +08:00
<%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => " f14 c_blue02"%>
<%= link_to "(#{course_poll_count})", poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => "subnav_num c_orange" %>
2015-11-26 21:17:04 +08:00
<%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'courseMenuSetting', :title =>"#{l(:label_new_poll)}") if is_teacher %>
</div>
<% end %>
2015-12-15 10:43:43 +08:00
<% unless show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count) %>
2015-11-13 16:40:39 +08:00
<div class="subNav">
<%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f14 c_blue02"%>
2015-12-15 10:43:43 +08:00
<%= link_to "(#{User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count})", exercise_index_path(:course_id => @course.id), :class => "subnav_num c_orange" %>
2015-11-26 21:17:04 +08:00
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'courseMenuSetting', :title =>"新建试卷") if is_teacher %>
2015-11-13 16:40:39 +08:00
</div>
<% end %>
<%# 工具栏展开 %>
<% if @course.homework_commons.count == 0 || @course.news.count == 0 || course_file_num == 0 || course_poll_count == 0 || @course.exercises.count == 0 ||
course_feedback_count == 0 || @course.exercises.count == 0 || (@course.boards.first ? @course.boards.first.topics.count : 0) == 0 %>
<div class="subNav subNav_jiantou" id="expand_tools_expand"><%= l(:label_project_more) %></div>
<ul class="navContent" id="navContentCourse">
<%= render 'courses/tool_expand', :locals => {:is_teacher => is_teacher, :course_file_num => course_file_num} %>
</ul>
<% end %>
2015-03-18 15:18:06 +08:00
</div><!--项目侧导航 end-->
<%# 课程贡献榜 %>
2015-03-18 15:18:06 +08:00
<div class="cl"></div>
<% unless contributor_course_scor(@course.id).count == 0 %>
<ul class="rankList">
2016-03-06 12:15:57 +08:00
<h4>课程活跃度
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))">积分规则</a>
</h4>
<div style="display: none;padding: 5px;" class="numIntro color_888">
<div class="contributor_course_innor">积分规则</div>
2016-03-05 10:38:21 +08:00
资源发布:资源数 x 5 </br>
问答发布:发帖数 x 2 </br>
通知发布:通知数 x 1 </br>
问答回复:回复数 x 1 </br>
作业留言:留言数 x 1 </br>
通知留言:留言数 x 1 </br>
课程留言:留言数 x 1 </br>
2016-03-04 21:10:45 +08:00
总得分为以上得分之和
</div>
<% contributor_course_scor(@course.id).each do |contributor_score| %>
2016-03-05 04:29:10 +08:00
<% 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 %>
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %></a>
<p><a href="javascript:void:(0);"><%=link_to contributor_score.user.show_name, user_path(contributor_score.user), :title => contributor_score.user.show_name %></a></p>
<p><span class="c_green" style="cursor:pointer">
2016-03-04 21:10:45 +08:00
<a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))" class="c_green">
2016-03-05 04:29:10 +08:00
<%=total_score %></a></span></p>
2016-03-06 12:15:57 +08:00
<div style="display: none" class="numIntro color_888">
<div class="contributor_course_calculate">积分计算</div>
2016-03-04 21:10:45 +08:00
<%# unless contributor_score.resource_num.to_i == 0 %>
2016-03-06 12:15:57 +08:00
<div style="padding-left: 2px;padding-bottom: 2px;padding-right: 2px">
资源发布数 x 5 = <%= contributor_score.resource_num.to_i %> x 5 = <%= contributor_score.resource_num.to_i * 5 %></br>
<%# end %>
<%# unless contributor_score.message_num.to_i == 0 %>
问答发布数 x 2 = <%= contributor_score.message_num.to_i %> x 2 = <%= contributor_score.message_num.to_i * 2 %></br>
通知发布数 x 1 = <%= contributor_score.news_num.to_i %> x 1 = <%= contributor_score.news_num.to_i %></br>
<%# end %>
<%# unless contributor_score.message_reply_num.to_i == 0 %>
问答回帖数 x 1 = <%= contributor_score.message_reply_num.to_i %> x 1 = <%= contributor_score.message_reply_num.to_i %></br>
作业留言数 x 1 = <%= contributor_score.homework_journal_num.to_i %> x 1 = <%= contributor_score.homework_journal_num.to_i %></br>
通知留言数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %></br>
<%# end %>
<%# unless contributor_score.journal_num.to_i == 0 %>
课程留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %></br>
<%# end %>
<%# unless contributor_score.homework_journal_num.to_i == 0 %>
2016-03-05 10:38:21 +08:00
2016-03-06 12:15:57 +08:00
<%# end %>
<%# unless contributor_score.news_reply_num.to_i == 0 %>
2016-03-05 10:38:21 +08:00
2016-03-06 12:15:57 +08:00
<%# end %>
总得分:<%=total_score %>
</div>
</div>
</li>
<% end %>
2015-11-26 21:17:04 +08:00
<% end %>
<div class="cl"></div>
</ul>
<% end %>
<% hero_homework_scores = hero_homework_score(@course, "desc") %>
2015-11-30 15:42:00 +08:00
<% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %>
<ul class="rankList">
2016-03-05 10:38:21 +08:00
<h4><span>课程英雄榜</span>
2016-03-06 12:15:57 +08:00
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))">积分规则</a></h4>
<div style="display: none" class="numIntro color_888">
<div class="hero_course_innor">积分规则</div>
2016-03-05 10:38:21 +08:00
英雄榜的得分是每个同学作业的得分总和
</div>
<% hero_homework_scores.each do |student_score| %>
2015-11-30 15:42:00 +08:00
<% if student_score.score.to_i != 0 %>
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %></a>
<p><a href="javascript:void:(0);"><%=link_to student_score.user.show_name, user_path(student_score.user), :title => student_score.user.show_name %></a></p>
2016-03-05 10:38:21 +08:00
<p><span class="c_red" style="cursor:pointer" ><%= student_score.score<0 ? 0 : student_score.score.to_i %></span></p>
</li>
<% end %>
<% end %>
<div class="cl"></div>
</ul>
<% end %>
2015-03-18 15:18:06 +08:00
<div class="project_intro">
<div id="course_description" class="course_description">
<h4 ><%= l(:label_course_brief_introduction)%></h4>
<div id="course_description_content">
<%= textilizable(@course.description) if @course.description && !@course.description.blank? %>
</div>
</div>
<div class="lg-foot" id="lg-foot" onclick="show_more_msg();">
2015-03-18 15:18:06 +08:00
<%= l(:label_expend_information)%>
<span class="g-arr-down">
<img src="/images/jiantou.jpg" width="12" height="6" />
</span>
</div>
2015-03-18 15:18:06 +08:00
</div><!--项目简介 end-->
<div class="project_Label">
2016-01-20 18:37:39 +08:00
<h4 class="mb5" ><%= l(:label_tag)%></h4>
2015-03-18 15:18:06 +08:00
<div class="tag_h" >
<%= render :partial => 'tags/new_tag', :locals => {:obj => @course, :object_flag => "9"} %>
</div>
<div class="cl"></div>
2015-03-18 15:18:06 +08:00
</div><!--项目标签 end-->
2016-01-15 10:35:56 +08:00
<!--课程推荐-->
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
2015-03-18 15:18:06 +08:00
</div><!--LSide end-->
<div id="RSide" class="fl">
<%= yield %>
2015-09-16 15:51:35 +08:00
<%#= render_flash_messages %>
<%#= call_hook :view_layouts_base_content %>
</div>
2015-09-16 15:51:35 +08:00
<div class="cl"></div>
</div><!--Content end-->
2015-03-18 10:47:30 +08:00
</div><!--Container end-->
<div class="cl"></div>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<%= render :partial => 'layouts/new_feedback' %>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="ajax-modal" style="display:none;"></div>
<%= call_hook :view_layouts_base_body_bottom %>
2014-05-19 17:56:39 +08:00
</body>
2015-10-29 09:07:26 +08:00
<script>
2015-10-29 11:53:52 +08:00
var blog_artile_list_html = '';
2015-10-29 09:07:26 +08:00
$(function(){
$(document).on('input','input[name="course_outline_search"]',function(e){
throttle(course_outline_search,window,e);
})
function throttle(method,context,e){
clearTimeout(method.tId);
method.tId=setTimeout(function(){
method.call(context,e);
2015-10-29 11:53:52 +08:00
},500);
2015-10-29 09:07:26 +08:00
}
function course_outline_search(e){
2015-10-29 11:53:52 +08:00
// if($(e.target).val().trim() == ''){
// return;
// }
$("#course_outline_hint").hide();
2015-10-29 09:07:26 +08:00
$.ajax({
2015-10-29 11:53:52 +08:00
url:'<%=search_course_outline_course_path(@course) %>'+"?&title="+ e.target.value,
2015-10-29 09:07:26 +08:00
type:'post',
success:function(data){
2015-10-29 11:53:52 +08:00
if(data.length != 0 ){
$("#course_outline_list").html('');
for(var i =0;i<data.length;i++){
var html = ' <ul class="blogRow"> '+
' <li class="fl"> '+
'<input name="outline_id" type="radio" value="'+data[i].blog_comment.id+'" class="courseSendCheckbox"/>'+
'</li>'+
'<li class="blogTitle fl">'+data[i].blog_comment.title+'</li>'+
'</ul>'+
'<div class="homeworkPublishTime">发布时间:'+data[i].blog_comment.created_at.match(/(\S*)T/)[1]+'</div>';
$("#course_outline_list").append(html)
}
}else{
$("#course_outline_list").html('');
2015-10-29 11:53:52 +08:00
$("#course_outline_hint").show();
}
2015-10-29 09:07:26 +08:00
}
})
}
})
function course_files_upload(){
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_course_files',:locals => {:course => @course,:course_attachment_type => 1}) %>');
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
2016-01-20 16:03:28 +08:00
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
}
2015-11-26 21:17:04 +08:00
// 鼠标经过的时候显示内容
function message_titile_show(obj,e)
{
obj.parent().parent().next("div").show();
obj.parent().next("div").css("top",e.pageY).css("left",e.pageX).css("position","absolute");
}
function message_titile_hide(obj)
{
obj.parent().parent().next("div").hide();
}
2016-03-04 21:10:45 +08:00
function message_titile_show2(obj,e)
{
obj.parent().next("div").show();
obj.parent().next("div").css("top",e.pageY).css("left",e.pageX).css("position","absolute");
}
function message_titile_hide2(obj)
{
obj.parent().next("div").hide();
}
$("#expand_tools_expand").click(function(){
$("#navContentCourse").toggle();
});
2015-10-29 09:07:26 +08:00
</script>
2014-05-20 09:12:15 +08:00
2013-09-14 09:51:26 +08:00
</html>