Merge branch 'szzh' into develop

This commit is contained in:
sw 2014-08-28 14:40:59 +08:00
commit 9c4ed9c8f9
45 changed files with 407 additions and 206 deletions

View File

@ -55,12 +55,15 @@ class AvatarController < ApplicationController
# saved = @avatar.save
begin
f = Magick::ImageList.new(diskfile)
# gif格式不再做大小处理
if f.format != 'GIF'
width = 300.0
proportion = (width/f[0].columns)
height = (f[0].rows*proportion)
f.resize_to_fill!(width,height)
# f.scale!(width,height)
f.write(diskfile)
end
rescue Exception => e
logger.error "[Error] avatar : avatar_controller#upload ===> #{e}"
end

View File

@ -502,45 +502,7 @@ class CoursesController < ApplicationController
end
def get_course_activity courses, activities
@course_ids=activities.keys()
days = Setting.activity_days_default.to_i
date_to ||= Date.today + 1
date_from = date_to - days-1.years
#file_count
Attachment.where(container_id: @course_ids, container_type: Course).where("created_on>?", date_from).each do |attachment|
activities[attachment.container_id]+=1
end
#message_count
Board.where(course_id: @course_ids).each do |board|
# activities[board.course_id]+=1
activities[board.course_id]+=board.messages.where("updated_on>?", date_from).count
end
#news
News.where(course_id: @course_ids).where("created_on>?",date_from).each do |news|
activities[news.course_id]+=1
end
#feedbackc_count
JournalsForMessage.where(jour_id: @course_ids, jour_type: Course).each do |jourformess|
activities[jourformess.jour_id]+=1
end
#activities!=0
i=0;
courses.each do |course|
id=course.id
if activities[id]==0
activities[id]=1
end
end
return activities
end
def toggleCourse
@course_prefs = Course.find_by_extra(@course.extra)
@ -643,6 +605,15 @@ class CoursesController < ApplicationController
events = @activity.events(@date_from, @date_to, :is_public => 1)
end
# 无新动态时,显示老动态
if events.count == 0
if User.current.member_of_course?(@course)|| User.current.admin?
events = @activity.events
else
events = @activity.events(:is_public => 1)
end
end
@offset, @limit = api_offset_and_limit({:limit => 10})
@events_count = events.count
@events_pages = Paginator.new @events_count, @limit, params['page']

View File

@ -57,36 +57,45 @@ class FilesController < ApplicationController
elsif params[:course_id]
@isproject = false
sort = ""
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
params[:sort].split(",").each do |sort_type|
order_by = sort_type.split(":")
case order_by[0]
when "filename"
attribute = "filename"
when "size"
attribute = "filesize"
when "attach_type"
attribute = "attachtype"
when "content_type"
attribute = "created_on"
when "field_file_dense"
attribute = "is_public"
when "downloads"
attribute = "downloads"
when "created_on"
attribute = "created_on"
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"
if order_by.count == 1
sort += "#{Attachment.table_name}.#{attribute} desc "
elsif order_by.count == 2
sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
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)]
if sort_type != params[:sort].split(",").last
sort += ","
end
end
end
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
show_attachments @containers
render :layout => 'base_courses'
end
end
def new
@ -226,6 +235,7 @@ class FilesController < ApplicationController
elsif @course
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)]
end
show_attachments @containers
@attachtype = params[:type].to_i
@contenttype = params[:contentType].to_s

View File

@ -42,7 +42,7 @@ class ProjectsController < ApplicationController
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
before_filter :file, :statistics, :watcherlist
before_filter :find_project_repository, :only => [:show]
#before_filter :find_project_repository, :only => [:show]
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去
before_filter :memberAccess, only: :member
@ -106,7 +106,7 @@ class ProjectsController < ApplicationController
def index
#调用存储过程更新提交次数
ActiveRecord::Base.connection.execute("CALL sp_project_status_cursor();")
#ActiveRecord::Base.connection.execute("CALL sp_project_status_cursor();")
#Modified by nie
@project_type = params[:project_type].to_i
per_page_option = 10
@ -594,6 +594,7 @@ class ProjectsController < ApplicationController
"show_news" => true,
"show_bids" => true,
"show_contests" => true,
"show_wiki_edits"=>true,
"show_journals_for_messages" => true
}
@date_to ||= Date.today + 1

View File

