Merge branch 'szzh' into develop

This commit is contained in:
sw 2014-08-14 15:55:43 +08:00
commit 46ba7f6a7b
78 changed files with 821 additions and 440 deletions

View File

@ -75,3 +75,9 @@ bundle exec rake db:migrate:up version=20140725062302
kw: Mysql2::Error,存储过程,CALL sp_project_status_cursor();
bundle exec rake db:migrate:down version=20130828004955
bundle exec rake db:migrate:up version=20130828004955
=================================[2014-08-13]====================================
kw:配置支持的图片格式
默认支持如下格式:"bmp,jpeg,jpg,png,gif"
可在configuration.yml中修改格式pic_types: "bmp,jpeg,jpg,png,gif"(注意pic_types若前面有#号需去掉)
配置完成后重启服务

View File

@ -76,6 +76,7 @@ class ProjectsController < ApplicationController
# helper :watcherlist
helper :words
helper :project_score
helper :user_score
### added by william
include ActsAsTaggableOn::TagsHelper
@ -111,7 +112,7 @@ class ProjectsController < ApplicationController
per_page_option = 10
@projects_all = Project.active.visible.
joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").
joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").joins("LEFT JOIN #{ProjectScore.table_name} ON #{Project.table_name}.id = #{ProjectScore.table_name}.project_id").
where("#{Project.table_name}.project_type = ? ", Project::ProjectType_project)
@project_count = @projects_all.count
@ -134,7 +135,7 @@ class ProjectsController < ApplicationController
@projects = @projects_all.order("created_on desc")
@s_type = 0
when '1'
@projects = @projects_all.order("grade desc")
@projects = @projects_all.order("score desc")
@s_type = 1
when '2'
@projects = @projects_all.order("watchers_count desc")
@ -148,7 +149,7 @@ class ProjectsController < ApplicationController
@projects = @projects[@project_pages.offset, @project_pages.per_page]
else
@projects = @projects = @projects_all.order("grade desc")
@projects = @projects = @projects_all.order("score desc")
@s_type = 1
end
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)

View File

@ -5,12 +5,18 @@ class StoresController < ApplicationController
layout 'base_stores'
def search
begin
q = "%#{params[:name].strip}%"
(redirect_to stores_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
result = find_public_attache q
@searched_attach = paginateHelper result
@result_all_count = result.count;
rescue Exception => e
#render 'stores'
redirect_to stores_path
end
end
def find_public_attache keywords

View File

@ -27,14 +27,14 @@ class WelcomeController < ApplicationController
@first_page = FirstPage.where("page_type = 'project'").first
#@show_course = @first_page.show_course
if @first_page.nil? || @first_page.sort_type.nil?
@projects = find_miracle_project(10, 3,"grade desc")
@projects = find_miracle_project(10, 3,"score desc")
else
case @first_page.sort_type
when 0
@projects = find_miracle_project(10, 3,"created_on desc")
#@projects = @projects_all.order("created_on desc")
when 1
@projects = find_miracle_project(10, 3,"grade desc")
@projects = find_miracle_project(10, 3,"score desc")
#@projects = @projects_all.order("grade desc")
when 2
@projects = find_miracle_project(10, 3,"watchers_count desc")
@ -48,7 +48,7 @@ class WelcomeController < ApplicationController
# @projects = @projects[@project_pages.offset, @project_pages.per_page]
else
@projects = @projects_all.order("grade desc")
@projects = @projects_all.order("score desc")
end
end

View File

@ -679,15 +679,15 @@ module ApplicationHelper
def textilizable(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
case args.size
when 1
obj = options[:object]
text = args.shift
when 2
obj = args.shift
attr = args.shift
text = obj.send(attr).to_s
else
raise ArgumentError, 'invalid arguments to textilizable'
when 1
obj = options[:object]
text = args.shift
when 2
obj = args.shift
attr = args.shift
text = obj.send(attr).to_s
else
raise ArgumentError, 'invalid arguments to textilizable'
end
return '' if text.blank?
project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)
@ -716,6 +716,48 @@ module ApplicationHelper
text.html_safe
end
#
#格式化字符串不转义html代码
def textAreailizable(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
case args.size
when 1
obj = options[:object]
text = args.shift
when 2
obj = args.shift
attr = args.shift
text = obj.send(attr).to_s
else
raise ArgumentError, 'invalid arguments to textilizable'
end
return '' if text.blank?
project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)
only_path = options.delete(:only_path) == false ? false : true
text = text.dup
macros = catch_macros(text)
text = Redmine::WikiFormatting.to_html("CKEditor", text, :object => obj, :attribute => attr)
@parsed_headings = []
@heading_anchors = {}
@current_section = 0 if options[:edit_section_links]
parse_sections(text, project, obj, attr, only_path, options)
text = parse_non_pre_blocks(text, obj, macros) do |text|
[:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links].each do |method_name|
send method_name, text, project, obj, attr, only_path, options
end
end
parse_headings(text, project, obj, attr, only_path, options)
if @parsed_headings.any?
replace_toc(text, @parsed_headings)
end
text.html_safe
end
def parse_non_pre_blocks(text, obj, macros)
s = StringScanner.new(text)
tags = []
@ -1300,10 +1342,10 @@ module ApplicationHelper
start_of_week = start_of_week.to_i % 7
tags = javascript_tag(
"var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: #{start_of_week}, " +
"var datepickerOptions={dateFormat: 'yy-mm-dd',minDate: new Date(), firstDay: #{start_of_week}, " +
"showOn: 'button', buttonImageOnly: true, buttonImage: '" +
path_to_image('/images/calendar.png') +
"', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};")
"', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true, onClose: function(dateText, inst) {TimeClose(dateText,inst);}, beforeShow : function(input){TimeBeforeShow(input);} };")
jquery_locale = l('jquery.locale', :default => current_language.to_s)
unless jquery_locale == 'en'
tags << javascript_include_tag("i18n/jquery.ui.datepicker-#{jquery_locale}.js")
@ -1789,4 +1831,5 @@ module ApplicationHelper
content_tag(:ul, logos.join("").html_safe, :class => ul_class.to_s).html_safe
end
end

View File

@ -73,7 +73,7 @@ module IssuesHelper
ancestors.each do |ancestor|
s << '<div>' + content_tag('p', link_to_issue(ancestor, :project => (issue.project_id != ancestor.project_id)))
end
s << '<div>'
s << '<div style="word-wrap: break-word; word-break: normal;">'
subject = h(issue.subject)
if issue.is_private?
subject = content_tag('span', l(:field_is_private), :class => 'private') + ' ' + subject

View File

@ -65,26 +65,34 @@ module ProjectScoreHelper
b_m_num * 2
end
#项目得分
#计算项目得分
def project_scores project
result = (issue_score project) + (news_score project) + (document_score project) + (changesets_score project) + (board_message_score project)
pss = ProjectStatus.where("project_id = '#{project.id}'")
pss = ProjectScore.where("project_id = '#{project.id}'")
if pss.nil? || pss.count == 0
ps = ProjectStatus.new
ps.grade = result
ps = ProjectScore.new
ps.score = result
ps.project = project
ps.watchers_count = project.watcher_users.count
ps.changesets_count = project.changesets.count
ps.save
else
ps = pss.first
ps.grade = result
if ps.changesets_count.nil? || ps.changesets_count == ""
ps.changesets_count = project.changesets.count
end
ps.score = result
ps.save
end
result
end
#读取项目得分
def red_project_scores project
grade = 0
pss = ProjectScore.where("project_id = '#{project.id}'")
if pss.nil? || pss.count == 0
grade
else
ps = pss.first
grade = ps.score
grade
end
end
end

View File

