Merge branch 'szzh' into develop

This commit is contained in:
sw 2015-09-19 11:53:00 +08:00
commit 9826b562eb
35 changed files with 422 additions and 166 deletions

View File

@ -137,6 +137,7 @@ class HomeworkCommonController < ApplicationController
def edit def edit
@user = User.current @user = User.current
@is_in_course = params[:is_in_course]
respond_to do |format| respond_to do |format|
format.html{render :layout => 'new_base_user'} format.html{render :layout => 'new_base_user'}
end end
@ -173,7 +174,11 @@ class HomeworkCommonController < ApplicationController
if @homework.save if @homework.save
@homework_detail_manual.save if @homework_detail_manual @homework_detail_manual.save if @homework_detail_manual
@homework_detail_programing.save if @homework_detail_programing @homework_detail_programing.save if @homework_detail_programing
redirect_to user_homeworks_user_path(User.current.id) if params[:is_in_course] == "1"
redirect_to homework_common_index_path(:course => @course.id)
else
redirect_to user_homeworks_user_path(User.current.id)
end
end end
end end
end end
@ -181,7 +186,13 @@ class HomeworkCommonController < ApplicationController
def destroy def destroy
if @homework.destroy if @homework.destroy
respond_to do |format| respond_to do |format|
format.html {redirect_to user_homeworks_user_path(User.current.id)} format.html {
if params[:is_in_course] == "1"
redirect_to homework_common_index_path(:course => @course.id)
else
redirect_to user_homeworks_user_path(User.current.id)
end
}
end end
end end
end end
@ -206,7 +217,9 @@ class HomeworkCommonController < ApplicationController
end end
@homework_detail_manual.update_column('comment_status', 2) @homework_detail_manual.update_column('comment_status', 2)
@statue = 1 @statue = 1
# send_message_homework(@homework) # 匿评开启消息邮件通知
send_message_anonymous_comment(@homework, m_status = 2)
Mailer.send_mail_anonymous_comment_open(@homework).deliver
else else
@statue = 2 @statue = 2
end end
@ -225,21 +238,22 @@ class HomeworkCommonController < ApplicationController
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0 student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save student_work.save
end end
# send_message_homework(@homework) # 匿评关闭消息邮件通知
send_message_anonymous_comment(@homework, m_status = 3)
Mailer.send_mail_anonymous_comment_close(@homework).deliver
respond_to do |format| respond_to do |format|
format.js format.js
end end
end end
# 开启/关闭匿评消息通知 # 开启/关闭匿评消息通知
# def send_message_homework(homework) def send_message_anonymous_comment(homework, m_status )
# # status 标记匿评状态 1为关闭 0为开启 # status 标记匿评状态 1为关闭 0为开启
# course = @homework.course course = @homework.course
# course.student.each do |st| course.student.each do |st|
# @homework.course_messages << CourseMessage.new(:user_id => st.user_id, :course_id => course.id, :viewed => false, :status => false) @homework.course_messages << CourseMessage.new(:user_id => st.student_id, :course_id => course.id, :viewed => false, :status => m_status)
# end end
# end end
#提示 #提示
def alert_anonymous_comment def alert_anonymous_comment
@cur_size = 0 @cur_size = 0

View File

@ -464,6 +464,10 @@ class ProjectsController < ApplicationController
# by young # by young
# include CoursesHelper # include CoursesHelper
def member def member
# 消息"同意加入项目"
if params[:message_id]
message_invite(params[:message_id], params[:key])
end
# params[:login]为邮箱邀请用户加入,主要功能: # params[:login]为邮箱邀请用户加入,主要功能:
# 1、自动注册 # 1、自动注册
# 2、加入项目、创建角色 # 2、加入项目、创建角色
@ -519,6 +523,14 @@ class ProjectsController < ApplicationController
@members = paginateHelper @members @members = paginateHelper @members
end end
def message_invite(message_id, key)
forge_message = ForgeMessage.find(message_id)
if key == forge_message.secret_key
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
#判断指定用户是否为课程教师 #判断指定用户是否为课程教师
def isCourseTeacher(id) def isCourseTeacher(id)
result = false result = false

View File

@ -198,7 +198,7 @@ class UsersController < ApplicationController
# 系统消息 # 系统消息
def user_system_messages def user_system_messages
@sytem_messages = SystemMessage.order("created_at desc").all @sytem_messages = SystemMessage.order("created_at desc").all
@sytem_messages = paginateHelper @sytem_messages,25 @sytem_messages = paginateHelper @sytem_messages, 10
respond_to do |format| respond_to do |format|
format.html{render :layout=>'new_base_user'} format.html{render :layout=>'new_base_user'}
end end

View File

@ -2368,7 +2368,7 @@ module ApplicationHelper
end end
def student_anonymous_comment homework def student_anonymous_comment homework
if homework.homework_type == 1 && homework.homework_detail_manual if homework.homework_detail_manual
case homework.homework_detail_manual.comment_status case homework.homework_detail_manual.comment_status
when 1 when 1
"<span class='fr mr10 pr_join_span '>未开启匿评</span>".html_safe "<span class='fr mr10 pr_join_span '>未开启匿评</span>".html_safe
@ -2377,10 +2377,6 @@ module ApplicationHelper
when 3 when 3
"<span class='fr mr10 pr_join_span '>匿评已结束</span>".html_safe "<span class='fr mr10 pr_join_span '>匿评已结束</span>".html_safe
end end
elsif homework.homework_type == 0
"<span class='fr mr10 pr_join_span '>未启用匿评</span>".html_safe
elsif homework.homework_type == 2
"<span class='fr mr10 pr_join_span '>&nbsp;编程作业&nbsp;&nbsp;</span>".html_safe
end end
end end

View File

@ -83,7 +83,7 @@ module ProjectsHelper
elsif ivite_list.user.active? elsif ivite_list.user.active?
value = "邀请已发送,等待用户加入!" value = "邀请已发送,等待用户加入!"
else else
value = "账号尚未激活,等待用户应答" value = "邀请已发送,等待用户激活账号"
end end
end end

View File

@ -8,7 +8,7 @@ class ForgeMessage < ActiveRecord::Base
TYPE_OF_WIKI_ACT = "Wiki" TYPE_OF_WIKI_ACT = "Wiki"
TYPE_OF_NEWS_ACT = "News" TYPE_OF_NEWS_ACT = "News"
attr_accessible :forge_message_id, :forge_message_type, :project_id, :user_id, :viewed attr_accessible :forge_message_id, :forge_message_type, :project_id, :user_id, :viewed, :secret_key
belongs_to :forge_message ,:polymorphic => true belongs_to :forge_message ,:polymorphic => true
belongs_to :project belongs_to :project

View File

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

View File

@ -47,6 +47,42 @@ class Mailer < ActionMailer::Base
MailerProxy.new(self) MailerProxy.new(self)
end end
# 作业匿评开启
def send_mail_anonymous_comment_open(homework_common)
course = homework_common.course
recipients ||= []
course.student.each do |student|
user = User.find(student.student_id)
@subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}"
@token = Token.get_token_from_user(user, 'autologin')
@anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
@anonymous_comment_close_name = homework_common.name
@author = homework_common.user
#收件人邮箱
recipients << user.mail
end
mail :to => recipients,
:subject => @subject
end
# 作业匿评关闭
def send_mail_anonymous_comment_close(homework_common)
course = homework_common.course
recipients ||= []
course.student.each do |student|
user = User.find(student.student_id)
@subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}"
@token = Token.get_token_from_user(user, 'autologin')
@anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
@anonymous_comment_close_name = homework_common.name
@author = homework_common.user
#收件人邮箱
recipients << user.mail
end
mail :to => recipients,
:subject => @subject
end
# author: alan # author: alan
# 邀请未注册用户加入项目 # 邀请未注册用户加入项目
# 功能: 在加入项目的同时自动注册用户 # 功能: 在加入项目的同时自动注册用户
@ -82,14 +118,15 @@ class Mailer < ActionMailer::Base
@token = Token.get_token_from_user(user, 'autologin') @token = Token.get_token_from_user(user, 'autologin')
@project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value) @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value)
# 发送消息邀请 # 发送消息邀请
send_message(user,project) send_message_request_member(user,project)
# end # end
mail :to => email, :subject => @subject mail :to => email, :subject => @subject
end end
# 邀请信息消息 注forge_message_id 为邀请人ID(特殊情况) # 邀请信息消息 注forge_message_id 为邀请人ID(特殊情况)
def send_message(user, project) def send_message_request_member(user, project)
ForgeMessage.create(:user_id => user.id, :project_id => project.id, :forge_message_type => "Project_Invite",:forge_message_id => User.current.id, :viewed => false) key = newpass(6).to_s
ForgeMessage.create(:user_id => user.id, :project_id => project.id, :forge_message_type => "ProjectInvite",:forge_message_id => User.current.id, :viewed => false, :secret_key =>key)
end end
# author: alan # author: alan

View File

@ -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}) %>"); $("#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%");

View File

@ -16,6 +16,7 @@
<!-- 老师身份才可以发布作业 --> <!-- 老师身份才可以发布作业 -->
<div class="HomeWork mb10"> <div class="HomeWork mb10">
<%= form_for @homework do |f| %> <%= form_for @homework do |f| %>
<input type="text" name="is_in_course" class="none" value="<%= @is_in_course%>"/>
<div id="HomeWorkCon"> <div id="HomeWorkCon">
<%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %> <%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
</div> </div>

View File

@ -26,8 +26,8 @@
</p> </p>
<% if @is_teacher%> <% if @is_teacher%>
<%= homework_anonymous_comment(homework)%> <%= homework_anonymous_comment(homework)%>
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %> <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework,:is_in_course => 1),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %>
<%= link_to(l(:button_edit),edit_homework_common_path(homework), :class => "fr mr10 work_edit") %> <%= link_to(l(:button_edit),edit_homework_common_path(homework,:is_in_course => 1), :class => "fr mr10 work_edit") %>
<% elsif @is_student%> <% elsif @is_student%>
<%= student_anonymous_comment homework %> <%= student_anonymous_comment homework %>
<%= student_new_homework homework %> <%= student_new_homework homework %>

View File

@ -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}) %>"); $("#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%");

View File

@ -0,0 +1,10 @@
<div class="mail_box" style="border:1px solid #c8c8c8; width:570px; height: auto; padding:15px; margin-top:10px; margin-bottom:10px;">
<ul style="list-style-type:none; margin:0; padding:0;">
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
<span style="float: left; width: 526px">
<p><%=link_to @author, user_url(@author) %> 发布的作业:<%=link_to @anonymous_comment_close_name, @anonymous_comment_close_url%> <span style="color: red; padding-left: 10px;">已经关闭了匿评!</span></p>
</span>
</li>
</ul>
<div class="cl" style="margin-top: 30px; clear:both; overflow:hidden;"></div>
</div>

View File

@ -0,0 +1,10 @@
<div class="mail_box" style="border:1px solid #c8c8c8; width:570px; height: auto; padding:15px; margin-top:10px; margin-bottom:10px;">
<ul style="list-style-type:none; margin:0; padding:0;">
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
<span style="float: left; width: 526px">
<p><%=link_to @author, user_url(@author) %> 发布的作业:<%=link_to @anonymous_comment_close_name, @anonymous_comment_close_url%> <span style="color: red; padding-left: 10px;">已经开启匿评了!</span></p>
</span>
</li>
</ul>
<div class="cl" style="margin-top: 30px; clear:both; overflow:hidden;"></div>
</div>

View File

@ -3,4 +3,4 @@
<%elsif @course%> <%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}) %>"); $("#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%> <%end%>
init_activity_KindEditor_data(<%= @user_activity_id%>,"","85%"); init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");

View File

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

View File

@ -12,13 +12,38 @@
<% end %> TO <!--+"(课程名称)" --> <% end %> TO <!--+"(课程名称)" -->
<%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%> <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%>
</div> </div>
<div class="homepagePostTitle break_word"> <!--+"(作业名称)"--> <div class="homepagePostTitle hidden m_w530 fl"> <!--+"(作业名称)"-->
<%= link_to activity.name.to_s, student_work_index_path(:homework => activity.id,:host=> Setting.host_course), :class => "postGrey"%> <%= link_to activity.name.to_s, student_work_index_path(:homework => activity.id,:host=> Setting.host_course), :class => "postGrey"%>
</div> </div>
<% if activity.homework_detail_manual.comment_status == 1%>
<span class="grey_btn_cir ml10">未开启匿评</span>
<% elsif activity.homework_detail_manual.comment_status == 2%>
<span class="green_btn_cir ml10">匿评中</span>
<% elsif activity.homework_detail_manual.comment_status == 3%>
<span class="grey_btn_cir ml10">匿评已结束</span>
<% end%>
<div class="homepagePostSubmitContainer"> <div class="homepagePostSubmitContainer">
<div class="homepagePostSubmit"> <div class="homepagePostSubmit">
<%= student_work_activity_submit_status(homework: activity) %> <% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
<%= user_for_homework_common activity,is_teacher %>
</div> </div>
<% if activity.homework_type == 2 && is_teacher%>
<div class="homepagePostSubmit">
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
</div>
<% end %>
<% 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%>
</div>
<% end %>
<div class="homepagePostDeadline">截止时间:<%= activity.end_time.to_s %></div> <div class="homepagePostDeadline">截止时间:<%= activity.end_time.to_s %></div>
</div> </div>
<div class="homepagePostIntro break_word upload_img" id="activity_description_<%= user_activity_id%>"> <div class="homepagePostIntro break_word upload_img" id="activity_description_<%= user_activity_id%>">

View File

@ -97,16 +97,16 @@
</div> </div>
<% end %> <% 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="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;"> <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|%> <%= 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="quote[quote]" value="">
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>"> <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> <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> <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> <div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p> <p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%> <% end%>

View File

@ -68,21 +68,22 @@
</div> </div>
<% end %> <% 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="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;"> <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|%> <%= 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%>"> <input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea> <textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div> <div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="margin-top:6px;">发送</a> <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> <div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p> <p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%> <% end%>
</div>
<div class="cl"></div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
</div>
</div> </div>
</div> </div>

View File

@ -113,22 +113,23 @@
</div> </div>
<% end %> <% 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="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;"> <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|%> <%= 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%>"> <input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="notes"></textarea> <textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="notes"></textarea>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div> <div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="margin-top:6px;">发送</a> <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> <div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p> <p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%> <% end%>
</div>
<div class="cl"></div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
</div>
</div> </div>
</div> </div>

View File

@ -82,23 +82,24 @@
</div> </div>
<% end %> <% 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="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;"> <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|%> <%= 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="quote[quote]" value="">
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>"> <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> <textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div> <div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="margin-top:6px;">发送</a> <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> <div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p> <p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%> <% end%>
</div>
<div class="cl"></div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
</div>
</div> </div>

View File

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

View File

@ -59,10 +59,10 @@
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText"> <ul class="homepagePostSettiongText">
<li> <li>
<%= link_to l(:button_edit),edit_homework_common_path(homework_common), :class => "postOptionLink"%> <%= link_to l(:button_edit),edit_homework_common_path(homework_common,:is_in_course => 0), :class => "postOptionLink"%>
</li> </li>
<li> <li>
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %> <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => 0),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
</li> </li>
<li> <li>
<%= homework_anonymous_comment homework_common %> <%= homework_anonymous_comment homework_common %>

