diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index c234eb17b..0b2ae02b3 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -60,7 +60,7 @@ class AttachmentsController < ApplicationController :disposition => (@attachment.image? ? 'inline' : 'attachment') end rescue => e - redirect_to "http://forge.trustie.net/file_not_found.html" + redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html" end #更新资源文件类型 diff --git a/app/controllers/avatar_controller.rb b/app/controllers/avatar_controller.rb index 3b43fec9c..73c1dbd90 100644 --- a/app/controllers/avatar_controller.rb +++ b/app/controllers/avatar_controller.rb @@ -25,7 +25,7 @@ class AvatarController < ApplicationController end end end - if @temp_file && (@temp_file.size > 0) + if @temp_file && (@temp_file.size > 0) diskfile=disk_filename(@source_type,@source_id) @urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file)) logger.info("Saving avatar '#{diskfile}' (#{@temp_file.size} bytes)") @@ -55,7 +55,7 @@ class AvatarController < ApplicationController # saved = @avatar.save begin f = Magick::ImageList.new(diskfile) - width = 300.0; + width = 300.0 proportion = (width/f[0].columns) height = (f[0].rows*proportion) f.resize_to_fill!(width,height) diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 991af0154..b54d98b8f 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -129,6 +129,7 @@ class ForumsController < ApplicationController format.html { redirect_to @forum, notice: l(:label_forum_create_succ) } format.json { render json: @forum, status: :created, location: @forum } else + flash.now[:error] = "#{l :label_forum_create_fail}: #{@forum.errors.full_messages[0]}" format.html { render action: "new" } format.json { render json: @forum.errors, status: :unprocessable_entity } end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index b357ac44f..92186710c 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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] # 除非项目内人员,不可查看成员, TODO: 完了写报表里去 before_filter :memberAccess, only: :member @@ -78,6 +78,14 @@ class ProjectsController < ApplicationController ### added by william include ActsAsTaggableOn::TagsHelper + def find_project_repository + unless @project.repositories.nil? + @project.repositories.each do |repository| + repository.fetch_changesets if Setting.autofetch_changesets? + end + end + end + def enterprise_course session[:enterprise_college] = 2 respond_to do |format| diff --git a/app/views/avatar/_avatar_form.html.erb b/app/views/avatar/_avatar_form.html.erb index fc55bd2ef..272397c62 100644 --- a/app/views/avatar/_avatar_form.html.erb +++ b/app/views/avatar/_avatar_form.html.erb @@ -42,17 +42,17 @@
- - <%= l(:button_upload_photo) %> + + <%= l(:button_upload_photo) %> - + <%= file_field_tag 'avatar[image]', :id => nil, :class => 'file_selector', :style => 'width:70px;',#added by young :size => "1", :multiple => false, - :onchange => 'addInputAvatar(this);', + :onchange => 'addInputAvatar(this);', :data => { :max_file_size => Setting.attachment_max_size.to_i.kilobytes, :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), @@ -61,7 +61,7 @@ :description_placeholder => nil ,# l(:label_optional_description) :source_type => source.class.to_s, :source_id => source.id.to_s - } %> + } %> <% content_for :header_tags do %> diff --git a/app/views/bids/_homework.html.erb b/app/views/bids/_homework.html.erb index a013facbc..f3578e713 100644 --- a/app/views/bids/_homework.html.erb +++ b/app/views/bids/_homework.html.erb @@ -57,7 +57,7 @@ diff --git a/app/views/courses/_course.html.erb b/app/views/courses/_course.html.erb index 80cd7df9d..ef8f37566 100644 --- a/app/views/courses/_course.html.erb +++ b/app/views/courses/_course.html.erb @@ -17,9 +17,9 @@ <% @admin = @course.course_infos%> <%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%> - <%# unless @course.course_extra.school.nil? %> - <%= @course.teacher.user_extensions.school.try(:name) %> - <%# end %> + <% unless @course.teacher.user_extensions.school.nil? %> + <%= link_to @course.teacher.user_extensions.school.try(:name), school_course_list_path(@course.teacher.user_extensions.school) %> + <% end %> <% end %>

diff --git a/app/views/courses/index.html.erb b/app/views/courses/index.html.erb index c29903d78..ecc4306f7 100644 --- a/app/views/courses/index.html.erb +++ b/app/views/courses/index.html.erb @@ -24,7 +24,7 @@ - <%= link_to request.host()+"/course", :controller => 'courses', :action => 'index', :course_type => 1 %> + <%= link_to request.host()+"/courses", :controller => 'courses', :action => 'index', :course_type => 1 %> <%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_course_practice), :controller => 'courses', :action => 'index', :course_type => 1 %> diff --git a/app/views/courses/search.html.erb b/app/views/courses/search.html.erb index 96f8c227d..25b45e0db 100644 --- a/app/views/courses/search.html.erb +++ b/app/views/courses/search.html.erb @@ -22,7 +22,7 @@ - <%= link_to "forge.trustie.net/courses", :controller => 'courses', :action => 'index'%> + <%= link_to request.host() + "/courses", :controller => 'courses', :action => 'index'%> <%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_course_practice), :controller => 'courses', :action => 'index' %> diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 396082854..f0cc62140 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -44,7 +44,7 @@ <% if e.event_type == "issue" %> - <%= link_to l(:label_find_all_comments), issue_path(e) %> <%= l(:label_comments_count, :count => e.journals.count) %> + <%= link_to l(:label_find_all_comments), issue_path(e.id) %> <%= l(:label_comments_count, :count => e.journals.count) %> <% end %> diff --git a/app/views/forums/_form.html.erb b/app/views/forums/_form.html.erb index b14df7b11..f67aa1181 100644 --- a/app/views/forums/_form.html.erb +++ b/app/views/forums/_form.html.erb @@ -3,15 +3,15 @@