@ -445,7 +445,7 @@ FROM `users` where id = #{user.id}")
def messges_for_issue_num(user,project=nil)
if project.nil?
Journal.includes(:user).where("user_id = '#{user.id}' and notes != '' and notes is not null").all.count
Journal.includes(:user).where("user_id = '#{user.id}' and notes is not null and notes != ''").all.count
else
Journal.includes(:user).joins(:issue).where("#{Journal.table_name}.user_id = '#{user.id}' and #{Issue.table_name}.project_id = '#{project.id}' and #{Journal.table_name}.notes != '' and #{Journal.table_name}.notes is not null").all.count
end
@ -475,6 +475,16 @@ FROM `users` where id = #{user.id}")
end
def issues_status_score(user,project=nil)
if project.nil?
#Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count
User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM journals JOIN journal_details on journals.id = journal_details.journal_id WHERE journal_details.prop_key = 'status_id' and journals.user_id = users.id) AS m_score FROM users WHERE users.id = '#{user.id}'")
else
#Journal.joins(:issue,:details,:user).where("#{Issue.table_name}.project_id = '#{project.id}' and #{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count
User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM journals JOIN journal_details on journals.id = journal_details.journal_id JOIN issues ON issues.id = journals.journalized_id and journalized_type = 'Issue' WHERE journal_details.prop_key = 'status_id' and journals.user_id = users.id and issues.project_id = '#{project.id}') AS m_score FROM users WHERE users.id = '#{user.id}'")
end
end
#更新对留言的回复数量
def update_replay_for_message(user,type,project=nil)
option_number = get_option_number(user,type)
@ -491,6 +501,14 @@ FROM `users` where id = #{user.id}")
end
def replay_for_message_score(user,project=nil)
if project.nil?
User.find_by_sql("SELECT users.id,(SELECT COUNT(*) From journals_for_messages WHERE m_parent_id IS NOT NULL and user_id = users.id and jour_type = 'Project') as m_score FROM users WHERE users.id = '#{user.id}'")
else
User.find_by_sql("SELECT users.id,(SELECT COUNT(*) From journals_for_messages WHERE m_parent_id IS NOT NULL and user_id = users.id and jour_type = 'Project' and jour_id = '#{project.id}') as m_score FROM users WHERE users.id = '#{user.id}'")
end
end
#更新对帖子的回复数量
def update_replay_for_memo(user,type,project=nil)
option_number = get_option_number(user,type)
@ -506,6 +524,14 @@ FROM `users` where id = #{user.id}")
end
end
def replay_for_memo_score(user,project=nil)
if project.nil?
User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM messages JOIN boards on messages.board_id = boards.id WHERE messages.parent_id IS NOT NULL AND messages.author_id = users.id AND boards.project_id != -1) FROM users WHERE users.id = #{user.id}")
else
User.find_by_sql("SELECT users.id,(SELECT COUNT(*) FROM messages JOIN boards on messages.board_id = boards.id WHERE messages.parent_id IS NOT NULL AND messages.author_id = users.id AND boards.project_id = #{project.id}) FROM users WHERE users.id = #{user.id}")
end
end
#更新被关注的人数
def update_follow(user,type)
option_number = get_option_number(user,type)
@ -517,6 +543,10 @@ FROM `users` where id = #{user.id}")
Watcher.includes(:watchable).where("watchable_type = 'Principal' and watchable_id = '#{user.id}'").count
end
def follow_score(user)
User.find_by_sql("SELECT users.id, (SELECT COUNT(*) * 2 FROM #{Watcher.table_name} WHERE watchable_type = 'Principal' and watchable_id = '#{user.id}') FROM users WHERE users.id = '#{user.id}'")
end
#更新帖子踩各项数量
def update_tread(user,type,project=nil)
option_number = get_option_number(user,type)
@ -542,7 +572,7 @@ FROM `users` where id = #{user.id}")
end
target_user = obj.author
level = UserLevels.get_level(pt.user)#pt.user.get_level
project = pt.project
#project = pt.project
if level == 1 && target_user.id == user.id
result << pt
elsif level == 2 && target_user.id == user.id
@ -560,7 +590,7 @@ FROM `users` where id = #{user.id}")
result2 = []
pts.each do |pt|
obj = PraiseTread.find_object_by_type_and_id(pt.praise_tread_object_type, pt.praise_tread_object_id)
if obj.nil?
if obj.nil? || (pt.praise_tread_object_type == "Issue" && obj.project.nil?) || (pt.praise_tread_object_type == "Message" && obj.board.nil?) || (pt.praise_tread_object_type == "Message" && obj.board.project.nil?)
next
end
if !(pt.praise_tread_object_type == "Issue" && obj.project.id == project.id) && !(pt.praise_tread_object_type == "Message" && obj.board.project.id == project.id)
@ -568,7 +598,7 @@ FROM `users` where id = #{user.id}")
end
target_user = obj.author
level = UserLevels.get_level(pt.user)#pt.user.get_level
project = pt.project
#project = pt.project
if level == 1 && target_user.id == user.id
result << pt
elsif level == 2 && target_user.id == user.id
@ -600,7 +630,7 @@ FROM `users` where id = #{user.id}")
result2 = []
pts.each do |pt|
obj = PraiseTread.find_object_by_type_and_id(pt.praise_tread_object_type, pt.praise_tread_object_id)
if obj.nil?
if obj.nil? || (pt.praise_tread_object_type == "Issue" && obj.project.nil?) || (pt.praise_tread_object_type == "Message" && obj.board.nil?) || (pt.praise_tread_object_type == "Message" && obj.board.project.nil?)
next
end
if !(pt.praise_tread_object_type == "Issue" && obj.project.id == project.id) && !(pt.praise_tread_object_type == "Message" && obj.board.project.id == project.id)
@ -608,7 +638,7 @@ FROM `users` where id = #{user.id}")
end
target_user = obj.author
level = UserLevels.get_level(pt.user)#pt.user.get_level
project = pt.project
#project = pt.project
if level == 1 && target_user.id == user.id
result << pt
elsif level == 2 && target_user.id == user.id

View File

@ -428,13 +428,13 @@ module WelcomeHelper
resultSet.take(limit)
end
def sort_project_by_hot_rails project_type=0, order_by='grade DESC', limit=15
def sort_project_by_hot_rails project_type=0, order_by='score DESC', limit=15
# Project.find_by_sql("
# SELECT p.id, p.name, p.description, p.identifier, t.project_id
# FROM projects AS p LEFT OUTER JOIN (
# SELECT project_id,grade FROM project_statuses
# WHERE project_type = #{project_type} ORDER BY #{order_by} LIMIT #{limit} ) AS t ON p.id = t.project_id ")
Project.visible.joins(:project_status).where("#{Project.table_name}.project_type = ?", project_type).order(order_by).limit(limit).all
Project.visible.joins(:project_status).joins("LEFT JOIN #{ProjectScore.table_name} ON #{Project.table_name}.id = #{ProjectScore.table_name}.project_id").where("#{Project.table_name}.project_type = ?", project_type).order(order_by).limit(limit).all
end
def sort_bid_by_hot_rails reward_type, limit = 10

View File

@ -40,4 +40,14 @@ module WikiHelper
link_to(h(parent.pretty_title), {:controller => 'wiki', :action => 'show', :id => parent.title, :project_id => parent.project, :version => nil})
})
end
def wiki_content_format wiki
text = wiki.text.html_safe
text = parse_non_pre_blocks(text, wiki, text) do |text|
[:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links].each do |method_name|
send method_name, text, project, wiki, attr, only_path, options
end
end
text
end
end

View File

@ -26,6 +26,8 @@ class Attachment < ActiveRecord::Base
belongs_to :author, :class_name => "User", :foreign_key => "author_id"
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
include UserScoreHelper
validates_presence_of :filename, :author
validates_length_of :filename, :maximum => 255
validates_length_of :disk_filename, :maximum => 255
@ -68,8 +70,9 @@ class Attachment < ActiveRecord::Base
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
before_save :files_to_final_location
before_save :be_user_score # user_score
after_destroy :delete_from_disk
after_create :be_user_score # user_score
after_update :be_user_score
after_destroy :delete_from_disk,:down_user_score
# add by nwb
# 获取所有可公开的资源文件列表
@ -504,9 +507,16 @@ class Attachment < ActiveRecord::Base
type = self.container_type
types = %w|Document News Version Project Issue Message WikiPage|
if types.include?(type)
UserScore.project(:push_file, User.current,self, { attachment_id: self.id })
#UserScore.project(:push_file, self.author,self, { attachment_id: self.id })
end
end
update_attachment(self.author,1)
end
#删除附件时重新统计用户的附件数量得分
def down_user_score
update_attachment(self.author,1)
end
end

View File

@ -18,7 +18,7 @@
class Changeset < ActiveRecord::Base
belongs_to :repository
belongs_to :user
include UserScoreHelper
#after_save :be_user_score # user_score
has_many :filechanges, :class_name => 'Change', :dependent => :delete_all
@ -64,6 +64,8 @@ class Changeset < ActiveRecord::Base
}
after_create :scan_for_issues,:be_user_score # user_score
after_update :be_user_score
after_destroy :down_user_score
before_create :before_create_cs
# fq
@ -305,6 +307,13 @@ class Changeset < ActiveRecord::Base
UserScore.project(:push_code, self.user,self, { changeset_id: self.id })
#更新用户等级
UserLevels.update_user_level(self.user)
update_changeset(self.user,1)
end
#积分刷新
def down_user_score
UserLevels.update_user_level(self.user)
update_changeset(self.user,1)
end
end

View File

@ -0,0 +1,3 @@
class CourseAttachment < ActiveRecord::Base
attr_accessible :attachtype, :author_id, :content_type, :description, :digest, :disk_directory, :disk_filename, :downloads, :filename, :filesize, :integer, :is_public
end

View File

@ -20,9 +20,9 @@ class Document < ActiveRecord::Base
belongs_to :project
belongs_to :user
belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id"
after_create :be_user_score # user_score
include UserScoreHelper
after_save :be_user_score # user_score
after_destroy :down_user_score
acts_as_attachable :delete_permission => :delete_documents
@ -68,5 +68,10 @@ class Document < ActiveRecord::Base
# update user score
def be_user_score
UserScore.project(:push_document, self.user,self,{ document_id: self.id })
update_document(self.user,1)
end
def down_user_score
update_document(self.user,1)
end
end

View File

@ -11,7 +11,7 @@ class Forum < ActiveRecord::Base
'creator_id'
validates_presence_of :name, :creator_id, :description
validates_length_of :name, maximum: 50
validates_length_of :description, maximum: 255
#validates_length_of :description, maximum: 255
validates :name, :uniqueness => true
acts_as_taggable

View File

