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

244 lines
12 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)) %>
2016-06-30 15:36:46 +08:00
<% homework_num = visable_course_homework @course %>
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 %>
2016-07-22 15:32:37 +08:00
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','syllabus'%>
<%= 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();">
2016-07-22 15:32:37 +08:00
<div class="navContainer">
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>
<% else%>
<%= render :partial => 'layouts/unlogin_header' %>
<% end%>
</div>
<div class="cl"></div>
2016-07-22 15:32:37 +08:00
<div class="">
<div class="sy_class_infobox">
<%=render :partial => 'layouts/course_base_info' %>
</div>
<div class="sy_content">
<div class="sy_class_l fl" id="courseLSide">
<div class="sy_class_leftnav mb12">
<ul class="accordion">
<% unless show_nav?(@course.course_activities.count) %>
<li id="sy_01" class="sy_icons_index">
<a href="<%=course_path(@course) %>" >动态<span><%=@course.course_activities.count %></span></a>
</li>
<% end %>
2016-07-22 15:32:37 +08:00
<% unless show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
<li id="sy_02" class="sy_icons_boards">
<% count = @course.boards.first ? (@course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", @course.boards.first.id, nil).count) : 0 %>
<a href="<%=course_boards_path(@course) %>">问答区<span><%=count %></span></a>
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") %>
</li>
<% end %>
<% unless show_nav?(@course.homework_commons.count) %>
<li id="sy_03" class="sy_icons_hwork">
<a href="<%= homework_common_index_path(:course => @course.id) %>">作业<span><%=homework_num %></span></a>
<%= link_to( "",homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_course_homework_new)}") if is_teacher %>
</li>
<% end %>
<% unless show_nav?(@course.news.count) %>
<li id="sy_04" class="sy_icons_news">
<a href="<%=course_news_index_path(@course) %>">通知<span><%=@course.news.count %></span></a>
<%= link_to( "",new_course_news_path(@course,:is_new=>1), :class => 'sy_class_add', :title =>"#{l(:label_course_news_new)}") if is_teacher %>
</li>
<% end %>
<% unless show_nav?(course_file_num) %>
<li id="sy_05" class="sy_icons_files">
<a href="<%=course_files_path(@course) %>">资源库<span><%=course_file_num %></span></a>
<% if is_teacher || (@course.publish_resource == 1 && User.current.member_of_course?(@course)) %>
<a class="sy_class_add" title="上传资源" href="javascript:void(0);" onclick="course_files_upload();"> </a>
<% end %>
</li>
<% end %>
<% unless show_nav?(course_feedback_count) %>
<li id="sy_06" class="sy_icons_feedback">
<a href="<%=course_feedback_path(@course) %>">留言<span><%=course_feedback_count %></span></a>
<%= link_to "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%>
</li>
<% end %>
<% unless show_nav?(course_poll_count) %>
<li id="sy_07" class="sy_icons_poll">
<a href="<%=poll_index_path(:polls_type => "Course", :polls_group_id => @course.id) %>">问卷调查<span><%=course_poll_count %></span></a>
<%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'sy_class_add', :title =>"#{l(:label_new_poll)}") if is_teacher %>
</li>
<% end %>
<% count = User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status <> 1").count %>
<% unless show_nav?(count) %>
<li id="sy_08" class="sy_icons_exercise">
<a href="<%=exercise_index_path(:course_id => @course.id) %>">在线测验<span><%=count %></span></a>
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'sy_class_add', :title =>"新建试卷") if is_teacher %>
</li>
<% end %>
<% statistics_count = 0 %>
<% unless show_nav?(statistics_count) %>
<li id="sy_09" class="sy_icons_st">
<a href="<%=statistics_course_course_path(@course) %>">统计<span></span></a>
<!--<a href="javascript:void(0);" class="sy_class_add"></a>-->
</li>
<% 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 || statistics_count == 0%>
<li id="expand_tools_expand" class="sy_icons_more"><a href="javascript:void(0)"> 更多</a>
</li>
<ul class="sub-menu undis" id="navContentCourse">
<%= render :partial => 'courses/tool_expand' %>
</ul>
<% end %>
</ul>
</div><!--sy_class_leftnav end-->
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} %>
2016-07-22 15:32:37 +08:00
<div class="sy_class_leftbox mb15" >
<h3>班级推荐</h3>
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
</div>
</div><!--sy_class_l end-->
<div class="fl">
<%= yield %>
2016-07-22 15:32:37 +08:00
</div><!--sy_class_r end-->
2015-09-16 15:51:35 +08:00
<div class="cl"></div>
2016-07-22 15:32:37 +08:00
</div><!--sy_content end-->
</div>
2016-07-22 15:32:37 +08:00
<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(){
2016-07-22 15:32:37 +08:00
if($("#sy_0<%=@left_nav_type %>").length > 0){
$("#sy_0<%=@left_nav_type %> a").addClass('active');
} else {
$("#expand_tools_expand a").addClass('active');
$("#navContentCourse").toggle();
}
2015-10-29 09:07:26 +08:00
$(document).on('input','input[name="course_outline_search"]',function(e){
throttle(course_outline_search,window,e);
2016-07-22 15:32:37 +08:00
});
2015-10-29 09:07:26 +08:00
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
}
})
}
2016-07-22 15:32:37 +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(){
2016-07-22 15:32:37 +08:00
var accordion_head = $('.accordion > li > a');
accordion_head.removeClass('active');
$("#expand_tools_expand a").addClass('active');
$("#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>