@ -21,7 +21,7 @@ class TrackersController < ApplicationController
before_filter :require_admin, :except => :index
before_filter :require_admin_or_api_request, :only => :index
accept_api_auth :index
include CoursesHelper
def index
respond_to do |format|
format.html {
@ -37,8 +37,13 @@ class TrackersController < ApplicationController
def new
@tracker ||= Tracker.new(params[:tracker])
@trackers = Tracker.sorted.all
@projects = Project.all
@projects = Project.where("project_type = #{Project::ProjectType_project}").all
@courses = Course.all
@course_activity_count=Hash.new
@courses.each do |course|
@course_activity_count[course.id]=0
end
@course_activity_count=get_course_activity @courses,@course_activity_count
end
def create
@ -58,7 +63,8 @@ class TrackersController < ApplicationController
def edit
@tracker ||= Tracker.find(params[:id])
@projects = Project.all
@projects = Project.where("project_type = #{Project::ProjectType_project}").all
@courses = Course.all
end
def update

View File

@ -46,6 +46,7 @@ class UsersController < ApplicationController
#william
before_filter :require_login, :only => [:tag_save,:tag_saveEx]
#before_filter :refresh_changests, :only =>[:user_activities,:user_courses,:user_projects,:user_newfeedback]
helper :sort
@ -68,6 +69,17 @@ class UsersController < ApplicationController
# fq
helper :words
def refresh_changests
if !(@user.nil?) && !(@user.memberships.nil?)
@user.memberships.each do |member|
unless member.project.nil?
member.project.repository.fetch_changesets if Setting.autofetch_changesets?
end
end
end
end
#added by young
def user_projects

View File

@ -151,7 +151,7 @@ class WelcomeController < ApplicationController
def entry_select
#@first_page = FirstPage.where("page_type = 'project'").first
url = request.original_url.gsub('/','')
if url.include?(Setting.host_course)
if url.include?(Setting.host_course.gsub('/',''))
if @first_page.show_course == 1
course
render :course
@ -160,7 +160,7 @@ class WelcomeController < ApplicationController
end
return 0
elsif url.include?(Setting.host_contest)
elsif url.include?(Setting.host_contest.gsub('/',''))
if @first_page.show_contest == 1
contest
render :contest
@ -169,7 +169,7 @@ class WelcomeController < ApplicationController
end
return 0
elsif url.include?(Setting.host_user)
elsif url.include?(Setting.host_user.gsub('/',''))
redirect_to(:controller => "users", :action => "index")
end

View File

@ -90,7 +90,6 @@ class WordsController < ApplicationController
end
def destroyJournal
@journalP=JournalsForMessage.find(params[:object_id])
@journalP.destroy

View File

@ -480,4 +480,45 @@ module CoursesHelper
type
end
#获取课程动态
def get_course_activity courses, activities
@course_ids=activities.keys()
days = Setting.activity_days_default.to_i
date_to ||= Date.today + 1
date_from = date_to - days-1.years
#file_count
Attachment.where(container_id: @course_ids, container_type: Course).where("created_on>?", date_from).each do |attachment|
activities[attachment.container_id]+=1
end
#message_count
Board.where(course_id: @course_ids).each do |board|
# activities[board.course_id]+=1
activities[board.course_id]+=board.messages.where("updated_on>?", date_from).count
end
#news
News.where(course_id: @course_ids).where("created_on>?",date_from).each do |news|
activities[news.course_id]+=1
end
#feedbackc_count
JournalsForMessage.where(jour_id: @course_ids, jour_type: Course).each do |jourformess|
activities[jourformess.jour_id]+=1
end
#activities!=0
i=0;
courses.each do |course|
id=course.id
if activities[id]==0
activities[id]=1
end
end
return activities
end
end

View File

@ -326,7 +326,7 @@ module IssuesHelper
if detail.property == 'attr' && detail.prop_key == 'description'
s = l(:text_journal_changed_no_detail, :label => label)
unless no_html
diff_link = link_to 'diff',
diff_link = link_to l(:label_diff),
{:controller => 'journals', :action => 'diff', :id => detail.journal_id,
:detail_id => detail.id, :only_path => options[:only_path]},
:title => l(:label_view_diff)

View File

@ -71,11 +71,24 @@ module ProjectScoreHelper
pss = ProjectScore.where("project_id = '#{project.id}'")
if pss.nil? || pss.count == 0
ps = ProjectScore.new
ps.issue_num = issue_num(project)
ps.board_message_num = board_message_num(project)
ps.changeset_num = changesets_num(project)
ps.documents_num = documents_num(project)
ps.issue_journal_num = issue_journal_num(project)
ps.news_num = news_num(project)
ps.score = result
ps.project = project
ps.save
else
ps = pss.first
ps.issue_num = issue_num(project)
ps.board_message_num = board_message_num(project)
ps.changeset_num = changesets_num(project)
ps.documents_num = documents_num(project)
ps.issue_journal_num = issue_journal_num(project)
ps.news_num = news_num(project)
ps.score = result
ps.save
end
@ -95,4 +108,15 @@ module ProjectScoreHelper
end
end
def get_project_score project
pss = ProjectScore.where("project_id = '#{project.id}'")
ps = nil
if pss.nil? || pss.count == 0
ps = nil
else
ps = pss.first
end
ps
end
end

View File

@ -63,7 +63,7 @@ class Changeset < ActiveRecord::Base
includes(:repository => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_changesets, *args))
}
after_create :scan_for_issues,:be_user_score # user_score
after_create :scan_for_issues,:refresh_changests#:be_user_score # user_score
after_update :be_user_score
after_destroy :down_user_score
before_create :before_create_cs
@ -305,12 +305,15 @@ class Changeset < ActiveRecord::Base
# update user score
def be_user_score
UserScore.project(:push_code, self.user,self, { changeset_id: self.id })
unless self.user.nil?
#更新用户等级
UserLevels.update_user_level(self.user)
update_changeset(self.user,1)
update_changeset(self.user,2,self.repository.project)
end
end
#积分刷新
def down_user_score
UserLevels.update_user_level(self.user)
@ -318,4 +321,11 @@ class Changeset < ActiveRecord::Base
update_changeset(self.user,2,self.repository.project)
end
#刷新本次提交补全相关信息如user_id等
def refresh_changests
unless self.repository.nil?
self.repository.fetch_changesets if Setting.autofetch_changesets?
end
end
end