View File

@ -4,7 +4,7 @@
<div class="HomeWorkCon"> <div class="HomeWorkCon">
<div class="mt15"> <div class="mt15">
<select class="InputBox W120 language_type" > <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> </select>
</div> </div>
<% if edit_mode && homework.is_program_homework? %> <% if edit_mode && homework.is_program_homework? %>

View File

@ -64,19 +64,18 @@
<% unless usm.subject.nil? %> <% unless usm.subject.nil? %>
<p><strong>标题:</strong><%= usm.subject %></p> <p><strong>标题:</strong><%= usm.subject %></p>
<% end %> <% end %>
<% if usm.description.nil? && usm.content.nil? %> <% if (!usm.description.nil? && usm.description != "") || (!usm.content.nil? && usm.content != "") %>
<div class="fl"><strong>内容:</strong></div><div class="ml36"><%= usm.description.nil? ? usm.content.html_safe : usm.description.html_safe %></div>
<% else %>
<div class="fl"><strong>内容:</strong></div><div class="ml36"><%= usm.description.html_safe %></div>
<% end %> <% end %>
</div> </div>
<li class="homepageNewsTime fl"><%= time_tag(usm.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(usm.created_at).html_safe %> </li>
</ul> </ul>
<% end %> <% end %>
<% end %> <% end %>
<%# 课程消息 %> <!--总消息列表-->
<% unless @message_alls.nil? %> <% unless @message_alls.nil? %>
<% @message_alls.each do |ma| %> <% @message_alls.each do |ma| %>
<%# 课程消息 %>
<% if ma.class == CourseMessage %> <% if ma.class == CourseMessage %>
<% if ma.course_message_type == "News" %> <% if ma.course_message_type == "News" %>
<ul class="homepageNewsList fl"> <ul class="homepageNewsList fl">
@ -88,7 +87,11 @@
:onmouseover =>"message_titile_show($(this),event)", :onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></li> :onmouseout => "message_titile_hide($(this))" %></li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<%= ma.course_message.title.html_safe %> <p><strong>标题:</strong><%= ma.course_message.title %></p>
<% unless ma.course_message.description.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.course_message.description.html_safe %></div>
<% end %>
</div> </div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul> </ul>
@ -103,12 +106,16 @@
:onmouseover =>"message_titile_show($(this),event)", :onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></li> :onmouseout => "message_titile_hide($(this))" %></li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<%= ma.course_message.comments.html_safe %> <p><strong>标题:</strong><%= ma.course_message.commented.title %></p>
<% unless ma.course_message.comments.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.course_message.comments.html_safe %></div>
<% end %>
</div> </div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul> </ul>
<% end %> <% end %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status != 1 %> <% if ma.course_message_type == "HomeworkCommon" && ma.status.nil? %>
<ul class="homepageNewsList fl"> <ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li> <li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了作业:</span></li> <li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了作业:</span></li>
@ -118,7 +125,11 @@
:onmouseover =>"message_titile_show($(this),event)", :onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></a></li> :onmouseout => "message_titile_hide($(this))" %></a></li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<%= ma.course_message.name %> <p><strong>标题:</strong><%= ma.course_message.name %></p>
<% unless ma.course_message.description.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.course_message.description.html_safe %></div>
<% end %>
</div> </div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul> </ul>
@ -151,6 +162,65 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul> </ul>
<% end %> <% end %>
<!--作品开启匿评 待整合:时间紧-->
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布的作业:</span></li>
<% if ma.viewed == 0 %>
<li class="homepageHomeworkContent fl">
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
</li>
<div style="display: none" class="message_title_red system_message_style">
<%= ma.course_message.name %>
</div>
<li class="homepageHomeworkContentWarn fl"> &nbsp;&nbsp; 开启匿评了!</li>
<% else %>
<li class="homepageNewsContent fl">
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))"%>
</li>
<div style="display: none" class="message_title_red system_message_style">
<%= ma.course_message.name %>
</div>
<% end %>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<!--作品关闭匿评-->
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布的作业:</span></li>
<% if ma.viewed == 0 %>
<li class="homepageHomeworkContent fl">
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
</li>
<div style="display: none" class="message_title_red system_message_style">
<%= ma.course_message.name %>
</div>
<li class="homepageHomeworkContentWarn fl"> &nbsp;&nbsp; 匿评已经关闭!</li>
<% else %>
<li class="homepageNewsContent fl">
<%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))"%>
</li>
<div style="display: none" class="message_title_red system_message_style">
<%= ma.course_message.name %>
</div>
<% end %>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "Poll" %> <% if ma.course_message_type == "Poll" %>
<ul class="homepageNewsList fl"> <ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li> <li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
@ -174,7 +244,15 @@
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey"> <li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.course_message.subject, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id), <%= link_to ma.course_message.subject, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
:title => "#{ma.course_message.subject.html_safe}" %></a></li> :onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></a></li>
<div style="display: none" class="message_title_red system_message_style" >
<p><strong>主题:</strong><%= ma.course_message.subject %></p>
<% unless ma.course_message.content.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.course_message.content.html_safe %></div>
<% end %>
</div>
<% else %> <% else %>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey"> <li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.course_message.content.html_safe, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id), <%= link_to ma.course_message.content.html_safe, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
@ -182,7 +260,11 @@
:onmouseover =>"message_titile_show($(this),event)", :onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></a></li> :onmouseout => "message_titile_hide($(this))" %></a></li>
<div style="display: none" class="message_title_red system_message_style" > <div style="display: none" class="message_title_red system_message_style" >
<%= ma.course_message.content.html_safe %> <p><strong>主题:</strong><%= ma.course_message.subject %></p>
<% unless ma.course_message.content.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.course_message.content.html_safe %></div>
<% end %>
</div> </div>
<% end %> <% end %>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
@ -250,6 +332,7 @@
<% end %> <% end %>
<!--项目消息--> <!--项目消息-->
<% if ma.class == ForgeMessage %> <% if ma.class == ForgeMessage %>
<!--申请加入项目-->
<% if ma.forge_message_type == "AppliedProject" %> <% if ma.forge_message_type == "AppliedProject" %>
<ul class="homepageNewsList fl"> <ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"> <li class="homepageNewsPortrait fl">
@ -270,6 +353,37 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul> </ul>
<% end %> <% end %>
<!--邀请加入项目-->
<% if ma.forge_message_type == "ProjectInvite" %>
<% inviter = User.find(ma.forge_message_id) %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(inviter), :width => "30", :height => "30"), user_path(inviter) %></a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to inviter, user_path(inviter), :class => "newsBlue homepageNewsPublisher" %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">邀请你加入项目:</span>
</li>
<li class="homepageHomeworkContent fl">
<%= link_to ma.project, project_path(ma.project),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover => "message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
</li>
<div style="display: none" class="message_title_red system_message_style">
<%= ma.project %>
</div>
<% if User.current == @user %>
<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,
:class => "green_btn_cir ml10",
:style => "color:#fff" %>
</li>
<% end %>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.forge_message_type == "Issue" %> <% if ma.forge_message_type == "Issue" %>
<ul class="homepageNewsList fl"> <ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"> <li class="homepageNewsPortrait fl">
@ -285,7 +399,11 @@
:onmouseout => "message_titile_hide($(this))" %></a> :onmouseout => "message_titile_hide($(this))" %></a>
</li> </li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<%= ma.forge_message.subject %> <p><strong>主题:</strong><%= ma.forge_message.subject %></p>
<% unless ma.forge_message.description.nil? || ma.forge_message.description == "" %>
<div class="fl"><strong>描述:</strong></div>
<div class="ml36"><%= ma.forge_message.description.html_safe %></div>
<% end %>
</div> </div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul> </ul>
@ -309,7 +427,7 @@
<div style="display: none" class="message_title_red system_message_style" > <div style="display: none" class="message_title_red system_message_style" >
<p><strong>问题标题:</strong><%= ma.forge_message.journalized.subject %></p> <p><strong>问题标题:</strong><%= ma.forge_message.journalized.subject %></p>
<div class="fl"><strong>更新内容:</strong></div> <div class="fl"><strong>更新内容:</strong></div>
<div class="ml36"><%= get_issue_des_update(ma.forge_message).html_safe %></div> <div class="ml60"><%= get_issue_des_update(ma.forge_message).html_safe %></div>
</div> </div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul> </ul>
@ -327,7 +445,11 @@
:onmouseover => "message_titile_show($(this),event)", :onmouseover => "message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></a></li> :onmouseout => "message_titile_hide($(this))" %></a></li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<%= ma.forge_message.subject.html_safe %> <p><strong>主题:</strong><%= ma.forge_message.subject %></p>
<% unless ma.forge_message.content.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.forge_message.content.html_safe %></div>
<% end %>
</div> </div>
<% else %> <% else %>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey"> <li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
@ -337,7 +459,11 @@
:onmouseover => "message_titile_show($(this),event)", :onmouseover => "message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></a></li> :onmouseout => "message_titile_hide($(this))" %></a></li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<%= ma.forge_message.content.html_safe %> <p><strong>主题:</strong><%= ma.forge_message.subject %></p>
<% unless ma.forge_message.content.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.forge_message.content.html_safe %></div>
<% end %>
</div> </div>
<% end %> <% end %>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
@ -359,8 +485,11 @@
:onmouseout => "message_titile_hide($(this))" %></a> :onmouseout => "message_titile_hide($(this))" %></a>
</li> </li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<p><strong>标题:</strong><%= ma.forge_message.title %></p>
<%= ma.forge_message.title.html_safe %> <% unless ma.forge_message.description.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.forge_message.description.html_safe %></div>
<% end %>
</div> </div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul> </ul>
@ -377,7 +506,9 @@
:onmouseout => "message_titile_hide($(this))" %> :onmouseout => "message_titile_hide($(this))" %>
</li> </li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<%= ma.forge_message.comments.html_safe %> <p><strong>新闻标题:</strong><%= ma.forge_message.commented.title %></p>
<div class="fl"><strong>评论内容:</strong></div>
<div class="ml60"><%= ma.forge_message.comments.html_safe %></div>
</div> </div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul> </ul>
@ -402,8 +533,10 @@
</li> </li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<p><strong>标题:</strong><%= ma.memo.subject %></p> <p><strong>标题:</strong><%= ma.memo.subject %></p>
<div class="fl"><strong>内容:</strong></div> <% unless ma.memo.content.nil? %>
<div class="ml36"><%= ma.memo.content.html_safe %></div> <div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.memo.content.html_safe %></div>
<% end %>
</div> </div>
<% else %> <% else %>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey"> <li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
@ -413,8 +546,10 @@
</li> </li>
<div style="display: none" class="message_title_red system_message_style"> <div style="display: none" class="message_title_red system_message_style">
<p><strong>标题:</strong><%= ma.memo.subject %></p> <p><strong>标题:</strong><%= ma.memo.subject %></p>
<div class="fl"><strong>内容:</strong></div> <% unless ma.memo.content.nil? %>
<div class="ml36"><%= ma.memo.content.html_safe %></div> <div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.memo.content.html_safe %></div>
<% end %>
</div> </div>
<% end %> <% end %>
<li class="homepageNewsTime fl"><%= time_tag(ma.memo.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.memo.created_at).html_safe %> </li>

View File

@ -39,8 +39,8 @@
</div> </div>
<div class="homepagePostDes"> <div class="homepagePostDes">
<div class="homepagePostTo break_word"> <div class="homepagePostTo break_word">
<span class="fl"> Trustie平台 发布了系统消息:</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 %></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>
<div class="cl"></div> <div class="cl"></div>
<p class="homepagePostIntro break_word upload_img"> <p class="homepagePostIntro break_word upload_img">

View File

@ -103,7 +103,7 @@ default:
# autologin_cookie_name: the name of the cookie (default: autologin) # autologin_cookie_name: the name of the cookie (default: autologin)
# autologin_cookie_path: the cookie path (default: /) # autologin_cookie_path: the cookie path (default: /)
# autologin_cookie_secure: true sets the cookie secure flag (default: false) # autologin_cookie_secure: true sets the cookie secure flag (default: false)
autologin_cookie_name: "autologin_trustie" autologin_cookie_name:
autologin_cookie_path: autologin_cookie_path:
autologin_cookie_secure: autologin_cookie_secure:
@ -197,16 +197,10 @@ default:
#max_concurrent_ajax_uploads: 2 #max_concurrent_ajax_uploads: 2
#pic_types: "bmp,jpeg,jpg,png,gif" #pic_types: "bmp,jpeg,jpg,png,gif"
repository_root_path: '/tmp/htdocs'
judge_server: 'http://judge.trustie.net/'
# specific configuration options for production environment # specific configuration options for production environment
# that overrides the default ones # that overrides the default ones
production: production:
judge_server: 'http://192.168.80.21:8080/' # CJK support
repository_root_path: '/home/pdl/redmine-2.3.2-0/apache2/htdocs'
cookie_domain: ".trustie.net"
rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf
email_delivery: email_delivery:
delivery_method: :smtp delivery_method: :smtp
@ -224,9 +218,9 @@ development:
email_delivery: email_delivery:
delivery_method: :smtp delivery_method: :smtp
smtp_settings: smtp_settings:
address: smtp.163.com address: mail.trustie.net
port: 25 port: 25
domain: smtp.163.com domain: mail.trustie.net
authentication: :login authentication: :login
user_name: "huang.jingquan@163.com" user_name: "mail@trustie.net"
password: "xinhu1ji2qu366" password: "loong2010"

