Merge branch 'szzh' into dev_hjq

tmp
huang 10 years ago
commit 6d9ead94f4

@ -162,7 +162,7 @@ class MessagesController < ApplicationController
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
@topic.children << @reply
user_activity = UserActivity.where("act_type='Message' and act_id =#{@topic.id}").first
user_activity.updated_at = @reply.created_on
user_activity.updated_at = Time.now
user_activity.save
#@topic.update_attribute(:updated_on, Time.now)
if !@reply.new_record?

@ -259,7 +259,8 @@ class ProjectsController < ApplicationController
# Author lizanle
# Description 项目动态展示方法,删除了不必要的代码
def show
# 更新消息为已读
update_message_status(User.current, @project)
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
return
end
@ -468,6 +469,7 @@ class ProjectsController < ApplicationController
if params[:message_id]
message_invite(params[:message_id], params[:key])
end
update_message_status(User.current, @project)
# params[:login]为邮箱邀请用户加入,主要功能:
# 1、自动注册
# 2、加入项目、创建角色
@ -523,13 +525,23 @@ class ProjectsController < ApplicationController
@members = paginateHelper @members
end
def update_message_status(user, project)
project_invite_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type =?", user, project, "ProjectInvite")
project_invite_messages.each do |project_invite_message|
project_invite_message.update_attribute(:viewed, true)
end
end
def message_invite(message_id, key)
forge_message = ForgeMessage.find(message_id)
if key == forge_message.secret_key
# 情况:用户收到邀请邮件还没看,但是管理员已经把该用户添加进项目
if Member.where("user_id =? and project_id =?",forge_message.user_id, forge_message.project_id).first.nil?
Member.create(:role_ids => [4], :user_id => forge_message.user_id, :project_id => forge_message.project_id)
UserGrade.create(:user_id => forge_message.user_id, :project_id => forge_message.project_id)
end
end
end
#判断指定用户是否为课程教师
def isCourseTeacher(id)

@ -95,9 +95,11 @@ class UsersController < ApplicationController
# 说明: homework 发布作业message讨论区 news新闻 poll问卷works_reviewers作品评阅works_reply:作品回复
# issue问题journal缺陷状态更新 forum公共贴吧: user_feedback: 用户留言; new_reply:新闻回复comment
def user_messages
unless User.current.logged?
if !User.current.logged?
redirect_to signin_url
return
elsif @user != User.current && !User.current.admin?
return render_403
end
# 记录当前点击按钮的时间
# 考虑到用户未退出刷新消息页面
@ -198,7 +200,7 @@ class UsersController < ApplicationController
# 系统消息
def user_system_messages
@sytem_messages = SystemMessage.order("created_at desc").all
@sytem_messages = paginateHelper @sytem_messages,25
@sytem_messages = paginateHelper @sytem_messages, 10
respond_to do |format|
format.html{render :layout=>'new_base_user'}
end

@ -4,6 +4,6 @@ class HomeworkDetailPrograming < ActiveRecord::Base
belongs_to :homework_common
def language_name
%W(C C++).at(self.language.to_i - 1)
%W(C C++ Python).at(self.language.to_i - 1)
end
end

@ -1,3 +1,3 @@
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id,:first_user_activity =>@first_user_activity,:page => @page}) %>");
init_activity_KindEditor_data('<%= @user_activity_id%>',"","85%");
init_activity_KindEditor_data('<%= @user_activity_id%>',"","87%");

@ -78,11 +78,7 @@
<div class="mt5">
<span class="tit_fb" style="width: auto;"> 开发语言:</span>
<div class="fl">
<% if homework.homework_detail_programing.language.to_i == 1%>
C
<% elsif homework.homework_detail_programing.language.to_i == 2%>
C++
<% end%>
<%= homework.language_name%>
</div>
</div>
<div class="cl"></div>

@ -1,3 +1,3 @@
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id,:first_user_activity =>@first_user_activity,:page => @page}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","85%");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");

@ -3,4 +3,4 @@
<%elsif @course%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:first_user_activity =>@first_user_activity,:page => @page}) %>");
<%end%>
init_activity_KindEditor_data(<%= @user_activity_id%>,"","85%");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");

@ -30,13 +30,13 @@
<% if poll.polls_status == 1 %>
<li><%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml5"%></li>
<% else%>
<li class="polls_de_grey fr ml5">编辑</li>
<li class="polls_de_grey fr ml5" title="未发布的问卷才能进行编辑">编辑</li>
<% end%>
<% if poll.polls_status == 2 %>
<li><a class="polls_de fr ml5" onclick="close_poll(<%= poll.id%>);" href="javascript:">关闭</a></li>
<% else %>
<li class="polls_de_grey fr ml5">关闭</li>
<li class="polls_de_grey fr ml5" title="发布的问卷才能进行关闭">关闭</li>
<% end%>
<% if poll.polls_status == 1%>

