diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 41d302829..00d814bd3 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -5,9 +5,9 @@ class HomeworkCommonController < ApplicationController layout "base_courses" include StudentWorkHelper - before_filter :find_course, :only => [:index,:new,:create,:next_step] - before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy] - before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment] + before_filter :find_course, :only => [:index,:new,:create] + before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr] + before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr] before_filter :member_of_course, :only => [:index] def index @@ -23,116 +23,11 @@ class HomeworkCommonController < ApplicationController #新建作业,在个人作业列表创建作业 def new render_404 - # @homework_type = "1" - # - # @homework = HomeworkCommon.new - # @homework.safe_attributes = params[:homework_common] - # @homework.late_penalty = 2 - # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - # @homework.publish_time = Time.now.strftime('%Y-%m-%d') - # - # if @homework_type == "1" - # #匿评作业相关属性 - # @homework_detail_manual = HomeworkDetailManual.new - # @homework_detail_manual.ta_proportion = 0.6 - # @homework_detail_manual.absence_penalty = 2 - # @homework_detail_manual.evaluation_num = 3 - # @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') - # @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - # @homework.homework_detail_manual = @homework_detail_manual - # elsif @homework_type == "2" - # #编程作业相关属性 - # @homework_detail_programing = HomeworkDetailPrograming.new - # @homework.homework_detail_programing = @homework_detail_programing - # end - # respond_to do |format| - # format.html - # end end #新建作业,在个人作业列表创建作业 def create redirect_to user_homeworks_user_path(User.current.id) - # if params[:homework_common] - # homework = HomeworkCommon.new - # homework.name = params[:homework_common][:name] - # homework.description = params[:homework_common][:description] - # homework.end_time = params[:homework_common][:end_time] - # homework.publish_time = params[:homework_common][:publish_time] - # homework.homework_type = params[:homework_common][:homework_type] - # homework.late_penalty = params[:late_penalty] - # homework.user_id = User.current.id - # homework.course_id = @course.id - # - # homework.save_attachments(params[:attachments]) - # render_attachment_warning_if_needed(homework) - # - # if homework.homework_type == 2 - # homework_detail_programing = HomeworkDetailPrograming.new - # homework_detail_programing.language = params[:language] - # homework_detail_programing.standard_code = params[:standard_code] - # homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6 - # question = {title:homework.name,content:homework.description} - # question[:input] = [] - # question[:output] = [] - # if params[:input] && params[:output] && params[:result] - # params[:input].each do |k,v| - # if params[:output].include? k - # homework_test = HomeworkTest.new - # homework_test.input = v - # homework_test.output = params[:output][k] - # homework_test.result = params[:result][k] - # homework_test.error_msg = params[:error_msg] - # homework.homework_tests << homework_test - # question[:input] << homework_test.input - # question[:output] << homework_test.output - # end - # end - # end - # - # # uri = URI('http://192.168.80.21:8080/api/questions.json') - # # body = question.to_json - # # res = Net::HTTP.new(uri.host, uri.port).start do |client| - # # request = Net::HTTP::Post.new(uri.path) - # # request.body = body - # # request["Content-Type"] = "application/json" - # # client.request(request) - # # end - # # result = JSON.parse(res.body) - # # homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0 - # - # homework.homework_detail_programing = homework_detail_programing - # else - # #匿评作业相关属性 - # homework_detail_manual = HomeworkDetailManual.new - # homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 - # homework_detail_manual.comment_status = 1 - # homework_detail_manual.evaluation_start = params[:evaluation_start] - # homework_detail_manual.evaluation_end = params[:evaluation_end] - # homework_detail_manual.evaluation_num = params[:evaluation_num] - # homework_detail_manual.absence_penalty = params[:absence_penalty] - # homework.homework_detail_manual = homework_detail_manual - # end - # - # if homework.save - # homework_detail_programing.save if homework_detail_programing - # homework_detail_manual.save if homework_detail_manual - # respond_to do |format| - # format.html { - # flash[:notice] = l(:notice_successful_create) - # redirect_to homework_common_index_path(:course => @course.id) - # } - # end - # return - # end - # end - # - # respond_to do |format| - # format.html { - # flash[:notice] = l(:notice_failed_create) - # redirect_to new_homework_common_path(:course => @course.id) - # } - # end end def edit @@ -294,6 +189,27 @@ class HomeworkCommonController < ApplicationController end end + #启动匿评参数设置 + def start_evaluation_set + + end + + #设置匿评参数 + def set_evaluation_attr + if @homework_detail_manual + unless params[:evaluation_start].to_s == @homework_detail_manual.evaluation_start.to_s + @homework_detail_manual.evaluation_start = params[:evaluation_start] + end + + unless @homework_detail_manual.evaluation_end.to_s == params[:evaluation_end].to_s + @homework_detail_manual.evaluation_end = params[:evaluation_end] + end + + @homework_detail_manual.evaluation_num = params[:evaluation_num] + @homework_detail_manual.save + end + end + private #获取课程 def find_course diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index bf854abe8..2232602aa 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -223,7 +223,6 @@ class IssuesController < ApplicationController end if saved - #修改界面增加跟踪者 watcherlist = @issue.watcher_users select_users = [] @@ -253,9 +252,7 @@ class IssuesController < ApplicationController JournalReply.add_reply(@issue.current_journal.id, reply_id, User.current.id) end flash[:notice] = l(:notice_successful_update) unless @issue.current_journal.new_record? - respond_to do |format| - format.html { redirect_to issue_url(@issue.id) } format.api { render_api_ok } end diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index 6cebfef7a..769e62209 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -36,8 +36,7 @@ class JournalsController < ApplicationController sort_update(@query.sortable_columns) if @query.valid? - @journals = @query.journals(:order => "#{Journal.table_name}.created_on DESC", - :limit => 25) + @journals = @query.journals(:order => "#{Journal.table_name}.created_on DESC", :limit => 25) end @title = (@project ? @project.name : Setting.app_title) + ": " + (@query.new_record? ? l(:label_changes_details) : @query.name) render :layout => false, :content_type => 'application/atom+xml' @@ -72,9 +71,9 @@ class JournalsController < ApplicationController end # Replaces pre blocks with [...] text = text.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]') - @content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> " - @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" - # @content = "
" << @content + @content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n" + @content << text.gsub(/(\r?\n|\r\n?)/, "\n ") + "\n" + @content = "
" << @content << "
" @id = user.id rescue ActiveRecord::RecordNotFound render_404 diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 4d80efdf3..414ef6d70 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -162,7 +162,7 @@ class ProjectsController < ApplicationController @trackers = Tracker.sorted.all @project = Project.new @project.safe_attributes = params[:project] - render :layout => 'base' + render :layout => 'new_base' else redirect_to signin_url end @@ -188,7 +188,7 @@ class ProjectsController < ApplicationController @project.safe_attributes = params[:project] @project.organization_id = params[:organization_id] @project.user_id = User.current.id - @project.project_new_type = 1 + @project.project_new_type = params[:project_new_type] if validate_parent_id && @project.save @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') # Add current user as a project member if he is not admin @@ -220,7 +220,7 @@ class ProjectsController < ApplicationController end else respond_to do |format| - format.html { render :action => 'new', :layout => 'base'}#Added by young + format.html { render :action => 'new', :layout => 'new_base'}#Added by young format.api { render_validation_errors(@project) } end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 76643a099..35860c728 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -101,33 +101,12 @@ class UsersController < ApplicationController elsif @user != User.current && !User.current.admin? return render_403 end - # 记录当前点击按钮的时间 - # 考虑到用户未退出刷新消息页面 - message_time = OnclickTime.where("user_id =?", User.current).first - if message_time.nil? - message_new_time = OnclickTime.new - message_new_time.user_id = User.current.id - message_new_time.onclick_time = Time.now - message_new_time.save - else - # 24小时内显示 - contrast_time = Time.now - 86400 - message_time.update_attributes(:onclick_time => Time.now) - end - @user_system_messages = SystemMessage.where("created_at >?", contrast_time).order("created_at desc") - # 当前用户查看消息,则设置消息为已读 - # DO 待优化,只需查出符合条件的再更新 + # 初始化/更新 点击按钮时间 + # 24小时内显示系统消息 + update_onclick_time + # 全部设为已读 if params[:viewed] == "all" - course_querys = @user.course_messages - forge_querys = @user.forge_messages - user_querys = @user.user_feedback_messages - forum_querys = @user.memo_messages - if User.current.id == @user.id - course_querys.update_all(:viewed => true) - forge_querys.update_all(:viewed => true) - user_querys.update_all(:viewed => true) - forum_querys.update_all(:viewed => true) - end + update_message_viewed(@user) end # @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count case params[:type] @@ -197,6 +176,39 @@ class UsersController < ApplicationController end end + # 初始化/更新 点击按钮时间 + def update_onclick_time + # 记录当前点击按钮的时间 + # 考虑到用户未退出刷新消息页面 + message_time = OnclickTime.where("user_id =?", User.current).first + if message_time.nil? + message_new_time = OnclickTime.new + message_new_time.user_id = User.current.id + message_new_time.onclick_time = Time.now + message_new_time.save + else + # 24小时内显示 + contrast_time = Time.now - 86400 + message_time.update_attributes(:onclick_time => Time.now) + end + # 24小时内显示系统消息 + @user_system_messages = SystemMessage.where("created_at >?", contrast_time).order("created_at desc") + end + + # 消息设置为已读 + def update_message_viewed(user) + course_querys = CourseMessage.where("user_id =? and viewed =?", user, 0) + forge_querys = ForgeMessage.where("user_id =? and viewed =?", user, 0) + user_querys = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0) + forum_querys = MemoMessage.where("user_id =? and viewed =?", user, 0) + if User.current.id == @user.id + course_querys.update_all(:viewed => true) + forge_querys.update_all(:viewed => true) + user_querys.update_all(:viewed => true) + forum_querys.update_all(:viewed => true) + end + end + # 系统消息 def user_system_messages @sytem_messages = SystemMessage.order("created_at desc").all diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d7fac9a7d..e100a8fc9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2306,7 +2306,7 @@ module ApplicationHelper when 2 link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink' when 3 - link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束" + # link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束" end else link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "学生提交作业数大于2时才可以启动匿评" diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 6a865b203..41f25d1a3 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -76,6 +76,36 @@ module ProjectsHelper return result end + # 项目类型 + def project_type_select + type = [] + option1 = [] + option1 << l(:label_development_team) + option1 << l(:label_development_team) + option2 = [] + option2 << l(:label_research_group) + option2 << l(:label_research_group) + option3 = [] + option3 << l(:label_friend_organization) + option3 << l(:label_friend_organization) + type << option1 + type << option2 + type << option3 + type + end + + # 项目类型描述 + def project_newtype_descrption + case params + when 1 + value = l(:label_type_des_development) + when 2 + value = l(:label_type_des_research) + when 3 + value = l(:label_type_des_friend) + end + end + # 被邀请成员的状态 def status_for_ivitied(ivite_list, project) if ivite_list.user.member_of?(project) diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 15eebc15e..b1020d938 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -463,7 +463,7 @@ module UsersHelper def get_issue_des_update(journal) no_html = "message" arr = details_to_strings(journal.details, no_html) - unless journal.notes.empty? + unless journal.notes.blank? arr << "留言内容:" + journal.notes end str = '' diff --git a/app/models/journal.rb b/app/models/journal.rb index 0d86d12ff..9ffc5d405 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -171,11 +171,16 @@ class Journal < ActiveRecord::Base # 缺陷状态更改,消息提醒 def act_as_forge_message + receivers = [] + # 直接回复 if self.user_id != self.issue.author_id - self.forge_messages << ForgeMessage.new(:user_id => self.issue.author_id, :project_id => self.issue.project_id, :viewed => false) + receivers << self.issue.author_id end if self.user_id != self.issue.assigned_to_id && self.issue.assigned_to_id != self.issue.author_id # 指派人不是自己的话,则给指派人发送 - self.forge_messages << ForgeMessage.new(:user_id => self.issue.assigned_to_id, :project_id => self.issue.project_id, :viewed => false) + receivers << self.issue.assigned_to_id + end + receivers.each do |r| + self.forge_messages << ForgeMessage.new(:user_id => r, :project_id => self.issue.project_id, :viewed => false) end end diff --git a/app/models/journal_reply.rb b/app/models/journal_reply.rb index 814231776..a1ea761af 100644 --- a/app/models/journal_reply.rb +++ b/app/models/journal_reply.rb @@ -5,8 +5,34 @@ class JournalReply < ActiveRecord::Base belongs_to :user belongs_to :journal + after_create :send_journal_messages def self.add_reply(journal_id, reply_id, user_id) self.create(:journal_id => journal_id, :reply_id => reply_id, :user_id => user_id) end + + def send_journal_messages + journal = self.journal + replier = User.find(self.reply_id) + receivers = [] + # 被回复的人发送消息 + if journal.user_id != self.reply_id && self.reply_id != journal.issue.author_id + receivers << replier + end + if journal.user_id != journal.issue.author_id && self.reply_id != journal.issue.author_id + receivers << self.journal.issue.author + end + # journal_forge_messages = ForgeMessage.new + receivers.each do |r| + journal.forge_messages << ForgeMessage.new(:user_id =>r.id, :project_id => journal.issue.project_id, :viewed => false) + end + + # if self.user_id != self.journal_reply.user_id + # receivers << self.journal_reply.user_id + # end + # # 给缺陷发布者发送 + # if self.user_id != self.issue.author_id && self.journal_reply.user_id != self.issue.author_id + # receivers << self.issue.author_id + # end + end end diff --git a/app/models/user.rb b/app/models/user.rb index 48b269e6e..0ed8aeda0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -264,6 +264,7 @@ class User < Principal if OnclickTime.where("user_id =?", User.current).first.nil? message_new_time = OnclickTime.new message_new_time.user_id = User.current.id + # 第一次初始化点击铃铛时间 message_new_time.onclick_time = User.current.last_login_on.nil? ? Time.now : User.current.last_login_on message_new_time.save end diff --git a/app/views/homework_common/_set_evalutation_att.html.erb b/app/views/homework_common/_set_evalutation_att.html.erb new file mode 100644 index 000000000..01d9351ee --- /dev/null +++ b/app/views/homework_common/_set_evalutation_att.html.erb @@ -0,0 +1,53 @@ +
+ <%= form_for('new_form',:url => {:controller => 'homework_common',:action => 'set_evaluation_attr',:homework => @homework.id},:method => "post",:remote => true) do |f|%> + 匿评设置 +
+ +
+ 开启匿评 +
+ + <%= calendar_for('evaluation_start_time')%> +
+
+