View File

@ -25,4 +25,6 @@ zh:
mail_course_homework_active: "中发布了作业" mail_course_homework_active: "中发布了作业"
mail_attention: "请您关注!" mail_attention: "请您关注!"
mail_homework_endtime: "作业截止时间快到了!" mail_homework_endtime: "作业截止时间快到了!"
mail_homework: "作业:" mail_homework: "作业:"
mail_anonymous_comment_close: "作业匿评已经关闭!"
mail_anonymous_comment_open: "作业匿评已经开启!"

View File

@ -0,0 +1,5 @@
class AddSecretKeyToForgeMessage < ActiveRecord::Migration
def change
add_column :forge_messages, :secret_key, :string
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150917081214) do ActiveRecord::Schema.define(:version => 20150918005722) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -497,26 +497,23 @@ ActiveRecord::Schema.define(:version => 20150917081214) do
add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
add_index "documents", ["project_id"], :name => "documents_project_id" add_index "documents", ["project_id"], :name => "documents_project_id"
create_table "dts", :primary_key => "Num", :force => true do |t| create_table "dts", :force => true do |t|
t.string "Defect", :limit => 50 t.string "IPLineCode"
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
t.string "Description" t.string "Description"
t.text "PreConditions", :limit => 2147483647 t.string "Num"
t.text "TraceInfo", :limit => 2147483647 t.string "Variable"
t.text "Code", :limit => 2147483647 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.integer "project_id"
t.datetime "created_at" t.datetime "created_at", :null => false
t.datetime "updated_at" t.datetime "updated_at", :null => false
t.integer "id", :null => false
end end
create_table "enabled_modules", :force => true do |t| create_table "enabled_modules", :force => true do |t|
@ -686,7 +683,6 @@ ActiveRecord::Schema.define(:version => 20150917081214) do
t.integer "user_id" t.integer "user_id"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.string "mail"
end end
create_table "issue_categories", :force => true do |t| create_table "issue_categories", :force => true do |t|
@ -1308,9 +1304,9 @@ ActiveRecord::Schema.define(:version => 20150917081214) do
create_table "student_work_tests", :force => true do |t| create_table "student_work_tests", :force => true do |t|
t.integer "student_work_id" t.integer "student_work_id"
t.datetime "created_at", :null => false t.integer "status"
t.datetime "updated_at", :null => false t.datetime "created_at", :null => false
t.integer "status", :default => 9 t.datetime "updated_at", :null => false
t.text "results" t.text "results"
t.text "src" t.text "src"
end end
@ -1329,7 +1325,7 @@ ActiveRecord::Schema.define(:version => 20150917081214) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.integer "late_penalty", :default => 0 t.integer "late_penalty", :default => 0
t.integer "absence_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 t.boolean "is_test", :default => false
end end
@ -1363,10 +1359,8 @@ ActiveRecord::Schema.define(:version => 20150917081214) do
create_table "system_messages", :force => true do |t| create_table "system_messages", :force => true do |t|
t.integer "user_id" t.integer "user_id"
t.string "content" t.string "content"
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.text "description"
t.string "subject"
end end
create_table "taggings", :force => true do |t| create_table "taggings", :force => true do |t|
@ -1558,6 +1552,7 @@ ActiveRecord::Schema.define(:version => 20150917081214) do
t.string "identity_url" t.string "identity_url"
t.string "mail_notification", :default => "", :null => false t.string "mail_notification", :default => "", :null => false
t.string "salt", :limit => 64 t.string "salt", :limit => 64
t.integer "gid"
end end
add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"