@ -79,7 +79,7 @@ class Issue < ActiveRecord::Base
# fq
after_create :act_as_activity,:be_user_score_new_issue
after_update :be_user_score
before_destroy :down_user_score
after_destroy :down_user_score
# after_create :be_user_score
# end
@ -138,10 +138,10 @@ class Issue < ActiveRecord::Base
nil
when 'default'
user_ids = [user.id] + user.groups.map(&:id)
"(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
"(#{table_name}.is_private = #{connection.quoted_false}) OR (#{table_name}.author_id = #{user.id} OR #{table_name}.tracker_id IN (#{user_ids.join(',')}) OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
when 'own'
user_ids = [user.id] + user.groups.map(&:id)
"(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
"(#{table_name}.author_id = #{user.id} OR #{table_name}.tracker_id IN (#{user_ids.join(',')}) OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
else
'1=0'
end
@ -159,9 +159,9 @@ class Issue < ActiveRecord::Base
when 'all'
true
when 'default'
!self.is_private? || (self.author == user || user.is_or_belongs_to?(assigned_to))
when 'own'
self.author == user || user.is_or_belongs_to?(assigned_to)
(!self.is_private? ||self.tracker == user) || (self.author == user || user.is_or_belongs_to?(assigned_to))
when 'own'
self.tracker == user || self.author == user || user.is_or_belongs_to?(assigned_to)
else
false
end
@ -1009,9 +1009,10 @@ class Issue < ActiveRecord::Base
s << ' overdue' if overdue?
s << ' child' if child?
s << ' parent' unless leaf?
s << ' private' if is_private?
#s << ' private' if is_private?
s << ' created-by-me' if User.current.logged? && author_id == User.current.id
s << ' assigned-to-me' if User.current.logged? && assigned_to_id == User.current.id
s << ' tracker-id' if User.current.logged? && tracker_id == User.current.id
s
end
@ -1508,35 +1509,38 @@ class Issue < ActiveRecord::Base
def be_user_score
#缺陷完成度更新
if self.done_ratio_changed?
UserScore.project(:update_issue_ratio, User.current,self,{ issue_id: self.id })
#update_issue_done_ratio(User.current,1)
UserScore.project(:update_issue_ratio, self.author,self,{ issue_id: self.id })
#update_issue_done_ratio(self.author,1)
end
#缺陷状态更改
if self.status_id_changed?
#协同得分
UserScore.joint(:change_issue_status, User.current,nil,self, {issue_id: self.id})
#update_issues_status(self.author , 1)
#协同得分
UserScore.joint(:change_issue_status, self.author,nil,self, {issue_id: self.id})
#update_issues_status(self.author , 1)
end
end
#发布缺陷
def be_user_score_new_issue
UserScore.project(:post_issue, User.current,self, { issue_id: self.id })
UserScore.project(:post_issue, self.author,self, { issue_id: self.id })
update_post_issue(self.author,1)
end
def down_user_score
#缺陷完成度更新
if self.done_ratio_changed?
UserScore.project(:update_issue_ratio, User.current,self,{ issue_id: self.id })
#update_issue_done_ratio(User.current,1)
end
#if self.done_ratio_changed?
# UserScore.project(:update_issue_ratio, User.current,self,{ issue_id: self.id })
# update_issue_done_ratio(User.current,1)
#end
#缺陷状态更改
if self.status_id_changed?
#协同得分
UserScore.joint(:change_issue_status, User.current,nil,self, {issue_id: self.id})
#update_issues_status(self.author , 1)
end
#if self.status_id_changed?
# #协同得分
# UserScore.joint(:change_issue_status, User.current,nil,self, {issue_id: self.id})
# update_issues_status(self.author , 1)
#end
update_post_issue(self.author,1)
update_issue_done_ratio(User.current,1)
update_issues_status(self.author , 1)
end

View File

@ -132,7 +132,7 @@ class IssueQuery < Query
:type => :list_optional, :values => group_values
) unless group_values.empty?
role_values = Role.givable.collect {|r| [r.name, r.id.to_s] }
role_values = Role.project_role.collect {|r| [r.name, r.id.to_s] }
add_available_filter("assigned_to_role",
:type => :list_optional, :values => role_values
) unless role_values.empty?

View File