View File

@ -1,4 +1,14 @@
class OptionNumber < ActiveRecord::Base
attr_accessible :attachment, :changeset, :document, :follow, :issue_done_ratio, :issues_status, :memo, :messages_for_issues, :post_issue, :praise_by_one, :praise_by_three, :praise_by_two, :replay_for_memo, :replay_for_message, :score_type, :total_score, :tread, :tread_by_one, :tread_by_three, :tread_by_two, :user_id
def self.get_user_option_number user_id
result = nil
unless user_id.nil?
ons = OptionNumber.find_all_by_user_id(user_id);
unless (ons .nil? && ons.count > 0)
result = ons.first
end
end
result
end
end

View File

@ -39,7 +39,8 @@ class Repository < ActiveRecord::Base
validates_length_of :password, :maximum => 255, :allow_nil => true
validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true
validates_presence_of :identifier#, :unless => Proc.new { |r| r.is_default? || r.set_as_default? }
validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true
#validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true
validates_uniqueness_of :identifier, :allow_blank => true
validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph)
# donwcase letters, digits, dashes, underscores but not digits only
validates_format_of :identifier, :with => /^[a-z0-9_\-]+$/, :allow_blank => true

View File

@ -32,6 +32,7 @@ class Tracker < ActiveRecord::Base
end
has_and_belongs_to_many :projects
has_and_belongs_to_many :courses
has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_trackers#{table_name_suffix}", :association_foreign_key => 'custom_field_id'
acts_as_list

View File

@ -37,7 +37,7 @@
<!-- <div class="borad-description"><%=h @board.description %></div> -->
<div class="borad-setitle">
<span class="borad-topic-count">共有 <%=link_to @topics.count %> 个贴子</span>
<span class="borad-topic-count">共有 <%=link_to @topic_count,:controller => 'boards',:action => 'index' %> 个贴子</span>
<span>
<%= link_to l(:label_message_new),
new_board_message_path(@board),

View File

@ -43,7 +43,7 @@
<!-- <div class="borad-description"><%= h @board.description %></div> -->
<div class="borad-setitle">
<span class="borad-topic-count">共有 <%= link_to @topics.count %> 个贴子</span>
<span class="borad-topic-count">共有 <%= link_to @topic_count,:controller => 'boards',:action => 'index' %> 个贴子</span>
<% if @project.enabled_modules.where("name = 'boards'").count > 0 %>
<span>
<%= link_to l(:label_message_new),

