commit
feb9125085
@ -0,0 +1,7 @@
|
|||||||
|
class CourseActivity < ActiveRecord::Base
|
||||||
|
attr_accessible :user_id, :course_act_id,:course_act_type,:course_id
|
||||||
|
# 虚拟关联
|
||||||
|
belongs_to :course_act ,:polymorphic => true
|
||||||
|
belongs_to :course
|
||||||
|
belongs_to :user
|
||||||
|
end
|
@ -1,2 +1,12 @@
|
|||||||
$("#test_send_<%= @index%>").replaceWith("<a class='<%= @result == 0 ? 'green_btn' : 'red_btn'%> fl ml5 mt1 programing_test' onclick='programing_test(<%= @index%>)' id='test_send_<%= @index%>'><%= @result == 0 ? '正确' : '错误'%></a>");
|
$("#test_send_<%= @index%>").replaceWith("<a class='<%= @result == 0 ? 'green_btn' : 'red_btn'%> fl ml5 mt1 programing_test' onclick='programing_test(<%= @index%>)' id='test_send_<%= @index%>'><%= @result == 0 ? '正确' : '错误'%></a>");
|
||||||
$("#test_result_<%= @index%>").val("<%= @result%>");
|
$("#test_result_<%= @index%>").val("<%= @result%>");
|
||||||
|
<% if @err_msg || @result != 0%>
|
||||||
|
$("#homework_work_test_show").show();
|
||||||
|
$("#homework_work_test_desc").text("<%= escape_javascript(@err_msg || status_to_err_msg(@result))%>");
|
||||||
|
<% if @err_msg%>
|
||||||
|
$("#homework_test_error_msg").val("<%= escape_javascript(@err_msg)%>");
|
||||||
|
<% end%>
|
||||||
|
<% else%>
|
||||||
|
$("#homework_work_test_show").hide();
|
||||||
|
$("#homework_test_error_msg").val("");
|
||||||
|
<% end%>
|
@ -0,0 +1,46 @@
|
|||||||
|
<div id="Footer">
|
||||||
|
<div class="footerAboutContainer">
|
||||||
|
<ul class="footerAbout">
|
||||||
|
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li>
|
||||||
|
<li class="fl"><a href="http://forge.trustie.net/projects/2/feedback" class="f_grey mw20" target="_blank"><%= l(:label_contact_us)%></a>|</li>
|
||||||
|
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_recruitment_information)%></a>|</li>
|
||||||
|
<li class="fl"><a href="http://forge.trustie.net/forums/1/memos/1168" class="f_grey mw20" target="_blank"><%= l(:label_surpport_group)%></a>|</li>
|
||||||
|
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_forums)%></a>|</li>
|
||||||
|
<li class="fl"><a href="javascript:void:(0);" class="f_grey ml20" target="_blank"><%= l(:label_language)%></a>
|
||||||
|
<select class="languageBox">
|
||||||
|
<option value="Chinese" selected="selected">中文</option>
|
||||||
|
<option value="English">英文</option>
|
||||||
|
</select>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cl"></div>
|
||||||
|
<ul class="departments">
|
||||||
|
<li class="fl mr10">
|
||||||
|
<strong><%= l(:label_hosted_organization)%></strong><a href="http://www.nudt.edu.cn/ArticleShow.asp?ID=47" class=" ml10 f_grey" target="_blank"><%= l(:label_hosted_by)%></a>
|
||||||
|
</li>
|
||||||
|
<li class="fl">
|
||||||
|
<a href="http://www.nudt.edu.cn/ArticleShow.asp?ID=41" class="mr45 f_grey" target="_blank"><%= l(:label_sponsor)%></a>
|
||||||
|
</li>
|
||||||
|
<li class="fl mr10">
|
||||||
|
<strong><%= l(:label_partners)%></strong><a href="http://eecs.pku.edu.cn" class="ml10 f_grey" target="_blank"><%= l(:label_co_organizer_EECS)%></a>
|
||||||
|
</li>
|
||||||
|
<li class="fl">
|
||||||
|
<a href="http://scse.buaa.edu.cn/" class="mr10 f_grey" target="_blank"><%= l(:label_co_organizer_BHU)%></a>
|
||||||
|
</li>
|
||||||
|
<li class="fl">
|
||||||
|
<a href="http://www.iscas.ac.cn/" class="mr10 f_grey" target="_blank"><%= l(:label_co_organizer_CAS)%></a>
|
||||||
|
</li>
|
||||||
|
<li class="fl">
|
||||||
|
<a href="http://www.inforbus.com/" class="f_grey" target="_blank"><%= l(:label_co_organizer_InforS)%></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<ul class="copyright">
|
||||||
|
<li class="fl"><%= l(:label_rights_reserved)%></li>
|
||||||
|
<span class="fl mw15">|</span>
|
||||||
|
<li class="fl"><a href="http://www.miibeian.gov.cn/" class="fl f_grey" target="_blank"><%= l(:label_license)%></a></li>
|
||||||
|
</ul>
|
||||||
|
</div><!--Footer end-->
|
||||||
|
<div class="cl"></div>
|
@ -0,0 +1,37 @@
|
|||||||
|
<div id="popbox_upload" style="margin-top: -30px;margin-left: -20px;margin-right: -10px;">
|
||||||
|
<div class="upload_con">
|
||||||
|
<h2>选择问卷导入本课程</h2>
|
||||||
|
<div class="upload_box">
|
||||||
|
<div id="error_show" style="color: red;"></div>
|
||||||
|
<%= form_tag import_other_poll_poll_index_path,
|
||||||
|
method: :post,
|
||||||
|
remote: true,
|
||||||
|
id: "relation_file_form" do %>
|
||||||
|
<input type="hidden" name="course_id" value="<%= polls_group_id%>" />
|
||||||
|
<%= content_tag('div', poll_check_box_tags('polls[]', polls,polls_group_id), :id => 'courses',:style=> 'width: 300px;')%>
|
||||||
|
<a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" style="margin-left: 0px !important;" onclick="submit_quote();">导 入</a>
|
||||||
|
<a href="javascript:void(0)" class="blue_btn grey_btn fl c_white " onclick="closeModal();">取 消</a>
|
||||||
|
<% end -%>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function submit_quote() {
|
||||||
|
$('#error_show').html('');
|
||||||
|
var selected = false;
|
||||||
|
for(var i = 0; i < $("input[name='polls[]']").length;i++){
|
||||||
|
if($("input[name='polls[]']")[i].checked){
|
||||||
|
selected = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selected){
|
||||||
|
$('#submit_quote').parent().submit();
|
||||||
|
closeModal();
|
||||||
|
}else{
|
||||||
|
$('#error_show').html('您没有选择任何问卷');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -0,0 +1,10 @@
|
|||||||
|
<% polls.each do |poll|%>
|
||||||
|
<ul id="polls_<%= poll.id %>" class="polls_list_ul">
|
||||||
|
<%= render :partial => 'poll', :locals => {:poll => poll} %>
|
||||||
|
</ul>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<% end%>
|
||||||
|
|
||||||
|
<ul class="wlist">
|
||||||
|
<%= pagination_links_full obj_pages, obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||||
|
</ul>
|
@ -0,0 +1 @@
|
|||||||
|
$('#polls_list').html('<%= escape_javascript(render :partial => 'polls_list', :locals => {:polls => @polls,:obj_pages=>@obj_pages,:obj_count=>@obj_count}) %> <div class="cl"></div>');
|
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
<% if @polls.empty? %>
|
||||||
|
alert('您目前还没有自己新建的问卷');
|
||||||
|
<% else %>
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>');
|
||||||
|
|
||||||
|
|
||||||
|
showModal('ajax-modal', '513px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||||
|
$('#ajax-modal').parent().css("top","").css("left","");
|
||||||
|
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||||
|
<% end %>
|
@ -0,0 +1,30 @@
|
|||||||
|
<% @tags = obj.reload.tag_list %>
|
||||||
|
<% if non_list_all && @tags.size > 0 %>
|
||||||
|
|
||||||
|
<% else %>
|
||||||
|
<!-- 用来显示三大对象的主页中的tag 故是全部显示 -->
|
||||||
|
<% if @tags.size > 0 %>
|
||||||
|
<% @tags.each do |tag| %>
|
||||||
|
<span class="re_tag f_l " id="tag">
|
||||||
|
<%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id, :class => 'pt5' %>
|
||||||
|
<span class="del">
|
||||||
|
<%= link_to('x', remove_tag_path(:tag_name => tag,:taggable_id => obj.id, :taggable_type => object_flag), :remote => true, :confirm => l(:text_are_you_sure) ) if User.current.eql?(obj) %>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if User.current.logged?%>
|
||||||
|
<a href="javascript:void(0)" class="yellowBtn f_l" onclick="$('#add_tag03').slideToggle();"><%= l(:label_add_tag)%></a>
|
||||||
|
<span id="add_tag03" style="display:none; vertical-align: middle;" class="ml10 f_l">
|
||||||
|
<%= form_for "tag_for_save",:remote => true,:url=>save_tag_path,:update => "tags_show",:complete => '$("#put-tag-form").slideUp();' do |f| %>
|
||||||
|
<%= f.text_field :name ,:id => "tags_name3",:size=>"20",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length,:class =>"isTxt w90 f_l" %>
|
||||||
|
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
|
||||||
|
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
|
||||||
|
<input type="button" class="submit f_l" onclick="$('#tags_name3').parent().submit();" />
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<% end%>
|
||||||
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
|||||||
|
<div id="tags">
|
||||||
|
<div id="tags_show">
|
||||||
|
<%= render :partial => "tags/tag_user_new_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,15 @@
|
|||||||
|
class AddCourseActivities < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
create_table :course_activities do |t|
|
||||||
|
t.integer :user_id
|
||||||
|
t.integer :course_id
|
||||||
|
t.integer :course_act_id
|
||||||
|
t.string :course_act_type
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
drop_table :course_activities
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,40 @@
|
|||||||
|
#encoding=UTF-8
|
||||||
|
class CourseActivities < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
Course.all.each do |course|
|
||||||
|
transaction do
|
||||||
|
course.course_acts << CourseActivity.new(:user_id => course.tea_id,:course_id => course.id)
|
||||||
|
#作业
|
||||||
|
course.homework_commons.each do |homework_common|
|
||||||
|
homework_common.course_acts << CourseActivity.new(:user_id => homework_common.user_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
#通知
|
||||||
|
course.news.each do |new|
|
||||||
|
new.course_acts << CourseActivity.new(:user_id => new.author_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
#资源
|
||||||
|
course.attachments.each do |attachment|
|
||||||
|
attachment.course_acts << CourseActivity.new(:user_id => attachment.author_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
#讨论区
|
||||||
|
if course.boards.first
|
||||||
|
course.boards.first.messages.each do |message|
|
||||||
|
message.course_acts << CourseActivity.new(:user_id => message.author_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#留言
|
||||||
|
course.journals_for_messages.each do |jour|
|
||||||
|
jour.course_acts << CourseActivity.new(:user_id => jour.user_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
#问卷
|
||||||
|
Poll.where("polls_type = 'Course' and polls_group_id = #{course.id}").each do |poll|
|
||||||
|
poll.course_acts << CourseActivity.new(:user_id => poll.user_id,:course_id => course.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
CourseActivity.destroy_all
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,22 @@
|
|||||||
|
class UpdateCourseActivityTime < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
count = CourseActivity.all.count / 10 + 1
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... count do i
|
||||||
|
CourseActivity.page(i).per(10).each do |activity|
|
||||||
|
if activity.course_act
|
||||||
|
if activity.course_act.respond_to?("created_at")
|
||||||
|
activity.created_at = activity.course_act.created_at
|
||||||
|
elsif activity.course_act.respond_to?("created_on")
|
||||||
|
activity.created_at = activity.course_act.created_on
|
||||||
|
end
|
||||||
|
activity.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue