Merge branch 'szzh' into develop

This commit is contained in:
sw 2014-08-07 14:03:06 +08:00
commit 08821b9391
84 changed files with 1084 additions and 2596 deletions

View File

@ -70,3 +70,8 @@ kw:
undefined image_width ÎÊÌâ
bundle exec rake db:migrate:down version=20140725062302
bundle exec rake db:migrate:up version=20140725062302
=================================[2014-07-19]=====================================
kw: Mysql2::Error,存储过程,CALL sp_project_status_cursor();
bundle exec rake db:migrate:down version=20130828004955
bundle exec rake db:migrate:up version=20130828004955

View File

@ -103,6 +103,13 @@ class AccountController < ApplicationController
def register
# @root_path="/home/pdl/redmine-2.3.2-0/apache2/"
#
@cache_identityy = params[:identity]||"" #身份
@cache_no = params[:no]||"" #学号
@cache_technical_title = params[:technical_title]||"" #教师职称
@cache_province = params[:province]||"" #省份
@cache_city = params[:city]||"" #城市
@cache_enterprise_name = params[:enterprise_name]||"" #企业
(redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration]
if request.get?
session[:auth_source_registration] = nil
@ -112,8 +119,8 @@ class AccountController < ApplicationController
@user = User.new
@user.safe_attributes = user_params
if params[:identity] == "2" # 2 企业
@user.firstname = params[:enterprise_name]
@user.lastname = l(:field_enterprise)
#@user.firstname = params[:enterprise_name]
#@user.lastname = l(:field_enterprise)
end
@user.admin = false
@user.register

View File

@ -20,7 +20,7 @@ class ActivitiesController < ApplicationController
before_filter :find_optional_project, :index
accept_rss_auth :index
helper :Watchers
helper :project_score
def index
@days = Setting.activity_days_default.to_i

View File

@ -525,7 +525,7 @@ class ApplicationController < ActionController::Base
#
# @return [boolean, string] name of the layout to use or false for no layout
def use_layout
request.xhr? ? false : 'base'
request.xhr? ? false : 'users_base'
end
def invalid_authenticity_token

View File

@ -29,6 +29,7 @@ class BidsController < ApplicationController
helper :projects
helper :words
helper :welcome
helper :project_score
def find_project_by_bid_id
@bid = Bid.find(params[:id])

View File

@ -26,6 +26,7 @@ class BoardsController < ApplicationController
helper :sort
include SortHelper
helper :watchers
helper :project_score
def index
#modify by nwb

View File

@ -27,6 +27,7 @@ class CalendarsController < ApplicationController
include QueriesHelper
helper :sort
include SortHelper
helper :project_score
def show
if params[:year] and params[:year].to_i > 1900

View File

@ -624,7 +624,9 @@ class CoursesController < ApplicationController
"show_course_journals_for_messages" => true
}
@date_to ||= Date.today + 1
@date_from = @date_to - @days-1.years
#
@date_from = (@date_to - @days) > @course.created_at.to_date ? (@date_to - @days) : @course.created_at.to_date
#@date_from = @date_to - @days-1.years
@author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
# 决定显示所用用户或单个用户活动
@activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,

View File

@ -26,6 +26,7 @@ class DocumentsController < ApplicationController
before_filter :authorize_document
helper :attachments
helper :project_score
def index
@sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category'

View File

@ -24,6 +24,7 @@ class FilesController < ApplicationController
helper :sort
include SortHelper
helper :project_score
def index
#sort_init 'filename', 'asc'
@ -40,7 +41,32 @@ class FilesController < ApplicationController
render :layout => !request.xhr?
elsif params[:course_id]
@isproject = false
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)]
if params[:sort]
if params[:sort].include?":"
@orderBy = params[:sort].split(":")[0]
@orderType = params[:sort].split(":")[1].split(",")[0]
else
@orderBy = params[:sort].split(",")[0]
@orderType = "asc"
end
end
if @orderBy=="size"
@orderBy="filesize"
elsif @orderBy=="field_file_dense"
@orderBy="is_public"
elsif @orderBy=="attach_type"
@orderBy="attachtype"
elsif @orderBy=="content_type"
@orderBy="attachtype"
end
if @orderBy
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.#{@orderBy} #{@orderType}").find(@course.id)]
else
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on desc").find(@course.id)]
end
render :layout => 'base_courses'
end
end

View File

@ -29,6 +29,7 @@ class GanttsController < ApplicationController
helper :sort
include SortHelper
include Redmine::Export::PDF
helper :project_score
def show
@gantt = Redmine::Helpers::Gantt.new(params)

View File

@ -1,5 +1,6 @@
#added by baiyu
class GitUsageController < ApplicationController
layout "project_base"
def ch_usage
end

View File

@ -26,6 +26,8 @@ class IssueCategoriesController < ApplicationController
before_filter :authorize
accept_api_auth :index, :show, :create, :update, :destroy
helper :project_score
def index
respond_to do |format|
format.html { redirect_to_settings_in_projects }

View File

@ -52,6 +52,7 @@ class IssuesController < ApplicationController
include IssuesHelper
helper :timelog
include Redmine::Export::PDF
helper :project_score
def index
retrieve_query

View File

@ -9,6 +9,7 @@ class MemosController < ApplicationController
helper :attachments
include AttachmentsHelper
include ApplicationHelper
layout 'base_memos'
@ -19,6 +20,11 @@ class MemosController < ApplicationController
@content = "#{ll(Setting.default_language, :text_user_wrote, @memo.author)} <br/> &nbsp; "
@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "</blockquote>\n\n<br/>"
@content = "<blockquote>" << @content
#@content = "> #{ll(Setting.default_language, :text_user_wrote, @memo.author)}\n> "
#@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
#@content_html = textilizable(@content)
@temp = Memo.new
@temp.content = @content
end
def new
@ -34,12 +40,23 @@ class MemosController < ApplicationController
end
def create
if params[:quote].nil?
@quote = ""
else
@quote = params[:quote]
end
#unless params[:quote].nil?
# @quote = params[:quote][:quote]
#end
@memo = Memo.new(params[:memo])
@memo.forum_id = params[:forum_id]
@memo.author_id = User.current.id
@memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads]))
@memo.content = @quote + @memo.content
respond_to do |format|
if @memo.save
format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" }
@ -67,7 +84,7 @@ class MemosController < ApplicationController
@reply_pages = Paginator.new @reply_count, pre_count, page
@replies = @memo.children.
includes(:author, :attachments).
reorder("#{Memo.table_name}.created_at ASC").
reorder("#{Memo.table_name}.created_at DESC").
limit(@reply_pages.per_page).
offset(@reply_pages.offset).
all

View File

@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class MessagesController < ApplicationController
include ApplicationHelper
menu_item :boards
default_search_scope :messages
before_filter :find_board, :only => [:new, :preview,:edit]
@ -27,6 +28,7 @@ class MessagesController < ApplicationController
helper :watchers
helper :attachments
include AttachmentsHelper
helper :project_score
REPLIES_PER_PAGE = 25 unless const_defined?(:REPLIES_PER_PAGE)
@ -80,10 +82,12 @@ class MessagesController < ApplicationController
if params[:reply][:content] == ""
(redirect_to board_message_path(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return)
end
@quote = params[:quote][:quote]
@reply = Message.new
@reply.author = User.current
@reply.board = @board
@reply.safe_attributes = params[:reply]
@reply.content = @quote + @reply.content
@topic.children << @reply
#@topic.update_attribute(:updated_on, Time.now)
if !@reply.new_record?
@ -143,8 +147,18 @@ class MessagesController < ApplicationController
@subject = @message.subject
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
@content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
@content << @message.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
#@content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
#@temp = Message.new
##@temp.content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}> "
#@content << @message.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
#@content_html = textilizable(@content)
#@temp.content = @content_html
@content = "#{ll(Setting.default_language, :text_user_wrote, @message.author)} <br/> &nbsp; "
@content << @message.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "</blockquote>\n\n<br/>"
@content = "<blockquote>" << @content
@temp = Message.new
@temp.content = @content
end
def preview

View File

@ -29,6 +29,7 @@ class NewsController < ApplicationController
helper :watchers
helper :attachments
helper :project_score
def index
case params[:format]

View File

@ -1,4 +1,7 @@
class NotificationcommentsController < ApplicationController
def show
end
# default_search_scope :contestnotifications
# model_object Contestnotifications
# before_filter :authorize
@ -20,8 +23,14 @@ class NotificationcommentsController < ApplicationController
end
def destroy
@contestnotifications.notificaioncomments.find(params[:notificaioncomment_id]).destroy
redirect_to contest_contestnotification_path(@contestnotifications)
@contest = Contest.find(params[:contest_id])
@contestnotification = Contestnotification.find(params[:contestnotification_id])
notificaioncomments = Notificationcomment.find(params[:id])
notificaioncomments.destroy if notificaioncomments
#@contestnotifications = notificaioncomments.Contestnotification
#@contest = @contestnotifications.contest
#@contestnotifications.notificaioncomments.find(params[:notificaioncomment_id]).destroy
redirect_to contest_contestnotification_path(@contest,@contestnotification)
end
end

View File

@ -75,6 +75,7 @@ class ProjectsController < ApplicationController
helper :watchers
# helper :watcherlist
helper :words
helper :project_score
### added by william
include ActsAsTaggableOn::TagsHelper
@ -481,10 +482,10 @@ class ProjectsController < ApplicationController
project_info = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id)
user_grades = UserGrade.create(:user_id => User.current.id, :project_id => @project.id)
Rails.logger.debug "UserGrade created: #{user_grades.to_json}"
if params[:project][:is_public] == '1'
project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0, :project_type => @project.project_type)
#if params[:project][:is_public] == '1'
project_status = ProjectStatus.create(:project_id => @project.id, :watchers_count => 0, :changesets_count => 0, :project_type => @project.project_type,:grade => 0)
Rails.logger.debug "ProjectStatus created: #{project_status.to_json}"
end
#end
@project.members << m
@project.project_infos << project_info
#end

View File

@ -39,6 +39,7 @@ class RepositoriesController < ApplicationController
before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ]
helper :repositories
include RepositoriesHelper
helper :project_score
#@root_path = RepositoriesHelper::ROOT_PATH
@ -205,6 +206,14 @@ class RepositoriesController < ApplicationController
@repository.committer_ids = params[:committers].values.inject({}) {|h, c| h[c.first] = c.last; h}
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_path(@project, :tab => 'repositories')
elsif request.get?
respond_to do |format|
format.html{
render :layout => "project_base"
}
end
end
end
@ -412,7 +421,10 @@ class RepositoriesController < ApplicationController
Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}-#{current_language}")
unless read_fragment(@cache_key)
@diff = @repository.diff(@path, @rev, @rev_to)
show_error_not_found unless @diff
unless @diff
show_error_not_found
return
end
end
@changeset = @repository.find_changeset_by_name(@rev)

View File

@ -156,8 +156,8 @@ class SoftapplicationsController < ApplicationController
format.html { redirect_to show_attendingcontest_contest_path(:id => params[:contest_id]), notice: l(:notice_attendingcontest_work_successfully_created) }
# format.json { render json: @softapplication, status: :created, location: @softapplication }
else
format.js { render status: 406 }
format.html { render action: "new" }
#format.js { render status: 406 }
format.html { render action: "contests/show_attendingcontest" }
# format.json { render json: @softapplication.errors, status: :unprocessable_entity }
end
end

View File

@ -41,7 +41,7 @@ class UsersController < ApplicationController
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index]
before_filter :auth_user_extension, only: :show
#before_filter :rest_user_score, only: :show
before_filter :rest_user_score, only: :show
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx
#william
@ -794,7 +794,9 @@ class UsersController < ApplicationController
praise_num(@user)
changeset_num(@user)
document_num(@user)
attachment_num(@user)
issue_done_ratio_num(@user)
post_issue_num(@user)
end
#验证是否显示课程

View File

@ -29,6 +29,7 @@ class VersionsController < ApplicationController
helper :custom_fields
helper :projects
helper :project_score
def index
respond_to do |format|

View File

@ -18,7 +18,7 @@
class WelcomeController < ApplicationController
include ApplicationHelper
include WelcomeHelper
helper :project_score
caches_action :robots
# before_filter :fake, :only => [:index, :course]
before_filter :entry_select, :only => [:index]

View File

@ -44,6 +44,7 @@ class WikiController < ApplicationController
include AttachmentsHelper
helper :watchers
include Redmine::Export::PDF
helper :project_score
# List of pages, sorted alphabetically and by parent (hierarchy)
def index

View File

@ -98,11 +98,11 @@ module CoursesHelper
end
alias teacherCountOrigin teacherCount
def teacherCount project
count = teacherCountOrigin project
garble count
end
#alias teacherCountOrigin teacherCount
#def teacherCount project
# count = teacherCountOrigin project
# garble count
#end
# 注意:此方法有问题,速度慢且结果不准
# alias studentCountOrigin studentCount
@ -114,7 +114,20 @@ module CoursesHelper
# 学生人数计算
# add by nwb
def studentCount course
count = course.student.count
count = searchStudent(course).count#course.student.count
if count <= 5
result = count.to_s
elsif count < 10 && count > 5
result = "5+"
else
result = (count-count % 10).to_s + "+"
end
result
end
#课程成员数计算
def memberCount course
count = searchStudent(course).count + searchTeacherAndAssistant(course).count
if count <= 5
result = count.to_s
elsif count < 10 && count > 5

View File

@ -53,10 +53,13 @@ module MembersHelper
# 当前申请加入的成员名单
def render_principals_for_applied_members(project)
scope = Principal.active.sorted.applied_members(project).like(params[:q])
scope = project.applied_projects.map(&:user)
principal_count = scope.count
principal_pages = Redmine::Pagination::Paginator.new principal_count, 10, params['page']
principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all
offset ||= principal_pages.offset
principals = scope[offset, 10]
#principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all
#principals = ApplicationController.new.paginateHelper scope,10
s = content_tag('div', principals_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals')

View File

@ -0,0 +1,90 @@
# encoding: utf-8
module ProjectScoreHelper
#缺陷数量
def issue_num project
project.issues.count
end
#缺陷留言数量
def issue_journal_num project
project.issue_changes.count
end
#新闻数量
def news_num project
project.news.count
end
#文档数量
def document_num project
project.documents.count
end
#代码提交数量
def changesets_num project
project.changesets.count
end
#讨论区帖子数量
def board_message_num project
board_message_count = 0
project.boards.each do |board|
board_message_count += board.messages_count
end
board_message_count
end
#缺陷得分
def issue_score project
i_num = issue_num project
i_j_num = issue_journal_num project
i_num * 4 + i_j_num
end
# 新闻得分
def news_score project
n_num = news_num project
n_num
end
#文档得分
def document_score project
d_num = document_num project
d_num * 4
end
#代码提交得分
def changesets_score project
c_num = changesets_num project
c_num * 4
end
#讨论区帖子得分
def board_message_score project
b_m_num = board_message_num project
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}'")
if pss.nil? || pss.count == 0
ps = ProjectStatus.new
ps.grade = 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.save
end
result
end
end

View File