View File

@ -22,15 +22,22 @@
<%= error_messages_for 'bid' %>
<p><%= l(:label_homeworks_form_new_description) %></p>
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT %></p>
<p>
<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :onblur => "regexName();" %>
<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 => Bid::DESCRIPTION_LENGTH_LIMIT %></p>
</p>
<p><span id="bid_name_span"></span></p>
<p><%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %></p>
<!-- <p><%#= select_tag 'bid_reward_type', "<option value = '0'>#{l(:label_choose_reward)}</option><option value = '1'>#{l(:label_money)}</option><option value = '3'>#{l(:label_bids_credit)}</option><option value = '2'>#{l(:label_reward_1)}</option>".html_safe,
:onChange => "show('bid_reward_type', 'bid_budget', '"+l(:label_bids_reward_what)+"','"+l(:label_bids_new_money)+"','"+l(:label_bids_new_credit)+"','"+l(:label_bids_new_content)+"')" %>
<%#= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %>
</p> -->
<% time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') %>
<p><%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}",:readonly => "readonly") %><%= calendar_for('bid_deadline')%>
<p><%= f.text_field(:deadline, :required => true, :size => 60, :style => "width:150px;",:value => "#{time}", :onchange => "regexDeadLine();") %><%= calendar_for('bid_deadline')%>
<span id="bid_deadline_span">
</span>
</p>
<p><%= f.select :is_evaluation, is_evaluation_option %>
</p>

View File

@ -1,9 +1,60 @@
<script type="text/javascript">
function regexName()
{
var name = $("#bid_name").val();
if(name=="")
{
$("#bid_name_span").text("名称不能为空");
$("#bid_name_span").css('color','#ff0000');
return false;
}
else
{
$("#bid_name_span").text("填写正确");
$("#bid_name_span").css('color','#008000');
return true;
}
}
function regexDeadLine()
{
var deadline = $("#bid_deadline").val();
var regex = /^\d{4}-\d{2}-\d{2}$/;
if(deadline=="")
{
$("#bid_deadline_span").text("截止日期不能为空");
$("#bid_deadline_span").css('color','#ff0000');
return false;
}
else if(regex.test(deadline))
{
$("#bid_deadline_span").text("填写正确");
$("#bid_deadline_span").css('color','#008000');
return true;
}
else
{
$("#bid_deadline_span").text("截止日期格式错误");
$("#bid_deadline_span").css('color','#ff0000');
return false;
}
}
function submitHomework()
{
if(regexDeadLine()&&regexName())
{
$("#new_bid").submit();
}
}
</script>
<h3><%=l(:label_course_new_homework)%></h3>
<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
<div class="box tabular">
<%= render :partial => 'homework_form', :locals => { :f => f } %>
<%= submit_tag l(:button_create), :class => "enterprise" %>
<input type="button" onclick="submitHomework();" value="<%= l(:button_create)%>" class="enterprise">
<%= javascript_tag "$('#bid_name').focus();" %>
<% end %>
</div>

View File