+
+
+ +
+ 关闭匿评 +
+ + <%= calendar_for('evaluation_end_time')%> +
+
+

+
+
+ +
+ 匿评人数 + +
+

+
+
+ +
+ 禁用匿评 + + 禁用后将无法进行学生互评 +
+
+ +
+
+ 确定 +
+
+ 取消 +
+
+
+ <% end%> +
\ No newline at end of file diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index 4bf3d1781..8799bcab9 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -25,9 +25,9 @@ ( <%= link_to homework.student_works.count, student_work_index_path(:homework => homework.id), :class => 'c_red'%> )

<% if @is_teacher%> - <%= homework_anonymous_comment(homework)%> <%= 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") %> + <%= link_to(l(:button_edit),edit_homework_common_path(homework,:is_in_course => 1), :class => "fr mr10 work_edit ml10") %> + <%= homework_anonymous_comment(homework)%> <% elsif @is_student%> <%= student_anonymous_comment homework %> <%= student_new_homework homework %> diff --git a/app/views/homework_common/set_evaluation_attr.js.erb b/app/views/homework_common/set_evaluation_attr.js.erb new file mode 100644 index 000000000..d6ab73df5 --- /dev/null +++ b/app/views/homework_common/set_evaluation_attr.js.erb @@ -0,0 +1 @@ +clickCanel(); \ No newline at end of file diff --git a/app/views/homework_common/start_evaluation_set.js.erb b/app/views/homework_common/start_evaluation_set.js.erb new file mode 100644 index 000000000..9d494f908 --- /dev/null +++ b/app/views/homework_common/start_evaluation_set.js.erb @@ -0,0 +1,6 @@ +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_common/set_evalutation_att') %>'); +showModal('ajax-modal', '350px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + +""); +$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed"); \ No newline at end of file diff --git a/app/views/homework_common/stop_anonymous_comment.js.erb b/app/views/homework_common/stop_anonymous_comment.js.erb index 3cbac1bf6..4725d5731 100644 --- a/app/views/homework_common/stop_anonymous_comment.js.erb +++ b/app/views/homework_common/stop_anonymous_comment.js.erb @@ -1,2 +1,2 @@ -$("#<%= @homework.id %>_stop_anonymous_comment").replaceWith('匿评结束'); +$("#<%= @homework.id %>_stop_anonymous_comment").replaceWith(''); alert('关闭成功'); \ No newline at end of file diff --git a/app/views/issues/_attributes.html.erb b/app/views/issues/_attributes.html.erb index 68bd9f82c..54cb85212 100644 --- a/app/views/issues/_attributes.html.erb +++ b/app/views/issues/_attributes.html.erb @@ -6,12 +6,11 @@
  • <% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %> - <%= f.select :status_id, - (@allowed_statuses.collect { |p| [p.name, p.id] }), - {:no_label => true}, - # ajax 刷新 - #:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')", - :class => "w150" %> + <%= f.select :status_id, (@allowed_statuses.collect { |p| [p.name, p.id] }), + {:no_label => true}, + # ajax 刷新 + #:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')", + :class => "w150" %> <% else %> <%= h(@issue.status.name) %> <% end %> @@ -20,10 +19,9 @@
  • <% if @issue.safe_attribute? 'priority_id' %> - <%= f.select :priority_id, - (@priorities.collect { |p| [p.name, p.id] }), - {:required => true, :no_label => true}, :disabled => !@issue.leaf?, - :class => "w150" %> + <%= f.select :priority_id, (@priorities.collect { |p| [p.name, p.id] }), + {:required => true, :no_label => true}, :disabled => !@issue.leaf?, + :class => "w150" %> <% end %>
  • @@ -32,8 +30,8 @@ <% if @issue.safe_attribute? 'assigned_to_id' %> <%= f.select :assigned_to_id, principals_options_for_select(@issue.assignable_users, @issue.assigned_to), - {:required => @issue.required_attribute?('assigned_to_id'), :no_label => true}, - :class => "w150" %> + {:required => @issue.required_attribute?('assigned_to_id'), :no_label => true}, + :class => "w150" %> <% end %>
    @@ -41,8 +39,8 @@ <% if @issue.safe_attribute?('fixed_version_id') && @issue.assignable_versions.any? %> <%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), - {:include_blank => true, :required => @issue.required_attribute?('fixed_version_id'), :no_label => true}, - :class => "w150" %> + {:include_blank => true, :required => @issue.required_attribute?('fixed_version_id'), :no_label => true}, + :class => "w150" %> <%#= link_to(image_tag('add.png', :style => 'vertical-align: middle;'), new_project_version_path(@issue.project), :remote => true, @@ -60,11 +58,7 @@
  • <% if @issue.safe_attribute? 'start_date' %> - <%= f.text_field :start_date, - :size => 22, - :disabled => !@issue.leaf?, - :no_label => true, - :required => @issue.required_attribute?('start_date') %> + <%= f.text_field :start_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true, :required => @issue.required_attribute?('start_date') %> <%= calendar_for('issue_start_date', 'start_date') if @issue.leaf? %> <% end %>
  • @@ -72,10 +66,7 @@
  • <% if @issue.safe_attribute? 'due_date' %> - <%= f.text_field :due_date, :size => 22, - :disabled => !@issue.leaf?, - :no_label => true, - :required => @issue.required_attribute?('due_date') %> + <%= f.text_field :due_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true, :required => @issue.required_attribute?('due_date') %> <%= calendar_for('issue_due_date', 'start_date') if @issue.leaf? %> <% end %>
  • @@ -83,10 +74,7 @@
  • <% if @issue.safe_attribute? 'estimated_hours' %> - <%= f.text_field :estimated_hours, :size => 22, - :disabled => !@issue.leaf?, - :no_label => true, - :required => @issue.required_attribute?('estimated_hours') %> + <%= f.text_field :estimated_hours, :size => 22, :disabled => !@issue.leaf?, :no_label => true, :required => @issue.required_attribute?('estimated_hours') %> <%= l(:field_hours) %> <% end %>
  • @@ -94,9 +82,9 @@
  • <% if @issue.safe_attribute?('done_ratio') && @issue.leaf? && Issue.use_field_for_done_ratio? %> <%= f.select :done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }), - {:required => @issue.required_attribute?('done_ratio'), :no_label => true}, - :onchange => "PrecentChange(this.value)", - :class => "w150" %> + {:required => @issue.required_attribute?('done_ratio'), :no_label => true}, + :onchange => "PrecentChange(this.value)", + :class => "w150" %> <% end %>
  • diff --git a/app/views/issues/_attributes_show.html.erb b/app/views/issues/_attributes_show.html.erb new file mode 100644 index 000000000..7b9e2bedf --- /dev/null +++ b/app/views/issues/_attributes_show.html.erb @@ -0,0 +1,52 @@ + +
    + <%= issue_fields_rows do |rows| %> + + + + + <% end %> + <%#= render_custom_fields_rows(@issue) %> + <%#= call_hook(:view_issues_show_details_bottom, :issue => @issue) %> +
    + \ No newline at end of file diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index 1f3f984b4..c6b805d0a 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -6,21 +6,17 @@ - <% end %> - - <% if @journals.present? %>
    <%= render :partial => 'history', :locals => {:issue => @issue, :journals => @journals} %>
    <% end %> -
    +
    + +
    回复 <%= f.text_area :notes, :style => "width:99%;", :rows => "5", :no_label => true %> diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb index 41fca87eb..0d5c876f1 100644 --- a/app/views/issues/_form.html.erb +++ b/app/views/issues/_form.html.erb @@ -28,11 +28,7 @@
  • <% if @issue.safe_attribute? 'subject' %> - <%= f.text_field :subject, - :class => "w576", - :maxlength => 255, - :style => "font-size:small", - :no_label => true %> + <%= f.text_field :subject, :class => "w576", :maxlength => 255, :style => "font-size:small", :no_label => true %> <%= javascript_tag do %> observeAutocompleteField('issue_subject', @@ -53,13 +49,7 @@ <%= f.label_for_field :description, :required => @issue.required_attribute?('description'), :no_label => true, :class => "label" %> <%#= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %> <%#= content_tag 'span', :id => "issue_description_and_toolbar" do %> - <%= f.kindeditor :description,:editor_id => "issue_desc_editor", - # :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min), - # :accesskey => accesskey(:edit), - # :class => "w583", - :width=>'87%', - :resizeType => 0, - :no_label => true %> + <%= f.kindeditor :description,:editor_id => "issue_desc_editor", :width=>'87%', :resizeType => 0, :no_label => true %> <%# end %> <%#= wikitoolbar_for 'issue_description' %> <% end %> @@ -68,13 +58,13 @@
  • - <% if @copy_from && @copy_from.attachments.any? %> -

    + <%# if @copy_from && @copy_from.attachments.any? %> + -

    - <% end %> + + <%# end %> <% if @copy_from && !@copy_from.leaf? %>

    diff --git a/app/views/issues/_form_custom_fields.html.erb b/app/views/issues/_form_custom_fields.html.erb index 4da98eb13..c97244902 100644 --- a/app/views/issues/_form_custom_fields.html.erb +++ b/app/views/issues/_form_custom_fields.html.erb @@ -1,13 +1,13 @@

    -
    -<% i = 0 %> -<% split_on = (@issue.custom_field_values.size / 2.0).ceil - 1 %> -<% @issue.editable_custom_field_values.each do |value| %> -

    <%= custom_field_tag_with_label :issue, value, :required => @issue.required_attribute?(value.custom_field_id) %>

    -<% if i == split_on -%> -
    -<% end -%> -<% i += 1 -%> -<% end -%> -
    +
    + <% i = 0 %> + <% split_on = (@issue.custom_field_values.size / 2.0).ceil - 1 %> + <% @issue.editable_custom_field_values.each do |value| %> +

    <%= custom_field_tag_with_label :issue, value, :required => @issue.required_attribute?(value.custom_field_id) %>

    + <% if i == split_on -%> +
    + <% end -%> + <% i += 1 -%> + <% end -%> +
    diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 41605a826..2b706be7f 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -1,4 +1,4 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor", '/assets/kindeditor/pasteimg' %> +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>

    <%= l(:label_issue_edit) %>

    @@ -12,6 +12,7 @@
    <%= link_to image_tag(url_to_avatar(@issue.author), :width => 46, :height => 46), user_path(@issue.author), :class => "ping_dispic" %>
    +

    @@ -20,32 +21,59 @@


    -

    <%= @issue.author %> - <%# if @issue.created_on != @issue.updated_on %> - 添加于 <%= format_time(@issue.created_on).html_safe %> - <%# else %> - <%#= format_time(@issue.updated_on).html_safe %> - <%# end %> + 由<%= @issue.author %>添加于 <%= format_time(@issue.created_on).html_safe %>

    + 'action_menu' %>
    -
    - <% if @issue.description? || @issue.attachments.any? -%> + <% if @issue.description? || @issue.attachments.any? -%> +
    <% if @issue.description? %> <%#= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'icon icon-comment' if authorize_for('issues', 'edit') %> <%= textAreailizable @issue, :description, :attachments => @issue.attachments %> <% end %> -
    +
    + <% end -%> +
    <%= link_to_attachment_project @issue, :thumbnails => true %>
    - <% end -%> <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> -
    -
    - + +
    + + +<<<<<<< .mine + <%= render :partial => 'attributes_show' %> + + + + + + + + + + + + + + + + + + + + + + + + + + +=======
    <%= issue_fields_rows do |rows| %>
      @@ -73,7 +101,18 @@ <% end %>
    +>>>>>>> .theirs +<<<<<<< .mine + <%# 该应用是对issue主题内容的引用,对应:to => 'journals#new %> + + + + + + +
    +=======
      <% unless @issue.disabled_core_fields.include?('start_date') %>
    •  开始  : 

      @@ -82,6 +121,33 @@
    • <% end %>
      +>>>>>>> .theirs +<<<<<<< .mine + + + + + + + + + + + + + + + + + + + + + + + + +======= <% unless @issue.disabled_core_fields.include?('estimated_hours') %>
    •  周期  : 

      <%= l_hours(@issue.estimated_hours) %> @@ -106,28 +172,23 @@ <% end %> <%#= render_custom_fields_rows(@issue) %> <%#= call_hook(:view_issues_show_details_bottom, :issue => @issue) %> -
    - -
    - <%= link_to l(:button_quote), quoted_issue_path(@issue.id), :remote => true, :method => 'post', :class => 'talk_edit fr' if authorize_for('issues', 'edit') %> -
    - +>>>>>>> .theirs + +
    + <% if @issue.editable? %>
    <%= render :partial => 'edit' %>

    - - - + <%#--引用时不能修改,剥离出引用内容--%> <%= l(:button_submit) %> <% end %> - <%#= submit_tag l(:button_submit) %> <%#= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue), 'issue-form' ,'preview',{:class => "blue_btn fr mr10"}%> @@ -138,6 +199,7 @@ <%= render :partial => 'changesets', :locals => {:changesets => @changesets} %> <% end %> +
    <% other_formats_links do |f| %> <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> diff --git a/app/views/journals/new.js.erb b/app/views/journals/new.js.erb index ae2574595..b24b5ffb6 100644 --- a/app/views/journals/new.js.erb +++ b/app/views/journals/new.js.erb @@ -1,10 +1,11 @@ $('#issue_notes').val("<%= raw escape_javascript(@content) %>"); <% # when quoting a private journal, check the private checkbox - if @journal && @journal.private_notes? + if @journal && @journal.private_notes? %> $('#issue_private_notes').attr('checked', true); <% end %> +//quote_issue_journal() showAndScrollTo("update", "notes"); $('#notes').scrollTop = $('#notes').scrollHeight - $('#notes').clientHeight; diff --git a/app/views/layouts/_base_feedback.html.erb b/app/views/layouts/_base_feedback.html.erb index 07f852914..9fe25ce95 100644 --- a/app/views/layouts/_base_feedback.html.erb +++ b/app/views/layouts/_base_feedback.html.erb @@ -1,9 +1,9 @@ @@ -39,7 +39,7 @@ minStatue : true, skin : 'blue', durationTime : 1000 - } + }; var options = $.extend(defaults, options); this.each(function(){ @@ -56,13 +56,13 @@ if(options.minStatue == "true"){ $(".show_btn").css("float", options.float); sideContent.css('width', 0); - show_btn.css('width', 25); + show_btn.css('width', 29); } //close closeBtn.bind("click",function(){ sideContent.animate({width: '0px'},"fast"); - show_btn.stop(true, true).delay(300).animate({ width: '25px'},"fast"); + show_btn.stop(true, true).delay(300).animate({ width: '29px'},"fast"); cookiesave('minStatue','true','','',''); }); //show @@ -83,14 +83,10 @@ $(function(){ $("#button1").click(function(){ myTips("<%= l(:label_feedback_success) %>","success"); }); - }); function f_submit() { -// var subject = $("#memo_subject").val(); -// var content = $("#memo_content_1").val(); -// $("#memo_subject").val(subject+":"+ content.substr(0,18)+"..."); $("#new_memo").submit(); } @@ -169,15 +165,15 @@ function cookieget(n)
    <% get_memo %> - <% if @public_forum %> - <%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %> - <%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %> - <%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %> - <%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %> - - <%= l(:label_submit)%> - <% end %> - <% end %> + <% if @public_forum %> + <%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %> + <%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %> + <%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %> + <%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %> + + <%= l(:label_submit)%> + <% end %> + <% end %>
    -
    <%= l(:label_submit)%>
    +
    diff --git a/app/views/layouts/_new_feedback.html.erb b/app/views/layouts/_new_feedback.html.erb index db0a3c3ee..136e49b37 100644 --- a/app/views/layouts/_new_feedback.html.erb +++ b/app/views/layouts/_new_feedback.html.erb @@ -30,6 +30,7 @@
    - 在线客服 + <%= l(:label_submit)%> +
    diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index b7b88c186..c9bc68c33 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -170,9 +170,9 @@

    请选择项目类型:

      -
    • id="development_group"/>
    • -
    • id="research_group"/>
    • -
    • id="friend_organization"/>
    • +
    • id="development_group"/>
    • +
    • id="research_group"/>
    • +
    • id="friend_organization"/>
    确定
    diff --git a/app/views/mailer/applied_project.html.erb b/app/views/mailer/applied_project.html.erb index 4f266e6ce..eb49c35b9 100644 --- a/app/views/mailer/applied_project.html.erb +++ b/app/views/mailer/applied_project.html.erb @@ -1,5 +1,11 @@ -<%= l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name) %> -
    - -

    <%= link_to(h(@project.name), @applied_url) %>

    +
    +
      +
    • <%= l(:mail_issue_content)%> + +

      <%=link_to @user.show_name, user_url(@user) %> 申请加入项目:<%=link_to @project.name, @applied_url %>

      +
      +
    • +
    +
    +
    diff --git a/app/views/mailer/applied_project.text.erb b/app/views/mailer/applied_project.text.erb index 7af8c2018..0dd3f308d 100644 --- a/app/views/mailer/applied_project.text.erb +++ b/app/views/mailer/applied_project.text.erb @@ -1,4 +1,7 @@ -<%= l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name) %> +<%= l(:mail_issue_content)%> +<%=link_to @user.show_name, user_url(@user) %> +<%=link_to @project.name, @applied_url %> + + -

    <%= link_to(h(@project.name), @applied_url) %>

    diff --git a/app/views/projects/_form_new.html.erb b/app/views/projects/_form_new.html.erb new file mode 100644 index 000000000..c53c23d47 --- /dev/null +++ b/app/views/projects/_form_new.html.erb @@ -0,0 +1,28 @@ +<%# 这些代码删除也没什么影响,暂时放着,待优化 %> +<%= wikitoolbar_for 'project_description' %> + +<% @project.custom_field_values.each do |value| %> +

    + <%= custom_field_tag_with_label :project, value %> +

    +<% end %> +<%= call_hook(:view_projects_form, :project => @project, :form => f) %> +<% unless @project.identifier_frozen? %> + <% content_for :header_tags do %> + <%= javascript_include_tag 'project_identifier' %> + <% end %> +<% end %> + +<% if !User.current.admin? && @project.inherit_members? && @project.parent && User.current.member_of?(@project.parent) %> + <%= javascript_tag do %> + $(document).ready(function() { + $("#project_inherit_members").change(function(){ + if (!$(this).is(':checked')) { + if (!confirm("<%= escape_javascript(l(:text_own_membership_delete_confirmation)) %>")) { + $("#project_inherit_members").attr("checked", true); + } + } + }); + }); + <% end %> +<% end %> diff --git a/app/views/projects/new.html.erb b/app/views/projects/new.html.erb index 98612b733..e57afe0ad 100644 --- a/app/views/projects/new.html.erb +++ b/app/views/projects/new.html.erb @@ -1,23 +1,112 @@ <% @nav_dispaly_project_label = 1 @nav_dispaly_forum_label = 1 %> +<%= error_messages_for 'project' %> +
    +

    <%= l(:label_project_new)%>

    +
    +
    +
      + <%= labelled_form_for @project do |f| %> +
    • + + + + + +
    • +
      +
    • + + <%= select_tag :project_new_type, options_for_select([["开发模式", "1"], ["研讨模式", "2"], ["圈子模式", "3"]]) %> + 为团队提供系列在线开发工具! +
    • +
      +
    • + + +
      +
    • +
    • +

      + <%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH, + value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %> + <% unless @project.identifier_frozen? %> + + <%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> + <%= l(:text_project_identifier_info).html_safe %> + + <% end %>

      +
    • +
    • + + + (打钩为公开,不打钩则不公开,若不公开,仅项目成员可见该项目。) +
      +
    • +
    • +

      + <%= f.text_field :project_type, :value => 0 %> +

      +
    • +
    • + <%= render :partial => 'form_new', :locals => { :f => f } %> +
    • +
    • + 提交 + <%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%> +
      +
    • + <% end%> +
    +
    +
    -<%= labelled_form_for @project do |f| %> -
    - <%=l(:label_project_new)%> - - -
    -

    - <%=raw l(:label_project_new_description)%> -

    - <%= render :partial => 'form', :locals => { :f => f } %> - - <%= submit_tag l(:button_create), :class => "enterprise"%> - -
    - <%#= submit_tag l(:button_create_and_continue), :name => 'continue' %> - <%= javascript_tag "$('#project_name').focus();" %> -
    -<% end %> +<% html_title(l(:label_project_new)) -%> + + -<% html_title(l(:label_project_new)) -%> \ No newline at end of file diff --git a/app/views/projects/settings/_new_edit.html.erb b/app/views/projects/settings/_new_edit.html.erb index 8de9b8229..b38871a60 100644 --- a/app/views/projects/settings/_new_edit.html.erb +++ b/app/views/projects/settings/_new_edit.html.erb @@ -5,9 +5,8 @@ <%= render :partial=>"avatar/new_avatar_form",:locals=> {source:@project} %>
  • -
  • - + @@ -15,7 +14,7 @@
  • - +
  • @@ -24,11 +23,6 @@ >
    -
  • - - > -
    -
  • 保存 <% end %> diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb index bc9fe2e00..ff2420a1a 100644 --- a/app/views/student_work/_evaluation_un_work.html.erb +++ b/app/views/student_work/_evaluation_un_work.html.erb @@ -3,27 +3,29 @@
    • - <%= image_tag(url_to_avatar(student_work.user),width:"40", height: "40") %> -
    • -
    • - <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%> -
      - <%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%> -
      -
    • -
    • -
        -
      • - <%= student_work.user.show_name%> -
      • -
      • - <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> -
      • -
      + <%= link_to(image_tag(url_to_avatar(User.current),:width =>"40",:height => "40"),user_activities_path(User.current.id))%>
    • +
      +
    • + <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%> +
      + <%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%> +
      +
    • +
    • +
        +
      • + <%= student_work.user.show_name%> +
      • +
      • + <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> +
      • +
      +
    • +
  • -
  • +
  • <%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>  <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %> [迟交] diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index cd596e22b..89800b768 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -60,6 +60,9 @@
  • <%= 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") %>
  • +
  • + <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common),:class => "postOptionLink", :remote => true) if homework_common.homework_detail_manual.comment_status == 1%> +
  • <%= homework_anonymous_comment homework_common %>
  • diff --git a/app/views/users/user_homeworks.html.erb b/app/views/users/user_homeworks.html.erb index a169be166..a37709b69 100644 --- a/app/views/users/user_homeworks.html.erb +++ b/app/views/users/user_homeworks.html.erb @@ -7,10 +7,6 @@ homework_description_editor.html(""); $("#homework_editor").toggle(); } - - function checkAllBox(doc){ - - }
    作业
    diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index ac4572b5b..c7895efb7 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -118,17 +118,47 @@ <% if ma.course_message_type == "HomeworkCommon" && ma.status.nil? %>
    • <%=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" %>">发布了作业:
    • -
    • +
    • <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师", user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> + ">发布了作业于课程:<%= ma.course_message.course.name %> +
    • +
    • <%= 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))" %>
    • <%= time_tag(ma.created_at).html_safe %>
    • @@ -146,7 +176,39 @@ :onmouseout => "message_titile_hide($(this))" %>
    •    截止时间快到了!
    • <% else %> @@ -274,7 +336,13 @@ <% if ma.course_message_type == "StudentWorksScore" %> @@ -577,7 +664,14 @@ :onmouseout => "message_titile_hide($(this))" %>
    • <%= time_tag(ma.journals_for_message.created_on).html_safe %>
    • diff --git a/config/locales/commons/zh.yml b/config/locales/commons/zh.yml index 457d56dad..7cbb223c6 100644 --- a/config/locales/commons/zh.yml +++ b/config/locales/commons/zh.yml @@ -284,7 +284,8 @@ zh: label_tags_issue: "问题名称" label_tags_issue_description: 问题描述 - label_tags_project_name: "项目名称:" + label_tags_project_name: "项目名称:" + label_projects_new_name: "项目名称" label_tags_project_description: "项目描述" label_tags_user_mail: "用户邮箱:" diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 599b51c30..dbce93219 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -60,6 +60,10 @@ zh: label_friend_organization: 圈子模式 label_research_group: 研讨模式 label_development_team: 开发模式 + label_type_project: 项目类型 + label_type_des_development: 开发模式:面向小组开发,支持问题跟踪、代码托管、论坛交流等所有功能。 + label_type_des_research: 研讨模式:面向小组研究,支持任务分工、论坛交流、资源分享等。 + label_type_des_friend: 圈子模式:面向好友分享,支持论坛交流、资源分享等。 label_member: 成员 project_module_attachments: 资源 diff --git a/config/routes.rb b/config/routes.rb index 409a04b20..ba6d161c2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -101,6 +101,8 @@ RedmineApp::Application.routes.draw do get 'start_anonymous_comment' get 'stop_anonymous_comment' get 'alert_anonymous_comment' + get 'start_evaluation_set' + post 'set_evaluation_attr' end collection do post 'next_step' diff --git a/lib/tasks/homework_evaluation.rake b/lib/tasks/homework_evaluation.rake new file mode 100644 index 000000000..af833448d --- /dev/null +++ b/lib/tasks/homework_evaluation.rake @@ -0,0 +1,54 @@ +#coding=utf-8 + +namespace :homework_evaluation do + desc "start and end evaluation" + def get_assigned_homeworks(student_works, n, index) + student_works += student_works + student_works[index + 1 .. index + n] + end + #自动开启匿评的任务 + task :start_evaluation => :environment do + homework_detail_manuals = HomeworkDetailManual.where("evaluation_start = '#{Date.today}'") + homework_detail_manuals.each do |homework_detail_manual| + homework_common = homework_detail_manual.homework_common + if homework_detail_manual.comment_status == 1 #新建状态才可开启匿评 + student_works = homework_common.student_works + if student_works && student_works.size >= 2 + student_works.each_with_index do |work, index| + user = work.user + n = homework_detail_manual.evaluation_num + n = n < student_works.size ? n : student_works.size - 1 + assigned_homeworks = get_assigned_homeworks(student_works, n, index) + assigned_homeworks.each do |h| + student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) + student_works_evaluation_distributions.save + end + end + homework_detail_manual.update_column('comment_status', 2) + # 匿评开启消息邮件通知 + else + #作业数小于2,启动失败 + end + end + end + end + + #自动关闭匿评的任务 + task :end_evaluation => :environment do + homework_detail_manuals = HomeworkDetailManual.where("evaluation_end = '#{Date.today}'") + homework_detail_manuals.each do |homework_detail_manual| + homework_common = homework_detail_manual.homework_common + if homework_detail_manual.comment_status == 2 #开启匿评状态才可关闭匿评 + #计算缺评扣分 + work_ids = "(" + homework_common.student_works.map(&:id).join(",") + ")" + homework_common.student_works.each do |student_work| + absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count + student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manuals.absence_penalty : 0 + student_work.save + end + homework_detail_manual.update_column('comment_status', 3) + # 匿评关闭消息邮件通知 + end + end + end +end diff --git a/public/images/sidebar_bg.png b/public/images/sidebar_bg.png index 2704727d7..9ceea0f91 100644 Binary files a/public/images/sidebar_bg.png and b/public/images/sidebar_bg.png differ diff --git a/public/javascripts/course.js b/public/javascripts/course.js index b471ea89e..07a149adb 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -975,3 +975,14 @@ $(function(){ function new_homework_alert(){ alert("您好!课程内直接发布作业的功能正在改进中,请直接点击\n顶部导航栏的“作业”向本课程发送作业。谢谢!如有问\n题,可参见帮助中心。"); } + +function show_student_work(url){ + $.get( + url, + { + + }, + function (data) { + } + ); +} diff --git a/public/javascripts/feedback.js b/public/javascripts/feedback.js index 1bbab1f45..fb3b35ca7 100644 --- a/public/javascripts/feedback.js +++ b/public/javascripts/feedback.js @@ -5,7 +5,7 @@ minStatue : true, skin : 'blue', durationTime : 1000 - } + }; var options = $.extend(defaults, options); this.each(function(){ @@ -13,17 +13,13 @@ var thisBox = $(this), closeBtn = thisBox.find('.close_btn' ), show_btn = thisBox.find('.show_btn' ), - sideContent = thisBox.find('.side_content'), - sideList = thisBox.find('.side_list') - ; + sideContent = thisBox.find('.side_content'); var defaultTop = thisBox.offset().top; //????????top - thisBox.css(options.float, 0); if(options.minStatue == "true"){ - $(".show_btn").css("float", options.float); + show_btn.css("float", options.float); sideContent.css('width', 0); show_btn.css('width', 25); - } //close closeBtn.bind("click",function(){ @@ -37,26 +33,12 @@ sideContent.stop(true, true).delay(200).animate({ width: '154px'},"fast"); cookiesave('minStatue','false','','',''); }); - - - }); //end this.each }; })(jQuery); - -$(function(){ - $("#button1").click(function(){ - myTips("<%= l(:label_feedback_success) %>","success"); - }); - -}); - function f_submit() { -// var subject = $("#memo_subject").val(); -// var content = $("#memo_content").val(); -// $("#memo_subject").val(subject+":"+ content.substr(0,18)+"..."); $("#new_memo").submit(); } @@ -68,11 +50,8 @@ function cookiesave(n, v, mins, dn, path) if(!mins) mins = 365 * 24 * 60; if(!path) path = "/"; var date = new Date(); - date.setTime(date.getTime() + (mins * 60 * 1000)); - var expires = "; expires=" + date.toGMTString(); - if(dn) dn = "domain=" + dn + "; "; document.cookie = n + "=" + v + expires + "; " + dn + "path=" + path; @@ -86,34 +65,31 @@ function cookieget(n) var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(name) == 0){ - return c.substring(name.length,c.length);} - + return c.substring(name.length,c.length); + } } return false; } $(function(){ + $(".closeSidebar").click(function(){ + $(".show_btn").css("display","none"); + $("#scrollsidebar").css("display","none"); + return false; + }); + $("#button1").click(function(){ - myTips("<%= l(:label_feedback_success) %>","success"); + myTips("反馈成功","success"); }); -}); - - -$(document).ready(function () { - $(function () { - $("#scrollsidebar").fix({ - float: 'right', //default.left or right - minStatue: cookieget('minStatue'), - skin: 'green', //default.gray or blue - durationTime: 600 - }); + $("#scrollsidebar").fix({ + float: 'right', //default.left or right + minStatue: cookieget('minStatue'), + skin: 'green', //default.gray or blue + durationTime: 600 }); -}); - -$(document).ready(function(){ $("#subject").keydown(function(){ var curLength=$("#subject").val().length; if(curLength>50){ @@ -123,8 +99,7 @@ $(document).ready(function(){ else{ $("#textCount").text(50-$("#subject").val().length) } - }) - $("#subject").keyup(function(){ + }).keyup(function(){ var curLength=$("#subject").val().length; if(curLength>50){ var num=$("#subject").val().substr(0,50); @@ -133,5 +108,5 @@ $(document).ready(function(){ else{ $("#textCount").text(50-$("#subject").val().length) } - }) -}) \ No newline at end of file + }); +}); \ No newline at end of file diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index fb71d75db..86456bd8a 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -136,18 +136,36 @@ function search_homework_by_name(url){ ); } +//提交匿评参数设置 +function submit_set_evaluation_attr(end_time){ + if(!regex_evaluation_start(end_time)){ + $("#evaluation_start_time").focus(); + } + else if(!regex_evaluation_end()){ + $("#evaluation_end_time").focus(); + } + else if(!regex_evaluation_num()){ + $("#evaluation_num").focus(); + } + else{ + $('#popbox02 form').submit(); + } +} + //验证匿评开启时间:大于截止时间,或者为空 -function regex_evaluation_start(){ +function regex_evaluation_start(end_time){ var evaluation_start = $.trim($("#evaluation_start_time").val()); if(evaluation_start == ""){ - return true; + $("#homework_evaluation_start_time").text("开启匿评日期不能为空"); + return false; } - var end_time = new Date($.trim($("#homework_end_time").val())); + var end_time = new Date(end_time); var evaluation_start_time = new Date(evaluation_start); if(evaluation_start_time > end_time){ + $("#homework_evaluation_start_time").text(""); return true; }else{ - $("#homework_end_time_span").text("开启匿评日期必须大于截止日期"); + $("#homework_evaluation_start_time").text("开启匿评日期必须大于截止日期"); return false; } } @@ -157,17 +175,40 @@ function regex_evaluation_end(){ var evaluation_start = $.trim($("#evaluation_start_time").val()); var evaluation_end = $.trim($("#evaluation_end_time").val()); if(evaluation_end == ""){ + $("#homework_evaluation_end_time").text("关闭匿评日期不能为空"); return true; - }else if(evaluation_start == ""){ - $("#homework_end_time_span").text("开启匿评日期为空时,关闭匿评日期必须为空"); - return false; } var evaluation_start_time = new Date(evaluation_start); var evaluation_end_time = new Date(evaluation_end); if(evaluation_end_time > evaluation_start_time){ + $("#homework_evaluation_end_time").text(""); return true; }else{ - $("#homework_end_time_span").text("关闭匿评日期必须大于开启匿评日期"); + $("#homework_evaluation_end_time").text("关闭匿评日期必须大于开启匿评日期"); + return false; + } +} + +//验证匿评数量 +function regex_evaluation_num(){ + var evaluation_num = $.trim($("#evaluation_num").val()); + var regex = /^\d+$/; + if(evaluation_num==""){ + $("#evaluation_num_notice").text("匿评人数不能为空"); + return false; + } + else if(regex.test(evaluation_num)){ + if(evaluation_num > 0){ + $("#evaluation_num_notice").html(""); + return true; + } + else{ + $("#evaluation_num_notice").text("匿评人数必须为大于0"); + return false; + } + } + else{ + $("#evaluation_num_notice").text("匿评人数只能为数字"); return false; } } diff --git a/public/javascripts/project.js b/public/javascripts/project.js index 7e9643bc7..491b5bb92 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -369,6 +369,9 @@ $(document).ready(function () { $('html, body').animate({scrollTop: $('#' + id).offset().top}, 400); } + function quote_issue_journal(){ + document.getElementById("#issue_notes").focus(); + } /*缺陷完成度决定缺陷状态*/ function PrecentChange(obj) { @@ -502,4 +505,5 @@ function judgeprojectname(){ //用户反馈 function submitProjectFeedback() { $("#project_feedback_form").submit(); -} \ No newline at end of file +} + diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 5e049e029..b77b95f21 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -58,6 +58,12 @@ h4{ font-size:14px; color:#3b3b3b;} .clearfix{clear:both;zoom:1} .break_word{ word-break:break-all; word-wrap: break-word;} .white_space{white-space:nowrap;} +.fontGrey3 {color:#484848;} +a.linkGrey6 {color:#484848 !important;} +a.linkGrey6:hover {color:#ffffff !important;} +.markPopup {width:290px; height:auto; padding:5px 0px 15px 15px; background-color:#ffffff; z-index:1000;} +.markInput { outline:none; border:1px solid #e6e6e6; height:30px; width:140px; color:#3d3c3c;} +.markPercentage {margin:10px 0; border:1px solid #e6e6e6; width:70px; height:30px; outline:none; font-size:12px; color:#3d3c3c;} /* Spacing */ .ml2{ margin-left:2px;} @@ -103,6 +109,7 @@ h4{ font-size:14px; color:#3b3b3b;} .mb8 {margin-bottom:8px !important;} .mb10{ margin-bottom:10px !important;} .mb12 {margin-bottom:12px !important;} +.mb15{margin-bottom: 15px;} .mb20{ margin-bottom:20px;} .pl15{ padding-left:15px;} .w20{ width:20px;} @@ -515,7 +522,9 @@ a.homepageMenuText {color:#484848; font-size:16px; margin-left:20px;} .homepageNewsPortrait {width:40px; display:block; margin-top:7px;} .homepageNewsPublisher { max-width:100px; font-size:12px; color:#269ac9; display:block; padding-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; } .homepageNewsType {width:110px; padding-left: 5px; font-size:12px; color:#888888; display:block;} +.homepageNewsTypeHomework {width:160px; padding-left: 5px; font-size:12px; color:#888888; display:block; overflow:hidden; height:49px;word-break:break-all; word-wrap:break-word; text-overflow:ellipsis;} .homepageNewsPubType {width:220px; font-size:12px; color:#888888; display: block;} +.homepageNewsPubTypeHomework {width:270px; font-size:12px; color:#888888; display: block; white-space:nowrap;} .homepageNewsContent {width:365px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } .homepageSystenMessageContent {width:291px; max-width:291px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden;text-overflow:ellipsis;max-height: 49px; } .homepageHomeworkContentWarn {width:110px; max-width:365px; margin-right:10px; font-size:12px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } @@ -527,7 +536,7 @@ a.homepageWhite:hover {color:#a1ebff} a.newsGrey {color:#4b4b4b;} a.newsGrey:hover {color:#000000;} a.newsRed {color:red;} -a.newsRed:hovor {color:#888888;} +a.newsRed:hover {color:#888888;} a.replyGrey {color:#888888; display:inline-block;} a.replyGrey:hover {color:#4b4b4b;} a.replyGrey1 {color:#888888;} @@ -704,7 +713,7 @@ html{ overflow-x:hidden;} .scrollsidebar{ position: fixed; bottom:1px; right:1px; background:none; } .side_content{width:154px; height:auto; overflow:hidden; float:left; } .side_content .side_list {width:154px;overflow:hidden;} -.show_btn{ width:0; height:112px; overflow:hidden; float:left; margin-top:190px;cursor:pointer;} +.show_btn{ width:0; height:112px; overflow:hidden; float:left; margin-top:200px; cursor:pointer;} .show_btn span { display:none;} .close_btn{width:24px;height:24px;cursor:pointer;} .side_title,.side_bottom,.close_btn,.show_btn {background:url(../images/sidebar_bg.png) no-repeat; } @@ -714,20 +723,21 @@ html{ overflow-x:hidden;} .close_btn { float:right; display:block; width:21px; height:16px; margin:9px 10px 0 0; _margin:16px 5px 0 0;} .close_btn span { display:none;} .side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;} -.msgserver { margin-top:5px;} -.msgserver a { background:url(../images/sidebar_bg.png) no-repeat -119px -112px; padding-left:22px; height:21px; display:block; } +.msgserver { margin:10px 0 0px 5px;} +.msgserver a { background:url(../images/sidebar_bg.png) no-repeat -119px -110px; padding-left:22px; display:block; height:24px; } .opnionText{box-shadow:none; width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;overflow:auto; background-attachment:fixed;border-style:solid;} -a.opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;} -a:hover.opnionButton{background: #0fa9bb; } +a.opnionButton{ display:block; background:#269ac9; width:130px; height:26px; margin-top:5px; text-align:center; padding-top:0px; color:#fff;} +a.opnionButton:hover{background: #297fb8; } /* blue skin as the default skin */ .side_title {background-position:-195px 0;} .side_center {background:url(../images/blue_line.png) repeat-y center; } .side_bottom {background-position:-195px -50px;} -a.close_btn {background-position:-44px 0;} -a:hover.close_btn {background-position:-66px 0;} +.close_btn {background-position:-44px 0;} +.close_btn:hover {background-position:-66px 0;} .show_btn {background-position:-119px 0;} -.msgserver a {color:#15bccf; } +.msgserver a {color:#269ac9; } .msgserver a:hover { text-decoration:underline; } +.closeSidebar {background:url(../images/sidebar_bg.png) 0px -112px no-repeat; width:28px; height:18px; margin-top:65px; position:absolute;} /***** Ajax indicator ******/ @@ -768,9 +778,6 @@ div.modal { .ui-widget { font-family: Verdana, sans-serif; font-size: 1.1em; - width: 200px; - height: 14px; - background: #e2e2e2; } .ui-dialog .ui-dialog-content { position: relative; @@ -973,6 +980,7 @@ img.ui-datepicker-trigger { } /*消息*/ .homepageNewsTypeNotRead {width:100px; padding-left: 5px; font-size:12px; color:#4b4b4b; font-weight:bold; display:block;} +.homepageNewsTypeNotReadHomework {width:170px; padding-left: 5px; font-size:12px; color:#4b4b4b; font-weight:bold; display:block;overflow:hidden; height:49px; word-break:break-all; word-wrap:break-word;text-overflow:ellipsis;} .calendar_input{border-left:none !important;border-bottom: none!important; border-top: none!important; border-right: 1px solid #d9d9d9;} .calendar_div{border: 1px solid #d9d9d9;} /*缺陷更新动态在消息中显示样式*/ @@ -1151,4 +1159,4 @@ a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; c .link_file_a{ display:block; max-width:450px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} .list_style ol li{list-style-type: decimal;margin-left: 20px;} -.list_style ul li{list-style-type: disc;margin-left: 20px;} \ No newline at end of file +.list_style ul li{list-style-type: disc;margin-left: 20px;} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 963b4aeb3..1669bdd05 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -3,6 +3,7 @@ .project_content{ width:940px; margin:10px auto;} .project_left{ float:left;} .project_right{ width:670px; float:left;background:#fff; padding:10px;} +.project_r_h02{ width:920px; height:40px; background:#eaeaea; margin-bottom:10px;} /*简介*/ .project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index d8285709f..c4a839e0a 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -714,7 +714,7 @@ html{ overflow-x:hidden;} .scrollsidebar{ position: fixed; bottom:1px; right:1px; background:none; } .side_content{width:154px; height:auto; overflow:hidden; float:left; } .side_content .side_list {width:154px;overflow:hidden;} -.show_btn{ width:0; height:112px; overflow:hidden; float:left; margin-top:190px;cursor:pointer;} +.show_btn{ width:0; height:112px; overflow:hidden; float:left; margin-top:200px; cursor:pointer;} .show_btn span { display:none;} .close_btn{width:24px;height:24px;cursor:pointer;} .side_title,.side_bottom,.close_btn,.show_btn {background:url(../images/sidebar_bg.png) no-repeat; } @@ -724,21 +724,21 @@ html{ overflow-x:hidden;} .close_btn { float:right; display:block; width:21px; height:16px; margin:9px 10px 0 0; _margin:16px 5px 0 0;} .close_btn span { display:none;} .side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;} -.msgserver { margin-top:5px;} -/*.msgserver a { background:url(../images/sidebar_bg.png) no-repeat -119px -112px; padding-left:22px; height:21px; display:block; }*/ -.msgserver a { padding-left:4px; height:21px; display:block; } +.msgserver { margin:10px 0 0px 5px;} +.msgserver a { background:url(../images/sidebar_bg.png) no-repeat -119px -110px; padding-left:22px; display:block; height:24px; } .opnionText{box-shadow:none; width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;overflow:auto; background-attachment:fixed;border-style:solid;} -a.opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;} -a:hover.opnionButton{background: #0fa9bb; } +a.opnionButton{ display:block; background:#269ac9; width:130px; height:26px; margin-top:5px; text-align:center; padding-top:0px; color:#fff;} +a.opnionButton:hover{background: #297fb8; } /* blue skin as the default skin */ .side_title {background-position:-195px 0;} .side_center {background:url(../images/blue_line.png) repeat-y center; } .side_bottom {background-position:-195px -50px;} -a.close_btn {background-position:-44px 0;} -a:hover.close_btn {background-position:-66px 0;} +.close_btn {background-position:-44px 0;} +.close_btn:hover {background-position:-66px 0;} .show_btn {background-position:-119px 0;} -.msgserver a {color:#15bccf; } +.msgserver a {color:#269ac9; } .msgserver a:hover { text-decoration:underline; } +.closeSidebar {background:url(../images/sidebar_bg.png) 0px -112px no-repeat; width:28px; height:18px; margin-top:65px; position:absolute;} .hiddent{ overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} @@ -858,7 +858,7 @@ div.flash.warning, .conflict { /*弹出框*/ .black_overlay{display:none;position:fixed;top:0px;left:0px;width:100%;height:100%;background-color:black;z-index:1001;-moz-opacity:0.8;opacity:.80;filter:alpha(opacity=80);} .white_content{display:none;position:fixed;top:15%;left:30%;width:420px;height: auto; margin-bottom:20px;padding:16px;border:3px solid #15bccf;background-color:white;z-index:1002;overflow:auto;} -.white_content02{display:none;position:fixed;top:15%;left:30%;width:310px;height: auto; margin-bottom:20px;padding:10px;border:3px solid #15bccf;background-color:white;z-index:1002;overflow:auto;} +.white_content02{display:none;position:fixed;top:15%;left:30%;width:450px;height: auto; margin-bottom:20px;padding:10px;border:3px solid #15bccf;background-color:white;z-index:1002;overflow:auto;} .floatbox{ width:420px; border:3px solid #15bccf; background:#fff; padding:5px;} a.box_close{ display:block; float:right; width:16px; height:16px; background:url(../images/img_floatbox.png) 0 0 no-repeat;} a.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;}