@ -337,12 +337,15 @@ module UserScoreHelper
:activity => activity, :file => file, :issue => issue, :level => level)
end
#====================================================================================================
def get_option_number(user,type,project_id=nil)
if project_id.nil?
#========================================================================================================
#个人得分统计
#========================================================================================================
#type 1个人得分、2个人在项目project中的得分
def get_option_number(user,type,project=nil)
if project.nil?
option_number = OptionNumber.where("user_id = '#{user.id}' and score_type = '#{type}'");
else
option_number = OptionNumber.where("user_id = '#{user.id}' and score_type = '#{type}' and project_id = '#{project_id}'");
option_number = OptionNumber.where("user_id = '#{user.id}' and score_type = '#{type}' and project_id = '#{project.id}'");
end
result = nil
@ -382,6 +385,7 @@ module UserScoreHelper
def update_score(option_number)
option_number.total_score = collaboration(option_number) + influence(option_number) + skill(option_number) + active(option_number)
option_number.save
option_number.total_score
end
#协同得分
@ -402,16 +406,16 @@ module UserScoreHelper
end
#更新发帖数
def update_memo_number(user,type)
option_number = get_option_number(user,type)
option_number.memo = Message.includes(:author).where("parent_id IS NULL and author_id = '#{user.id}'").all.count + Memo.includes(:author).where("parent_id IS NULL and author_id = '#{user.id}'").all.count
def update_memo_number(user,type,project=nil)
option_number = get_option_number(user,type,project)
option_number.memo = memo_num(user,project)#Message.includes(:author).where("parent_id IS NULL and author_id = '#{user.id}'").all.count + Memo.includes(:author).where("parent_id IS NULL and author_id = '#{user.id}'").all.count
update_score(option_number)
end
#发帖数
def memo_num(user,project=nil)
if project.nil?
Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id != -1").all.count
Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id != -1").all.count #+ Memo.includes(:author).where("parent_id IS NULL and author_id = '#{user.id}'").all.count
else
Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id = #{project.id}").all.count
end
@ -419,9 +423,9 @@ module UserScoreHelper
end
#更新对缺陷留言数
def update_messges_for_issue(user,type)
def update_messges_for_issue(user,type,project=nil)
option_number = get_option_number(user,type)
option_number.messages_for_issues = Journal.includes(:user).where("user_id = '#{user.id}' and notes != '' and notes is not null").all.count
option_number.messages_for_issues = messges_for_issue_num(user,project)#Journal.includes(:user).where("user_id = '#{user.id}' and notes != '' and notes is not null").all.count
update_score(option_number)
end
@ -434,9 +438,9 @@ module UserScoreHelper
end
#更新更改缺陷状态状态次数
def update_issues_status(user,type)
def update_issues_status(user,type,project=nil)
option_number = get_option_number(user,type)
option_number.issues_status = Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count
option_number.issues_status = issues_status_num(user,project)#Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'status_id' and #{User.table_name}.id = '#{user.id}'").count
update_score(option_number)
end
@ -450,26 +454,31 @@ module UserScoreHelper
end
#更新对留言的回复数量
def update_replay_for_message(user,type)
def update_replay_for_message(user,type,project=nil)
option_number = get_option_number(user,type)
option_number.replay_for_message = JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id}").count
option_number.replay_for_message = replay_for_message_num(user,project)#JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id}").count
update_score(option_number)
end
def replay_for_message_num(user)
JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id}").count
def replay_for_message_num(user,project=nil)
if project.nil?
JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id} and jour_type = 'Project'").count
else
JournalsForMessage.includes(:user).where("m_parent_id IS NOT NULL and user_id = #{user.id} and jour_type = 'Project' and jour_id = '#{project.id}'").count
end
end
#更新对帖子的回复数量
def update_replay_for_memo(user,type)
def update_replay_for_memo(user,type,project=nil)
option_number = get_option_number(user,type)
option_number.replay_for_memo = Message.includes(:author).where("parent_id IS NOT NULL and author_id = #{user.id}").all.count #+ Memo.includes(:author).where("parent_id IS NOT NULL and author_id = #{user.id}").all.count
option_number.replay_for_memo = replay_for_memo_num(user,project)#Message.includes(:author).where("parent_id IS NOT NULL and author_id = #{user.id}").all.count #+ Memo.includes(:author).where("parent_id IS NOT NULL and author_id = #{user.id}").all.count
update_score(option_number)
end
def replay_for_memo_num(user,project=nil)
if project.nil?
Message.includes(:author).where("parent_id IS NOT NULL and author_id = #{user.id}").all.count
Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NOT NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id != -1").all.count
else
Message.includes(:author).joins(:board).where("#{Message.table_name}.parent_id IS NOT NULL and #{Message.table_name}.author_id = '#{user.id}' and #{Board.table_name}.project_id = #{project.id}").all.count
end
@ -487,32 +496,13 @@ module UserScoreHelper
end
#更新帖子踩各项数量
def update_tread(user,type)
def update_tread(user,type,project=nil)
option_number = get_option_number(user,type)
option_number.tread = PraiseTread.where("praise_tread_object_type = 'Issue' || praise_tread_object_type = 'Message' and praise_or_tread = 0 and user_id = '#{user.id}'").all.count
pts = PraiseTread.where("praise_tread_object_type = 'Issue' || praise_tread_object_type = 'Message' and praise_or_tread = 0").all
result = []
result1 = []
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?
next
end
target_user = obj.author
level = UserLevels.get_level(pt.user)#pt.user.get_level
project = pt.project
if level == 1 && target_user.id = user.id
result << pt
elsif level == 2 && target_user.id = user.id
result1 << pt
elsif level == 3 && target_user.id = user.id
result2 << pt
end
end
option_number.tread_by_one = result.count
option_number.tread_by_two = result1.count
option_number.tread_by_three = result2.count
tread_nums = tread_num(user,project)
option_number.tread = tread_nums[:tread]
option_number.tread_by_one = tread_nums[:tead_by_one]
option_number.tread_by_two = tread_nums[:tread_by_two]
option_number.tread_by_three = tread_nums[:tread_by_three]
update_score(option_number)
end
@ -571,36 +561,17 @@ module UserScoreHelper
end
#更新帖子顶数量
def update_praise(user,type)
def update_praise(user,type,project=nil)
option_number = get_option_number(user,type)
pts = PraiseTread.where("praise_tread_object_type = 'Issue' || praise_tread_object_type = 'Message' and praise_or_tread = 1").all
result = []
result1 = []
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?
next
end
target_user = obj.author
level = UserLevels.get_level(pt.user)#pt.user.get_level
project = pt.project
if level == 1 && target_user.id = user.id
result << pt
elsif level == 2 && target_user.id = user.id
result1 << pt
elsif level == 3 && target_user.id = user.id
result2 << pt
end
end
option_number.praise_by_one = result.count
option_number.praise_by_two = result1.count
option_number.praise_by_three = result2.count
praise_nums = praise_num(user,project)
option_number.praise_by_one = praise_nums[:praise_by_one]
option_number.praise_by_two = praise_nums[:praise_by_two]
option_number.praise_by_three = praise_nums[:praise_by_three]
update_score(option_number)
end
def praise_num(user,project=nil)
if project.nil?
if !project.nil?
pts = PraiseTread.where("praise_tread_object_type = 'Issue' || praise_tread_object_type = 'Message' and praise_or_tread = 1").all
result = []
result1 = []
@ -635,6 +606,9 @@ module UserScoreHelper
if obj.nil?
next
end
#if obj.project.id == -1
# next
#end
target_user = obj.author
level = UserLevels.get_level(pt.user)#pt.user.get_level
project = pt.project
@ -652,9 +626,9 @@ module UserScoreHelper
end
#更新提交代码次数
def update_changeset(user,type)
def update_changeset(user,type,project=nil)
option_number = get_option_number(user,type)
option_number.changeset = Changeset.includes(:user).where("user_id = '#{user.id}'").all.count
option_number.changeset = changeset_num(user,project)#Changeset.includes(:user).where("user_id = '#{user.id}'").all.count
update_score(option_number)
end
@ -668,13 +642,13 @@ module UserScoreHelper
end
#更新文档提交次数
def update_document(user,type)
def update_document(user,type,project=nil)
option_number = get_option_number(user,type)
option_number.document = Document.includes(:user).where("user_id = '#{user.id}'").all.count
option_number.document = document_num(user,project)#Document.includes(:user).where("user_id = '#{user.id}'").all.count
update_score(option_number)
end
def document_num(user,project=nil?)
def document_num(user,project=nil)
if project.nil?
Document.includes(:user).where("user_id = '#{user.id}'").all.count
else
@ -684,40 +658,66 @@ module UserScoreHelper
end
#更新附件提交数量
def update_attachment(user,type)
def update_attachment(user,type,project=nil)
option_number = get_option_number(user,type)
option_number.attachment = Attachment.includes(:author).where("author_id = '#{user.id}'").all.count
option_number.attachment = attachment_num(user,project)#Attachment.includes(:author).where("author_id = '#{user.id}'").all.count
update_score(option_number)
end
#===================here to continue============================
def attachment_num(user,project=nil)
if project.nil?
Attachment.includes(:author).where("author_id = '#{user.id}'").all.count
Attachment.includes(:author,:container).where("author_id = '#{user.id}' and container_type = 'Project'").all.count
else
Attachment.includes(:author,:container).where("author_id = '#{user.id}' and container_type = 'Project' and container_id = #{project.id}").all.count
end
end
#更新缺陷完成度次数
def update_issue_done_ratio(user,type)
def update_issue_done_ratio(user,type,project=nil)
option_number = get_option_number(user,type)
option_number.issue_done_ratio = Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'done_ratio' and #{User.table_name}.id = '#{user.id}'").count
option_number.issue_done_ratio = issue_done_ratio_num(user,project) #Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'done_ratio' and #{User.table_name}.id = '#{user.id}'").count
update_score(option_number)
end
def issue_done_ratio_num(user,project)
def issue_done_ratio_num(user,project=nil)
if project.nil?
Journal.joins(:details, :user).where("#{JournalDetail.table_name}.prop_key = 'done_ratio' and #{User.table_name}.id = '#{user.id}'").count
else
Journal.joins(:issue,:details,:user).where("#{Issue.table_name}.project_id = '#{project.id}' and #{JournalDetail.table_name}.prop_key = 'done_ratio' and #{User.table_name}.id = '#{user.id}'").count
end
end
#更新发布缺陷次数
def update_post_issue(user,type)
def update_post_issue(user,type,project=nil)
option_number = get_option_number(user,type)
option_number.post_issue = Issue.includes(:author).where("author_id = '#{user.id}'").all.count
option_number.post_issue = post_issue_num(user,project) #Issue.includes(:author).where("author_id = '#{user.id}'").all.count
update_score(option_number)
end
def post_issue_num(user,project=nil)
if project.nil?
Issue.includes(:author).where("author_id = '#{user.id}'").all.count
else
Issue.includes(:author).where("author_id = '#{user.id}' and project_id = '#{project.id}'").all.count
end
end
def user_scores(user,type,project=nil)
ooption_num = get_option_number(user,type,project)
update_memo_number(user,type,project)
update_messges_for_issue(user,type,project)
update_issues_status(user,type,project)
update_replay_for_message(user,type,project)
update_replay_for_memo(user,type,project)
update_tread(user,type,project)
update_praise(user,type,project)
update_changeset(user,type,project)
update_document(user,type,project)
update_attachment(user,type,project)
update_issue_done_ratio(user,type,project)
update_post_issue(user,type,project)
update_score(ooption_num)
ooption_num
end
end

View File

@ -193,7 +193,7 @@ class Attachment < ActiveRecord::Base
def show_suffix_type
suffix = 'other'
temp = self.suffix_type.downcase
if self.attachmentstype.suffixArr.include?(temp)
if self.attachmentstype && self.attachmentstype.suffixArr.include?(temp)
suffix = temp
end
suffix

View File

@ -4,6 +4,7 @@ class Notificationcomment < ActiveRecord::Base
include Redmine::SafeAttributes
belongs_to :notificationcommented, :polymorphic => true#, :counter_cache => true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
belongs_to :Contestnotification
validates_presence_of :notificationcommented, :author, :notificationcomments

View File

@ -1,5 +1,5 @@
class ProjectStatus < ActiveRecord::Base
attr_accessible :changesets_count, :watchers_count, :project_id, :project_type
attr_accessible :changesets_count, :watchers_count, :project_id, :project_type,:grade
belongs_to :project
belongs_to :watchers
belongs_to :changesets

View File

@ -11,7 +11,7 @@ class Softapplication < ActiveRecord::Base
belongs_to :project
has_many :contests, :through => :contesting_softapplications
validates_length_of :name, :maximum => 125
validates_length_of :name, :maximum => 25
validates_length_of :application_developers, :maximum => 125
validates_length_of :android_min_version_available, :maximum => 125

View File

@ -174,6 +174,7 @@ class User < Principal
validates_format_of :login, :with => /\A[a-z0-9_\-@\.]*\z/i
validates_length_of :login, :maximum => LOGIN_LENGTH_LIMIT
validates_length_of :firstname, :maximum => 30
validates_length_of :lastname, :maximum => 30
validates_format_of :mail, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :allow_blank => true
validates_length_of :mail, :maximum => MAIL_LENGTH_LIMIT, :allow_nil => true
validates_confirmation_of :password, :allow_nil => true
@ -324,7 +325,7 @@ class User < Principal
# Returns the user that matches provided login and password, or nil
#登录,返回用户名与密码匹配的用户
def self.try_to_login(login, password)
login = login.to_s
login = login.to_s.lstrip.rstrip
password = password.to_s
# Make sure no one can sign in with an empty login or password

View File

@ -193,7 +193,40 @@
</script>
<script type="text/javascript" language="javascript">
window.onload = function(){
var identity = "<%= @cache_identityy %>";
var no = "<%= @cache_no %>";
var technical_title = "<%= @cache_technical_title %>";
var province = "<%= @cache_province %>";
var city = "<%= @cache_city %>";
var enterprise_name = "<%= @cache_enterprise_name %>";
//还原身份
if(identity!=null&&identity!=""){
$('#userIdentity').children("option[value='"+identity+"']").attr("selected","selected");
showtechnical_title(identity, document.getElementById('userTechnical_title'));
if(identity=="0"){
//还原教师职称
$('#userTechnical_title').children("option[value='"+technical_title+"']").attr("selected","selected");
}else if(identity=="1"){
//还原学号
$("input[id='no']").attr("value",no);
}
}
//还原地区
if(province!=null&&province!=""){
$("#userProvince").children("option[value='"+province+"']").attr("selected","selected");
showcity(province, document.getElementById('userCity'));
$("select[id='userCity']").children("option[value='"+city+"']").attr("selected","selected");
}
//还原企业名
if(enterprise_name!=null&&enterprise_name!=""){
$("input[id='enterprise_name']").attr("value",enterprise_name);
}
}
function showtechnical_title(identity, technical_titleField) {
var technical_titleOptions = null;
switch (identity) {
case '0' :
@ -202,7 +235,7 @@
$('#name').show()
$('#enterprise').hide()
$('#gender').show()
var technical_titleOptions = new Array(
technical_titleOptions = new Array(
"<%= l(:label_technicl_title_professor) %>", "<%= l(:label_technicl_title_associate_professor) %>", "<%= l(:label_technicl_title_lecturer) %>", "<%= l(:label_technicl_title_teaching_assistant) %>");
break;
@ -234,7 +267,11 @@
break;
}
technical_titleField.options.length = 0;
if(technical_titleOptions == null){
return;
}
for (var i = 0; i < technical_titleOptions.length; i++) {
technical_titleField.options[i] = new Option(technical_titleOptions[i], technical_titleOptions[i]);
/*
@ -242,7 +279,8 @@
{
//alert("here put City ok!");
document.oblogform["city"].selectedIndex = i;
}*/
}
*/
}
}
</script>

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)) %>
@ -40,16 +40,25 @@
<th></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") %>">
<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 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>

View File

@ -12,8 +12,16 @@
<% end %>
<% end %>
</span>
<script type='text/javascript'>
function CompatibleSend()
{
var obj=document.getElementById("_file");
var file= $(obj).clone();
file.click();
}
</script>
<span class="add_attachment">
<%= button_tag "浏览", :type=>"button", :onclick=>"_file.click()" %>
<%= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',

View File

@ -8,7 +8,7 @@
<table width="100%" valign="center">
<tr>
<td ><span style="margin-left:0px"><%= l(:label_task_plural)%>(<%= @homework_list.count%>)</span>
<%= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;line-height: 20px;height: 20px;display: inline-block;" if(is_teacher && @bid.homeworks.count > 0) %>
<%= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), class: "button_submit button_submit_font_white", style: "margin: 5px 10px;line-height: 20px;height: 20px;display: inline-block;" if(is_teacher && @bid.homeworks.count > 0) %>
</td>
<td align="right">
<div class="project-search">
@ -96,7 +96,7 @@
<td>
<strong>项目得分:&nbsp;
<span style="color: <%= homework.project.nil? ? "#727272" : "#EC6300"%>;">
<%= homework.project.nil? ? "N/A" : project_score(homework.project) %>
<%= homework.project.nil? ? "N/A" : project_scores(homework.project) %>
</span>
</strong>
</td>
@ -106,7 +106,7 @@
<td>
<strong>提交文件:&nbsp;
<% if is_evaluation || is_teacher%>
<%= link_to "打包下载", :controller => "zipdown", :action => "download_user_homework",:homework => homework, :remote => true%>
<%= link_to "打包下载", :controller => "zipdown", :action => "download_user_homework",:homework => homework%>
<% else %>
<span class="required">未开启互评功能作业不允许下载</span>
<% end %>

View File

@ -69,7 +69,21 @@
<td>
<table width="580px" border="0">
<tr>
<td colspan="2" valign="top"><strong><%= link_to_user(notificationcomment.author) if notificationcomment.respond_to?(:author) %> </strong><span class="font_lighter"><%= l(:label_project_newadd) %></span><%= l(:label_comment_plural) %></td>
<td colspan="2" valign="top">
<strong>
<%= link_to_user(notificationcomment.author) if notificationcomment.respond_to?(:author) %>
</strong>
<span class="font_lighter">
<%= l(:label_project_newadd) %>
</span>
<%= l(:label_comment_plural) %>
</td>
<td>
<% if notificationcomment.author==User.current|| User.current.admin? %>
<%= link_to(l(:label_bid_respond_delete), contest_contestnotification_notificationcomment_path(@contest, @contestnotification,notificationcomment),
:method => :delete,:confirm => l(:text_are_you_sure), :title => l(:button_delete)) %>
<% end %>
</td>
</tr>
<tr>
<td colspan="2" width="580px" >

View File

@ -23,12 +23,12 @@
<p style="width:500px;"><%= l(:label_bids_form_contest_new_description) %></p>
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Contest::NAME_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_name)}" %></p>
<p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Contest::DESCRIPTION_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_description)}" %></p>
<p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 5, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Contest::DESCRIPTION_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_description)}" %></p>
<p style="margin-left:-10px;"><%= f.text_field :password, :size => 60, :style => "width:488px;margin-left: 10px;" %></p>
<p>
<%= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
<%= f.text_area :budget, :required => true, :size => 60,:rows => 4,:maxlength => Contest::DESCRIPTION_LENGTH_LIMIT, :style => "width:490px;", :placeholder => l(:label_bids_reward_what) %>
<!-- 设置奖项设置的打开 关闭开关-->
</p>

View File

@ -44,7 +44,7 @@
<p class="stats">
<%= content_tag('span', "#{garble @course.members.count}", :class => "info") %>
<%#= content_tag('span', l(:label_x_member, :count => @course.members.count)) %>
<%= content_tag('span', l(:label_x_member, :count => studentCount(@course)+teacherCount(@course))) %>
<%= content_tag('span', l(:label_x_member, :count => memberCount(@course))) %>
</p>
<!--gcm-->

View File

@ -2,7 +2,7 @@
<div class="content-title-top-avtive">
<!-- <h3><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %></h3> -->
<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_from), :end => format_date(@date_to - 1)) %>
</p>
<% @events_by_day.keys.sort.reverse.each do |day| %>

View File

@ -21,7 +21,7 @@
<%= sort_header_tag('field_file_dense', :caption => l(:field_file_dense), :default_order => 'desc', :scope => "col", :id => "vzebra-field_file_dense") %>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
<!-- <%#= sort_header_tag('description', :caption => l(:field_description)) %> -->
</tr>
</thead>
<tbody>
@ -43,7 +43,7 @@
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
<td class="filesize"><%= number_to_human_size(file.filesize) %></td>
<td class="attach_type">
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName %></span>
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName unless file.attachmentstype.nil? %></span>
<span id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;">
<%= render :partial => 'attachments/course_type_edit', :locals => {:attachmenttypes => attachmenttypes, :attachment => file, :contentype => selContentType} %>
</span>

View File

@ -21,7 +21,7 @@
<%= sort_header_tag('field_file_dense', :caption => l(:field_file_dense), :default_order => 'desc', :scope => "col", :id => "vzebra-field_file_dense") %>
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
<!-- <%#= sort_header_tag('description', :caption => l(:field_description)) %> -->
</tr>
</thead>
<tbody>

View File

@ -5,8 +5,7 @@
<div class="splitcontent" style="display: block;">
<div class="splitcontentleft">
<% if @issue.safe_attribute?('status_id') && @allowed_statuses.present? %>
<p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), {:required => true},
:onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')" %></p>
<p><%= f.select :status_id, (@allowed_statuses.collect {|p| [p.name, p.id]}), {:required => true}, :onchange => "updateIssueFrom('#{escape_javascript project_issue_form_path(@project, :id => @issue, :format => 'js')}')" %></p>
<% else %>
<p><label><%= l(:field_status) %></label> <%= h(@issue.status.name) %></p>
@ -46,10 +45,28 @@
<% if @issue.safe_attribute? 'estimated_hours' %>
<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">
function PrecentChange(obj){
var _v= obj;
if(_v==100)
{
//alert(3);
}
else if(_v==0)
{
//alert(1);
}
else if(_v!=100&&_v!=0)
{
// alert(2);
}
}
</script>
<% if @issue.safe_attribute?('done_ratio') && @issue.leaf? && Issue.use_field_for_done_ratio? %>
<p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }), :required => @issue.required_attribute?('done_ratio') %></p>
<p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }), {:required => @issue.required_attribute?('done_ratio')},
{:onchange => "PrecentChange(this.value)"} %></p>
<% end %>
</div>
</div>
</fieldset>

View File

