diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 35d6f2b85..9d5768948 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -137,6 +137,7 @@ class HomeworkCommonController < ApplicationController def edit @user = User.current + @is_in_course = params[:is_in_course] respond_to do |format| format.html{render :layout => 'new_base_user'} end @@ -173,7 +174,11 @@ class HomeworkCommonController < ApplicationController if @homework.save @homework_detail_manual.save if @homework_detail_manual @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 @@ -181,7 +186,13 @@ class HomeworkCommonController < ApplicationController def destroy if @homework.destroy 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 @@ -206,7 +217,9 @@ class HomeworkCommonController < ApplicationController end @homework_detail_manual.update_column('comment_status', 2) @statue = 1 - # send_message_homework(@homework) + # 匿评开启消息邮件通知 + send_message_anonymous_comment(@homework, m_status = 2) + Mailer.send_mail_anonymous_comment_open(@homework).deliver else @statue = 2 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.save 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| format.js end end # 开启/关闭匿评消息通知 - # def send_message_homework(homework) - # # status 标记匿评状态 1为关闭 0为开启 - # course = @homework.course - # course.student.each do |st| - # @homework.course_messages << CourseMessage.new(:user_id => st.user_id, :course_id => course.id, :viewed => false, :status => false) - # end - # end - + def send_message_anonymous_comment(homework, m_status ) + # status 标记匿评状态 1为关闭 0为开启 + course = @homework.course + course.student.each do |st| + @homework.course_messages << CourseMessage.new(:user_id => st.student_id, :course_id => course.id, :viewed => false, :status => m_status) + end + end #提示 def alert_anonymous_comment @cur_size = 0 diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 6da45c10b..71b852e01 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -464,6 +464,10 @@ class ProjectsController < ApplicationController # by young # include CoursesHelper def member + # 消息"同意加入项目" + if params[:message_id] + message_invite(params[:message_id], params[:key]) + end # params[:login]为邮箱邀请用户加入,主要功能: # 1、自动注册 # 2、加入项目、创建角色 @@ -519,6 +523,14 @@ class ProjectsController < ApplicationController @members = paginateHelper @members 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) result = false diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b6ac28258..d3921d44a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -198,7 +198,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 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1982542a9..d7fac9a7d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2368,7 +2368,7 @@ module ApplicationHelper end 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 when 1 "未开启匿评".html_safe @@ -2377,10 +2377,6 @@ module ApplicationHelper when 3 "匿评已结束".html_safe end - elsif homework.homework_type == 0 - "未启用匿评".html_safe - elsif homework.homework_type == 2 - " 编程作业  ".html_safe end end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 7b4b9d2e4..6a865b203 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -83,7 +83,7 @@ module ProjectsHelper elsif ivite_list.user.active? value = "邀请已发送,等待用户加入!" else - value = "账号尚未激活,等待用户应答!" + value = "邀请已发送,等待用户激活账号!" end end diff --git a/app/models/forge_message.rb b/app/models/forge_message.rb index 0c8b3384f..0dce57598 100644 --- a/app/models/forge_message.rb +++ b/app/models/forge_message.rb @@ -8,7 +8,7 @@ class ForgeMessage < ActiveRecord::Base TYPE_OF_WIKI_ACT = "Wiki" 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 :project diff --git a/app/models/homework_detail_programing.rb b/app/models/homework_detail_programing.rb index f6286a45e..2877ed6c1 100644 --- a/app/models/homework_detail_programing.rb +++ b/app/models/homework_detail_programing.rb @@ -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 diff --git a/app/models/mailer.rb b/app/models/mailer.rb index c9ab6e58e..07b2a345c 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -47,6 +47,42 @@ class Mailer < ActionMailer::Base MailerProxy.new(self) 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 # 邀请未注册用户加入项目 # 功能: 在加入项目的同时自动注册用户 @@ -82,14 +118,15 @@ class Mailer < ActionMailer::Base @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) # 发送消息邀请 - send_message(user,project) + send_message_request_member(user,project) # end mail :to => email, :subject => @subject end # 邀请信息消息 注:forge_message_id 为邀请人ID(特殊情况) - def send_message(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) + def send_message_request_member(user, project) + 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 # author: alan diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb index 51cb4458e..7892ed773 100644 --- a/app/views/comments/create.js.erb +++ b/app/views/comments/create.js.erb @@ -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%"); diff --git a/app/views/homework_common/edit.html.erb b/app/views/homework_common/edit.html.erb index d6815a00a..5fc11728b 100644 --- a/app/views/homework_common/edit.html.erb +++ b/app/views/homework_common/edit.html.erb @@ -16,6 +16,7 @@
<%= form_for @homework do |f| %> +
<%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index d7723452b..693ddba65 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -26,8 +26,8 @@