@ -46,11 +46,11 @@ class Journal < ActiveRecord::Base
before_create :split_private_notes
# fq
after_create :act_as_activity,:be_user_score
after_save :act_as_activity,:be_user_score
# end
#after_destroy :down_user_score
#before_save :be_user_score
before_destroy :down_user_score
after_destroy :down_user_score
scope :visible, lambda {|*args|
user = args.shift || User.current
@ -162,8 +162,9 @@ class Journal < ActiveRecord::Base
if !self.notes.nil? && self.notes.gsub(' ','') != ''
#协同得分加分
UserScore.joint(:post_issue_message, self.user,self.issue.author,self, { message_id: self.id })
update_messges_for_issue(self.user,1)
end
#update_messges_for_issue(User.current,1)
end
# 减少用户分数 -by zjc
def down_user_score
@ -171,7 +172,8 @@ class Journal < ActiveRecord::Base
if !self.notes.nil? && self.notes.gsub(' ','') != ''
#协同得分减分
UserScore.joint(:delete_issue_message, self.user,self.issue.author,self, { message_id: self.id })
update_messges_for_issue(self.user,1)
end
#update_messges_for_issue(User.current,1)
end
end

View File

@ -19,9 +19,9 @@ class JournalDetail < ActiveRecord::Base
include UserScoreHelper
belongs_to :journal
before_save :normalize_values
after_create :be_user_score
#after_destroy :down_user_score
before_destroy :down_user_score
after_save :be_user_score
after_destroy :down_user_score
#before_destroy :down_user_score
private
def normalize_values
@ -45,23 +45,21 @@ class JournalDetail < ActiveRecord::Base
def be_user_score
#更新缺陷完成度
if self.prop_key == 'done_ratio'
#update_issue_done_ratio(User.current,1)
update_issue_done_ratio(self.journal.user,1)
#更新缺陷状态
elsif self.prop_key == 'status_id'
#update_issues_status(User.current , 1)
update_issues_status(self.journal.user , 1)
end
end
#更新用户分数
def down_user_score
#update_issue_done_ratio(User.current,1)
#update_issues_status(User.current , 1)
if self.prop_key == 'done_ratio'
update_issue_done_ratio(self.journal.user,1)
#更新缺陷状态
elsif self.prop_key == 'status_id'
UserScore.joint(:delete_issue_status, self.journal.user,nil,self, {issue_id: self.id})
update_issues_status(self.journal.user, 1)
end
end

View File

@ -54,10 +54,10 @@ class JournalsForMessage < ActiveRecord::Base
validates :notes, presence: true
after_create :act_as_activity #huang
after_create :reset_counters!,:be_user_score
after_create :reset_counters!
after_destroy :reset_counters!
#before_save :be_user_score
#before_destroy :down_user_score
after_save :be_user_score
after_destroy :down_user_score
# default_scope { where('m_parent_id IS NULL') }
@ -142,8 +142,8 @@ class JournalsForMessage < ActiveRecord::Base
#新建了留言回复
if self.reply_id != 0
#协同得分加分
UserScore.joint(:reply_message, User.current,User.find(self.reply_id),self, { journals_for_messages_id: self.id })
update_replay_for_message(User.current,1)
UserScore.joint(:reply_message, self.user,User.find(self.reply_id),self, { journals_for_messages_id: self.id })
update_replay_for_message(self.user,1)
end
end
# 更新用户分数 -by zjc
@ -151,7 +151,8 @@ class JournalsForMessage < ActiveRecord::Base
#删除了留言回复
if self.reply_id != 0
#协同得分减分
UserScore.joint(:reply_message_delete, User.current,User.find(self.reply_id), { journals_for_messages_id: self.id })
UserScore.joint(:reply_message_delete, self.user,User.find(self.reply_id), { journals_for_messages_id: self.id })
update_replay_for_message(self.user,1)
end
end
end

View File

@ -8,12 +8,13 @@ class Memo < ActiveRecord::Base
# 若是主题帖,则内容可以是空
#validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? }
validates_length_of :subject, maximum: 50
validates_length_of :content, maximum: 3072
#validates_length_of :content, maximum: 3072
validate :cannot_reply_to_locked_topic, :on => :create
acts_as_tree :counter_cache => :replies_count, :order => "#{Memo.table_name}.created_at ASC"
acts_as_attachable
has_many :user_score_details, :class_name => 'UserScoreDetails',:as => :score_changeable_obj
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
belongs_to :last_reply, :class_name => 'Memo', :foreign_key => 'last_reply_id'
# acts_as_searchable :column => ['subject', 'content'],
# #:include => { :forum => :p}

View File

@ -21,6 +21,8 @@ class Message < ActiveRecord::Base
belongs_to :board
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
acts_as_tree :counter_cache => :replies_count, :order => "#{Message.table_name}.created_on ASC"
acts_as_attachable
belongs_to :last_reply, :class_name => 'Message', :foreign_key => 'last_reply_id'
@ -59,12 +61,11 @@ class Message < ActiveRecord::Base
after_create :add_author_as_watcher, :reset_counters!
after_update :update_messages_board
after_destroy :reset_counters!#,:down_user_score
after_destroy :reset_counters!,:down_user_score
# fq
after_create :act_as_activity,:be_user_score
#before_save :be_user_score
before_destroy :down_user_score
# end
scope :visible, lambda {|*args|
@ -151,11 +152,11 @@ class Message < ActiveRecord::Base
#新建message且无parent的为发帖
if self.parent_id.nil? && !self.board.project.nil?
UserScore.joint(:post_message, self.author,nil,self, { message_id: self.id })
#update_memo_number(User.current,1)
update_memo_number(User.current,1)
#新建message且有parent的为回帖
elsif !self.parent_id.nil? && !self.board.project.nil?
UserScore.joint(:reply_posting, self.author,self.parent.author,self, { message_id: self.id })
#update_replay_for_memo(User.current,1)
update_replay_for_memo(User.current,1)
end
end
@ -163,10 +164,10 @@ class Message < ActiveRecord::Base
def down_user_score
if self.parent_id.nil? && !self.board.project.nil?
UserScore.joint(:delete_message, self.author,nil,self, { message_id: self.id })
update_memo_number(User.current,1)
elsif !self.parent_id.nil? && !self.board.project.nil?
UserScore.joint(:reply_deleting, self.author,self.parent.author,self, { message_id: self.id })
update_replay_for_memo(User.current,1)
end
#update_memo_number(User.current,1)
#update_replay_for_memo(User.current,1)
end
end

View File

@ -3,7 +3,8 @@ class PraiseTread < ActiveRecord::Base
belongs_to :user
belongs_to :praise_tread_object, polymorphic: true
after_create :be_user_score
after_destroy :down_user_score
include UserScoreHelper
def self.find_object_by_type_and_id(type,id)
@obj = nil
case type
@ -28,7 +29,7 @@ class PraiseTread < ActiveRecord::Base
# 获取裁定对象为Message时Message所属的项目或课程
def project
project = nil
if self.praise_tread_object_type == 'Message'
if self.praise_tread_object_type == 'Message' || self.praise_tread_object_type == 'Issues'
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
project = obj.project
end
@ -38,15 +39,37 @@ class PraiseTread < ActiveRecord::Base
#更新用户分数 - by zjc
def be_user_score
#踩贴吧或讨论区帖子
if self.praise_or_tread == 0 && (self.praise_tread_object_type == 'Memo' || self.praise_tread_object_type == 'Message')
if self.praise_or_tread == 0 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message')
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
target_user = obj.author
UserScore.skill(:treaded_by_user, User.current,target_user,self, { praise_tread_id: self.id })
update_tread(User.current,1)
update_tread(target_user,1)
#顶贴吧或讨论区帖子
elsif self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Memo' || self.praise_tread_object_type == 'Message')
elsif self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message')
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
target_user = obj.author
UserScore.skill(:praised_by_user, User.current,target_user,self,{ praise_tread_id: self.id })
update_praise(target_user,1)
#更新用户等级
UserLevels.update_user_level(target_user)
end
end
def down_user_score
#踩贴吧或讨论区帖子
if self.praise_or_tread == 0 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message')
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
target_user = obj.author
#UserScore.skill(:treaded_by_user, User.current,target_user,self, { praise_tread_id: self.id })
update_tread(User.current,1)
update_tread(target_user,1)
#顶贴吧或讨论区帖子
elsif self.praise_or_tread == 1 && (self.praise_tread_object_type == 'Issue' || self.praise_tread_object_type == 'Message')
obj = PraiseTread.find_object_by_type_and_id(self.praise_tread_object_type,praise_tread_object_id)
target_user = obj.author
#UserScore.skill(:praised_by_user, User.current,target_user,self,{ praise_tread_id: self.id })
update_praise(target_user,1)
#更新用户等级
UserLevels.update_user_level(target_user)
end

View File

@ -0,0 +1,4 @@
class ProjectScore < ActiveRecord::Base
attr_accessible :project_id, :score
belongs_to :project, foreign_key: :project_id
end

View File

@ -67,6 +67,16 @@ class Role < ActiveRecord::Base
:in => ISSUES_VISIBILITY_OPTIONS.collect(&:first),
:if => lambda {|role| role.respond_to?(:issues_visibility)}
#获取项目相关角色
def self.project_role
self.givable[0..2]
end
#获取课程相关角色
def self.course_role
self.givable[3..5]
end
# Copies attributes from another role, arg can be an id or a Role
def copy_from(arg, options={})
return unless arg.present?

View File

@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class Watcher < ActiveRecord::Base
include UserScoreHelper
belongs_to :watchable, :polymorphic => true
belongs_to :user
#Added by nie
@ -23,7 +24,7 @@ class Watcher < ActiveRecord::Base
has_one :users_status
#end
after_create :be_user_score
before_destroy :down_user_score
after_destroy :down_user_score
validates_presence_of :user
validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id]
@ -79,6 +80,7 @@ class Watcher < ActiveRecord::Base
if self.watchable_type == 'Principal'
#影响力得分
UserScore.influence(:followed_by, self.user,self.watchable,self, { watcher_id: self.id })
update_follow(self.watchable,1)
end
end
@ -87,6 +89,7 @@ class Watcher < ActiveRecord::Base
#取消关注
if self.watchable_type == 'Principal'
UserScore.influence(:cancel_followed, self.user,self.watchable,self, { watcher_id: self.id })
update_follow(self.watchable,1)
end
end

View File

@ -17,7 +17,7 @@
&nbsp;
<div class="autoscroll">
<table class="list">
<table class="list" style="width: 100%;table-layout: fixed">
<thead><tr>
<th><%=l(:label_project)%></th>
<th><%=l(:field_is_public)%></th>
@ -27,7 +27,7 @@
<tbody>
<% project_tree(@projects) do |project, level| %>
<tr class="<%= cycle("odd", "even") %> <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
<td class="name"><span><%= link_to_project_settings(project, {}, :title => project.short_description) %></span></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=project.name%>'><span><%= link_to_project_settings(project, {}) %></span></td>
<td align="center"><%= checked_image project.is_public? %></td>
<td align="center"><%= format_date(project.created_on) %></td>
<td class="buttons">

View File

@ -26,7 +26,7 @@
&nbsp;
<div class="autoscroll">
<table class="list">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<%= sort_header_tag('login', :caption => l(:field_login)) %>
@ -37,20 +37,20 @@
<%= sort_header_tag('admin', :caption => l(:field_admin), :default_order => 'desc') %>
<%= sort_header_tag('created_on', :caption => l(:field_created_on), :default_order => 'desc') %>
<%= sort_header_tag('last_login_on', :caption => l(:field_last_login_on), :default_order => 'desc') %>
<th></th>
<th style="width: 100px;"></th>
</tr>
</thead>
<tbody>
<% for user in @users -%>
<tr class="<%= user.css_classes %> <%= cycle("odd", "even") %>">
<td class="username"><%= avatar(user, :size => "14") %><%= link_to h(user.login), edit_user_path(user) %></td>
<td class="firstname"><%= h(user.firstname) %></td>
<td class="lastname"><%= h(user.lastname) %></td>
<td class="email"><%= mail_to(h(user.mail)) %></td>
<td align="center"><%= checked_image user.admin? %></td>
<td class="created_on" align="center"><%= format_time(user.created_on) %></td>
<td class="last_login_on" align="center"><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
<td class="buttons"> <%= change_status_link(user) %>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="username" title='<%=user.login%>'> <%= avatar(user, :size => "14") %><%= link_to h(user.login), edit_user_path(user) %></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="firstname" align="center" title='<%=user.firstname%>'><%= h(user.firstname) %></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="lastname" align="center" title='<%=user.lastname%>'><%= h(user.lastname) %></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="email" align="center" title='<%=user.mail%>'><%= mail_to(h(user.mail)) %></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" align="center" align="center"><%= checked_image user.admin? %></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="created_on" align="center" title='<%=format_time(user.created_on)%>'><%= format_time(user.created_on) %></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="last_login_on" align="center" title='<%= format_time(user.last_login_on)%>'><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
<td class="buttons"> <%= change_status_link(user) %>
<%= delete_link user_path(user, :back_url => admin_users_path(params)) unless User.current == user %> </td>
</tr>
<% end -%>

View File

@ -37,18 +37,9 @@
<%= sort_header_tag('admin', :caption => l(:field_admin), :default_order => 'desc') %>
<%= sort_header_tag('created_on', :caption => l(:field_created_on), :default_order => 'desc') %>
<%= sort_header_tag('last_login_on', :caption => l(:field_last_login_on), :default_order => 'desc') %>
<th></th>
<th style="width: 100px;"></th>
</tr>
</thead>
<col style="width: 20%" />
<col style="width: 10%" />
<col style="width: 5%" />
<col style="width: 20%" />
<col style="width: 5%" />
<col style="width: 15%" />
<col style="width: 15%" />
<col style="width: 5%" />
<col style="width: 5%" />
<tbody>
<% for user in @users -%>
<tr class="<%= user.css_classes %> <%= cycle("odd", "even") %>">
@ -59,7 +50,7 @@
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" align="center" align="center"><%= checked_image user.admin? %></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="created_on" align="center" title='<%=format_time(user.created_on)%>'><%= format_time(user.created_on) %></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="last_login_on" align="center" title='<%= format_time(user.last_login_on)%>'><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
<td class="buttons"> <%= change_status_link(user) %>
<td class="buttons"> <%= change_status_link(user) %>
<%= delete_link user_path(user, :back_url => admin_users_path(params)) unless User.current == user %> </td>
</tr>
<% end -%>

View File

@ -5,7 +5,7 @@
<div id='leave-message'>
<%= render :partial => 'new', :locals => {:bid => @bid, :sta => @state} %>
</div>
<% label = '';
<% label = ''
case @bid.reward_type
when 1
label = l(:label_respond_requirement)

View File

@ -41,7 +41,7 @@
<table border="0" width="525px" align="center">
<tr>
<td align="right"> <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
<%= submit_tag l(:button_clear), :name => nil, :onclick => "clearMessage('bid_message_message');", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>
<%= submit_tag l(:button_clear_meassge), :name => nil, :onclick => "clearMessage('bid_message_message');", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>
</tr>
</table>
<!-- end -->

View File

@ -3,7 +3,7 @@
<%= l(:bale_news_notice) %>
</div>
<div class="box tabular">
<p><%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;" %></p>
<p><%= f.text_field :title, :required => true, :size => 60,:maxlength => 60, :style => "width:488px;" %></p>
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;" %></p>
</div>

View File

@ -40,7 +40,7 @@
<table border="0" width="525px" align="center">
<tr>
<td align="right"> <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "contest_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
<%= submit_tag l(:button_clear), :name => nil, :onclick => "clearMessage('contest_message_message');", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>
<%= submit_tag l(:button_clear_meassge), :name => nil, :onclick => "clearMessage('contest_message_message');", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>
</tr>
</table>
<!-- end -->

View File

@ -79,7 +79,7 @@ function checkMaxLength() {
return false;"} %>
<% end %>
<% if journal.delete_by_user?(User.current) %>
<%= link_to(l(:button_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => journal.user}, :method => :delete,:remote => true)%>
<%= link_to(l(:button_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => journal.user}, :method => :delete,:confirm => l(:text_are_you_sure),:remote => true)%>
<% end %>
</span>
</span>

View File

@ -9,7 +9,7 @@
<% end %>
</div>
<h2><%=h @document.title %></h2>
<h2 style="word-wrap: break-word; word-break: normal;"><%=h @document.title %></h2>
<p><em><%#=h @document.category.name %><br />
<%= format_date @document.created_on %></em></p>

View File

@ -13,16 +13,19 @@
</ul>
</div> -->
<% end %>
<div class="actions" style="margin:10px">
<div style="width: 120%;">
<div class="field">
<%= f.text_field :name, :required => true, :style => 'width: 100%;', :class => 'create-share' %>
</div>
<div class="field">
<%= f.text_area :description, :required => true, :rows => 4, :style => 'width: 100%;resize: none;', :class => 'create-share' %>
<div>
<script src="/javascripts/ckeditor/ckeditor.js?1404953555" type="text/javascript"></script>
<%= f.text_area :description, :required => true, :id => 'editor01' %>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01',{height:300});</script>
<p style="color: #ff0000">(<%= l(:lable_forums_max_length) %>)</p>
</div>
<div class="actions" style=" padding-top: 10px; float:right">
<%= f.submit :value=>(l :button_submit) ,:class => 'nyan-clean-gray', :style => 'font-size: 14px; padding: 0px 3px' %>
<%= link_to l(:button_back), forums_path,:class => 'nyan-clean-gray',:style => 'font-size: 14px; padding: 0px 3px; color: #000' %>
<%= submit_tag l(:button_submit) %>
<%= link_to l(:button_back), forums_path ,:style => 'font-size: 14px; padding: 0px 3px;' %>
</div>
</div>
<% end %>

View File

@ -4,7 +4,7 @@
@nav_dispaly_main_contest_label = 1 %>
<% @nav_dispaly_forum_label = 1%>
<!-- added by fq -->
<h3><%= l :label_forum_new %></h1>
<h1><%= l :label_forum_new %></h1>
<%= render 'form' %>

View File

@ -18,8 +18,9 @@
<p><%= f.text_field :subject, :required => true%></p>
<p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor02' %></p>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor02');</script>
<br/>
<p style="color: #ff0000">(<%= l(:lable_memos_max_length) %>)</p>
<p>
<%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
</p>

View File

@ -78,7 +78,7 @@
:name => nil , :class => "enterprise",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
<%= submit_tag l(:button_clear), :name => nil, :class => "enterprise",
<%= submit_tag l(:button_clear_meassge), :name => nil, :class => "enterprise",
:onclick => "clearMessage('new_form_user_message');",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>

View File

@ -78,7 +78,7 @@
:name => nil , :class => "enterprise",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
<%= submit_tag l(:button_clear), :name => nil, :class => "enterprise",
<%= submit_tag l(:button_clear_meassge), :name => nil, :class => "enterprise",
:onclick => "clearMessage('new_form_user_message');",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>

View File

@ -46,6 +46,43 @@
<p><%= f.text_field :estimated_hours, :size => 3, :disabled => !@issue.leaf?, :required => @issue.required_attribute?('estimated_hours') %> <%= l(:field_hours) %></p>
<% end %>
<script type="text/javascript">
// window.onload=function(){
// var img=$("#issue_due_date").next("img");
// img.attr("onclick","SetMinValue();");
// }
function TimeClose(dateText, inst) {
if(inst.id=="issue_start_date"){
time=dateText;
}
}
var time=new Date();
function TimeBeforeShow(input){
if(input.id=="issue_due_date"){
//var minDate = $(input).datepicker('option', 'minDate');
var tempdata=$("#issue_start_date").attr("value");
$(input).datepicker('option', 'minDate',new Date(tempdata.replace(/-/g, "/")));
//$('.selector').datepicker('option', 'minDate', '12/25/2012');
}
}
function SetMinValue(){
/// var tempdata=$("#issue_start_date").attr("value");
//$('.selector').datepicker('option', 'minDate', '12/25/2012');
//alert(tempdata);
//$("#issue_due_date").datepicker({
// minDate: new Date(2014,08,23)
//var datepickerOptions=
//{dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
//alert( $('.issue_due_date').length);
//$('.selector')[1].datepicker('option', 'minDate', new Date(2014, 0 - 8, 23));
//$("#issue_due_date").datepicker(datepickerOptions);
//$("##{issue_due_date}").datepicker(datepickerOptions);
//$("#issue_due_date").datepicker(
// {dateFormat: 'yy-mm-dd',minDate: new Date(2014,08,23), showOn: 'button', buttonImageOnly: true, buttonImage: "path_to_image('/images/calendar.png')", showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true}
//)
//});
}
function PrecentChange(obj){
var _v= obj;
if(_v==100)

View File

@ -34,6 +34,7 @@
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
</div>
</fieldset>
<!--
<fieldset class="collapsible collapsed">
<legend onclick="toggleFieldset(this);">
<%= l(:label_options) %>
@ -55,6 +56,7 @@
</table>
</div>
</fieldset>
-->
<div class="buttons hide-when-print">
<%= link_to_function l(:label_issue_query), 'submit_query_form("query_form")', :class => 'icon icon-checked' %>
<%= link_to l(:label_issue_cancel_query), {:set_filter => 1, :project_id => @project}, :class => 'icon icon-reload' %>

View File

@ -4,7 +4,9 @@
<%= render :partial => 'action_menu' %>
<h3><%= issue_heading(@issue) %></h3>
<h3>
<%= issue_heading(@issue) %>
</h3>
<style type="text/css"></style>
@ -25,9 +27,9 @@
</div>
<% end %>
<!-- <%= avatar(@issue.author, :size => "50") %> -->
<!-- <%#= avatar(@issue.author, :size => "50") %> -->
<div class="subject">
<div class="subject" style="word-wrap: break-word;">
<%= render_issue_subject_with_tree(@issue) %>
</div>

View File

@ -10,11 +10,12 @@
</ul>
</div>
<% end %>
<div class="actions" style="style="max-width:680px"">
<div class="actions" style="max-width:680px">
<p><%= f.text_field :subject, :required => true, :size => 95 %></p>
<p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor01' %></p>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script>
<br/>
<p>
<%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>

View File

@ -48,7 +48,7 @@
<div class="memo-title <%= @memo.sticky ? 'sticky' : '' %> <%= @memo.locked? ? 'locked' : '' %>"><%= label_tag l(:field_subject) %>: <%=h @memo.subject %></div>
<div class="memo-content">
<%=h sanitize(@memo.content.html_safe) %>
<%= textAreailizable(@memo,:content) %>
<p>
<% if @memo.attachments.any?%>
<% options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %>

View File

@ -161,7 +161,8 @@
<td class="comments">
<div class="wiki">
<%= textilizable message, :content, :attachments => message.attachments %>
<%= textAreailizable message,:content,:attachments => message.attachments %>
<%#= message.content.html_safe %>
</div>
<%= link_to_attachments message, :author => false %> </td>
</tr>

View File

@ -23,8 +23,8 @@
<% else%>
<%= content_tag "div", content_tag("p", rolesToLanguage(member.roles.sort.collect(&:to_s)).join(', ')), :class => "clear avatar_name" %>
<div class="clear avatar_user">
<p>
<%= l(:label_user_for_project_grade) %>: <span style="color:#ec6300"><%= format("%.2f" ,UserGrade.find_by_user_id_and_project_id(member[:user_id], @project.id).grade).to_i %></span>
<p> <!--user_scores(member.user,2,@project).total_score).to_i UserGrade.find_by_user_id_and_project_id(member[:user_id], @project.id).grade).to_i-->
<%= l(:label_user_for_project_grade) %>: <span style="color:#ec6300"><%= format("%.2f" ,user_scores(member.user,2,@project).total_score).to_i %></span>
</p>
</div>
<% end %>