@ -1,3 +1,4 @@
<% @nav_dispaly_project_label = 1
@nav_dispaly_forum_label = 1 %>
<% #@nav_dispaly_project_label = 1 %>
@ -62,37 +63,10 @@
<%= link_to @project.name, project_path(@project)%>
</div>
<div>
<!-- added by bai 增加项目得分 -->
<% issue_count = @project.issues.count %>
<% issue_journal_count = @project.issue_changes.count %>
<% issue_score = issue_count * 0.2 %>
<% issue_journal_score = issue_journal_count * 0.1 %>
<% finall_issue_score = issue_score + issue_journal_score %>
<% new_count = @project.news.count %>
<% new_score = new_count * 0.1 %>
<% finall_new_score = new_score %>
<% document_count = @project.documents.count %>
<% file_score = document_count * 0.1 %>
<% finall_file_score = file_score %>
<% changeset_count = @project.changesets.count %>
<% code_submit_score = changeset_count * 0.3 %>
<% finall_code_submit_score = code_submit_score %>
<% board_message_count = 0 %>
<% @project.boards.each do |board| %>
<% board_message_count += board.messages_count %>
<% end %>
<% topic_score = board_message_count * 0.1 %>
<% finall_topic_score = topic_score %>
<% finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %>
<% if @project.project_type == 0 %>
<%= l(:label_project_grade)%> :
<%= link_to(format("%.2f" , finall_project_score ).to_f, {:controller => 'projects',
<%= link_to(format("%.2f" , project_scores(@project) ).to_i, {:controller => 'projects',
:action => 'show_projects_score',
:remote => true,
:id => @project.id

View File

@ -2,6 +2,9 @@
<%= f.hidden_field :subject, :required => true, value: @memo.subject %>
<%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %>
<%= f.hidden_field :parent_id, :required => true, value: @memo.id %>
<div id="message_quote" class="wiki"></div>
<%= hidden_field_tag :quote,"",:required => false,:style => 'display:none' %>
<%= label_tag(l(:label_reply_plural)) %>:
<!-- <p> < %= f.text_area :content, :required => true, :size => "75%", :resize => "none", id: 'editor01' %> </p> -->
<%= f.text_area :content, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'editor01', :value => @content %></p>

View File

@ -1,2 +1,4 @@
ckeditor.setData("<%= raw escape_javascript(@content) %>");
//ckeditor.setData("<%= raw escape_javascript(@content) %>");
$('#message_quote').html("<%= raw escape_javascript(@temp.content) %>");
$('#quote').val("<%= raw escape_javascript(@content) %>");
showAndScrollTo("new_memo", "cke_editor01");

View File

@ -104,6 +104,8 @@
<div class="memo-content">
<%= textilizable(@topic, :content) %>
<%= link_to_attachments @topic, :author => false %>
<%# options = {:author => true, :deletable => @topic.author.eql?(User.current)} %>
<%#= render :partial => 'attachments/app_link', :locals => {:attachments => @topi.attachments, :options => options} %>
</div>
<div class="memo-timestamp">
<div style="float: left"><%= authoring @topic.created_on, @topic.author %></div>

View File

@ -32,7 +32,9 @@
<%= f.select :board_id, boards_options_for_select(@message.course.boards) %></p>
<% end %>
<% end %>
<div id="message_quote" class="wiki"></div>
<%= text_area :quote,:quote,:style => 'display:none' %>
<p>
<%= label_tag "message_content", l(:description_message_content), :class => "hidden-for-sighted" %>
<%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content' %></p>

View File

@ -1,4 +1,7 @@
$('#message_subject').val("<%= raw escape_javascript(@subject) %>");
$('#message_content').val("<%= raw escape_javascript(@content) %>");
$('#message_quote').html("<%= raw escape_javascript(@temp.content) %>");
//$('#message_content').val("<#%= raw escape_javascript(@content) %>");
$('#quote_quote').html("<%= raw escape_javascript(@content) %>");
showAndScrollTo("reply", "message_content");
$('#message_content').scrollTop = $('#message_content').scrollHeight - $('#message_content').clientHeight;

View File

@ -82,7 +82,7 @@
</span>
<span id='enterprise' style='display:none'>
<p style="width:400px;padding-left: 26px;">企业名<%= text_field_tag :enterprise_name, @user.firstname %>
<p style="width:400px;padding-left: 26px;"><%= l(:label_company_name)%><%= text_field_tag :enterprise_name, @user.firstname %>
</p>
</span>

View File

@ -1,7 +1,4 @@
<!-- added by bai -->
<% changeset_count = @project.changesets.count %>
<% code_submit_score = changeset_count * 0.3 %>
<% finall_code_submit_score = code_submit_score %>
<div><%= l(:label_code_submit_number) %> * 0.3 = <%= changeset_count %> * 0.3 = <%= format("%.2f" , code_submit_score).to_f %></div>
<div><%= l(:label_code_submit_score) %> = <%= format("%.2f" , finall_code_submit_score).to_f %></div>
<div><%= l(:label_code_submit_number) %> * 4 = <%= changesets_num(@project) %> * 4 = <%= format("%.2f" , changesets_score(@project)).to_i %></div>
<div><%= l(:label_code_submit_score) %> = <%= format("%.2f" , changesets_score(@project)).to_i %></div>
<!-- end -->

View File

@ -1,7 +1,4 @@
<!-- added by bai -->
<% document_count = @project.documents.count %>
<% file_score = document_count * 0.1 %>
<% finall_file_score = file_score %>
<div><%= l(:label_file_number) %> * 0.1 = <%= document_count %> * 0.1 = <%= format("%.2f" , file_score).to_f %></div>
<div><%= l(:label_file_score) %> = <%= format("%.2f" , finall_file_score).to_f %></div>
<div><%= l(:label_file_number) %> * 4 = <%= document_num(@project) %> * 4 = <%= format("%.2f" , document_score(@project)).to_i %></div>
<div><%= l(:label_file_score) %> = <%= format("%.2f" , document_score(@project)).to_i %></div>
<!-- end -->

View File

@ -8,10 +8,13 @@
<p style="padding-right: 20px;">
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
</p><!--by young-->
<p><%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH %>
<p style="display: none"><%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH,
value:"#{User.current.id.to_s + '_' +format_time(Time.now).to_s}" %>
<% unless @project.identifier_frozen? %>
<em class="info"><%= l(:text_length_between, :min => 1, :max => Project::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_project_identifier_info).html_safe %></em>
<% end %></p>
<!-- <p style="margin-left:-10px;"><%#= f.text_field :homepage, :size => 60, :style => "width:488px;margin-left: 10px;" %></p> --> <!-- by huang -->
<p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;"><%= f.check_box :is_public, :style => "margin-left:10px;" %></em></p>
<p style="margin-left:-10px;"><em style ="color: #888888;display: block;font-size: 90%;font-style: normal;"><%= f.check_box :hidden_repo, :style => "margin-left:10px;" %></em></p>

View File

@ -1,11 +1,6 @@
<!-- added by bai -->
<% issue_count = @project.issues.count %>
<% issue_journal_count = @project.issue_changes.count %>
<% issue_score = issue_count * 0.2 %>
<% issue_journal_score = issue_journal_count * 0.1 %>
<% finall_issue_score = issue_score + issue_journal_score %>
<div><%= l(:label_issue_number) %> * 0.2 = <%= issue_count %> * 0.2 = <%= format("%.2f" , issue_score).to_f %></div>
<div><%= l(:label_issue_journal_number) %> * 0.1 = <%= issue_journal_count %> * 0.1 = <%= format("%.2f" , issue_journal_score).to_f %></div>
<div><%= l(:label_issue_score) %> = <%= format("%.2f" , issue_score).to_f %> + <%= format("%.2f" , issue_journal_score).to_f %>
= <%= format("%.2f" , finall_issue_score).to_f %></div>
<div><%= l(:label_issue_number) %> * 4 = <%= issue_num(@project) %> * 4 = <%= format("%.2f" , issue_num(@project) * 4).to_i %></div>
<div><%= l(:label_issue_journal_number) %> * 1 = <%= issue_journal_num(@project) %> * 1 = <%= format("%.2f" , issue_journal_num(@project)).to_i %></div>
<div><%= l(:label_issue_score) %> = <%= format("%.2f" , issue_num(@project) * 4).to_i %> + <%= format("%.2f" , issue_journal_num(@project)).to_i %>
= <%= format("%.2f" , issue_score(@project)).to_i %></div>
<!-- end -->

View File

@ -1,7 +1,5 @@
<!-- added by bai -->
<% new_count = @project.news.count %>
<% new_score = new_count * 0.1 %>
<% finall_new_score = new_score %>
<div><%= l(:label_new_number) %> * 0.1 = <%= new_count %> * 0.1 = <%= format("%.2f" , new_score).to_f %></div>
<div><%= l(:label_news_score) %> = <%= format("%.2f" , finall_new_score).to_f %></div>
<div><%= l(:label_new_number) %> * 1 = <%= news_num(@project) %> * 1 = <%= format("%.2f" , news_score(@project)).to_i %></div>
<div><%= l(:label_news_score) %> = <%= format("%.2f" , news_score(@project)).to_i %></div>
<!-- end -->

View File

@ -18,37 +18,37 @@
<div class="information">
<p class="stats">
<table style="width: 400px;">
<table style="width: 280px;">
<tr>
<td style="width: 50%;text-align: right;font-size: 17px;">
<td style="width: 40%;text-align: right;font-size: 17px;">
<strong><%= link_to @project.watcher_users.count, project_watcherlist_path(project)%></strong>
</td>
<td style="width: 50%;text-align: left">
<td style="width: 60%;text-align: left">
<%= content_tag('span', l(:label_x_follow_people,:count =>@project.watcher_users.count)) %>
</td>
</tr>
<tr>
<td style="width: 50%;text-align: right;font-size: 17px;">
<td style="width: 40%;text-align: right;font-size: 17px;">
<strong><%= link_to "#{@project.members.count}", project_member_path(@project)%></strong>
</td>
<td style="width: 50%;text-align: left">
<td style="width: 60%;text-align: left">
<%= content_tag('span', l(:label_x_current_contributors, :count => @project.users.count)) %>
</td>
</tr>
<tr>
<td style="width: 50%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
<td style="width: 40%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
<strong><%= content_tag('span', "#{(@project.repository.nil? || @project.repository.changesets[0].nil?) ? '0' : distance_of_time_in_words(Time.now, @project.repository.changesets[0].committed_on)}", :class => "info") %></strong>
</td>
<td style="width: 50%;text-align: left">
<td style="width: 60%;text-align: left">
<%= content_tag('span', l(:label_since_last_commits)) %>
</td>
</tr>
<tr>
<td style="width: 50%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
<td style="width: 40%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
<% #find_project_repository @project %>
<strong><%= content_tag('span', "#{@project.repository.nil? || @project.project_status.nil? ? '0' : @project.project_status.changesets_count }", :class => "info") %></strong>
</td>
<td style="width: 50%;text-align: left">
<td style="width: 60%;text-align: left">
<%= content_tag('span', l(:label_commit_on)) %>
</td>
</tr>
@ -124,37 +124,11 @@
<!-- added by bai -->
<div class="grade">
<% issue_count = @project.issues.count %>
<% issue_journal_count = @project.issue_changes.count %>
<% issue_score = issue_count * 0.2 %>
<% issue_journal_score = issue_journal_count * 0.1 %>
<% finall_issue_score = issue_score + issue_journal_score %>
<% new_count = @project.news.count %>
<% new_score = new_count * 0.1 %>
<% finall_new_score = new_score %>
<% document_count = @project.documents.count %>
<% file_score = document_count * 0.1 %>
<% finall_file_score = file_score %>
<% changeset_count = @project.changesets.count %>
<% code_submit_score = changeset_count * 0.3 %>
<% finall_code_submit_score = code_submit_score %>
<% board_message_count = 0 %>
<% @project.boards.each do |board| %>
<% board_message_count += board.messages_count %>
<% end %>
<% topic_score = board_message_count * 0.1 %>
<% finall_topic_score = topic_score %>
<% finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %>
<% if @project.project_type !=1 %>
<%= l(:label_project_grade)%>:
<span >
<%= link_to(format("%.2f" , finall_project_score ).to_f,
<%= link_to(format("%.2f" , project_scores(@project) ).to_i,
{:controller => 'projects',
:action => 'show_projects_score',
:remote => true, :id => @project.id}, :style=>"color: #EC6300;") %>

View File

@ -1,36 +1,10 @@
<!-- added by bai -->
<% issue_count = @project.issues.count %>
<% issue_journal_count = @project.issue_changes.count %>
<% issue_score = issue_count * 0.2 %>
<% issue_journal_score = issue_journal_count * 0.1 %>
<% finall_issue_score = issue_score + issue_journal_score %>
<% new_count = @project.news.count %>
<% new_score = new_count * 0.1 %>
<% finall_new_score = new_score %>
<% document_count = @project.documents.count %>
<% file_score = document_count * 0.1 %>
<% finall_file_score = file_score %>
<% changeset_count = @project.changesets.count %>
<% code_submit_score = changeset_count * 0.3 %>
<% finall_code_submit_score = code_submit_score %>
<% board_message_count = 0 %>
<% @project.boards.each do |board| %>
<% board_message_count += board.messages_count %>
<% end %>
<% topic_score = board_message_count * 0.1 %>
<% finall_topic_score = topic_score %>
<% finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %>
<%= l(:label_projects_score) %>
<div> = <%= l(:label_issue_score) %> + <%= l(:label_news_score) %> + <%= l(:label_file_score) %> +
<%= l(:label_code_submit_score) %> + <%= l(:label_topic_score) %></div>
<div> = <%= format("%.2f" , finall_issue_score).to_f %> + <%= format("%.2f" , finall_new_score).to_f %> +
<%= format("%.2f" , finall_file_score).to_f %> + <%= format("%.2f" , finall_code_submit_score).to_f %> +
<%= format("%.2f" , topic_score).to_f %></div>
<div> = <%= format("%.2f" , finall_project_score).to_f %></div>
<div> = <%= format("%.2f" , issue_score(@project)).to_i %> + <%= format("%.2f" , news_score(@project)).to_i %> +
<%= format("%.2f" , document_score(@project)).to_i %> + <%= format("%.2f" , changesets_score(@project)).to_i %> +
<%= format("%.2f" , board_message_score(@project)).to_i %></div>
<div> = <%= format("%.2f" , project_scores(@project)).to_i %></div>
<!-- end -->

View File

@ -1,10 +1,4 @@
<!-- added by bai -->
<% board_message_count = 0 %>
<% @project.boards.each do |board| %>
<% board_message_count += board.messages_count %>
<% end %>
<% topic_score = board_message_count * 0.1 %>
<% finall_topic_score = topic_score %>
<div><%= l(:label_topic_number) %> * 0.1 = <%= board_message_count %> * 0.1 = <%= topic_score %></div>
<div><%= l(:label_topic_score) %> = <%= format("%.2f" , finall_topic_score).to_f %></div>
<div><%= l(:label_topic_number) %> * 2 = <%= board_message_num(@project) %> * 2 = <%= board_message_score(@project) %></div>
<div><%= l(:label_topic_score) %> = <%= format("%.2f" , board_message_score(@project)).to_i %></div>
<!-- end -->

View File

@ -1,30 +1,4 @@
<!-- added by bai -->
<% issue_count = @project.issues.count %>
<% issue_journal_count = @project.issue_changes.count %>
<% issue_score = issue_count * 0.2 %>
<% issue_journal_score = issue_journal_count * 0.1 %>
<% finall_issue_score = issue_score + issue_journal_score %>
<% new_count = @project.news.count %>
<% new_score = new_count * 0.1 %>
<% finall_new_score = new_score %>
<% document_count = @project.documents.count %>
<% file_score = document_count * 0.1 %>
<% finall_file_score = file_score %>
<% changeset_count = @project.changesets.count %>
<% code_submit_score = changeset_count * 0.3 %>
<% finall_code_submit_score = code_submit_score %>
<% board_message_count = 0 %>
<% @project.boards.each do |board| %>
<% board_message_count += board.messages_count %>
<% end %>
<% topic_score = board_message_count * 0.1 %>
<% finall_topic_score = topic_score %>
<% finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %>
<h3 class="title"><%= l(:label_projects_score) %></h3>
<div class="inf_user_image">
@ -40,7 +14,7 @@
<td width="35%">
<table>
<tr class="info_font"><td><%= l(:label_projects_score) %></td></tr>
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , finall_project_score ).to_f %></span></td></tr>
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , project_scores(@project) ).to_i %></span></td></tr>
</table>
</td>
</tr>
@ -51,27 +25,27 @@
<ul>
<li>
<%= link_to l(:label_projects_score), {:controller => 'projects', :action => 'show_projects_score', :remote => true}%> :
<%= format("%.2f" , finall_project_score ).to_f %>
<%= format("%.2f" , project_scores(@project) ).to_i %>
</li>
<li>
<%= link_to l(:label_issue_score), {:controller => 'projects', :action => 'issue_score_index', :remote => true}%> :
<%= format("%.2f" , finall_issue_score).to_f %>
<%= format("%.2f" , issue_score(@project)).to_i %>
</li>
<li>
<%= link_to l(:label_news_score), {:controller => 'projects', :action => 'news_score_index', :remote => true}%> :
<%= format("%.2f" , finall_new_score).to_f %>
<%= format("%.2f" , news_score(@project)).to_i %>
</li>
<li>
<%= link_to l(:label_file_score), {:controller => 'projects', :action => 'file_score_index', :remote => true}%> :
<%= format("%.2f" , finall_file_score).to_f %>
<%= format("%.2f" , document_score(@project)).to_i %>
</li>
<li>
<%= link_to l(:label_code_submit_score), {:controller => 'projects', :action => 'code_submit_score_index', :remote => true}%> :
<%= format("%.2f" , finall_code_submit_score).to_f %>
<%= format("%.2f" , changesets_score(@project)).to_i %>
</li>
<li>
<%= link_to l(:label_topic_score), {:controller => 'projects', :action => 'projects_topic_score_index', :remote => true}%> :
<%= format("%.2f" , finall_topic_score).to_f %>
<%= format("%.2f" , board_message_score(@project)).to_i %>
</li>
</ul>
</div>

View File

@ -1,30 +1,5 @@
<!-- added by bai -->
<% issue_count = @project.issues.count %>
<% issue_journal_count = @project.issue_changes.count %>
<% issue_score = issue_count * 0.2 %>
<% issue_journal_score = issue_journal_count * 0.1 %>
<% finall_issue_score = issue_score + issue_journal_score %>
<% new_count = @project.news.count %>
<% new_score = new_count * 0.1 %>
<% finall_new_score = new_score %>
<% document_count = @project.documents.count %>
<% file_score = document_count * 0.1 %>
<% finall_file_score = file_score %>
<% changeset_count = @project.changesets.count %>
<% code_submit_score = changeset_count * 0.3 %>
<% finall_code_submit_score = code_submit_score %>
<% board_message_count = 0 %>
<% @project.boards.each do |board| %>
<% board_message_count += board.messages_count %>
<% end %>
<% topic_score = board_message_count * 0.1 %>
<% finall_topic_score = topic_score %>
<% finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %>
<head>
<meta charset="utf-8" />
<title><%= h html_title %></title>
@ -56,7 +31,7 @@
<td width="35%">
<table>
<tr class="info_font"><td><%= l(:label_projects_score) %></td></tr>
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , finall_project_score ).to_f %></span></td></tr>
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , project_scores(@project) ).to_i %></span></td></tr>
</table>
</td>
</tr>
@ -67,27 +42,27 @@
<ul>
<li>
<%= link_to l(:label_projects_score), {:controller => 'projects', :action => 'show_projects_score', :remote => true}%> :
<%= format("%.2f" , finall_project_score ).to_f %>
<%= format("%.2f" , project_scores(@project) ).to_i %>
</li>
<li>
<%= link_to l(:label_issue_score), {:controller => 'projects', :action => 'issue_score_index', :remote => true}%> :
<%= format("%.2f" , finall_issue_score).to_f %>
<%= format("%.2f" , issue_score(@project)).to_i %>
</li>
<li>
<%= link_to l(:label_news_score), {:controller => 'projects', :action => 'news_score_index', :remote => true}%> :
<%= format("%.2f" , finall_new_score).to_f %>
<%= format("%.2f" , news_score(@project)).to_i %>
</li>
<li>
<%= link_to l(:label_file_score), {:controller => 'projects', :action => 'file_score_index', :remote => true}%> :
<%= format("%.2f" , finall_file_score).to_f %>
<%= format("%.2f" , document_score(@project)).to_i %>
</li>
<li>
<%= link_to l(:label_code_submit_score), {:controller => 'projects', :action => 'code_submit_score_index', :remote => true}%> :
<%= format("%.2f" , finall_code_submit_score).to_f %>
<%= format("%.2f" , changesets_score(@project)).to_i %>
</li>
<li>
<%= link_to l(:label_topic_score), {:controller => 'projects', :action => 'projects_topic_score_index', :remote => true}%> :
<%= format("%.2f" , finall_topic_score).to_f %>
<%= format("%.2f" , board_message_score(@project)).to_i %>
</li>
</ul>
</div>

View File

@ -11,13 +11,14 @@
</p>
<p><%= f.check_box :is_default, :label => :field_repository_is_default %></p>
<p><%= f.text_field :identifier, :required => true, :disabled => @repository.identifier_frozen? %>
<p style="display: none"><%= f.text_field :identifier, :required => true, :disabled => @repository.identifier_frozen?,
value:"#{User.current.id.to_s + '_' +format_time(Time.now).to_s}"%>
<% unless @repository.identifier_frozen? %>
<em class="info" ><%= l(:text_length_between, :min => 1, :max => Repository::IDENTIFIER_MAX_LENGTH) %> <%= l(:text_repository_identifier_info).html_safe %></em>
<% end %></p>
<!--Modified by tanxianbo-->
<p><%= f.text_field :url, :size => 60, :required => true, :disabled => !@repository.safe_attribute?('url') %>
<p><%= f.text_field :url, :size => 60, :required => true, :disabled => !@repository.safe_attribute?('url'), :id => "url_text_field" %>
<em class='info'><%= "#{l(:label_exist_repository_path)}" %></em>
</p>
<p><%= f.text_field :login, :size => 30 %></p>
@ -27,6 +28,7 @@
</div>
<!--Ended by tanxianbo-->
<p>
<%= submit_tag(@repository.new_record? ? l(:button_create) : l(:button_save)) %>
<%#= submit_tag(@repository.new_record? ? l(:button_create) : l(:button_save)) %>
<input type="button" class="enterprise" value="<%= @repository.new_record? ? l(:button_create) : l(:button_save) %>" onclick="createVersion();"/>
<%= link_to l(:button_cancel), settings_project_path(@project, :tab => 'repositories') %>
</p>

View File

@ -5,7 +5,12 @@ background-color:gray;
border:none
}
</style>
<script type="text/javascript">
window.onload = function() {
document.getElementById("googleinputcache").remove();
document.getElementById("repository_identifier").setAttribute("type","text");
}
</script>
<%= error_messages_for 'repository' %>
<div class="box tabular">
@ -22,7 +27,10 @@ border:none
<% end %>
</p>
<p><%= f.check_box :is_default, :label => :field_repository_is_default %></p>
<p><%= f.text_field :identifier, :required=>true, :disabled => @repository.identifier_frozen?, :label => l(:label_repository_name)%>
<p>
<input id="googleinputcache" size="30" type="text">
<%= f.text_field :identifier,:required=>true,:type=>"hidden", :disabled => @repository.identifier_frozen?, :label => l(:label_repository_name)%>
<% unless @repository.identifier_frozen? %>
<em class="info"><%= l(:text_length_between, :min => 1, :max => Repository::IDENTIFIER_MAX_LENGTH) %>
<%= l(:text_repository_identifier_info).html_safe %></em>

