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

280 lines
14 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%# course_model %>
<% course_file_num = visable_attachemnts_incourse(@course).count%>
<% 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 %>
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8">
<title>
<%= h html_title %>
</title>
<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' %>
<!-- page specific tags -->
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
<script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!--<script type="text/javascript"-->
<!--src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">-->
<!--</script>-->
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
</head>
<!--add by huang-->
<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">
<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>
<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>
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @course %>
<%# over %>
<div class="subNavBox">
<% unless show_nav?(@course.course_activities.count) %>
<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) %>
<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"%>
<%= 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) %>
<div class="subNav">
<%= link_to "通知", course_news_index_path(@course), :class => "f14 c_blue02" %>
<%= 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) %>
<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' %>
<% 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')-->
<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) %>
<div class="subNav">
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %>
<%= 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) %>
<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) %>
<div class="subNav">
<%= 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" %>
<%= 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 %>
<% unless show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count) %>
<div class="subNav">
<%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f14 c_blue02"%>
<%= 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" %>
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'courseMenuSetting', :title =>"新建试卷") if is_teacher %>
</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 %>
</div><!--项目侧导航 end-->
<%# 课程活跃度 %>
<div class="cl"></div>
<%= render :partial => 'courses/course_activity_users', :locals => {:course => @course} %>
<%# 课程英雄榜 %>
<%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %>
<% if @course.description && !@course.description.blank? %>
<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();">
<%= l(:label_expend_information)%>
<span class="g-arr-down">
<img src="/images/jiantou.jpg" width="12" height="6" />
</span>
</div>
</div><!--项目简介 end-->
<% end %>
<div class="project_Label">
<h4 class="mb5" ><%= l(:label_tag)%></h4>
<div class="tag_h" >
<%= render :partial => 'tags/new_tag', :locals => {:obj => @course, :object_flag => "9"} %>
</div>
<div class="cl"></div>
</div><!--项目标签 end-->
<!--课程推荐-->
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
<div class="fontGrey5 mt10 ml10 mb10">访问计数 <%= @course.visits.to_i %></div>
</div><!--LSide end-->
<div id="RSide" class="fl">
<%= yield %>
<%#= render_flash_messages %>
<%#= call_hook :view_layouts_base_content %>
</div>
<div class="cl"></div>
</div><!--Content end-->
</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 %>
</body>
<script>
var blog_artile_list_html = '';
$(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);
},500);
}
function course_outline_search(e){
// if($(e.target).val().trim() == ''){
// return;
// }
$("#course_outline_hint").hide();
$.ajax({
url:'<%=search_course_outline_course_path(@course) %>'+"?&title="+ e.target.value,
type:'post',
success:function(data){
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('');
$("#course_outline_hint").show();
}
}
})
}
})
//资源库上传附件
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>");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
}
// 鼠标经过的时候显示内容
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();
}
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();
});
</script>
</html>