View File

@ -128,7 +128,7 @@
<% if @project.project_type !=1 %>
<%= l(:label_project_grade)%>:
<span >
<%= link_to(format("%.2f" , project_scores(@project) ).to_i,
<%= link_to(format("%.2f" , red_project_scores(@project) ).to_i,
{:controller => 'projects',
:action => 'show_projects_score',
:remote => true, :id => @project.id}, :style=>"color: #EC6300;") %>

View File

@ -1,7 +1,8 @@
<% if @events_by_day.size >0 %>
<div class="content-title-top-avtive">
<p class="subtitle">
<%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %>
<% # 暂时隐藏时间的显示%>
<%#= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %>
</p>
<% @events_by_day.keys.sort.reverse.each do |day| %>

View File

@ -4,5 +4,5 @@
&nbsp;&nbsp;
<%= submit_tag l(:label_search), :class => "enterprise"%>
<% end %>
<div class='font_lighter' style="display: inline-block; margin-top:3px;">全站文件搜索。不会搜索私有项目中的内容、学生已经提交的作业。</div>
<div class='font_lighter' style="display: inline-block; margin-top:3px;">全站文件搜索。不会搜索私有项目中的内容。</div>
</div>

View File

@ -94,6 +94,14 @@
:taggable_id => obj.id, :taggable_type => object_flag %> </span>
<% end %>
<% end %>
<!--添加的删除标签0814添加 -->
<!--<%# if obj.author_id == User.current.id %>
<span class='del'> <%#= link_to 'x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,
:taggable_id => obj.id, :taggable_type => object_flag %> </span>
<%# end %>
-->
</span>
</div>

View File

@ -1,8 +1,9 @@
<div>技术得分:</div>
<div>&nbsp;&nbsp;&nbsp; 踩别人的帖子 -2</div>
<div>&nbsp;&nbsp;&nbsp; 帖子被一级会员顶 +4</div>
<div>&nbsp;&nbsp;&nbsp; 帖子被二级会员顶 +6</div>
<div>&nbsp;&nbsp;&nbsp; 帖子被三级会员顶 +8</div>
<div>&nbsp;&nbsp;&nbsp; 帖子被一级会员踩 -2</div>
<div>&nbsp;&nbsp;&nbsp; 帖子被二级会员踩 -4</div>
<div>&nbsp;&nbsp;&nbsp; 帖子被三级会员踩 -6</div>
<div>&nbsp;&nbsp;&nbsp; 踩别人的帖子数量 * (-2) = <%= option_num.tread %> * (-2) = <%= option_num.tread * (-2) %></div>
<div>&nbsp;&nbsp;&nbsp; 帖子被一级会员顶的次数 * 4 = <%= option_num.praise_by_one %> * 4 = <%= option_num.praise_by_one * 4 %></div>
<div>&nbsp;&nbsp;&nbsp; 帖子被二级会员顶的次数 * 6 = <%= option_num.praise_by_two %> * 6 = <%= option_num.praise_by_two * 6 %></div>
<div>&nbsp;&nbsp;&nbsp; 帖子被三级会员顶的次数 * 8 = <%= option_num.praise_by_three %> * 8 = <%= option_num.praise_by_three * 8 %></div>
<div>&nbsp;&nbsp;&nbsp; 帖子被一级会员踩的次数 * (-2) = <%= option_num.tread_by_one %> * (-2) = <%= option_num.tread_by_one * (-2) %></div>
<div>&nbsp;&nbsp;&nbsp; 帖子被二级会员踩的次数 * (-4) = <%= option_num.tread_by_two %> * (-4) = <%= option_num.tread_by_two * (-4) %></div>
<div>&nbsp;&nbsp;&nbsp; 帖子被三级会员踩的次数 * (-6) = <%= option_num.tread_by_three %> * (-6) = <%= option_num.tread_by_three * (-6) %></div>
<div>&nbsp;&nbsp;&nbsp; 技术得分 = <%= option_num.tread * (-2) %> + <%= option_num.praise_by_one * 4 %> + <%= option_num.praise_by_two * 6 %> + <%= option_num.praise_by_three * 8 %> + (<%= option_num.tread_by_one * (-2) %>) + ( <%= option_num.tread_by_two * (-4) %>) + (<%= option_num.tread_by_three * (-6) %>) = <%= skill(option_num) %> </div>

View File

@ -1,6 +1,7 @@
<div>项目贡献得分:</div>
<div>&nbsp;&nbsp;&nbsp; 提交代码 +4</div>
<div>&nbsp;&nbsp;&nbsp; 提交文档 +4</div>
<div>&nbsp;&nbsp;&nbsp; 提交附件 +4</div>
<div>&nbsp;&nbsp;&nbsp; 更新缺陷完成度 +2</div>
<div>&nbsp;&nbsp;&nbsp; 发布缺陷 +4</div>
<div>&nbsp;&nbsp;&nbsp; 提交代码次数 * 4 = <%= option_num.changeset %> * 4 = <%= option_num.changeset * 4 %></div>
<div>&nbsp;&nbsp;&nbsp; 提交文档次数 * 4 = <%= option_num.document %> * 4 = <%= option_num.document * 4 %></div>
<div>&nbsp;&nbsp;&nbsp; 提交附件次数 * 4 = <%= option_num.attachment %> * 4 = <%= option_num.attachment * 4 %></div>
<div>&nbsp;&nbsp;&nbsp; 更新缺陷完成度次数 * 2 = <%= option_num.issue_done_ratio %> * 2 = <%= option_num.issue_done_ratio * 2 %></div>
<div>&nbsp;&nbsp;&nbsp; 发布缺陷数量 * 4 = <%= option_num.post_issue %> * 4 = <%= option_num.post_issue * 4 %></div>
<div>&nbsp;&nbsp;&nbsp; 项目贡献得分 = <%= option_num.changeset * 4 %> + <%= option_num.document * 4 %> + <%= option_num.attachment * 4 %> + <%= option_num.issue_done_ratio * 2 %> + <%= option_num.post_issue * 4 %> = <%= active(option_num) %> </div>

View File

@ -1,4 +1,4 @@
<% roles = Role.find_all_givable %>
<% roles = Role.find_all_givable[0..2] %>
<% projects = Project.active.all %>
<div class="splitcontentleft">
@ -50,12 +50,19 @@
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
</div>
<script type="text/javascript">
window.onready = function()
{
$("#membership_project_id").css("width","150px");
$("#membership_project_id").css("overflow ","hidden");
}
</script>
<div class="splitcontentright">
<% if projects.any? %>
<fieldset><legend><%=l(:label_project_new)%></legend>
<fieldset style="width: 170px;"><legend><%=l(:label_project_new)%></legend>
<%= form_for(:membership, :remote => true, :url => user_memberships_path(@user)) do %>
<%= select_tag 'membership[project_id]', options_for_membership_project_select(@user, projects) %>
<div style="width:100px;"><%= select_tag 'membership[project_id]', options_for_membership_project_select(@user, projects)%></div>
<p><%= l(:label_role_plural) %>:
<% roles.each do |role| %>
<label><%= check_box_tag 'membership[role_ids][]', role.id %> <%=h role %></label>

View File

@ -1,2 +1,3 @@
<div>影响力得分:</div>
<div>&nbsp;&nbsp;&nbsp; 被关注人数 +2/人</div>
<div>&nbsp;&nbsp;&nbsp; 被关注人数 * 2 = <%= option_num.follow %> * 2 = <%= option_num.follow * 2 %></div>
<div>&nbsp;&nbsp;&nbsp; 影响力得分 = <%= option_num.follow * 2 %></div>

View File

@ -1,34 +1,10 @@
<!-- added by bai -->
<%# messages_count = @user.messages.count %>
<%# messages_score = messages_count * 0.05%>
<%# finall_messages_score = messages_score %>
<%# journals_count = @user.journals.count %>
<%# journals_score = journals_count * 0.1 %>
<%# user_changesets_count = @user.changesets.count %>
<%# user_changesets_score = user_changesets_count * 0.3 %>
<%# finall_user_project_score = journals_score + user_changesets_score %>
<%# journals_for_messages_count = @user.journals_messages.count %>
<%# activities_count = @user.activities.count %>
<%# journals_for_messages_score = journals_for_messages_count * 0.05 %>
<%# activities_score = activities_count * 0.2 %>
<%# finall_activity_score = journals_for_messages_score + activities_score %>
<%# news_count = @user.news.count %>
<%# news_score = news_count * 0.1 %>
<%# wiki_contents_count = @user.wiki_contents.count %>
<%# wiki_contents_score = wiki_contents_count * 0.1 %>
<%# comments_count = @user.comments.count %>
<%# comments_score = comments_count * 0.1 %>
<%# finall_influence_score = news_score + wiki_contents_score + comments_score %>
<%# finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %>
<div><%= l(:label_user_score) %></div>
<div> = <%= l(:label_user_score_of_collaboration) %> + <%= l(:label_user_score_of_influence) %> +
<%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %></div>
<!-- <div>&nbsp;&nbsp;&nbsp;+ <%#= l(:label_user_score_of_influence) %></div> -->
<div> = <%= format("%.2f" ,@user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_i %> + <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence ).to_i %>
+ <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_i %> + <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_i %></div>
<div> = <%= format("%.2f" ,@user.user_score_attr.total_score.nil? ? 0:@user.user_score_attr.total_score).to_i %></div>
<div> = <%= format("%.2f" ,collaboration(option_num)).to_i %> + <%= format("%.2f" , influence(option_num) ).to_i %>
+ <%= "(" if skill(option_num) < 0 %> <%= format("%.2f" , skill(option_num)).to_i %> <%= ")" if skill(option_num) < 0 %> + <%= format("%.2f" , active(option_num)).to_i %></div>
<div> = <%= format("%.2f" ,option_num.total_score).to_i %></div>
<!-- end -->

View File

@ -1,28 +1,4 @@
<!-- added by bai -->
<%# messages_count = @user.messages.count %>
<%# messages_score = messages_count * 0.05%>
<%# finall_messages_score = messages_score %>
<%# journals_count = @user.journals.count %>
<%# journals_score = journals_count * 0.1 %>
<%# user_changesets_count = @user.changesets.count %>
<%# user_changesets_score = user_changesets_count * 0.3 %>
<%# finall_user_project_score = journals_score + user_changesets_score %>
<%# journals_for_messages_count = @user.journals_messages.count %>
<%# activities_count = @user.activities.count %>
<%# journals_for_messages_score = journals_for_messages_count * 0.05 %>
<%# activities_score = activities_count * 0.2 %>
<%# finall_activity_score = journals_for_messages_score + activities_score %>
<%# news_count = @user.news.count %>
<%# news_score = news_count * 0.1 %>
<%# wiki_contents_count = @user.wiki_contents.count %>
<%# wiki_contents_score = wiki_contents_count * 0.1 %>
<%# comments_count = @user.comments.count %>
<%# comments_score = comments_count * 0.1 %>
<%# finall_influence_score = news_score + wiki_contents_score + comments_score %>
<%# finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %>
<h3 class="title"><%= l(:label_user_score) %></h3>
<div class="inf_user_image">
@ -37,8 +13,9 @@
</td>
<td>
<table>
<tr class="info_font"><td><%= l(:label_user_score) %></td></tr>
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , @user.user_score_attr.total_score).to_i %></span></td></tr>
<tr class="info_font"><td><%= l(:label_user_score) %></td></tr> <!--@user.user_score_attr.total_score -->
<% option_num = get_option_number(@user,1) %>
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , option_num.total_score).to_i %></span></td></tr>
</table>
</td>
</tr>
@ -46,31 +23,57 @@
</table>
<table style="border-bottom: solid 0px #80a6d2;" width="100%">
<tr>
<%= link_to l(:label_user_score) , {:controller => 'users', :action => 'score_new_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.total_score).to_i %>
</tr><br>
<tr>
<%= link_to l(:label_user_score_of_collaboration), {:controller => 'users',:action => 'topic_new_score_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_i %>
</tr><br>
<tr>
<%= link_to l(:label_user_score_of_influence), {:controller => 'users',:action => 'project_new_score_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_i %>
</tr><br>
<tr>
<%= link_to l(:label_user_score_of_skill), {:controller => 'users',:action => 'activity_new_score_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_i %>
</tr><br>
<tr>
<%= link_to l(:label_user_score_of_active), {:controller => 'users',:action => 'influence_new_score_index', :remote => true} %>
<%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_i %>
</tr><br>
</table>
<script type="text/javascript">
function show_div(url)
{
if(url == 'topic_new_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/topic_new_score_index', :locals => {:index =>0,:option_num => option_num}) %>');
}
else if(url == 'score_new_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/score_new_index', :locals => {:index =>0,:option_num => option_num}) %>');
}
else if(url == 'project_new_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/project_new_score_index', :locals => {:index =>0,:option_num => option_num}) %>');
}
else if(url == 'activity_new_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/activity_new_score_index', :locals => {:index =>0,:option_num => option_num}) %>');
}
else if(url == 'influence_new_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'users/influence_new_score_index', :locals => {:index =>0,:option_num => option_num}) %>');
}
}
</script>
<ul style="border-bottom: solid 0px #80a6d2;" width="100%">
<li> <!-- {:controller => 'users', :action => 'score_new_index', :remote => true} -->
<%= link_to l(:label_user_score) ,"javascript:void(0)", :onclick => "show_div('score_new_index')" %> :
<%= format("%.2f" , option_num.total_score).to_i %>
</li>
<li> <!-- {:controller => 'users',:action => 'topic_new_score_index', :remote => true,:option_num => option_num} -->
<%= link_to l(:label_user_score_of_collaboration), "javascript:void(0)", :onclick => "show_div('topic_new_score_index')" %> :
<%= format("%.2f" , collaboration(option_num)).to_i %>
</li>
<li>
<%= link_to l(:label_user_score_of_influence),"javascript:void(0)", :onclick => "show_div('project_new_score_index')" %> :
<%= format("%.2f" , influence(option_num)).to_i %>
</li>
<li>
<%= link_to l(:label_user_score_of_skill),"javascript:void(0)", :onclick => "show_div('activity_new_score_index')" %> :
<%= format("%.2f" , skill(option_num)).to_i %>
</li>
<li>
<%= link_to l(:label_user_score_of_active), "javascript:void(0)", :onclick => "show_div('influence_new_score_index')" %>
<%= format("%.2f" , active(option_num)).to_i %>
</li>
</ul>
</div>
<div id="show_score_detail" style="padding-left: 6px">
<%= render :partial => 'users/score_new_index', :locals => {:index => 0 } %>
<%= render :partial => 'users/score_new_index', :locals => {:index => 0,:option_num => option_num } %>
</div>