View File

@ -1,5 +1,23 @@
<h3><%= l(:label_repository_new) %></h3>
<script type="text/javascript">
//var re=new RegExp(strRegex);
function createVersion(){
var re =new RegExp("^(https|http|file|svn)[?:]{1}/{1}/{1}.*$");
var strRegex = /^([https|http|file|svn]:){1}.*$/;
var name = $("#url_text_field").val();
if(name == "")
{
alert("URL不能为空");
return;
}
else if(!re.test(name))
{
alert("URL路径不正确");
return;
}
$("#repository-form").submit();
}
</script>
<%= labelled_form_for :repository, @repository, :url => project_repositories_path(@project), :html => {:id => 'repository-form'} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>

View File

@ -71,6 +71,12 @@
})
}
function word_keydown(e){
if(e&& e.keyCode==13){
ssearch();
}
}
</script>
<div>
@ -85,7 +91,7 @@
<li style="width: 40%; float: left">请选择省份:
<select id="province" name="province" onchange="get_school(this.value)"></select>
</li>
<li style="width: 50%; float: left"><input type="text" id="key_word" name="key_word" />
<li style="width: 50%; float: left"><input type="text" id="key_word" name="key_word" onkeydown="word_keydown(event);"/>
<input type="button" class="enterprise" value="搜索" onclick="ssearch()"></li>
</ul>