@ -37,7 +37,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.nil? ? l(:lable_unknow_type):file.attachmentstype.typeName %></span>
&nbsp;
<span id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;">
<%= render :partial => 'attachments/course_type_edit', :locals => {:attachmenttypes => attachmenttypes,

View File

@ -37,7 +37,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.nil? ? l(:lable_unknow_type):file.attachmentstype.typeName %></span>
&nbsp;
<span id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;">
<%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes,

View File

@ -37,21 +37,21 @@
<!--
<fieldset class="collapsible collapsed">
<legend onclick="toggleFieldset(this);">
<%= l(:label_options) %>
<%#= l(:label_options) %>
</legend>
<div style="display: none;">
<table>
<tr>
<td><%= l(:field_column_names) %></td>
<td><%= render_query_columns_selection(@query) %></td>
<td><%#= l(:field_column_names) %></td>
<td><%#= render_query_columns_selection(@query) %></td>
</tr>
<tr>
<td><label for='group_by'><%= l(:field_group_by) %></label></td>
<td><%= select_tag('group_by', options_for_select([[]] + @query.groupable_columns.collect { |c| [c.caption, c.name.to_s] }, @query.group_by)) %></td>
<td><%#= select_tag('group_by', options_for_select([[]] + @query.groupable_columns.collect { |c| [c.caption, c.name.to_s] }, @query.group_by)) %></td>
</tr>
<tr>
<td><%= l(:button_show) %></td>
<td><%= available_block_columns_tags(@query) %></td>
<td><%#= l(:button_show) %></td>
<td><%#= available_block_columns_tags(@query) %></td>
</tr>
</table>
</div>

View File

@ -1,7 +1,7 @@
<h3><%=h @issue.tracker %> #<%= @issue.id %></h3>
<p><%= authoring @journal.created_on, @journal.user, :label => :label_updated_time_by %></p>
<div class="text-diff">
<div class="text-diff" style="word-break: break-all;width: 100%;">
<%= simple_format_without_paragraph @diff.to_html %>
</div>

View File

@ -92,33 +92,6 @@
<% end %></td>
</tr>
<!-- 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 %>
<!-- modified by zjc 新得分显示 -->
<tr><td class="score">
<div id="score_div">
<%= render :partial => 'users/user_score', :locals => {:user => @user}%>

View File

@ -32,7 +32,7 @@
<%= f.select :board_id, boards_options_for_select(@message.course.boards) %></p>
<% end %>
<% end %>
<div id="message_quote" class="wiki"></div>
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all"></div>
<%= text_area :quote,:quote,:style => 'display:none' %>
<p>

View File

@ -4,7 +4,7 @@
<%= course_board_breadcrumb(@message) %>
<% end %>
<h3><%= avatar(@topic.author, :size => "24") %><%=h @topic.subject %></h3>
<h3><%= avatar(@topic.author, :size => "24") %><span style = "width:100%;word-break:break-all;"><%=h @topic.subject %></span></h3>
<%= form_for @message, {
:as => :message,

View File

@ -37,6 +37,17 @@
<td><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_not_treed_over) %></td>
</tr>
</table>
<% else %>
<!-- 积分少于2分不能踩帖 -->
<% if OptionNumber.get_user_option_number(user_id).nil? || OptionNumber.get_user_option_number(user_id).total_score < 2 %>
<table style="line-height: 1px">
<tr>
<td ><%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),
:controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %></td>
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
<td><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issues_score_not_enough) %></td>
</tr>
</table>
<% else %>
<table style="line-height: 1px">
<tr>
@ -49,6 +60,8 @@
</table>
<% end %>
<% end %>
<!-- end -->
<% end %>
</div>
@ -104,6 +117,21 @@
<td><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_not_treed_over) %> </td>
</tr>
</table>
<% else %>
<% if OptionNumber.get_user_option_number(user_id).nil? || OptionNumber.get_user_option_number(user_id).total_score < 2 %>
<table style="line-height: 1px">
<tr>
<td > <%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),
:controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class ,:horizontal => horizontal %></td>
</tr>
<tr>
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
</tr>
<tr>
<td><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issues_score_not_enough) %> </td>
</tr>
</table>
<% else %>
<table style="line-height: 1px">
<tr>
@ -120,6 +148,8 @@
</table>
<% end %>
<% end %>
<!-- end -->
<% end %>
</div>

View File

@ -46,7 +46,7 @@
<tr>
<td style="width: 40%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
<!-- @project.repository.nil? || @project.project_status.nil? ? '0' : @project.project_status.changesets_count -->
<strong><%= content_tag('span', "#{changesets_num(@project)}", :class => "info") %></strong>
<strong><%= content_tag('span', "#{get_project_score(@project).nil? ? 0:get_project_score(@project).changeset_num}", :class => "info") %></strong>
</td>
<td style="width: 60%;text-align: left">
<%= content_tag('span', l(:label_commit_on)) %>
@ -87,7 +87,7 @@
<% end %>
</div>
<div class="add-info">
<div class="add-info-project">
<div class="main-language">
<!-- added by huang -->
<% if(@project.project_type==1)%>

View File

