Merge branch 'develop' into hjq_new_course

dev_hjq
huang 10 years ago
commit 70cd068ea8

@ -683,7 +683,7 @@ class StudentWorkController < ApplicationController
if !params[:name].nil? if !params[:name].nil?
condition = "%#{params[:name].strip}%".gsub(" ","") condition = "%#{params[:name].strip}%".gsub(" ","")
end end
@project_ids = Project.where("user_id = #{User.current.id} and name like '#{condition}'") @project_ids = Project.visible.where("user_id = #{User.current.id} and name like '#{condition}'")
@first = params[:first].to_i @first = params[:first].to_i
respond_to do |format| respond_to do |format|
format.js format.js

@ -1,92 +1,99 @@
<% 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)) %>
<% teacher_num = searchTeacherAndAssistant(@course).count %> <% teacher_num = searchTeacherAndAssistant(@course).count %>
<% student_num = studentCount(@course) %> <% student_num = studentCount(@course) %>
<% course_file_num = visable_attachemnts_incourse(@course).count%> <% course_file_num = visable_attachemnts_incourse(@course).count%>
<div class="pr_info_logo fl mr10 mb5"> <div class="pr_info_logo fl mr10 mb5">
<!--<a href="#"><img src="images/courses/pic_courses.jpg" width="60" height="60" alt="logo" /></a>--> <% if @course.id == 370 %>
<%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %> <img src="/images/course/boutique.png" width="50" height="auto" alt="精品" class="boutiqueP" />
</div> <% end %>
<div class="pr_info_id fl mb5 f14"><%= @course.is_public == 0 ? "私有课程" : "公开课程" %></div> <!--<a href="#"><img src="images/courses/pic_courses.jpg" width="60" height="60" alt="logo" /></a>-->
<div class="pr_info_id fl f14"> <%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %>
ID:<%= @course.id%> </div>
</div> <div class="pr_info_id fl mb5 f14"><%= @course.is_public == 0 ? "私有课程" : "公开课程" %>
<!--<div class="pr_info_id fl mb5 f14"> <% if @course.id == 370 %>
ID:<%#= @course.id%> <img src="/images/course/medal.png" alt="精品课程" style="vertical-align:bottom;" class="ml5" />
</div> <% end %>
<div class="pr_info_join fl"> </div>
<%# if is_teacher%> <div class="pr_info_id fl f14">
<%#= link_to "<span class='pr_setting'></span>#{l(:button_configure)}".html_safe, {:controller => 'courses', :action => 'settings', :id => @course}, :class => "pr_join_a" %> ID:<%= @course.id%>
<%#= set_course_time @course%> </div>
<%#= link_to "<span class='pr_copy'></span>#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %> <!--<div class="pr_info_id fl mb5 f14">
<%# else%> ID:<%#= @course.id%>
<div id="join_in_course_header"><%#= join_in_course_header(@course, User.current) %></div> </div>
<%# end%> <div class="pr_info_join fl">
</div>--> <%# if is_teacher%>
<div class="cl"></div> <%#= link_to "<span class='pr_setting'></span>#{l(:button_configure)}".html_safe, {:controller => 'courses', :action => 'settings', :id => @course}, :class => "pr_join_a" %>
<%#= set_course_time @course%>
<!--<div >--> <%#= link_to "<span class='pr_copy'></span>#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %>
<!--<a class="pr_info_name fl c_dark fb break_word" href="http://<%#= Setting.host_course%>/courses/<%#= @course.id%>" target="_blank">--> <%# else%>
<!--<%#= @course.name %>--> <div id="join_in_course_header"><%#= join_in_course_header(@course, User.current) %></div>
<!--</a>--> <%# end%>
<!--<%# if @course.is_public == 0%>--> </div>-->
<!--<span class="img_private ">--> <div class="cl"></div>
<!--<%#= l(:field_is_private)%>-->
<!--</span>--> <!--<div >-->
<!--<%# end %>--> <!--<a class="pr_info_name fl c_dark fb break_word" href="http://<%#= Setting.host_course%>/courses/<%#= @course.id%>" target="_blank">-->
<!--<%#if @course.tea_id == User.current.id && @course.outline == 0 %>--> <!--<%#= @course.name %>-->
<!--<span>--> <!--</a>-->
<!--<a href="javascript:void(0)" onclick="course_outline('<%#= @course.id%>');">设置大纲</a>--> <!--<%# if @course.is_public == 0%>-->
<!--</span>--> <!--<span class="img_private ">-->
<!--<%# else%>--> <!--<%#= l(:field_is_private)%>-->
<!--<span>--> <!--</span>-->
<!--<a href="javascript:void(0)" onclick="course_outline('<%#= @course.id%>');">设置大纲</a>--> <!--<%# end %>-->
<!--</span>--> <!--<%#if @course.tea_id == User.current.id && @course.outline == 0 %>-->
<!--<%# end %>--> <!--<span>-->
<!--</div>--> <!--<a href="javascript:void(0)" onclick="course_outline('<%#= @course.id%>');">设置大纲</a>-->
<div > <!--</span>-->
<a class="pr_info_name fl c_dark fb break_word" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank"></a> <!--<%# else%>-->
<div> <!--<span>-->
<a class="pr_info_name c_dark fb break_word fl" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank"> <!--<a href="javascript:void(0)" onclick="course_outline('<%#= @course.id%>');">设置大纲</a>-->
<%= @course.name %> <!--</span>-->
</a> <!--<%# end %>-->
<%# if @course.is_public == 0%> <!--</div>-->
<!--<span class="img_private "></span>--> <div >
<!--<span class="img_private mr5 fl"> <a class="pr_info_name fl c_dark fb break_word" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank"></a>
<%#= l(:field_is_private)%> <div>
</span>--> <a class="pr_info_name c_dark fb break_word fl" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank">
<%# end %> <%= @course.name %>
<span id="course_outline_bar"> </a>
<%if User.current && @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %> <%# if @course.is_public == 0%>
<a href="javascript:void(0);" title="设置课程大纲" onclick="course_outline('<%= @course.id%>')" class="mr5 syllabusSetting fl"> </a> <!--<span class="img_private "></span>-->
<% elsif User.current && @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0%> <!--<span class="img_private mr5 fl">
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a> <%#= l(:field_is_private)%>
<% elsif User.current && @course.tea_id != User.current.id && !@course.is_public? && User.current.member_of_course?(@course) && @course.outline != 0%> </span>-->
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a> <%# end %>
<% elsif User.current && @course.tea_id != User.current.id && @course.is_public? && @course.outline != 0%> <span id="course_outline_bar">
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a> <%if User.current && @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %>
<%else%> <a href="javascript:void(0);" title="设置课程大纲" onclick="course_outline('<%= @course.id%>')" class="mr5 syllabusSetting fl"> </a>
<%end %> <% elsif User.current && @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0%>
</span> <a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
</div> <% elsif User.current && @course.tea_id != User.current.id && !@course.is_public? && User.current.member_of_course?(@course) && @course.outline != 0%>
</div> <a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<div class="cl"></div> <% elsif User.current && @course.tea_id != User.current.id && @course.is_public? && @course.outline != 0%>
<div class="pr_info_foot "> <a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<%= l(:label_account_identity_teacher)%><%= course_teacher_link teacher_num %> <%else%>
<span>|&nbsp;</span> <%end %>
<%= l(:label_account_identity_student)%><%= course_student_link student_num %> </span>
<span>|&nbsp;</span> </div>
<%= l(:project_module_attachments)%><%= link_to course_file_num, course_files_path(@course), :class => 'info_foot_num c_blue',:id=>'courses_files_count_info' %></div> </div>
<div class="cl"></div> <div class="cl"></div>
<% if is_teacher %> <div class="pr_info_foot ">
<div class="homepagePostSetting mt5 mr5"> <%= l(:label_account_identity_teacher)%><%= course_teacher_link teacher_num %>
<ul> <span>|&nbsp;</span>
<li class="homepagePostSettingIcon"> <%= l(:label_account_identity_student)%><%= course_student_link student_num %>
<ul class="homepagePostSettiongText boxShadow"> <span>|&nbsp;</span>
<li><%= link_to "课程配置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "postOptionLink" %></li> <%= l(:project_module_attachments)%><%= link_to course_file_num, course_files_path(@course), :class => 'info_foot_num c_blue',:id=>'courses_files_count_info' %></div>
<li><%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "postOptionLink" %></li> <div class="cl"></div>
<li><%= link_to "复制学期", copy_course_course_path(@course.id),:remote=>true, :class => "postOptionLink" %></li> <% if is_teacher %>
</ul> <div class="homepagePostSetting mt5 mr5">
</li> <ul>
</ul> <li class="homepagePostSettingIcon">
</div> <ul class="homepagePostSettiongText boxShadow">
<% end %> <li><%= link_to "课程配置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "postOptionLink" %></li>
<li><%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "postOptionLink" %></li>
<li><%= link_to "复制学期", copy_course_course_path(@course.id),:remote=>true, :class => "postOptionLink" %></li>
</ul>
</li>
</ul>
</div>
<% end %>