View File

@ -113,7 +113,7 @@
<%= render :partial => 'attachments/form' %>
</p>
<p style="font-size: 10px">1、<%=l(:label_upload_softapplication_packets_mustpacketed)%><br>2、<%=l(:label_upload_softapplication_photo_condition)%></p>
<p style="font-size: 10px; color: red"><%=l(:label_updated_caution)%></p>
<!-- p style="font-size: 10px; color: red"><%#=l(:label_updated_caution)%></p-->
</fieldset>
</fieldset></br>

View File

@ -43,6 +43,7 @@
<% (Rails.logger.error "[Error] =========================================================> NameError: uninitialized constant " + e.act_type.to_s; next;) if e.act_type.safe_constantize.nil? %>
<% act = e.act %>
<% unless act.nil? %>
<% if e.act_type == 'JournalsForMessage' || e.act_type == 'Bid' || e.act_type == 'Journal'|| e.act_type == 'Changeset' || e.act_type == 'Message' || e.act_type == 'Principal' || e.act_type == 'News' || e.act_type == 'Issue' || e.act_type == 'Contest'%>
<table width="660" border="0" align="left" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
<tr>
<td colspan="2" valign="top" width="50"><%= image_tag(url_to_avatar(e.user), :class => "avatar") %></td>
@ -278,12 +279,15 @@
<% end %>
</tr>
<tr>
<td colspan="2" width="580">
<td colspan="2" width="580" style="WORD-BREAK: break-all; WORD-WRAP: break-word">
<!--
<div class="issue-list-description">
<div class="wiki">
</div>
</div>
-->
<%= textilizable act, :description %>
</div>
</div>
<!-- <p class="font_description"> <%#= textilizable(act.description) %> </p> -->
</td>
</tr>
@ -320,12 +324,14 @@
</div>
</tr>
<% else %>
<% f=1 %>
<%# f=1 %>
<% end %><!-- < % #case end %> -->
</table>
</td>
</tr>
</table>
<% end %>
<% end %><!-- < % #unless act.nil? end %> -->
<% end %><!-- < % #@activity.each do |e| end%> -->

View File

@ -173,7 +173,7 @@
<% end %>
</div>
<div style="float: left;margin:5px; margin-left: 12px; margin-bottom: 2px; width: 380px;">
<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 />

View File

@ -92,15 +92,15 @@
</ul>
<ul class="d-p-projectlist">
<h1></h1>
<% if User.current.logged? %>
<h1></h1>
<p id="errorExplanation">
该学校未开设任何课程,您可以查看其他学校课程
</p>
<h1></h1>
<% end %>
<h1></h1>
<% find_all_new_hot_course(9, @school_id).map do |course| %>
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s.gsub(/<\/?.*?>/,"") %>>
<div class='avatar'>
@ -123,7 +123,7 @@
<div class='desc_item text_nowrap'>
[<%= get_course_term course %>]
<%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
(<%= "#{studentCount(course)}人" %>)
(<%= "#{memberCount(course)}人" %>)
<% files_count = course.attachments.count.to_s %>
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
</div>
@ -164,18 +164,20 @@
<div class='desc_item text_nowrap'>
[<%= get_course_term course %>]
<%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
(<%= "#{studentCount(course)}人" %>)
(<%= "#{memberCount(course)}人" %>)
<% files_count = course.attachments.count.to_s %>
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
</div>
<!--
<div class='join_course_link'>
<% if !course_endTime_timeout?(course) %>
<%# if !course_endTime_timeout?(course) %>
<div>
<%= join_in_course(course, User.current) %>
<%#= join_in_course(course, User.current) %>
</div>
<% end %>
<%# end %>
</div>
-->
</li>
<%end%>
<% end; reset_cycle %>
@ -209,7 +211,7 @@
<div class='desc_item text_nowrap'>
[<%= get_course_term course %>]
<%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
(<%= "#{studentCount(course)}人" %> )
(<%= "#{memberCount(course)}人" %> )
<% files_count = course.attachments.count.to_i.to_s %>
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
</div>