View File

@ -124,7 +124,7 @@ $(function(){
$('#textarea_input_test').focus(); $('#textarea_input_test').focus();
}); });
$("#BluePopupBox a.BlueCirBtn").live('click', function(){ var saveProgramAnswers = function() {
var test_numbers = 0; var test_numbers = 0;
var valid = true; var valid = true;
var input = null; var input = null;
@ -159,6 +159,12 @@ $(function(){
$('.program-input').remove(); $('.program-input').remove();
var html=bt('t:program-input-list',data); var html=bt('t:program-input-list',data);
$("input[name=homework_type]").after(html); $("input[name=homework_type]").after(html);
}
return valid;
}
$("#BluePopupBox a.BlueCirBtn").live('click', function(){
if(saveProgramAnswers()){
if($( "#BluePopupBox" ).dialog( "isOpen" )){ if($( "#BluePopupBox" ).dialog( "isOpen" )){
$("#BluePopupBox").dialog( "close" ); $("#BluePopupBox").dialog( "close" );
} }
@ -180,4 +186,4 @@ $(function(){
$("#BluePopupBox").on('click', 'a.icon_remove', function(){ $("#BluePopupBox").on('click', 'a.icon_remove', function(){
$(this).parent('.mt10').remove(); $(this).parent('.mt10').remove();
}); });
}); });

View File

@ -1,10 +1,7 @@
/**
* Created by Alan on 2015/9/18.
*/
function init_editor(params){ function init_editor(params){
// var minHeight; //最小高度 // var minHeight; //最小高度
var id = arguments[1] ? arguments[1] : undefined;
var paramsHeight = params.height; //设定的高度 var paramsHeight = params.height; //设定的高度
var id = arguments[1] ? arguments[1] : undefined;
var paramsWidth = params.width == undefined ? "100%" : params.width; var paramsWidth = params.width == undefined ? "100%" : params.width;
var editor = params.kindutil.create(params.textarea, { var editor = params.kindutil.create(params.textarea, {
@ -13,19 +10,42 @@ function init_editor(params){
minHeight:"30px",// == undefined ? "30px":paramsHeight+"px", minHeight:"30px",// == undefined ? "30px":paramsHeight+"px",
items:['emoticons'], items:['emoticons'],
afterChange:function(){//按键事件 afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
var edit = this.edit; var edit = this.edit;
var body = edit.doc.body; var body = edit.doc.body;
edit.iframe.height(paramsHeight); edit.iframe.height(paramsHeight);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + (paramsHeight == undefined ? 30:paramsHeight), paramsHeight)); this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + (paramsHeight == undefined ? 30:paramsHeight), paramsHeight));
}, },
afterBlur:function(){
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
if(this.edit.html()=="") {
this.edit.html('<span id="hint" style="color: #808080">我要回复</span>');
}
//params.toolbar_container.hide();
$('#reply_image_' + id).addClass('imageFuzzy');
//this.resize("95%", null);
//params.submit_btn.css("display","none");
},
afterFocus: function(){
var edit = this.edit;
var body = edit.doc.body;
if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\#\d*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(edit.html())){
edit.html('');
}
params.contentmsg.hide();
// params.toolbar_container.show();
$('#reply_image_' + id).removeClass('imageFuzzy');
//edit.iframe.width(paramsWidth);
this.resize(paramsWidth, null);
params.submit_btn.show();
},
afterCreate:function(){ afterCreate:function(){
params.submit_btn.css("display","none"); params.submit_btn.css("display","none");
var toolbar = $("div[class='ke-toolbar']",params.div_form); var toolbar = $("div[class='ke-toolbar']",params.div_form);
toolbar.css('width',24); toolbar.css('width',24);
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情'); $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
params.toolbar_container.append(toolbar); params.toolbar_container.append(toolbar);
params.toolbar_container.style.display = 'none';
//init //init
var edit = this.edit; var edit = this.edit;
var body = edit.doc.body; var body = edit.doc.body;
@ -36,20 +56,10 @@ function init_editor(params){
var body = edit.doc.body; var body = edit.doc.body;
paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight; paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight;
edit.iframe.height(paramsHeight); edit.iframe.height(paramsHeight);
edit.html('<span id="hint" style="color: #808080">我要回复</span>');
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ (paramsHeight == undefined ? 30:paramsHeight) , paramsHeight)); this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ (paramsHeight == undefined ? 30:paramsHeight) , paramsHeight));
// params.toolbar_container.hide();
},
afterFocus:function(){
$('#reply_image_' + id).removeClass('imageFuzzy');
//edit.iframe.width(paramsWidth);
this.resize(paramsWidth, null);
params.submit_btn.css('display','inline-block');
},
afterBlur:function(){
$('#reply_image_' + id).addClass('imageFuzzy');
this.resize("95%", null);
params.submit_btn.css("display","none");
} }
}).loadPlugin('paste'); }).loadPlugin('paste');
return editor; return editor;
@ -64,7 +74,7 @@ function nh_check_field(params){
if(params.content.html()!=params.textarea.html() || params.issubmit==true){ if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html()); params.textarea.html(params.content.html());
params.content.sync(); params.content.sync();
if(params.content.isEmpty()){ if(params.content.isEmpty() || /^\&\w*\;\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\#\d*\;\"\&\w*\;[\u4e00-\u9fa5]*\&\w*\;\/\w*\&\w*\;$/.test(params.textarea.html())){
params.contentmsg.html('内容不能为空'); params.contentmsg.html('内容不能为空');
params.contentmsg.css({color:'#ff0000'}); params.contentmsg.css({color:'#ff0000'});
}else{ }else{
@ -128,7 +138,7 @@ function init_activity_KindEditor_data(id){
params.height = height; params.height = height;
params.width = width; params.width = width;
if (params.textarea.data('init') == undefined) { if (params.textarea.data('init') == undefined) {
params.editor = init_editor(params, id); params.editor = init_editor(params,id);
init_form(params); init_form(params);
params.cancel_btn.click(function () { params.cancel_btn.click(function () {
nh_reset_form(params); nh_reset_form(params);
@ -141,4 +151,4 @@ function init_activity_KindEditor_data(id){
} }
}); });
}); });
} }

