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

276 lines
14 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-->
2016-03-21 16:45:49 +08:00
<%# 课程活跃度 %>
2015-03-18 15:18:06 +08:00
<div class="cl"></div>
2016-03-21 16:45:49 +08:00
<%= render :partial => 'courses/course_activity_users', :locals => {:course => @course} %>
2016-03-21 16:50:24 +08:00
<%# 课程英雄榜 %>
<%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %>
<% if @course.description && !@course.description.blank? %>
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-->
<% end %>
2015-03-18 15:18:06 +08:00
<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
<!--课程推荐-->
2016-03-25 20:11:26 +08:00
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
2016-03-11 15:58:16 +08:00
<div class="fontGrey5 mt10 ml10 mb10">访问计数 <%= @course.visits.to_i %></div>
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>