@ -1,4 +1,3 @@
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.skill.tramples')%> * (-2) = <%= option_num.tread %> * (-2) = <%= option_num.tread * (-2) %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.skill.like.level1')%> * 4 = <%= option_num.praise_by_one %> * 4 = <%= option_num.praise_by_one * 4 %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.skill.like.level2')%> * 6 = <%= option_num.praise_by_two %> * 6 = <%= option_num.praise_by_two * 6 %></div>

@ -36,11 +36,7 @@
<% if activity.homework_type == 2%>
<div class="homepagePostDeadline mr15">
语言:
<% if activity.homework_detail_programing.language.to_i == 1%>
C
<% elsif activity.homework_detail_programing.language.to_i == 2%>
C++
<% end%>
<%= activity.language_name%>
</div>
<% end %>

@ -97,16 +97,16 @@
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone">
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer">
<div class="homepagePostReplyInputContainer mt3 mb10">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="quote[quote]" value="">
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="margin-top:6px;">发送</a>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left; margin-left: 5px; padding-top:3px;"></div>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>

@ -68,9 +68,9 @@
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone">
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer">
<div class="homepagePostReplyInputContainer mt3 mb10">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
@ -83,6 +83,7 @@
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
</div>
</div>

@ -113,9 +113,9 @@
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone">
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer">
<div class="homepagePostReplyInputContainer mt3 mb10">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f|%>
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
@ -128,6 +128,7 @@
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
</div>

@ -82,9 +82,9 @@
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone">
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer">
<div class="homepagePostReplyInputContainer mt3 mb10">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="quote[quote]" value="">
@ -98,6 +98,7 @@
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>

@ -36,7 +36,7 @@
}
$(function() {
init_activity_KindEditor_data(<%= user_activity.id%>,"","85%");
init_activity_KindEditor_data(<%= user_activity.id%>,"","87%");
});
</script>
<% act= user_activity.act unless user_activity.act_type == "ProjectCreateInfo" %>

@ -34,11 +34,7 @@
<% if homework_common.homework_type == 2%>
<div class="homepagePostDeadline mr15">
语言:
<% if homework_common.homework_detail_programing.language.to_i == 1%>
C
<% elsif homework_common.homework_detail_programing.language.to_i == 2%>
C++
<% end%>
<%= homework_common.language_name%>
</div>
<% end %>
<div class="homepagePostDeadline">

@ -4,7 +4,7 @@
<div class="HomeWorkCon">
<div class="mt15">
<select class="InputBox W120 language_type" >
<%= options_for_select({"C语言"=>1, "C++"=>2}, (edit_mode && homework.is_program_homework?) ? homework.language : 1) %>
<%= options_for_select({"C语言"=>1, "C++"=>2, "Python"=>3}, (edit_mode && homework.is_program_homework?) ? homework.language : 1) %>
</select>
</div>
<% if edit_mode && homework.is_program_homework? %>

@ -1,6 +1,8 @@
<% content_for :header_tags do %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %>
<%= javascript_include_tag 'homework','baiduTemplate' %>
<%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
<% end %>
<!-- 模板1开始可以使用scripttype设置为text/html来存放模板片段并且用id标示 -->
@ -75,6 +77,7 @@
<input type="hidden" name="is_test" value="<%=@is_test%>">
<div class="mt15">
<span>请使用 <%= @homework.language_name %> 语言编写</span>
<span data-language=<%=@homework.language%> style="display-hidden" id="data-language"></span>
</div>
<div class="mt10">
<%= f.text_area :name, id: 'program-title', class:"InputBox W700", placeholder:"请概括你的代码的功能" %>

