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

288 lines
14 KiB
Plaintext
Raw Normal View History

<%# course_model %>
<%# course_file_num = Attachment.where(:container_type => "Course", :container_id => @course.id).count %>
<% 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 %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','syllabus', 'css/moduel'%>
<%= javascript_include_tag "course","avatars","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="">
2016-09-08 13:59:48 +08:00
<div class="sy_class_infobox pr" id="project_info_<%=@course.id %>">
2016-07-22 15:32:37 +08:00
<%=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-10-14 14:28:19 +08:00
<% course_board = @course.boards.where("parent_id is NULL").first %>
<% unless show_nav?(course_board ? course_board.topics.count : 0) %>
2016-07-22 15:32:37 +08:00
<li id="sy_02" class="sy_icons_boards">
2016-10-14 14:28:19 +08:00
<% count = course_board ? (course_board.topics.count + Message.where("board_id =? and parent_id is not ?", course_board.id, nil).count) : 0 %>
2016-08-25 15:59:09 +08:00
<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)}") if User.current.logged? %>
2016-07-22 15:32:37 +08:00
</li>
2016-10-14 14:28:19 +08:00
<div id="board_children_list">
<%= render :partial => 'layouts/board_children_list', :locals => {:course_board => course_board} %>
</div>
2016-07-22 15:32:37 +08:00
<% 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 id="course_jour_count"><%=course_feedback_count %></span></a>
<%= link_to( "", course_feedback_path(@course), :class => 'sy_class_add', :title =>"#{l(:label_course_feedback)}") if is_teacher %>
2016-07-22 15:32:37 +08:00
</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="<%= User.current.logged? ? exercise_index_path(:course_id => @course.id) : signin_url_without_domain %>">在线测验<span><%=count %></span></a>
2016-07-22 15:32:37 +08:00
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'sy_class_add', :title =>"新建试卷") if is_teacher %>
</li>
<% end %>
2016-09-30 17:12:40 +08:00
<% group_count = @course.course_groups.count %>
<% if !show_nav?(group_count) && ((User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) || User.current.admin?) %>
<li id="sy_09" class="sy_icons_group">
2016-09-30 17:12:40 +08:00
<a href="<%=course_member_path(@course, :role => 2) %>">分班<span><%=group_count %></span></a>
<!--<a href="javascript:void(0);" class="sy_class_add"></a>-->
</li>
<div id="group_children_list">
<%= render :partial => 'layouts/group_children_list', :locals => {:course => @course, :is_teacher => is_teacher} %>
</div>
<% end %>
2016-07-22 15:32:37 +08:00
<% statistics_count = 0 %>
<% unless show_nav?(statistics_count) %>
<li id="sy_10" class="sy_icons_st">
2016-07-22 15:32:37 +08:00
<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-08-29 14:44:33 +08:00
<div class="sy_class_leftbox" >
2016-08-05 14:11:35 +08:00
<h3 class="fontGrey7">班级推荐</h3>
2016-07-22 15:32:37 +08:00
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
</div>
2016-08-29 14:44:33 +08:00
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @course %>
<div class="fontGrey5 mt10 ml20">访问计数 <%= @course.visits.to_i %> 自2016年5月</div>
2016-07-22 15:32:37 +08:00
</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>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @course} %>
</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();
}
<% unless @board.nil? %>
if($("#board_children_<%=@board.id %>").length > 0){
$("#board_children_<%=@board.id %> a").addClass('active');
$(".accordion>li>a").removeClass('active');
}
<% end %>
<% unless @group.nil? %>
if($("#course_group_<%=@group.id %>").length > 0){
$("#course_group_<%=@group.id %> a").addClass('active');
$(".accordion>li>a").removeClass('active');
}
<% end %>
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");
//与更新版本弹窗js冲突新增样式代码
$('#ajax-modal').parent().css({"border":"3px solid #269ac9", "padding":"4px"});
$('#ajax-modal').css("padding","");
}
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();
});
function delete_confirm(){
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您确认要退出该班级吗?</p><div class="cl"></div><a href="<%=join_path(:object_id => @course.id) %>" class="fr sy_btn_blue mr85 mt10" data-method="delete" data-remote="true">确&nbsp;&nbsp;定</a>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取&nbsp;&nbsp;消</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
}
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>