Merge branch 'develop' into cxt_course

cxt_course
cxt 10 years ago
commit 5d5fcda475

@ -532,9 +532,10 @@ class UsersController < ApplicationController
if @student_work.nil? if @student_work.nil?
@student_work = StudentWork.new @student_work = StudentWork.new
end end
@course = @homework.course
respond_to do |format| respond_to do |format|
format.js format.js
format.html {render :layout => 'new_base_user'} format.html {render :layout => 'base_courses'}
end end
else else
render_403 render_403

@ -134,8 +134,11 @@ class ZipdownController < ApplicationController
homework_common.student_works.each do |work| homework_common.student_works.each do |work|
unless work.attachments.empty? unless work.attachments.empty?
out_file = zip_student_work_by_user(work) out_file = zip_student_work_by_user(work)
bid_homework_path << out_file.file_path
digests << out_file.file_digest bid_homework_path << out_file.file_path
digests << out_file.file_digest
end end
end end
homework_id = homework_common.id homework_id = homework_common.id
@ -172,7 +175,11 @@ class ZipdownController < ApplicationController
} }
end end
def zip_student_work_by_user work def make_zip_name(work)
"#{work.user.show_name}_#{((work.user.user_extensions.nil? || work.user.user_extensions.student_id.nil?) ? "" : work.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}"
end
def zip_student_work_by_user(work)
homeworks_attach_path = [] homeworks_attach_path = []
not_exist_file = [] not_exist_file = []
# 需要将所有homework.attachments遍历加入zip # 需要将所有homework.attachments遍历加入zip
@ -186,10 +193,23 @@ class ZipdownController < ApplicationController
digests << 'not_exist_file' digests << 'not_exist_file'
end end
end end
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
zipping("#{work.user.show_name}_#{((work.user.user_extensions.nil? || work.user.user_extensions.student_id.nil?) ? "" : work.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", #单个文件的话,不需要压缩,只改名
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file) out_file = nil
} if homeworks_attach_path.size == 1
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
des_path = "#{OUTPUT_FOLDER}/#{make_zip_name(work)}_#{File.basename(homeworks_attach_path.first)}"
FileUtils.cp homeworks_attach_path.first, des_path
des_path
}
else
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
zipping("#{make_zip_name(work)}.zip",
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
}
end
out_file
end end

@ -80,7 +80,7 @@ module IssuesHelper
issuetype << "support fl" issuetype << "support fl"
issuetype << "支持" issuetype << "支持"
elsif value == "功能" || value == 2 elsif value == "功能" || value == 2
issuetype << "function fl" issuetype << "issues-function fl"
issuetype << "功能" issuetype << "功能"
else else
issuetype << "weekly fl" issuetype << "weekly fl"

@ -28,6 +28,7 @@ class Attachment < ActiveRecord::Base
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id" belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
# 被ForgeActivity虚拟关联 # 被ForgeActivity虚拟关联
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
has_many :forwards, :as => :from
# 课程动态 # 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
# end # end

@ -0,0 +1,4 @@
class Forward < ActiveRecord::Base
validates_presence_of :from_id, :from_type, :to_id, :to_type
belongs_to :from, :polymorphic => true
end

@ -8,7 +8,7 @@
<% when 1%> <% when 1%>
<span class="issues fl" title="缺陷"></span> <span class="issues fl" title="缺陷"></span>
<% when 2%> <% when 2%>
<span class="function fl" title="功能"></span> <span class="issues-function fl" title="功能"></span>
<% when 3%> <% when 3%>
<span class="support fl" title="支持"></span> <span class="support fl" title="支持"></span>
<% when 4%> <% when 4%>

@ -1,6 +1,11 @@
<%# course_model %> <%# course_model %>
<% course_file_num = visable_attachemnts_incourse(@course).count%> <% course_file_num = visable_attachemnts_incourse(@course).count%>
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> <% 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> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@ -74,7 +79,7 @@
<% unless show_nav?(@course.homework_commons.count) %> <% unless show_nav?(@course.homework_commons.count) %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%> <%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%>
<%= link_to "(#{@course.homework_commons.count})", homework_common_index_path(:course => @course.id), :class => "subnav_num c_orange"%> <%= 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 %> <%= link_to( "", homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_homework_new)}") if is_teacher %>
</div> </div>
<% end %> <% end %>