@ -85,7 +85,7 @@ function checkMaxLength() {
<% if User.current.logged? %>
<% if journal.user_id==User.current.id|| User.current.admin? %>
<%= link_to(l(:button_delete),{:controller => 'words', :action => 'destroyJournal', :object_id => journal.id, :project_id=>@project.id, :page=>@page},
:remote => true, :title => l(:button_delete)) %>
:remote => true, :title => l(:button_delete), :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete") %>
<% end %>
<% end %>
</span>

View File

@ -7,7 +7,7 @@
<% @events_by_day.keys.sort.reverse.each do |day| %>
<% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
<div class="activity-item underline-evreycontent" style="font-size: 14px;line-height:1.5em;">
<div class="activity-item underline-evreycontent" style="font-size: 14px;line-height:1.5em;width: 100%;word-break: break-all;">
<div class="activity-avatar" style="float: left; margin:3px; height: 100%;">
<%= image_tag(url_to_avatar(e.event_author), :class => "avatar") %>
</div>

View File

@ -52,7 +52,7 @@
<span class="font_title_tag"><%= l(:label_tag) %>:</span>
<% if User.current.logged? %>
<span><%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'name'} %></span>
<span><%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'tags_name'} %></span>
<% end %>
<div id="tags_show">
@ -62,7 +62,7 @@
<%= form_for "tag_for_save",:remote=>true,:url=>tag_path,
:update => "tags_show",
:complete => '$("#put-tag-form").hide();' do |f| %>
<%= f.text_field :name ,:id => "name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length %>
<%= f.text_field :name ,:id => "tags_name",:size=>"28",:require=>true,:maxlength => Setting.tags_max_length,:minlength=>Setting.tags_min_length %>
<%= f.text_field :object_id,:value=> obj.id,:style=>"display:none"%>
<%= f.text_field :object_flag,:value=> object_flag,:style=>"display:none"%>
<%= f.submit l(:button_project_tags_add),:class => "small" %>

View File

@ -22,7 +22,7 @@
<% i += 1 %>
<% end %>
<%= link_to l(:label_more_tags), :action => "show", :id => obj.id %>
<%= link_to l(:label_more_tags),:controller => "tags", :action => "show", :id => obj.id %>
<% else %>

View File

@ -1,6 +1,6 @@
<%= error_messages_for 'tracker' %>
<div class="splitcontentleft">
<div> <!-- class="splitcontentleft" -->
<div class="box tabular">
<!--[form:tracker]-->
<p><%= f.text_field :name, :required => true %></p>
@ -39,14 +39,27 @@
<%= submit_tag l(@tracker.new_record? ? :button_create : :button_save) %>
</div>
<div class="splitcontentright">
<div><!--class="splitcontentright" -->
<% if @projects.any? %>
<fieldset class="box" id="tracker_project_ids"><legend><%= l(:label_project_plural) %></legend>
<div style="overflow: scroll; height: 300px; width: 680px;">
<%= render_project_nested_lists(@projects) do |p|
content_tag('label', check_box_tag('tracker[project_ids][]', p.id, @tracker.projects.include?(p), :id => nil) + ' ' + h(p))
end %>
</div>
<%= hidden_field_tag('tracker[project_ids][]', '', :id => nil) %>
<p><%= check_all_links 'tracker_project_ids' %></p>
</fieldset>
<% end %>
<!-- <#% if @courses.any? %>
<fieldset class="box" id="tracker_course_ids"><legend><#%= l(:label_course_all) %></legend>
<#%= render_course_nested_lists(@courses) do |p|
content_tag('label', check_box_tag('tracker[course_ids][]', p.id, @tracker.projects.include?(p), :id => nil) + ' ' + h(p))
end %>
<#%= hidden_field_tag('tracker[course_ids][]', '', :id => nil) %>
<p><#%= check_all_links 'tracker_course_ids' %></p>
</fieldset>
<#% end %> -->
</div>

View File

@ -6,5 +6,9 @@
<!-- <div>&nbsp;&nbsp;&nbsp;+ <%#= l(:label_user_score_of_influence) %></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>
<% if (format("%.2f" ,collaboration(option_num)).to_i + format("%.2f" , influence(option_num) ).to_i + format("%.2f" , skill(option_num)).to_i + format("%.2f" , active(option_num)).to_i) < 0 %>
<div><%= l(:lable_score_less_than_zero) %></div>
<% else %>
<div> = <%= format("%.2f" ,option_num.total_score).to_i %></div>
<% end %>
<!-- end -->

View File

@ -1,32 +1,6 @@
<!-- added by bai -->
<div class="autoscroll">
<% for user in @users -%>
<!-- 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 %>
<!-- end -->
<div class="well">
<%= content_tag "p", "#{format_date(user.created_on)} #{l(:label_member_since)}", :class => "float_right member_since" %>

View File

