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

@ -32,7 +32,7 @@ module ApplicationHelper
extend Forwardable
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
#Added by young
#Define the course menu's link class
# 不是数组的转化成数组然后判断当前menu_item是否在给定的列表
@ -53,10 +53,10 @@ module ApplicationHelper
def authorize_for_course(controller, action)
User.current.allowed_to?({:controller => controller, :action => action}, @course)
end
def authorize_for_contest(controller, action)
User.current.allowed_to?({:controller => controller, :action => action}, @contest)
end
end
# Display a link if user is authorized
#
@ -309,7 +309,7 @@ module ApplicationHelper
s << h(block_given? ? yield(project) : project.name)
else
end
if project.try(:project_type) == Project::ProjectType_project
unless User.current.member_of?(@project)
s << "<span style = 'float: right;'>"
@ -382,7 +382,7 @@ module ApplicationHelper
s << "</ul></li>\n"
end
end
classes = (ancestors.empty? ? 'root' : 'child')
classes = (ancestors.empty? ? 'root' : 'child')
s << h(block_given? ? yield(project) : project.name)
ancestors << project
end
@ -545,11 +545,11 @@ module ApplicationHelper
def authoring(created, author, options={})
l(options[:label] || :label_added_time_by, :author => link_to_user(author), :age => time_tag(created)).html_safe
end
def added_time(created)
l(:label_added_time, :age => time_tag(created)).html_safe
end
def user_url_and_time(user_name, user_url, created)
unless user_name.nil? || user_name == ''
l(:label_added_time_by, :author => link_to(user_name, user_url), :age => time_tag(created)).html_safe
@ -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 = []
@ -809,7 +851,7 @@ module ApplicationHelper
else
wiki_page_id = page.present? ? Wiki.titleize(page) : nil
parent = wiki_page.nil? && obj.is_a?(WikiContent) && obj.page && project == link_project ? obj.page.title : nil
url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project,
url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project,
:id => wiki_page_id, :version => nil, :anchor => anchor, :parent => parent)
end
end
@ -823,7 +865,7 @@ module ApplicationHelper
end
end
end
def select_option_helper option
tmp = Hash.new
tmp={"" => ""}
@ -1135,7 +1177,7 @@ module ApplicationHelper
end
def lang_options_for_select(blank=true)
{ 'Chinese简体中文 '=> 'zh', :English => :en}
{ 'Chinese简体中文 '=> 'zh', :English => :en}
end
def label_tag_for(name, option_tags = nil, options = {})
@ -1198,7 +1240,7 @@ module ApplicationHelper
end
end
html.html_safe
end
end
def delete_link(url, options={})
options = {
@ -1212,8 +1254,8 @@ module ApplicationHelper
def preview_link(url, form, target='preview', options={})
content_tag 'a', l(:label_preview), {
:href => "#",
:onclick => %|submitPreview("#{escape_javascript url_for(url)}", "#{escape_javascript form}", "#{escape_javascript target}"); return false;|,
:href => "#",
:onclick => %|submitPreview("#{escape_javascript url_for(url)}", "#{escape_javascript form}", "#{escape_javascript target}"); return false;|,
:accesskey => accesskey(:preview)
}.merge(options)
end
@ -1300,13 +1342,13 @@ module ApplicationHelper
start_of_week = start_of_week.to_i % 7
tags = javascript_tag(
"var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: #{start_of_week}, " +
"showOn: 'button', buttonImageOnly: true, buttonImage: '" +
"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")
tags << javascript_include_tag("i18n/jquery.ui.datepicker-#{jquery_locale}.js")
end
tags
end
@ -1474,14 +1516,14 @@ module ApplicationHelper
options
end
end
# Add by Tao
def url_to_avatar(source)
source = nil if source.kind_of?(String)
get_avatar(source)
end
# Endof Tao's code
def date_format_local(time)
date = time.strftime("%Y年%m月%d日")
end
@ -1497,7 +1539,7 @@ module ApplicationHelper
def link_to_content_update(text, url_params = {}, html_options = {})
link_to(text, url_params, html_options)
end
#added by nie
# Display watcher picture
def show_more_watchers?(obj)
@ -1507,7 +1549,7 @@ module ApplicationHelper
return false
end
end
def show_watcher_profile(obj)
count = 0
html = ''
@ -1532,7 +1574,7 @@ module ApplicationHelper
return false
end
end
def show_bid_project(bid)
html = ''
if bid.projects.where('is_public = 1').count == 0
@ -1544,15 +1586,15 @@ module ApplicationHelper
end
html.html_safe
end
def show_bid_fans_picture(obj)
html = ''
if obj.watcher_users.count == 0
html << (content_tag "span", l(:label_project_no_follow))
else
obj.watcher_users.take(12).each do |user|
obj.watcher_users.take(12).each do |user|
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name)
end
end
end
html.html_safe
end
@ -1573,7 +1615,7 @@ module ApplicationHelper
return false
end
end
def show_contest_project(bid)
html = ''
if contest.projects.where('is_public = 1').count == 0
@ -1585,7 +1627,7 @@ module ApplicationHelper
end
html.html_safe
end
def show_contest_project(contest)
html = ''
if contest.projects.where('is_public = 1').count == 0
@ -1597,7 +1639,7 @@ module ApplicationHelper
end
html.html_safe
end
def show_contest_softapplication(contest)
html = ''
if contest.softapplications.where('is_public = 1').count == 0
@ -1609,19 +1651,19 @@ module ApplicationHelper
end
html.html_safe
end
def show_contest_fans_picture(obj)
html = ''
if obj.watcher_users.count == 0
html << (content_tag "span", l(:label_project_no_follow))
else
obj.watcher_users.take(12).each do |user|
obj.watcher_users.take(12).each do |user|
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name)
end
end
end
html.html_safe
end
end
#display fans picture
def show_more_fans?(obj)
if obj.watcher_users.count > 12
@ -1630,20 +1672,20 @@ module ApplicationHelper
return false
end
end
def show_fans_picture(obj)
html = ''
if obj.watcher_users.count == 0
html << (content_tag "span", l(:label_no_current_fans))
else
obj.watcher_users.take(12).each do |user|
obj.watcher_users.take(12).each do |user|
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => user.name)
end
end
end
html.html_safe
end
# added by bai
# added by bai
def show_more_participate?(obj)
if obj.join_in_contests.count > 12
return true
@ -1651,7 +1693,7 @@ module ApplicationHelper
return false
end
end
def show_participate_picture(obj)
html = ''
count = 0
@ -1664,10 +1706,10 @@ module ApplicationHelper
if count >= 12
break
end
end
end
html.html_safe
end
end
#end
# add by huang
@ -1682,7 +1724,7 @@ module ApplicationHelper
end
end
html.html_safe
end
end
# end
#added by william
@ -1691,7 +1733,7 @@ module ApplicationHelper
end
#end
def hadcommittedhomework(cur,curb)
bid = Bid.find_by_id(curb)
return true if bid.nil?
@ -1706,7 +1748,7 @@ module ApplicationHelper
else
true
end
end
def render_dynamic_nav
@ -1717,10 +1759,10 @@ module ApplicationHelper
end
def bootstrap_render_dynamic_nav
main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.course_domain}
main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.project_domain}
main_contest_link = link_to l(:label_contest_innovate), {:controller => 'welcome', :action => 'index', :host => Setting.contest_domain}
main_contest_link = link_to l(:label_contest_innovate), {:controller => 'welcome', :action => 'index', :host => Setting.contest_domain}
course_all_course_link = link_to l(:label_course_all), {:controller => 'courses', :action => 'index'}
course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.course_domain}
@ -1732,20 +1774,20 @@ module ApplicationHelper
forum_link = link_to l(:label_project_module_forums), {:controller => "forums", :action => "index"}
stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'}
school_all_school_link = link_to l(:label_school_all), {:controller => 'school', :action => 'index'}
#@nav_dispaly_project_label
nav_list = Array.new
nav_list.push(school_all_school_link) if @nav_dispaly_course_all_label && @show_course == 1
nav_list.push(course_all_course_link) if @nav_dispaly_course_all_label && @show_course == 1
nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_all_label && @show_course == 1
nav_list.push(main_project_link) if @nav_dispaly_main_project_label
nav_list.push(main_course_link) if @nav_dispaly_main_course_label && @show_course == 1
nav_list.push(main_contest_link) if @nav_dispaly_main_contest_label && @show_contest == 1
nav_list.push(courses_link) if @nav_dispaly_course_label && @show_course == 1
nav_list.push(projects_link) if @nav_dispaly_project_label
nav_list.push(users_link) if @nav_dispaly_user_label
@ -1755,7 +1797,7 @@ module ApplicationHelper
nav_list.push(stores_link) if @nav_dispaly_store_all_label
content_li = ''
nav_list.collect do |nav_item|
nav_list.collect do |nav_item|
content_li << content_tag(:li, nav_item)
end
content_li.html_safe
@ -1764,12 +1806,12 @@ module ApplicationHelper
def current_user
User.current
end
# def hadcommittedforcontest(curu)
# message = JournalsForMessage.find_by_sql("select * from journals_for_messages where jour_type = 'Softapplication' ")
# message.each do |createmessage|
# if createmessage.user_id == curu
# return true
# if createmessage.user_id == curu
# return true
# end
# end
# end
@ -1782,11 +1824,12 @@ module ApplicationHelper
logos.push(link_to image_tag('/images/footer_logo/iscas.png', :alt=>"iscas"), "http://www.iscas.ac.cn" )
logos.push(link_to image_tag('/images/footer_logo/inforbus.png', :alt=>"inforbus"), "http://www.inforbus.com" )
logos.collect! { |logo|
logos.collect! { |logo|
content_tag(:li, logo.html_safe, :class => li_class.to_s)
}
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

@ -1,45 +1,45 @@
<div class="contextual">
<%= link_to l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add' %>
</div>
<h3><%=l(:label_project_plural)%></h3>
<%= form_tag({}, :method => :get) do %>
<fieldset><legend><%= l(:label_filter_plural) %></legend>
<label for='status'><%= l(:field_status) %> :</label>
<%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
<label for='name'><%= l(:label_project) %>:</label>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
</fieldset>
<% end %>
&nbsp;
<div class="autoscroll">
<table class="list">
<thead><tr>
<th><%=l(:label_project)%></th>
<th><%=l(:field_is_public)%></th>
<th><%=l(:field_created_on)%></th>
<th></th>
</tr></thead>
<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 align="center"><%= checked_image project.is_public? %></td>
<td align="center"><%= format_date(project.created_on) %></td>
<td class="buttons">
<%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %>
<%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %>
<%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %>
<%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del') %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% html_title(l(:label_project_plural)) -%>
<div class="contextual">
<%= link_to l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add' %>
</div>
<h3><%=l(:label_project_plural)%></h3>
<%= form_tag({}, :method => :get) do %>
<fieldset><legend><%= l(:label_filter_plural) %></legend>
<label for='status'><%= l(:field_status) %> :</label>
<%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
<label for='name'><%= l(:label_project) %>:</label>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
</fieldset>
<% end %>
&nbsp;
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead><tr>
<th><%=l(:label_project)%></th>
<th><%=l(:field_is_public)%></th>
<th><%=l(:field_created_on)%></th>
<th></th>
</tr></thead>
<tbody>
<% project_tree(@projects) do |project, level| %>
<tr class="<%= cycle("odd", "even") %> <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
<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">
<%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %>
<%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %>
<%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %>
<%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del') %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% html_title(l(:label_project_plural)) -%>

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

@ -4,11 +4,11 @@
<span class="body">
<h3><%= link_to(@bid.author.lastname+@bid.author.firstname, user_path(@bid.author))%><%= link_to(@bid.name,respond_path(@bid)) %></h3>
<% if @bid.reward_type.nil? or @bid.reward_type == 1%>
<p>
<p>
<strong><%= l(:label_bids_reward_method) %><span class="bonus"><%= l(:label_call_bonus) %>&nbsp; <%= l(:label_RMB_sign) %><%= @bid.budget %></span></strong>
</p>
<% elsif @bid.reward_type == 2%>
<p>
<p>
<strong><%= l(:label_bids_reward_method) %><span class="bonus"><%= @bid.budget%></span></strong>
</p>
<% else %>

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,12 +10,13 @@
</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>
<p>
<%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
</p>

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

@ -1,5 +1,5 @@
<% if @project %>
<%= render :partial => 'project_show', locals: {project: @project} %>
<% elsif @course %>
<%= render :partial => 'course_show', locals: {course: @course} %>
<% end %>
<% if @project %>
<%= render :partial => 'project_show', locals: {project: @project} %>
<% elsif @course %>
<%= render :partial => 'course_show', locals: {course: @course} %>
<% end %>

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

@ -21,7 +21,7 @@
<% k.each do |c1|%>
<div class="table_row1 <%= cycle 'odd', 'even' %>">
<div class="filename table_cell1 filename1" >
<%= link_to c1.filename, (attachFromUrl c1), {:title => c1.filename, :target => "_blank"} %>
<%= link_to c1.filename, (attachFromUrl c1), {:title => c1.filename, :target => "_blank"} %>
</div>
<div class="table_cell1 filedown1">
<%= c1.downloads %>
@ -32,7 +32,7 @@
</div>
<% end -%>
</div>
</div>
<% end; reset_cycle %>
</div>

View File

@ -43,32 +43,32 @@
<!-- 对用户主页 是本人 ,对项目,需求,问题是管理员 -->
<% case object_flag %>
<% when '1' %>
<% if User.current.eql?(obj) %>
<% if User.current.eql?(obj) %>
<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 %>
<% when '2' %>
<% if (ProjectInfo.find_by_project_id(obj.id)).try(:user_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 %>
<% when '3' %>
<% if (ProjectInfo.find_by_project_id(obj.project_id)).try(:user_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 %>
<% when '4' %>
<% 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 %>
<% when '6' %>
@ -82,10 +82,10 @@
<% end %>
<% when '7' %>
<% 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 %>
<% when '9' %>
@ -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

@ -14,7 +14,7 @@
$('#' + id).val('');
}
}
$(function(){
$("#main").find("a").attr("target", "_blank");
setCss();
@ -118,23 +118,23 @@
<div id="identifier-pannel" style="display:none">
<%= image_tag '/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" %>
<div class="weixin-content"><%=l(:label_weixin)%></div>
</div>
</div>
<div class="main-content-bar" id="main-content-bar">
<!--文字-->
<!--文字-->
<div style="float: left;padding-left:15px;">
<% if get_avatar?(@contest_page) %>
<%= image_tag(url_to_avatar(@contest_page), width:@contest_page.image_width,height: @contest_page.image_height) %>
<% else %>
<%= image_tag '/images/transparent.png', width:@contest_page.image_width,height: @contest_page.image_height %>
<% end %>
</div>
</div>
<div class="welcome_left" id="welcome_left">
<% unless @contest_page.nil? %>
<span class="font_welcome_trustie"><%= @contest_page.title %></span> <span class="font_welcome_tdescription">, <%= @contest_page.description %></span>
<% end %>
</div>
<!--搜索框-->
<!--搜索框-->
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %>
<%= text_field_tag 'name', params[:name], :placeholder => l(:label_search_intimation), name: "name", :class => 'blueinputbar', :style => 'width:240px; padding-right:50px;'%>
@ -162,7 +162,7 @@
<div class="avatar-4" style="float: left; margin-top: 7px">
<%= image_tag('/images/contest1.png')%>
</div>
<div style="float: left; margin-left: 12px; margin-top: 10px; margin-bottom: -4px; width: 380px;">
<!-- <%= link_to(contest.name, contest.event_url, :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %> -->
<%= link_to(contest.name, contest_contestnotifications_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %>
@ -172,19 +172,19 @@
<span class="font_lighter">(<span style="font-size: 13px"><%= link_to("#{contest.contesting_softapplications.count}"+l(:label_work_quantity), show_attendingcontest_contest_path(contest), :target => "_blank") %></span>)</span>
<% end %>
</div>
<div style="float: left;margin:5px; margin-left: 12px; margin-bottom: 2px; width: 380px;" class="text_nowrap">
<span class='font_lighter' title ='<%=contest.description%>'><%=contest.description.truncate(100, omission: '...')%></span>
</div><br />
<div style="padding-left: 57px; clear: left;">
<span class="font_lighter"><%=l(:label_release_time)%>:&nbsp;<%=format_time contest.created_on %></span>
</div>
</li>
<% end; reset_cycle %>
<% end; reset_cycle %>
</div>
</div>
</div>
@ -299,31 +299,31 @@
<% if Softapplication.count > 0%>
<div class="d-p-projectlist">
<% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %>
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
<div class="avatar-4" style="float: left; margin-top: 7px">
<%= image_tag('/images/app1.png')%>
</div>
<div style="float: left; margin-left: 10px; margin-top: 7px;margin-bottom: -2px; width: 380px;">
<%= link_to(softapplication.name, softapplication_path(softapplication.id), :class => "d-g-blue d-p-project-name", :title => "#{softapplication.name}", :target => "_blank") %>
</div>
<div class='text_nowrap' style="float: left;margin:5px; margin-left: 10px; margin-bottom:1px; width: 380px;">
<span class='font_lighter' title =<%=softapplication.description.to_s%>><%=softapplication.description.to_s.truncate(50, omission: '...')%></span>
</div><br />
<div style="padding-left: 55px; clear: left;">
<span class="font_lighter"><%=l(:label_release_time)%>:&nbsp;<%=format_time softapplication.created_at %></span>
</div>
</li>
<% end; reset_cycle %>
<% end; reset_cycle %>
</div>
<% else %>
<p class="font_lighter"><%= l(:label_no_ftapplication) %></p>
<% end %>
</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: 作品名称
@ -2104,4 +2105,11 @@ 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