@ -173,7 +173,7 @@
<% time=project.updated_on %> <% time=project.updated_on %>
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
<p><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p> <p><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p><%=time_from_now time %></p> <p><%=time_from_now time %>&nbsp;&nbsp;<%= project.commits_count %>提交</p>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>"> <div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
项目名称:<%=project.name %><br /> 项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br /> 创建者:<%=(User.find project.user_id).show_name %>(组长)<br />

@ -23,7 +23,7 @@
创建时间:<%= format_time(project.created_on) %> 创建时间:<%= format_time(project.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15"> <div class="homepagePostDate fl ml15">
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %> 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='ProjectCreateInfo' and forge_act_id =#{project.id}").first.updated_at) %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden"> <div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">

@ -18,9 +18,13 @@
<div class="homepagePostTitle break_word" > <div class="homepagePostTitle break_word" >
<%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %> <%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %>
</div> </div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
创建时间:<%= format_time(project.created_on) %> 创建时间:<%= format_time(project.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='ProjectCreateInfo' and forge_act_id =#{project.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden"> <div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">
<ul> <ul>
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">

@ -173,7 +173,7 @@
<% time=project.updated_on %> <% time=project.updated_on %>
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
<p><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p> <p><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p><%=time_from_now time %></p> <p><%=time_from_now time %>&nbsp;&nbsp;<%= project.commits_count %>提交</p>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>"> <div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
项目名称:<%=project.name %><br /> 项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br /> 创建者:<%=(User.find project.user_id).show_name %>(组长)<br />

@ -23,7 +23,7 @@
创建时间:<%= format_time(project.created_on) %> 创建时间:<%= format_time(project.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15"> <div class="homepagePostDate fl ml15">
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %> 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='ProjectCreateInfo' and forge_act_id =#{project.id}").first.updated_at) %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden"> <div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">

@ -174,7 +174,7 @@
<% time=project.updated_on %> <% time=project.updated_on %>
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %> <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
<p><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p> <p><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p><%=time_from_now time %></p> <p><%=time_from_now time %>&nbsp;&nbsp;<%= project.commits_count %>提交</p>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=homework_common.id %>"> <div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=homework_common.id %>">
项目名称:<%=project.name %><br /> 项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br /> 创建者:<%=(User.find project.user_id).show_name %>(组长)<br />

@ -1,17 +0,0 @@
class AddLastTermToCourse < ActiveRecord::Migration
def change
add_column :courses, :end_time, :integer
add_column :courses, :end_term, :string
count = Course.all.count / 30 + 2
transaction do
for i in 1 ... count do
Course.page(i).per(30).each do |course|
course.end_time = course.time
course.end_term = course.term
course.save
end
end
end
end
end

@ -0,0 +1,42 @@
class UpdateForgeAndUserActivity < ActiveRecord::Migration
def up
user_count = UserActivity.all.count / 30 + 2
transaction do
for i in 1 ... user_count do i
UserActivity.page(i).per(30).each do |user_act|
if user_act.act_type == 'Issue'
if user_act.act
if user_act.act.journals.count > 0
user_act.updated_at = user_act.act.journals.maximum("created_on")
user_act.save
end
else
user_act.destroy
end
end
end
end
end
for_count = ForgeActivity.all.count / 30 + 2
transaction do
for i in 1 ... for_count do i
ForgeActivity.page(i).per(30).each do |for_act|
if for_act.forge_act_type == 'Issue'
if for_act.forge_act
if for_act.forge_act.journals.count > 0
for_act.updated_at = for_act.forge_act.journals.maximum("created_on")
for_act.save
end
else
for_act.destroy
end
end
end
end
end
end
def down
end
end

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -1255,3 +1255,4 @@ div.disable_link {background-color: #c1c1c1 !important;}
.boxShadow {box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5);} .boxShadow {box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5);}
.fn {font-weight:normal} .fn {font-weight:normal}
.boutiqueP {position:absolute; left:0px; top:0px;}

Loading…
Cancel
Save