View File

@ -568,6 +568,7 @@ a.postTypeGrey:hover {color:#269ac9;}
.homepagePostReply {width:710px; margin:0px auto; background-color:#f1f1f1; margin-top:10px;} .homepagePostReply {width:710px; margin:0px auto; background-color:#f1f1f1; margin-top:10px;}
.homepagePostReplyBanner {width:708px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888;} .homepagePostReplyBanner {width:708px; height:33px; border:1px solid #e4e4e4; line-height:33px; vertical-align:middle; font-size:12px; color:#888888;}
.borderBottomNone {border-bottom:none !important;} .borderBottomNone {border-bottom:none !important;}
div.minHeight48{min-height: 48px;}
.homepagePostReplyBannerCount{width:255px; display:inline-block; margin-left:20px;} .homepagePostReplyBannerCount{width:255px; display:inline-block; margin-left:20px;}
.homepagePostReplyBannerTime{width:85px; display:inline-block;} .homepagePostReplyBannerTime{width:85px; display:inline-block;}
.homepagePostReplyBannerMore{width:330px; display:inline-block; text-align:right;} .homepagePostReplyBannerMore{width:330px; display:inline-block; text-align:right;}
@ -583,7 +584,7 @@ a.postReplyCancel {color:#888888; display:block;}
a.postReplyCancel:hover {color:#ffffff;} a.postReplyCancel:hover {color:#ffffff;}
.homepagePostReplyInputContainer2 {width:595px; margin:0px auto;} .homepagePostReplyInputContainer2 {width:595px; margin:0px auto;}
.homepagePostReplyInput2 {width:588px; height:45px; max-width:588px; max-height:45px; border:1px solid #d9d9d9; outline:none; margin:0px auto 10px auto;} .homepagePostReplyInput2 {width:588px; height:45px; max-width:588px; max-height:45px; border:1px solid #d9d9d9; outline:none; margin:0px auto 10px auto;}
.homepagePostReplyContainer {border-bottom:1px solid #e3e3e3; width:680px; margin:0px auto; margin-top:18px; min-height:48px;} .homepagePostReplyContainer {border-bottom:1px solid #e3e3e3; width:680px; margin:0px auto; margin-top:15px; min-height:60px;}
.homepagePostSetting {position:absolute; width:20px; height:20px; right:0px; top:0px;} .homepagePostSetting {position:absolute; width:20px; height:20px; right:0px; top:0px;}
.homepagePostSetting ul li:hover ul {display:block;} .homepagePostSetting ul li:hover ul {display:block;}
.homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;} .homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;}