@ -54,20 +54,18 @@
<span style="color: red;float: left">【系统消息】</span><li class="homepageSystenMessageContent fl" id="content_<%= usm.id %>">
<li class="homepageSystenMessageContent fl">
<%= link_to usm.subject.nil? ? (usm.content.nil? ? usm.description.html_safe : usm.content.html_safe) : usm.subject, user_system_messages_path(User.current),
<%= link_to usm.subject.blank? ? (usm.content.nil? ? usm.description.html_safe : usm.content.html_safe) : usm.subject, user_system_messages_path(User.current),
:id => "content_link_#{usm.id}",
:onmouseover =>"message_titile_show($(this),event);",
:onmouseout => "message_titile_hide($(this));"
%>
</li>
<div style="display:none;" class="message_title_red system_message_style">
<% unless usm.subject.nil? %>
<% unless usm.subject.blank? %>
<p><strong>标题:</strong><%= usm.subject %></p>
<% end %>
<% if usm.description.nil? && usm.content.nil? %>
<% else %>
<div class="fl"><strong>内容:</strong></div><div class="ml36"><%= usm.description.html_safe %></div>
<% if (!usm.description.blank?) || (!usm.content.blank?) %>
<div class="fl"><strong>内容:</strong></div><div class="ml36"><%= usm.description.nil? ? usm.content.html_safe : usm.description.html_safe %></div>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(usm.created_at).html_safe %> </li>
@ -364,9 +362,13 @@
</li>
<li class="homepageNewsPubType fl">
<%=link_to inviter, user_path(inviter), :class => "newsBlue homepageNewsPublisher" %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">邀请你加入项目:</span>
<span class='<%= ma.viewed == 0 ? 'homepageNewsTypeNotRead fl' : 'homepageNewsType fl' %>'>邀请你加入项目</span>
</li>
<% if ma.user.member_of?(ma.project) %>
<li class="homepageNewsContent fl">
<% else %>
<li class="homepageHomeworkContent fl">
<% end %>
<%= link_to ma.project, project_path(ma.project),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover => "message_titile_show($(this),event)",
@ -375,7 +377,7 @@
<div style="display: none" class="message_title_red system_message_style">
<%= ma.project %>
</div>
<% if User.current == @user %>
<% unless User.current.member_of?(ma.project) %>
<li class="homepageHomeworkContentWarn fl">
<%=link_to "同意加入", {:controller => 'projects', :action => 'member', :id => ma.project_id, :message_id =>ma.id, :key => ma.secret_key},
:value => ma.secret_key,

@ -39,13 +39,15 @@
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word">
<span class="fl"> Trustie平台 发布了系统消息:</span>
<span style="color:#0781b4; max-width:470px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;vertical-align: top;"><%= system_message.subject %></span>
<span class="fl"><span style="color:#0781b4;">Trustie平台 </span>发布了系统消息:</span>
<span style="color:#0781b4; max-width:470px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;vertical-align: top;"><%= system_message.subject.nil? ? "系统消息" : system_message.subject %></span>
</div>
<div class="cl"></div>
<p class="homepagePostIntro break_word upload_img">
<div class="homepagePostIntro break_word upload_img">
<p>
<%= system_message.content.nil? ? system_message.description.html_safe : system_message.content.html_safe %>
</p>
</div>
<div class="cl"></div>
<p class="homepagePostDeadline">截止时间:<%= format_time(system_message.created_at) %></p>
</div>

@ -103,7 +103,7 @@ default:
# autologin_cookie_name: the name of the cookie (default: autologin)
# autologin_cookie_path: the cookie path (default: /)
# autologin_cookie_secure: true sets the cookie secure flag (default: false)
autologin_cookie_name:
autologin_cookie_name: "autologin_trustie"
autologin_cookie_path:
autologin_cookie_secure:
@ -197,11 +197,17 @@ default:
#max_concurrent_ajax_uploads: 2
#pic_types: "bmp,jpeg,jpg,png,gif"
repository_root_path: '/tmp/htdocs'
judge_server: 'http://judge.trustie.net/'
# specific configuration options for production environment
# that overrides the default ones
production:
# CJK support
rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf
judge_server: 'http://192.168.80.21:8080/'
repository_root_path: '/home/pdl/redmine-2.3.2-0/apache2/htdocs'
cookie_domain: ".trustie.net"
email_delivery:
delivery_method: :smtp
smtp_settings:

@ -497,26 +497,23 @@ ActiveRecord::Schema.define(:version => 20150918134804) do
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
add_index "documents", ["project_id"], :name => "documents_project_id"
create_table "dts", :primary_key => "Num", :force => true do |t|
t.string "Defect", :limit => 50
t.string "Category", :limit => 50
t.string "File"
t.string "Method"
t.string "Module", :limit => 20
t.string "Variable", :limit => 50
t.integer "StartLine"
t.integer "IPLine"
t.string "IPLineCode", :limit => 200
t.string "Judge", :limit => 15
t.integer "Review", :limit => 1
create_table "dts", :force => true do |t|
t.string "IPLineCode"
t.string "Description"
t.text "PreConditions", :limit => 2147483647
t.text "TraceInfo", :limit => 2147483647
t.text "Code", :limit => 2147483647
t.string "Num"
t.string "Variable"
t.string "TraceInfo"
t.string "Method"
t.string "File"
t.string "IPLine"
t.string "Review"
t.string "Category"
t.string "Defect"
t.string "PreConditions"
t.string "StartLine"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "enabled_modules", :force => true do |t|
@ -1330,7 +1327,7 @@ ActiveRecord::Schema.define(:version => 20150918134804) do
t.datetime "updated_at", :null => false
t.integer "late_penalty", :default => 0
t.integer "absence_penalty", :default => 0
t.integer "system_score"
t.float "system_score", :default => 0.0
t.boolean "is_test", :default => false
end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save