View File

@ -1,6 +1,7 @@
<div>协同得分:</div>
<div>&nbsp;&nbsp;&nbsp; 发帖 +2</div>
<div>&nbsp;&nbsp;&nbsp; 对缺陷留言 +1</div>
<div>&nbsp;&nbsp;&nbsp; 更改一次缺陷状态 +1</div>
<div>&nbsp;&nbsp;&nbsp; 对留言的回复 +1</div>
<div>&nbsp;&nbsp;&nbsp; 对帖子的回复 +1</div>
<div>&nbsp;&nbsp;&nbsp; 发帖数量 * 2 = <%= option_num.memo %> * 2 = <%= option_num.memo * 2 %></div>
<div>&nbsp;&nbsp;&nbsp; 对缺陷留言数量 * 1 = <%= option_num.messages_for_issues %> * 1 = <%= option_num.messages_for_issues * 1 %></div>
<div>&nbsp;&nbsp;&nbsp; 更改缺陷状态次数 * 1 = <%= option_num.issues_status %> * 1= <%= option_num.issues_status * 1 %></div>
<div>&nbsp;&nbsp;&nbsp; 对留言的回复数量 * 1 = <%= option_num.replay_for_message %> * 1 = <%= option_num.replay_for_message * 1 %></div>
<div>&nbsp;&nbsp;&nbsp; 对帖子的回复数量 * 1 = <%= option_num.replay_for_memo %> * 1 = <%= option_num.replay_for_memo * 1 %></div>
<div>&nbsp;&nbsp;&nbsp; 协同得分 = <%= option_num.memo * 2 %> + <%= option_num.messages_for_issues * 1 %> + <%= option_num.issues_status * 1 %> + <%= option_num.replay_for_message * 1 %> + <%= option_num.replay_for_memo * 1 %> = <%= collaboration(option_num) %>  </div>