@ -72,7 +72,7 @@
<% end %>
<tr>
<td colspan="2" width="580">
<p class="font_description"> <%= textilizable act.notes %> </p>
<p class="font_description"> <%= textAreailizable act.notes %> </p>
<div style="display: inline-block; float: right; margin-top: 0px"><span><%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %>
</span></div>
@ -113,7 +113,7 @@
</tr>
<tr>
<td colspan="2" width="580">
<p class="font_description"> <%= act.description.html_safe %> </p></td>
<p class="font_description"> <%=textAreailizable act, :description %> </p></td>
</tr>
<tr>
<td>
@ -141,7 +141,7 @@
<% if act.notes.nil? %>
<% desStr = '' %>
<% else %>
<% desStr=act.notes.html_safe %>
<% desStr= textAreailizable(act, :notes) %>
<% end %>
<td colspan="2" width="580"><p class="font_description"> <%= desStr %> </p>
</td>
@ -168,7 +168,7 @@
</tr>
<tr>
<td colspan="2" width="580">
<p class="font_description"> <%= act.long_comments.html_safe %> </p></td>
<p class="font_description"> <%= textAreailizable act,:long_comments %> </p></td>
</tr>
<tr>
<td>
@ -194,7 +194,7 @@
</tr>
<tr>
<td colspan="2" width="580">
<p class="font_description"> <%= h act.content.truncate(240, omission: '...') %> </p>
<p class="font_description"> <%= textAreailizable(act,:content) %> </p>
</td>
</tr>
<tr>
@ -242,7 +242,7 @@
</tr>
<tr>
<td colspan="2" width="580">
<p class="font_description"> <%= act.description.html_safe %> </p></td>
<p class="font_description"> <%= textAreailizable act,:description %> </p></td>
</tr>
<tr>
<td>
@ -287,7 +287,7 @@
</div>
</div>
-->
<%= textilizable act, :description %>
<%= textAreailizable act, :description %>
<!-- <p class="font_description"> <%#= textilizable(act.description) %> </p> -->
</td>
</tr>
@ -314,7 +314,7 @@
<% end %>
</tr>
<tr>
<td colspan="2" width="580"><p class="font_description"> <%= h act.description %> </p>
<td colspan="2" width="580"><p class="font_description"> <%= textAreailizable act, :description %> </p>
</td>
</tr>
<tr>
@ -384,7 +384,7 @@
</td>
</tr>
<tr>
<td colspan="2" width="580"><p class="font_description"> <%= textilizable e.notes %> </p></td>
<td colspan="2" width="580"><p class="font_description"> <%= textAreailizable e.notes %> </p></td>
</tr>
<tr>
<td align="left"><a class="font_lighter"></a></td>

View File

@ -22,6 +22,6 @@
%>, <%= format_time(@diff.content_to.updated_on) %>)</em>
</p>
<div class="text-diff">
<div class="text-diff" style=" width: 100%;word-break: break-all;">
<%= simple_format_without_paragraph @diff.to_html %>
</div>

View File

@ -1807,3 +1807,5 @@ en:
label_company_name: Company Name
notice_account_invalid_creditentials_new: You have not to the mailbox activation
lable_unknow_type: Unknow type
lable_score_less_than_zero: Score less than 0, revised to 0

View File

@ -1214,7 +1214,7 @@ zh:
notice_issue_successful_create: 问题 %{id} 已创建。
label_between: 介于
setting_issue_group_assignment: 允许问题被分配给组
label_diff: diff
label_diff: 查看差别
description_query_sort_criteria_direction: 排序方式
description_project_scope: 搜索范围
description_filter: 过滤器
@ -1589,6 +1589,7 @@ zh:
label_issue_tread_over: 我刚才踩过了~
label_issue_not_praise_over: 不能顶自己~
label_issue_not_treed_over: 不能踩自己~
label_issues_score_not_enough: 积分不够,不能踩别人~
#end
label_goto: 前往>>
label_issue_appraise_over: 只能评价一次哦!
@ -2113,4 +2114,6 @@ zh:
lable_memos_max_length: 帖子内容最大长度为65535个字符
lable_forums_max_length: 贴吧描述最大长度为65535个字符
lable_unknow_type: 未知类型
lable_score_less_than_zero: 得分小于0修正为0

View File

@ -652,6 +652,7 @@ RedmineApp::Application.routes.draw do
post 'words/append', :to => 'words#append'
post 'words/create_reply', :to => 'words#create_reply'
delete 'words/destroy', :to => 'words#destroy'
delete 'words/destroyJournal', :to => 'words#destroyJournal'
get 'words/more', :to => 'words#more'
get 'words/back', :to=> 'words#back'
get 'words/destroyJournal', :to => 'words#destroyJournal'