<%= labelled_form_for(@forum) do |f| %> <% if @forum.errors.any? %> -
-

<%= pluralize(@forum.errors.count, "error") %> prohibited this forum from being saved:

+ <% end %>
diff --git a/app/views/git_usage/ch_usage.html.erb b/app/views/git_usage/ch_usage.html.erb index 5fca6b156..330ab9b5e 100644 --- a/app/views/git_usage/ch_usage.html.erb +++ b/app/views/git_usage/ch_usage.html.erb @@ -143,7 +143,7 @@ body table tr td span6 {

在桌面上点击鼠标右键,选择TortoiseGit的Settings进行设置

- Name和Email是用来设置自己的用户名和联系方式的(user.name和user.email必须填写,这些将在版本库提交时用到, 其中的name和email要和forge.trustie.net上的登陆名和邮箱保持一致 + Name和Email是用来设置自己的用户名和联系方式的(user.name和user.email必须填写,这些将在版本库提交时用到, 其中的name和email要和<%= Setting.host_name %>上的登陆名和邮箱保持一致 ,方便代码贡献统计 )。 @@ -313,7 +313,7 @@ body table tr td span6 {

$git config --global user.name “your_name”

$git config --global user.email “your_email” 

Name和Email是用来设置自己的用户名和联系方式的(user.name和user.email必须填写,这些将在版本库提交时用到, - 其中的name和email要和forge.trustie.net上的登陆名和密码保持一致 + 其中的name和email要和<%= Setting.host_name %>上的登陆名和密码保持一致 ,方便代码贡献统计 )。

diff --git a/app/views/git_usage/en_usage.html.erb b/app/views/git_usage/en_usage.html.erb index ce202c792..237895d23 100644 --- a/app/views/git_usage/en_usage.html.erb +++ b/app/views/git_usage/en_usage.html.erb @@ -143,7 +143,7 @@ body table tr td span6 {

Right-click on the desktop and select the "Settings" in the "TortoiseGit"

-

User name and email are used to set your own user name and contact information( user.name and user.email must be completed because these will be used when submitting the repository, the name and email must be the same with login name and email you registed in the forge.trustie.net +

User name and email are used to set your own user name and contact information( user.name and user.email must be completed because these will be used when submitting the repository, the name and email must be the same with login name and email you registed in the <%= Setting.host_name %> ).

Then you can customize the "Context Menu":

Please check the "Clone","Sync" and "Commit" options in the "Context Menu",

@@ -306,7 +306,7 @@ body table tr td span6 {

$git config --global user.name “your_name”M

$git config --global user.email “your_email” 

User name and email are used to set your own user name and contact information( user.name and user.email must be completed because these will be used when submitting the repository, - the name and email must be the same with login name and email you registed in the forge.trustie.net + the name and email must be the same with login name and email you registed in the <%= Setting.host_name %> ).

diff --git a/app/views/issues/_action_menu.html.erb b/app/views/issues/_action_menu.html.erb index 3f87eaabd..61cea920c 100644 --- a/app/views/issues/_action_menu.html.erb +++ b/app/views/issues/_action_menu.html.erb @@ -14,5 +14,5 @@ <%= watcher_link(@issue, User.current) %> <%= link_to l(:button_copy), project_copy_issue_path(@project, @issue), :class => 'icon icon-copy' if User.current.allowed_to?(:add_issues, @project) %> -<%= link_to l(:button_delete), issue_path(@issue), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'icon icon-del' if User.current.allowed_to?(:delete_issues, @project) %> +<%= link_to l(:button_delete), issue_path(@issue.id), :data => {:confirm => issues_destroy_confirmation_message(@issue)}, :method => :delete, :class => 'icon icon-del' if User.current.allowed_to?(:delete_issues, @project) %>
diff --git a/app/views/issues/_list.html.erb b/app/views/issues/_list.html.erb index dd3487258..b36c4b57d 100644 --- a/app/views/issues/_list.html.erb +++ b/app/views/issues/_list.html.erb @@ -28,11 +28,12 @@
    <% unless issue.author.nil? || issue.author.name == "Anonymous" %>
      - <%= link_to issue.author.name, user_path(issue.author), :class => "bid_user_u" %><%= l(:label_post_on)%> <% a = [] %> + <%= link_to issue.author.name, user_path(issue.author), :class => "bid_user_u" %> + <%= l(:label_post_on)%> <% a = [] %> <% a << column_content[1] %> <%# a << "##{column_content[0]}" << "(#{raw column_content[2]}):" << column_content[4] %> <% a << "#{issue.source_from}" << "(#{raw column_content[2]}):" << column_content[4] %> - <%= link_to a.join(' '), issue_path(issue), :class => "issue-link" %> + <%= link_to a.join(' '), issue_path(issue.id), :class => "issue-link" , :target =>"_blank"%>
    <% end -%>
      @@ -46,7 +47,7 @@ <% end %> <%= l(:label_updated_time_on, format_date(issue.updated_on)).html_safe %>
      - <%= link_to l(:label_find_all_comments), issue_path(issue) %><%= l(:label_comments_count, :count => issue.journals.all.count) %> + <%= link_to l(:label_find_all_comments), issue_path(issue.id) %><%= l(:label_comments_count, :count => issue.journals.all.count) %>
diff --git a/app/views/issues/_list_simple.html.erb b/app/views/issues/_list_simple.html.erb index 0e4aa0731..3a33e6f5f 100644 --- a/app/views/issues/_list_simple.html.erb +++ b/app/views/issues/_list_simple.html.erb @@ -12,12 +12,12 @@ <%= check_box_tag("ids[]", issue.id, false, :style => 'display:none;', :id => nil) %> - <%= link_to issue.id, issue_path(issue) %> + <%= link_to issue.id, issue_path(issue.id) %> <%= link_to_project(issue.project) %> <%=h issue.tracker %> - <%= link_to truncate(issue.subject, :length => 60), issue_path(issue) %> (<%=h issue.status %>) + <%= link_to truncate(issue.subject, :length => 60), issue_path(issue.id) %> (<%=h issue.status %>) <% end %> diff --git a/app/views/layouts/_base_footer.html.erb b/app/views/layouts/_base_footer.html.erb index ec7516689..2fc383440 100644 --- a/app/views/layouts/_base_footer.html.erb +++ b/app/views/layouts/_base_footer.html.erb @@ -12,7 +12,7 @@ <%= link_to l(:label_organizers_information),"http://www.nudt.edu.cn/ArticleShow.asp?ID=47",:target=>"_blank"%> <%= link_to l(:label_organizers_information_institute), "http://www.nudt.edu.cn/ArticleShow.asp?ID=41", :target => "_blank" %> <%=l(:label_copyright)%>@2007~2014 - <%= link_to l(:label_contact_us),"http://forge.trustie.net/projects/2/member", :target=>"_blank" %> + <%= link_to l(:label_contact_us),"http://" + Setting.host_name + "/projects/2/member", :target=>"_blank" %> <%= link_to l(:label_record),"http://www.miibeian.gov.cn/", :target => "_blank" %>

diff --git a/app/views/layouts/_bootstrap_base_footer.html.erb b/app/views/layouts/_bootstrap_base_footer.html.erb index 2bda28bdd..a2fdd6208 100644 --- a/app/views/layouts/_bootstrap_base_footer.html.erb +++ b/app/views/layouts/_bootstrap_base_footer.html.erb @@ -5,7 +5,7 @@ 主办单位: <%= link_to "国防科学技术大学并行与分布处理国家重点实验室","http://www.nudt.edu.cn/ArticleShow.asp?ID=47"%> <%= link_to "计算机科学与技术系", "http://www.nudt.edu.cn/ArticleShow.asp?ID=41"%> - <%= link_to "联系我们","http://forge.trustie.net/projects/2/member"%> + <%= link_to "联系我们","http://" + Setting.host_name + "/projects/2/member"%> <%= link_to "湘ICP备09019772","http://www.miibeian.gov.cn/"%>
diff --git a/app/views/mailer/journals_for_message_add.html.erb b/app/views/mailer/journals_for_message_add.html.erb index 43c5b9ae8..1aa8e45f8 100644 --- a/app/views/mailer/journals_for_message_add.html.erb +++ b/app/views/mailer/journals_for_message_add.html.erb @@ -1,5 +1,5 @@ 尊敬的用户,<%= @user %>给你留言了:
<%= @message %>

点击链接查看最新回复<%= link_to(@url, @url) %>

-         

<%= link_to(l(:lable_not_receive_mail),"http://forge.trustie.net/my/account")%>

+         

<%= link_to(l(:lable_not_receive_mail),"http://" + Setting.host_name + "/my/account")%>

diff --git a/app/views/projects/search.html.erb b/app/views/projects/search.html.erb index b1bd3d41e..36117e0bb 100644 --- a/app/views/projects/search.html.erb +++ b/app/views/projects/search.html.erb @@ -24,7 +24,7 @@ - <%= link_to "forge.trustie.net/projects", :controller => 'projects', :action => 'course', :project_type => 1 %> + <%= link_to request.host() + "/projects", :controller => 'projects', :action => 'course', :project_type => 1 %> <%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_course_practice), :controller => 'projects', :action => 'course', :project_type => 1 %> diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index cbdf5e6fe..04fb4eb7c 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -1,91 +1,77 @@ <% if @events_by_day.size >0 %> -
- -

- <%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %> -

- - <% @events_by_day.keys.sort.reverse.each do |day| %> -
- <% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%> -
- - - - - -
<%= image_tag(url_to_avatar(e.event_author), :class => "avatar")%> - - - - - - - - - - <% if e.event_type == "issue" %> - - <% end %> - -
- <%= h(e.project) if @project.nil? || @project.id != e.project.id %> - - <% if @canShowRealName %> - <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>(<%= link_to_user(e.event_author,@canShowRealName) if e.respond_to?(:event_author) %>) - <% else %> - <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> - <% end %> +
+

+ <%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %> +

- <%= l(:label_new_activity) %> - - <%= link_to "#{eventToLanguageCourse(e.event_type, @project)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Project)) ? project_files_path(e.container) : e.event_url %> -
-

- <%= h(truncate(strip_tags(e.event_description).gsub(/ /,' '), length: 30, omission:'...')) %> -

<%= l :label_activity_time %>:  <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %> <%= link_to l(:label_find_all_comments), issue_path(e) %> <%= l(:label_comments_count, :count => e.journals.count)%>
-
- - <% end %> -
+ <% @events_by_day.keys.sort.reverse.each do |day| %> + <% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%> +
+
+ <%= image_tag(url_to_avatar(e.event_author), :class => "avatar")%> +
+
+ <%= h(e.project) if @project.nil? || @project.id != e.project.id %> + + <% if @canShowRealName %> + <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>(<%= link_to_user(e.event_author,@canShowRealName) if e.respond_to?(:event_author) %>) + <% else %> + <%= link_to_user(e.event_author) if e.respond_to?(:event_author) %> + <% end %> - <% end -%> - + <%= l(:label_new_activity) %> + + <%= link_to "#{eventToLanguageCourse(e.event_type, @project)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Project)) ? project_files_path(e.container) : e.event_url %> - -
- <%end%> +
+ <%= h(truncate(strip_tags(e.event_description).gsub(/ /,' '), length: 30, omission:'...')) %> +
+
+ <%= l :label_activity_time %>:  <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %> + <% if e.event_type == "issue" %> +
+ <%= link_to l(:label_find_all_comments), issue_path(e) %> <%= l(:label_comments_count, :count => e.journals.count)%> +
+ <% end %> +
+
+
-
- - - - - -
<%= image_tag(url_to_avatar(@user), :class => "avatar") %> - - - - - -
- <% - #判断是否显示真名 - if @canShowRealName - %> - <%= link_to (h @user.try(:name)), user_path(@user) if @user %>(<%= link_to (h @user.try(:realname)), user_path(@user) if @user %>) - <% else %> - <%= link_to (h @user.try(:name)), user_path(@user) if @user %> - <% end %> - <%= l(:label_user_create_project) %> <%= link_to @project.name %> !
<%= l :label_create_time %>: <%= format_time(@project.created_on) %> -
+ <% end %> + <% end -%> + <% if(@events_pages.page == @events_pages.last_page) %> +
+
+ <%= image_tag(url_to_avatar(@user), :class => "avatar") %> +
+
+ + <% if @canShowRealName %> + <%= link_to (h @user.try(:name)), user_path(@user) if @user %>(<%= link_to (h @user.try(:realname)), user_path(@user) if @user %>) + <% else %> + <%= link_to (h @user.try(:name)), user_path(@user) if @user %> + <% end %> + <%#= l(:label_new_activity) %> + + <%= l(:label_user_create_project) %> <%= link_to @project.name %> ! +
+
+
+ <%= l :label_activity_time %>: <%= format_time(@project.created_on) %> +
+
+
+ <% end %>
+<%end%> + diff --git a/app/views/welcome/_link_to_another.html.erb b/app/views/welcome/_link_to_another.html.erb index bda48e753..14640897c 100644 --- a/app/views/welcome/_link_to_another.html.erb +++ b/app/views/welcome/_link_to_another.html.erb @@ -1,6 +1,6 @@
\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 8318a239a..f9dd53cf3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -700,7 +700,7 @@ RedmineApp::Application.routes.draw do #######confusing######## get 'welcome/search', to: 'welcome#search' get 'school/index', to: 'school#index' - get 'course/:school_id', to: 'welcome#course', :as => 'school_course_list' + get 'school/:school_id', to: 'welcome#course', :as => 'school_course_list' #get 'course/:school_id', to: 'welcome#course' post 'school/get_options/:province', :to => 'school#get_options' get 'school/get_options/:province', :to => 'school#get_options' diff --git a/config/settings.yml b/config/settings.yml index f2c64a97c..268198d4f 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -71,6 +71,10 @@ default_language: default: zh host_name: default: forge.trustie.net +host_course: + default: course.trustie.net +host_contest: + default: contest.trustie.net protocol: default: http feeds_limit: diff --git a/lib/redmine/info.rb b/lib/redmine/info.rb index 63c066da8..f41e576d3 100644 --- a/lib/redmine/info.rb +++ b/lib/redmine/info.rb @@ -2,8 +2,8 @@ module Redmine module Info class << self def app_name; 'Trustie' end - def url; 'http://forge.trustie.net/' end - def help_url; 'http://forge.trustie.net/forums' end + def url; 'http://'+ Setting.host_name + '/' end + def help_url; 'http://'+ Setting.host_name + '/forums' end def versioned_name; "#{app_name} #{Redmine::VERSION}" end def environment