@ -59,9 +59,10 @@
<div class="w607 fr">http// <div class="w607 fr">http//
<input type="text" name="organization[domain]" id="domain" value="<%= domain.nil? ? '' : domain.subname %>" class="orgUrlInput" /> <input type="text" name="organization[domain]" id="domain" value="<%= domain.nil? ? '' : domain.subname %>" class="orgUrlInput" />
.trustie.net<a href="javascript:void(0);" class="linkBlue ml15" style="text-decoration:underline;" onclick="apply_subdomain(<%= @organization.id %>,$('#domain').val());">申请</a> .trustie.net<a href="javascript:void(0);" class="linkBlue ml15" style="text-decoration:underline;" onclick="apply_subdomain(<%= @organization.id %>,$('#domain').val());">申请</a>
<% if domain.present? and OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content == domain.subname %> <% record = OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first %>
<% if domain.present? and record.present? and record.content == domain.subname %>
<span>(已批准)</span> <span>(已批准)</span>
<% elsif OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).count > 0 %> <% elsif record %>
<span>(您申请了子域名<%= OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content %>,还未批准)</span> <span>(您申请了子域名<%= OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content %>,还未批准)</span>
<% end %> <% end %>
<p class="c_green f12" id="apply_hint" ></p></div> <p class="c_green f12" id="apply_hint" ></p></div>

@ -18,7 +18,7 @@
<% when 1%> <% when 1%>
<span class="issues fl" title="缺陷"></span> <span class="issues fl" title="缺陷"></span>
<% when 2%> <% when 2%>
<span class="function fl" title="功能"></span> <span class="issues-function fl" title="功能"></span>
<% when 3%> <% when 3%>
<span class="support fl" title="支持"></span> <span class="support fl" title="支持"></span>
<% when 4%> <% when 4%>

@ -4,7 +4,12 @@
<%= stylesheet_link_tag "/assets/codemirror/codemirror" %> <%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
<% end %> <% end %>
<script type="text/javascript">
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
});
</script>
<!-- 模板1开始可以使用scripttype设置为text/html来存放模板片段并且用id标示 --> <!-- 模板1开始可以使用scripttype设置为text/html来存放模板片段并且用id标示 -->
<script id="t:result-list" type="text/html"> <script id="t:result-list" type="text/html">
<div class="ProResultTop"> <div class="ProResultTop">
@ -40,7 +45,7 @@
</script> </script>
<!-- 模板1结束 --> <!-- 模板1结束 -->
<div class="ProgramHomework"> <div class="ProgramHomework ml10">
<div class="homepageRightBanner mb10"> <div class="homepageRightBanner mb10">
@ -91,7 +96,9 @@
</div> </div>
<div class="mt10"> <div class="mt10">
<a href="javascript:void(0);" class="BlueCirBtn fl" data-homework-id="<%=@homework.id%>" data-student-work-id="<%=@student_work.id%>" id="test-program-btn">测试代码</a> <a href="javascript:void(0);" class="BlueCirBtn fl" data-homework-id="<%=@homework.id%>" data-student-work-id="<%=@student_work.id%>" id="test-program-btn">测试代码</a>
<% unless @is_test %> <% if @is_test %>
<%=link_to '返 回',course_path(@course),:class=>'fr mt6' %>
<% else @is_test %>
<a href="javascript:void(0);" class="BlueCirBtn fr" id="commit-program-work-btn">提交代码</a> <a href="javascript:void(0);" class="BlueCirBtn fr" id="commit-program-work-btn">提交代码</a>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>

@ -0,0 +1,15 @@
class CreateForwards < ActiveRecord::Migration
def up
create_table :forwards do|t|
t.integer :from_id
t.string :from_type
t.integer :to_id
t.string :to_type
t.timestamp :created_at
end
end
def down
drop_table :forwards
end
end