<% if @is_teacher%> <%= 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(:button_edit),edit_homework_common_path(homework), :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,:is_in_course => 1), :class => "fr mr10 work_edit") %> <% elsif @is_student%> <%= student_anonymous_comment homework %> <%= student_new_homework homework %> diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb index edc722dbc..7c56aea6e 100644 --- a/app/views/issues/add_journal.js.erb +++ b/app/views/issues/add_journal.js.erb @@ -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%"); \ No newline at end of file +init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); \ No newline at end of file diff --git a/app/views/mailer/send_mail_anonymous_comment_close.html.erb b/app/views/mailer/send_mail_anonymous_comment_close.html.erb new file mode 100644 index 000000000..128f9fae8 --- /dev/null +++ b/app/views/mailer/send_mail_anonymous_comment_close.html.erb @@ -0,0 +1,10 @@ +
+ +
+
\ No newline at end of file diff --git a/app/views/mailer/send_mail_anonymous_comment_close.text.erb b/app/views/mailer/send_mail_anonymous_comment_close.text.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/mailer/send_mail_anonymous_comment_open.html.erb b/app/views/mailer/send_mail_anonymous_comment_open.html.erb new file mode 100644 index 000000000..5409ade55 --- /dev/null +++ b/app/views/mailer/send_mail_anonymous_comment_open.html.erb @@ -0,0 +1,10 @@ +
+ +
+
\ No newline at end of file diff --git a/app/views/mailer/send_mail_anonymous_comment_open.text.erb b/app/views/mailer/send_mail_anonymous_comment_open.text.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/messages/reply.js.erb b/app/views/messages/reply.js.erb index 3d4878cf7..4cd1a86d6 100644 --- a/app/views/messages/reply.js.erb +++ b/app/views/messages/reply.js.erb @@ -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%"); \ No newline at end of file +init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); \ No newline at end of file diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb index 1828ede6d..c03570072 100644 --- a/app/views/poll/_poll.html.erb +++ b/app/views/poll/_poll.html.erb @@ -30,13 +30,13 @@ <% if poll.polls_status == 1 %>
  • <%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml5"%>
  • <% else%> -
  • 编辑
  • +
  • 编辑
  • <% end%> <% if poll.polls_status == 2 %>
  • 关闭
  • <% else %> -
  • 关闭
  • +
  • 关闭
  • <% end%> <% if poll.polls_status == 1%> diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 58b29696c..5ba83401c 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -12,13 +12,38 @@ <% end %> TO <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%>
    -
    + + <% if activity.homework_detail_manual.comment_status == 1%> + 未开启匿评 + <% elsif activity.homework_detail_manual.comment_status == 2%> + 匿评中 + <% elsif activity.homework_detail_manual.comment_status == 3%> + 匿评已结束 + <% end%>
    - <%= student_work_activity_submit_status(homework: activity) %> + <% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %> + <%= user_for_homework_common activity,is_teacher %>
    + + <% if activity.homework_type == 2 && is_teacher%> +
    + <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %> +
    + <% end %> + <% if activity.homework_type == 2%> +
    + 语言: + <% if activity.homework_detail_programing.language.to_i == 1%> + C + <% elsif activity.homework_detail_programing.language.to_i == 2%> + C++ + <% end%> +
    + <% end %> +
    截止时间:<%= activity.end_time.to_s %>
    diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index a58c10f8c..703882bd1 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -97,16 +97,16 @@
    <% end %> -
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    -
    +
    <%= 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|%> - 发送
    + 发送

    <% end%> diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index 90680cf82..ef01022ce 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -68,21 +68,22 @@
    <% end %> -
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    -
    -
    - <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> - - -
    - 发送 -
    -

    - <% end%> +
    +
    + <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> + + +
    + 发送 +
    +

    + <% end%> +
    +
    -
    \ No newline at end of file diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 07f7c452b..29bed1499 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -113,22 +113,23 @@
    <% end %> -
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    -
    -
    - <%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f|%> - - -
    - 发送 -
    -

    - <% end%> +
    +
    + <%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f|%> + + +
    + 发送 +
    +

    + <% end%> +
    +
    -
    diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index d734ad982..2cce8f83a 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -82,23 +82,24 @@
    <% end %> -
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    -
    -
    - <%= 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|%> - - - -
    - 发送 -
    -

    - <% end%> +
    +
    + <%= 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|%> + + + +
    + 发送 +
    +

    + <% end%> +
    +
    -
    diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index ba9e970b6..225304185 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -36,7 +36,7 @@ } $(function() { - init_activity_KindEditor_data(<%= user_activity.id%>,"","85%"); + init_activity_KindEditor_data(<%= user_activity.id%>,"","87%"); }); <% act= user_activity.act unless user_activity.act_type == "ProjectCreateInfo" %> diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index c6e827291..e7addad97 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -59,10 +59,10 @@
    • - <%= 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"%>
    • - <%= 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") %>
    • <%= homework_anonymous_comment homework_common %> diff --git a/app/views/users/_user_programing_attr.html.erb b/app/views/users/_user_programing_attr.html.erb index 498005010..970867c43 100644 --- a/app/views/users/_user_programing_attr.html.erb +++ b/app/views/users/_user_programing_attr.html.erb @@ -4,7 +4,7 @@
      <% if edit_mode && homework.is_program_homework? %> diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 5ac9f7e8e..b9e626f2d 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -64,19 +64,18 @@ <% unless usm.subject.nil? %>

      标题:<%= usm.subject %>

      <% end %> - <% if usm.description.nil? && usm.content.nil? %> - - <% else %> -
      内容:
      <%= usm.description.html_safe %>
      + <% if (!usm.description.nil? && usm.description != "") || (!usm.content.nil? && usm.content != "") %> +
      内容:
      <%= usm.description.nil? ? usm.content.html_safe : usm.description.html_safe %>
      <% end %>
    • <%= time_tag(usm.created_at).html_safe %>
    <% end %> <% end %> - <%# 课程消息 %> + <% unless @message_alls.nil? %> <% @message_alls.each do |ma| %> + <%# 课程消息 %> <% if ma.class == CourseMessage %> <% if ma.course_message_type == "News" %>
      @@ -88,7 +87,11 @@ :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %>
    • <%= time_tag(ma.created_at).html_safe %>
    @@ -103,12 +106,16 @@ :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %>
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> - <% if ma.course_message_type == "HomeworkCommon" && ma.status != 1 %> + <% if ma.course_message_type == "HomeworkCommon" && ma.status.nil? %> @@ -151,6 +162,65 @@
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> + + <% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %> +
      +
    • <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
    • +
    • <%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">发布的作业:
    • + <% if ma.viewed == 0 %> +
    • + <%= 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))" %> +
    • + +
    •    开启匿评了!
    • + <% else %> +
    • + <%= 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))"%> +
    • + + <% end %> +
    • <%= time_tag(ma.created_at).html_safe %>
    • +
    + <% end %> + + <% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 %> +
      +
    • <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
    • +
    • <%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">发布的作业:
    • + <% if ma.viewed == 0 %> +
    • + <%= 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))" %> +
    • + +
    •    匿评已经关闭!
    • + <% else %> +
    • + <%= 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))"%> +
    • + + <% end %> +
    • <%= time_tag(ma.created_at).html_safe %>
    • +
    + <% end %> + <% if ma.course_message_type == "Poll" %> @@ -327,7 +445,11 @@ :onmouseover => "message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %> <% else %>
  • @@ -337,7 +459,11 @@ :onmouseover => "message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %>
  • <% end %>
  • <%= time_tag(ma.created_at).html_safe %>
  • @@ -359,8 +485,11 @@ :onmouseout => "message_titile_hide($(this))" %>
  • <%= time_tag(ma.created_at).html_safe %>
  • @@ -377,7 +506,9 @@ :onmouseout => "message_titile_hide($(this))" %>
  • <%= time_tag(ma.created_at).html_safe %>
  • @@ -402,8 +533,10 @@ <% else %>
  • @@ -413,8 +546,10 @@
  • <% end %>
  • <%= time_tag(ma.memo.created_at).html_safe %>
  • diff --git a/app/views/users/user_system_messages.html.erb b/app/views/users/user_system_messages.html.erb index cf0130547..3b8bd9fb6 100644 --- a/app/views/users/user_system_messages.html.erb +++ b/app/views/users/user_system_messages.html.erb @@ -39,8 +39,8 @@
    - Trustie平台 发布了系统消息: - <%= system_message.subject %> + Trustie平台 发布了系统消息: + <%= system_message.subject.nil? ? "系统消息" : system_message.subject %>

    diff --git a/config/configuration.yml b/config/configuration.yml index 5c58c705a..87a54a976 100644 --- a/config/configuration.yml +++ b/config/configuration.yml @@ -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_trustie" + autologin_cookie_name: autologin_cookie_path: autologin_cookie_secure: @@ -197,16 +197,10 @@ 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: - judge_server: 'http://192.168.80.21:8080/' - repository_root_path: '/home/pdl/redmine-2.3.2-0/apache2/htdocs' - cookie_domain: ".trustie.net" + # CJK support rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf email_delivery: delivery_method: :smtp @@ -224,9 +218,9 @@ development: email_delivery: delivery_method: :smtp smtp_settings: - address: smtp.163.com + address: mail.trustie.net port: 25 - domain: smtp.163.com + domain: mail.trustie.net authentication: :login - user_name: "huang.jingquan@163.com" - password: "xinhu1ji2qu366" + user_name: "mail@trustie.net" + password: "loong2010" diff --git a/config/locales/mailers/zh.yml b/config/locales/mailers/zh.yml index fea392421..c2dd5c7e0 100644 --- a/config/locales/mailers/zh.yml +++ b/config/locales/mailers/zh.yml @@ -25,4 +25,6 @@ zh: mail_course_homework_active: "中发布了作业" mail_attention: "请您关注!" mail_homework_endtime: "作业截止时间快到了!" - mail_homework: "作业:" \ No newline at end of file + mail_homework: "作业:" + mail_anonymous_comment_close: "作业匿评已经关闭!" + mail_anonymous_comment_open: "作业匿评已经开启!" \ No newline at end of file diff --git a/db/migrate/20150918134804_add_secret_key_to_forge_message.rb b/db/migrate/20150918134804_add_secret_key_to_forge_message.rb new file mode 100644 index 000000000..1de5a8ae9 --- /dev/null +++ b/db/migrate/20150918134804_add_secret_key_to_forge_message.rb @@ -0,0 +1,5 @@ +class AddSecretKeyToForgeMessage < ActiveRecord::Migration + def change + add_column :forge_messages, :secret_key, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index d0c60e724..43357f44f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # 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| 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", ["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| @@ -686,7 +683,6 @@ ActiveRecord::Schema.define(:version => 20150917081214) do t.integer "user_id" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false - t.string "mail" end 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| t.integer "student_work_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "status", :default => 9 + t.integer "status" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.text "results" t.text "src" end @@ -1329,7 +1325,7 @@ ActiveRecord::Schema.define(:version => 20150917081214) 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 @@ -1363,10 +1359,8 @@ ActiveRecord::Schema.define(:version => 20150917081214) do create_table "system_messages", :force => true do |t| t.integer "user_id" t.string "content" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.text "description" - t.string "subject" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "taggings", :force => true do |t| @@ -1558,6 +1552,7 @@ ActiveRecord::Schema.define(:version => 20150917081214) do t.string "identity_url" t.string "mail_notification", :default => "", :null => false t.string "salt", :limit => 64 + t.integer "gid" end add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js index 0499ac5fb..3589a0728 100644 --- a/public/javascripts/homework.js +++ b/public/javascripts/homework.js @@ -124,7 +124,7 @@ $(function(){ $('#textarea_input_test').focus(); }); - $("#BluePopupBox a.BlueCirBtn").live('click', function(){ + var saveProgramAnswers = function() { var test_numbers = 0; var valid = true; var input = null; @@ -159,6 +159,12 @@ $(function(){ $('.program-input').remove(); var html=bt('t:program-input-list',data); $("input[name=homework_type]").after(html); + } + return valid; + } + + $("#BluePopupBox a.BlueCirBtn").live('click', function(){ + if(saveProgramAnswers()){ if($( "#BluePopupBox" ).dialog( "isOpen" )){ $("#BluePopupBox").dialog( "close" ); } @@ -180,4 +186,4 @@ $(function(){ $("#BluePopupBox").on('click', 'a.icon_remove', function(){ $(this).parent('.mt10').remove(); }); -}); \ No newline at end of file +}); diff --git a/public/javascripts/init_activity_KindEditor.js b/public/javascripts/init_activity_KindEditor.js index b73ff10d3..866d0ea41 100644 --- a/public/javascripts/init_activity_KindEditor.js +++ b/public/javascripts/init_activity_KindEditor.js @@ -1,10 +1,7 @@ -/** - * Created by Alan on 2015/9/18. - */ function init_editor(params){ // var minHeight; //最小高度 - var id = arguments[1] ? arguments[1] : undefined; var paramsHeight = params.height; //设定的高度 + var id = arguments[1] ? arguments[1] : undefined; var paramsWidth = params.width == undefined ? "100%" : params.width; var editor = params.kindutil.create(params.textarea, { @@ -13,19 +10,42 @@ function init_editor(params){ minHeight:"30px",// == undefined ? "30px":paramsHeight+"px", items:['emoticons'], afterChange:function(){//按键事件 - nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); + var edit = this.edit; var body = edit.doc.body; edit.iframe.height(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('我要回复'); + } + //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(){ params.submit_btn.css("display","none"); var toolbar = $("div[class='ke-toolbar']",params.div_form); toolbar.css('width',24); $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情'); params.toolbar_container.append(toolbar); - params.toolbar_container.style.display = 'none'; //init var edit = this.edit; var body = edit.doc.body; @@ -36,20 +56,10 @@ function init_editor(params){ var body = edit.doc.body; paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight; edit.iframe.height(paramsHeight); + edit.html('我要回复'); 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'); return editor; @@ -64,7 +74,7 @@ function nh_check_field(params){ if(params.content.html()!=params.textarea.html() || params.issubmit==true){ params.textarea.html(params.content.html()); 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.css({color:'#ff0000'}); }else{ @@ -128,7 +138,7 @@ function init_activity_KindEditor_data(id){ params.height = height; params.width = width; if (params.textarea.data('init') == undefined) { - params.editor = init_editor(params, id); + params.editor = init_editor(params,id); init_form(params); params.cancel_btn.click(function () { nh_reset_form(params); @@ -141,4 +151,4 @@ function init_activity_KindEditor_data(id){ } }); }); -} +} \ No newline at end of file diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index eaff43533..144589d5b 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -568,6 +568,7 @@ a.postTypeGrey:hover {color:#269ac9;} .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;} .borderBottomNone {border-bottom:none !important;} +div.minHeight48{min-height: 48px;} .homepagePostReplyBannerCount{width:255px; display:inline-block; margin-left:20px;} .homepagePostReplyBannerTime{width:85px; display:inline-block;} .homepagePostReplyBannerMore{width:330px; display:inline-block; text-align:right;} @@ -583,7 +584,7 @@ a.postReplyCancel {color:#888888; display:block;} a.postReplyCancel:hover {color:#ffffff;} .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;} -.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 ul li:hover ul {display:block;} .homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;}