View File

@ -1,6 +1,7 @@
<%= l(:label_user_grade)%>:
<!-- user.user_score_attr.total_score -->
<%= link_to(format("%.2f" ,user_scores(user,1).total_score ).to_i, {:controller => 'users',
<!-- user_scores(user,1).total_score -->
<%= link_to(format("%.2f" ,get_option_number(user,1).total_score ).to_i, {:controller => 'users',
:action => 'show_new_score',
:remote => true,
:id => user.id

View File

@ -1,28 +1,5 @@
<!-- added by bai -->
<% messages_count = @user.messages.count %>
<% messages_score = messages_count * 0.05%>
<% finall_messages_score = messages_score %>
<% journals_count = @user.journals.count %>
<% journals_score = journals_count * 0.1 %>
<% user_changesets_count = @user.changesets.count %>
<% user_changesets_score = user_changesets_count * 0.3 %>
<% finall_user_project_score = journals_score + user_changesets_score %>
<% journals_for_messages_count = @user.journals_messages.count %>
<% activities_count = @user.activities.count %>
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
<% activities_score = activities_count * 0.2 %>
<% finall_activity_score = journals_for_messages_score + activities_score %>
<% news_count = @user.news.count %>
<% news_score = news_count * 0.1 %>
<% wiki_contents_count = @user.wiki_contents.count %>
<% wiki_contents_score = wiki_contents_count * 0.1 %>
<% comments_count = @user.comments.count %>
<% comments_score = comments_count * 0.1 %>
<% finall_influence_score = news_score + wiki_contents_score + comments_score %>
<% finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %>
<head>
<meta charset="utf-8" />
<title><%= h html_title %></title>
@ -52,8 +29,8 @@
</td>
<td>
<table>
<tr class="info_font"><td><%= l(:label_user_score) %></td></tr>
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , @user.user_score_attr.total_score).to_i %></span></td></tr>
<tr class="info_font"><td><%= l(:label_user_score) %></td></tr> <!-- @user.user_score_attr.total_score).to_i-->
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , get_option_number(@user,1).total_score).to_i %></span></td></tr>
</table>
</td>
</tr>

View File

@ -4,5 +4,5 @@
&nbsp;&nbsp;
<%= submit_tag l(:label_search), :class => "enterprise"%>
<% end %>
<div class='font_lighter' style="margin: 0; padding: 0; margin-top: 4px;">全站文件搜索。不会搜索私有项目中的内容和学生已经提交的作业。</div>
<div class='font_lighter' style="margin: 0; padding: 0; margin-top: 4px;">全站文件搜索。不会搜索私有项目中的内容。</div>
</div>

View File

@ -1,4 +1,5 @@
<div class="wiki wiki-page">
<%= textilizable content, :text, :attachments => content.page.attachments,
<%= textAreailizable content, :text, :attachments => content.page.attachments,
:edit_section_links => (@sections_editable && {:controller => 'wiki', :action => 'edit', :project_id => @page.project, :id => @page.title}) %>
<%#= content.text.html_safe %>
</div>

View File

@ -1,5 +1,6 @@
<%= wiki_page_breadcrumb(@page) %>
<script src="/javascripts/ckeditor/ckeditor.js?1404953555" type="text/javascript"></script>
<h3><%= h @page.pretty_title %></h3>
<%= form_for @content, :as => :content,
@ -12,8 +13,15 @@
<% end %>
<%= error_messages_for 'content' %>
<div class="actions" style="max-width:680px">
<p style="max-width:680px;"><%=text_area_tag 'content[text]', @text, :required => true, :id => 'editor02', :cols => 100, :rows => 25 %></p>
<script type="text/javascript">
var ckeditor=CKEDITOR.replace('editor02',{height: '300'});
</script>
</div>
<div class="box tabular">
<%= text_area_tag 'content[text]', @text, :cols => 100, :rows => 25,
<%#= text_area_tag 'content[text]', @text, :cols => 100, :rows => 25,
:class => 'wiki-edit', :accesskey => accesskey(:edit) %>
<!--p style="max-width:680px"><input id="editor02" required="true" /><%#= f.text_area :comments, :required => true, :id => 'editor02' %></p>
@ -31,7 +39,7 @@
<% end %>
<% end %>
<p><label><%= l(:field_comments) %></label><%= f.text_field :comments, :size => 120 %></p>
<p style="width: 100%;"><label><%= l(:field_comments) %></label><%= f.text_field :comments, :style => "width:75%;" %></p>
<p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
</div>

View File

@ -1039,7 +1039,7 @@ zh:
button_ok_and_submit: 确定并提交
button_apply: 查询
button_clear: 清除留言
button_clear: 取消查询
button_clear_requirement: 取消
button_lock: 锁定
button_unlock: 解锁
@ -1334,7 +1334,7 @@ zh:
label_gantt_progress_line: Progress line
setting_jsonp_enabled: Enable JSONP support
field_inherit_members: Inherit members
field_closed_on: Closed
field_closed_on: 已关闭
setting_default_projects_tracker_ids: Default trackers for new projects
label_total_time: 合计
label_create_time: 创建时间 #Customer addedAdded by nie
@ -1415,6 +1415,7 @@ zh:
#fq
button_leave_meassge: 留言
button_clear_meassge: 清除留言
label_leave_message_to: 给用户 %{name}留言
label_leave_message: 留言内容
label_message: 留言板
@ -1977,7 +1978,7 @@ zh:
label_upload_softapplication_packets: 上传应用软件包
label_upload_softapplication_photo: 上传产品截图
label_upload_softapplication_packets_mustpacketed: 作品相关代码及相关说明文件必须打包后以压缩包的形式上传,便于上传和下载
label_upload_softapplication_photo_condition: 作品截图最好0~4张(多余图片不会再展示页面上显示)格式为gif/jpg/png 每张小于5M
label_upload_softapplication_photo_condition: 作品截图最好0~4张(多余图片不会在展示页面上显示)格式为gif/jpg/png/bmp等 每张小于5M
label_updated_caution: 注意:若编辑参赛作品,则之前上传的软件包和截图都将被删除,请重新上传!
label_softapplication_name: 应用名称
label_work_name: 作品名称
@ -2105,3 +2106,10 @@ zh:
lable_school_no_course: 该学校未开设任何课程,您可以查看其他学校课程
lable_school_less_course: 该学校开设课程较少,您可以查看其他学校课程
lable_file_not_found: 对不起,该文件现在不能下载!
lable_goto_homepage: 返回主页
lable_trustie_team: Trustie开发团队
lable_memos_max_length: 帖子内容最大长度为65535个字符
lable_forums_max_length: 贴吧描述最大长度为65535个字符

View File

@ -0,0 +1,10 @@
class CreateProjectScores < ActiveRecord::Migration
def change
create_table :project_scores do |t|
t.string :project_id
t.integer :score
t.timestamps
end
end
end

View File

@ -0,0 +1,20 @@
class CreateCourseAttachments < ActiveRecord::Migration
def change
create_table :course_attachments do |t|
t.string :filename
t.string :disk_filename
t.integer :filesize
t.string :content_type
t.string :digest
t.integer :downloads
t.string :author_id
t.string :integer
t.string :description
t.string :disk_directory
t.integer :attachtype
t.integer :is_public
t.timestamps
end
end
end

View File

@ -0,0 +1,5 @@
class AddColunToCourseAttachments < ActiveRecord::Migration
def change
add_column :course_attachments, :container_id, :integer, :default => 0
end
end

View File

@ -0,0 +1,29 @@
class UpdateCourseAttachments < ActiveRecord::Migration
def up
attachments = Attachment.where(" container_type = 'Course'")
attachments.each do |attachment|
course_attachment = CourseAttachment.new
course_attachment.container_id = attachment.container_id
course_attachment.filename = attachment.filename
course_attachment.disk_filename = attachment.disk_filename
course_attachment.filesize = attachment.filesize
course_attachment.content_type = attachment.content_type
course_attachment.digest = attachment.digest
course_attachment.downloads = attachment.downloads
course_attachment.author_id = attachment.author_id
course_attachment.created_at = attachment.created_on
course_attachment.description = attachment.description
course_attachment.disk_directory = attachment.disk_directory
course_attachment.attachtype = attachment.attachtype
course_attachment.is_public = attachment.is_public
course_attachment.save(:validate => false)
end
end
def down
coll = CourseAttachment.all
coll.each do |model|
model.destroy
end
end
end

View File

@ -0,0 +1,9 @@
class ChangeForumDescription < ActiveRecord::Migration
def up
change_column :forums, :description, :text, default: nil
end
def down
change_column :forums, :description, :string, default: ''
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140801034242) do
ActiveRecord::Schema.define(:version => 20140814062455) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -291,6 +291,24 @@ ActiveRecord::Schema.define(:version => 20140801034242) do
t.datetime "updated_on", :null => false
end
create_table "course_attachments", :force => true do |t|
t.string "filename"
t.string "disk_filename"
t.integer "filesize"
t.string "content_type"
t.string "digest"
t.integer "downloads"
t.string "author_id"
t.string "integer"
t.string "description"
t.string "disk_directory"
t.integer "attachtype"
t.integer "is_public"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "container_id", :default => 0
end
create_table "course_infos", :force => true do |t|
t.integer "course_id"
t.integer "user_id"
@ -423,21 +441,21 @@ ActiveRecord::Schema.define(:version => 20140801034242) do
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "sort_type"
t.integer "image_width", :default => 107
t.integer "image_height", :default => 63
t.integer "show_course", :default => 1
t.integer "show_contest", :default => 1
t.integer "image_width", :default => 107
t.integer "image_height", :default => 63
end
create_table "forums", :force => true do |t|
t.string "name", :null => false
t.string "description", :default => ""
t.string "name", :null => false
t.text "description"
t.integer "topic_count", :default => 0
t.integer "memo_count", :default => 0
t.integer "last_memo_id", :default => 0
t.integer "creator_id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "creator_id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "groups_users", :id => false, :force => true do |t|
@ -772,6 +790,13 @@ ActiveRecord::Schema.define(:version => 20140801034242) do
t.datetime "updated_at", :null => false
end
create_table "project_scores", :force => true do |t|
t.string "project_id"
t.integer "score"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "project_statuses", :force => true do |t|
t.integer "changesets_count"
t.integer "watchers_count"
@ -882,6 +907,19 @@ ActiveRecord::Schema.define(:version => 20140801034242) do
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
create_table "rich_rich_files", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "rich_file_file_name"
t.string "rich_file_content_type"
t.integer "rich_file_file_size"
t.datetime "rich_file_updated_at"
t.string "owner_type"
t.integer "owner_id"
t.text "uri_cache"
t.string "simplified_type", :default => "file"
end
create_table "roles", :force => true do |t|
t.string "name", :limit => 30, :default => "", :null => false
t.integer "position", :default => 1