@ -1405,7 +1405,7 @@ span.at a{color:#269ac9;text-decoration: none;}
.issues{ background:url(../images/public_icon.png) -66px 5px no-repeat; width:18px; height:21px;} .issues{ background:url(../images/public_icon.png) -66px 5px no-repeat; width:18px; height:21px;}
.duty{ background:url(../images/public_icon.png) -66px -18px no-repeat; width:18px; height:21px;} .duty{ background:url(../images/public_icon.png) -66px -18px no-repeat; width:18px; height:21px;}
.support{ background:url(../images/public_icon.png) -66px -45px no-repeat; width:18px; height:21px;} .support{ background:url(../images/public_icon.png) -66px -45px no-repeat; width:18px; height:21px;}
.function{ background:url(../images/public_icon.png) -66px -70px no-repeat; width:18px; height:21px;} .issues-function{ background:url(../images/public_icon.png) -66px -70px no-repeat; width:18px; height:21px;}
.weekly{ background:url(../images/public_icon.png) -66px -95px no-repeat; width:18px; height:21px;} .weekly{ background:url(../images/public_icon.png) -66px -95px no-repeat; width:18px; height:21px;}
/*资源发送到org*/ /*资源发送到org*/

@ -200,12 +200,6 @@ a.pro_mes_w_news{ height:20px; float:right;display:block; color:#999999;}
.pro_info_box ul li{ height:24px;} .pro_info_box ul li{ height:24px;}
.pro_info_p{color:#0781b4 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } .pro_info_p{color:#0781b4 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
.edit_pro_box{overflow:hidden;display:none; margin-bottom:30px; border-bottom:1px dashed #CCC; padding-bottom:10px;} .edit_pro_box{overflow:hidden;display:none; margin-bottom:30px; border-bottom:1px dashed #CCC; padding-bottom:10px;}
/*问题状态图片*/
.issues{ background:url(../images/public_icon.png) -66px 5px no-repeat; width:16px; height:21px;}
.duty{ background:url(../images/public_icon.png) -66px -18px no-repeat; width:16px; height:21px;}
.support{ background:url(../images/public_icon.png) -66px -45px no-repeat; width:16px; height:21px;}
.function{ background:url(../images/public_icon.png) -66px -70px no-repeat; width:16px; height:21px;}
.weekly{ background:url(../images/public_icon.png) -66px -95px no-repeat; width:16px; height:21px;}
/****翻页***/ /****翻页***/
ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; } ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
ul.wlist li{float: left;} ul.wlist li{float: left;}
@ -1084,7 +1078,7 @@ a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; c
.issues{ background:url(../images/public_icon.png) -66px 5px no-repeat; width:18px; height:21px;} .issues{ background:url(../images/public_icon.png) -66px 5px no-repeat; width:18px; height:21px;}
.duty{ background:url(../images/public_icon.png) -66px -18px no-repeat; width:18px; height:21px;} .duty{ background:url(../images/public_icon.png) -66px -18px no-repeat; width:18px; height:21px;}
.support{ background:url(../images/public_icon.png) -66px -45px no-repeat; width:18px; height:21px;} .support{ background:url(../images/public_icon.png) -66px -45px no-repeat; width:18px; height:21px;}
.function{ background:url(../images/public_icon.png) -66px -70px no-repeat; width:18px; height:21px;} .issues-function{ background:url(../images/public_icon.png) -66px -70px no-repeat; width:18px; height:21px;}
.weekly{ background:url(../images/public_icon.png) -66px -95px no-repeat; width:18px; height:21px;} .weekly{ background:url(../images/public_icon.png) -66px -95px no-repeat; width:18px; height:21px;}
.upload_img img{max-width: 100%;} .upload_img img{max-width: 100%;}

@ -113,6 +113,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.mt0 {margin-top:0px !important;} .mt0 {margin-top:0px !important;}
.mt3{ margin-top:3px;} .mt3{ margin-top:3px;}
.mt5{ margin-top:5px;} .mt5{ margin-top:5px;}
.mt6{ margin-top:6px;}
.mt8{ margin-top:8px;} .mt8{ margin-top:8px;}
.mt10{ margin-top:10px !important;} .mt10{ margin-top:10px !important;}
.mt20{margin-top: 20px;} .mt20{margin-top: 20px;}

Loading…
Cancel
Save