Merge branch 'develop' into cxt_course
This commit is contained in:
commit
159f0b294f
18
Gemfile
18
Gemfile
|
@ -50,10 +50,10 @@ gem 'elasticsearch-model'
|
|||
gem 'elasticsearch-rails'
|
||||
|
||||
#rails 3.2.22.2 bug
|
||||
gem "test-unit", "~>3.0"
|
||||
# gem "test-unit", "~>3.0"
|
||||
|
||||
### profile
|
||||
gem 'oneapm_rpm'
|
||||
# gem 'oneapm_rpm'
|
||||
|
||||
group :development do
|
||||
gem 'grape-swagger'
|
||||
|
@ -63,22 +63,18 @@ group :development do
|
|||
if RUBY_PLATFORM =~ /w32/
|
||||
gem 'win32console'
|
||||
end
|
||||
|
||||
if RUBY_PLATFORM =~ /darwin/
|
||||
gem 'puma'
|
||||
end
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
unless RUBY_PLATFORM =~ /w32/
|
||||
gem 'pry-rails'
|
||||
if RUBY_VERSION >= '2.0.0'
|
||||
gem 'pry-byebug'
|
||||
gem "test-unit", "~>3.0"
|
||||
end
|
||||
gem 'pry-stack_explorer'
|
||||
if RUBY_PLATFORM =~ /darwin/
|
||||
gem 'puma'
|
||||
end
|
||||
end
|
||||
|
||||
gem 'rspec-rails', '~> 3.0'
|
||||
gem 'factory_girl_rails'
|
||||
end
|
||||
|
||||
# Gems used only for assets and not required
|
||||
|
|
|
@ -283,7 +283,6 @@ module Mobile
|
|||
requires :token, type: String
|
||||
requires :lastname, type: String
|
||||
requires :sex, type: Integer
|
||||
requires :mail, type: String
|
||||
end
|
||||
|
||||
post 'edit_userinfo' do
|
||||
|
@ -298,41 +297,11 @@ module Mobile
|
|||
status = -1
|
||||
end
|
||||
|
||||
if params[:mail].length > 60 then
|
||||
message = "邮箱地址不能超过60个字符!"
|
||||
status = -1
|
||||
end
|
||||
|
||||
if !(params[:mail].match(/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i))
|
||||
message = "请输入正确的邮箱地址!"
|
||||
status = -1
|
||||
end
|
||||
|
||||
if status == 0
|
||||
# 修改邮箱的时候同步修改到gitlab
|
||||
if user.mail != params[:mail]
|
||||
g = Gitlab.client
|
||||
begin
|
||||
g.edit_user(user.gid, :email => params[:mail])
|
||||
rescue
|
||||
Rails.logger.error "sync user's email of gitlab failed!"
|
||||
end
|
||||
end
|
||||
|
||||
user.mail = params[:mail]
|
||||
|
||||
user.lastname = params[:lastname]
|
||||
|
||||
user.update_attribute(:lastname, params[:lastname])
|
||||
se = user.extensions
|
||||
|
||||
se.gender = params[:sex]
|
||||
|
||||
if user.save && se.save
|
||||
status = 0
|
||||
else
|
||||
message = "该邮箱地址已被使用!"
|
||||
status = -1
|
||||
end
|
||||
se.update_attribute(:gender, params[:sex])
|
||||
end
|
||||
|
||||
if status == 0
|
||||
|
|
|
@ -17,17 +17,18 @@ module Mobile
|
|||
end
|
||||
else
|
||||
case field
|
||||
when :download_url
|
||||
"attachments/download/#{f.try(:id)}"
|
||||
when :file_dir
|
||||
"attachments/download/" << f.send(:id).to_s << '/'
|
||||
when :attafile_size
|
||||
(number_to_human_size(f.filesize)).gsub("ytes", "").to_s
|
||||
when :coursename
|
||||
f.course.nil? ? "" : f.course.name
|
||||
f.try(:course).try(:name) || ''
|
||||
when :syllabus_title
|
||||
f.course.nil? ? "" : f.course.syllabus.nil? ? "" : f.course.syllabus.title
|
||||
f.try(:course).try(:syllabus).try(:title) || ''
|
||||
when :course_id
|
||||
f.course.nil? ? 0 : f.course.id
|
||||
|
||||
f.try(:course).try(:id) || 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -50,6 +51,8 @@ module Mobile
|
|||
current_user_is_teacher = is_course_teacher(current_user,instance.course)
|
||||
current_user_is_teacher
|
||||
end
|
||||
|
||||
attachment_expose :download_url
|
||||
end
|
||||
end
|
||||
end
|
|
@ -180,6 +180,8 @@ module Mobile
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
expose :attachments, using: Mobile::Entities::Attachment
|
||||
end
|
||||
end
|
||||
end
|
|
@ -175,8 +175,10 @@ class AdminController < ApplicationController
|
|||
def courses
|
||||
@name = params[:name].to_s.strip.downcase
|
||||
if @name && @name != ""
|
||||
@courses = Course.select{ |course| course.teacher && ((course.teacher.show_name).include?(@name) || course.name.include?(@name))}
|
||||
@courses = @courses.sort{|x, y| y.created_at <=> x.created_at}
|
||||
all_user_ids = Course.all.map{|course| course.tea_id}
|
||||
user_str_ids = search_user_by_name all_user_ids, @name
|
||||
user_ids = user_str_ids.empty? ? "(-1)" : "(" + user_str_ids.join(",") + ")"
|
||||
@courses = Course.where("tea_id in #{user_ids} or name like '%#{@name}%'").reorder("created_at desc")
|
||||
else
|
||||
@courses = Course.order('created_at desc')
|
||||
end
|
||||
|
|
|
@ -55,7 +55,7 @@ class ApplicationController < ActionController::Base
|
|||
include Redmine::Search::Controller
|
||||
include Redmine::MenuManager::MenuController
|
||||
helper Redmine::MenuManager::MenuHelper
|
||||
|
||||
|
||||
def user_agent
|
||||
logger.info "HTTP_USER_AGENT #{request.env["HTTP_USER_AGENT"]}"
|
||||
end
|
||||
|
@ -117,6 +117,9 @@ class ApplicationController < ActionController::Base
|
|||
elsif params[:format] == 'atom' && params[:key] && request.get? && accept_rss_auth?
|
||||
# RSS key authentication does not start a session
|
||||
user = User.find_by_rss_key(params[:key])
|
||||
elsif session[:wechat_openid]
|
||||
uw = UserWechat.find_by_openid(session[:wechat_openid])
|
||||
user = uw.user if uw
|
||||
end
|
||||
end
|
||||
if user.nil? && Setting.rest_api_enabled? && accept_api_auth?
|
||||
|
@ -509,8 +512,7 @@ class ApplicationController < ActionController::Base
|
|||
# render_404
|
||||
# end
|
||||
|
||||
def self.
|
||||
model_object(model)
|
||||
def self.model_object(model)
|
||||
self.model_object = model
|
||||
end
|
||||
|
||||
|
@ -828,7 +830,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
# Returns a string that can be used as filename value in Content-Disposition header
|
||||
def filename_for_content_disposition(name)
|
||||
request.env['HTTP_USER_AGENT'] =~ %r{MSIE|Trident} ? ERB::Util.url_encode(name) : name
|
||||
request.env['HTTP_USER_AGENT'] =~ %r{MSIE|Trident|Edge} ? ERB::Util.url_encode(name) : name
|
||||
end
|
||||
|
||||
def api_request?
|
||||
|
|
|
@ -72,8 +72,10 @@ class AttachmentsController < ApplicationController
|
|||
|
||||
def direct_download
|
||||
@attachment.increment_download
|
||||
file_type = detect_content_type(@attachment)
|
||||
|
||||
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
|
||||
:type => detect_content_type(@attachment),
|
||||
:type => file_type,
|
||||
:disposition => 'attachment' #inline can open in browser
|
||||
end
|
||||
|
||||
|
@ -130,11 +132,7 @@ class AttachmentsController < ApplicationController
|
|||
def download
|
||||
# modify by nwb
|
||||
# 下载添加权限设置
|
||||
if (params[:type] && params[:type] == "wechat" )
|
||||
candown = true
|
||||
else
|
||||
candown = attachment_candown @attachment
|
||||
end
|
||||
candown = attachment_candown @attachment
|
||||
|
||||
if candown || User.current.admin? || User.current.id == @attachment.author_id
|
||||
if stale?(:etag => @attachment.digest)
|
||||
|
|
|
@ -32,6 +32,13 @@ class CoursesController < ApplicationController
|
|||
before_filter :require_login, :only => [:join, :unjoin]
|
||||
#before_filter :allow_join, :only => [:join]
|
||||
|
||||
# 邀请码停用/启用
|
||||
def set_invite_code_halt
|
||||
if User.current.allowed_to?(:as_teacher, @course) || User.current.admin?
|
||||
@course.update_attribute('invite_code_halt', @course.invite_code_halt == 0 ? 1 : 0)
|
||||
end
|
||||
end
|
||||
|
||||
#查找组织
|
||||
def search_public_orgs_not_in_course
|
||||
condition = '%%'
|
||||
|
|
|
@ -56,7 +56,7 @@ class ExerciseController < ApplicationController
|
|||
end
|
||||
end
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
exercise_end = @exercise.end_time > Time.now
|
||||
exercise_end = @exercise.end_time.nil? ? false : @exercise.end_time > Time.now
|
||||
if @exercise.time == -1
|
||||
@can_edit_excercise = exercise_end
|
||||
else
|
||||
|
|
|
@ -6,7 +6,7 @@ class HomeworkCommonController < ApplicationController
|
|||
|
||||
include StudentWorkHelper
|
||||
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,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
|
||||
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works,:set_score_open,:alert_score_open_modal]
|
||||
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,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
|
||||
before_filter :member_of_course, :only => [:index]
|
||||
|
||||
|
@ -33,12 +33,18 @@ class HomeworkCommonController < ApplicationController
|
|||
|
||||
@homeworks = paginateHelper @homework_commons,10
|
||||
#设置at已读
|
||||
@homeworks.each do |homework|
|
||||
# homework.journals_for_messages.each do |j|
|
||||
# User.current.at_messages.unviewed('JournalsForMessage', j.id).each {|x| x.viewed!}
|
||||
# end
|
||||
homework.delay.set_jour_viewed
|
||||
ids = @homeworks.inject([]) do |ids, homework|
|
||||
jids = homework.journals_for_messages.map(&:id)
|
||||
jids ? ids + jids : ids
|
||||
|
||||
# homework.delay.set_jour_viewed
|
||||
end
|
||||
unless ids.empty?
|
||||
User.current.at_messages.where(viewed: false,
|
||||
at_message_type: 'JournalsForMessage',
|
||||
at_message_id: ids).update_all(viewed: true)
|
||||
end
|
||||
|
||||
@left_nav_type = 3
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -82,6 +88,27 @@ class HomeworkCommonController < ApplicationController
|
|||
@homework.publish_time = params[:homework_common][:publish_time]
|
||||
end
|
||||
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
|
||||
param_end_time = Time.parse(params[:homework_common][:end_time]).strftime("%Y-%m-%d")
|
||||
homework_end_time = Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d")
|
||||
if homework_end_time != param_end_time
|
||||
if homework_end_time > param_end_time
|
||||
@homework.student_works.where("work_status = 1").each do |st|
|
||||
if param_end_time < Time.parse(st.commit_time.to_s).strftime("%Y-%m-%d")
|
||||
st.late_penalty = @homework.late_penalty
|
||||
st.work_status = 2
|
||||
st.save
|
||||
end
|
||||
end
|
||||
else
|
||||
@homework.student_works.where("work_status = 2").each do |st|
|
||||
if param_end_time >= Time.parse(st.commit_time.to_s).strftime("%Y-%m-%d")
|
||||
st.late_penalty = 0
|
||||
st.work_status = 1
|
||||
st.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@homework.end_time = params[:homework_common][:end_time] || Time.now
|
||||
@homework.course_id = params[:course_id]
|
||||
if params[:homework_type] && params[:homework_type].to_i != @homework.homework_type
|
||||
|
@ -198,6 +225,23 @@ class HomeworkCommonController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 成绩公开范围弹框
|
||||
def alert_score_open_modal
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
else
|
||||
@user_activity_id = -1
|
||||
end
|
||||
@hw_status = params[:hw_status].to_i
|
||||
end
|
||||
|
||||
def set_score_open
|
||||
@homework.update_attribute('score_open', params[:score_open].to_i)
|
||||
@user_activity_id = params[:user_activity_id].to_i
|
||||
@hw_status = params[:hw_status].to_i
|
||||
@is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher, @course)
|
||||
end
|
||||
|
||||
#开启匿评
|
||||
#statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限
|
||||
def start_anonymous_comment
|
||||
|
|
|
@ -22,9 +22,9 @@ class IssuesController < ApplicationController
|
|||
before_filter :authorize1, :only => [:show]
|
||||
before_filter :find_issue, :only => [:show, :edit, :update,:add_journal, :add_journal_in_org]
|
||||
before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :destroy]
|
||||
before_filter :find_project, :only => [:new, :create, :update_form]
|
||||
before_filter :find_project, :only => [:new, :create, :update_form, :issue_commits, :commit_for_issue, :issue_commit_delete]
|
||||
#before_filter :authorize, :except => [:index, :show]
|
||||
before_filter :authorize, :except => [:index,:add_journal, :add_journal_in_org,:delete_journal,:reply,:add_reply]
|
||||
before_filter :authorize, :except => [:index,:add_journal, :add_journal_in_org,:delete_journal,:reply,:add_reply, :issue_commits, :commit_for_issue, :issue_commit_delete]
|
||||
|
||||
before_filter :find_optional_project, :only => [:index]
|
||||
before_filter :check_for_default_issue_status, :only => [:new, :create]
|
||||
|
@ -57,6 +57,57 @@ class IssuesController < ApplicationController
|
|||
helper :project_score
|
||||
include ApplicationHelper
|
||||
|
||||
# issue和代码提交id关联模块 --> over
|
||||
# 获取某个项目的commit_ids
|
||||
def issue_commits
|
||||
begin
|
||||
return render_404 if @project.gpid.nil?
|
||||
@issue_commit_ids = (params[:issue_commit_ids].is_a?(Array) ? params[:issue_commit_ids] : params[:issue_commit_ids].split(",")) unless params[:issue_commit_ids].nil?
|
||||
search = params[:search].to_s.strip
|
||||
@type = params[:type]
|
||||
limit = 15
|
||||
g = Gitlab.client
|
||||
g_project = g.project(@project.gpid)
|
||||
rev = params[:branch].nil? ? g_project.default_branch : params[:branch]
|
||||
@project_branches = g.branches(@project.gpid)
|
||||
@branch_names = @project_branches.map{|b| b.name}
|
||||
@default_branch = g_project.default_branch
|
||||
# 搜索的分页需要单独处理,因为搜索不容易获取总数
|
||||
if search.present?
|
||||
@commits = g.commits(@project.gpid, ref_name:rev, :search => search)
|
||||
@commits_count = @commits.count
|
||||
@commits_pages = Paginator.new @commits_count, limit, params['page'] || 1
|
||||
@offset ||= @commits_pages.offset
|
||||
@commits = paginateHelper @commits,limit
|
||||
else
|
||||
@commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s, ref_name:rev, :search => search)
|
||||
@commits_count = g.user_static(@project.gpid, :rev => rev).count
|
||||
@commits_pages = Redmine::Pagination::Paginator.new @commits_count, limit, params[:page]
|
||||
end
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
end
|
||||
|
||||
# 选择对应的Commit
|
||||
def commit_for_issue
|
||||
history_commit_ids = params[:issue_for_commit_ids].split(",") unless params[:issue_for_commit_ids].nil?
|
||||
@issue_commit_ids = (history_commit_ids.blank? ? params[:checkbox1] : params[:checkbox1] | history_commit_ids).uniq
|
||||
end
|
||||
|
||||
def issue_commit_delete
|
||||
commit_id = params[:commit_id].split(",")
|
||||
issue_commit_ids = params[:issue_commit_ids]
|
||||
# issue_id存在则为issue详情或者编辑的时候,否则为新建Issue
|
||||
# 编辑和详情的时候需要在数据库中删除记录,新建的时候在内存中删除
|
||||
if params[:issue_id]
|
||||
commit_issue = CommitIssues.where(:commit_id => commit_id, :issue_id => params[:issue_id], :project_id => @project.id).first
|
||||
commit_issue.delete if commit_issue
|
||||
end
|
||||
@issue_commit_ids = issue_commit_ids - commit_id
|
||||
end
|
||||
# over
|
||||
|
||||
def index
|
||||
# 顶部导航
|
||||
@project_menu_type = 2
|
||||
|
@ -163,14 +214,14 @@ class IssuesController < ApplicationController
|
|||
def show
|
||||
# 顶部导航
|
||||
@project_menu_type = 2
|
||||
|
||||
# 打开编辑内容
|
||||
@is_edit = true unless params[:edit].nil?
|
||||
|
||||
# 当前用户查看指派给他的缺陷消息,则设置消息为已读
|
||||
query = ForgeMessage.where("forge_message_type =? and user_id =? and forge_message_id =?", "Issue", User.current, @issue).first
|
||||
query.update_attribute(:viewed, true) unless query.nil?
|
||||
|
||||
# issue 关联的commit
|
||||
commit_issues = CommitIssues.where(:issue_id => @issue.id, :project_id => @issue.project_id)
|
||||
@issue_commit_ids = commit_issues.map{|commit_issue| commit_issue.commit_id}
|
||||
# issue 新建的at消息
|
||||
User.current.at_messages.unviewed('Issue', @issue.id).each {|x| x.viewed!}
|
||||
# 回复的at消息
|
||||
|
@ -186,7 +237,8 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
|
||||
@jour_reply = Journal.new
|
||||
@journals = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.id ASC").all
|
||||
@journals = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.id desc").all
|
||||
@journals = get_no_children_comments_all @journals
|
||||
@journals.each_with_index {|j,i| j.indice = i+1}
|
||||
@journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
|
||||
@journals.reverse! if User.current.wants_comments_in_reverse_order?
|
||||
|
@ -238,6 +290,8 @@ class IssuesController < ApplicationController
|
|||
@issue.fixed_version_id = nil if @issue.fixed_version_id == 0
|
||||
@issue.assigned_to_id = nil if @issue.assigned_to_id == 0
|
||||
if @issue.save
|
||||
# 关联commmit
|
||||
update_issue_commit params[:commit_ids]
|
||||
#params[:issue][:assigned_to_id] = nil if params[:issue][:assigned_to_id].to_i == 0
|
||||
senduser = User.find(params[:issue][:assigned_to_id])
|
||||
issue_id = @issue.id
|
||||
|
@ -276,6 +330,9 @@ class IssuesController < ApplicationController
|
|||
def edit
|
||||
# 修改实例变量的值
|
||||
return unless update_issue_from_params
|
||||
# issue 关联的commit
|
||||
commit_issues = CommitIssues.where(:issue_id => @issue.id, :project_id => @issue.project_id)
|
||||
@issue_commit_ids = commit_issues.map{|commit_issue| commit_issue.commit_id}
|
||||
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'base_projects' }#added by young
|
||||
|
@ -309,9 +366,9 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if @saved
|
||||
# 更新commit关联情况
|
||||
update_issue_commit params[:commit_ids]
|
||||
#修改界面增加跟踪者
|
||||
watcherlist = @issue.watcher_users
|
||||
select_users = []
|
||||
|
@ -356,6 +413,26 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 保存issue的时候相关的commit操作
|
||||
# commit_ids => "9b9845ff,poor56el"
|
||||
def update_issue_commit commit_ids
|
||||
# 关联commmit
|
||||
commit_ids = params[:commit_ids]
|
||||
unless commit_ids.blank?
|
||||
commit_ids = commit_ids.split(",").uniq
|
||||
if params[:action] == "update"
|
||||
exist_commit_ids = CommitIssues.where(:issue_id => @issue, :project_id => @issue.project_id)
|
||||
unless exist_commit_ids.blank?
|
||||
exist_commit_ids = exist_commit_ids.map{|commit| commit.commit_id}
|
||||
commit_ids = commit_ids - exist_commit_ids
|
||||
end
|
||||
end
|
||||
commit_ids.each do |commit_id|
|
||||
CommitIssues.create(:commit_id => commit_id, :project_id => @issue.project_id, :issue_id => @issue.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update_user_issue_detail(issue, params)
|
||||
case params[:type]
|
||||
when "status"
|
||||
|
@ -794,7 +871,6 @@ class IssuesController < ApplicationController
|
|||
|
||||
# 更新issue状态时,journal表产生记录,返回@current_journal
|
||||
@issue.init_journal(User.current)
|
||||
|
||||
issue_attributes = params[:issue]
|
||||
if issue_attributes && params[:conflict_resolution]
|
||||
case params[:conflict_resolution]
|
||||
|
@ -809,18 +885,18 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
senduser = User.find(params[:issue][:assigned_to_id])
|
||||
|
||||
if senduser.id != User.current.id && @issue.assigned_to_id != params[:issue][:assigned_to_id].to_i
|
||||
issue_id = @issue.id
|
||||
issue_title = params[:issue][:subject]
|
||||
priority_id = params[:issue][:priority_id]
|
||||
ps = ProjectsService.new
|
||||
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
|
||||
if params[:action] == "update"
|
||||
senduser = User.find(params[:issue][:assigned_to_id])
|
||||
if senduser.id != User.current.id && @issue.assigned_to_id != params[:issue][:assigned_to_id].to_i
|
||||
issue_id = @issue.id
|
||||
issue_title = params[:issue][:subject]
|
||||
priority_id = params[:issue][:priority_id]
|
||||
ps = ProjectsService.new
|
||||
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
|
||||
end
|
||||
end
|
||||
|
||||
@issue.safe_attributes = issue_attributes
|
||||
|
||||
@priorities = IssuePriority.active
|
||||
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
||||
true
|
||||
|
|
|
@ -14,17 +14,17 @@ class MemosController < ApplicationController
|
|||
# layout 'base_memos'
|
||||
|
||||
def quote
|
||||
@subject = @memo.subject
|
||||
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
|
||||
|
||||
@content = "#{ll(Setting.default_language, :text_user_wrote, @memo.author)} <br/> "
|
||||
@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "</blockquote>\n\n<br/>"
|
||||
@content = "<blockquote style='word-break: break-all;word-wrap: break-word;'>" << @content
|
||||
#@content = "> #{ll(Setting.default_language, :text_user_wrote, @memo.author)}\n> "
|
||||
#@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
#@content_html = textilizable(@content)
|
||||
@temp = Memo.new
|
||||
@temp.content = @content
|
||||
# @subject = @memo.subject
|
||||
# @subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
|
||||
#
|
||||
# @content = "#{ll(Setting.default_language, :text_user_wrote, @memo.author)} <br/> "
|
||||
# @content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "</blockquote>\n\n<br/>"
|
||||
# @content = "<blockquote style='word-break: break-all;word-wrap: break-word;'>" << @content
|
||||
# #@content = "> #{ll(Setting.default_language, :text_user_wrote, @memo.author)}\n> "
|
||||
# #@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
# #@content_html = textilizable(@content)
|
||||
# @temp = Memo.new
|
||||
# @temp.content = @content
|
||||
end
|
||||
|
||||
def new
|
||||
|
@ -47,6 +47,8 @@ class MemosController < ApplicationController
|
|||
@quote = params[:quote]
|
||||
end
|
||||
|
||||
|
||||
|
||||
#unless params[:quote].nil?
|
||||
# @quote = params[:quote][:quote]
|
||||
#end
|
||||
|
@ -55,6 +57,10 @@ class MemosController < ApplicationController
|
|||
@memo.forum_id = params[:forum_id]
|
||||
@memo.author_id = User.current.id
|
||||
|
||||
if params[:memo][:parent_id]
|
||||
@memo.root_id = (Memo.find params[:memo][:parent_id]).root_id.nil? ? params[:memo][:parent_id].to_i : (Memo.find params[:memo][:parent_id]).root_id
|
||||
end
|
||||
|
||||
@memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads]))
|
||||
@memo.content = @quote + @memo.content
|
||||
respond_to do |format|
|
||||
|
@ -111,32 +117,37 @@ class MemosController < ApplicationController
|
|||
@memo = @memo.root # 取出楼主,防止输入帖子id让回复作为主贴显示
|
||||
@memo.update_column(:viewed_count, (@memo.viewed_count.to_i + 1))
|
||||
|
||||
page = params[:page]
|
||||
if params[:r] && page.nil?
|
||||
offset = @memo.children.where("#{Memo.table_name}.id < ?", params[:r].to_i).count
|
||||
page = 1 + offset / pre_count
|
||||
else
|
||||
|
||||
end
|
||||
@reply_count = @memo.children.count
|
||||
@reply_pages = Paginator.new @reply_count, pre_count, page
|
||||
@replies = @memo.children.
|
||||
includes(:author, :attachments).
|
||||
reorder("#{Memo.table_name}.created_at DESC").
|
||||
limit(@reply_pages.per_page).
|
||||
offset(@reply_pages.offset).
|
||||
all
|
||||
# page = params[:page]
|
||||
# if params[:r] && page.nil?
|
||||
# offset = @memo.children.where("#{Memo.table_name}.id < ?", params[:r].to_i).count
|
||||
# page = 1 + offset / pre_count
|
||||
# else
|
||||
# end
|
||||
|
||||
# @reply_count = @memo.children.count
|
||||
# @reply_pages = Paginator.new @reply_count, pre_count, page
|
||||
# @replies = @memo.children.
|
||||
# includes(:author, :attachments).
|
||||
# reorder("#{Memo.table_name}.created_at DESC").
|
||||
# limit(@reply_pages.per_page).
|
||||
# offset(@reply_pages.offset).
|
||||
# all
|
||||
|
||||
@replies = Memo.where("root_id = #{@memo.id}").reorder("created_at desc")
|
||||
@reply_count = @replies.count
|
||||
@replies = get_no_children_comments_all @replies
|
||||
@limit_count = @replies.count
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
@limit = 10
|
||||
@replies = @replies[@page * @limit..@page * @limit + 9]
|
||||
|
||||
@memo_new = Memo.new
|
||||
|
||||
@my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is null").count
|
||||
@my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is not null").count
|
||||
# @memo = Memo.find_by_id(params[:id])
|
||||
# @forum = Forum.find(params[:forum_id])
|
||||
# @replies = @memo.replies
|
||||
# @mome_new = Memo.new
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout=> 'base_forums'}#:layout=> 'base_forums',
|
||||
format.json { render json: @memo }
|
||||
format.xml { render xml: @memo }
|
||||
|
|
|
@ -42,7 +42,7 @@ class PollController < ApplicationController
|
|||
if has_commit_poll?(@poll.id,User.current.id) && (!User.current.admin?)
|
||||
redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id)
|
||||
else
|
||||
@can_edit_poll = (!has_commit_poll?(@poll.id,User.current.id)) || User.current.admin?
|
||||
@can_edit_poll = @poll.user != User.current && ((!has_commit_poll?(@poll.id,User.current.id)) || User.current.admin?)
|
||||
@percent = get_percent(@poll,User.current)
|
||||
@poll_questions = @poll.poll_questions
|
||||
@left_nav_type = 7
|
||||
|
@ -270,6 +270,7 @@ class PollController < ApplicationController
|
|||
|
||||
#发布问卷
|
||||
def publish_poll
|
||||
@index = params[:index]
|
||||
@poll.polls_status = 2
|
||||
@poll.published_at = Time.now
|
||||
@poll.show_result = params[:show_result].to_i if params[:show_result]
|
||||
|
@ -298,7 +299,8 @@ class PollController < ApplicationController
|
|||
def commit_answer
|
||||
pq = PollQuestion.find(params[:poll_question_id])
|
||||
if has_commit_poll?(@poll.id,User.current.id) && (!User.current.admin?)
|
||||
render :json => {:text => "failure"}
|
||||
@percent = get_percent(@poll,User.current)
|
||||
render :json => {:text => "ok" ,:percent => format("%.2f" ,@percent)}
|
||||
return
|
||||
end
|
||||
if pq.question_type == 1
|
||||
|
@ -508,6 +510,7 @@ class PollController < ApplicationController
|
|||
|
||||
#重新发布问卷
|
||||
def republish_poll
|
||||
@index = params[:index]
|
||||
@poll.poll_questions.each do |poll_question|
|
||||
poll_question.poll_votes.destroy_all
|
||||
end
|
||||
|
@ -530,6 +533,7 @@ class PollController < ApplicationController
|
|||
|
||||
#关闭问卷
|
||||
def close_poll
|
||||
@index = params[:index]
|
||||
@poll.polls_status = 3
|
||||
@poll.closed_at = Time.now
|
||||
if @poll.save
|
||||
|
@ -801,7 +805,7 @@ class PollController < ApplicationController
|
|||
current_index = 1
|
||||
poll_questions.each_with_index do |poll_question, i|
|
||||
if poll_question.question_type == 1 || poll_question.question_type == 2
|
||||
sheet1[count_row ,current_index] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| poll_vote.poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/ /," ") if poll_vote.poll_answer}.join(";")
|
||||
sheet1[count_row ,current_index] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| (poll_vote.vote_text.nil? ? poll_vote.poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/ /," ") : l(:label_other_answer) + " (" + poll_vote.vote_text.to_s + ") ") if poll_vote.poll_answer}.join(";")
|
||||
current_index += 1
|
||||
elsif poll_question.question_type == 3
|
||||
sheet1[count_row ,current_index] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| poll_vote.vote_text.gsub(/<\/?.*?>/,"").gsub(/ /," ")}.join(";")
|
||||
|
|
|
@ -543,12 +543,12 @@ class ProjectsController < ApplicationController
|
|||
@users -= watched.watcher_users if @watched
|
||||
end
|
||||
@watchers = @project.watcher_users
|
||||
@limit = 20
|
||||
@limit = 32
|
||||
@is_remote = true
|
||||
@watchers_count = @watchers.count
|
||||
@watcher_pages = Paginator.new @watchers_count, @limit, params['page'] || 1
|
||||
@offset ||= @watcher_pages.offset
|
||||
@watchers = paginateHelper @watchers, 20
|
||||
@watchers = paginateHelper @watchers, @limit
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -611,14 +611,14 @@ class ProjectsController < ApplicationController
|
|||
@applied_members = appied_project_members(@project, @members)
|
||||
end
|
||||
end
|
||||
@members = paginateHelper @members
|
||||
@members = paginateHelper @members, 32
|
||||
|
||||
end
|
||||
|
||||
def member_forked
|
||||
@forked_projects = Project.where(:forked_from_project_id => @project.id)
|
||||
|
||||
@limit = 20
|
||||
@limit = 32
|
||||
@is_remote = true
|
||||
@forked_count = @forked_projects.count
|
||||
@forked_pages = Paginator.new @forked_count, @limit, params['page'] || 1
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
# encoding: utf-8
|
||||
# 如果你对改模块任何功能不清楚,请不要随便改
|
||||
# @Hjqreturn
|
||||
class PullRequestsController < ApplicationController
|
||||
before_filter :authorize_logged
|
||||
before_filter :find_project_and_repository
|
||||
before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new,
|
||||
:update_pull_request, :pull_request_comments, :create_pull_request_comment, :compare_pull_request]
|
||||
before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new, :update_pull_request, :pull_request_comments, :create_pull_request_comment, :compare_pull_request]
|
||||
before_filter :member_allowed, :only => [:new, :create, :create_pull_request_comment]
|
||||
before_filter :manager_allowed, :only => [:accept_pull_request]
|
||||
|
||||
layout "base_projects"
|
||||
include PullRequestsHelper
|
||||
include ApplicationHelper
|
||||
|
||||
require 'ostruct'
|
||||
|
||||
# 返回json格式
|
||||
def index
|
||||
# project_menu_type 为了控制base顶部导航
|
||||
|
@ -34,12 +38,12 @@ class PullRequestsController < ApplicationController
|
|||
@requests_merged_count = merge_requests.select{|request| request.state == "merged"}.count
|
||||
@requests_closed_count = merge_requests.select{|request| request.state == "closed"}.count
|
||||
|
||||
@limit = 10
|
||||
@limit = 20
|
||||
@is_remote = true
|
||||
@count = type_count(type, @requests_opened_count, @requests_merged_count, @requests_closed_count)
|
||||
@pages = Paginator.new @count, @limit, params['page'] || 1
|
||||
@offset ||= @pages.offset
|
||||
@requests = paginateHelper @requests, 10
|
||||
@requests = paginateHelper @requests, 20
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
|
@ -92,13 +96,21 @@ class PullRequestsController < ApplicationController
|
|||
if compare_pull_request(source_branch, target_project_id, target_branch)
|
||||
# 如果传送了目标项目ID即向fork源项目发送请求
|
||||
# if params[:forked_project_id] && params[:source_project] == "forked_project_name"
|
||||
if params[:target_project_id].to_i != @project.id
|
||||
if !params[:target_project_id].blank? && params[:target_project_id].to_i != @project.id
|
||||
target_project_id = params[:forked_project_id].to_i
|
||||
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch, :target_project_id => target_project_id)
|
||||
@fork_project_name = Project.find(params[:target_project_id]).try(:name)
|
||||
@fork_pr_message = true if @fork_project_name
|
||||
# 向管理员发送消息
|
||||
send_message_to_manager(params[:target_project_id].to_i, request.id, 1)
|
||||
PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => target_project_id, :title => title)
|
||||
else
|
||||
@project_member = Member.where(:project_id => @project.id)
|
||||
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch)
|
||||
# 发送消息
|
||||
send_message_to_manager(@project.id, request.id, 1)
|
||||
# 创建Trustie数据
|
||||
PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => @project.id, :title => title)
|
||||
respond_to do |format|
|
||||
format.js{redirect_to project_pull_request_path(request.id, :project_id => @project.id)}
|
||||
end
|
||||
|
@ -109,8 +121,14 @@ class PullRequestsController < ApplicationController
|
|||
format.js{redirect_to new_project_pull_request_path(:show_tip => tip)}
|
||||
end
|
||||
end
|
||||
rescue Gitlab::Error::Forbidden => e
|
||||
@message = l(:label_pull_request_forbidden)
|
||||
rescue Gitlab::Error::Conflict => e
|
||||
@message = e.message
|
||||
@message = l(:label_pull_request_conflic)
|
||||
rescue Gitlab::Error::NotFound => e
|
||||
@message = l(:label_pull_request_notfound)
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -170,13 +188,21 @@ class PullRequestsController < ApplicationController
|
|||
# @return [Gitlab::ObjectifiedHash]
|
||||
def accept_pull_request
|
||||
begin
|
||||
status = @g.accept_merge_rquest(@project.gpid, params[:id], User.current.gid)
|
||||
PullRequest.create(:pull_request_id => status.id, :user_id => User.current.id, :gpid => status.project_id)
|
||||
@status = @g.accept_merge_rquest(@project.gpid, params[:id], User.current.gid)
|
||||
# 接受后,给用户发消息
|
||||
send_message_to_author(@project.id, @status.author.try(:username), params[:id], 2)
|
||||
|
||||
respond_to do |format|
|
||||
format.js{redirect_to project_pull_request_path(status.id, :project_id => @project.id)}
|
||||
format.js{redirect_to project_pull_request_path(@status.id, :project_id => @project.id)}
|
||||
end
|
||||
rescue Gitlab::Error::Forbidden => e
|
||||
@message = l(:label_pull_request_forbidden)
|
||||
rescue Gitlab::Error::DataNotAccepted => e
|
||||
@message = l(:label_pull_request_datanotaccepted)
|
||||
rescue Gitlab::Error::NotFound => e
|
||||
@message = l(:label_pull_request_notfound)
|
||||
rescue Exception => e
|
||||
@message = e.message
|
||||
puts e
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -196,7 +222,13 @@ class PullRequestsController < ApplicationController
|
|||
# @return [Gitlab::ObjectifiedHash] Information about updated merge request.
|
||||
def update_pull_request
|
||||
begin
|
||||
@g.update_merge_request(@project.gpid, params[:id], User.current.gid, :state_event => params[:state])
|
||||
request = @g.update_merge_request(@project.gpid, params[:id], User.current.gid, :state_event => params[:state])
|
||||
user = User.find_by_login(request.author.try(:username))
|
||||
status = params[:state] == "close" ? 4 : 3
|
||||
send_message_to_manager(@project.id, params[:id], status)
|
||||
if is_project_manager?(User.current.id, @project.id)
|
||||
send_message_to_author(@project.id, user.login, request.id, status)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html{redirect_to project_pull_request_path(params[:id], :project_id => @project.id)}
|
||||
end
|
||||
|
@ -270,23 +302,70 @@ class PullRequestsController < ApplicationController
|
|||
# id (required) - The ID of a project
|
||||
# merge_request_id (required) - The ID of MR
|
||||
def pull_request_changes
|
||||
begin
|
||||
@type = params[:type]
|
||||
@changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes)
|
||||
@changes_count = @changes.count
|
||||
|
||||
|
||||
|
||||
|
||||
@changes_count = @changes.count
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@count = @changes_count
|
||||
@pages = Paginator.new @count, @limit, params['page'] || 1
|
||||
@offset ||= @pages.offset
|
||||
@changes = paginateHelper @changes, 10
|
||||
rescue Exception => e
|
||||
@message = e.message
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
# post 相关操作权限控制
|
||||
# 项目管理员可操作
|
||||
def manager_allowed
|
||||
unless is_project_manager?(User.current.id, @project.id)
|
||||
return render_403
|
||||
end
|
||||
end
|
||||
|
||||
# 项目成员可操作
|
||||
def member_allowed
|
||||
unless User.current.member_of?(@project)
|
||||
return render_403
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def send_message user_id, project_id, pull_request_id
|
||||
ForgeMessage.create(:user_id => user_id, :project_id => project_id,
|
||||
:forge_message_id => pull_request_id, :forge_message_type => "PullRequest", :viewed => true)
|
||||
end
|
||||
|
||||
def send_message_to_manager project_id, pull_request_id, status
|
||||
project = Project.find(project_id)
|
||||
project.members.each do |member|
|
||||
if is_project_manager?(member.user_id, project_id) && User.current.id != member.user_id
|
||||
add_message(member.user_id, project_id, pull_request_id, status)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def send_message_to_author(project_id, user_login, request_id, status)
|
||||
user = get_user_by_login_and(user_login)
|
||||
if user.id != User.current.id
|
||||
add_message(user.id, project_id, request_id, status)
|
||||
end
|
||||
end
|
||||
|
||||
def add_message(user_id, project_id, pull_request_id, status)
|
||||
ForgeMessage.create(:user_id => user_id,
|
||||
:project_id => project_id,
|
||||
:forge_message_id => pull_request_id,
|
||||
:forge_message_type => "PullRequest",
|
||||
:viewed => true,
|
||||
:status => status,
|
||||
:operate_user_id => User.current.id,
|
||||
)
|
||||
end
|
||||
|
||||
def authorize_logged
|
||||
if !User.current.logged?
|
||||
redirect_to signin_path
|
||||
|
|
|
@ -49,6 +49,7 @@ class RepositoriesController < ApplicationController
|
|||
helper :repositories
|
||||
include RepositoriesHelper
|
||||
helper :project_score
|
||||
require 'ostruct'
|
||||
#@root_path = RepositoriesHelper::ROOT_PATH
|
||||
# require 'net/ssh'
|
||||
|
||||
|
@ -429,29 +430,21 @@ update
|
|||
|
||||
end
|
||||
|
||||
# 注:由于考虑到性能所以commits api每次返回20条记录
|
||||
def changes
|
||||
# 顶部导航
|
||||
@project_menu_type = 5
|
||||
|
||||
@entry = @repository.entry(@path, @rev)
|
||||
(show_error_not_found; return) unless @entry
|
||||
g = Gitlab.client
|
||||
limit = 20
|
||||
#每次页面的换回值从1开始,但是gitlab的页面查询是从0开始,所以先改变page的类型减一在改回来
|
||||
limit = 10
|
||||
# 每次页面的换回值从1开始,但是gitlab的页面查询是从0开始,所以先改变page的类型减一在改回来
|
||||
@commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s, ref_name:@rev)
|
||||
@commits_count = params[:commit_count].nil? ? @g.user_static(@project.gpid, :rev => @rev).count : params[:commit_count].to_i
|
||||
@commits_pages = Paginator.new @commits_count, limit, params[:page]
|
||||
# @offset ||= @commits_pages.offset
|
||||
# @commits = paginateHelper @commits, limit
|
||||
|
||||
#add by hx
|
||||
#rep_count = commit_count(@project)
|
||||
|
||||
#页面传递必须要str类型,但是Paginator的初始化必须要num类型,需要类型转化
|
||||
@commits_count = params[:commit_count].to_i
|
||||
@commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page]
|
||||
|
||||
@commit = g.commit(@project.gpid,@rev)
|
||||
# @changesets = g.get ("/projects/#{@project.gpid}/repository/commits?#{@rev}")
|
||||
#@changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i)
|
||||
@properties = @repository.properties(@path, @rev)
|
||||
@changeset = @repository.find_changeset_by_name(@rev)
|
||||
render :layout => 'base_projects'
|
||||
end
|
||||
|
||||
|
@ -580,8 +573,12 @@ update
|
|||
def commit_diff
|
||||
# 顶部导航
|
||||
@project_menu_type = 5
|
||||
|
||||
@commit_diff = @g.commit_diff(@project.gpid, params[:changeset])
|
||||
diff = ActiveSupport::JSON.decode(@commit_diff.to_json).first
|
||||
diff = OpenStruct.new(diff)
|
||||
@diff_file = Trustie::Gitlab::Diff::File.new(diff)
|
||||
|
||||
|
||||
@commit_details = @g.commit(@project.gpid, params[:changeset])
|
||||
render :layout => 'base_projects'
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ class StudentWorkController < ApplicationController
|
|||
require "base64"
|
||||
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex,
|
||||
:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,
|
||||
:search_course_students,:work_canrepeat,:add_group_member]
|
||||
:search_course_students,:work_canrepeat,:add_group_member,:change_project]
|
||||
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work,:revise_attachment]
|
||||
before_filter :member_of_course, :only => [:new, :create, :show, :add_score, :praise_student_work]
|
||||
before_filter :author_of_work, :only => [:edit, :update, :destroy]
|
||||
|
@ -351,6 +351,18 @@ class StudentWorkController < ApplicationController
|
|||
# 作品评论消息状态更新
|
||||
journals_for_teacher = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, "JournalsForMessage", 0)
|
||||
journals_for_teacher.update_all(:viewed => true)
|
||||
#匿评申诉消息状态更新
|
||||
if params[:show_work_id]
|
||||
work = @homework.student_works.where("id = #{params[:show_work_id].to_i}").first
|
||||
if work && !work.student_works_scores.where("reviewer_role = 3 and appeal_status != 0").blank?
|
||||
score_ids = "(" + work.student_works_scores.where("reviewer_role = 3 and appeal_status != 0").map{|score| score.id}.join(",") + ")"
|
||||
score_appeal_ids = StudentWorksScoresAppeal.where("student_works_score_id in #{score_ids}").blank? ? "(-1)" : "(" + StudentWorksScoresAppeal.where("student_works_score_id in #{score_ids}").map{|score_appeal| score_appeal.id}.join(",") + ")"
|
||||
anonymous_appeal =AppliedMessage.where("user_id =? and applied_id in #{score_appeal_ids} and applied_type =? and viewed =?", User.current.id, 'StudentWorksScoresAppeal', 0)
|
||||
anonymous_appeal.update_all(:viewed => true)
|
||||
appeal_message = CourseMessage.where("user_id =? and course_id =? and course_message_id in #{score_appeal_ids} and course_message_type =? and viewed =?", User.current.id, @homework.course, "StudentWorksScoresAppeal", 0)
|
||||
appeal_message.update_all(:viewed => true)
|
||||
end
|
||||
end
|
||||
##################################################################################################################
|
||||
@order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name].to_s.strip || "",params[:group]
|
||||
@homework_commons = @course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).order("created_at desc")
|
||||
|
@ -587,6 +599,14 @@ class StudentWorkController < ApplicationController
|
|||
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
|
||||
student_work.late_penalty = @homework.late_penalty
|
||||
student_work.work_status = 2
|
||||
# 缺评扣分
|
||||
if @homework.homework_detail_manual.no_anon_penalty == 0 && @homework.homework_detail_manual.comment_status == 3 && @homework.anonymous_comment == 0
|
||||
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
|
||||
all_dis_eva = StudentWorksEvaluationDistribution.where("student_work_id IN #{work_ids}")
|
||||
has_sw_count = all_dis_eva.select("distinct user_id").count
|
||||
anon_count = all_dis_eva.count / has_sw_count
|
||||
student_work.absence_penalty = @homework.homework_detail_manual.absence_penalty * anon_count
|
||||
end
|
||||
else
|
||||
student_work.late_penalty = 0
|
||||
student_work.work_status = 1
|
||||
|
@ -689,9 +709,23 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
#匿评申诉消息状态更新
|
||||
if @work && !@work.student_works_scores.where("reviewer_role = 3 and appeal_status != 0").blank?
|
||||
score_ids = "(" + @work.student_works_scores.where("reviewer_role = 3 and appeal_status != 0").map{|score| score.id}.join(",") + ")"
|
||||
score_appeal_ids = StudentWorksScoresAppeal.where("student_works_score_id in #{score_ids}").blank? ? "(-1)" : "(" + StudentWorksScoresAppeal.where("student_works_score_id in #{score_ids}").map{|score_appeal| score_appeal.id}.join(",") + ")"
|
||||
anonymous_appeal =AppliedMessage.where("user_id =? and applied_id in #{score_appeal_ids} and applied_type =? and viewed =?", User.current.id, 'StudentWorksScoresAppeal', 0)
|
||||
anonymous_appeal.update_all(:viewed => true)
|
||||
appeal_message = CourseMessage.where("user_id =? and course_id =? and course_message_id in #{score_appeal_ids} and course_message_type =? and viewed =?", User.current.id, @homework.course, "StudentWorksScoresAppeal", 0)
|
||||
appeal_message.update_all(:viewed => true)
|
||||
end
|
||||
|
||||
@score = student_work_score @work,User.current
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
@student_work_scores = student_work_score_record(@work)
|
||||
if @homework.homework_detail_manual.comment_status == 2 && !@is_teacher && @work.user != User.current
|
||||
@student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc")
|
||||
else
|
||||
@student_work_scores = student_work_score_record(@work)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -799,7 +833,7 @@ class StudentWorkController < ApplicationController
|
|||
@new_score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
|
||||
@new_score.user_id = User.current.id
|
||||
@new_score.student_work_id = @work.id
|
||||
if @is_teacher && @work.work_status == 0
|
||||
if @is_teacher && !@new_score.score.nil? && @work.work_status == 0
|
||||
@work.update_attributes(:work_status => 1, :commit_time => Time.now)
|
||||
end
|
||||
if User.current.admin?
|
||||
|
@ -841,7 +875,7 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
when 3 #学生评分 学生评分显示平均分
|
||||
#@work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
|
||||
stu_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 3 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
|
||||
stu_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 3 AND appeal_status != 3 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
|
||||
@work.student_score = stu_score.first.score.try(:round, 2).to_f
|
||||
if @is_group_leader
|
||||
add_score_to_member @work, @homework, @new_score
|
||||
|
@ -867,6 +901,7 @@ class StudentWorkController < ApplicationController
|
|||
@score = StudentWorksScore.find params[:score_id]
|
||||
@is_last = params[:is_last] == "true"
|
||||
@jour = @score.journals_for_messages.new(:user_id => User.current.id,:notes =>params[:message], :reply_id => 0)
|
||||
@show_real_name = User.current.allowed_to?(:as_teacher, @score.student_work.homework_common.course) || User.current.admin? || @score.reviewer_role != 3 || @jour.user == User.current
|
||||
if @jour.save
|
||||
@status = 1
|
||||
else
|
||||
|
@ -982,7 +1017,27 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
no_anon_penalty = params[:no_anon_penalty] ? 1 : 0
|
||||
unless (params[:anonymous_appeal].to_i == 1 && @homework.anonymous_appeal == 1 && params[:appeal_penalty].to_i == homework_detail_manual.appeal_penalty) || (params[:anonymous_appeal].to_i == 0 && @homework.anonymous_appeal == 0)
|
||||
if params[:anonymous_appeal].to_i == 0 && @homework.anonymous_appeal != 0
|
||||
homework_detail_manual.appeal_penalty = 0
|
||||
StudentWork.where("homework_common_id = #{@homework.id} and work_status != 0").each do |student_work|
|
||||
student_work.update_attribute('appeal_penalty', 0)
|
||||
end
|
||||
else
|
||||
homework_detail_manual.appeal_penalty = params[:appeal_penalty].to_i
|
||||
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
|
||||
@homework.student_works.where("work_status != 0").each do |student_work|
|
||||
appeal_penalty_count = student_work.user.student_works_scores.where("student_work_id IN #{work_ids} and appeal_status = 3").count
|
||||
student_work.appeal_penalty = appeal_penalty_count > 0 ? appeal_penalty_count * params[:appeal_penalty].to_i : 0
|
||||
student_work.save
|
||||
end
|
||||
end
|
||||
|
||||
@homework.anonymous_appeal = params[:anonymous_appeal].to_i
|
||||
homework_detail_manual.save if homework_detail_manual
|
||||
end
|
||||
|
||||
no_anon_penalty = params[:no_anon_penalty] ? 0 : 1
|
||||
if no_anon_penalty != homework_detail_manual.no_anon_penalty
|
||||
homework_detail_manual.no_anon_penalty = no_anon_penalty
|
||||
if homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值
|
||||
|
@ -1046,8 +1101,64 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def appeal_anonymous_score
|
||||
@student_work_score = StudentWorksScore.where("id = #{params[:score_id].to_i}").first
|
||||
@is_last = params[:is_last]
|
||||
if @student_work_score
|
||||
@student_work_score.update_column('appeal_status', 1)
|
||||
score_appeal = StudentWorksScoresAppeal.create(:user_id => User.current.id, :student_works_score_id => @student_work_score.id, :comment => params[:appeal][:comment], :appeal_status => 1)
|
||||
course = @student_work_score.student_work.homework_common.course
|
||||
course.members.includes(:member_roles).where("member_roles.role_id in (3, 7, 9)").each do |member|
|
||||
AppliedMessage.create(:user_id => member.user_id, :status => 0, :viewed => 0, :applied_id => score_appeal.id, :applied_type => 'StudentWorksScoresAppeal', :applied_user_id => User.current.id)
|
||||
end
|
||||
CourseMessage.create(:user_id => @student_work_score.user_id, :course_id => course.id, :viewed => false,:course_message_id=> score_appeal.id,:course_message_type=>'StudentWorksScoresAppeal',:status=>1)
|
||||
end
|
||||
@homework = @student_work_score.student_work.homework_common
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher, course) || User.current.admin?
|
||||
end
|
||||
|
||||
def alert_appeal_box
|
||||
@student_work_score = StudentWorksScore.where("id = #{params[:score_id].to_i}").first
|
||||
@is_last = params[:is_last]
|
||||
end
|
||||
|
||||
def deal_appeal_score
|
||||
@student_work_score = StudentWorksScore.where("id = #{params[:score_id].to_i}").first
|
||||
@is_last = params[:is_last]
|
||||
if @student_work_score
|
||||
@student_work_score.update_column('appeal_status', params[:status].to_i)
|
||||
score_appeal = @student_work_score.student_works_scores_appeal
|
||||
score_appeal.applied_messages.update_all(:status => params[:status].to_i == 2 ? 3 : (params[:status].to_i == 3 ? 1 : 2))
|
||||
if params[:status].to_i == 3 || params[:status].to_i == 4
|
||||
homework = @student_work_score.student_work.homework_common
|
||||
if params[:status].to_i == 3
|
||||
# 申诉成功后 扣匿评学生的违规匿评扣分
|
||||
sw = homework.student_works.where("user_id = #{@student_work_score.user_id}").first
|
||||
sw.update_attribute("appeal_penalty", homework.homework_detail_manual.appeal_penalty + sw.appeal_penalty)
|
||||
|
||||
# 申诉成功 重新计算申诉者的匿评分
|
||||
work = @student_work_score.student_work
|
||||
if work.student_works_scores.where("reviewer_role = 3 AND appeal_status != 3").count > 0
|
||||
stu_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@student_work_score.student_work_id} AND reviewer_role = 3 AND appeal_status != 3 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
|
||||
work.student_score = stu_score.first.score.try(:round, 2).to_f
|
||||
else
|
||||
work.student_score = nil
|
||||
end
|
||||
@student_work_score.student_work.save
|
||||
end
|
||||
course = homework.course
|
||||
CourseMessage.create(:user_id => @student_work_score.user_id, :course_id => course.id, :viewed => false,:course_message_id=> score_appeal.id,:course_message_type=>'StudentWorksScoresAppeal',:status=>params[:status].to_i,:apply_result =>User.current.id)
|
||||
CourseMessage.create(:user_id => score_appeal.user_id, :course_id => course.id, :viewed => false,:course_message_id=> score_appeal.id,:course_message_type=>'StudentWorksScoresAppeal',:status=>params[:status].to_i,:apply_result =>User.current.id)
|
||||
end
|
||||
@homework = @student_work_score.student_work.homework_common
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher, course) || User.current.admin?
|
||||
@work = @student_work_score.student_work
|
||||
@is_group_leader = !@work.student_work_projects.empty?
|
||||
end
|
||||
end
|
||||
|
||||
def forbidden_anonymous_comment
|
||||
@homework.update_column('anonymous_comment', 1)
|
||||
@homework.update_column('anonymous_comment', @homework.anonymous_comment == 0 ? 1 : 0)
|
||||
homework_detail_manual = @homework.homework_detail_manual
|
||||
homework_detail_programing = @homework.homework_detail_programing
|
||||
if homework_detail_programing
|
||||
|
@ -1079,6 +1190,7 @@ class StudentWorkController < ApplicationController
|
|||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
@homework = @work.homework_common
|
||||
end
|
||||
|
||||
def new_student_work_project
|
||||
|
@ -1125,6 +1237,26 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 作品更换关联项目
|
||||
def change_project
|
||||
work = @homework.student_works.has_committed.where("user_id = #{User.current.id}").first
|
||||
project = Project.find params[:projectName].to_i
|
||||
if work && project
|
||||
relate_user_ids = work.student_work_projects.map{|pro| pro.user_id}
|
||||
member_ids = project.members.map{|mem| mem.user_id}
|
||||
if (relate_user_ids & member_ids) == relate_user_ids
|
||||
work.student_work_projects.update_all(:project_id => params[:projectName].to_i)
|
||||
student_works = @homework.student_works.where("user_id in #{'(' + relate_user_ids.join(',') + ')'}")
|
||||
student_works.update_all(:project_id => params[:projectName].to_i)
|
||||
else
|
||||
@remain_user_ids = relate_user_ids - (relate_user_ids & member_ids)
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#查找课程的学生
|
||||
def search_course_students
|
||||
name = ""
|
||||
|
@ -1524,7 +1656,7 @@ class StudentWorkController < ApplicationController
|
|||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
if student_work.final_score
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
|
||||
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
|
||||
else
|
||||
student_work.work_score = nil
|
||||
|
@ -1543,7 +1675,7 @@ class StudentWorkController < ApplicationController
|
|||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
if student_work.final_score
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
|
||||
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
|
||||
else
|
||||
student_work.work_score = nil
|
||||
|
@ -1553,7 +1685,7 @@ class StudentWorkController < ApplicationController
|
|||
if homework.teacher_priority == 1 #教师优先
|
||||
if student_work.teacher_score
|
||||
student_work.final_score = student_work.teacher_score
|
||||
student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty
|
||||
student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
|
||||
else
|
||||
if student_work.teaching_asistant_score.nil? #教辅未评分
|
||||
if student_work.student_score.nil?
|
||||
|
@ -1583,7 +1715,7 @@ class StudentWorkController < ApplicationController
|
|||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
if student_work.final_score
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
|
||||
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
|
||||
else
|
||||
student_work.work_score = nil
|
||||
|
@ -1618,7 +1750,7 @@ class StudentWorkController < ApplicationController
|
|||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
if student_work.final_score
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
|
||||
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
|
||||
else
|
||||
student_work.work_score = nil
|
||||
|
|
|
@ -35,14 +35,14 @@ class UsersController < ApplicationController
|
|||
|
||||
#
|
||||
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
|
||||
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses,
|
||||
:user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
|
||||
:watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
||||
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list, :unfinished_homework_list,
|
||||
:unfinished_poll_list, :user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
|
||||
:anonymous_evaluation_list,:unfinished_test_list, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||
:unapproval_applied_list, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
||||
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,
|
||||
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
|
||||
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list,
|
||||
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues]
|
||||
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues, :course_community, :project_community]
|
||||
before_filter :auth_user_extension, only: :show
|
||||
#before_filter :rest_user_score, only: :show
|
||||
#before_filter :select_entry, only: :user_projects
|
||||
|
@ -72,7 +72,7 @@ class UsersController < ApplicationController
|
|||
helper :user_score
|
||||
helper :journals
|
||||
|
||||
# added by liuping 关注
|
||||
# added by liuping 关注
|
||||
|
||||
helper :watchers
|
||||
helper :activities
|
||||
|
@ -90,6 +90,7 @@ class UsersController < ApplicationController
|
|||
# order 排序条件
|
||||
# subject 主题:搜索用(注意:搜索和列表调用同一方法,通过参数或者remote区分)
|
||||
def user_issues
|
||||
@type = params[:type] unless params[:type].nil?
|
||||
@subject = params[:subject]
|
||||
# author_id = params[:author_id]
|
||||
params[:assigned_to_id].to_i == 0 ? @assigned_to = nil : @assigned_to = params[:assigned_to_id].to_i
|
||||
|
@ -111,8 +112,8 @@ class UsersController < ApplicationController
|
|||
else
|
||||
if @assigned_to.nil?
|
||||
if author_id.nil?
|
||||
@issues = Issue.where("(author_id =? or assigned_to_id =? ) and project_id=? and subject like ?",
|
||||
(author_id ? author_id : @user.id) , @user.id, @project_id, "%#{@subject}%").order('updated_on desc')
|
||||
@issues = Issue.where("(author_id =? or assigned_to_id =? ) and project_id=? and subject like ?",
|
||||
(author_id ? author_id : @user.id) , @user.id, @project_id, "%#{@subject}%").order('updated_on desc')
|
||||
else
|
||||
@issues = Issue.where("author_id =? and project_id=? and subject like ?",
|
||||
author_id , @project_id, "%#{@subject}%").order('updated_on desc')
|
||||
|
@ -127,14 +128,23 @@ class UsersController < ApplicationController
|
|||
@issues_author_count = Issue.where("author_id =? and subject like ?", @user.id, "%#{@subject}%").count
|
||||
@issue_open_count = Issue.where(" (author_id =? or assigned_to_id =?) and status_id in (1,2,3,4,6)", (author_id ? author_id : @user.id) , @user).count
|
||||
@issue_close_count = Issue.where("(author_id =? or assigned_to_id =?) and status_id = 5", (author_id ? author_id : @user.id) , @user.id).count
|
||||
|
||||
# 导出excel的issues
|
||||
@excel_issues = @issues
|
||||
|
||||
@issue_count = @issues.count
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
|
||||
@offset ||= @issue_pages.offset
|
||||
@issues = paginateHelper @issues, @limit
|
||||
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'static_base'}
|
||||
format.xls{
|
||||
filename = "我的_#{l(:label_issue_list_xls)}.xls"
|
||||
send_data(issue_list_xls(@excel_issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
|
||||
}
|
||||
format.api
|
||||
format.js
|
||||
end
|
||||
|
@ -155,6 +165,8 @@ class UsersController < ApplicationController
|
|||
@comment = Comment.find params[:comment].to_i
|
||||
when 'Journal','is_project_issue'
|
||||
@comment = Journal.find params[:comment].to_i
|
||||
when 'Memo'
|
||||
@comment = Memo.find params[:comment].to_i
|
||||
end
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@parent_id = params[:parent_id] if params[:parent_id]
|
||||
|
@ -299,6 +311,15 @@ class UsersController < ApplicationController
|
|||
@root.update_column('updated_at', Time.now)
|
||||
@count = @root.journals_for_messages.count
|
||||
@comments = @root.journals_for_messages.reorder("created_on desc").limit(3)
|
||||
when 'Memo'
|
||||
@root = reply.root
|
||||
comment = Memo.new
|
||||
comment.author = User.current
|
||||
comment.forum = reply.forum
|
||||
comment.content = params[:reply_message]
|
||||
comment.subject = "#{@root.subject}"
|
||||
comment.root_id = reply.root_id
|
||||
reply.children << comment
|
||||
end
|
||||
update_course_activity(@root.class.to_s,@root.id)
|
||||
update_user_activity(@root.class.to_s,@root.id)
|
||||
|
@ -413,8 +434,10 @@ class UsersController < ApplicationController
|
|||
render_404
|
||||
return
|
||||
end
|
||||
@message_alls = paginateHelper @message_alls,25
|
||||
|
||||
@message_alls = paginateHelper @message_alls, 25
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html{render :layout=>'new_base_user'}
|
||||
end
|
||||
end
|
||||
|
@ -515,7 +538,7 @@ class UsersController < ApplicationController
|
|||
#将角色改为老师或者教辅
|
||||
member = Course.find(@msg.course_id).members.where(:user_id=>apply_user.id).all[0]
|
||||
member.role_ids = integer_ids
|
||||
#删除为学生的记录
|
||||
#删除为学生的记录
|
||||
unless member.role_ids.include?(10)
|
||||
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,@msg.course_id)
|
||||
joined.each do |join|
|
||||
|
@ -936,15 +959,15 @@ class UsersController < ApplicationController
|
|||
visible_course = Course.where("is_public = 1 && is_delete = 0")
|
||||
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
|
||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
|
||||
# elsif params[:type] == "3" #申请题库
|
||||
# none_visible_course = Course.where("is_delete = 1")
|
||||
# none_visible_course_ids = none_visible_course.empty? ? "(-1)" : "(" + none_visible_course.map{|course| course.id}.join(",") + ")"
|
||||
# #apply_homeworks = ApplyHomework.where("user_id = ?",@user.id).order('created_at desc')
|
||||
# #homework_ids = apply_homeworks.empty? ? "(-1)" : "(" + apply_homeworks.map{|ah| ah.homework_common_id}.join(",") + ")"
|
||||
# #@homeworks = HomeworkCommon.where("id in #{homework_ids} and course_id not in #{none_visible_course_ids}")
|
||||
#
|
||||
# sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN apply_homeworks as ah ON homework_commons.id = ah.homework_common_id where ah.user_id = #{@user.id} and homework_commons.course_id not in #{none_visible_course_ids} order by ah.created_at desc"
|
||||
# @homeworks = HomeworkCommon.find_by_sql(sql)
|
||||
# elsif params[:type] == "3" #申请题库
|
||||
# none_visible_course = Course.where("is_delete = 1")
|
||||
# none_visible_course_ids = none_visible_course.empty? ? "(-1)" : "(" + none_visible_course.map{|course| course.id}.join(",") + ")"
|
||||
# #apply_homeworks = ApplyHomework.where("user_id = ?",@user.id).order('created_at desc')
|
||||
# #homework_ids = apply_homeworks.empty? ? "(-1)" : "(" + apply_homeworks.map{|ah| ah.homework_common_id}.join(",") + ")"
|
||||
# #@homeworks = HomeworkCommon.where("id in #{homework_ids} and course_id not in #{none_visible_course_ids}")
|
||||
#
|
||||
# sql = "SELECT homework_commons.* FROM homework_commons INNER JOIN apply_homeworks as ah ON homework_commons.id = ah.homework_common_id where ah.user_id = #{@user.id} and homework_commons.course_id not in #{none_visible_course_ids} order by ah.created_at desc"
|
||||
# @homeworks = HomeworkCommon.find_by_sql(sql)
|
||||
end
|
||||
if params[:property]
|
||||
all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")"
|
||||
|
@ -1166,10 +1189,18 @@ class UsersController < ApplicationController
|
|||
student_work = StudentWork.where(homework_common_id: homework.id, user_id: User.current.id).first
|
||||
if student_work
|
||||
|
||||
#提交作品时,计算是否迟交
|
||||
# 提交作品时,计算是否迟交
|
||||
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
|
||||
student_work.late_penalty = homework.late_penalty
|
||||
student_work.work_status = 2
|
||||
# 缺评扣分
|
||||
if homework.homework_detail_manual.no_anon_penalty == 0 && homework.homework_detail_manual.comment_status == 3 && homework.anonymous_comment == 0
|
||||
work_ids = "(" + homework.student_works.has_committed.map(&:id).join(",") + ")"
|
||||
all_dis_eva = StudentWorksEvaluationDistribution.where("student_work_id IN #{work_ids}")
|
||||
has_sw_count = all_dis_eva.select("distinct user_id").count
|
||||
anon_count = all_dis_eva.count / has_sw_count
|
||||
student_work.absence_penalty = homework.homework_detail_manual.absence_penalty * anon_count
|
||||
end
|
||||
else
|
||||
student_work.late_penalty = 0
|
||||
student_work.work_status = 1
|
||||
|
@ -1463,13 +1494,13 @@ class UsersController < ApplicationController
|
|||
@jour_count = jours.count
|
||||
@jour = jours.limit(10).offset(@page * 10)
|
||||
@type = params[:type]
|
||||
if User.current == @user
|
||||
@jour.update_all(:is_readed => true, :status => false)
|
||||
@jour.each do |journal|
|
||||
# fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
|
||||
journal.delay.set_children_readed_delay
|
||||
end
|
||||
end
|
||||
# if User.current == @user
|
||||
# @jour.update_all(:is_readed => true, :status => false)
|
||||
# @jour.each do |journal|
|
||||
# # fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
|
||||
# journal.delay.set_children_readed_delay
|
||||
# end
|
||||
# end
|
||||
@state = false
|
||||
render :layout=>'new_base_user'
|
||||
end
|
||||
|
@ -1786,22 +1817,311 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
#更新用户申请成为课程老师或教辅消息的状态
|
||||
if is_current_user
|
||||
# 自己的主页显示消息
|
||||
# 系统消息为管理员发送,我的消息中包含有系统消息
|
||||
@message_alls = []
|
||||
messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" , @user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc")
|
||||
messages.each do |message_all|
|
||||
mess = message_all.message
|
||||
unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1)
|
||||
if (message_all.message_type =="SystemMessage" && !many_days_ago(mess.created_at, 30))
|
||||
next
|
||||
else
|
||||
@message_alls << mess
|
||||
end
|
||||
end
|
||||
end
|
||||
@message_count = @message_alls.count
|
||||
@message_alls = paginateHelper @message_alls, 20
|
||||
@unsolved_issues_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).order("updated_on desc").count
|
||||
# 用户待完成的作业
|
||||
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
|
||||
homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Date.today}'")
|
||||
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
|
||||
student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0")
|
||||
@unfinished_homework_count = homeworks.count - student_works.count
|
||||
# 用户待完成的测验
|
||||
exercises = Exercise.where("course_id in #{my_course_ids} and exercise_status = 2")
|
||||
exercise_ids = exercises.blank? ? "(-1)" : "(" + exercises.map{|ex| ex.id}.join(",") + ")"
|
||||
exercise_users = ExerciseUser.where("user_id = #{@user.id} and exercise_id in #{exercise_ids}")
|
||||
@unfinished_test_count = exercises.count - exercise_users.count
|
||||
# 用户待完成的问卷
|
||||
polls = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2")
|
||||
poll_ids = polls.blank? ? "(-1)" : "(" + polls.map{|poll| poll.id}.join(",") + ")"
|
||||
poll_users = PollUser.where("user_id = #{@user.id} and poll_id in #{poll_ids}")
|
||||
@unfinished_poll_count = polls.count - poll_users.count
|
||||
# 用户待匿评的作品
|
||||
homeworks = HomeworkCommon.includes(:homework_detail_manual).where("homework_commons.course_id in #{my_course_ids} and homework_detail_manuals.comment_status in (1,2)")
|
||||
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
|
||||
student_work_scores = @user.student_works_scores.where("reviewer_role = 3")
|
||||
anonymous_evaluation_ids = student_work_scores.blank? ? "(-1)" : "(" + student_work_scores.map{|st| st.student_work_id}.join(",") + ")"
|
||||
unfinished_evaluations = @user.student_works_evaluation_distributions.where("student_work_id not in #{anonymous_evaluation_ids}")
|
||||
unfinished_evaluations_work_ids = unfinished_evaluations.blank? ? "(-1)" : "(" + unfinished_evaluations.map{|st| st.student_work_id}.join(",") + ")"
|
||||
@anonymous_evaluation_count = StudentWork.where("student_works.id in #{unfinished_evaluations_work_ids} and homework_common_id in #{homework_ids}").count
|
||||
# 待评阅的作业 暂不做
|
||||
# @unreview_homework = 1
|
||||
|
||||
# 待审批的申请
|
||||
@applied_message_alls = []
|
||||
applied_messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["OrgMessage", "AppliedMessage", "CourseMessage"]).includes(:message)
|
||||
applied_messages_all.each do |message_all|
|
||||
mess = message_all.message
|
||||
if !mess.nil?
|
||||
if (message_all.message_type == "OrgMessage")
|
||||
if mess.message_type == "ApplySubdomain" && OrgMessage.where(:organization_id => mess.organization_id, :message_type => "AgreeApplySubdomain").count == 0
|
||||
@applied_message_alls << mess
|
||||
end
|
||||
elsif (message_all.message_type == "AppliedMessage" )
|
||||
if (mess.applied_type == "StudentWorksScoresAppeal" && mess.status == 0) || (mess.applied_type == "AppliedProject" && mess.status == 1) || ( mess.applied_type == "ApplyAddSchools" && ApplyAddSchools.where(:school_id => mess.applied_id, :status => 0).count != 0 )
|
||||
@applied_message_alls << mess
|
||||
end
|
||||
elsif message_all.message_type == "CourseMessage"
|
||||
if mess.course_message_type == "JoinCourseRequest" && mess.status == 0
|
||||
@applied_message_alls << mess
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@applied_message_alls_count = @applied_message_alls.count
|
||||
# org_applied_messages = MessageAll.where(:message_type => "OrgMessage").includes(:message).order("created_at desc")
|
||||
# org_applied_messages = org_applied_messages.message.map{|message| message.message_type == "ApplySubdomain" and OrgMessage.where(:organization_id => message.organization_id, :message_type => "AgreeApplySubdomain").count == 0}.length
|
||||
# project_message_applied_count = AppliedMessage.where(:user_id => @user.id, :message_type => "AppliedProject", :status => 1)
|
||||
# school_message_applied_count = AppliedMessage.where(:user_id => @user.id, :message_type => "ApplyAddSchools", :status => 0)
|
||||
# course_message_applied_count = CourseMessage.where(:message_type => "JoinCourse", :satus => 0)
|
||||
# @applied_message_count = org_message_applied_count + project_message_applied_count + school_message_applied_count + course_message_applied_count
|
||||
else
|
||||
# 看别人的主页显示动态
|
||||
#更新用户申请成为课程老师或教辅消息的状态
|
||||
if params[:course_id] != nil
|
||||
join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",
|
||||
params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
|
||||
join_course_messages.update_all(:viewed => true)
|
||||
end
|
||||
shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
|
||||
shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
user_project_ids = (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
|
||||
user_course_ids = (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
|
||||
course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
|
||||
project_types = "('Message','Issue','Project')"
|
||||
principal_types = "JournalsForMessage"
|
||||
container_type = ''
|
||||
act_type = ''
|
||||
# 他的动态
|
||||
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
|
||||
if params[:type].present?
|
||||
case params[:type]
|
||||
when "course_homework"
|
||||
container_type = 'Course'
|
||||
act_type = 'HomeworkCommon'
|
||||
when "course_news"
|
||||
container_type = 'Course'
|
||||
act_type = 'News'
|
||||
when "course_message"
|
||||
container_type = 'Course'
|
||||
act_type = 'Message'
|
||||
when "course_poll"
|
||||
container_type = 'Course'
|
||||
act_type = 'Poll'
|
||||
when "course_journals"
|
||||
container_type = 'Course'
|
||||
act_type = 'JournalsForMessage'
|
||||
when "project_issue"
|
||||
container_type = 'Project'
|
||||
act_type = 'Issue'
|
||||
when "project_message"
|
||||
container_type = 'Project'
|
||||
act_type = 'Message'
|
||||
when "user_journals"
|
||||
container_type = 'Principal'
|
||||
act_type = 'JournalsForMessage'
|
||||
when "current_user"
|
||||
container_type = 'Principal'
|
||||
act_type = 'Principal'
|
||||
when "all"
|
||||
container_type = 'all'
|
||||
act_type = 'all'
|
||||
end
|
||||
end
|
||||
if container_type != '' && container_type != 'all'
|
||||
if container_type == 'Course'
|
||||
sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
|
||||
elsif container_type == 'Project'
|
||||
sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
|
||||
elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
|
||||
sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
|
||||
elsif container_type == 'Principal' && act_type == 'Principal'
|
||||
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
|
||||
end
|
||||
if User.current != @user
|
||||
sql += " and user_id = #{@user.id}"
|
||||
end
|
||||
else
|
||||
if User.current != @user
|
||||
blog_ids = "("+@user.blog.id.to_s+")"
|
||||
else
|
||||
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
||||
end
|
||||
sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
||||
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
|
||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
|
||||
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
|
||||
if container_type != 'all' && User.current != @user
|
||||
sql = "user_id = #{@user.id} and(" + sql + ")"
|
||||
end
|
||||
end
|
||||
@user_activities_count = UserActivity.where("#{sql}").order('updated_at desc').count
|
||||
@user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
@type = params[:type]
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'new_base_user'}
|
||||
end
|
||||
end
|
||||
|
||||
# 待解决的Issue
|
||||
def unsolved_issues_list
|
||||
@unsolved_issues = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 4, 6]).includes(:author, :project).order("updated_on desc")
|
||||
@unsolved_issues_count = @unsolved_issues.count
|
||||
@limit = 20
|
||||
@is_remote = true
|
||||
@unsolved_issues_pages = Paginator.new @unsolved_issues_count, @limit, params['page'] || 1
|
||||
@offset ||= @unsolved_issues_pages.offset
|
||||
@unsolved_issues = paginateHelper @unsolved_issues, @limit
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 待完成的作业
|
||||
def unfinished_homework_list
|
||||
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
|
||||
homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Date.today}'")
|
||||
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
|
||||
student_works = StudentWork.where("user_id = #{@user.id} and homework_common_id in #{homework_ids} and work_status != 0")
|
||||
finished_works_id = student_works.blank? ? "(-1)" : "(" + student_works.map{ |sw| sw.homework_common_id.to_i }.join(",") + ")"
|
||||
@unfinished_homeworks = HomeworkCommon.where("course_id in #{my_course_ids} and publish_time <= '#{Date.today}' and id not in #{finished_works_id}").order("updated_at desc")
|
||||
@unfinished_homeworks_count = @unfinished_homeworks.count
|
||||
@limit = 20
|
||||
@unfinished_homework_pages = Paginator.new @unfinished_homeworks_count, @limit, params['page'] || 1
|
||||
@offset ||= @unfinished_homework_pages.offset
|
||||
@unfinished_homeworks = paginateHelper @unfinished_homeworks, @limit
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 待完成的测验
|
||||
def unfinished_test_list
|
||||
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
|
||||
exercises = Exercise.where("course_id in #{my_course_ids} and exercise_status = 2")
|
||||
exercise_ids = exercises.blank? ? "(-1)" : "(" + exercises.map{|ex| ex.id}.join(",") + ")"
|
||||
exercise_users = ExerciseUser.where("user_id = #{@user.id} and exercise_id in #{exercise_ids}")
|
||||
finished_test_ids = exercise_users.blank? ? "(-1)" : "(" + exercise_users.map{|eu| eu.exercise_id }.join(",") + ")"
|
||||
@unfinished_test = Exercise.where("course_id in #{my_course_ids} and exercise_status = 2 and id not in #{finished_test_ids}")
|
||||
@unfinished_test_count = @unfinished_test.count
|
||||
@limit = 20
|
||||
@unfinished_test_pages = Paginator.new @unfinished_test_count, @limit, params['page'] || 1
|
||||
@offset ||= @unfinished_test_pages.offset
|
||||
@unfinished_test = paginateHelper @unfinished_test, @limit
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 待完成的问卷
|
||||
def unfinished_poll_list
|
||||
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
|
||||
polls = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2")
|
||||
poll_ids = polls.blank? ? "(-1)" : "(" + polls.map{|poll| poll.id}.join(",") + ")"
|
||||
poll_users = PollUser.where("user_id = #{@user.id} and poll_id in #{poll_ids}")
|
||||
finished_poll_ids = poll_users.blank? ? "(-1)" : "(" + poll_users.map{|pu| pu.poll_id }.join(",") + ")"
|
||||
@unfinished_poll = Poll.where("polls_type = 'Course' and polls_group_id in #{my_course_ids} and polls_status = 2 and id not in #{finished_poll_ids}").order("updated_at desc")
|
||||
@unfinished_poll_count = @unfinished_poll.count
|
||||
@limit = 20
|
||||
@unfinished_poll_pages = Paginator.new @unfinished_poll_count, @limit, params['page'] || 1
|
||||
@offset ||= @unfinished_poll_pages.offset
|
||||
@unfinished_poll = paginateHelper @unfinished_poll, @limit
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 待匿评的作业
|
||||
def anonymous_evaluation_list
|
||||
my_course_ids = StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").blank? ? "(-1)" : "(" + StudentsForCourse.includes(:course).where("student_id = #{@user.id} and courses.is_delete = 0").map{|sc| sc.course_id}.join(",") + ")"
|
||||
homeworks = HomeworkCommon.includes(:homework_detail_manual).where("homework_commons.course_id in #{my_course_ids} and homework_detail_manuals.comment_status in (1,2)")
|
||||
homework_ids = homeworks.blank? ? "(-1)" : "(" + homeworks.map{|homework| homework.id}.join(",") + ")"
|
||||
student_work_scores = @user.student_works_scores.where("reviewer_role = 3")
|
||||
anonymous_evaluation_ids = student_work_scores.blank? ? "(-1)" : "(" + student_work_scores.map{|st| st.student_work_id}.join(",") + ")"
|
||||
unfinished_evaluations = @user.student_works_evaluation_distributions.where("student_work_id not in #{anonymous_evaluation_ids}")
|
||||
unfinished_evaluations_work_ids = unfinished_evaluations.blank? ? "(-1)" : "(" + unfinished_evaluations.map{|st| st.student_work_id}.join(",") + ")"
|
||||
homework_ids = StudentWork.where("id in #{unfinished_evaluations_work_ids} and homework_common_id in #{homework_ids}").blank? ? "(-1)" : "(" + StudentWork.where("id in #{unfinished_evaluations_work_ids} and homework_common_id in #{homework_ids}").map{|st| st.homework_common_id}.join(",") + ")"
|
||||
@anonymous_evaluation = HomeworkCommon.where("homework_commons.id in #{homework_ids}")
|
||||
@anonymous_evaluation_count = @anonymous_evaluation.count
|
||||
@limit = 20
|
||||
@anonymous_evaluation_pages = Paginator.new @anonymous_evaluation_count, @limit, params['page'] || 1
|
||||
@offset ||= @anonymous_evaluation_pages.offset
|
||||
@anonymous_evaluation = paginateHelper @anonymous_evaluation, @limit
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 待审批的申请
|
||||
def unapproval_applied_list
|
||||
@message_alls = []
|
||||
# messages_all = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc")
|
||||
messages_all = MessageAll.where(:user_id => @user.id, :message_type => ["OrgMessage", "AppliedMessage", "CourseMessage"]).includes(:message).order("created_at desc")
|
||||
messages_all.each do |message_all|
|
||||
mess = message_all.message
|
||||
if !mess.nil?
|
||||
if (message_all.message_type == "OrgMessage")
|
||||
if mess.message_type == "ApplySubdomain" && OrgMessage.where(:organization_id => mess.organization_id, :message_type => "AgreeApplySubdomain").count == 0
|
||||
@message_alls << mess
|
||||
end
|
||||
elsif (message_all.message_type == "AppliedMessage" )
|
||||
if (mess.applied_type == "StudentWorksScoresAppeal" && mess.status == 0) || (mess.applied_type == "AppliedProject" && mess.status == 1) || ( mess.applied_type == "ApplyAddSchools" && ApplyAddSchools.where(:school_id => mess.applied_id, :status => 0).count != 0 )
|
||||
@message_alls << mess
|
||||
end
|
||||
elsif message_all.message_type == "CourseMessage"
|
||||
if mess.course_message_type == "JoinCourseRequest" && mess.status == 0
|
||||
@message_alls << mess
|
||||
end
|
||||
=begin
|
||||
elsif message_all.message_type == "ForgeMessage"
|
||||
if mess.forge_message_type == "PullRequest" && PullRequest.where(:forge_message_id => mess.forge_message_id, :status =>0 )
|
||||
@message_alls << mess
|
||||
end
|
||||
=end
|
||||
end
|
||||
end
|
||||
end
|
||||
@message_count = @message_alls.count
|
||||
@message_alls = paginateHelper @message_alls, 20
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 课程社区
|
||||
def course_community
|
||||
if params[:course_id] != nil
|
||||
join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",
|
||||
params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
|
||||
join_course_messages.update_all(:viewed => true)
|
||||
end
|
||||
shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
|
||||
shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
user_project_ids = (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
|
||||
user_course_ids = (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
|
||||
course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
|
||||
project_types = "('Message','Issue','Project')"
|
||||
principal_types = "JournalsForMessage"
|
||||
container_type = ''
|
||||
act_type = ''
|
||||
|
||||
if params[:type].present?
|
||||
case params[:type]
|
||||
when "course_homework"
|
||||
|
@ -1819,15 +2139,6 @@ class UsersController < ApplicationController
|
|||
when "course_journals"
|
||||
container_type = 'Course'
|
||||
act_type = 'JournalsForMessage'
|
||||
when "project_issue"
|
||||
container_type = 'Project'
|
||||
act_type = 'Issue'
|
||||
when "project_message"
|
||||
container_type = 'Project'
|
||||
act_type = 'Message'
|
||||
when "user_journals"
|
||||
container_type = 'Principal'
|
||||
act_type = 'JournalsForMessage'
|
||||
when "current_user"
|
||||
container_type = 'Principal'
|
||||
act_type = 'Principal'
|
||||
|
@ -1839,36 +2150,77 @@ class UsersController < ApplicationController
|
|||
if container_type != '' && container_type != 'all'
|
||||
if container_type == 'Course'
|
||||
sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
|
||||
elsif container_type == 'Project'
|
||||
sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
|
||||
elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
|
||||
sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
|
||||
elsif container_type == 'Principal' && act_type == 'Principal'
|
||||
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
|
||||
sql = "user_id = #{@user.id} and (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})"
|
||||
end
|
||||
if User.current != @user
|
||||
sql += " and user_id = #{@user.id}"
|
||||
end
|
||||
else
|
||||
if User.current != @user
|
||||
blog_ids = "("+@user.blog.id.to_s+")"
|
||||
else
|
||||
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
||||
end
|
||||
sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
||||
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
|
||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
|
||||
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
|
||||
sql = "(container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})" +
|
||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) "
|
||||
if container_type != 'all' && User.current != @user
|
||||
sql = "user_id = #{@user.id} and(" + sql + ")"
|
||||
end
|
||||
end
|
||||
|
||||
@user_activities_count = UserActivity.where("#{sql}").order('updated_at desc').count
|
||||
@user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
@type = params[:type]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'new_base_user'}
|
||||
format.html {render :layout => 'base_course_community'}
|
||||
end
|
||||
end
|
||||
|
||||
# 项目社区
|
||||
def project_community
|
||||
# 看别人的主页显示动态
|
||||
#更新用户申请成为课程老师或教辅消息的状态
|
||||
shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
user_project_ids = (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.favorite_projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
|
||||
project_types = "('Message','Issue','Project')"
|
||||
principal_types = "JournalsForMessage"
|
||||
container_type = ''
|
||||
act_type = ''
|
||||
if params[:type].present?
|
||||
case params[:type]
|
||||
when "project_issue"
|
||||
container_type = 'Project'
|
||||
act_type = 'Issue'
|
||||
when "project_message"
|
||||
container_type = 'Project'
|
||||
act_type = 'Message'
|
||||
when "current_user"
|
||||
container_type = 'Principal'
|
||||
act_type = 'Principal'
|
||||
when "all"
|
||||
container_type = 'all'
|
||||
act_type = 'all'
|
||||
end
|
||||
end
|
||||
if container_type != '' && container_type != 'all'
|
||||
if container_type == 'Project'
|
||||
sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
|
||||
elsif container_type == 'Principal' && act_type == 'Principal'
|
||||
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}))"
|
||||
end
|
||||
if User.current != @user
|
||||
sql += " and user_id = #{@user.id}"
|
||||
end
|
||||
else
|
||||
sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) "
|
||||
if container_type != 'all' && User.current != @user
|
||||
sql = "user_id = #{@user.id} and(" + sql + ")"
|
||||
end
|
||||
end
|
||||
@user_activities_count = UserActivity.where("#{sql}").order('updated_at desc').count
|
||||
@user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
@type = params[:type]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'base_project_community'}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -2492,7 +2844,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
@ori = ori
|
||||
end
|
||||
# 发送多个资源
|
||||
# 发送多个资源
|
||||
elsif params[:send_ids].present?
|
||||
send_ids = params[:send_ids].split(",")
|
||||
project_ids = params[:projects_ids]
|
||||
|
@ -2768,7 +3120,7 @@ class UsersController < ApplicationController
|
|||
project_ids.each do |project_id|
|
||||
project = Project.find(project_id)
|
||||
if project.news.map(&:id).exclude?(news.id)
|
||||
# message = Message.create(:board_id => project.boards.first.id, :subject => news.title, :content => news.description, :author_id => User.current.id)
|
||||
# message = Message.create(:board_id => project.boards.first.id, :subject => news.title, :content => news.description, :author_id => User.current.id)
|
||||
message = News.create(:project_id => project.id, :title => news.title, :summary => news.summary, :description => news.description, :author_id => User.current.id, :created_on => Time.now )
|
||||
# record forward to table forwards if new record is valid
|
||||
if message.valid?
|
||||
|
@ -3519,7 +3871,7 @@ class UsersController < ApplicationController
|
|||
# @syllabus = paginateHelper @syllabus,@limit
|
||||
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'new_base_user'}
|
||||
format.html {render :layout => 'base_course_community'}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -3654,7 +4006,7 @@ class UsersController < ApplicationController
|
|||
#limit = 5
|
||||
|
||||
# 用户的所有项目
|
||||
# @my_projects = @user.projects.visible.where("projects.user_id = #{@user.id}").select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS updatetime").order("updatetime DESC")
|
||||
# @my_projects = @user.projects.visible.where("projects.user_id = #{@user.id}").select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS updatetime").order("updatetime DESC")
|
||||
@my_projects = @user.projects.where("projects.user_id = #{@user.id}").select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS updatetime").order("updatetime DESC")
|
||||
@my_projects_count = @my_projects.count
|
||||
|
||||
|
@ -3663,7 +4015,7 @@ class UsersController < ApplicationController
|
|||
@my_joined_projects_count = @my_joined_projects.count
|
||||
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'new_base_user'}
|
||||
format.html {render :layout => 'base_project_community'}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#coding=utf-8
|
||||
|
||||
require 'base64'
|
||||
class WechatsController < ActionController::Base
|
||||
wechat_responder
|
||||
|
||||
|
@ -105,6 +107,7 @@ class WechatsController < ActionController::Base
|
|||
end
|
||||
|
||||
on :event, with: 'unsubscribe' do |request|
|
||||
unBind(request)
|
||||
request.reply.success # user can not receive this message
|
||||
end
|
||||
|
||||
|
@ -272,12 +275,18 @@ class WechatsController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
def unBind(request)
|
||||
uw = user_binded?(request[:FromUserName])
|
||||
uw.try(:subscribe!)
|
||||
end
|
||||
|
||||
def sendBind(request)
|
||||
tmpurl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities'}&response_type=code&scope=snsapi_base&state=login&connect_redirect=1#wechat_redirect"
|
||||
logger.info "tmpurl!!!!!!!!!!!!!!"
|
||||
logger.info tmpurl
|
||||
news = (1..1).each_with_object([]) { |n, memo| memo << { title: '绑定登录', content: "欢迎使用Trustie创新实践服务平台!
|
||||
在这里您可以随时了解您的课程和项目动态,随时点赞和回复。
|
||||
在这里您可以随时了解您的课程和项目动态,随时点赞和回复。交作业、代码提交等更多功能,请前往 www.trustie.net
|
||||
|
||||
我们将会与微信不断结合,为您提供更有价值的服务。
|
||||
|
||||
您还未绑定确实的用户,请先绑定,谢谢!" } }
|
||||
|
@ -485,9 +494,33 @@ class WechatsController < ActionController::Base
|
|||
end
|
||||
|
||||
|
||||
# 用于权限跳转
|
||||
def auth
|
||||
state = params[:state]
|
||||
url = "#{ROOT_URL}/wechat/auth_callback"
|
||||
authorize_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{url}&response_type=code&scope=snsapi_base&state=#{state}&connect_redirect=1#wechat_redirect"
|
||||
redirect_to authorize_url
|
||||
end
|
||||
|
||||
def auth_callback
|
||||
path = Base64.urlsafe_decode64(params[:state])
|
||||
open_id = get_openid_from_code(params[:code])
|
||||
unless open_id
|
||||
render 'wechats/open_wechat', layout: nil and return
|
||||
end
|
||||
|
||||
redirect_to "/wechat/user_activities##{path}"
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
def get_openid_from_code(code)
|
||||
return 'oCnvgvz8R7QheXE-R9Kkr39j8Ndg' if code =='only-for-test'
|
||||
if code =='only-for-test'
|
||||
openid = 'o3ss_wHOOnHkz1khBJxH8RF4SfPY'
|
||||
session[:wechat_openid] = openid
|
||||
return openid
|
||||
end
|
||||
|
||||
openid = session[:wechat_openid]
|
||||
unless openid
|
||||
if code
|
||||
|
|
|
@ -37,11 +37,21 @@ module ApplicationHelper
|
|||
# super
|
||||
# end
|
||||
|
||||
# 获取多种类型的user用户名
|
||||
def user_message_username user
|
||||
user.try(:show_name)
|
||||
end
|
||||
|
||||
# 超出1w后用k+形式显示
|
||||
def switch_integer_into_k number
|
||||
number > 10000 ? (number.to_f / 1000).round.to_s + "k" : number
|
||||
end
|
||||
|
||||
# 判断某个课程是否包含仅对自己可见的作业
|
||||
def course_has_score_open_common_homework course
|
||||
course.homework_commons.select{|hc| hc.score_open == 0}.count > 0 ? true : false
|
||||
end
|
||||
|
||||
# 隐藏项目以外的信息
|
||||
# return: true 显示,false 不显示
|
||||
def hidden_unproject_infos
|
||||
|
@ -72,10 +82,40 @@ module ApplicationHelper
|
|||
user.nil? ? User.find(2) : user
|
||||
end
|
||||
|
||||
# 通过登录名查找用户,能查到返回用户姓名,否则返回登录名
|
||||
def link_to_user_login login, css_class
|
||||
user = User.find_by_login(login)
|
||||
user = user.nil? ? login : user
|
||||
if user.is_a?(User)
|
||||
name = user.show_name
|
||||
link_to name, {:controller=> 'users', :action => 'show', id: user.id}, :class => css_class, :target => "_blank"
|
||||
else
|
||||
"<a class='#{css_class}'>#{h(user.to_s)}</a>".html_safe
|
||||
end
|
||||
end
|
||||
|
||||
def link_to_user_mail(mail, css_class)
|
||||
user = User.find_by_mail(mail)
|
||||
user = user.nil? ? mail : user
|
||||
if user.is_a?(User)
|
||||
name = user.show_name
|
||||
link_to name, {:controller=> 'users', :action => 'show', id: user.id}, :class => css_class, :target => "_blank"
|
||||
else
|
||||
"<a class='#{css_class}' title='#{user.to_s}'>#{h(user.to_s)}</a>".html_safe
|
||||
end
|
||||
end
|
||||
|
||||
# 通过系统外部用户名查找用户,如果用户不存在则用邮箱替换
|
||||
def get_user_by_login_and login
|
||||
user = User.find_by_login(login)
|
||||
user.nil? ? User.find(2) : user
|
||||
(user.nil? || login == "root") ? User.find(2) : user
|
||||
end
|
||||
|
||||
# 登录名来自外部系统
|
||||
# 通过登录名查找用户,如果用户存在则显示用户姓名,否则显示登录名
|
||||
def get_user_by_login login
|
||||
user = User.find_by_login(login)
|
||||
user.nil? ? login : user.show_name
|
||||
end
|
||||
|
||||
# 重置user_path,目的是将id转换成用户名
|
||||
|
@ -2786,6 +2826,37 @@ module ApplicationHelper
|
|||
end
|
||||
technical_title
|
||||
end
|
||||
# 用户项目总数
|
||||
def user_project_count
|
||||
@my_projects = @user.projects.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS updatetime").order("updatetime DESC")
|
||||
@my_project_total = @my_projects.count
|
||||
end
|
||||
|
||||
# 用户的课程总数
|
||||
def user_course_count
|
||||
@my_course_count = @user.syllabuses.count
|
||||
|
||||
sy_courses = @user.courses.visible.not_deleted
|
||||
syllabus_ids = sy_courses.empty? ? '(-1)' : "(" + sy_courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
|
||||
syllabus_members = SyllabusMember.where("user_id = #{@user.id}")
|
||||
syllabus_member_ids = syllabus_members.empty? ? "(-1)" : "(" + syllabus_members.map{|syl_mem| syl_mem.syllabus_id}.join(',') + ")"
|
||||
@join_syllabuses = Syllabus.where("(id in #{syllabus_ids} or id in #{syllabus_member_ids}) and user_id != #{@user.id}")
|
||||
@my_joined_course_count = @join_syllabuses.count
|
||||
|
||||
@user_course_total = @my_joined_course_count + @my_course_count
|
||||
end
|
||||
|
||||
# 用户发布的issue数
|
||||
def issues_author_is_self_count
|
||||
@issues = Issue.where( :author_id => @user.id )
|
||||
@issues_author_is_self_count = @issues.count
|
||||
end
|
||||
|
||||
# 用户收到的issue数
|
||||
def issues_assigned_is_self_count
|
||||
@issues = Issue.where( :assigned_to_id => @user.id )
|
||||
@issues_assigned_is_self_count = @issues.count
|
||||
end
|
||||
|
||||
def get_user_roll user
|
||||
technical_title = ""
|
||||
|
@ -2855,18 +2926,18 @@ module ApplicationHelper
|
|||
#获取匿评相关连接代码
|
||||
def homework_anonymous_comment (homework, hw_status, user_activity_id = -1)
|
||||
if homework.homework_detail_manual.comment_status == 0 ||Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
||||
link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评"
|
||||
link = link_to "启动匿评","javascript:void(0)", :class => "wpostOptionLink", :title => "作业截止日期之前不可以启动匿评"
|
||||
elsif homework.student_works.has_committed.count >= 2 && homework.homework_detail_manual#作业份数大于2
|
||||
case homework.homework_detail_manual.comment_status
|
||||
when 1
|
||||
link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
|
||||
link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'wpostOptionLink'
|
||||
when 2
|
||||
link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
|
||||
link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?hw_status=" + hw_status.to_s + "&user_activity_id=" + user_activity_id.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'wpostOptionLink'
|
||||
when 3
|
||||
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
|
||||
end
|
||||
else
|
||||
link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "学生提交作业数大于等于2时才可以启动匿评"
|
||||
link = link_to "启动匿评","javascript:void(0)", :class => "wpostOptionLink", :title => "学生提交作业数大于等于2时才可以启动匿评"
|
||||
end
|
||||
link
|
||||
end
|
||||
|
@ -3422,6 +3493,8 @@ def get_reply_by_type type, reply_id
|
|||
reply = Journal.find reply_id
|
||||
when 'Syllabus'
|
||||
reply = JournalsForMessage.find reply_id
|
||||
when 'Memo'
|
||||
reply = Memo.find reply_id
|
||||
end
|
||||
reply
|
||||
end
|
||||
|
@ -3703,7 +3776,9 @@ def get_hw_status homework_common
|
|||
end
|
||||
if Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
||||
str += '<span class="green_homework_btn_cir ml5">作品提交中</span>'
|
||||
elsif Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d")
|
||||
elsif Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && homework_common.anonymous_comment == 1 && User.current.allowed_to?(:as_teacher, homework_common.course)
|
||||
str += '<span class="green_homework_btn_cir ml5" title="目前教师和教辅正在评阅">教师评阅中</span>'
|
||||
else
|
||||
str += '<span class="red_homework_btn_cir ml5">作品补交中</span>'
|
||||
end
|
||||
elsif homework_common.homework_detail_manual.comment_status == 2
|
||||
|
|
|
@ -19,6 +19,11 @@ module PullRequestsHelper
|
|||
PullRequest.where(:pull_request_id => pull_request_id).first
|
||||
end
|
||||
|
||||
# 通过gitlab项目id获取Trustie项目的用户名
|
||||
def find_gitlab_project gitlab_project_id
|
||||
Project.find_by_gpid(gitlab_project_id).owner.try(:show_name)
|
||||
end
|
||||
|
||||
def get_state state
|
||||
case state
|
||||
when "open","reopened"
|
||||
|
|
|
@ -27,6 +27,21 @@ module RepositoriesHelper
|
|||
REPO_IP_ADDRESS = Setting.host_repository
|
||||
REPO_GITLAB_ADDRESS = "git.trustie.net"
|
||||
|
||||
# 获取某次提交的关联Issue
|
||||
# REDO:一次关联查询
|
||||
# type为true则为详情页面,全部显示
|
||||
def get_commit_issues commit_id, project_id, type
|
||||
commit_issues = CommitIssues.where(:commit_id => commit_id, :project_id => project_id)
|
||||
unless commit_issues.blank?
|
||||
if commit_issues.count > 2 && type != 1
|
||||
result = commit_issues.map{|commit_issue| commit_issue.issue_id}.first(2) << "more"
|
||||
else
|
||||
result = commit_issues.map{|commit_issue| commit_issue.issue_id}
|
||||
end
|
||||
end
|
||||
return result unless result.blank?
|
||||
end
|
||||
|
||||
# 因为gitlab的提交总数不是实时同步的,说以取总数用两种方法
|
||||
def choise_commit_count git_count, pro_count
|
||||
git_count > pro_count ? git_count : pro_count
|
||||
|
|
|
@ -29,6 +29,16 @@ module UsersHelper
|
|||
["#{l(:status_locked)} (#{user_count_by_status[3].to_i})", '3']], selected.to_s)
|
||||
end
|
||||
|
||||
def task_count(unsolved_issues_count, unfinished_homework_count, unfinished_test_count, unfinished_poll_count, anonymous_evaluation_count, unapproval_homework)
|
||||
result = unsolved_issues_count + unfinished_homework_count + unfinished_test_count + unfinished_poll_count + anonymous_evaluation_count + unapproval_homework
|
||||
end
|
||||
|
||||
# 判断某个时间再多少天前
|
||||
# params[:num] 天数
|
||||
def many_days_ago time, num
|
||||
time > Time.now - 86400 * num
|
||||
end
|
||||
|
||||
def issue_list(issues, &block)
|
||||
ancestors = []
|
||||
issues.each do |issue|
|
||||
|
@ -78,6 +88,18 @@ module UsersHelper
|
|||
end
|
||||
end
|
||||
|
||||
# 作业类型提示
|
||||
def homework_type_tip homework_type
|
||||
case homework_type
|
||||
when 1
|
||||
"普通作业"
|
||||
when 2
|
||||
"编程作业"
|
||||
when 3
|
||||
"分组作业"
|
||||
end
|
||||
end
|
||||
|
||||
# 获取消息角色
|
||||
def applied_project_message_type role
|
||||
case role
|
||||
|
@ -90,6 +112,20 @@ module UsersHelper
|
|||
end
|
||||
end
|
||||
|
||||
# 获取pullrequest消息状态
|
||||
def pull_request_message_status ma
|
||||
case ma.status
|
||||
when 1
|
||||
"创建了PullRequest:"
|
||||
when 2
|
||||
"接受了PullRequest:"
|
||||
when 3
|
||||
"重新打开了PullRequest:"
|
||||
when 4
|
||||
"关闭了PullRequest:"
|
||||
end
|
||||
|
||||
end
|
||||
# 判断当前用户能否对消息进行操作
|
||||
def allow_to_show applied_message
|
||||
(User.current.id == applied_message.user_id && applied_message.status == 1) ? true : false
|
||||
|
@ -121,11 +157,11 @@ module UsersHelper
|
|||
def applied_project_tip applied_message
|
||||
case applied_message.status
|
||||
when 4
|
||||
"拒绝申请加入项目:"
|
||||
"拒绝申请加入:"
|
||||
when 5,3,2,1,7
|
||||
"申请加入项目:"
|
||||
"申请加入:"
|
||||
when 6
|
||||
"同意申请加入项目"
|
||||
"同意申请加入:"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -145,6 +181,10 @@ module UsersHelper
|
|||
end
|
||||
end
|
||||
|
||||
def is_current_user
|
||||
is_current_user = (User.current == @user)
|
||||
end
|
||||
|
||||
def applied_project_tip_header applied_message
|
||||
case applied_message.status
|
||||
when 4
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class AppliedMessage < ActiveRecord::Base
|
||||
# status: 0表示未批准; status:1表示已批准; status: 2表示已拒绝
|
||||
# status: 0表示未批准; status:1表示已批准; status: 2表示已拒绝; status: 3撤销
|
||||
|
||||
attr_accessible :applied_id, :applied_type, :status, :user_id, :viewed, :applied_user_id, :role, :project_id, :name
|
||||
belongs_to :applied ,:polymorphic => true
|
||||
|
|
|
@ -397,7 +397,7 @@ class Attachment < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def course
|
||||
container
|
||||
Course === container ? container : nil
|
||||
end
|
||||
|
||||
def visible?(user=User.current)
|
||||
|
|
|
@ -40,7 +40,7 @@ class Comment < ActiveRecord::Base
|
|||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
validates_presence_of :commented, :author, :comments
|
||||
safe_attributes 'comments','parent_id','reply_id','comments_count'
|
||||
after_create :send_mail, :act_as_system_message, :act_as_student_score
|
||||
after_create :act_as_system_message, :act_as_student_score #:send_mail,
|
||||
after_destroy :down_course_score
|
||||
|
||||
def act_as_system_message
|
||||
|
@ -55,11 +55,11 @@ class Comment < ActiveRecord::Base
|
|||
# end
|
||||
end
|
||||
else # 项目相关
|
||||
if self.author_id != self.commented.author_id
|
||||
self.forge_messages << ForgeMessage.new(:user_id => self.commented.author_id, :project_id => self.commented.project.id, :viewed => false)
|
||||
#content = strip_html self.comments.html_safe, 200
|
||||
#ws.comment_template self.commented.author_id, "blog_comment", self.id, "#{l(:label_news_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
||||
end
|
||||
# if self.author_id != self.commented.author_id
|
||||
# self.forge_messages << ForgeMessage.new(:user_id => self.commented.author_id, :project_id => self.commented.project.id, :viewed => false)
|
||||
# #content = strip_html self.comments.html_safe, 200
|
||||
# #ws.comment_template self.commented.author_id, "blog_comment", self.id, "#{l(:label_news_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class CommitIssues < ActiveRecord::Base
|
||||
attr_accessible :commit_id, :issue_id, :project_id
|
||||
# 之所以没建立关联表,主要是应为commit_id是直接通过api获取的,不存在trustie端
|
||||
has_many :issues
|
||||
end
|
|
@ -5,6 +5,8 @@ class CourseMessage < ActiveRecord::Base
|
|||
# HomeworkCommon:status:
|
||||
# nil:发布了作业; 1:作业截止时间到了提醒!;2:开启匿评; 3:关闭匿评; 4:匿评开始失败; 5:申请引用作业, 6:申请结果
|
||||
# apply_user_id: 申请者的用户id
|
||||
# StudentWorksScoresAppeal: status:
|
||||
# 1: 申诉中, 2:申诉撤销, 3:申诉成功, 4:申诉被拒绝
|
||||
attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed, :content, :status, :apply_user_id, :apply_result
|
||||
|
||||
# 多态 虚拟关联
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
class DataException < ActiveRecord::Base
|
||||
attr_accessible :container_id, :container_type, :message
|
||||
end
|
|
@ -1,12 +1,12 @@
|
|||
class ForgeMessage < ActiveRecord::Base
|
||||
# status在不同的类中,作用不同
|
||||
# Isseu: satus nil:发布了缺陷;:1:缺陷计划完成日志到了提醒
|
||||
attr_accessible :forge_message_id, :forge_message_type, :project_id, :user_id, :viewed, :secret_key, :status
|
||||
attr_accessible :forge_message_id, :forge_message_type, :project_id, :user_id, :viewed, :secret_key, :status, :operate_user_id
|
||||
|
||||
belongs_to :forge_message ,:polymorphic => true
|
||||
belongs_to :project
|
||||
belongs_to :user
|
||||
has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy
|
||||
has_many :message_alls, :class_name => 'MessageAll', :as => :message, :dependent => :destroy
|
||||
|
||||
validates :user_id,presence: true
|
||||
validates :project_id,presence: true
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#encoding: utf-8
|
||||
#老师布置的作业表
|
||||
#homework_type: 0:普通作业;1:匿评作业;2:编程作业
|
||||
#homework_type: 0:普通作业;1:匿评作业;2:编程作业;3:分组作业;
|
||||
class HomeworkCommon < ActiveRecord::Base
|
||||
# attr_accessible :name, :user_id, :description, :publish_time, :end_time, :homework_type, :late_penalty, :course_id,:simi_time
|
||||
require 'net/http'
|
||||
|
|
|
@ -56,6 +56,8 @@ class Issue < ActiveRecord::Base
|
|||
has_one :praise_tread_cache, as: :object, dependent: :destroy
|
||||
# ForgeMessage虚拟关联(多态)
|
||||
has_many :forge_messages, :class_name => 'ForgeMessage',:as =>:forge_message ,:dependent => :destroy
|
||||
# 该关联不能关联删除,因为commit记录没有存在Trustie数据库中
|
||||
has_many :commit_issueses
|
||||
|
||||
has_many :at_messages, class_name: 'AtMessage', as: :at_message ,:dependent => :destroy
|
||||
|
||||
|
@ -133,6 +135,10 @@ class Issue < ActiveRecord::Base
|
|||
after_save :after_create_from_copy
|
||||
after_destroy :update_parent_attributes
|
||||
|
||||
def user
|
||||
self.author
|
||||
end
|
||||
|
||||
#动态的更新
|
||||
def update_activity
|
||||
update_user_activity(self.class, self.id)
|
||||
|
|
|
@ -73,13 +73,13 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
has_one :praise_tread_cache, as: :object, dependent: :destroy
|
||||
|
||||
validates :notes, presence: true, if: :is_homework_jour?
|
||||
after_create :act_as_activity, :act_as_course_activity, :act_as_course_message,
|
||||
after_create :act_as_course_activity, :act_as_course_message,
|
||||
act_as_at_message(:notes, :user_id), :act_as_user_feedback_message,
|
||||
:act_as_principal_activity, :act_as_student_score
|
||||
after_create :reset_counters!
|
||||
:act_as_principal_activity
|
||||
# after_create :reset_counters!
|
||||
#after_update :update_activity
|
||||
# after_destroy :reset_counters!
|
||||
after_save :be_user_score
|
||||
# after_save :be_user_score
|
||||
after_destroy :down_user_score, :down_course_score
|
||||
|
||||
# default_scope { where('m_parent_id IS NULL') }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Added by young
|
||||
class JournalsForMessageObserver < ActiveRecord::Observer
|
||||
def after_create(journals_for_message)
|
||||
Mailer.run.journals_for_message_add(User.current, journals_for_message)
|
||||
# Mailer.run.journals_for_message_add(User.current, journals_for_message)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -109,40 +109,40 @@ class Mailer < ActionMailer::Base
|
|||
# 邀请未注册用户加入项目
|
||||
# 功能: 在加入项目的同时自动注册用户
|
||||
def send_invite_in_project(email, project, invitor, first_name, last_name, gender)
|
||||
@email = email
|
||||
@subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} "
|
||||
@password = newpass(6)
|
||||
|
||||
login = email
|
||||
login = login.sub(/%40/,'@')
|
||||
us = UsersService.new
|
||||
# 自动激活用户
|
||||
user = us.register_auto(login, email, @password, first_name, last_name, gender)
|
||||
InviteList.create(:user_id => user.id, :project_id => project.id, :mail =>email)
|
||||
User.current = user unless User.current.nil?
|
||||
@user = user
|
||||
@token = Token.get_token_from_user(user, 'autologin')
|
||||
@project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :mail => true, :token => @token.value)
|
||||
mail :to => email, :subject => @subject
|
||||
# @email = email
|
||||
# @subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} "
|
||||
# @password = newpass(6)
|
||||
#
|
||||
# login = email
|
||||
# login = login.sub(/%40/,'@')
|
||||
# us = UsersService.new
|
||||
# # 自动激活用户
|
||||
# user = us.register_auto(login, email, @password, first_name, last_name, gender)
|
||||
# InviteList.create(:user_id => user.id, :project_id => project.id, :mail =>email)
|
||||
# User.current = user unless User.current.nil?
|
||||
# @user = user
|
||||
# @token = Token.get_token_from_user(user, 'autologin')
|
||||
# @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :mail => true, :token => @token.value)
|
||||
# mail :to => email, :subject => @subject
|
||||
end
|
||||
|
||||
# 邀请已注册的用户加入项目
|
||||
def request_member_to_project(email, project, invitor)
|
||||
@subject = "#{invitor.name} #{l(:label_invite_project)}: #{project.name} "
|
||||
user = User.find_by_mail(email.to_s)
|
||||
@invitor_name = "#{invitor.name}"
|
||||
@project_name = "#{project.name}"
|
||||
@user = user
|
||||
@project = project
|
||||
if InviteList.where("project_id= ? and user_id =? and mail =?", project.id, @user.id, email).first.nil?
|
||||
InviteList.create(:user_id => user.id, :project_id => project.id, :mail => email)
|
||||
end
|
||||
@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_request_member(user,project)
|
||||
# @subject = "#{invitor.name} #{l(:label_invite_project)}: #{project.name} "
|
||||
# user = User.find_by_mail(email.to_s)
|
||||
# @invitor_name = "#{invitor.name}"
|
||||
# @project_name = "#{project.name}"
|
||||
# @user = user
|
||||
# @project = project
|
||||
# if InviteList.where("project_id= ? and user_id =? and mail =?", project.id, @user.id, email).first.nil?
|
||||
# InviteList.create(:user_id => user.id, :project_id => project.id, :mail => email)
|
||||
# end
|
||||
mail :to => email, :subject => @subject
|
||||
# @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_request_member(user,project)
|
||||
# # end
|
||||
# mail :to => email, :subject => @subject
|
||||
end
|
||||
|
||||
# 邀请信息消息 注:forge_message_id 为邀请人ID(特殊情况)
|
||||
|
@ -293,23 +293,23 @@ class Mailer < ActionMailer::Base
|
|||
|
||||
# 公共讨论区发帖、回帖添加邮件发送信息
|
||||
def forum_message_added(memo)
|
||||
@memo = memo
|
||||
redmine_headers 'Memo' => memo.id
|
||||
@forum = memo.forum
|
||||
@author = memo.author
|
||||
@forum_url = url_for(:controller => 'forums', :action => 'show', :id => @forum.id)
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
recipients ||= []
|
||||
#将帖子创建者邮箱地址加入数组
|
||||
recipients << @forum.creator.mail
|
||||
#回复人邮箱地址加入数组
|
||||
recipients << @author.mail
|
||||
# cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||
|
||||
@memo_url = url_for(forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id)))
|
||||
mail :to => recipients,
|
||||
:subject => "[ #{l(:label_message_plural)} : #{memo.subject} #{l(:label_memo_create_succ)}]",
|
||||
:filter => true
|
||||
# @memo = memo
|
||||
# redmine_headers 'Memo' => memo.id
|
||||
# @forum = memo.forum
|
||||
# @author = memo.author
|
||||
# @forum_url = url_for(:controller => 'forums', :action => 'show', :id => @forum.id)
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# recipients ||= []
|
||||
# #将帖子创建者邮箱地址加入数组
|
||||
# recipients << @forum.creator.mail
|
||||
# #回复人邮箱地址加入数组
|
||||
# recipients << @author.mail
|
||||
# # cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||
#
|
||||
# @memo_url = url_for(forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id)))
|
||||
# mail :to => recipients,
|
||||
# :subject => "[ #{l(:label_message_plural)} : #{memo.subject} #{l(:label_memo_create_succ)}]",
|
||||
# :filter => true
|
||||
end
|
||||
# Builds a Mail::Message object used to email recipients of the added journals for message.
|
||||
|
||||
|
@ -318,64 +318,64 @@ class Mailer < ActionMailer::Base
|
|||
# 直接留言后 reply_id,m_parent_id 为空,相对应的at_user取值为nil
|
||||
|
||||
def journals_for_message_add(user, journals_for_message)
|
||||
@user = journals_for_message.user # 留言人
|
||||
@mail = journals_for_message.jour if journals_for_message.at_user.nil? # 留言
|
||||
@mail = journals_for_message.at_user if journals_for_message.at_user
|
||||
@message = journals_for_message.notes
|
||||
@title = "#@user #{t(:label_leave_your_message, :locale => 'zh')}"
|
||||
@issue_author_url = url_for(user_activities_url(@user))
|
||||
@url = case journals_for_message.jour.class.to_s.to_sym # 判断留言的对象所属类型
|
||||
# when :Bid
|
||||
# course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
when :Project
|
||||
return -1 if journals_for_message.jour.project_type == Project::ProjectType_project
|
||||
project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
when :Course
|
||||
course_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
when :Contest
|
||||
show_contest_contest_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
when :User
|
||||
user_newfeedback_user_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
else
|
||||
Rails.logger.error "[Builds a Mail::Message ERROR] journalsForMessage's jour is unkown type, journalsForMessage.id = #{journals_for_message.id}"
|
||||
return -1
|
||||
end
|
||||
|
||||
# 验证用户的收取邮件的方式
|
||||
recipients ||= []
|
||||
recipients1 ||= []
|
||||
recipients1 = @mail.mail
|
||||
recipients = journals_for_message.jour.author.mail
|
||||
|
||||
# modify by nwb
|
||||
#如果是直接留言并且留言对象是课程
|
||||
if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Course
|
||||
course = journals_for_message.jour
|
||||
@author = journals_for_message.user
|
||||
#课程的教师
|
||||
@members = course_all_member journals_for_message.jour
|
||||
#收件人邮箱
|
||||
@recipients ||= []
|
||||
@members.each do |teacher|
|
||||
@recipients << teacher.user.mail
|
||||
end
|
||||
mail :to => @recipients,
|
||||
:subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} ",
|
||||
:filter => true
|
||||
# elsif journals_for_message.jour.class.to_s.to_sym == :Bid
|
||||
# @user = journals_for_message.user # 留言人
|
||||
# @mail = journals_for_message.jour if journals_for_message.at_user.nil? # 留言
|
||||
# @mail = journals_for_message.at_user if journals_for_message.at_user
|
||||
# @message = journals_for_message.notes
|
||||
# @title = "#@user #{t(:label_leave_your_message, :locale => 'zh')}"
|
||||
# @issue_author_url = url_for(user_activities_url(@user))
|
||||
# @url = case journals_for_message.jour.class.to_s.to_sym # 判断留言的对象所属类型
|
||||
# # when :Bid
|
||||
# # course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
# when :Project
|
||||
# return -1 if journals_for_message.jour.project_type == Project::ProjectType_project
|
||||
# project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
# when :Course
|
||||
# course_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
# when :Contest
|
||||
# show_contest_contest_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
# when :User
|
||||
# user_newfeedback_user_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
# else
|
||||
# Rails.logger.error "[Builds a Mail::Message ERROR] journalsForMessage's jour is unkown type, journalsForMessage.id = #{journals_for_message.id}"
|
||||
# return -1
|
||||
# end
|
||||
#
|
||||
# # 验证用户的收取邮件的方式
|
||||
# recipients ||= []
|
||||
# recipients1 ||= []
|
||||
# recipients1 = @mail.mail
|
||||
# recipients = journals_for_message.jour.author.mail
|
||||
#
|
||||
# # modify by nwb
|
||||
# #如果是直接留言并且留言对象是课程
|
||||
# if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Course
|
||||
# course = journals_for_message.jour
|
||||
# @author = journals_for_message.user
|
||||
# #课程的教师
|
||||
# @members = course_all_member journals_for_message.jour
|
||||
# #收件人邮箱
|
||||
# @recipients ||= []
|
||||
# @members.each do |teacher|
|
||||
# @recipients << teacher.user.mail
|
||||
# end
|
||||
# mail :to => @recipients,
|
||||
# :subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} ",
|
||||
# :filter => true
|
||||
# # elsif journals_for_message.jour.class.to_s.to_sym == :Bid
|
||||
# # if !journals_for_message.jour.author.notify_about? journals_for_message
|
||||
# # return -1
|
||||
# # end
|
||||
# #
|
||||
# # mail :to => recipients, :subject => @title,:filter => true
|
||||
# elsif journals_for_message.jour.class.to_s.to_sym == :Contest
|
||||
# if !journals_for_message.jour.author.notify_about? journals_for_message
|
||||
# return -1
|
||||
# end
|
||||
#
|
||||
# mail :to => recipients, :subject => @title,:filter => true
|
||||
elsif journals_for_message.jour.class.to_s.to_sym == :Contest
|
||||
if !journals_for_message.jour.author.notify_about? journals_for_message
|
||||
return -1
|
||||
end
|
||||
mail :to => recipients, :subject => @title,:filter => true
|
||||
else
|
||||
mail :to => recipients1, :subject => @title,:filter => true
|
||||
end
|
||||
# else
|
||||
# mail :to => recipients1, :subject => @title,:filter => true
|
||||
# end
|
||||
|
||||
|
||||
end
|
||||
|
@ -485,16 +485,16 @@ class Mailer < ActionMailer::Base
|
|||
|
||||
# 用户申请加入项目邮件通知
|
||||
def applied_project(applied)
|
||||
@project =applied.project
|
||||
redmine_headers 'Project' => @project,
|
||||
'User' => applied.user
|
||||
@user = applied.user
|
||||
recipients = @project.manager_recipients
|
||||
s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name)
|
||||
@token = Token.get_token_from_user(@user, 'autologin')
|
||||
@applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members')
|
||||
mail :to => recipients,
|
||||
:subject => s
|
||||
# @project =applied.project
|
||||
# redmine_headers 'Project' => @project,
|
||||
# 'User' => applied.user
|
||||
# @user = applied.user
|
||||
# recipients = @project.manager_recipients
|
||||
# s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name)
|
||||
# @token = Token.get_token_from_user(@user, 'autologin')
|
||||
# @applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members')
|
||||
# mail :to => recipients,
|
||||
# :subject => s
|
||||
end
|
||||
|
||||
def reminder(user, issues, days)
|
||||
|
@ -555,14 +555,14 @@ class Mailer < ActionMailer::Base
|
|||
# document_added(document) => Mail::Message object
|
||||
# Mailer.document_added(document).deliver => sends an email to the document's project recipients
|
||||
def document_added(document)
|
||||
redmine_headers 'Project' => document.project.identifier
|
||||
@author = User.current
|
||||
@document = document
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
@document_url = url_for(:controller => 'documents', :action => 'show', :id => document)
|
||||
mail :to => document.recipients,
|
||||
:subject => "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}",
|
||||
:filter => true
|
||||
# redmine_headers 'Project' => document.project.identifier
|
||||
# @author = User.current
|
||||
# @document = document
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# @document_url = url_for(:controller => 'documents', :action => 'show', :id => document)
|
||||
# mail :to => document.recipients,
|
||||
# :subject => "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}",
|
||||
# :filter => true
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email recipients of a project when an attachements are added.
|
||||
|
@ -571,54 +571,54 @@ class Mailer < ActionMailer::Base
|
|||
# attachments_added(attachments) => Mail::Message object
|
||||
# Mailer.attachments_added(attachments).deliver => sends an email to the project's recipients
|
||||
def attachments_added(attachments)
|
||||
container = attachments.first.container
|
||||
added_to = ''
|
||||
added_to_url = ''
|
||||
@author = attachments.first.author
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
case container.class.name
|
||||
when 'Project'
|
||||
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container)
|
||||
added_to = "#{l(:label_project)}: #{container}"
|
||||
recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
|
||||
when 'Course'
|
||||
added_to_url = url_for(:controller => 'files', :action => 'index', :course_id => container)
|
||||
added_to = "#{l(:label_course)}: #{container.name}"
|
||||
recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
|
||||
when 'Version'
|
||||
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container.project)
|
||||
added_to = "#{l(:label_version)}: #{container.name}"
|
||||
recipients = container.project.notified_users.select { |user| user.allowed_to?(:view_files, container.project) }.collect { |u| u.mail }
|
||||
when 'Document'
|
||||
added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
|
||||
added_to = "#{l(:label_document)}: #{container.title}"
|
||||
recipients = container.recipients
|
||||
end
|
||||
if container.class.name == 'Course'
|
||||
redmine_headers 'Course' => container.id
|
||||
@attachments = attachments
|
||||
@added_to = added_to
|
||||
@added_to_url = added_to_url
|
||||
mail :to => recipients,
|
||||
:subject => "[#{container.name}] #{l(:label_attachment_new)}",
|
||||
:filter => true
|
||||
elsif container.class.name == 'Project'
|
||||
redmine_headers 'Project' => container.id
|
||||
@attachments = attachments
|
||||
@added_to = added_to
|
||||
@added_to_url = added_to_url
|
||||
mail :to => recipients,
|
||||
:subject => "[#{container.name}] #{l(:label_attachment_new)}",
|
||||
:filter => true
|
||||
else
|
||||
redmine_headers 'Project' => container.project.identifier
|
||||
@attachments = attachments
|
||||
@added_to = added_to
|
||||
@added_to_url = added_to_url
|
||||
mail :to => recipients,
|
||||
:subject => "[#{container.project.name}] #{l(:label_attachment_new)}",
|
||||
:filter => true
|
||||
end
|
||||
# container = attachments.first.container
|
||||
# added_to = ''
|
||||
# added_to_url = ''
|
||||
# @author = attachments.first.author
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# case container.class.name
|
||||
# when 'Project'
|
||||
# added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container)
|
||||
# added_to = "#{l(:label_project)}: #{container}"
|
||||
# recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
|
||||
# when 'Course'
|
||||
# added_to_url = url_for(:controller => 'files', :action => 'index', :course_id => container)
|
||||
# added_to = "#{l(:label_course)}: #{container.name}"
|
||||
# recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
|
||||
# when 'Version'
|
||||
# added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container.project)
|
||||
# added_to = "#{l(:label_version)}: #{container.name}"
|
||||
# recipients = container.project.notified_users.select { |user| user.allowed_to?(:view_files, container.project) }.collect { |u| u.mail }
|
||||
# when 'Document'
|
||||
# added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
|
||||
# added_to = "#{l(:label_document)}: #{container.title}"
|
||||
# recipients = container.recipients
|
||||
# end
|
||||
# if container.class.name == 'Course'
|
||||
# redmine_headers 'Course' => container.id
|
||||
# @attachments = attachments
|
||||
# @added_to = added_to
|
||||
# @added_to_url = added_to_url
|
||||
# mail :to => recipients,
|
||||
# :subject => "[#{container.name}] #{l(:label_attachment_new)}",
|
||||
# :filter => true
|
||||
# elsif container.class.name == 'Project'
|
||||
# redmine_headers 'Project' => container.id
|
||||
# @attachments = attachments
|
||||
# @added_to = added_to
|
||||
# @added_to_url = added_to_url
|
||||
# mail :to => recipients,
|
||||
# :subject => "[#{container.name}] #{l(:label_attachment_new)}",
|
||||
# :filter => true
|
||||
# else
|
||||
# redmine_headers 'Project' => container.project.identifier
|
||||
# @attachments = attachments
|
||||
# @added_to = added_to
|
||||
# @added_to_url = added_to_url
|
||||
# mail :to => recipients,
|
||||
# :subject => "[#{container.project.name}] #{l(:label_attachment_new)}",
|
||||
# :filter => true
|
||||
# end
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email recipients of a course when an homework are posted.
|
||||
|
@ -650,15 +650,15 @@ class Mailer < ActionMailer::Base
|
|||
def news_added(news)
|
||||
|
||||
if news.project
|
||||
redmine_headers 'Project' => news.project.identifier
|
||||
@author = news.author
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
message_id news
|
||||
@news = news
|
||||
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
mail :to => news.recipients,
|
||||
:subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
:filter => true
|
||||
# redmine_headers 'Project' => news.project.identifier
|
||||
# @author = news.author
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# message_id news
|
||||
# @news = news
|
||||
# @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
# mail :to => news.recipients,
|
||||
# :subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
# :filter => true
|
||||
elsif news.course
|
||||
redmine_headers 'Course' => news.course.id
|
||||
@author = news.author
|
||||
|
@ -681,17 +681,17 @@ class Mailer < ActionMailer::Base
|
|||
def news_comment_added(comment)
|
||||
news = comment.commented
|
||||
if news.project
|
||||
redmine_headers 'Project' => news.project.identifier
|
||||
@author = comment.author
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
message_id comment
|
||||
@news = news
|
||||
@comment = comment
|
||||
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
mail :to => news.recipients,
|
||||
:cc => news.watcher_recipients,
|
||||
:subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
:filter => true
|
||||
# redmine_headers 'Project' => news.project.identifier
|
||||
# @author = comment.author
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# message_id comment
|
||||
# @news = news
|
||||
# @comment = comment
|
||||
# @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
# mail :to => news.recipients,
|
||||
# :cc => news.watcher_recipients,
|
||||
# :subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
# :filter => true
|
||||
elsif news.course
|
||||
redmine_headers 'Course' => news.course.id
|
||||
@author = comment.author
|
||||
|
@ -714,37 +714,37 @@ class Mailer < ActionMailer::Base
|
|||
# message_posted(message) => Mail::Message object
|
||||
# Mailer.message_posted(message).deliver => sends an email to the recipients
|
||||
def message_posted(message)
|
||||
if message.project
|
||||
redmine_headers 'Project' => message.project.identifier,
|
||||
'Topic-Id' => (message.parent_id || message.id)
|
||||
@author = message.author
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
message_id message
|
||||
references message.parent unless message.parent.nil?
|
||||
recipients = message.recipients
|
||||
cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients)
|
||||
@message = message
|
||||
@message_url = url_for(message.event_url)
|
||||
mail :to => recipients,
|
||||
:cc => cc,
|
||||
:subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
|
||||
:filter => true
|
||||
elsif message.course
|
||||
redmine_headers 'Course' => message.course.id,
|
||||
'Topic-Id' => (message.parent_id || message.id)
|
||||
@author = message.author
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
message_id message
|
||||
references message.parent unless message.parent.nil?
|
||||
recipients = message.course.notified_users.select { |user| user.allowed_to?(:view_files, message.course) }.collect { |u| u.mail }
|
||||
cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients)
|
||||
@message = message
|
||||
@message_url = url_for(message.event_url)
|
||||
mail :to => recipients,
|
||||
:cc => cc,
|
||||
:subject => "[#{message.board.course.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
|
||||
:filter => true
|
||||
end
|
||||
# if message.project
|
||||
# redmine_headers 'Project' => message.project.identifier,
|
||||
# 'Topic-Id' => (message.parent_id || message.id)
|
||||
# @author = message.author
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# message_id message
|
||||
# references message.parent unless message.parent.nil?
|
||||
# recipients = message.recipients
|
||||
# cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients)
|
||||
# @message = message
|
||||
# @message_url = url_for(message.event_url)
|
||||
# mail :to => recipients,
|
||||
# :cc => cc,
|
||||
# :subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
|
||||
# :filter => true
|
||||
# elsif message.course
|
||||
# redmine_headers 'Course' => message.course.id,
|
||||
# 'Topic-Id' => (message.parent_id || message.id)
|
||||
# @author = message.author
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# message_id message
|
||||
# references message.parent unless message.parent.nil?
|
||||
# recipients = message.course.notified_users.select { |user| user.allowed_to?(:view_files, message.course) }.collect { |u| u.mail }
|
||||
# cc = ((message.root.watcher_recipients + message.board.watcher_recipients).uniq - recipients)
|
||||
# @message = message
|
||||
# @message_url = url_for(message.event_url)
|
||||
# mail :to => recipients,
|
||||
# :cc => cc,
|
||||
# :subject => "[#{message.board.course.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
|
||||
# :filter => true
|
||||
# end
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email the recipients of a project of the specified wiki content was added.
|
||||
|
@ -753,20 +753,20 @@ class Mailer < ActionMailer::Base
|
|||
# wiki_content_added(wiki_content) => Mail::Message object
|
||||
# Mailer.wiki_content_added(wiki_content).deliver => sends an email to the project's recipients
|
||||
def wiki_content_added(wiki_content)
|
||||
redmine_headers 'Project' => wiki_content.project.identifier,
|
||||
'Wiki-Page-Id' => wiki_content.page.id
|
||||
@author = wiki_content.author
|
||||
message_id wiki_content
|
||||
recipients = wiki_content.recipients
|
||||
cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||
@wiki_content = wiki_content
|
||||
@wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
|
||||
:project_id => wiki_content.project,
|
||||
:id => wiki_content.page.title)
|
||||
mail :to => recipients,
|
||||
:cc => cc,
|
||||
:subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}",
|
||||
:filter => true
|
||||
# redmine_headers 'Project' => wiki_content.project.identifier,
|
||||
# 'Wiki-Page-Id' => wiki_content.page.id
|
||||
# @author = wiki_content.author
|
||||
# message_id wiki_content
|
||||
# recipients = wiki_content.recipients
|
||||
# cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||
# @wiki_content = wiki_content
|
||||
# @wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
|
||||
# :project_id => wiki_content.project,
|
||||
# :id => wiki_content.page.title)
|
||||
# mail :to => recipients,
|
||||
# :cc => cc,
|
||||
# :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}",
|
||||
# :filter => true
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email the recipients of a project of the specified wiki content was updated.
|
||||
|
@ -775,23 +775,23 @@ class Mailer < ActionMailer::Base
|
|||
# wiki_content_updated(wiki_content) => Mail::Message object
|
||||
# Mailer.wiki_content_updated(wiki_content).deliver => sends an email to the project's recipients
|
||||
def wiki_content_updated(wiki_content)
|
||||
redmine_headers 'Project' => wiki_content.project.identifier,
|
||||
'Wiki-Page-Id' => wiki_content.page.id
|
||||
@author = wiki_content.author
|
||||
message_id wiki_content
|
||||
recipients = wiki_content.recipients
|
||||
cc = wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients
|
||||
@wiki_content = wiki_content
|
||||
@wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
|
||||
:project_id => wiki_content.project,
|
||||
:id => wiki_content.page.title)
|
||||
@wiki_diff_url = url_for(:controller => 'wiki', :action => 'diff',
|
||||
:project_id => wiki_content.project, :id => wiki_content.page.title,
|
||||
:version => wiki_content.version)
|
||||
mail :to => recipients,
|
||||
:cc => cc,
|
||||
:subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}",
|
||||
:filter => true
|
||||
# redmine_headers 'Project' => wiki_content.project.identifier,
|
||||
# 'Wiki-Page-Id' => wiki_content.page.id
|
||||
# @author = wiki_content.author
|
||||
# message_id wiki_content
|
||||
# recipients = wiki_content.recipients
|
||||
# cc = wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients
|
||||
# @wiki_content = wiki_content
|
||||
# @wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
|
||||
# :project_id => wiki_content.project,
|
||||
# :id => wiki_content.page.title)
|
||||
# @wiki_diff_url = url_for(:controller => 'wiki', :action => 'diff',
|
||||
# :project_id => wiki_content.project, :id => wiki_content.page.title,
|
||||
# :version => wiki_content.version)
|
||||
# mail :to => recipients,
|
||||
# :cc => cc,
|
||||
# :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}",
|
||||
# :filter => true
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email the specified user their account information.
|
||||
|
|
|
@ -79,9 +79,10 @@ class Memo < ActiveRecord::Base
|
|||
"lock",
|
||||
"sticky",
|
||||
"parent_id",
|
||||
"replies_count"
|
||||
"replies_count",
|
||||
"root_id"
|
||||
|
||||
after_create :add_author_as_watcher, :reset_counters!, :send_mail, :send_message,:create_memo_ealasticsearch_index
|
||||
after_create :add_author_as_watcher, :reset_counters!, :send_message,:create_memo_ealasticsearch_index
|
||||
after_update :update_memo_ealasticsearch_index
|
||||
after_destroy :reset_counters!,:delete_kindeditor_assets,:delete_memo_ealasticsearch_index#,:down_user_score -- 公共区发帖暂不计入得分,
|
||||
# after_create :send_notification
|
||||
|
@ -126,6 +127,18 @@ class Memo < ActiveRecord::Base
|
|||
Mailer.run.forum_message_added(self) if Setting.notified_events.include?('forum_message_added')
|
||||
end
|
||||
|
||||
def creator_user
|
||||
self.author
|
||||
end
|
||||
|
||||
def created_time
|
||||
self.created_on
|
||||
end
|
||||
|
||||
def content_detail
|
||||
self.content
|
||||
end
|
||||
|
||||
# 公共贴吧消息记录
|
||||
# 原则:贴吧创始人;发帖人,wanglingchun(特殊用户)
|
||||
def send_message
|
||||
|
|
|
@ -106,6 +106,10 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
}
|
||||
|
||||
def description
|
||||
self.content
|
||||
end
|
||||
|
||||
def topic?
|
||||
parent_id.nil?
|
||||
end
|
||||
|
@ -324,17 +328,28 @@ class Message < ActiveRecord::Base
|
|||
def delay_message_send
|
||||
if self.course
|
||||
if self.parent_id.nil? # 发帖
|
||||
self.delay.contain_messages_message
|
||||
dm = []
|
||||
self.course.members.includes(:user).each do |m|
|
||||
if self.author.allowed_to?(:as_teacher, self.course) && m.user_id != self.author_id # 老师 自己的帖子不给自己发送消息
|
||||
dm << {course_message_type:'Message',course_message_id:self.id, :user_id => m.user_id,
|
||||
:course_id => self.board.course_id, :viewed => false}
|
||||
if dm.size >= 30
|
||||
self.delay.contain_messages_message(dm)
|
||||
dm.clear
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
unless dm.empty?
|
||||
self.delay.contain_messages_message(dm)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def contain_messages_message
|
||||
self.course.members.includes(:user).each do |m|
|
||||
if self.author.allowed_to?(:as_teacher, self.course) && m.user_id != self.author_id # 老师 自己的帖子不给自己发送消息
|
||||
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
|
||||
end
|
||||
end
|
||||
def contain_messages_message vs
|
||||
CourseMessage.create(vs)
|
||||
end
|
||||
|
||||
#更新用户分数 -by zjc
|
||||
|
|
|
@ -65,7 +65,7 @@ class News < ActiveRecord::Base
|
|||
:author_key => :author_id
|
||||
acts_as_watchable
|
||||
|
||||
after_create :act_as_forge_activity, :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score, :act_as_system_message,:delay_news_wechat_send,:delay_news_send
|
||||
after_create :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score,:delay_news_wechat_send, :delay_news_send
|
||||
after_update :update_activity
|
||||
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score
|
||||
|
||||
|
@ -208,16 +208,29 @@ class News < ActiveRecord::Base
|
|||
|
||||
def delay_news_send
|
||||
if self.course
|
||||
self.delay.contain_news_message
|
||||
|
||||
vs = []
|
||||
self.course.members.each do | m|
|
||||
if m.user_id != self.author_id
|
||||
vs << {course_message_type:'News',course_message_id:self.id, :user_id => m.user_id,
|
||||
:course_id => self.course_id, :viewed => false}
|
||||
|
||||
if vs.size >= 30
|
||||
self.delay.contain_news_message(vs)
|
||||
vs.clear
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
unless vs.empty?
|
||||
self.delay.contain_news_message(vs)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def contain_news_message
|
||||
self.course.members.each do |m|
|
||||
if m.user_id != self.author_id
|
||||
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
|
||||
end
|
||||
end
|
||||
def contain_news_message(vs)
|
||||
CourseMessage.create(vs)
|
||||
end
|
||||
|
||||
# Time 2015-03-31 13:50:54
|
||||
|
|
|
@ -44,7 +44,9 @@ class Poll < ActiveRecord::Base
|
|||
def act_as_course_activity
|
||||
if self.polls_type == "Course"
|
||||
if self.polls_status == 2 #问卷是发布状态
|
||||
self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.polls_group_id)
|
||||
if CourseActivity.where(:course_id => self.polls_group_id, :user_id => self.user_id, :course_act_id => self.id, :course_act_type => 'Poll').count == 0
|
||||
self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.polls_group_id)
|
||||
end
|
||||
elsif self.polls_status == 1 #问卷是新建状态
|
||||
self.course_acts.destroy_all
|
||||
end
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
class ProfessionalLevel < ActiveRecord::Base
|
||||
attr_accessible :level
|
||||
end
|
|
@ -1,4 +1,7 @@
|
|||
class PullRequest < ActiveRecord::Base
|
||||
attr_accessible :gpid, :pull_request_id, :user_id
|
||||
# status 1:创建 2:接受 3:重新打开 4:关闭
|
||||
attr_accessible :gpid, :pull_request_id, :user_id, :project_id, :title
|
||||
validates_uniqueness_of :pull_request_id
|
||||
|
||||
has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy
|
||||
end
|
||||
|
|
|
@ -53,7 +53,7 @@ class StudentWork < ActiveRecord::Base
|
|||
if homework.teacher_priority == 1 #教师优先
|
||||
if student_work.teacher_score
|
||||
student_work.final_score = student_work.teacher_score
|
||||
student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty
|
||||
student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
|
||||
else
|
||||
if student_work.teaching_asistant_score.nil?
|
||||
student_work.final_score = student_work.student_score
|
||||
|
@ -67,7 +67,7 @@ class StudentWork < ActiveRecord::Base
|
|||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
if student_work.final_score
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
|
||||
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
|
||||
else
|
||||
student_work.work_score = nil
|
||||
|
@ -88,7 +88,7 @@ class StudentWork < ActiveRecord::Base
|
|||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
if student_work.final_score
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
|
||||
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
|
||||
else
|
||||
student_work.work_score = nil
|
||||
|
@ -98,7 +98,7 @@ class StudentWork < ActiveRecord::Base
|
|||
if homework.teacher_priority == 1 #教师优先
|
||||
if student_work.teacher_score
|
||||
student_work.final_score = student_work.teacher_score
|
||||
student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty
|
||||
student_work.work_score = student_work.teacher_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
|
||||
else
|
||||
if student_work.teaching_asistant_score.nil? #教辅未评分
|
||||
if student_work.student_score.nil?
|
||||
|
@ -128,7 +128,7 @@ class StudentWork < ActiveRecord::Base
|
|||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
if student_work.final_score
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
|
||||
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
|
||||
else
|
||||
student_work.work_score = nil
|
||||
|
@ -163,7 +163,7 @@ class StudentWork < ActiveRecord::Base
|
|||
student_work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
if student_work.final_score
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty
|
||||
score = student_work.final_score - student_work.absence_penalty - student_work.late_penalty - student_work.appeal_penalty
|
||||
student_work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) if score
|
||||
else
|
||||
student_work.work_score = nil
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
#encoding=UTF-8
|
||||
class StudentWorksScore < ActiveRecord::Base
|
||||
#reviewer_role: 1:教师评分;2:教辅评分;3:学生匿评
|
||||
#appeal_status: 0:正常;1:申诉中,2:撤销申诉;3:申诉成功;4申诉被拒绝
|
||||
attr_accessible :student_work_id, :user_id, :score, :comment, :reviewer_role
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :student_work
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
has_one :student_works_scores_appeal, :dependent => :destroy
|
||||
|
||||
acts_as_attachable
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
class StudentWorksScoresAppeal < ActiveRecord::Base
|
||||
attr_accessible :appeal_status, :comment, :student_works_score_id, :user_id
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
has_many :applied_messages, :class_name => 'AppliedMessage', :as => :applied, :dependent => :destroy
|
||||
belongs_to :student_works_score
|
||||
belongs_to :user
|
||||
end
|
||||
|
|
|
@ -82,7 +82,7 @@ class User < Principal
|
|||
#每日一报、一事一报、不报
|
||||
MAIL_NOTIFICATION_OPTIONS = [
|
||||
#['week', :label_user_mail_option_week],
|
||||
['day', :label_user_mail_option_day],
|
||||
# ['day', :label_user_mail_option_day],
|
||||
['all', :label_user_mail_option_all],
|
||||
['none', :label_user_mail_option_none]
|
||||
]
|
||||
|
@ -110,6 +110,7 @@ class User < Principal
|
|||
has_many :student_works_evaluation_distributions, :dependent => :destroy
|
||||
has_many :student_works_scores, :dependent => :destroy
|
||||
has_many :student_work_projects, :dependent => :destroy
|
||||
has_many :student_works_scores_appeals, :dependent => :destroy
|
||||
has_many :apply_homeworks, :dependent => :destroy
|
||||
has_many :apply_resources, :dependent => :destroy
|
||||
#end
|
||||
|
@ -1216,13 +1217,9 @@ class User < Principal
|
|||
end
|
||||
end
|
||||
|
||||
#为新注册用户发送留言
|
||||
# 为新注册用户发送留言
|
||||
# 只发三条没可以不用delay job,而且这个最好是注册的时候就能看到
|
||||
def add_new_jour
|
||||
self.delay.add_new_jour_delay
|
||||
end
|
||||
|
||||
#为新注册用户发送留言
|
||||
def add_new_jour_delay
|
||||
Rails.logger.info "add_new_jour_delay!!!!!!!!!"
|
||||
if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0"
|
||||
if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any?
|
||||
|
@ -1238,6 +1235,26 @@ class User < Principal
|
|||
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
end
|
||||
end
|
||||
# self.delay.add_new_jour_delay
|
||||
end
|
||||
|
||||
#为新注册用户发送留言
|
||||
def add_new_jour_delay
|
||||
# Rails.logger.info "add_new_jour_delay!!!!!!!!!"
|
||||
# if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0"
|
||||
# if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any?
|
||||
# lead_message1 = Message.find(19292)
|
||||
# notes1 = lead_message1.content
|
||||
# lead_message2 = Message.find(19291)
|
||||
# notes2 = lead_message2.content
|
||||
# lead_message3 = Message.find(19504)
|
||||
# notes3 = lead_message3.content
|
||||
# #user_id 默认为课程使者创建
|
||||
# self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
# self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
# self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
# 更新邮箱的同事,更新invite_lists表中的邮箱信息
|
||||
|
|
|
@ -24,4 +24,9 @@ class UserWechat < ActiveRecord::Base
|
|||
BlogComment.where(author_id: old_user).update_all(author_id: u.id)
|
||||
UserActivity.where(user_id: old_user).update_all(user_id: u.id)
|
||||
end
|
||||
|
||||
|
||||
def unsubscribe!
|
||||
self.delete
|
||||
end
|
||||
end
|
||||
|
|
|
@ -584,6 +584,8 @@ class CoursesService
|
|||
@state = 2
|
||||
elsif course[:is_delete] == 1
|
||||
@state = 11
|
||||
elsif course[:invite_code_halt] == 1
|
||||
@state = 14
|
||||
else
|
||||
if current_user.member_of_course?(course) #如果已经是成员
|
||||
@state = 3
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<% end %>
|
||||
|
||||
<div>
|
||||
<input type="text" name="article_homepage[title]" id="message_subject" class="InputBox" style="width: 99.5%;" maxlength="255" onkeyup="regexTopicSubject();" placeholder="请输入标题,例如:张小兰的个人主页" value="<%=@article.title %>" />
|
||||
<input type="text" name="article_homepage[title]" id="message_subject" class="InputBox" style="width: 99.5%;" maxlength="255" onkeyup="regexTopicSubject();" placeholder="请输入标题" value="<%=@article.title %>" />
|
||||
<p id="subjectmsg"></p>
|
||||
</div>
|
||||
<div>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span id="reply_praise_count_<%=comment.id %>">
|
||||
<span class="reply_praise_count_<%=comment.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
<div class="postDetailDate mb5"><%= format_time( @article.created_on)%></div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="homepagePostIntro break_word upload_img table_maxWidth " id="activity_description_<%= @article.id%>">
|
||||
<div class="homepagePostIntro break_word upload_img table_maxWidth ke-block" id="activity_description_<%= @article.id%>">
|
||||
<div id="intro_content_<%= @article.id%>">
|
||||
<%= @article.content.to_s.html_safe %>
|
||||
</div>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<% if @course %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/course_news_post_reply', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% elsif @project %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'projects/project_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% else %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
$("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(render :partial => 'organizations/course_news_post_reply', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% end %>
|
||||
sd_create_editor_from_data('<%= @user_activity_id%>',"","100%", "UserActivity");
|
||||
|
|
|
@ -62,17 +62,17 @@
|
|||
<% when 'HomeworkCommon' %>
|
||||
<%= render :partial => 'users/course_homework', :locals => {:activity => act, :user_activity_id => activity.id, :hw_status => 2} %>
|
||||
<% when 'News' %>
|
||||
<%= render :partial => 'users/course_news', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<%= render :partial => 'users/course_news', :locals => {:activity => act, :user_activity_id => activity.id, :is_course => 1} %>
|
||||
<% when 'Message' %>
|
||||
<%= render :partial => 'users/course_message', :locals => {:activity => act, :user_activity_id => activity.id,:is_course=>1,:is_board=>0} %>
|
||||
<% when 'Poll' %>
|
||||
<%= render :partial => 'users/course_poll', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<%= render :partial => 'users/course_poll', :locals => {:activity => act, :user_activity_id => activity.id, :is_course => 1} %>
|
||||
<% when 'JournalsForMessage' %>
|
||||
<%= render :partial => 'users/course_journalsformessage', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<%= render :partial => 'users/course_journalsformessage', :locals => {:activity => act, :user_activity_id => activity.id, :is_course => 1} %>
|
||||
<% when 'Attachment' %>
|
||||
<%= render :partial => 'users/course_attachment', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<% when 'Course' %>
|
||||
<%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => activity.id, :is_course => 1} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,27 +1,15 @@
|
|||
<% unless contributor_course_scor(course.id).count == 0 %>
|
||||
<% count = contributor_course_scor(course.id).select{|ccs| ccs.con_score != 0 && !ccs.con_score.nil?}.count %>
|
||||
<% unless count == 0 %>
|
||||
<div>
|
||||
<ul class="rankList">
|
||||
<h3 style="font-size: 14px; font-weight: normal;">
|
||||
<% if (User.current.logged? && course.open_student == 1) || (User.current.member_of_course?(course)) || User.current.admin? %>
|
||||
<%= link_to "班级活跃度", course_member_path(course, :role => 2, :sort_type => 'act_score'), :class => 'fontGrey3' %>
|
||||
<%= link_to "活跃度", course_member_path(course, :role => 2, :sort_type => 'act_score'), :class => 'fontGrey3' %>
|
||||
<% else %>
|
||||
<span class="fontGrey7"> 班级活跃度 </span>
|
||||
<span class="fontGrey7"> 活跃度 </span>
|
||||
<% end %>
|
||||
<a class="sy_cmore fr" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor: pointer; position:relative;">积分规则</a>
|
||||
<div class="cl"></div>
|
||||
</h3>
|
||||
<div class="numIntro undis" style="cursor:pointer;">
|
||||
<div class="active-degree-rule">
|
||||
积分规则<br/>
|
||||
资源发布:资源数 x 5 <br/>
|
||||
问答发布:发帖数 x 2 <br/>
|
||||
通知发布:通知数 x 1 <br/>
|
||||
问答回复:回复数 x 1 <br/>
|
||||
作业留言:留言数 x 1 <br/>
|
||||
通知留言:留言数 x 1 <br/>
|
||||
班级留言:留言数 x 1 <br/>
|
||||
总得分为以上得分之和</div>
|
||||
</div>
|
||||
<% contributor_course_scor(course.id).each do |contributor_score| %>
|
||||
<% total_score = contributor_score.con_score %>
|
||||
<% if !total_score.nil? && total_score !=0 %>
|
||||
|
|
|
@ -3,21 +3,23 @@
|
|||
<ul class="rankList">
|
||||
<h4 style="font-size: 14px; font-weight: normal;">
|
||||
<% if (User.current.logged? && course.open_student == 1) || (User.current.member_of_course?(course)) || User.current.admin? %>
|
||||
<%= link_to "班级英雄榜", course_member_path(course, :role => 2), :class => 'fontGrey3' %>
|
||||
<%= link_to "英雄榜", course_member_path(course, :role => 2), :class => 'fontGrey3' %>
|
||||
<% else %>
|
||||
<span class="fontGrey7">班级英雄榜</span>
|
||||
<span class="fontGrey7">英雄榜</span>
|
||||
<% end %>
|
||||
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor:pointer;">积分规则</a></h4>
|
||||
<div style="cursor:pointer;" class="numIntro undis">
|
||||
<div class="hero-degree-rule">积分规则<br/>
|
||||
英雄榜的得分是每个同学作业的得分总和
|
||||
</div>
|
||||
</div>
|
||||
</h4>
|
||||
|
||||
<% hero_homework_scores.each do |student_score| %>
|
||||
<% if student_score.score.to_i != 0 %>
|
||||
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %></a>
|
||||
<p><a href="javascript:void:(0);"><%=link_to student_score.user.show_name, user_path(student_score.user), :title => student_score.user.show_name %></a></p>
|
||||
<p><span class="c_red" style="cursor:pointer" ><%= student_score.score<0 ? 0 : student_score.score.to_i %></span></p>
|
||||
<li> <a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %></a>
|
||||
<p><a href="javascript:void(0);"><%=link_to student_score.user.show_name, user_path(student_score.user), :title => student_score.user.show_name %></a></p>
|
||||
<p><span class="c_red" style="cursor:pointer" >
|
||||
<% if !(User.current.allowed_to?(:as_teacher, @course) || User.current.admin?) && User.current.id != student_score.user.id && course_has_score_open_common_homework(@course) %>
|
||||
<%= "**" %>
|
||||
<% else %>
|
||||
<%= student_score.score<0 ? 0 : student_score.score.to_i %>
|
||||
<% end %>
|
||||
</span></p>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,23 +1,26 @@
|
|||
<div class="st_list">
|
||||
<div class="st_box">
|
||||
<a href="javascript:void(0)" class="fr fb mb5" >加入时间</a>
|
||||
<a href="javascript:void(0)" class="fr fb mb5 mr70" >角色</a>
|
||||
<div class="cl"></div><!--st_box_top end-->
|
||||
<div class="sy_class_fenban clear">
|
||||
<div class="mt5">
|
||||
<div style="border-bottom: 1px solid #CCC">
|
||||
<span href="javascript:void(0)" class="c_grey f14 fl fb mb5 ml65" >姓名</span>
|
||||
<span href="javascript:void(0)" class="c_grey f14 fr fb mb5 mr20">加入时间</span>
|
||||
<span href="javascript:void(0)" class="c_grey f14 fr fb mb5 mr70" >角色</span>
|
||||
<div class="cl"></div><!--st_box_top end-->
|
||||
</div>
|
||||
|
||||
<div class="mt10">
|
||||
<% members.each do |member| %>
|
||||
<div class="st_boxlist">
|
||||
<%= link_to image_tag(url_to_avatar(member.user), :width => "32", :height => "32", :style => "display:block;"), user_path(member.user_id),:target => '_blank', :class => 'st_img' ,:alt => "用户头像" %>
|
||||
<span class="fl ml10 c_grey"><%= l(:label_username)%></span>
|
||||
<%= link_to(member.user.show_name, user_path(member.user),:class => "ml10 c_blue02") %>
|
||||
<span class="fr c_grey"><%= format_date(member.created_on)%></span>
|
||||
<span class="fr c_grey mr30 w45"><%= zh_course_role(h member.roles.sort.collect(&:to_s).first)%></span>
|
||||
<div class="teacher_st_boxlist">
|
||||
<%= link_to image_tag(url_to_avatar(member.user), :width => "50", :height => "50", :style => "display:block;", :class =>'teacher_member_img'), user_path(member.user_id), :class => 'fl' ,:alt => "用户头像" %>
|
||||
<div class="fl">
|
||||
<%= link_to(member.user.show_name, user_path(member.user),:class => "ml10 mt5 mb10 link-blue db") %>
|
||||
<span class="c_grey ml10"><%= l(:label_username)%><%= member.user.login%></span>
|
||||
</div>
|
||||
<span class="fr c_grey mr15"><%= format_date(member.created_on)%></span>
|
||||
<span class="fr c_grey mr55 w45" style="text-align: center"><%= zh_course_role(h member.roles.sort.collect(&:to_s).first)%></span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end%>
|
||||
|
||||
<ul class="wlist">
|
||||
<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
|
@ -25,7 +25,7 @@
|
|||
<div class="ping_disfoot f14">
|
||||
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||
|
||||
<span id="reply_praise_count_<%=journal.id %>">
|
||||
<span class="reply_praise_count_<%=journal.id %>">
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>journal, :user_activity_id=>journal.id,:type=>"reply"}%>
|
||||
</span>
|
||||
<% if reply_allow %>
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
<li>
|
||||
<label>班级邀请码:</label>
|
||||
<input class=" sy_input_txt fl" name="invite_code" placeholder="请输入五位班级邀请码">
|
||||
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -18,14 +17,13 @@
|
|||
<input type="checkbox" name="role[]" value="9" id="join_course_role_9" class="ml5 mr5 "/><span class="mr10">教师</span>
|
||||
<input type="checkbox" name="role[]" value="7" id="join_course_role_7" class="ml5 mr5"/><span class="mr10">助教</span>
|
||||
<input type="checkbox" name="role[]" value="10" id="join_course_role_10" class="ml5 mr5"/><span class="mr10">学生</span>
|
||||
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li>
|
||||
<p id="none_checked_notice" class="c_red none f12" style="margin-left: 42px;">请至少选择一个身份</p>
|
||||
<li class="mt10">
|
||||
<label> </label>
|
||||
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="$('#new-watcher-form').submit();hideModal()">确 定</a>
|
||||
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="submit_join_course();">确 定</a>
|
||||
<a href="javascript:void(0);" class="sy_btn_grey fl ml20" onclick="hideModal()">取 消</a>
|
||||
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -33,6 +31,16 @@
|
|||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function submit_join_course(){
|
||||
if ($("input[name='role[]']:checked").length >= 1){
|
||||
$("#none_checked_notice").hide();
|
||||
$('#new-watcher-form').submit();
|
||||
hideModal();
|
||||
}else{
|
||||
$("#none_checked_notice").show();
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$("#join_course_role_7").on('click', function(){
|
||||
if($("#join_course_role_7").is(":checked")) {
|
||||
|
|
|
@ -79,29 +79,39 @@
|
|||
<% sum = hw_score + ex_score + act_score %>
|
||||
<td><%= (@page - 1) * @limit + i + 1 %></td>
|
||||
<td>
|
||||
<%= link_to image_tag(url_to_avatar(user), :width => "30", :height => "30", :style => "display:block;"), user_path(member.user_id), :class => 'sy_class_users_st fl mt5 mr5' ,:alt => "用户头像" %>
|
||||
<span class="fl sy_class_users_st_name" title="<%= user.show_name %>"><%= user.show_name %></span>
|
||||
<%= link_to image_tag(url_to_avatar(user), :width => "30", :height => "30", :style => "display:block;"), user_path(user), :class => 'sy_class_users_st fl mt5 mr5' ,:alt => "用户头像", :target => '_blank' %>
|
||||
<%= link_to user.show_name, user_path(user), :class => 'fl sy_class_users_st_name' ,:title => "#{user.show_name}", :target => '_blank' %>
|
||||
</td>
|
||||
<td>
|
||||
<span class="sy_class_users_st_num" title="<%= user.user_extensions.student_id %>"><%= user.user_extensions.student_id %></span>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to format("%0.2f", hw_score), {
|
||||
:action => 'show_member_score',
|
||||
:member_id => member.id,
|
||||
:remote => true},
|
||||
:class => "" %>
|
||||
<% if !is_teacher && User.current.id != member.user_id && course_has_score_open_common_homework(@course) %>
|
||||
<a>**</a>
|
||||
<% else %>
|
||||
<%= link_to format("%0.2f", hw_score), {
|
||||
:action => 'show_member_score',
|
||||
:member_id => member.id,
|
||||
:remote => true},
|
||||
:class => "" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= ex_score %></td>
|
||||
<td>
|
||||
<%= link_to act_score, {
|
||||
:action => 'show_member_act_score',
|
||||
:member_id => member.id,
|
||||
:remote => true},
|
||||
:class => '' %>
|
||||
:action => 'show_member_act_score',
|
||||
:member_id => member.id,
|
||||
:remote => true},
|
||||
:class => '' %>
|
||||
</td>
|
||||
<td class="pr">
|
||||
<span class="sum_score_tip"><%= format("%0.2f", sum) %></span>
|
||||
<span class="sum_score_tip">
|
||||
<% if !is_teacher && User.current.id != member.user_id && course_has_score_open_common_homework(@course) %>
|
||||
<a>**</a>
|
||||
<% else %>
|
||||
<%= format("%0.2f", sum) %>
|
||||
<% end %>
|
||||
</span>
|
||||
<div class="sy_tips_box_inner undis" style="left: <%=is_teacher ? '230px' : '215px' %>; top: -60px; text-align: left;">
|
||||
<span style="top: 75px;"></span>
|
||||
<p >
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
hideModal();
|
||||
$("#member_li_<%=params[:member_id] %>").html("");
|
||||
var all_indexes = $("#member_li_<%=params[:member_id] %>").nextAll().find("td:first-child");
|
||||
for(var i = 0; i < all_indexes.length; i++){
|
||||
$(all_indexes[i]).html(parseInt($(all_indexes[i]).html()) - 1);
|
||||
}
|
||||
$("#member_li_<%=params[:member_id] %>").remove();
|
||||
$("#st_groups").html("<%=escape_javascript(render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups}) %>");
|
||||
$("#group_children_list").html("<%= escape_javascript( render :partial => 'layouts/group_children_list', :locals => {:course => @course})%>");
|
||||
$("#student_number").html("<%= studentCount(@course) %>");
|
||||
|
|
|
@ -1,20 +1,8 @@
|
|||
<div class="sy_class_r sy_class_nobg fr ml10">
|
||||
<div class="sy_class_r_head mb10">
|
||||
<h3>学生列表(<%=@group.name %>)</h3>
|
||||
<div class="hw_more_box">
|
||||
<ul>
|
||||
<li class="hw_more_icons">
|
||||
<ul class="hw_more_txt">
|
||||
<li><%= link_to l(:label_export_excel), export_course_member_excel_course_path(@course,:group_id => @group.id ,:format => 'xls'), :class => 'hw_more_li'%></li>
|
||||
<% if @canShowCode %>
|
||||
<li>
|
||||
<%=link_to "成员管理", {:controller => 'courses', :action => 'settings', :id => @course.id, :tab => 'member'}, :class => 'hw_more_li' %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<h3 class="fl">学生列表(<%=@group.name %>)</h3>
|
||||
<%= link_to "导出成绩", export_course_member_excel_course_path(@course,:group_id => @group.id ,:format => 'xls'), :class => 'link-blue fr mt5'%>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="sy_class_fenban clear">
|
||||
|
|
|
@ -5,77 +5,82 @@
|
|||
<% if @state == 0 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">加入成功</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 1 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">密码错误</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 2 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">班级已过期<br/>请联系班级管理员重启班级。(在配置班级处)</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 3 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您已经加入了班级</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 4 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您输入的邀请码错误</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 5 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您还未登录</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 6 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">申请成功,请等待审核</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 7%>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您已经发送过申请了,请耐心等待</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 8%>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您已经是该班级的教师了</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 9%>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您已经是该班级的教辅了</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 10%>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您已经是该班级的管理员了</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 11%>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">该班级已被删除</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
'<div class="clear mt15"><p class="text_c f14">该班级已归档,请联系老师</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 12 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您已经发送过申请了,请耐心等待</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 13 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">申请成功,请等待审核</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="refresh_current_course();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% elsif @state == 14 %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">此二维码已停用,请与老师联系</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% else %>
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">未知错误,请稍后再试</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确 定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
<% if @role.to_i == 1 %>
|
||||
<div class="courseRSide fl" id="homework_page_right">
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2 fl"><%= @subPage_title%></h2>
|
||||
<div class="sy_class_r sy_class_nobg fr ml10">
|
||||
<div class="sy_class_r_head mb10">
|
||||
<h3 class="fl"><%= @subPage_title %></h3>
|
||||
<% if User.current.allowed_to?(:as_teacher,@course) %>
|
||||
<span class="fr f14 fontGrey2" style="height: 40px; line-height: 40px; margin-right: 15px;">
|
||||
<%=link_to "成员管理", {:controller => 'courses', :action => 'settings', :id => @course.id, :tab=>'member'}, :class => 'hw_more_li' %>
|
||||
</span>
|
||||
<%=link_to "成员管理", {:controller => 'courses', :action => 'settings', :id => @course.id, :tab=>'member'}, :class => 'link-blue fr mt5' %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<%= render :partial => 'course_teacher', :locals => {:members => @members} %>
|
||||
</div>
|
||||
|
@ -17,7 +16,7 @@
|
|||
<% if User.current.allowed_to?(:as_teacher,@course) %>
|
||||
<%=link_to "成员管理", {:controller => 'courses', :action => 'settings', :id => @course.id, :tab => 'member'}, :class => 'link-blue ml10 fr mt5' %>
|
||||
<% end %>
|
||||
<%= link_to l(:label_export_excel), export_course_member_excel_course_path(@course,:format => 'xls'), :class => 'link-blue fr mt5'%>
|
||||
<%= link_to "导出成绩", export_course_member_excel_course_path(@course,:format => 'xls'), :class => 'link-blue fr mt5'%>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<%= render :partial => 'course_student', :locals => {:members => @members} %>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
$("#project_info_<%=@course.id %>").html("<%= escape_javascript(render :partial => 'layouts/course_base_info') %>");
|
||||
hideModal();
|
|
@ -2,13 +2,13 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th class="newupload_td01"> </th>
|
||||
<th class="pr">
|
||||
<%= link_to "试卷标题", search_exercises_exercise_index_path(:course_id => course_id, :order => "exercise_name", :sort => @r_sort), :remote => true%>
|
||||
<th class="pr tl">
|
||||
<%= link_to "试卷标题", search_exercises_exercise_index_path(:course_id => course_id, :order => "exercise_name", :sort => @r_sort), :remote => true, :class => "ml5"%>
|
||||
<% if order == "exercise_name" %>
|
||||
<%= link_to "", search_exercises_exercise_index_path(:course_id => course_id, :order => "exercise_name", :sort => @r_sort), :class => "#{@r_sort == 'desc' ? 'sortupbtn' : 'sortdownbtn'}", :style => "position: absolute; top: 8px; left: 172px;", :remote => true %>
|
||||
<% end %>
|
||||
</th>
|
||||
<th class="newupload_td03" style="color: #7f7f7f;">来源</th>
|
||||
<th class="newupload_td03 tl" style="color: #7f7f7f;"><span class="ml5">来源</span></th>
|
||||
<th class="newupload_td04 pr">
|
||||
<%= link_to "创建时间", search_exercises_exercise_index_path(:course_id => course_id, :order => "created_at", :sort => @r_sort), :remote => true%>
|
||||
<% if order == "created_at" %>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<span class="c_grey fl mr15">测试时长:<%= exercise.time.nil? || exercise.time == -1 ? '不限' : exercise.time.to_s + "分钟" %></span>
|
||||
<span class="c_grey fl mr15">截止时间:<%= exercise.end_time.nil? ? '未设置' : format_time(exercise.end_time) %></span>
|
||||
<span class="c_grey fl mr15">发布时间:<%= exercise.publish_time.nil? ? '未设置' : format_time(exercise.publish_time) %></span>
|
||||
<% if @is_teacher && exercise.exercise_status > 1 %>
|
||||
<% if exercise.exercise_status > 1 %>
|
||||
<span class="c_grey fl mr15">已提交:<span class="c_blue"><%= exercise.exercise_users.where("commit_status = 1").count %></span></span>
|
||||
<span class="c_grey fl mr15">未提交:<span class="c_blue"><%= exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count %></span></span>
|
||||
<% end %>
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
<% unless exercise.publish_time.nil? %>
|
||||
<span class="mr100">发布时间:<%=Time.parse(h(exercise.publish_time)).strftime("%Y-%m-%d %H:%M:%S") %></span>
|
||||
<% end %>
|
||||
<span class="mr100">截止时间:<%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") %></span>
|
||||
<% unless exercise.end_time.nil? %>
|
||||
<span class="mr100">截止时间:<%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") %></span>
|
||||
<% end %>
|
||||
<% if exercise.time != -1 %>
|
||||
<span class="fr">测验时长:<%=exercise.time %>分钟</span>
|
||||
<% end %>
|
||||
|
|
|
@ -94,6 +94,7 @@
|
|||
<%= render :partial => "files/tag_yun_project", :locals => {:tag_list => @tag_list,:project => @project, :tag_name => @tag_name}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% if @tip_all_attachments > 0 %>
|
||||
<div class="re_con_top">
|
||||
<p class="f_l fontBlue f_b f_14" id="tip_attachment_count">
|
||||
<%= render :partial => "files/tip_attachment_count" %>
|
||||
|
@ -124,5 +125,8 @@
|
|||
<div id="course_list">
|
||||
<%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "projects/no_data" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%# html_title(l(:label_attachment_plural)) -%>
|
|
@ -18,7 +18,8 @@
|
|||
</div>
|
||||
<div class="postDetailReply fr">
|
||||
<a href="<%= forum_memo_path(topic.forum, topic)%>" class="postReplyIcon mr5" target="_blank"></a>
|
||||
<%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic),:target =>'_blank',:class=>'linkGrey2' %>
|
||||
<% replies_count = Memo.where("root_id = #{topic.id}").count %>
|
||||
<%= link_to (replies_count), forum_memo_path(topic.forum, topic),:target =>'_blank',:class=>'linkGrey2' %>
|
||||
<a href="javascript:void(0);" class="linkGrey2 disablePostLikeIcon ml10" style="cursor: default" title="点赞人数" > <%= get_praise_num(topic)%></a>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<div id="muban_popup_box" style="width:400px;">
|
||||
<div class="muban_popup_top">
|
||||
<h3 class="fl">成绩公开范围</h3>
|
||||
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<%= form_for('new_form',:url =>{:controller => 'homework_common',:action => 'set_score_open',:id => @homework.id,:user_activity_id => @user_activity_id, :hw_status => @hw_status},
|
||||
:method => "post", :remote => true) do |f|%>
|
||||
<div class="muban_popup_con clear">
|
||||
<div class="clear mt15 ml20">
|
||||
<ul class="pro_newsetting_con fl">
|
||||
<li class="mb10 clear">
|
||||
<ul class="fl">
|
||||
<li class="clear">
|
||||
<label class="fl ml5">请选择作品成绩的公开范围</label>
|
||||
</li>
|
||||
<li class="clear ml20">
|
||||
<input type="radio" class="fl" id="open_to_all" <%= @homework.score_open == 1 ? "checked" : "" %> value="1" name="score_open"/>
|
||||
<label for="open_to_all" class="fl ml5 fontGrey2">成绩对所有学生可见</label>
|
||||
</li>
|
||||
<li class="clear ml20">
|
||||
<input type="radio" class="fl" id="open_to_me" <%= @homework.score_open == 0 ? "checked" : "" %> value="0" name="score_open"/>
|
||||
<label for="open_to_me" class="fl ml5 fontGrey2">成绩仅对自己可见</label>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="fl ml20">
|
||||
<div class="popup_tip_box fontGrey2">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p>老师和助教始终能看到所有成绩</p>
|
||||
</div>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class="fr sy_btn_blue mr20" onclick="$(this).parent().parent().parent().submit();">确定</a>
|
||||
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="hideModal();">取消</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% end%>
|
||||
</div>
|
|
@ -1,4 +1,4 @@
|
|||
<div id="muban_popup_box" style="width:550px;">
|
||||
<div id="muban_popup_box" style="width:600px;">
|
||||
<div class="muban_popup_top">
|
||||
<h3 class="fl">评分设置</h3>
|
||||
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
|
||||
|
@ -17,10 +17,27 @@
|
|||
<input type="text" name="absence_penalty" id="absence_penalty_num" placeholder="0-50" class="fl issues_calendar_input" value="<%= homework.homework_detail_manual.absence_penalty%>" onkeyup="check_late_penalty('absence_penalty_num')"/>
|
||||
</li>
|
||||
<li class="mb10 clear">
|
||||
<input type="checkbox" class="fl ml100" name="no_anon_penalty" <%=homework.homework_detail_manual.no_anon_penalty == 1 ? 'checked' : '' %> value="<%=homework.homework_detail_manual.no_anon_penalty%>"/>
|
||||
<label class="pop_box_label fl ml10" style="text-align: left">不参加匿评扣分</label>
|
||||
<input type="checkbox" class="fl ml100" id="no_anon_penalty" name="no_anon_penalty" <%=homework.homework_detail_manual.no_anon_penalty == 0 ? 'checked' : '' %> value="<%=homework.homework_detail_manual.no_anon_penalty%>"/>
|
||||
<label class="pop_box_label fl ml10" for="no_anon_penalty" style="text-align: left; width: 120px;">扣分(不参加匿评)</label>
|
||||
</li>
|
||||
<li class="mb10 clear mt30">
|
||||
<label class="pop_box_label fl">匿评申诉 : </label>
|
||||
<ul class="fl">
|
||||
<li class="clear">
|
||||
<input type="radio" class="fl" id="anonymous_appeal" value="1" name="anonymous_appeal"/>
|
||||
<label for="anonymous_appeal" class="fl ml5">启用</label>
|
||||
</li>
|
||||
<li class="clear" style="margin-top: 27px;">
|
||||
<label class="pop_box_label fl">违规匿评扣分 : </label>
|
||||
<input type="text" style="width: 75px; padding-left: 10px;" id="appeal_penalty" name="appeal_penalty" placeholder="0-50" value="<%=homework.homework_detail_manual.appeal_penalty %>" class="fl">
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="mb10 clear" style="margin-top: 45px;">
|
||||
<label class="pop_box_label fl"> </label>
|
||||
<input type="radio" class="fl" value="0" id="no_anonymous_appeal" name="anonymous_appeal"/><label for="no_anonymous_appeal" class="fl ml5">禁用</label>
|
||||
</li>
|
||||
<li class="mb10 clear">
|
||||
<label class="pop_box_label fl">最终得分 : </label>
|
||||
<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/><label for="teacher_score" class=" fl ml5">教师评分</label>
|
||||
</li>
|
||||
|
@ -61,14 +78,29 @@
|
|||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p >教师评分 - 迟交扣分 - 缺评扣分</p>
|
||||
<p>学生可对匿评成绩发起申诉<br/>您可以接受或者拒绝申诉<br/></p>
|
||||
</div>
|
||||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p>请输入数值0-50<br/>若匿评时评出不合理的成绩被申诉成功,<br/>扣违规匿评分<br/></p>
|
||||
</div>
|
||||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p>学生不能对匿评成绩发起申诉</p>
|
||||
</div>
|
||||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p >教师评分-迟交扣分-缺评扣分-违规匿评扣分</p>
|
||||
</div>
|
||||
<div class="popup_tip_box fontGrey2">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p >助教评分 * 其百分比 + <br/>
|
||||
学生匿评平均分 * 其百分比 - <br/>
|
||||
( 迟交扣分 + 缺评扣分 )</p>
|
||||
<p >助教评分*其百分比+ <br/>
|
||||
学生匿评平均分*其百分比- <br/>
|
||||
( 迟交扣分+缺评扣分+违规匿评扣分 )</p>
|
||||
</div>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
|
@ -106,5 +138,10 @@
|
|||
<% end %>
|
||||
}
|
||||
});
|
||||
<% if homework.anonymous_appeal == 1 %>
|
||||
$("#anonymous_appeal").attr("checked", "checked");
|
||||
<% else %>
|
||||
$("#no_anonymous_appeal").attr("checked", "checked");
|
||||
<% end %>
|
||||
});
|
||||
</script>
|
|
@ -1,4 +1,4 @@
|
|||
<div id="muban_popup_box" style="width:570px;">
|
||||
<div id="muban_popup_box" style="width:600px;">
|
||||
<div class="muban_popup_top">
|
||||
<h3 class="fl">评分设置</h3>
|
||||
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
|
||||
|
@ -17,10 +17,27 @@
|
|||
<input type="text" name="absence_penalty" id="absence_penalty_num" placeholder="0-50" class="fl w180" value="<%= homework.homework_detail_manual.absence_penalty%>" onkeyup="check_late_penalty('absence_penalty_num')"/>
|
||||
</li>
|
||||
<li class="mb10 clear">
|
||||
<input type="checkbox" class="fl ml100" name="no_anon_penalty" <%=homework.homework_detail_manual.no_anon_penalty == 1 ? 'checked' : '' %> value="<%=homework.homework_detail_manual.no_anon_penalty%>"/>
|
||||
<label class="pop_box_label fl ml10" style="text-align: left">不参加匿评扣分</label>
|
||||
<input type="checkbox" class="fl ml100" id="no_anon_penalty" name="no_anon_penalty" <%=homework.homework_detail_manual.no_anon_penalty == 0 ? 'checked' : '' %> value="<%=homework.homework_detail_manual.no_anon_penalty%>"/>
|
||||
<label class="pop_box_label fl ml10" for="no_anon_penalty" style="text-align: left; width: 120px;">扣分(不参加匿评)</label>
|
||||
</li>
|
||||
<li class="mb10 clear mt30">
|
||||
<label class="pop_box_label fl">匿评申诉 : </label>
|
||||
<ul class="fl">
|
||||
<li class="clear">
|
||||
<input type="radio" class="fl" id="anonymous_appeal" value="1" name="anonymous_appeal"/>
|
||||
<label for="anonymous_appeal" class="fl ml5">启用</label>
|
||||
</li>
|
||||
<li class="clear" style="margin-top: 27px;">
|
||||
<label class="pop_box_label fl">违规匿评扣分 : </label>
|
||||
<input type="text" style="width: 75px; padding-left: 10px;" id="appeal_penalty" name="appeal_penalty" placeholder="0-50" value="<%=homework.homework_detail_manual.appeal_penalty %>" class="fl" onkeyup="check_late_penalty('appeal_penalty')">
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="mb10 clear" style="margin-top: 45px;">
|
||||
<label class="pop_box_label fl"> </label>
|
||||
<input type="radio" class="fl" value="0" id="no_anonymous_appeal" name="anonymous_appeal"/><label for="no_anonymous_appeal" class="fl ml5">禁用</label>
|
||||
</li>
|
||||
<li class="mb10 clear">
|
||||
<label class="pop_box_label fl">最终得分 : </label>
|
||||
<input type="radio" class="fl" value="1" id="teacher_score" name="teacher_priority"/><label for="teacher_score" class=" fl ml5">教师评分</label>
|
||||
</li>
|
||||
|
@ -40,7 +57,7 @@
|
|||
<span class="fl ml5">助教评分</span>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<input type="text" style="width: 49px; padding-left: 10px;" id="student_proportion" value="<%= (100 - homework.homework_detail_manual.ta_proportion * 100).to_i - (homework.homework_detail_programing.ta_proportion * 100).to_i%>%" class="fl ml15" readonly>
|
||||
<input type="text" style="width: 49px; padding-left: 10px;" id="student_proportion" value="<%= (100 - homework.homework_detail_manual.ta_proportion * 100).to_i - (homework.homework_detail_programing.ta_proportion * 100).to_i%>" class="fl ml15" readonly>
|
||||
<span class="fl ml5">学生匿评</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -60,12 +77,27 @@
|
|||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p>匿评开启后提交的作品,未能参加<br/>匿评,按照全部缺评扣分</p>
|
||||
<p>匿评开启后提交的作品,未能参加匿评,<br/>按照全部缺评扣分</p>
|
||||
</div>
|
||||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p>教师评分-迟交扣分-缺评扣分</p>
|
||||
<p>学生可对匿评成绩发起申诉<br/>您可以接受或者拒绝申诉<br/></p>
|
||||
</div>
|
||||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p>请输入数值0-50<br/>若匿评时评出不合理的成绩被申诉成功,<br/>扣违规匿评分<br/></p>
|
||||
</div>
|
||||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p>学生不能对匿评成绩发起申诉</p>
|
||||
</div>
|
||||
<div class="popup_tip_box fontGrey2 mb10">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p>教师评分-迟交扣分-缺评扣分-违规匿评扣分</p>
|
||||
</div>
|
||||
<div class="popup_tip_box fontGrey2">
|
||||
<em></em>
|
||||
|
@ -73,7 +105,7 @@
|
|||
<p>系统评分*其百分比+ <br/>
|
||||
助教评 *其百分比+ <br/>
|
||||
学生匿评平均分*其百分比 - <br/>
|
||||
( 迟交扣分+缺评扣分 )</p>
|
||||
( 迟交扣分+缺评扣分+违规匿评扣分 )</p>
|
||||
</div>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
|
@ -116,5 +148,10 @@
|
|||
<% end %>
|
||||
}
|
||||
});
|
||||
<% if homework.anonymous_appeal == 1 %>
|
||||
$("#anonymous_appeal").attr("checked", "checked");
|
||||
<% else %>
|
||||
$("#no_anonymous_appeal").attr("checked", "checked");
|
||||
<% end %>
|
||||
});
|
||||
</script>
|
|
@ -1,6 +1,2 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/alert_forbidden_anonymous', :locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","30%").css("left","30%").css("position","fixed").css("border","3px solid #269ac9");
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'student_work/alert_forbidden_anonymous', :locals => {:user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>";
|
||||
pop_box_new(htmlvalue, 400, 178);
|
|
@ -0,0 +1,2 @@
|
|||
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/alert_score_open_modal') %>";
|
||||
pop_box_new(htmlvalue, 400, 200);
|
|
@ -1,7 +1,7 @@
|
|||
<% if @homework.homework_type == 2 %>
|
||||
<% if @homework.anonymous_comment == 0 %>
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_pro',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>";
|
||||
pop_box_new(htmlvalue, 570, 355);
|
||||
pop_box_new(htmlvalue, 600, 580);
|
||||
<% else %>
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_pro_anon',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>";
|
||||
pop_box_new(htmlvalue, 500, 285);
|
||||
|
@ -9,19 +9,22 @@
|
|||
<% else %>
|
||||
<% if @homework.anonymous_comment == 0 %>
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_non_pro',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>";
|
||||
pop_box_new(htmlvalue, 500, 325);
|
||||
pop_box_new(htmlvalue, 600, 550);
|
||||
<% else %>
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_common/set_score_rule_none_pro_anon',:locals => {:homework => @homework, :student_path => false, :user_activity_id => @user_activity_id,:hw_status => @hw_status}) %>";
|
||||
pop_box_new(htmlvalue, 500, 225);
|
||||
<% end %>
|
||||
<% end %>
|
||||
function set_score_rule_submit() {
|
||||
if($("#late_penalty_num").val() == ""){
|
||||
if($("#late_penalty_num").val().trim() == ""){
|
||||
$("#late_penalty_num").val("0");
|
||||
}
|
||||
if($("#absence_penalty_num").val() == ""){
|
||||
if($("#absence_penalty_num").val().trim() == ""){
|
||||
$("#absence_penalty_num").val("0");
|
||||
}
|
||||
if($("#appeal_penalty").val().trim() == ""){
|
||||
$("#appeal_penalty").val("0");
|
||||
}
|
||||
$('#muban_popup_box').find('form').submit();
|
||||
hideModal();
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
hideModal();
|
||||
<% if @hw_status != 5 %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:hw_status=>@hw_status}) %>");
|
||||
<% if @user_activity_id != @homework.id %>
|
||||
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
|
||||
<% else %>
|
||||
sd_create_editor_from_data(<%= @homework.id%>,"","100%", "<%=@homework.class.to_s%>");
|
||||
<% end %>
|
||||
<% else %>
|
||||
$("#homework_post_brief").html("<%= escape_javascript(render :partial => 'student_work/homework_post_brief', :locals => {:homework => @homework, :is_teacher => @is_teacher}) %>");
|
||||
<% end %>
|
|
@ -2,5 +2,6 @@
|
|||
<%#= watcher_link_issue(@issue, User.current) %>
|
||||
<%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'talk_edit fr' if User.current.allowed_to?(:add_issues, @project) %>
|
||||
<%= link_to l(:button_delete), issue_path(@issue.id), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'talk_edit fr' if User.current.allowed_to?(:delete_issues, @project) %>
|
||||
<%= link_to l(:button_edit), 'javascript:void(0);', :onclick => 'issueEditShow();', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %>
|
||||
<%#= link_to l(:button_edit), 'javascript:void(0);', :onclick => 'issueEditShow();', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %>
|
||||
<%= link_to l(:button_edit), edit_issue_path(@issue), :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:edit_issues, @project) %>
|
||||
<%#= link_to l(:label_user_newfeedback), edit_issue_path(@issue.id), :onclick => 'showAndScrollTo("update", "issue_journal_kind_reply"); return false;', :class => 'talk_edit fr', :accesskey => accesskey(:edit) if @issue.editable? && User.current.allowed_to?(:add_issue_notes, @project) %>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<%= render :partial => 'action_menu' %>
|
||||
<div class="cl"></div>
|
||||
<% if @issue.description? || @issue.attachments.any? -%>
|
||||
<div class="talk_info mb10 issue_desc" id="issue_desc_<%= @issue.id %>" style="word-break:break-all;">
|
||||
<div class="talk_info mb10 issue_desc ke-block" id="issue_desc_<%= @issue.id %>" style="word-break:break-all;">
|
||||
<% 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 %>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div id="issue_edit" style="display: none">
|
||||
<div id="issue_edit">
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
|
|
|
@ -27,30 +27,7 @@
|
|||
<%#= wikitoolbar_for 'issue_description' %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="fl">
|
||||
<% if @issue.safe_attribute? 'tracker_id' %>
|
||||
<label class="label mt3"><span class="c_red f12">*</span> 类型 : </label>
|
||||
<%= f.select :tracker_id, @issue.project.trackers.collect { |t| [t.name, t.id] },
|
||||
{:required => true, :no_label => true},
|
||||
#:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')",
|
||||
:class => "w110" %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="fl ml41">
|
||||
<label class="label mt3"><span class="c_red f12">*</span><%= l(:field_status) %>:</label>
|
||||
<%# if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %>
|
||||
<%= f.select :status_id, (@allowed_statuses.collect { |p| [p.name, p.id] }),
|
||||
{:no_label => true},
|
||||
:class => "w110" %>
|
||||
</li>
|
||||
<li class="fl ml41">
|
||||
<label class="label mt3"><span class="c_red f12">*</span><%= l(:field_priority) %>:</label>
|
||||
<% 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 => "w110" %>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<li class="clear">
|
||||
<label class="label"><%= l(:label_attachment_plural) %>:</label>
|
||||
<%= render :partial => 'attachments/form', :locals => {:container => @issue} %>
|
||||
|
@ -59,11 +36,11 @@
|
|||
<% if params[:action] == "new" %>
|
||||
<a href="<%= project_issues_path(@project, :remote => true) %>" class="sy_btn_grey mr5 fr"> 取消</a>
|
||||
<% else %>
|
||||
<a href="javascript:void(0);" onclick="issueDetailShow();" class="sy_btn_grey mr5 fr" > 取消 </a>
|
||||
<%= link_to "取消", issue_path(@issue), :class => "sy_btn_grey mr5 fr" %>
|
||||
<% end %>
|
||||
<!--<a href="javascript:void(0);" class="sy_btn_blue mr5 fr"> 保存并继续</a>-->
|
||||
<!--<a href="javascript:void(0);" onclick="issue_desc_editor.sync();$('#issue-form').submit();" class="sy_btn_blue mr5 fr" id="issue_confirm"> 保存</a>-->
|
||||
<input onclick="issue_desc_editor.sync();$('#issue-form').submit();" class="sy_btn_blue fr mr5" onfocus="this.blur()" id="issue_confirm" style="width: 28px;color: #FFF" value="保存">
|
||||
<input onclick="issue_create();" class="sy_btn_blue fr mr5" onfocus="this.blur()" id="issue_confirm" style="width: 28px;color: #FFF" value="保存">
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="fl pro_new_conbox_right ml10 mb10">
|
||||
|
@ -74,76 +51,125 @@
|
|||
<label class="fl ml5" for="issue_is_private" id="issue_is_private_tips"><%= l(:field_set_private_tips)%></label>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class=" clear" id="versions_assigned_id">
|
||||
<li class="clear" id="versions_assigned_id">
|
||||
<span class="fl mt6 mr10">指派给</span>
|
||||
<% if @issue.safe_attribute? 'assigned_to_id' %>
|
||||
<%= f.select :assigned_to_id, assigned_options_for_select(@issue.assignable_users, @issue.assigned_to),
|
||||
{:required => @issue.required_attribute?('assigned_to_id'), :no_label => true},
|
||||
{:onchange => "change_assigned_tip();",:class => "w150"} %>
|
||||
{:onchange => "change_assigned_tip();",:class => "w160 fl"} %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class=" clear" id="assigned_to_tips">
|
||||
<%= @issue.assigned_to.nil? ? "未指派" : "已指派" %>
|
||||
</li>
|
||||
<li class=" clear" >
|
||||
<%= 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},
|
||||
{:onchange => "change_milestone_tip();", :class => "w150"} %>
|
||||
</li>
|
||||
<li class=" clear" id="milestone_option_tips">
|
||||
<%= @issue.fixed_version.nil? ? "未选择里程碑" : "已选择里程碑" %>
|
||||
<% if params[:action] == "new" %>
|
||||
<%= link_to "", new_project_version_path(@project, :is_issue => true, :issue_project_id => @project.id), :class => "pic_add mt5 ml5 fr", :remote => true %>
|
||||
<li class="clear">
|
||||
<span class="fl mt6 mr12">类 型</span>
|
||||
<% if @issue.safe_attribute? 'tracker_id' %>
|
||||
<%= f.select :tracker_id, @issue.project.trackers.collect { |t| [t.name, t.id] },{:required => true, :no_label => true},
|
||||
#:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')",
|
||||
:class => "fl", :style => "width:160px;padding-left:0px;" %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class=" clear" style="border:1px solid #c8c8c8;">
|
||||
<% 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'), :onchange => "issue_start_date_change();",
|
||||
:class => "fl calendar_input", :style => "width:170px;" %>
|
||||
<%= calendar_for('issue_start_date', 'start_date') if @issue.leaf? %>
|
||||
<li class="clear">
|
||||
<span class="fl mt6 mr12">状 态</span>
|
||||
<%# if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %>
|
||||
<%= f.select :status_id, (@allowed_statuses.collect { |p| [p.name, p.id] }),
|
||||
{:no_label => true},
|
||||
:class => "fl", :style => "width:160px;padding-left:0px;" %>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<span class="fl mt6 mr10"><%= l(:field_priority) %></span>
|
||||
<% 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 => "w160 fl" %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class=" clear" id="option_start_date_tips">
|
||||
<%= @issue.start_date.nil? ? "未选择开始日期" : "已选择开始日期" %>
|
||||
<li class="clear" >
|
||||
<span class="fl mt6 mr10">里程碑</span>
|
||||
<%= 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},
|
||||
{:onchange => "change_milestone_tip();", :class => "w160 fl"} %>
|
||||
</li>
|
||||
<li class=" clear" style="border:1px solid #c8c8c8;">
|
||||
<label class="label02" ></label>
|
||||
<% 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'), :onchange => "issue_end_date_change();",
|
||||
:class => "fl calendar_input",:style => "width: 170px;", :placeholder => "请选择结束日期" %>
|
||||
<%= calendar_for('issue_due_date', 'start_date') if @issue.leaf? %>
|
||||
<% end %>
|
||||
<li class="clear">
|
||||
<label class="fl mt6 mr12">开 始</label>
|
||||
<label class=" fl" style="border:1px solid #c8c8c8;display: inline-block;">
|
||||
<% 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'), :onchange => "issue_start_date_change();",
|
||||
:class => "fl issues_calendar_input",
|
||||
:style => "height:28px;border-left:none;border-top:none;border-bottom:none;width:124px;",
|
||||
:placeholder => "请选择开始日期" %>
|
||||
<%= calendar_for('issue_start_date', 'start_date') if @issue.leaf? %>
|
||||
<% end %>
|
||||
</label>
|
||||
</li>
|
||||
<li class=" clear " id="option_end_date_tips">
|
||||
<%= @issue.due_date.nil? ? "未选择结束日期" : "已选择结束日期" %>
|
||||
</li>
|
||||
<li class=" clear">
|
||||
<% 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'), :placeholder => "请填写预计工时" %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class=" clear"><%= l(:field_estimated_hours) %></li>
|
||||
|
||||
<li class=" clear">
|
||||
<li class="clear">
|
||||
<!--<label class="label02" ></label>-->
|
||||
<label class="fl mt6 mr12">结 束</label>
|
||||
<label class=" fl" style="border:1px solid #c8c8c8;display: inline-block;">
|
||||
<% if @issue.safe_attribute? 'due_date' %>
|
||||
<%= f.text_field :due_date, :size => 10, :disabled => !@issue.leaf?, :no_label => true,
|
||||
:required => @issue.required_attribute?('due_date'), :onchange => "issue_end_date_change();",
|
||||
:class => "issues_calendar_input fl",
|
||||
:style => "height:28px;border-left:none;border-top:none;border-bottom:none;width:124px;",
|
||||
:placeholder => "请选择结束日期" %>
|
||||
<%= calendar_for('issue_due_date', 'start_date') if @issue.leaf? %>
|
||||
<% end %>
|
||||
</label>
|
||||
</li>
|
||||
|
||||
<li class="clear">
|
||||
<span class="fl mt6 mr12">工 时</span>
|
||||
<% if @issue.safe_attribute? 'estimated_hours' %>
|
||||
<%= f.text_field :estimated_hours, :disabled => !@issue.leaf?, :no_label => true,
|
||||
:required => @issue.required_attribute?('estimated_hours'), :placeholder => "请填写预计工时",
|
||||
:class => "fl", :style => "width:153px;" %>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<li class="clear">
|
||||
<span class="fl mt6 mr10">完成度</span>
|
||||
<% 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 => "w160 fl" %>
|
||||
<% end %>
|
||||
<li class=" clear">完成度</li>
|
||||
</li>
|
||||
|
||||
<% if @project.gpid %>
|
||||
<%#= hidden_field_tag @issue_commit_ids %>
|
||||
<input value="" name="commit_ids" id="commit_ids" type="hidden">
|
||||
<% if @issue %>
|
||||
<% if is_project_manager?(User.current.id, @project.id)|| User.current.id == @issue.author_id || User.current.admin? %>
|
||||
<li class="clear"><span>关联Commit</span>
|
||||
<a href="javascript:void(0)" onclick="get_issue_commit_ids('issue_commit_ids','<%= @project.id %>');">
|
||||
<span class='btn-commit btn-blue mt-2 fr'>+</span>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<li class="clear"><span>关联Commit</span>
|
||||
<a href="javascript:void(0)" onclick="get_issue_commit_ids('issue_commit_ids','<%= @project.id %>');">
|
||||
<span class='btn-commit btn-blue mt-2 fr'>+</span>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div id="issue_commit_ids">
|
||||
<%= render :partial => "issues/issue_commit_ids", :locals => {:f => f} %>
|
||||
</div>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
<script>
|
||||
|
||||
function change_assigned_tip() {
|
||||
if( document.getElementById('issue_assigned_to_id').options[document.getElementById('issue_assigned_to_id').selectedIndex].value == 0 ){
|
||||
$('#assigned_to_tips').html("未指派");
|
||||
}
|
||||
else{
|
||||
$('#assigned_to_tips').html("已指派")};
|
||||
$('#assigned_to_tips').html("已指派")};
|
||||
}
|
||||
function change_milestone_tip(version_id){
|
||||
if( document.getElementById('issue_fixed_version_id').options[document.getElementById('issue_fixed_version_id').selectedIndex].value == 0 ){
|
||||
|
@ -158,6 +184,40 @@
|
|||
function issue_end_date_change() {
|
||||
$('#option_end_date_tips').html("已选择结束日期");
|
||||
}
|
||||
|
||||
function issue_create(){
|
||||
var issue_commit_ids = $("#issue_commit_ids .commit_id_value");
|
||||
var str = "";
|
||||
for(var i=0; i < issue_commit_ids.length; i++){
|
||||
str += $(issue_commit_ids[i]).html();
|
||||
if(i != issue_commit_ids.length -1){
|
||||
str += ",";
|
||||
}
|
||||
}
|
||||
issue_desc_editor.sync();
|
||||
$('#commit_ids').val(str);
|
||||
$('#issue-form').submit();
|
||||
}
|
||||
|
||||
function get_issue_commit_ids(id, project_id){
|
||||
var issue_commit_ids = $("#issue_commit_ids .commit_id_value");
|
||||
var str = "";
|
||||
for(var i=0; i < issue_commit_ids.length; i++){
|
||||
str += $(issue_commit_ids[i]).html();
|
||||
if(i != issue_commit_ids.length -1){
|
||||
str += ",";
|
||||
}
|
||||
}
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'issues', :action => 'issue_commits') %>',
|
||||
type:'get',
|
||||
data:{
|
||||
project_id: project_id,
|
||||
issue_commit_ids: str
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 里程碑添加默认选项
|
||||
$("#issue_fixed_version_id option[value='']").remove();
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<% unless @issue_commit_ids.blank? %>
|
||||
<% @issue_commit_ids.each do |commit_id| %>
|
||||
<div class="btn-commit-issue btn-blue mb5 mr5">
|
||||
<%= link_to commit_id[0,8], {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit_id}, :target => "_blank", :class => "commit_id_value" %>
|
||||
<% if @issue %>
|
||||
<% if User.current.admin? || is_project_manager?(User.current.id, @project.id) || User.current.id == @issue.author_id %>
|
||||
<%= link_to "×", issue_commit_delete_issues_path(:commit_id => commit_id, :project_id => @project.id, :issue_commit_ids => @issue_commit_ids, :issue_id => @issue.try(:id)), :remote => true, :style => "color:#fff;" %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "×", issue_commit_delete_issues_path(:commit_id => commit_id, :project_id => @project.id, :issue_commit_ids => @issue_commit_ids, :issue_id => @issue.try(:id)), :remote => true, :style => "color:#fff;" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -0,0 +1,20 @@
|
|||
<% if !@issue_commit_ids.blank? %>
|
||||
<span class="pro_new_conbox_leftspan mb5">关联Commit</span>
|
||||
<% @issue_commit_ids.each do |commit_id| %>
|
||||
<div class="btn-commit-issue btn-blue mb5 mr5">
|
||||
<%= link_to commit_id[0,8], {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit_id}, :target => "_blank", :class => "commit_id_value" %>
|
||||
<% if @issue %>
|
||||
<% if User.current.admin? || is_project_manager?(User.current.id, @project.id) || User.current.id == @issue.author_id %>
|
||||
<%= link_to "×", issue_commit_delete_issues_path(:commit_id => commit_id, :project_id => @project.id, :issue_commit_ids => @issue_commit_ids, :issue_id => @issue.try(:id)), :remote => true, :style => "color:#fff;" %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<%= link_to "×", issue_commit_delete_issues_path(:commit_id => commit_id, :project_id => @project.id, :issue_commit_ids => @issue_commit_ids, :issue_id => @issue.try(:id)), :remote => true, :style => "color:#fff;" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<span class="pro_new_conbox_leftspan mb5 fl">关联Commit</span>
|
||||
<span class="pro_new_conbox_rightspan fl ml10">无</span>
|
||||
<% end %>
|
|
@ -0,0 +1,42 @@
|
|||
<div style="width:745px;">
|
||||
<div class="muban_popup_top">
|
||||
<h3 class="fl">关联Commit</h3>
|
||||
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="muban_popup_con " >
|
||||
<div class="newupload_conbox " >
|
||||
<% if @commits.blank? %>
|
||||
<%= render :partial => "projects/no_data" %>
|
||||
<% else %>
|
||||
<div class=" clear">
|
||||
<div class="cl"></div>
|
||||
<%= form_tag(url_for(:controller => 'issues', :action => 'issue_commits', :project_id => @project.id, :type => "search"),
|
||||
:remote => true, :method => 'get', :id => 'issue_commit_form', :class => "fl") do %>
|
||||
<ul class="clear lightheight28 fl mr100">
|
||||
<li class="mb10 clear fl">
|
||||
<span class=" fl"> 分支 : </span>
|
||||
<%= select_tag :branch, options_for_select(["#{@default_branch}"]+ @branch_names, @rev),
|
||||
:class => "fl newupload_select", :style => "width:180px;height:28px;",
|
||||
:onchange => "$('#issue_commit_form').submit();" %>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="hw_search_box fr mb10" >
|
||||
<input type="text" name="search" placeholder="输入描述内容进行搜索" class="hw_search-input" style="width:300px;">
|
||||
<%= submit_tag '', :class => 'hw_btn_search', :onfocus => 'this.blur();', :style => 'border-style:none' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div id="issue_commit_list">
|
||||
<%= render :partial => "issues/issue_commits_list" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function remote_function(id) {
|
||||
$(id).submit();
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<%= form_tag(url_for(:controller => 'issues', :action => 'commit_for_issue', :project_id => @project.id), :remote => true, :method => 'get', :id => 'commit_for_issue', :class => "fl") do %>
|
||||
<table class="newupload_table " cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="newupload_td01"> </th>
|
||||
<th class="newupload_td04">修订号</th>
|
||||
<th>描述</th>
|
||||
<th class="newupload_td04">提交者</th>
|
||||
<th class="newupload_td05">提交日期</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @commits.each do |commit| %>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox" value="<%= commit.short_id %>" name="checkbox1[]"> </td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name">
|
||||
<%= link_to commit.id[0,8], {:controller => 'repositories', :action => 'commit_diff', :id => @project.id, :changeset => commit.id}, :target => "_blank" %></span>
|
||||
</td>
|
||||
<td class="newupload_td02"><p><%= commit.title %></p></td>
|
||||
<td class="newupload_td04"><span class="newupload_table_name"><%= link_to_user_mail(commit.author_email, "") %></span></td>
|
||||
<td class="newupload_td05"><%= format_date(commit.created_at) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
<input value="" name="issue_for_commit_ids" id="issue_for_commit_ids" type="hidden">
|
||||
</table>
|
||||
<div class="clear">
|
||||
<div class="clear fl mt10 mb10">
|
||||
<a href="javascript:void(0);" class="sy_btn_blue fl" onclick="search_and_branch_for_commit_ids();">确 定</a>
|
||||
<a href="javascript:void(0);" class="sy_btn_grey fl ml10" onclick="hideModal()">取 消</a>
|
||||
</div>
|
||||
<div style="text-align:center;">
|
||||
<div class="pages" style="width:auto; display:inline-block;">
|
||||
<ul id="homework_pository_ref_pages">
|
||||
<%= pagination_links_full @commits_pages, @commits_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<script>
|
||||
function search_and_branch_for_commit_ids(){
|
||||
var issue_commit_ids = $("#issue_commit_ids .commit_id_value");
|
||||
var str = "";
|
||||
for(var i=0; i < issue_commit_ids.length; i++){
|
||||
str += $(issue_commit_ids[i]).html();
|
||||
if(i != issue_commit_ids.length -1){
|
||||
str += ",";
|
||||
}
|
||||
}
|
||||
$('#issue_for_commit_ids').val(str);
|
||||
$('#commit_for_issue').submit();
|
||||
hideModal();
|
||||
}
|
||||
</script>
|
|
@ -1,5 +1,5 @@
|
|||
<ul>
|
||||
<% issue.journals.reorder("created_on desc").each do |comment| %>
|
||||
<% @journals.each do |comment| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= comment.id %>');
|
||||
|
@ -24,7 +24,7 @@
|
|||
<div class="orig_reply mb10 mt-10">
|
||||
<div class="reply">
|
||||
<span class="reply-right">
|
||||
<span id="reply_praise_count_<%= comment.id %>">
|
||||
<span class="reply_praise_count_<%= comment.id %>">
|
||||
<%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %>
|
||||
</span>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
<span class="fl mr5"><%= activity.journals.count %></span>
|
||||
<% end %>
|
||||
<div class="undis" style="position: absolute; <%= activity.journals.count > 0 ? 'top:25px;' : 'top:7px' %>">
|
||||
<%= link_to "", issue_path(activity.id, :edit => 'true'), :class => 'sy_icons_edit fl mt15', :style => "margin-top:25px;", :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %>
|
||||
<%= link_to "", edit_issue_path(activity.id), :class => 'sy_icons_edit fl mt15', :style => "margin-top:25px;", :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %>
|
||||
<% if !defined?(project_id) && !defined?(user_id) %>
|
||||
<%= link_to "", issue_path(activity.id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'sy_icons_del fl mt15', :style => "margin-top:25px;" if User.current.allowed_to?(:delete_issues, activity.project) %>
|
||||
<% elsif defined?(project_id) %>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
</div>
|
||||
<div class="clear">
|
||||
<div>
|
||||
<ul class="new_roadmap_nav fl" >
|
||||
<ul class="new_roadmap_nav fl" style="margin-left: 0px">
|
||||
<li class="new_roadmap_nav_hover" id="new_roadmap_nav_1" onclick="HoverLi(1);">
|
||||
<%= link_to "所有<span class='new_roadmap_nav_taghover ml5' id='new_roadmap_num_1'>#{@issues_filter.count}</span>".html_safe, "", :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_1" %>
|
||||
</li>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
$("#issue_commit_ids").html('<%= escape_javascript(render :partial => 'issues/issue_commit_ids') %>');
|
|
@ -1,6 +1,7 @@
|
|||
<h3><%=h "#{@issue.tracker.name} ##{@issue.id}" %></h3>
|
||||
<div id="issue_edit_show" class="mt10 pro_newissue_con">
|
||||
<%= render :partial => 'issues/edit' %>
|
||||
<% content_for :header_tags do %>
|
||||
<%= robot_exclusion_tag %>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => 'edit' %>
|
||||
<% content_for :header_tags do %>
|
||||
<%= robot_exclusion_tag %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -214,6 +214,9 @@
|
|||
</div><!--issues_statistics end-->
|
||||
<a href="<%= new_project_issue_path(@project)%>" class="sy_btn_green fr " >新建</a>
|
||||
</div>
|
||||
<% if @issues.empty? %>
|
||||
<%= render :partial => "projects/no_data" %>
|
||||
<% else %>
|
||||
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
|
||||
<%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project},:remote=>'xls', :method => :get,:id=>"issue_query_form", :class => 'query_form') do %>
|
||||
<%= hidden_field_tag 'set_filter', '1' %>
|
||||
|
@ -236,7 +239,6 @@
|
|||
<%= calendar_for('issue_create_date_start_show')%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="issues_con_list" style="position: relative;">
|
||||
<ul id="issues_list_nav" >
|
||||
<li id="issues_list_nav_1" onclick="HoverLi(1);all_reset_form();" class="issues_nav_hover">
|
||||
|
@ -309,9 +311,7 @@
|
|||
</div><!--issues_filter end-->
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if @issues.empty? %>
|
||||
<p class="nodata mt10"><%= l(:label_no_data) %></p>
|
||||
<% else %>
|
||||
|
||||
<div id="issue_list">
|
||||
<%= render :partial => 'issues/all_list', :locals => {:issues => @issues, :query => @query,:issue_pages=>@issue_pages,:issue_count=>@issue_count,:project=>@project,:subject=>@subject} %>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
$("#issue_commit_ids").html('<%= escape_javascript(render :partial => 'issues/issue_commit_ids') %>');
|
|
@ -0,0 +1,13 @@
|
|||
var checked = $("input[name='checkbox1[]']:checked").size();
|
||||
if(checked > 0)
|
||||
{
|
||||
alert('翻页或搜索后将丢失当前选择的提交记录!');
|
||||
}
|
||||
|
||||
<% if @type %>
|
||||
$("#issue_commit_list").html('<%= escape_javascript(render :partial => 'issues/issue_commits_list') %>');
|
||||
<% else %>
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'issues/issue_commits') %>";
|
||||
pop_box_new(htmlvalue,760,600);
|
||||
<% end %>
|
||||
|
|
@ -5,16 +5,7 @@
|
|||
<script>
|
||||
sd_create_editor_from_data(<%= @issue.id%>, null, "100%", "<%= @issue.class.name %>");
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
is_edit = <%= @is_edit.present? && @is_edit == true %>
|
||||
if(is_edit) {
|
||||
issueEditShow();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="mt10 mb10" id =issue_show_total"">
|
||||
<div class="banner-big f16 fontGrey3">
|
||||
问题跟踪
|
||||
|
@ -46,10 +37,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="issue_edit_show" class="mt10 pro_newissue_con">
|
||||
<%= render :partial => 'issues/edit'%>
|
||||
</div>
|
||||
<ul class="fr pro_new_conbox_right" id="project_issue_info_show">
|
||||
<ul class="fr pro_new_conbox_right mt10" id="project_issue_info_show">
|
||||
<li class="clear">
|
||||
<span class="pro_new_conbox_leftspan fl">当前状态</span>
|
||||
<span class="pro_new_conbox_rightspan fl ml10"><%= @issue.status.name %></span>
|
||||
|
@ -76,6 +64,11 @@
|
|||
<span class="pro_new_conbox_rightspan fl ml10"><%= format_date(@issue.start_date) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<% unless @issue.disabled_core_fields.include?('due_date') %>
|
||||
<li class="clear"><span class="pro_new_conbox_leftspan fl">结束日期</span>
|
||||
<span class="pro_new_conbox_rightspan fl ml10"><%= format_date(@issue.due_date) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<% unless @issue.disabled_core_fields.include?('estimated_hours') %>
|
||||
<li class="clear"><span class="pro_new_conbox_leftspan fl">预计工时(H)</span>
|
||||
<span class="pro_new_conbox_rightspan fl ml10"><%= l_hours(@issue.estimated_hours) %></span>
|
||||
|
@ -86,6 +79,9 @@
|
|||
<span class="pro_new_conbox_rightspan fl ml10"><%= @issue.done_ratio %>%</span>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="clear">
|
||||
<%= render :partial => "issues/issue_commit_ids_show" %>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<% student_num = studentCount(@course) %>
|
||||
<% course_file_num = visable_attachemnts_incourse(@course).count %>
|
||||
<p class="sy_cgrey mb10 mr20">
|
||||
<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cgrey') %>
|
||||
<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :title => '主讲老师', :class => 'sy_cgrey') %>
|
||||
>
|
||||
<% if @course.syllabus %>
|
||||
<%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey', :title => '课程名称' %>
|
||||
|
@ -22,6 +22,12 @@
|
|||
<% if @course.syllabus %>
|
||||
<li><%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "sy_class_option", :target => "_blank" %></li>
|
||||
<% end %>
|
||||
<% if @course.invite_code_halt == 0 %>
|
||||
<li><a href="javascript:void(0);" class="sy_class_option" onclick="alert_halt_code();">暂停加入</a></li>
|
||||
<% elsif @course.invite_code_halt == 1 %>
|
||||
<li><a href="<%=set_invite_code_halt_course_path(@course) %>" data-remote="true" class="sy_class_option">放开加入</a></li>
|
||||
<% end %>
|
||||
<li><%= link_to "设置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "sy_class_option" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -56,10 +62,14 @@
|
|||
<div class="sy_class_id fl">
|
||||
<p>邀 请 码<br />
|
||||
<span class="sy_corange">
|
||||
<% if User.current.admin? || User.current.member_of_course?(@course) %>
|
||||
<%=@course.generate_invite_code %>
|
||||
<% if @course.invite_code_halt == 0 %>
|
||||
<% if User.current.admin? || User.current.member_of_course?(@course) %>
|
||||
<%=@course.generate_invite_code %>
|
||||
<% else %>
|
||||
<span class="f12">请询问老师</span>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<span class="f12">请询问老师</span>
|
||||
已停用
|
||||
<% end %>
|
||||
</span>
|
||||
</p>
|
||||
|
@ -70,22 +80,16 @@
|
|||
<%=@course.name %>
|
||||
</h3>
|
||||
<span class="<%= @course.is_public == 0 ? 'hw_icon_private' : 'hw_icon_open' %> fl mr20 mt3"></span>
|
||||
<p class="sy_cgrey fl mt3">
|
||||
<span class=" mr15">教师:<%= course_teacher_link teacher_num %></span>
|
||||
<span class=" mr15">学生:<%= course_student_link student_num %></span>
|
||||
<span class=" mr15">资源:<%= link_to course_file_num, course_files_path(@course), :class => 'sy_cblue',:id=>'courses_files_count_info' %></span>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="sy_cgrey mb5">
|
||||
<span class=" mr15">主讲老师:<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cblue') %></span>
|
||||
<span class=" mr15">学时:<span class="sy_cblack"><%= @course.class_period %>学时</span></span>
|
||||
<span class=" mr15">学期:<span class="sy_cblack"><%= current_time_and_term @course %></span></span>
|
||||
<span class=" mr15">单位:<span class="sy_cblack"><%= get_occupation_from_user(@course.teacher).blank? ? '无' : get_occupation_from_user(@course.teacher) %></span></span>
|
||||
<span class="mr25">学期:<span class="sy_cblack"><%= current_time_and_term @course %></span></span>
|
||||
<span class="mr25">教师:<%= course_teacher_link teacher_num %></span>
|
||||
<span class="mr25">学生:<%= course_student_link student_num %></span>
|
||||
</p>
|
||||
<p class="sy_cgrey fl mt5">
|
||||
<span class="mr25">单位:<span class="sy_cblack"><%= get_occupation_from_user(@course.teacher).blank? ? '无' : get_occupation_from_user(@course.teacher) %></span></span>
|
||||
</p>
|
||||
<% if is_teacher %>
|
||||
<%= link_to "班级设置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "sy_btn_grey mr10 fl" %>
|
||||
<% end %>
|
||||
<% is_TA = get_user_member_roles_course @course, User.current, 7 %>
|
||||
<% is_TE = get_user_member_roles_course @course, User.current, 9 %>
|
||||
<% is_ST = get_user_member_roles_course @course, User.current, 10 %>
|
||||
|
@ -102,10 +106,10 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
<% if is_teacher %>
|
||||
<div class="invite_code_tip_box fontGrey2">
|
||||
<div class="invite_code_tip_box fontGrey2" id="invite_code_tip_box">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p class="mt10 mb5">请将邀请码告诉学生和教辅</p>
|
||||
<p class="mb10">他们可以主动加入班级</p>
|
||||
<p class="mt10 mb5"><%= @course.invite_code_halt == 0 ? "请将邀请码告诉成员" : "邀请码已停用" %></p>
|
||||
<p class="mb10"><%= @course.invite_code_halt == 0 ? "他们可以主动加入" : "暂时停止成员主动加入" %></p>
|
||||
</div>
|
||||
<% end %>
|
|
@ -7,13 +7,19 @@
|
|||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "首页",user_activities_path(User.current), :class => "c_white f16 db p10", :title => "回到个人首页"%>
|
||||
</li>
|
||||
<!-- <li class="navHomepageMenu fl">
|
||||
<%#= link_to "资源库", user_resource_user_path(User.current, :type => 1), :class => "c_white f16 db p10" %>
|
||||
</li>-->
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :class => "c_white f16 db p10" %>
|
||||
<%= link_to "课程", user_course_community_path(User.current), :class => "c_white f16 db p10" %>
|
||||
</li>
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "项目", user_project_community_path(User.current), :class => "c_white f16 db p10" %>
|
||||
</li>
|
||||
<% if hidden_unproject_infos %>
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
|
||||
</li>
|
||||
<!-- <li class="navHomepageMenu fl">
|
||||
<%#= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
|
||||
</li>-->
|
||||
<% memo = Memo.where(:id => 1168).first %>
|
||||
<% unless memo.nil? %>
|
||||
<li class="navHomepageMenu fl mr30">
|
||||
|
@ -72,10 +78,10 @@
|
|||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<%= link_to "我的组织", user_organizations_user_path(:id => User.current), :class => "menuGrey"%>
|
||||
<%= link_to '我的项目', {:controller => "users", :action => "user_projectlist", :id => @user}, :id => 'user_project_list', :class => "menuGrey" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "新建组织", new_organization_path, :class => "menuGrey"%>
|
||||
<%= link_to "我的组织", user_organizations_user_path(:id => User.current), :class => "menuGrey"%>
|
||||
</li>
|
||||
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
|
||||
<li>
|
||||
|
|
|
@ -61,7 +61,8 @@
|
|||
<% elsif ma.course_message.jour_type == 'HomeworkCommon' %>
|
||||
<li><a href="<%= homework_common_index_url_in_org(ma.course_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %> <%=ma.course_message.m_parent_id.nil? ? '回复了您的作业:' : '在作业中回复了您:' %><%= message_content(ma.course_message.notes)%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %> </span><%=ma.course_message.m_parent_id.nil? ? '回复了您的作业:' : '在作业中回复了您:' %><%= message_content(ma.course_message.notes)%></a></li>
|
||||
<% else %>
|
||||
<li><a href="<%= student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id,:show_work_id => ma.course_message.jour.student_work_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %><%=ma.course_message.user.allowed_to?(:as_teacher, ma.course) ? '老师' : '同学' %> 回复了作品评论:<%= message_content(ma.course_message.notes)%>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %><%=ma.course_message.user.allowed_to?(:as_teacher, ma.course) ? '老师' : '同学' %> </span>回复了作品评论:<%= message_content(ma.course_message.notes)%></a></li>
|
||||
<% show_name = ma.course_message.jour.reviewer_role != 3 || ma.course_message.user.allowed_to?(:as_teacher, ma.course) %>
|
||||
<li><a href="<%= student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id,:show_work_id => ma.course_message.jour.student_work_id) %>" target="_blank" title="<%=show_name ? ma.course_message.user.show_name + "#{ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"}" : "匿名用户" %> 回复了作品评论:<%= message_content(ma.course_message.notes)%>"><span class="shadowbox_news_user"><%=show_name ? ma.course_message.user.show_name + "#{ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"}" : "匿名用户" %> </span>回复了作品评论:<%= message_content(ma.course_message.notes)%></a></li>
|
||||
<% end %>
|
||||
<% elsif ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? && !User.current.allowed_to?(:as_teacher, ma.course_message.homework_common.course) %>
|
||||
<li><a href="<%=student_work_index_path(:homework => ma.course_message.homework_common_id) %>" target="_blank" title="<%=ma.course_message.homework_common.user.show_name %>老师 发布的作业:<%=ma.course_message.homework_common.name %>,由于迟交作业,您及您的作品都不能参与该作业的匿评"><span class="shadowbox_news_user"><%=ma.course_message.homework_common.user.show_name %>老师 </span>发布的作业:<%=ma.course_message.homework_common.name %>,由于迟交作业,您及您的作品都不能参与该作业的匿评</a></li>
|
||||
|
@ -69,6 +70,13 @@
|
|||
<li><a href="<%=student_work_index_path(:homework => ma.course_message.homework_common_id, :show_work_id => ma.course_message_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>同学 重新提交了作品:<%=ma.course_message.name %>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>同学 </span>重新提交了作品:<%=ma.course_message.name %></a></li>
|
||||
<% elsif ma.course_message_type == "StudentWork" && ma.status == 2 %>
|
||||
<li><a href="<%=student_work_index_path(:homework => ma.course_message.homework_common_id, :show_work_id => ma.course_message_id) %>" target="_blank" title="<%=ma.course_message.user.show_name %>同学 追加新附件了:作业标题:<%=ma.course_message.homework_common.name %>"><span class="shadowbox_news_user"><%=ma.course_message.user.show_name %>同学 </span>追加新附件了:作业标题:<%=ma.course_message.homework_common.name %></a></li>
|
||||
<% elsif ma.course_message_type == "StudentWorksScoresAppeal" && ma.course_message && ma.status == 1 %>
|
||||
<% student_work = ma.course_message.student_works_score.student_work %>
|
||||
<li><a href="<%=student_work_index_path(:homework => student_work.homework_common_id, :show_work_id => student_work.id, :tab => 2) %>" target="_blank" title="匿名用户 对您的评阅发起申诉:<%=student_work.homework_common.name %>"><span class="shadowbox_news_user">匿名用户</span> 对您的评阅发起申诉:<%=student_work.homework_common.name %></a></li>
|
||||
<% elsif ma.course_message_type == "StudentWorksScoresAppeal" && ma.course_message && (ma.status == 3 || ma.status == 4) %>
|
||||
<% deal_user = User.find ma.apply_result %>
|
||||
<% student_work = ma.course_message.student_works_score.student_work %>
|
||||
<li><a href="<%=student_work_index_path(:homework => student_work.homework_common_id, :show_work_id => student_work.id, :tab => 2) %>" target="_blank" title="<%= deal_user.show_name%> <%= ma.status == 3 ? '接受申诉' : '拒绝申诉' %>:<%=student_work.homework_common.name %>"><span class="shadowbox_news_user"><%= deal_user.show_name%></span> <%= ma.status == 3 ? '接受申诉' : '拒绝申诉' %>:<%=student_work.homework_common.name %></a></li>
|
||||
<% elsif ma.course_message_type == "Course" %>
|
||||
<li><a href="<%=course_path(ma.course_message) %>" target="_blank" title="系统提示 您成功创建了班级:班级名称:<%=ma.course_message.name %>"><span class="shadowbox_news_user">系统提示 </span>您成功创建了班级:班级名称:<%=ma.course_message.name %></a></li>
|
||||
<% elsif ma.course_message_type == "JoinCourseRequest" %>
|
||||
|
@ -114,6 +122,12 @@
|
|||
<% content = "<span class='shadowbox_news_user'>系统提示:</span>“#{ma.name}”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!" %>
|
||||
<%= link_to content.html_safe, { :controller=> "my",:action => "account", :flag => 1, :applied_message_id => ma.id }, :title => "系统提示:“#{ma.name}”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!", :target => '_blank'%>
|
||||
</li>
|
||||
<% elsif ma.applied_type == "StudentWorksScoresAppeal" %>
|
||||
<li>
|
||||
<% homework = ma.applied.student_works_score.student_work.homework_common %>
|
||||
<% content = '<span class="shadowbox_news_user">'+User.find(ma.applied_user_id).show_name+' </span>申诉匿评成绩:'+"“"+homework.name+"”" %>
|
||||
<%= link_to content.html_safe, student_work_index_path(:homework => homework.id, :show_work_id => ma.applied.student_works_score.student_work_id, :tab => 2), :title => "#{User.find(ma.applied_user_id).show_name}申诉匿评成绩:“#{homework.name}”", :target => '_blank' %>
|
||||
</li>
|
||||
<% end %>
|
||||
<% elsif ma.class == ForgeMessage %>
|
||||
<% if ma.forge_message_type == "AppliedProject" %>
|
||||
|
@ -147,7 +161,7 @@
|
|||
<% end %>
|
||||
<% elsif ma.class == OrgMessage %>
|
||||
<% if ma.message_type == 'ApplySubdomain' && ma.organization %>
|
||||
<li><a href="<%=agree_apply_subdomain_organizations_path( :organization_id => ma.organization_id, :org_domain => ma.content, :user_id => ma.sender_id, :act_id => ma.id ) %>" target="_blank" title="<%=ma.organization.name %> 申请子域名:<%= (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count == 0 || (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count > 0 && Secdomain.where("sub_type=2 and pid=?", ma.organization.id).first.subname != ma.content)) ? "同意申请":"申请已批准"%>"><span class="shadowbox_news_user"><%=ma.organization.name %> </span>申请子域名:<%= (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count == 0 || (Secdomain.where("sub_type=2 and pid=?", ma.organization.id).count > 0 && Secdomain.where("sub_type=2 and pid=?", ma.organization.id).first.subname != ma.content)) ? "同意申请":"申请已批准"%></a></li>
|
||||
<li><a href="<%=organization_path(ma.organization_id) %>" target="_blank" title="<%=ma.organization.name %> 申请子域名:<%= ma.content%>"><span class="shadowbox_news_user"><%=ma.organization.name %> </span>申请子域名:<%= ma.content%></a></li>
|
||||
<% elsif ma.message_type == 'AgreeApplySubdomain' %>
|
||||
<li><a href="javascript:void(0)" target="_blank" title="系统提示 管理员同意了您的子域名申请:<%= ma.content%>"><span class="shadowbox_news_user">系统提示 </span>管理员同意了您的子域名申请:<%= ma.content%></a></li>
|
||||
<% end %>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<span>
|
||||
<% if user.user_extensions && user.user_extensions.brief_introduction && !user.user_extensions.brief_introduction.empty? %>
|
||||
<%= user.user_extensions.brief_introduction %>
|
||||
<% else%>
|
||||
这个小伙伴很懒,什么都没留下~
|
||||
<div class="user_info_intro">
|
||||
<% if !user.user_extensions.school_id.blank? %>
|
||||
<%= user.user_extensions.school.name %>
|
||||
<% end %>
|
||||
</div>
|
||||
</span>
|
||||
<% if User.current == user%>
|
||||
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);", :onclick => "show_edit_user_introduction();"%>
|
||||
<% end %>
|
||||
<%# if User.current == user%>
|
||||
<%#= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);", :onclick => "show_edit_user_introduction();"%>
|
||||
<%# end %>
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
<div class="sub-menu-title c_dark">
|
||||
<em></em>
|
||||
<font></font>
|
||||
<div>课程:<%= link_to course.syllabus.title, syllabus_path(course.syllabus_id), :target => '_blank' %></div>
|
||||
<div>班级:<%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :target => '_blank' %></div>
|
||||
<div>课程:<%= link_to course.syllabus.title, syllabus_path(course.syllabus_id), :target => '_blank', :style => "background-color:#fff; height:auto; line-height:1; font-size:12px; color:#aaa;" %></div>
|
||||
<div>班级:<%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :target => '_blank', :style => "background-color:#fff; height:auto; line-height:1; font-size:12px; color:#aaa;" %></div>
|
||||
</div>
|
||||
<%#= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course),
|
||||
:id => "show_course_#{course.id}", :class => 'course_list_menu hidden', :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+"("+current_time_and_term(course)+")"%>
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<ul>
|
||||
<% if User.current.logged?%>
|
||||
<% if User.current == target%>
|
||||
<li style="width: 119px; float: left; border-right: 1px solid #ddd;"><%= link_to("个人资料", my_account_path, :class => "user_editinfo") %></li>
|
||||
<li style="width: 118px; float: left;"><%= link_to '个人主页', homepage_user_path(@user), :class => "user_editinfo", :target => '_blank' %></li>
|
||||
<!-- <li style="width: 119px; float: left; border-right: 1px solid #ddd;"><%#= link_to("个人资料", my_account_path, :class => "user_editinfo") %></li>-->
|
||||
<li><%= link_to '个人主页', homepage_user_path(@user), :class => "user_editinfo", :target => '_blank' %></li>
|
||||
<li class="cl"></li>
|
||||
<% else%>
|
||||
<li style="width: 119px; float: left; border-right: 1px solid #ddd;">
|
||||
<% if target.base_homepage.nil? %>
|
||||
<!-- <li style="width: 119px; float: left; border-right: 1px solid #ddd;">
|
||||
<%# if target.base_homepage.nil? %>
|
||||
<a href="javascript:void(0)" class ="user_editinfo" style="color: #cccccc" title="该用户暂未设置主页">主页</a>
|
||||
<% else %>
|
||||
<%=link_to "主页", homepage_user_path(@user.login), :class => 'user_editinfo', :target => '_blank' %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li style="width: 118px; float: left;">
|
||||
<%# else %>
|
||||
<%#=link_to "主页", homepage_user_path(@user.login), :class => 'user_editinfo', :target => '_blank' %>
|
||||
<%# end %>
|
||||
</li>-->
|
||||
<li>
|
||||
<%if(target.watched_by?(User.current))%>
|
||||
<%= link_to "取消关注",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "user_editinfo", :method => "delete",:remote => "true", :title => "取消关注"%>
|
||||
<% else %>
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%= h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus','css/moduel', 'css/user', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= yield :header_tags -%>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript"
|
||||
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
<!-- 配置 : 在生成的公式图片上去掉Math定义的右键菜单,$$ $$ \( \) \[ \] 中的公式给予显示-->
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
|
||||
showMathMenu: false,
|
||||
showMathMenuMSIE: false,
|
||||
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="prettyPrint();">
|
||||
<div class="navContainer">
|
||||
<% is_current_user = User.current.logged? && User.current == @user%>
|
||||
<% if User.current.logged? %>
|
||||
<%= render :partial => 'layouts/logined_header' %>
|
||||
<% else%>
|
||||
<%= render :partial => 'layouts/unlogin_header' %>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepageContentContainer">
|
||||
<!--div class="homepageRightBannerImg"></div-->
|
||||
<div class="cl"></div>
|
||||
<div class="homepageContent">
|
||||
<div class="homepageLeft mt10" id="LSide">
|
||||
<div class="user_leftnav ">
|
||||
<% if hidden_unproject_infos %>
|
||||
<ul class="users_accordion mb10">
|
||||
<li id="user_01" class="user_icons_course">
|
||||
<%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user}, :id => "user_course_list" %>
|
||||
<font class="show-all-sub"><%= link_to '全部',{:controller => "users", :action => "user_courselist", :id => @user}, :style => "color:#aaa;" %></font>
|
||||
<% courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %>
|
||||
<div class="<%= courses.empty? ? 'none' : ''%>" id="homepage_left_course_list">
|
||||
<%= render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => courses} %>
|
||||
</div>
|
||||
</li>
|
||||
<% if is_current_user %>
|
||||
<li id="user_02" class="user_icons_new">
|
||||
<%= link_to "新建课程", new_syllabus_path(:host=> Setting.host_course), :target => "_blank", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<li id="user_03" class="user_icons_new">
|
||||
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course), :target => "_blank", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<li id="user_04" class="user_icons_addclass">
|
||||
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true, :method => "post", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
<ul class="users_accordion mb10">
|
||||
<% if @user == User.current %>
|
||||
<li id="user_05" class="user_icons_myhw">
|
||||
<%=link_to '我的作业', my_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<li id="user_06" class="icons-doc clear">
|
||||
<%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :style => "font-size:14px;" %>
|
||||
</li>
|
||||
<li id="user_07" class="icons-download clear">
|
||||
<%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :target => "_blank",:style => "font-size:14px;" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<!--<div class="user_leftnav ">-->
|
||||
<!--<ul class="users_accordion mb10">-->
|
||||
<!--<li id="user_10" class="user_icons_mes">-->
|
||||
<!--<%#= link_to '留言', feedback_path(@user, :host=> Setting.host_user)%>-->
|
||||
<!--</li>-->
|
||||
<!--</ul>-->
|
||||
<!--</div>-->
|
||||
<%# 更新访问数,刷新的时候更新访问次数 %>
|
||||
<% update_visiti_count @user %>
|
||||
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %> (自2016年5月)</div>
|
||||
</div>
|
||||
<div class="homepageRight">
|
||||
<%= yield %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'layouts/footer' %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
|
||||
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @user} %>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function leftCourseslistChange(){
|
||||
var target = $('#user_courses_li>li');
|
||||
for(var i = 10; i < target.length; i++){
|
||||
target.eq(i).slideToggle();
|
||||
}
|
||||
$('#hide_show_courseicon').toggleClass("user_icons_closeclass");
|
||||
$('#hide_show_courseicon').toggleClass("user_icons_moreclass");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -147,7 +147,7 @@
|
|||
<%# 课程英雄榜 %>
|
||||
<%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %>
|
||||
<div class="sy_class_leftbox" >
|
||||
<h3 class="fontGrey7">班级推荐</h3>
|
||||
<h3 class="fontGrey7">推荐</h3>
|
||||
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
|
||||
</div>
|
||||
<%# 更新访问数,刷新的时候更新访问次数 %>
|
||||
|
@ -279,10 +279,19 @@
|
|||
|
||||
function delete_confirm(){
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您确认要退出该班级吗?</p><div class="cl"></div><a href="<%=join_path(:object_id => @course.id) %>" class="fr sy_btn_blue mr85 mt10" data-method="delete" data-remote="true">确 定</a>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您确认要退出该班级吗?</p><div class="cl"></div>'+
|
||||
'<a href="<%=join_path(:object_id => @course.id) %>" class="fr sy_btn_blue mr85 mt10" data-method="delete" data-remote="true">确 定</a>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取 消</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
}
|
||||
|
||||
function alert_halt_code(){
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">邀请码停用后,用户不能主动加入该班级了</p><p class="text_c mt10 f14">您是否确认停用</p><div class="cl"></div>'+
|
||||
'<a href="<%=set_invite_code_halt_course_path(@course) %>" class="fr sy_btn_blue mr135 mt10" data-remote="true">确 定</a>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取 消</a></div></div>';
|
||||
pop_box_new(htmlvalue, 400, 180);
|
||||
}
|
||||
</script>
|
||||
|
||||
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue