diff --git a/Gemfile b/Gemfile
index a8131fb3f..11acafe3c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -6,7 +6,11 @@ unless RUBY_PLATFORM =~ /w32/
gem 'iconv'
end
-gem 'certified'
+gem 'net-ssh', '2.9.1'
+gem 'jenkins_api_client'
+gem 'nokogiri'
+
+# gem 'certified'
gem 'wechat',path: 'lib/wechat'
gem 'grack', path:'lib/grack'
diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb
index 58d4a4f8c..6696b8360 100644
--- a/app/api/mobile/apis/courses.rb
+++ b/app/api/mobile/apis/courses.rb
@@ -103,7 +103,7 @@ module Mobile
post "join" do
authenticate!
cs = CoursesService.new
- status = cs.join_course({openid: params[:openid], invite_code: params[:invite_code]}, current_user)
+ status = cs.join_course({role: "10", openid: params[:openid], invite_code: params[:invite_code]}, current_user)
{
status: status[:state],
messsge:CoursesService::JoinCourseError.message(status[:state])
diff --git a/app/assets/javascripts/quality_analyses.js.coffee b/app/assets/javascripts/quality_analyses.js.coffee
new file mode 100644
index 000000000..761567942
--- /dev/null
+++ b/app/assets/javascripts/quality_analyses.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
diff --git a/app/assets/stylesheets/quality_analyses.css.scss b/app/assets/stylesheets/quality_analyses.css.scss
new file mode 100644
index 000000000..9404eb70f
--- /dev/null
+++ b/app/assets/stylesheets/quality_analyses.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the QualityAnalyses controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 43b488e96..7dea90e4b 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -1305,12 +1305,12 @@ class CoursesController < ApplicationController
sheet[count_row,7] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(2)
if home.anonymous_comment ==0
sheet[count_row,8] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(2)
- sheet[count_row,9] = home.teacher_priority == 1 ? 0 : stu.absence_penalty
- sheet[count_row,10] = home.teacher_priority == 1 ? 0 : stu.late_penalty
+ sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
+ sheet[count_row,10] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,11] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,12] = format_time(stu.created_at)
else
- sheet[count_row,8] = home.teacher_priority == 1 ? 0 : stu.late_penalty
+ sheet[count_row,8] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,9] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,10] = format_time(stu.created_at)
end
@@ -1338,12 +1338,12 @@ class CoursesController < ApplicationController
sheet[count_row,8] = stu.system_score.nil? ? l(:label_without_score) : stu.system_score.round(2)
if home.anonymous_comment ==0
sheet[count_row,9] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(2)
- sheet[count_row,10] = home.teacher_priority == 1 ? 0 : stu.absence_penalty
- sheet[count_row,11] = home.teacher_priority == 1 ? 0 : stu.late_penalty
+ sheet[count_row,10] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
+ sheet[count_row,11] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,12] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,13] = format_time(stu.created_at)
else
- sheet[count_row,9] = home.teacher_priority == 1 ? 0 : stu.late_penalty
+ sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,10] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,11] = format_time(stu.created_at)
end
@@ -1369,12 +1369,12 @@ class CoursesController < ApplicationController
sheet[count_row,6] = stu.teaching_asistant_score.nil? ? l(:label_without_score) : stu.teaching_asistant_score.round(2)
if home.anonymous_comment ==0
sheet[count_row,7] = stu.student_score.nil? ? l(:label_without_score) : stu.student_score.round(2)
- sheet[count_row,8] = home.teacher_priority == 1 ? 0 : stu.absence_penalty
- sheet[count_row,9] = home.teacher_priority == 1 ? 0 : stu.late_penalty
+ sheet[count_row,8] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.absence_penalty
+ sheet[count_row,9] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,10] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,11] = format_time(stu.created_at)
else
- sheet[count_row,7] = home.teacher_priority == 1 ? 0 : stu.late_penalty
+ sheet[count_row,7] = (home.teacher_priority == 1 && !stu.teacher_score.nil?) ? 0 : stu.late_penalty
sheet[count_row,8] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(2)
sheet[count_row,9] = format_time(stu.created_at)
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index c8b272480..c216491b1 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -393,7 +393,7 @@ class ProjectsController < ApplicationController
unless @project.gpid.nil?
g = Gitlab.client
@gitlab_branches = g.branches(@project.gpid)
- @branch_names = g.branches(@project.gpid).map{|b| b.name}
+ @branch_names = @gitlab_branches.map{|b| b.name}
@gitlab_default_branch = g.project(@project.gpid).default_branch
end
end
@@ -645,7 +645,7 @@ class ProjectsController < ApplicationController
params[:project][:is_public] ? @project.is_public = 1 : @project.is_public = 0
params[:project][:hidden_repo] ? @project.hidden_repo = 1 : @project.hidden_repo = 0
# 更新公开私有时同步gitlab公开私有
- unless @project.gpid.nil?
+ if !@project.gpid.nil? && @project.is_public != (params[:project][:is_public] == "on" ? true : false)
g = Gitlab.client
params[:project][:is_public] ? g.edit_project(@project.gpid, 20, params[:branch]) : g.edit_project(@project.gpid, 0, params[:branch])
end
diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb
new file mode 100644
index 000000000..83e5960b9
--- /dev/null
+++ b/app/controllers/quality_analysis_controller.rb
@@ -0,0 +1,99 @@
+class QualityAnalysisController < ApplicationController
+ before_filter :find_project_by_project_id#, :except => [:getattachtype]
+ before_filter :authorize
+ layout "base_projects"
+ include ApplicationHelper
+ require 'jenkins_api_client'
+ require 'nokogiri'
+ require 'json'
+ require 'open-uri'
+
+ def show
+
+ end
+
+ def create
+ gitlab_address = Redmine::Configuration['gitlab_address']
+ jenkins_address = Redmine::Configuration['jenkins_address']
+ @client = JenkinsApi::Client.new(:server_url => jenkins_address,
+ :username => "temp",
+ :password => '123123')
+ #@client.exists?(job_name)
+ @g = Gitlab.client
+ user_name = User.find(params[:user_id]).try(:login)
+ branch = params[:branch].nil? ? "master" : params[:branch]
+ language = params[:language]
+ path = params[:path]
+ identifier = params[:identifier]
+ qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first
+ version = qa.nil? ? 1 : qa.sonar_version + 1
+ properties = "sonar.projectKey=#{user_name}:#{identifier}
+ sonar.projectName=#{user_name}:#{identifier}
+ sonar.projectVersion=#{version}
+ sonar.sources=#{path}
+ sonar.language=#{language.downcase}
+ sonar.sourceEncoding=utf-8"
+ git_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git"
+
+ # # # modify config
+ @doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml')))
+ @doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url
+ @doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}"
+ @doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties #sonar-properties
+ #
+ # replace config.xml of jenkins
+ @client = @client.job.create("#{user_name}_#{identifier}", @doc.to_xml)
+ # relace gitlab hook
+ # genkins address
+ @g.add_project_hook(@project.gpid, jenkins_address + "/project/#{user_name}_#{identifier}")
+ if qa.nil?
+ QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, :sonar_version => version, :path => path, :branch => branch, :language => language)
+
+ else
+ qa.update_attribute(:sonar_version, version)
+ end
+ end
+
+ def index
+ @sonar_address = Redmine::Configuration['sonar_address']
+ # if params[:resource_id].nil?
+ # @name_flag = true
+ # @quality_analyses = QualityAnalysis.where(:project_id => @project.id)
+ # # @quality_analyses.map {|qa| qa.}
+ # # if @quality_analyses.count > 0
+ # # @quality_analyses.each do |qa|
+ # # ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"]
+ # #
+ # # end
+ # # end
+ # # projects_date = open(@sonar_address + "/api/projects/index").read
+ # # arr = JSON.parse(projects_date).map {|m| m["nm"]}
+ # # arr.map
+ # else
+ qa = QualityAnalysis.where(:project_id => @project.id).first
+ @resource_id = qa.author_login+":"+qa.rep_identifier
+ @name_flag = false
+ complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read
+ @complexity =JSON.parse(complexity_date).first
+ issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read
+ @sonar_issues = JSON.parse(issue_date).first
+ # end
+ end
+
+ # Find project of id params[:project_id]
+ def find_project_by_project_id
+ @project = Project.find(params[:project_id])
+ rescue ActiveRecord::RecordNotFound
+ render_404
+ end
+
+ # Authorize the user for the requested action
+ def authorize(ctrl = params[:controller], action = params[:action], global = false)
+ unless @project.archived? && @project.gpid.nil?
+ true
+ else
+ render_403 :message => :notice_not_authorized_archived_project
+ end
+ end
+
+end
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 9e785c562..cbb5b2f69 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -30,11 +30,13 @@ class RepositoriesController < ApplicationController
menu_item :settings, :only => [:new, :create, :edit, :update, :destroy, :committers]
default_search_scope :changesets
- before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo, :stats]
+ before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo, :stats, :quality_analysis]
before_filter :find_repository, :only => [:edit, :update, :destroy, :committers]
before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo, :to_gitlab, :forked, :project_archive]
before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
- before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :commit_diff, :project_archive]
+ before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :commit_diff, :project_archive, :quality_analysis]
+ # 链接gitlab
+ before_filter :connect_gitlab, :only => [:quality_analysis]
accept_rss_auth :revisions
# hidden repositories filter // 隐藏代码过滤器
before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ]
@@ -43,6 +45,7 @@ class RepositoriesController < ApplicationController
helper :project_score
#@root_path = RepositoriesHelper::ROOT_PATH
$g=Gitlab.client
+ require 'net/ssh'
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
def new
@@ -306,6 +309,37 @@ update
end
end
+ def quality_analysis
+ gitlab_branches = @g.branches(@project.gpid)
+ @branch_names = gitlab_branches.map{|b| b.name}
+ @gitlab_default_branch = @g.project(@project.gpid).default_branch
+ # language = params[:language]
+ # branch = params[:branch]
+ # path = params[:path]
+ # user_name = User.find(@project.user_id).try(:login)
+ # rep_name = params[:repository_id]
+ # host = "192.168.0.200"
+ # port = "1125"
+ # username = "git"
+ # password = "123123"
+ # server_cmd1 = "sh gitclone.sh" + " " + user_name + " " + rep_name
+ # # 连接到远程主机 foobar
+ # ssh = Net::SSH.start(host, username, :port => port, :password => password) do |ssh|
+ # result = ssh.exec!(server_cmd1)
+ # path = "/home/git/repo/" + user_name + "/" + rep_name
+ # # sonar 分析
+ # # server_cmd2
+ # # 删除clone的版本库
+ # # server_cmd3
+ # end
+ respond_to do |format|
+ format.js
+ format.html{
+ render :layout => "base_projects"
+ }
+ end
+ end
+
def destroy
DestroyRepositoryTask.new.destroy(User.current.id, @repository.id)
@repository.hidden = true
@@ -615,6 +649,14 @@ update
project.project_score.update_attribute(:commit_time, date.created_at)
end
+ # 链接gitlab
+ def connect_gitlab
+ @g = Gitlab.client
+ unless @project.gpid.nil?
+ @g_project = @g.project(@project.gpid)
+ end
+ end
+
def find_repository
@repository = Repository.find(params[:id])
@project = @repository.project
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 3a72ba55e..9006c8a79 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -1230,12 +1230,12 @@ class StudentWorkController < ApplicationController
sheet1[count_row,8] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : homework.teaching_asistant_score.round(2)
if @homework.anonymous_comment ==0
sheet1[count_row,9] = homework.student_score.nil? ? l(:label_without_score) : homework.student_score.round(2)
- sheet1[count_row,10] = @homework.teacher_priority == 1 ? 0 : homework.absence_penalty
- sheet1[count_row,11] = @homework.teacher_priority == 1 ? 0 : homework.late_penalty
+ sheet1[count_row,10] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty
+ sheet1[count_row,11] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,12] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,13] = format_time(homework.created_at)
else
- sheet1[count_row,9] = @homework.teacher_priority == 1 ? 0 : homework.late_penalty
+ sheet1[count_row,9] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,10] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,11] = format_time(homework.created_at)
end
@@ -1263,12 +1263,12 @@ class StudentWorkController < ApplicationController
sheet1[count_row,9] = homework.system_score.nil? ? l(:label_without_score) : homework.system_score.round(2)
if @homework.anonymous_comment ==0
sheet1[count_row,10] = homework.student_score.nil? ? l(:label_without_score) : homework.student_score.round(2)
- sheet1[count_row,11] = @homework.teacher_priority == 1 ? 0 : homework.absence_penalty
- sheet1[count_row,12] = @homework.teacher_priority == 1 ? 0 : homework.late_penalty
+ sheet1[count_row,11] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty
+ sheet1[count_row,12] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,13] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,14] = format_time(homework.created_at)
else
- sheet1[count_row,10] = @homework.teacher_priority == 1 ? 0 : homework.late_penalty
+ sheet1[count_row,10] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,11] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,12] = format_time(homework.created_at)
end
@@ -1292,12 +1292,12 @@ class StudentWorkController < ApplicationController
sheet1[count_row,5] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : homework.teaching_asistant_score.round(2)
if @homework.anonymous_comment ==0
sheet1[count_row,6] = homework.student_score.nil? ? l(:label_without_score) : homework.student_score.round(2)
- sheet1[count_row,7] = @homework.teacher_priority == 1 ? 0 : homework.absence_penalty
- sheet1[count_row,8] = @homework.teacher_priority == 1 ? 0 : homework.late_penalty
+ sheet1[count_row,7] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.absence_penalty
+ sheet1[count_row,8] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,10] = format_time(homework.created_at)
else
- sheet1[count_row,6] = @homework.teacher_priority == 1 ? 0 : homework.late_penalty
+ sheet1[count_row,6] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,7] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : homework.score.round(2) : l(:label_without_score)
sheet1[count_row,8] = format_time(homework.created_at)
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index c1f5863b8..b7972ff6f 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1498,8 +1498,8 @@ class UsersController < ApplicationController
# 减少数据库交互
watched_user_ids = User.watched_by(@user.id).count == 0 ? " " : ("," + User.watched_by(@user.id).map{|u| u.id.to_s }.join(','))
user_ids = "(" + @user.id.to_s + watched_user_ids + ")"
- watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",")
- blog_ids = "(" + watched_user_blog_ids + ")"
+ watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}")
+ blog_ids = watched_user_blog_ids.empty? ? "(-1)" : "(" + watched_user_blog_ids.map { |blog| blog.id}.join(",") + ")"
@user_activities = UserActivity.where("(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}) "+
diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb
index 15d4ab2e1..7dcfa1948 100644
--- a/app/controllers/wechats_controller.rb
+++ b/app/controllers/wechats_controller.rb
@@ -4,22 +4,11 @@ class WechatsController < ActionController::Base
include ApplicationHelper
# ROOT_URL = "#{Setting.protocol}://#{Setting.host_name}/"
- ROOT_URL = "http://wechat.trustie.net"
+ ROOT_URL = "http://www.trustie.net"
# default text responder when no other match
on :text do |request, content|
#邀请码
- begin
- uw = user_binded?(request[:FromUserName])
- if !uw
- return sendBind()
- else
- return join_class({invite_code: content}, uw.user)
- end
- rescue => e
- logger.error e.inspect
- logger.error e.backtrace.join("\n")
- return request.reply.text e
- end
+ sendBindClass(request, {invite_code: content})
end
# When receive 'help', will trigger this responder
@@ -48,24 +37,13 @@ class WechatsController < ActionController::Base
# When subscribe user scan scene_id in public account
on :scan, with: 'scene_id' do |request, ticket|
- begin
- uw = user_binded?(request[:FromUserName])
- if !uw
- return sendBind()
- else
- return join_class({ticket: ticket}, uw.user)
- end
- rescue => e
- logger.error e.inspect
- logger.error e.backtrace.join("\n")
- return request.reply.text e
- end
+ sendBindClass(request, {ticket: ticket})
end
# When no any on :scan responder can match subscribe user scaned scene_id
on :event, with: 'scan' do |request|
if request[:EventKey].present?
- request.reply.text "event scan got EventKey #{request[:EventKey]} Ticket #{request[:Ticket]}"
+ sendBindClass(request, {ticket: request[:Ticket]})
end
end
@@ -86,6 +64,9 @@ class WechatsController < ActionController::Base
request.reply.text "User: #{request[:FromUserName]} click #{key}"
end
+ on :click, with: 'DEV' do |request, key|
+ request.reply.text "此功能正在开发中,请耐心等待。"
+ end
# When user view URL in the menu button
on :view, with: 'http://wechat.somewhere.com/view_url' do |request, view|
request.reply.text "#{request[:FromUserName]} view #{view}"
@@ -161,6 +142,22 @@ class WechatsController < ActionController::Base
end
end
+
+ def sendBindClass(request, params)
+ begin
+ uw = user_binded?(request[:FromUserName])
+ if !uw
+ return sendBind(request)
+ else
+ return join_class(params, uw.user, request)
+ end
+ rescue => e
+ logger.error e.inspect
+ logger.error e.backtrace.join("\n")
+ return request.reply.text e
+ end
+ end
+
def default_msg(request)
uw = user_binded?(request[:FromUserName])
if uw && uw.user
@@ -187,20 +184,19 @@ class WechatsController < ActionController::Base
end
end
- def join_class(params, user)
+ def join_class(params, user, request)
course = nil
- course = Course.where(qrcode: params[:ticket]) if params[:ticket]
- course = Course.where(invite_code: params[:invite_code]) if params[:invite_code]
- raise "课程不存在" if course.blank?
+ course = Course.where(qrcode: params[:ticket]).first if params[:ticket]
+ course = Course.where(invite_code: params[:invite_code]).first if params[:invite_code]
+ raise "课程不存在" unless course
cs = CoursesService.new
- status = cs.join_course(course.invite_code, user)
+ status = cs.join_course({invite_code: course.invite_code}, user)
logger.info status
if status[:state] != 0
raise CoursesService::JoinCourseError.message(status[:state])
end
- course = status[:course]
news = (1..1).each_with_object([]) { |n, memo| memo << { title: '恭喜您成功加入班级,开始学习吧!',
content: "课程名称: #{course.name}\n班级名称: #{course.name}\n任课老师: #{course.teacher.show_name}\n进入班级,和小伙伴愉快的学习吧!"} }
return request.reply.news(news) do |article, n, index| # article is return object
diff --git a/app/helpers/quality_analysis_helper.rb b/app/helpers/quality_analysis_helper.rb
new file mode 100644
index 000000000..9c6c07109
--- /dev/null
+++ b/app/helpers/quality_analysis_helper.rb
@@ -0,0 +1,97 @@
+# encoding: utf-8
+module QualityAnalysisHelper
+
+ def sqale_rating_status val
+ arr = []
+ if val.to_i > 0 && val.to_i < 5
+ arr << "很好"
+ arr << "b_green2"
+ elsif val.to_i > 5 && val.to_i < 10
+ arr << "较好"
+ arr << "b_slow_yellow"
+ elsif val.to_i > 10 && val.to_i < 20
+ arr << "中等"
+ arr << "b_yellow"
+ elsif val.to_i > 20 && val.to_i < 50
+ arr << "较差"
+ arr << "b_slow_red"
+ elsif val.to_i > 20
+ arr << "很差"
+ arr << "b_red"
+ end
+ end
+
+ def complexity_status val
+ arr = []
+ if val.to_i < 10
+ arr << "良好"
+ arr << "b_green2"
+ elsif val.to_i > 10 && val.to_i < 15
+ arr << "较高"
+ arr << "b_yellow"
+ elsif val.to_i > 15
+ arr << "很高"
+ arr << "b_red"
+ end
+ end
+
+ def duplicated_lines_density_status val
+ arr = []
+ if val.to_i < 30
+ arr << "良好"
+ arr << "b_green2"
+ elsif val.to_i > 30 && val.to_i < 50
+ arr << "较高"
+ arr << "b_yellow"
+ elsif val.to_i > 50
+ arr << "很高"
+ arr << "b_red"
+ end
+ end
+
+ def comment_lines_density_status val
+ arr = []
+ if val.to_i < 20
+ arr << "较低"
+ arr << "b_yellow"
+ elsif val.to_i > 20 && val.to_i < 50
+ arr << "正常"
+ arr << "b_green2"
+ elsif val.to_i > 50
+ arr << "较高"
+ arr << "b_red"
+ end
+ end
+
+ def score_sqale_rating val
+ if val.to_i > 0 && val.to_i < 5
+ "5"
+ elsif val.to_i > 5 && val.to_i < 10
+ "4"
+ elsif val.to_i > 10 && val.to_i < 20
+ "3"
+ elsif val.to_i > 20 && val.to_i < 50
+ "2"
+ elsif val.to_i > 20
+ "1"
+ end
+ end
+
+ def lines_scale val
+ if val.to_i < 5000
+ "小型"
+ elsif val.to_i >5000 && val.to_i < 50000
+ "中型"
+ else
+ "大型"
+ end
+ end
+
+ #统计答题百分比,统计结果保留两位小数
+ def statistics_result_percentage(e, t)
+ e = e.to_f
+ t = t.to_f
+ t == 0 ? 0 : format("%.2f", e*100/t)
+ end
+
+end
diff --git a/app/models/project.rb b/app/models/project.rb
index ceec0e182..bbc639f3d 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -155,7 +155,7 @@ class Project < ActiveRecord::Base
#ActiveModel::Dirty 这里有一个changed方法。对任何对象都可以用
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
# 创建project之后默认创建一个board,之后的board去掉了board的概念
- after_create :create_board_sync,:acts_as_forge_activities,:create_project_ealasticsearch_index
+ after_create :create_board_sync,:acts_as_forge_activities, :create_project_ealasticsearch_index
before_destroy :delete_all_members,:delete_project_ealasticsearch_index
after_update :update_project_ealasticsearch_index
def remove_references_before_destroy
diff --git a/app/models/quality_analysis.rb b/app/models/quality_analysis.rb
new file mode 100644
index 000000000..229be9826
--- /dev/null
+++ b/app/models/quality_analysis.rb
@@ -0,0 +1,7 @@
+class QualityAnalysis < ActiveRecord::Base
+ attr_accessible :author_login, :project_id, :rep_identifier, :sonar_version, :branch, :path, :rep_identifier, :language
+
+ def user_rep_name
+ self.author_login+":"+self.rep_identifier
+ end
+end
diff --git a/app/models/sonar_analysis.rb b/app/models/sonar_analysis.rb
new file mode 100644
index 000000000..0bb2089de
--- /dev/null
+++ b/app/models/sonar_analysis.rb
@@ -0,0 +1,3 @@
+class SonarAnalysis < ActiveRecord::Base
+ attr_accessible :author_login, :project_id, :rep_identifier
+end
diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb
index 41fb18b61..60c053997 100644
--- a/app/services/courses_service.rb
+++ b/app/services/courses_service.rb
@@ -351,7 +351,7 @@ class CoursesService
#如果加入角色为教师或者教辅,并且当前是学生,或者是要成为教辅,当前不是教辅,或者要成为教师,当前不是教师。那么要发送请求
elsif (params[:role] != "10" && roleName == "Student") || (params[:role] == "7" && roleName != "TeachingAsistant" ) || (params[:role] == "9" && roleName != "Teacher" )
#如果已经发送过消息了,那么就要给个提示
- if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = #{params[:role]} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0 ").count != 0
+ if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0 ").count != 0
@state = 7
else
Mailer.run.join_course_request(course, User.current, params[:role])
diff --git a/app/views/attachments/_show_attachment_history.html.erb b/app/views/attachments/_show_attachment_history.html.erb
index 6e2994a8d..61ccef344 100644
--- a/app/views/attachments/_show_attachment_history.html.erb
+++ b/app/views/attachments/_show_attachment_history.html.erb
@@ -1,7 +1,7 @@
更新资源版本
-
+
当前版本
@@ -39,19 +39,19 @@
+
+ (未选择文件)
+ 您可以上传小于50MB 的文件
+
-
-
(未选择文件)
-
您可以上传小于50MB 的文件
-
diff --git a/app/views/courses/_join_private_course.html.erb b/app/views/courses/_join_private_course.html.erb
index 0799953bf..96c9a2b7d 100644
--- a/app/views/courses/_join_private_course.html.erb
+++ b/app/views/courses/_join_private_course.html.erb
@@ -49,7 +49,7 @@
-
快速进入课程通道
+
快速加入课程通道
只要持有课程邀请码,就可以快速加入所在课程。课程页面搜索不到的私有课程只能从此通道进入哦!
<% else %>
- <% unless file.description.blank? %>
-
-
资源描述:<%= file.description %>
- <% end %>
+ 资源描述:<% if file.description.blank? %>
未添加 <% else %><%= file.description %><% end %>
<% end %>
diff --git a/app/views/files/_project_file_list.html.erb b/app/views/files/_project_file_list.html.erb
index b8b38f7b9..4d3645a33 100644
--- a/app/views/files/_project_file_list.html.erb
+++ b/app/views/files/_project_file_list.html.erb
@@ -48,15 +48,12 @@
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
-
<% else %>
- <% unless file.description.blank? %>
-
-
资源描述:<%= file.description %>
- <% end %>
+ 资源描述:<% if file.description.blank? %>
未添加 <% else %><%= file.description %><% end %>
<% end %>
diff --git a/app/views/files/_project_list.html.erb b/app/views/files/_project_list.html.erb
index 48fb4c86f..36dc80a18 100644
--- a/app/views/files/_project_list.html.erb
+++ b/app/views/files/_project_list.html.erb
@@ -40,16 +40,13 @@
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
-
<% else %>
-
- <% unless file.description.blank? %>
-
-
资源描述:<%= file.description %>
- <% end %>
-
+
+ 资源描述:<% if file.description.blank? %>未添加 <% else %><%= file.description %><% end %>
+
<% end %>
diff --git a/app/views/files/_resource_detail.html.erb b/app/views/files/_resource_detail.html.erb
index 8aedc3c03..0edf22e58 100644
--- a/app/views/files/_resource_detail.html.erb
+++ b/app/views/files/_resource_detail.html.erb
@@ -42,15 +42,12 @@
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
-
<% else %>
- <% unless file.description.blank? %>
-
-
资源描述:<%= file.description %>
- <% end %>
+ 资源描述:<% if file.description.blank? %>
未添加 <% else %><%= file.description %><% end %>
<% end %>
<%# end %>
diff --git a/app/views/forums/create.js.erb b/app/views/forums/create.js.erb
index bea3f3872..ee8172cbd 100644
--- a/app/views/forums/create.js.erb
+++ b/app/views/forums/create.js.erb
@@ -1,7 +1,7 @@
<%if @save_flag%>
//$('#new_forum_div').slideToggle();$('#create_btn').parent().slideToggle();
//$('#reorder_time').click();
- window.location.href= "http://"+"<%= Setting.host_name%>"+"/forums/" + "<%= @forum.id%>"
+ window.location.href= "<%= host_with_protocol %>"+"/forums/" + "<%= @forum.id%>"
<%else%>
$("#error").html("<%= @forum.errors.full_messages[0]%>").show();
<%end %>
diff --git a/app/views/layouts/_show_messages_list.html.erb b/app/views/layouts/_show_messages_list.html.erb
index f67250e46..a4df961d3 100644
--- a/app/views/layouts/_show_messages_list.html.erb
+++ b/app/views/layouts/_show_messages_list.html.erb
@@ -5,18 +5,20 @@
<% messages.each do |ma| %>
<% if ma.class == SystemMessage %>
- Trustie平台 发布新消息:<%= ma.subject.blank? ? (ma.content.nil? ? ma.description.html_safe : ma.content.html_safe) : ma.subject%>
+ Trustie平台 发布新消息:<%= ma.subject.blank? ? (ma.content.nil? ? ma.description.html_safe : ma.content.html_safe) : ma.subject%>
<% elsif ma.class == CourseMessage %>
<% if ma.course_message_type == "News" %>
- <%=ma.course_message.author.show_name %> 发布了通知:<%= ma.course_message.title%>
+ <%=ma.course_message.author.show_name %> 发布了通知:<%= ma.course_message.title%>
<% elsif ma.course_message_type == "Comment" %>
- <%=ma.course_message.author.show_name %> 评论了通知:<%= ma.course_message.commented.title%>
+ <%=ma.course_message.author.show_name %> 评论了通知:<%= ma.course_message.commented.title%>
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status.nil? %>
<%=ma.course_message.user.show_name %>老师 发布了课程作业:作业标题:<%= ma.course_message.name%>
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status == 1 %>
<%=ma.course_message.user.show_name %>老师 发布的作业:作业标题:<%= ma.course_message.name%>的截止日期快到了
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
<%=ma.course_message.user.show_name %>老师 启动了作业匿评:作业标题:<%= ma.course_message.name%>
+ <% elsif ma.course_message_type == "HomeworkCommon" && ma.status == 3 %>
+ <%=ma.course_message.user.show_name %>老师 关闭了作业匿评:作业标题:<%= ma.course_message.name%>
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status == 4 %>
<%=ma.course_message.user.show_name %>老师 启动作业匿评失败:<%= ma.course_message.name%>(失败原因:提交作品的人数低于2人)
<% elsif ma.course_message_type == "HomeworkCommon" && ma.status == 5 %>
@@ -34,106 +36,106 @@
<% href = 'javascript:void(0)' %>
<% end %>
<%=ma.course_message.user.show_name %> 申请引用资源:<%= ma.course_message.find_attachment(ma.course_message.attachment_id).try(:filename)%>
- <% elsif ma.course_message_type == "ApplyResource" && ma.status == 1 %>
- <% if ma.course_message.container_type == "Course" %>
- <% href = course_files_path(ma.course_message.container_id) %>
- <% elsif ma.course_message.container_type == "Project" %>
- <% href = project_files_path(ma.course_message.container_id) %>
- <% elsif ma.course_message.container_type == "OrgSubfield" %>
- <% href = org_subfield_files_path(ma.course_message.container_id) %>
- <% else %>
- <% href = 'javascript:void(0)' %>
- <% end %>
- <%=User.find(ma.course_message.apply_user_id).show_name %> <%= ma.apply_result == 2 ? '同意' : '拒绝'%>引用资源:<%= ma.course_message.find_attachment(ma.course_message.attachment_id).try(:filename)%>
- <% elsif ma.course_message_type == "Poll" %>
- "><%=ma.course_message.user.show_name %> 发布了问卷:<%= ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name%>
- <% elsif ma.course_message_type == "Message" %>
- <% content = ma.course_message.parent_id.nil? ? ma.course_message.subject : ma.course_message.content.html_safe %>
- <% href = course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id) %>
- <%= content%>"><%=ma.course_message.author.show_name %> <%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %><%= content%>
- <% elsif ma.course_message_type == "StudentWorksScore" %>
- <%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %><%= ma.content.html_safe if !ma.content.nil?%>"><%=ma.course_message.reviewer_role == 3 ? '匿名用户' : ma.course_message.user.show_name+"老师" %> <%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %><%= ma.content.html_safe if !ma.content.nil?%>
- <% elsif ma.course_message_type == "JournalsForMessage" %>
- <% if ma.course_message.jour_type == 'Course' %>
- <%=ma.course_message.user.show_name %> 在课程中留言了:<%= ma.course_message.notes.html_safe%>
- <% elsif ma.course_message.jour_type == 'HomeworkCommon' %>
- <%=ma.course_message.user.show_name %> <%=ma.course_message.m_parent_id.nil? ? '回复了您的作业:' : '在作业中回复了您:' %><%= ma.course_message.notes.html_safe%>
- <% else %>
- <%=ma.course_message.user.show_name %><%=ma.course_message.user.allowed_to?(:as_teacher, ma.course) ? '老师' : '同学' %> 回复了作品评论:<%= ma.course_message.notes%>
- <% 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) %>
- <%=ma.course_message.homework_common.user.show_name %>老师 发布的作业:<%=ma.course_message.homework_common.name %>,由于迟交作业,您及您的作品都不能参与该作业的匿评
- <% elsif ma.course_message_type == "StudentWork" && ma.status == 1 %>
- <%=ma.course_message.user.show_name %>同学 重新提交了作品:<%=ma.course_message.name %>
- <% elsif ma.course_message_type == "StudentWork" && ma.status == 2 %>
- <%=ma.course_message.user.show_name %>同学 追加新附件了:作业标题:<%=ma.course_message.homework_common.name %>
- <% elsif ma.course_message_type == "Course" %>
- 系统提示 您成功创建了课程:课程名称:<%=ma.course_message.name %>
- <% elsif ma.course_message_type == "JoinCourseRequest" %>
- <% content = User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}" %>
- 系统提示 您有了新的课程成员申请:<%=content %>
- <% elsif ma.course_message_type == "CourseRequestDealResult" %>
- <% content = ma.status == 1 ? '您申请成为课程"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'申请已通过' : '您申请成为课程"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'的申请被拒绝' %>
- 系统提示 课程申请进度反馈:<%=content %>
- <% elsif ma.course_message_type == "JoinCourse" and ma.status == 0 %>
- <%=User.find(ma.course_message_id).show_name %> 将您加入了课程:<%=ma.course.name %>
- <% elsif ma.course_message_type == "JoinCourse" and ma.status == 1 %>
- ">系统提示 您增加了新的课程成员:<%=User.find(ma.course_message_id).login+"("+User.find(ma.course_message_id).show_name+")" %>
- <% elsif ma.course_message_type == "RemoveFromCourse" %>
- <%=User.find(ma.course_message_id).show_name %> 将您移出了课程:<%=ma.course.name %>
- <% elsif ma.course_message_type == "Exercise" && ma.status == 2 %>
- <%=ma.course_message.user.show_name %>老师 发布了课程测验:测验题目:<%=ma.course_message.exercise_name %>
- <% elsif ma.course_message_type == "Exercise" && ma.status == 3 %>
- <%=ma.course_message.user.show_name %>老师 发布的测验:<%=ma.course_message.exercise_name %> 截止时间快到了
- <% end %>
- <% elsif ma.class == ForgeMessage %>
- <% if ma.forge_message_type == "AppliedProject" %>
- " target="_blank" title="<%=ma.forge_message.user.show_name %> 申请加入项目:<%= ma.project.name%>"><%=ma.forge_message.user.show_name %> 申请加入项目:<%= ma.project.name%>
- <% elsif ma.forge_message_type == "JoinProject" %>
- <%=User.find(ma.forge_message_id).show_name %> 将您加入了项目:<%= ma.project.name%>
- <% elsif ma.forge_message_type == "RemoveFromProject" %>
- <%=User.find(ma.forge_message_id).show_name %> 将您移出了项目:<%= ma.project.name%>
- <% elsif ma.forge_message_type == "RemoveFromProject" %>
- <%=User.find(ma.forge_message_id).show_name %> 邀请你加入项目:<%= ma.project.name%>
- <% elsif ma.forge_message_type == "Issue" && ma.status == 1 %>
- <%= ma.forge_message.subject%> 截止时间快到了!"><%=ma.forge_message.author.show_name %> <%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%><%= ma.forge_message.subject%> 截止时间快到了!
- <% elsif ma.forge_message_type == "Issue" && ma.status != 1 %>
- <%= ma.forge_message.subject%>"><%=ma.forge_message.author.show_name %> <%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%><%= ma.forge_message.subject%>
- <% elsif ma.forge_message_type == "Journal" %>
- <%=ma.forge_message.user.show_name %> 更新了问题状态:<%= ma.forge_message.journalized.subject%>
- <% elsif ma.forge_message_type == "Message" %>
- <%= ma.forge_message.subject%>"><%=ma.forge_message.author.show_name %> <%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %><%= ma.forge_message.subject%>
- <% elsif ma.forge_message_type == "News" %>
- <%=ma.forge_message.author.show_name %> 发布了新闻:<%= ma.forge_message.title.html_safe%>
- <% elsif ma.forge_message_type == "Comment" %>
- <%=ma.forge_message.author.show_name %> 评论了新闻:<%= ma.forge_message.commented.title%>
- <% end %>
- <% elsif ma.class == MemoMessage %>
- <% if ma.memo_type == "Memo" %>
- <%= ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content.html_safe%>"><%=ma.memo.author.show_name %> <%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content.html_safe%>
- <% end %>
- <% elsif ma.class == UserFeedbackMessage %>
- <% if ma.journals_for_message_type == "JournalsForMessage" %>
- <%= ma.journals_for_message.notes.gsub("","").gsub("
","").gsub(" ","").html_safe%>"><%=ma.journals_for_message.user.show_name %> <%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %><%= ma.journals_for_message.notes.gsub("","").gsub("
","").gsub(" ","").html_safe%>
- <% end %>
- <% elsif ma.class == OrgMessage %>
- <% if ma.message_type == 'ApplySubdomain' %>
- 0 && Secdomain.where("sub_type=2 and pid=?", ma.organization.id).first.subname != ma.content)) ? "同意申请":"申请已批准"%>"><%=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)) ? "同意申请":"申请已批准"%>
- <% elsif ma.message_type == 'AgreeApplySubdomain' %>
- 系统提示 管理员同意了您的子域名申请:<%= ma.content%>
- <% end %>
- <% elsif AtMessage === ma && ma.at_valid? %>
- <% if ma.at_message_type == "Message" && !ma.at_message.course.nil? %>
- <% href = course_boards_path(ma.at_message.course,:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id) %>
- <%=ma.author.show_name %> 提到了你:<%= ma.subject.html_safe%>
- <% elsif ma.at_message_type == "Message" && !ma.at_message.project.nil? %>
- <% href = project_boards_path(ma.at_message.project,:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id) %>
- <%=ma.author.show_name %> 提到了你:<%= ma.subject.html_safe%>
+ <% elsif ma.course_message_type == "ApplyResource" && ma.status == 1 %>
+ <% if ma.course_message.container_type == "Course" %>
+ <% href = course_files_path(ma.course_message.container_id) %>
+ <% elsif ma.course_message.container_type == "Project" %>
+ <% href = project_files_path(ma.course_message.container_id) %>
+ <% elsif ma.course_message.container_type == "OrgSubfield" %>
+ <% href = org_subfield_files_path(ma.course_message.container_id) %>
<% else %>
- <% content = ''+ma.author.show_name+' 提到了你:'+ma.subject.html_safe %>
- <%=link_to content.html_safe, ma.url, :title => ma.author.show_name+' 提到了你:'+ma.subject.html_safe, :target => '_blank' %>
+ <% href = 'javascript:void(0)' %>
<% end %>
+ <%=User.find(ma.course_message.apply_user_id).show_name %> <%= ma.apply_result == 2 ? '同意' : '拒绝'%>引用资源:<%= ma.course_message.find_attachment(ma.course_message.attachment_id).try(:filename)%>
+ <% elsif ma.course_message_type == "Poll" %>
+ "><%=ma.course_message.user.show_name %> 发布了问卷:<%= ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name%>
+ <% elsif ma.course_message_type == "Message" %>
+ <% content = ma.course_message.parent_id.nil? ? ma.course_message.subject : ma.course_message.content.html_safe %>
+ <% href = course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id) %>
+ <%= content%>"><%=ma.course_message.author.show_name %> <%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %><%= content%>
+ <% elsif ma.course_message_type == "StudentWorksScore" %>
+ <%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %><%= ma.content.html_safe if !ma.content.nil?%>"><%=ma.course_message.reviewer_role == 3 ? '匿名用户' : ma.course_message.user.show_name+"老师" %> <%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %><%= ma.content.html_safe if !ma.content.nil?%>
+ <% elsif ma.course_message_type == "JournalsForMessage" %>
+ <% if ma.course_message.jour_type == 'Course' %>
+ <%=ma.course_message.user.show_name %> 在课程中留言了:<%= ma.course_message.notes.html_safe%>
+ <% elsif ma.course_message.jour_type == 'HomeworkCommon' %>
+ <%=ma.course_message.user.show_name %> <%=ma.course_message.m_parent_id.nil? ? '回复了您的作业:' : '在作业中回复了您:' %><%= ma.course_message.notes.html_safe%>
+ <% else %>
+ <%=ma.course_message.user.show_name %><%=ma.course_message.user.allowed_to?(:as_teacher, ma.course) ? '老师' : '同学' %> 回复了作品评论:<%= ma.course_message.notes%>
+ <% 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) %>
+ <%=ma.course_message.homework_common.user.show_name %>老师 发布的作业:<%=ma.course_message.homework_common.name %>,由于迟交作业,您及您的作品都不能参与该作业的匿评
+ <% elsif ma.course_message_type == "StudentWork" && ma.status == 1 %>
+ <%=ma.course_message.user.show_name %>同学 重新提交了作品:<%=ma.course_message.name %>
+ <% elsif ma.course_message_type == "StudentWork" && ma.status == 2 %>
+ <%=ma.course_message.user.show_name %>同学 追加新附件了:作业标题:<%=ma.course_message.homework_common.name %>
+ <% elsif ma.course_message_type == "Course" %>
+ 系统提示 您成功创建了课程:课程名称:<%=ma.course_message.name %>
+ <% elsif ma.course_message_type == "JoinCourseRequest" %>
+ <% content = User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}" %>
+ 系统提示 您有了新的课程成员申请:<%=content %>
+ <% elsif ma.course_message_type == "CourseRequestDealResult" %>
+ <% content = ma.status == 1 ? '您申请成为课程"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'申请已通过' : '您申请成为课程"'+Course.find(ma.course_id).name+'"的'+(ma.content == '9' ? '老师' : '教辅')+'的申请被拒绝' %>
+ 系统提示 课程申请进度反馈:<%=content %>
+ <% elsif ma.course_message_type == "JoinCourse" and ma.status == 0 %>
+ <%=User.find(ma.course_message_id).show_name %> 将您加入了课程:<%=ma.course.name %>
+ <% elsif ma.course_message_type == "JoinCourse" and ma.status == 1 %>
+ ">系统提示 您增加了新的课程成员:<%=User.find(ma.course_message_id).login+"("+User.find(ma.course_message_id).show_name+")" %>
+ <% elsif ma.course_message_type == "RemoveFromCourse" %>
+ <%=User.find(ma.course_message_id).show_name %> 将您移出了课程:<%=ma.course.name %>
+ <% elsif ma.course_message_type == "Exercise" && ma.status == 2 %>
+ <%=ma.course_message.user.show_name %>老师 发布了课程测验:测验题目:<%=ma.course_message.exercise_name %>
+ <% elsif ma.course_message_type == "Exercise" && ma.status == 3 %>
+ <%=ma.course_message.user.show_name %>老师 发布的测验:<%=ma.course_message.exercise_name %> 截止时间快到了
<% end %>
+ <% elsif ma.class == ForgeMessage %>
+ <% if ma.forge_message_type == "AppliedProject" %>
+ " target="_blank" title="<%=ma.forge_message.user.show_name %> 申请加入项目:<%= ma.project.name%>"><%=ma.forge_message.user.show_name %> 申请加入项目:<%= ma.project.name%>
+ <% elsif ma.forge_message_type == "JoinProject" %>
+ <%=User.find(ma.forge_message_id).show_name %> 将您加入了项目:<%= ma.project.name%>
+ <% elsif ma.forge_message_type == "RemoveFromProject" %>
+ <%=User.find(ma.forge_message_id).show_name %> 将您移出了项目:<%= ma.project.name%>
+ <% elsif ma.forge_message_type == "RemoveFromProject" %>
+ <%=User.find(ma.forge_message_id).show_name %> 邀请你加入项目:<%= ma.project.name%>
+ <% elsif ma.forge_message_type == "Issue" && ma.status == 1 %>
+ <%= ma.forge_message.subject%> 截止时间快到了!"><%=ma.forge_message.author.show_name %> <%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%><%= ma.forge_message.subject%> 截止时间快到了!
+ <% elsif ma.forge_message_type == "Issue" && ma.status != 1 %>
+ <%= ma.forge_message.subject%>"><%=ma.forge_message.author.show_name %> <%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%><%= ma.forge_message.subject%>
+ <% elsif ma.forge_message_type == "Journal" %>
+ <%=ma.forge_message.user.show_name %> 更新了问题状态:<%= ma.forge_message.journalized.subject%>
+ <% elsif ma.forge_message_type == "Message" %>
+ <%= ma.forge_message.subject%>"><%=ma.forge_message.author.show_name %> <%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %><%= ma.forge_message.subject%>
+ <% elsif ma.forge_message_type == "News" %>
+ <%=ma.forge_message.author.show_name %> 发布了新闻:<%= ma.forge_message.title.html_safe%>
+ <% elsif ma.forge_message_type == "Comment" %>
+ <%=ma.forge_message.author.show_name %> 评论了新闻:<%= ma.forge_message.commented.title%>
+ <% end %>
+ <% elsif ma.class == MemoMessage %>
+ <% if ma.memo_type == "Memo" %>
+ <%= ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content.html_safe%>"><%=ma.memo.author.show_name %> <%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : ma.memo.content.html_safe%>
+ <% end %>
+ <% elsif ma.class == UserFeedbackMessage %>
+ <% if ma.journals_for_message_type == "JournalsForMessage" %>
+ <%= ma.journals_for_message.notes.gsub("","").gsub("
","").gsub(" ","").html_safe%>"><%=ma.journals_for_message.user.show_name %> <%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %><%= ma.journals_for_message.notes.gsub("","").gsub("
","").gsub(" ","").html_safe%>
+ <% end %>
+ <% elsif ma.class == OrgMessage %>
+ <% if ma.message_type == 'ApplySubdomain' %>
+ 0 && Secdomain.where("sub_type=2 and pid=?", ma.organization.id).first.subname != ma.content)) ? "同意申请":"申请已批准"%>"><%=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)) ? "同意申请":"申请已批准"%>
+ <% elsif ma.message_type == 'AgreeApplySubdomain' %>
+ 系统提示 管理员同意了您的子域名申请:<%= ma.content%>
+ <% end %>
+ <% elsif AtMessage === ma && ma.at_valid? %>
+ <% if ma.at_message_type == "Message" && !ma.at_message.course.nil? %>
+ <% href = course_boards_path(ma.at_message.course,:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id) %>
+ <%=ma.author.show_name %> 提到了你:<%= ma.subject.html_safe%>
+ <% elsif ma.at_message_type == "Message" && !ma.at_message.project.nil? %>
+ <% href = project_boards_path(ma.at_message.project,:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id) %>
+ <%=ma.author.show_name %> 提到了你:<%= ma.subject.html_safe%>
+ <% else %>
+ <% content = ''+ma.author.show_name+' 提到了你:'+ma.subject.html_safe %>
+ <%=link_to content.html_safe, ma.url, :title => ma.author.show_name+' 提到了你:'+ma.subject.html_safe, :target => '_blank' %>
+ <% end %>
+ <% end %>
<% end %>
展开更多
diff --git a/app/views/organizations/_org_custom_left1.html.erb b/app/views/organizations/_org_custom_left1.html.erb
index ee88f3315..8632dd57a 100644
--- a/app/views/organizations/_org_custom_left1.html.erb
+++ b/app/views/organizations/_org_custom_left1.html.erb
@@ -66,7 +66,7 @@
<% else %>
<%= link_to image_tag("/files/uploads/image#{get_image_path_from_content(document.content)}", :width => "299", :height => "246"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %>
<% end %>
-
+
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :class => 'por_hot_title_r link-black', :target => "_blank", :title => document.title %>
<%= time_from_now(document.created_at) %> <%= link_to document.creator.show_name, user_path(document.creator), :class => "por_hot_name link-blue", :target => "_blank" %>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => document.id, :content=> document.content, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %>
@@ -85,9 +85,11 @@
<% else %>
<%= link_to image_tag("/files/uploads/image#{get_image_path_from_content(content)}", :width => "299", :height => "246"), board_message_url_in_org(message.board.id, message.id), :target => "_blank" %>
<% end %>
- <%= link_to title, board_message_url_in_org(message.board.id, message.id), :class => 'por_hot_title_r link-black', :target => "_blank", :title => title %>
-
<%= time_from_now(message.created_on) %> <%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %>
- <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %>
+
+ <%= link_to title, board_message_url_in_org(message.board.id, message.id), :class => 'por_hot_title_r link-black', :target => "_blank", :title => title %>
+
<%= time_from_now(message.created_on) %> <%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %>
+ <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %>
+
<% else %>
@@ -96,9 +98,11 @@
<% else %>
<%= link_to image_tag("/files/uploads/image#{get_image_path_from_content(content)}", :width => "299", :height => "246"), board_message_path(message.board.id, message.id), :target => "_blank" %>
<% end %>
- <%= link_to title, board_message_path(message.board.id, message.id), :class => 'por_hot_title_r link-black', :target => "_blank", :title => title %>
-
<%= time_from_now(message.created_on) %> <%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %>
- <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %>
+
+ <%= link_to title, board_message_path(message.board.id, message.id), :class => 'por_hot_title_r link-black', :target => "_blank", :title => title %>
+
<%= time_from_now(message.created_on) %> <%= link_to message.author.show_name, user_path(message.author), :class => "por_hot_name link-blue", :target => "_blank" %>
+ <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => message.id, :content=> content, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %>
+
<% end %>
<% end %>
@@ -111,9 +115,11 @@
<% else %>
<%= link_to image_tag("/files/uploads/image#{path}", :width => "299", :height => "246"), news_path(news), :target => "_blank" %>
<% end %>
- <%= link_to news.title, news_path(news), :class => 'por_hot_title_r link-black', :target => "_blank", :title => news.title %>
-
<%= time_from_now(news.created_on) %> <%= link_to news.author.show_name, user_path(news.author), :class => "por_hot_name link-blue", :target => "_blank" %>
- <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => news.id, :content=> news.description, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %>
+
+ <%= link_to news.title, news_path(news), :class => 'por_hot_title_r link-black', :target => "_blank", :title => news.title %>
+
<%= time_from_now(news.created_on) %> <%= link_to news.author.show_name, user_path(news.author), :class => "por_hot_name link-blue", :target => "_blank" %>
+ <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => news.id, :content=> news.description, :maxheight => 80, :maxwordsnum => 90, :maxwidth => 0, :cl => "por_hot_txt_r"} %>
+
<% end %>
<% end %>
@@ -121,4 +127,8 @@
<%# end %>
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/app/views/organizations/_org_custom_left3.html.erb b/app/views/organizations/_org_custom_left3.html.erb
index fb2b83dd2..ff412d869 100644
--- a/app/views/organizations/_org_custom_left3.html.erb
+++ b/app/views/organizations/_org_custom_left3.html.erb
@@ -71,7 +71,7 @@
<% end %>
<% end %>
- <% unless acts[1..4].nil? %>
+ <% unless acts[1..4].blank? %>
<% acts[1..4].each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %>
@@ -110,10 +110,10 @@
<% end %>
<% end %>
- <% unless acts[5..16].nil? %>
+ <% unless acts[5..16].blank? %>
- <% acts[6..16].each do |activity| %>
+ <% acts[5..16].each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %>
<%= link_to " #{document.title}".html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hidden_w270 link-black', :target => "_blank" %>
diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb
index ebf3f5445..a2f8a8f29 100644
--- a/app/views/organizations/setting.html.erb
+++ b/app/views/organizations/setting.html.erb
@@ -112,7 +112,8 @@
<%= form_tag url_for(:controller => 'org_member', :action => 'create', :org => @organization),:id=>'org_member_add_form',:remote=>true do |f|%>
<%# if @organization.secdomain_name.nil? %>
- <%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript host_with_protocol + "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %>
+ <%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %>
+ <%#= javascript_tag "observeSearchfield('not_org_member_search', null, '#{url_for(:controller => 'organizations', :action => 'org_member_autocomplete', :org=> @organization.id)}')" %>
<%# else %>
<%#= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript secdomain_with_protocol(@organization.secdomain_name) + "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %>
<%# end %>
diff --git a/app/views/quality_analysis/_hightchars.html.erb b/app/views/quality_analysis/_hightchars.html.erb
new file mode 100644
index 000000000..fb60eaed3
--- /dev/null
+++ b/app/views/quality_analysis/_hightchars.html.erb
@@ -0,0 +1,483 @@
+
\ No newline at end of file
diff --git a/app/views/quality_analysis/_result_list.html.erb b/app/views/quality_analysis/_result_list.html.erb
new file mode 100644
index 000000000..507ded0fe
--- /dev/null
+++ b/app/views/quality_analysis/_result_list.html.erb
@@ -0,0 +1,25 @@
+
+
分析结果
+
+
+ 名称
+ 版本
+ 分支
+ 语言
+ 时间
+
+
+<% if @quality_analyses.count >0 %>
+ <% @quality_analyses.each do |qa| %>
+
+ <%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.author_login+":"+qa.rep_identifier, :branch => qa.branch.nil? ? "master" : qa.branch), :class => "analysis-result-name fl fontBlue2" %>
+ 1.0
+ <%= qa.branch %>
+ <%= qa.language %>
+ <%= format_time(qa.created_at) %>
+
+
+ <% end %>
+<% end %>
+
+
diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb
new file mode 100644
index 000000000..8f1cb8443
--- /dev/null
+++ b/app/views/quality_analysis/_show.html.erb
@@ -0,0 +1,114 @@
+<%= javascript_include_tag 'highcharts','highcharts-more' %>
+ <%= render :partial => "hightchars" %>
+
+
质量分析
+
+当前分支:<%= params[:branch] %>
+
+ 项目代码质量分析报告
+ 概要信息
+
+
+
+
+
质量等级
+
<%= @complexity["msr"][9]["frmt_val"] %> borderRadius"><%= sqale_rating_status(@complexity["msr"][9]["val"])[0] %>
+
+
+
+
复杂度
+
<%= @complexity["msr"][6]["val"] %> borderRadius"><%= complexity_status(@complexity["msr"][6]["val"])[0] %>
+
+
+
+
+
+
代码重复度
+
<%= @complexity["msr"][7]["frmt_val"] %> borderRadius"><%= duplicated_lines_density_status(@complexity["msr"][7]["val"])[0] %>
+
+
+
+
注释率
+
<%= @complexity["msr"][5]["frmt_val"] %>
+
+
+
+ 质量等级 <%= score_sqale_rating(@complexity["msr"][9]["val"]) %> /5分可定性评价为:质量<%= sqale_rating_status(@complexity["msr"][9]["val"])[0] %>
+
+
技术债务 <%= @complexity["msr"][8]["frmt_val"] %> 查看详情
+
+
+
阻断 <%= @sonar_issues["msr"][1]["frmt_val"] %> %;">
+
严重 <%= @sonar_issues["msr"][2]["frmt_val"] %> %;">
+
主要 <%= @sonar_issues["msr"][3]["frmt_val"] %> %;">
+
次要 <%= @sonar_issues["msr"][4]["frmt_val"] %> %;">
+
信息 <%= @sonar_issues["msr"][5]["frmt_val"] %> %;">
+
+
+ 代码规模 可定性评价为:<%= lines_scale(@complexity["msr"][0]["frmt_val"]) %>
+
+
+
代码行数
+
<%= @complexity["msr"][0]["frmt_val"] %>
+
+
+
文件
+
<%= @complexity["msr"][2]["frmt_val"] %>
+
+
+
目录
+
<%= @complexity["msr"][3]["frmt_val"] %>
+
+
+
类
+
<%= @complexity["msr"][1]["frmt_val"] %>
+
+
+
方法
+
<%= @complexity["msr"][4]["frmt_val"] %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/quality_analysis/index.html.erb b/app/views/quality_analysis/index.html.erb
new file mode 100644
index 000000000..9b06e6483
--- /dev/null
+++ b/app/views/quality_analysis/index.html.erb
@@ -0,0 +1,6 @@
+<% if @name_flag %>
+ <%= render :partial => "result_list" %>
+<% else %>
+ <%= render "show" %>
+<% end %>
+
diff --git a/app/views/quality_analysis/show.html.erb b/app/views/quality_analysis/show.html.erb
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/views/repositories/_quality_analysis.html.erb b/app/views/repositories/_quality_analysis.html.erb
new file mode 100644
index 000000000..f9726fb9b
--- /dev/null
+++ b/app/views/repositories/_quality_analysis.html.erb
@@ -0,0 +1,23 @@
+代码质量分析
+
+ <%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier), :remote => true, :id => 'quality_analyses_form') do %>
+
+ <% end %>
+
diff --git a/app/views/repositories/quality_analyses.html.erb b/app/views/repositories/quality_analyses.html.erb
new file mode 100644
index 000000000..69dae2629
--- /dev/null
+++ b/app/views/repositories/quality_analyses.html.erb
@@ -0,0 +1,76 @@
+<%= javascript_include_tag 'highcharts','highcharts-more' %>
+
+
<%= l(:label_quality_analyses) %>
+
+
+
+ <%#= render :partial => 'navigation' %>
+
+
+
+
+
+
+
+
+
+
+<%= link_to l(:button_back), :action => 'show', :id => @project %>
+<% html_title(l(:label_repository), l(:label_statistics)) -%>
\ No newline at end of file
diff --git a/app/views/repositories/quality_analysis.js.erb b/app/views/repositories/quality_analysis.js.erb
new file mode 100644
index 000000000..bafe28cdf
--- /dev/null
+++ b/app/views/repositories/quality_analysis.js.erb
@@ -0,0 +1,8 @@
+$('#ajax-modal').html('<%= escape_javascript( render :partial => 'repositories/quality_analysis', :locals => {}) %>');
+showModal('ajax-modal', '615px');
+$('#ajax-modal').siblings().remove();
+$('#ajax-modal').before(" ");
+$('#ajax-modal').parent().css("top","20%").css("left","32%").css("border","3px solid #269ac9");
+$('#ajax-modal').parent().addClass("popbox_polls");
+
+
diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb
index 43be57760..124e3ef4d 100644
--- a/app/views/repositories/show.html.erb
+++ b/app/views/repositories/show.html.erb
@@ -2,7 +2,13 @@
<%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
ZIP下载
-
+ <% if is_project_manager?(User.current, @project.id) && QualityAnalysis.where(:project_id => @project.id).first.nil? %>
+ <%# if User.current.member_of?(@project) %>
+ <%= link_to "质量分析", quality_analysis_path(:id => @project.id), :remote => true, :class => "btn_zipdown fr" %>
+ <%# end %>
+ <% else %>
+ <%= link_to "质量分析", project_quality_analysis_path(:project_id => @project.id, :resource_id => @proje), :class => "btn_zipdown fr" %>
+ <% end %>
<% if @entries.nil? %>
@@ -45,7 +51,7 @@
<%= @changesets_latest_coimmit.message %>
<% else %>
-
<%=@changesets_latest_coimmit.author_email %>
+ <%=@changesets_latest_coimmit.author_email %>
提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:
<%= @changesets_latest_coimmit.message %>
@@ -57,7 +63,6 @@
<%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %> 提交
-
<% end %>
diff --git a/app/views/student_work/_evaluation_title.html.erb b/app/views/student_work/_evaluation_title.html.erb
index 1914b1018..9875a4cc6 100644
--- a/app/views/student_work/_evaluation_title.html.erb
+++ b/app/views/student_work/_evaluation_title.html.erb
@@ -3,7 +3,7 @@
序号
<% if @homework.homework_type != 3 %>
- 作品名称
+ 作品名称
姓名
diff --git a/app/views/users/_reply_banner.html.erb b/app/views/users/_reply_banner.html.erb
index 0d7e0b2bd..25175542f 100644
--- a/app/views/users/_reply_banner.html.erb
+++ b/app/views/users/_reply_banner.html.erb
@@ -10,7 +10,7 @@
<%#= format_date(activity.updated_on) %>
<%if count>3 %>
diff --git a/app/views/users/_reply_to.html.erb b/app/views/users/_reply_to.html.erb
index fd56eb712..621b56fbd 100644
--- a/app/views/users/_reply_to.html.erb
+++ b/app/views/users/_reply_to.html.erb
@@ -1,9 +1,7 @@
-
-
- <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
-
-
- <% if User.current.logged? %>
+
+ <% if User.current.logged? %>
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
+
<% if @type == 'HomeworkCommon' %>
<%= form_for('new_form',:url => {:controller => 'words', :action => 'reply_to_homework', :id => reply.id},:method => "post", :remote => true) do |f| %>
@@ -32,10 +30,10 @@
<% end%>
<% end %>
- <% else %>
- <%= render :partial => "users/show_unlogged" %>
- <% end %>
-
-
+
+
+ <% else %>
+ <%= render :partial => "users/show_unlogged_reply" %>
+ <% end %>
\ No newline at end of file
diff --git a/app/views/users/_show_unlogged_reply.html.erb b/app/views/users/_show_unlogged_reply.html.erb
new file mode 100644
index 000000000..b428fd249
--- /dev/null
+++ b/app/views/users/_show_unlogged_reply.html.erb
@@ -0,0 +1,4 @@
+
+
登录 后可添加回复
+ <%#= link_to "登录", signin_path, :class => "linkBlue", :target => "_blank" %>
+
\ No newline at end of file
diff --git a/app/views/wechats/user_activities.html.erb b/app/views/wechats/user_activities.html.erb
index 2b4ebc703..80d254dae 100644
--- a/app/views/wechats/user_activities.html.erb
+++ b/app/views/wechats/user_activities.html.erb
@@ -28,27 +28,27 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+