View File

@ -79,33 +79,7 @@
<span class='font_lighter' title ='<%=project.short_description%>'><%=project.description.truncate(100, omission: '...')%></span>
</div>
<div >
<%# issue_count = project.issues.count %>
<%# issue_journal_count = project.issue_changes.count %>
<%# issue_score = issue_count * 0.2 %>
<%# issue_journal_score = issue_journal_count * 0.1 %>
<%# finall_issue_score = issue_score + issue_journal_score %>
<%# new_count = project.news.count %>
<%# new_score = new_count * 0.1 %>
<%# finall_new_score = new_score %>
<%# document_count = project.documents.count %>
<%# file_score = document_count * 0.1 %>
<%# finall_file_score = file_score %>
<%# changeset_count = project.changesets.count %>
<%# code_submit_score = changeset_count * 0.3 %>
<%# finall_code_submit_score = code_submit_score %>
<%# board_message_count = 0 %>
<%# project.boards.each do |board| %>
<%# board_message_count += board.messages_count %>
<%# end %>
<%# topic_score = board_message_count * 0.1 %>
<%# finall_topic_score = topic_score %>
<%# finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %>
<%= content_tag "span", l(:label_project_score)+ ":" + project_score(project),
<%= content_tag "span", l(:label_project_score)+ ":" + project_scores(project).to_s,
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300;",
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
:class => "tooltip",

View File

@ -16,6 +16,9 @@
<%= 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>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor02');</script-->
<% if @page.safe_attribute_names.include?('parent_id') && @wiki.pages.any? %>
<%= fields_for @page do |fp| %>
<p>

View File

@ -1,5 +1,10 @@
<%= wiki_page_breadcrumb(@page) %>
<script type="text/javascript" language="javascript">
$(document).ready(function($) {
var label=$("#wiki_page_redirect_existing_links").prev().prev();
label.css("margin-left","-165px");
});
</script>
<h3><%= h @original_title %></h3>
<%= error_messages_for 'page' %>

File diff suppressed because it is too large Load Diff

View File

@ -630,7 +630,7 @@ zh:
#by huang # modified by bai
label_college: 高校进入
label_enter_college: 进入高校
label_enterprise: 企业进入
#label_enterprise: 企业进入
lable_enter_enterprise: 进入企业
label_term: 开课学期
label_spring: 春季学期
@ -1557,7 +1557,7 @@ zh:
label_welcome_page_to: 参与了 %{project_count} 个项目!
label_repository_path_not_null: 库路径 不能为空字符
label_password_not_null: 密码不能设置为空。
label_exist_repository_path: 定义已有版本库URL路径定义格式file:///, http://, https://, svn://
label_exist_repository_path: 定义已有版本库URL路径定义格式file://, http://, https://, svn://
label_project_no_activity: 该项目暂无动态!
label_course_homework_un: 暂未发布任何作业
label_follow_no_requirement: 暂未关注任何需求!
@ -1975,7 +1975,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 每张小于5M
label_updated_caution: 注意:若编辑参赛作品,则之前上传的软件包和截图都将被删除,请重新上传!
label_softapplication_name: 应用名称
label_work_name: 作品名称
@ -2016,6 +2016,7 @@ zh:
label_contest_work_list: 参赛作品列表
label_attending_contest: 我要参赛
label_contest_notification: 竞赛通知
label_company_name: 企业名
label_coursefile_sharingarea: 课程资源共享区
label_sort_by_activity: 按动态数排序

View File

@ -83,6 +83,10 @@ RedmineApp::Application.routes.draw do
end
end
#resources :notificationcomments do
#
#end
#resources :contestnotifications, :only => [:index, :show, :edit, :update, :destroy]
# match '/contestnotifications/:id/notificationcomments', :to => 'notificationcomments#create', :via => :post
# match '/contestnotifications/:id/notificationcomments/:notificationcomment_id', :to => 'notificationcomments#destroy', :via => :delete
@ -91,7 +95,9 @@ RedmineApp::Application.routes.draw do
resources :contests, only: [:index] do
resources :contestnotifications do
# get 'preview', on: :collection
resources :notificationcomments
resources :notificationcomments do
end
end
collection do

View File

@ -0,0 +1,20 @@
# -*coding:utf-8 -*-
class ChangeBoardsName < ActiveRecord::Migration
def up
boards = Board.where("project_id <> -1 and name like '%课程讨论区%'")
boards.each do |board|
board.name = "项目讨论区"
board.description = "项目讨论区"
board.save(:validate => false)
end
end
def down
boards = Board.where("project_id <> -1 and name like '%项目讨论区%'")
boards.each do |board|
board.name = " 课程讨论区"
board.description = " 课程讨论区"
board.save(:validate => false)
end
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 => 20140730024419) do
ActiveRecord::Schema.define(:version => 20140801034242) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -177,6 +177,58 @@ ActiveRecord::Schema.define(:version => 20140730024419) do
add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
create_table "code_review_assignments", :force => true do |t|
t.integer "issue_id"
t.integer "change_id"
t.integer "attachment_id"
t.string "file_path"
t.string "rev"
t.string "rev_to"
t.string "action_type"
t.integer "changeset_id"
end
create_table "code_review_project_settings", :force => true do |t|
t.integer "project_id"
t.integer "tracker_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "updated_by"
t.boolean "hide_code_review_tab", :default => false
t.integer "auto_relation", :default => 1
t.integer "assignment_tracker_id"
t.text "auto_assign"
t.integer "lock_version", :default => 0, :null => false
t.boolean "tracker_in_review_dialog", :default => false
end
create_table "code_review_user_settings", :force => true do |t|
t.integer "user_id", :default => 0, :null => false
t.integer "mail_notification", :default => 0, :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "code_reviews", :force => true do |t|
t.integer "project_id"
t.integer "change_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "line"
t.integer "updated_by_id"
t.integer "lock_version", :default => 0, :null => false
t.integer "status_changed_from"
t.integer "status_changed_to"
t.integer "issue_id"
t.string "action_type"
t.string "file_path"
t.string "rev"
t.string "rev_to"
t.integer "attachment_id"
t.integer "file_count", :default => 0, :null => false
t.boolean "diff_all"
end
create_table "comments", :force => true do |t|
t.string "commented_type", :limit => 30, :default => "", :null => false
t.integer "commented_id", :default => 0, :null => false
@ -796,7 +848,7 @@ ActiveRecord::Schema.define(:version => 20140730024419) do
t.integer "osp_id"
t.integer "parent_id"
t.string "subject", :null => false
t.text "content", :null => false
t.text "content", :limit => 16777215, :null => false
t.integer "author_id"
t.integer "replies_count", :default => 0
t.integer "last_reply_id"
@ -884,6 +936,7 @@ ActiveRecord::Schema.define(:version => 20140730024419) do
t.datetime "updated_at", :null => false
t.integer "project_id"
t.integer "user_id"
t.string "description"
end
create_table "softapplications", :force => true do |t|
@ -989,8 +1042,8 @@ ActiveRecord::Schema.define(:version => 20140730024419) do
t.integer "zip_code"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "identity"
t.string "technical_title"
t.integer "identity"
t.string "student_id"
t.string "teacher_realname"
t.string "student_realname"
@ -1048,9 +1101,6 @@ ActiveRecord::Schema.define(:version => 20140730024419) do
t.integer "active"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "level"
t.integer "file"
t.integer "issue"
end
create_table "user_statuses", :force => true do |t|

View File

@ -0,0 +1,17 @@
# -*coding:utf-8 -*-
desc "project score Initialize"
task :project_score do
puts "project_score sync."
end
namespace :project_score do
desc "calculating first page"
task :calculate => :environment do
include ProjectScoreHelper
Project.where("project_type != 1").all.each do |project|
result = project_scores(project)
puts "score of #{project.name} is #{result}"
end
puts "calculate completed"
end
end

View File

@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class CodeReviewController < ApplicationController
layout "project_base"
unloadable
before_filter :find_project, :authorize, :find_user, :find_setting, :find_repository

View File

@ -489,6 +489,7 @@ color: #000000;
margin-bottom: 30px;
border-right:1px solid #C6E9F1;
overflow:auto;
word-wrap:break-word;
/*by young*/
-moz-box-shadow:#C6E9F1 1px 1px 2px;
-webkit-box-shadow:2px 2px 0px -2px #C6E9F1;
@ -903,6 +904,7 @@ hr
p
{
font-size: 13px;
word-break: break-all;
/*position: static;/*gcm*/
}
/*end*/
@ -1068,10 +1070,10 @@ overflow: hidden;
.information {
margin-top: 20px;
margin-left: 607px;
margin-left: 690px;
float: left;
height: auto;
width: 300px;
width: 280px;
font-family: '微软雅黑',helvetica,arial,sans-serif; /*modify by men*/
color: rgb(0, 0, 0);
font-size: 13px;
@ -1230,7 +1232,7 @@ p.stats {
.licences {
float: left;
height: 18px;
width: 260px;
width: 200px;
font-size: 13px;
font-family: '微软雅黑',helvetica,arial,sans-serif; /*modify by men*/
line-height: 18px;