View File

@ -1,6 +1,7 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>File not found</title>
<style>
body{
@ -24,17 +25,18 @@
</head>
<body>
<div class="container" >
<h1>Sorry, this file can not be downloaded now. </h1>
<h3> <a href="http://forge.trustie.net" style="">Goto Home page</a> </h3>
<!--<h1>Sorry, this file can not be downloaded now. </h1>-->
<h1>对不起,该文件现在不能下载!</h1>
<h3> <a href="http://forge.trustie.net" style="">返回主页</a> </h3>
<div class="container" style="">
<div style="position: relative; right:0;text-align: right;">
<h4>Trustie Team.</h4>
<div class="container" style="">
<div style="position: relative; right:0;text-align: right;">
<h4>Trustie开发团队.</h4>
</div>
</div>
<p class="hidden" >
<a href="javascript:history.back()">Back</a>
</p>
</div>
<p class="hidden" >
<a href="javascript:history.back()">Back</a>
</p>
</div>
</body>
</html>
</body>
</html>

View File

@ -0,0 +1,42 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>File not found</title>
<style>
body{
font-family: Trebuchet MS,Georgia,"Times New Roman",serif;
color:#303030;
}
div.container{
margin: 0 auto;
width: 80%;
}
h1{
font-size:1.5em;
}
p{
font-size:0.8em;
}
.hidden{
display: none;
}
</style>
</head>
<body>
<div class="container" >
<!--<h1>Sorry, this file can not be downloaded now. </h1>-->
<h1><%= l(:lable_file_not_found) %></h1>
<h3> <a href="http://forge.trustie.net" style=""><%= l(:lable_goto_homepage) %></a> </h3>
<div class="container" style="">
<div style="position: relative; right:0;text-align: right;">
<h4><%= l(:lable_trustie_team) %></h4>
</div>
</div>
<p class="hidden" >
<a href="javascript:history.back()">Back</a>
</p>
</div>
</body>
</html>

9
test/fixtures/project_scores.yml vendored Normal file
View File

@ -0,0 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
project_id: MyString
score: 1
two:
project_id: MyString
score: 1

View File

@ -0,0 +1,7 @@
require 'test_helper'
class ProjectScoreTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end