View File

@ -0,0 +1,19 @@
class ProjectScoreAddCloumn < ActiveRecord::Migration
def up
add_column("project_scores","issue_num",:integer,:default => 0)
add_column("project_scores","issue_journal_num",:integer,:default => 0)
add_column("project_scores","news_num",:integer,:default => 0)
add_column("project_scores","documents_num",:integer,:default => 0)
add_column("project_scores","changeset_num",:integer,:default => 0)
add_column("project_scores","board_message_num",:integer,:default => 0)
end
def down
remove_column("project_scores","issue_num")
remove_column("project_scores","issue_journal_num")
remove_column("project_scores","news_num")
remove_column("project_scores","documents_num")
remove_column("project_scores","changeset_num")
remove_column("project_scores","board_message_num")
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 => 20140814062455) do
ActiveRecord::Schema.define(:version => 20140826072838) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -437,9 +437,9 @@ ActiveRecord::Schema.define(:version => 20140814062455) do
t.string "web_title"
t.string "title"
t.text "description"
t.string "page_type"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "page_type"
t.integer "sort_type"
t.integer "show_course", :default => 1
t.integer "show_contest", :default => 1
@ -458,6 +458,26 @@ ActiveRecord::Schema.define(:version => 20140814062455) do
t.datetime "updated_at", :null => false
end
create_table "gitlab_projects", :force => true do |t|
t.integer "gitlab_project_id"
t.integer "project_id"
t.string "repository_url"
t.string "web_url"
t.string "localfile_url"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "gitlab_users", :force => true do |t|
t.integer "gitlab_user_id"
t.integer "user_id"
t.string "email"
t.string "password"
t.string "login", :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|
t.integer "group_id", :null => false
t.integer "user_id", :null => false
@ -795,6 +815,12 @@ ActiveRecord::Schema.define(:version => 20140814062455) do
t.integer "score"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "issue_num", :default => 0
t.integer "issue_journal_num", :default => 0
t.integer "news_num", :default => 0
t.integer "documents_num", :default => 0
t.integer "changeset_num", :default => 0
t.integer "board_message_num", :default => 0
end
create_table "project_statuses", :force => true do |t|

View File

@ -1634,7 +1634,7 @@ fieldset#filters td.field { width:230px; }
fieldset#filters td.operator { width:180px; }
fieldset#filters td.operator select {max-width:170px;}
fieldset#filters td.values { white-space:nowrap; }
fieldset#filters td.values select {min-width:130px;}
fieldset#filters td.values select {min-width:130px;max-width: 220px;}
fieldset#filters td.values input {height:1em;}
fieldset#filters td.add-filter { text-align: right; vertical-align: top; }
@ -1725,8 +1725,8 @@ ul.projects li {list-style-type:none;
#projects-index ul.projects div.root a.project {font-family:'微软雅黑', "Trebuchet MS", Verdana, sans-serif; font-weight: bold; font-size: 14px; margin: 0 0 10px 0; }
.my-project { padding-left: 18px; background: url(../images/fav.png) no-repeat 0 50%; }
#notified-projects ul, #tracker_project_ids ul {max-height:250px; overflow-y:auto;}
#notified-projects ul{max-height:250px; overflow-y:auto;}
#tracker_project_ids ul {max-height:250px; /*overflow-y:auto;*/}
#related-issues li img {vertical-align:middle;}
ul.properties {padding:0; font-size: 0.9em; color: #777;}

View File

@ -1071,14 +1071,14 @@ overflow: hidden;
.information {
margin-top: 20px;
margin-left: 690px;
float: left;
/*float: left;*/
height: auto;
width: 280px;
font-family: '微软雅黑',helvetica,arial,sans-serif; /*modify by men*/
color: rgb(0, 0, 0);
font-size: 13px;
line-height: 18px;
position: absolute;
/*position: absolute;*/
}
/*
a.project {
@ -1216,6 +1216,15 @@ p.stats {
padding-top: 10px;
}
.add-info-project {
/*float: left;*/
margin-top: 0px;
height: 20px;
width: 908px;
margin-bottom: 5px;
padding-top: 10px;
}
.main-language {
float: left;
height: 18px;