diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 8402c05f0..8a5bfd9fb 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -8,6 +8,7 @@ class CoursesController < ApplicationController menu_item :overview menu_item :feedback, :only => :feedback menu_item :homework, :only => :homework + menu_item :new_homework menu_item l(:label_sort_by_time), :only => :index menu_item l(:label_sort_by_active), :only => :index diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 2fcc2e89b..932ffaa7a 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -44,7 +44,7 @@ class DocumentsController < ApplicationController @grouped = documents.group_by {|d| d.title.first.upcase} when 'author' # @grouped = documents.select{|d| d.attachments.any?}.group_by {|d| d.attachments.last.author} - @grouped = documents.group_by {|d| d.user.name } + @grouped = documents.group_by(&:user) else @grouped = documents.group_by(&:category) end diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 69dda5be0..fa2784f22 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -1,282 +1,282 @@ -# Redmine - project management software -# Copyright (C) 2006-2013 Jean-Philippe Lang -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -#+ -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -class MyController < ApplicationController - layout "users_base" - before_filter :require_login - - helper :issues - helper :users - helper :custom_fields - - BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues, - 'issuesreportedbyme' => :label_reported_issues, - 'issueswatched' => :label_watched_issues, - 'news' => :label_news_latest, - 'calendar' => :label_calendar, - 'documents' => :label_document_plural, - 'timelog' => :label_spent_time - }.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze - - DEFAULT_LAYOUT = { 'left' => ['issuesassignedtome'], - 'right' => ['issuesreportedbyme'] - }.freeze - - def index - - page - render :action => 'page' - end - - # Show user's page - def page - @user = User.current - @Issues= Issue.visible.open. - where(:assigned_to_id => ([User.current.id] + User.current.group_ids)) - @limit = 10 - @feedback_count = @Issues.count - @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] - @offset ||= @feedback_pages.offset - @curse_attachments = @Issues[@offset, @limit] - - @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT - end - - def page2 - @limit = 10 - @user = User.current - @Issues= Issue.visible.open. - where(:assigned_to_id => ([User.current.id] + User.current.group_ids)) - @feedback_count = @Issues.count - @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] - @offset ||= @feedback_pages.offset - @curse_attachments = @Issues[@offset, @limit] - @state = false - @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT - respond_to do |format| - format.js - end - end - - # Edit user's account - def account - @user = User.current - lg=@user.login - @pref = @user.pref - diskfile = disk_filename('User', @user.id) - diskfile1 = diskfile + 'temp' - if request.post? - @user.safe_attributes = params[:user] - @user.pref.attributes = params[:pref] - @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') - @user.login = params[:login] - unless @user.user_extensions.nil? - if @user.user_extensions.identity == 2 - @user.firstname = params[:enterprise_name] - end - end - - @se = @user.extensions - @se.school_id = params[:occupation] if params[:occupation] - @se.gender = params[:gender] - @se.location = params[:province] if params[:province] - @se.location_city = params[:city] if params[:city] - @se.identity = params[:identity].to_i if params[:identity] - @se.technical_title = params[:technical_title] if params[:technical_title] - @se.student_id = params[:no] if params[:no] - - if @user.save && @se.save - # 头像保存 - if File.exist?(diskfile1) - if File.exist?(diskfile) - File.delete(diskfile) - end - File.open(diskfile1, "rb") do |f| - buffer = f.read(10) - if buffer != "DELETE" - File.open(diskfile1, "rb") do |f1| - File.open(diskfile, "wb") do |f| - buffer = "" - while (buffer = f1.read(8192)) - f.write(buffer) - end - end - end - - # File.rename(diskfile + 'temp',diskfile); - end - end - end - - # 确保文件被删除 - if File.exist?(diskfile1) - File.delete(diskfile1) - end - - @user.pref.save - @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : []) - set_language_if_valid @user.language - flash[:notice] = l(:notice_account_updated) - redirect_to user_url(@user) - return - else - # 确保文件被删除 - if File.exist?(diskfile1) - File.delete(diskfile1) - end - @user.login = lg - end - else - # 确保文件被删除 - if File.exist?(diskfile1) - File.delete(diskfile1) - end - end - end - - # Destroys user's account - def destroy - @user = User.current - unless @user.own_account_deletable? - redirect_to my_account_url - return - end - - if request.post? && params[:confirm] - @user.destroy - if @user.destroyed? - logout_user - flash.now[:notice] = l(:notice_account_deleted) - end - redirect_to home_url - end - end - - # Manage user's password - def password - @user = User.current - unless @user.change_password_allowed? - flash.now[:error] = l(:notice_can_t_change_password) - redirect_to my_account_url - return - end - if request.post? - if @user.check_password?(params[:password]) - @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation] - - if @user.save - flash.now[:notice] = l(:notice_account_password_updated) - redirect_to my_account_url - end - else - flash.now[:error] = l(:notice_account_wrong_password) - end - end - end - - # Create a new feeds key - def reset_rss_key - if request.post? - if User.current.rss_token - User.current.rss_token.destroy - User.current.reload - end - User.current.rss_key - flash[:notice] = l(:notice_feeds_access_key_reseted) - end - redirect_to my_account_url - end - - # Create a new API key - def reset_api_key - if request.post? - if User.current.api_token - User.current.api_token.destroy - User.current.reload - end - User.current.api_key - flash[:notice] = l(:notice_api_access_key_reseted) - end - redirect_to my_account_url - end - - # User's page layout configuration - def page_layout - @user = User.current - @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT.dup - @block_options = [] - BLOCKS.each do |k, v| - unless %w(top left right).detect {|f| (@blocks[f] ||= []).include?(k)} - @block_options << [l("my.blocks.#{v}", :default => [v, v.to_s.humanize]), k.dasherize] - end - end - end - - # Add a block to user's page - # The block is added on top of the page - # params[:block] : id of the block to add - def add_block - block = params[:block].to_s.underscore - if block.present? && BLOCKS.key?(block) - @user = User.current - layout = @user.pref[:my_page_layout] || {} - # remove if already present in a group - %w(top left right).each {|f| (layout[f] ||= []).delete block } - # add it on top - layout['top'].unshift block - @user.pref[:my_page_layout] = layout - @user.pref.save - end - redirect_to my_page_layout_url - end - - # Remove a block to user's page - # params[:block] : id of the block to remove - def remove_block - block = params[:block].to_s.underscore - @user = User.current - # remove block in all groups - layout = @user.pref[:my_page_layout] || {} - %w(top left right).each {|f| (layout[f] ||= []).delete block } - @user.pref[:my_page_layout] = layout - @user.pref.save - redirect_to my_page_layout_url - end - - # Change blocks order on user's page - # params[:group] : group to order (top, left or right) - # params[:list-(top|left|right)] : array of block ids of the group - def order_blocks - group = params[:group] - @user = User.current - if group.is_a?(String) - group_items = (params["blocks"] || []).collect(&:underscore) - group_items.each {|s| s.sub!(/^block_/, '')} - if group_items and group_items.is_a? Array - layout = @user.pref[:my_page_layout] || {} - # remove group blocks if they are presents in other groups - %w(top left right).each {|f| - layout[f] = (layout[f] || []) - group_items - } - layout[group] = group_items - @user.pref[:my_page_layout] = layout - @user.pref.save - end - end - render :nothing => true - end -end +# Redmine - project management software +# Copyright (C) 2006-2013 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +#+ +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +class MyController < ApplicationController + layout "users_base" + before_filter :require_login + + helper :issues + helper :users + helper :custom_fields + + BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues, + 'issuesreportedbyme' => :label_reported_issues, + 'issueswatched' => :label_watched_issues, + 'news' => :label_news_latest, + 'calendar' => :label_calendar, + 'documents' => :label_document_plural, + 'timelog' => :label_spent_time + }.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze + + DEFAULT_LAYOUT = { 'left' => ['issuesassignedtome'], + 'right' => ['issuesreportedbyme'] + }.freeze + + def index + + page + render :action => 'page' + end + + # Show user's page + def page + @user = User.current + @Issues= Issue.visible.open. + where(:assigned_to_id => ([User.current.id] + User.current.group_ids)) + @limit = 10 + @feedback_count = @Issues.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + @curse_attachments = @Issues[@offset, @limit] + + @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT + end + + def page2 + @limit = 10 + @user = User.current + @Issues= Issue.visible.open. + where(:assigned_to_id => ([User.current.id] + User.current.group_ids)) + @feedback_count = @Issues.count + @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] + @offset ||= @feedback_pages.offset + @curse_attachments = @Issues[@offset, @limit] + @state = false + @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT + respond_to do |format| + format.js + end + end + + # Edit user's account + def account + @user = User.current + lg=@user.login + @pref = @user.pref + diskfile = disk_filename('User', @user.id) + diskfile1 = diskfile + 'temp' + if request.post? + @user.safe_attributes = params[:user] + @user.pref.attributes = params[:pref] + @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') + @user.login = params[:login] + unless @user.user_extensions.nil? + if @user.user_extensions.identity == 2 + @user.firstname = params[:enterprise_name] + end + end + + @se = @user.extensions + @se.school_id = params[:occupation] if params[:occupation] + @se.gender = params[:gender] + @se.location = params[:province] if params[:province] + @se.location_city = params[:city] if params[:city] + @se.identity = params[:identity].to_i if params[:identity] + @se.technical_title = params[:technical_title] if params[:technical_title] + @se.student_id = params[:no] if params[:no] + + if @user.save && @se.save + # 头像保存 + if File.exist?(diskfile1) + if File.exist?(diskfile) + File.delete(diskfile) + end + File.open(diskfile1, "rb") do |f| + buffer = f.read(10) + if buffer != "DELETE" + File.open(diskfile1, "rb") do |f1| + File.open(diskfile, "wb") do |f| + buffer = "" + while (buffer = f1.read(8192)) + f.write(buffer) + end + end + end + + # File.rename(diskfile + 'temp',diskfile); + end + end + end + + # 确保文件被删除 + if File.exist?(diskfile1) + File.delete(diskfile1) + end + + @user.pref.save + @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : []) + set_language_if_valid @user.language + flash[:notice] = l(:notice_account_updated) + redirect_to user_url(@user) + return + else + # 确保文件被删除 + if File.exist?(diskfile1) + File.delete(diskfile1) + end + @user.login = lg + end + else + # 确保文件被删除 + if File.exist?(diskfile1) + File.delete(diskfile1) + end + end + end + + # Destroys user's account + def destroy + @user = User.current + unless @user.own_account_deletable? + redirect_to my_account_url + return + end + + if request.post? && params[:confirm] + @user.destroy + if @user.destroyed? + logout_user + flash.now[:notice] = l(:notice_account_deleted) + end + redirect_to home_url + end + end + + # Manage user's password + def password + @user = User.current + unless @user.change_password_allowed? + flash.now[:error] = l(:notice_can_t_change_password) + redirect_to my_account_url + return + end + if request.post? + if @user.check_password?(params[:password]) + @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation] + + if @user.save + flash.now[:notice] = l(:notice_account_password_updated) + redirect_to my_account_url + end + else + flash.now[:error] = l(:notice_account_wrong_password) + end + end + end + + # Create a new feeds key + def reset_rss_key + if request.post? + if User.current.rss_token + User.current.rss_token.destroy + User.current.reload + end + User.current.rss_key + flash[:notice] = l(:notice_feeds_access_key_reseted) + end + redirect_to my_account_url + end + + # Create a new API key + def reset_api_key + if request.post? + if User.current.api_token + User.current.api_token.destroy + User.current.reload + end + User.current.api_key + flash[:notice] = l(:notice_api_access_key_reseted) + end + redirect_to my_account_url + end + + # User's page layout configuration + def page_layout + @user = User.current + @blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT.dup + @block_options = [] + BLOCKS.each do |k, v| + unless %w(top left right).detect {|f| (@blocks[f] ||= []).include?(k)} + @block_options << [l("my.blocks.#{v}", :default => [v, v.to_s.humanize]), k.dasherize] + end + end + end + + # Add a block to user's page + # The block is added on top of the page + # params[:block] : id of the block to add + def add_block + block = params[:block].to_s.underscore + if block.present? && BLOCKS.key?(block) + @user = User.current + layout = @user.pref[:my_page_layout] || {} + # remove if already present in a group + %w(top left right).each {|f| (layout[f] ||= []).delete block } + # add it on top + layout['top'].unshift block + @user.pref[:my_page_layout] = layout + @user.pref.save + end + redirect_to my_page_layout_url + end + + # Remove a block to user's page + # params[:block] : id of the block to remove + def remove_block + block = params[:block].to_s.underscore + @user = User.current + # remove block in all groups + layout = @user.pref[:my_page_layout] || {} + %w(top left right).each {|f| (layout[f] ||= []).delete block } + @user.pref[:my_page_layout] = layout + @user.pref.save + redirect_to my_page_layout_url + end + + # Change blocks order on user's page + # params[:group] : group to order (top, left or right) + # params[:list-(top|left|right)] : array of block ids of the group + def order_blocks + group = params[:group] + @user = User.current + if group.is_a?(String) + group_items = (params["blocks"] || []).collect(&:underscore) + group_items.each {|s| s.sub!(/^block_/, '')} + if group_items and group_items.is_a? Array + layout = @user.pref[:my_page_layout] || {} + # remove group blocks if they are presents in other groups + %w(top left right).each {|f| + layout[f] = (layout[f] || []) - group_items + } + layout[group] = group_items + @user.pref[:my_page_layout] = layout + @user.pref.save + end + end + render :nothing => true + end +end diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index 0c7e2ade1..5b6111187 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -56,12 +56,12 @@ class SoftapplicationsController < ApplicationController stars_status = stars_reates.select("stars, count(*) as scount"). group("stars") - @stars_status_map = Hash.new(0.0) + @stars_status_map = Hash.new(0) stars_status.each do |star_status| percent = percent_of(star_status.scount, stars_reates_count).to_f - percent_m = format("%.2f", percent) + people = star_status.scount.to_i @stars_status_map["star#{star_status.stars.to_i}".to_sym] = - percent_m.to_s + "%" + people.to_s end @jours = @softapplication.journals_for_messages.order('created_on DESC') @image_results = [] diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb index 7e70d55c7..c55143ca8 100644 --- a/app/models/issue_query.rb +++ b/app/models/issue_query.rb @@ -137,6 +137,11 @@ class IssueQuery < Query :type => :list_optional, :values => role_values ) unless role_values.empty? + #done_values = [10,20,30,40,50,60,70,80,90,100] + #add_available_filter("done_ratio_111", + # :type => :list_optional, :values => done_values + #) + if versions.any? add_available_filter "fixed_version_id", :type => :list_optional, diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index 20b0c5c04..1115ca80e 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -26,7 +26,11 @@ <%= back_url_hidden_field_tag %>
+ | + + | <%= text_field_tag 'username', params[:username], :tabindex => '1' , :value => "#{l(:label_login_prompt)}", :onfocus => "clearInfo('username','#{l(:label_login_prompt)}')", @@ -35,33 +39,48 @@ | |
- | <%= password_field_tag 'password', nil, :tabindex => '2' %> | ++ + | ++ <%= password_field_tag 'password', nil, :tabindex => '2' %> + |
- | <%= text_field_tag "openid_url", nil, :tabindex => '3' %> | ++ + | ++ <%= text_field_tag "openid_url", nil, :tabindex => '3' %> + |
<% if Setting.autologin? %> - + <% end %> | |||
- <% if Setting.lost_password? %> + + <% if Setting.lost_password? %> <%= link_to l(:label_password_lost), lost_password_path %> <% end %> - |
- <%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %> -
-- - <%= image_tag(url_to_avatar(e.event_author), :class => "avatar") %> - | -
-
|
-
- <% @activity.event_types.each do |t| %>
- <%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %>
-
-
- <% end %>
-
- -
-<% end %> -<%= hidden_field_tag('user_id', params[:user_id]) unless params[:user_id].blank? %> -- <%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %> -
-<% end %> -<% end %> - -<% html_title(l(:label_activity), @author) -%> ++ <%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %> +
++ + <%= image_tag(url_to_avatar(e.event_author), :class => "avatar") %> + | +
+
|
+
+ <% @activity.event_types.each do |t| %>
+ <%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %>
+
+
+ <% end %>
+
+ +
+<% end %> +<%= hidden_field_tag('user_id', params[:user_id]) unless params[:user_id].blank? %> ++ <%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %> +
+<% end %> +<% end %> + +<% html_title(l(:label_activity), @author) -%> diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 26576195d..5a25cf262 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -1,31 +1,36 @@ - - - - - - + -<%= link_to h(topic.subject.truncate(40,ommision:'...')), board_message_path(@board, topic),title: topic.subject.to_s %> + <%= topic.locked? ? 'locked' : '' %>"> + <%= link_to h(topic.subject.truncate(40,ommision:'...')), board_message_path(@board, topic),title: topic.subject.to_s %> + | +
+
|
-
|
||||
<%= authoring topic.created_on, topic.author %> |
<%= l(:label_no_data) %>
++ <%= l(:label_no_data) %> +
<% end %><%= f.text_field :name, :required => true %>
-<%= f.text_field :description, :required => true, :size => 30 %>
++ <%= f.text_field :name, :required => true %> +
++ <%= f.text_field :description, :required => true, :size => 30 %> +
<% if @board.valid_parents.any? %> -<%= f.select :parent_id, boards_options_for_select(@board.valid_parents), :include_blank => true, :label => :field_board_parent %>
++ <%= f.select :parent_id, boards_options_for_select(@board.valid_parents), :include_blank => true, :label => :field_board_parent %> +
<% end %><%= l(:label_no_data) %>
<% end %> diff --git a/app/views/boards/index.html.erb b/app/views/boards/index.html.erb index 614066613..d3671a096 100644 --- a/app/views/boards/index.html.erb +++ b/app/views/boards/index.html.erb @@ -3,14 +3,26 @@ <%= link_to l(:label_board_new), new_project_board_path(@project), :class => 'icon icon-add' %> <% end %><%= l(:label_board) %> | -<%= l(:label_topic_plural) %> | -<%= l(:label_message_plural) %> | -<%= l(:label_message_last) %> | -|||||
---|---|---|---|---|---|---|---|---|
+ <%= l(:label_board) %> + | ++ <%= l(:label_topic_plural) %> + | ++ <%= l(:label_message_plural) %> + | ++ <%= l(:label_message_last) %> + | +|||||
<%= board.topics_count %> | - ++ <%= board.topics_count %> + | +
- <%= link_to image_tag(url_to_avatar(contestnotifications.author), :class => "avatar"), user_path(contestnotifications.author) %> - | -
-
|
-
+ + <%= l(:label_bids_reward_method) %> + + <%= @contest.budget%> + + +
++ <%= link_to image_tag(url_to_avatar(contestnotifications.author), :class => "avatar"), user_path(contestnotifications.author) %> + | +
+
|
+
<%= l(:label_contest_innovate) %> | -<%= l(:label_user_location) %> : | -- <% if User.current.logged? %> - <% unless User.current.user_extensions.identity == 1 %> - <%= link_to(l(:label_newtype_contest), new_contest_contests_path, :class => 'icon icon-add', :target => "_blank") %> - - <% end %> - <% end %> - | -
-
- <%= text_field_tag 'name', params[:name], :size => 30 %>
- <%= hidden_field_tag 'project_type', params[:project_type] %>
- <%= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
-
- |
-
- - <%= link_to request.host()+"/contests", contests_path %> - - - | -- <%=link_to l(:field_homepage), home_path %> > - <%=link_to l(:label_contest_innovate), :controller => 'contests', :action => 'index' %> - - | -
<%= l(:label_contest_innovate) %> | +<%= l(:label_user_location) %> : | ++ <% if User.current.logged? %> + <% unless User.current.user_extensions.identity == 1 %> + <%= link_to(l(:label_newtype_contest), new_contest_contests_path, :class => 'icon icon-add', :target => "_blank") %> + + <% end %> + <% end %> + | +
+
+ <%= text_field_tag 'name', params[:name], :size => 30 %>
+ <%= hidden_field_tag 'project_type', params[:project_type] %>
+ <%= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
+
+ |
+
+ + <%= link_to request.host()+"/contests", contests_path %> + + + | ++ <%=link_to l(:field_homepage), home_path %> > + <%=link_to l(:label_contest_innovate), :controller => 'contests', :action => 'index' %> + + | +
只要持有课程ID和密码,就可快速加入所在课程。课程页面搜索不到的私有课程只能从此通道进入哦!
-只要持有课程ID和密码,就可快速加入所在课程。课程页面搜索不到的私有课程只能从此通道进入哦!
+<%= link_to h(document.title), document_path(document) %> | |
+ | |
+ <%= link_to h(document.title), document_path(document) %> + | +|
<%= textilizable(truncate_lines(document.description), :object => document) %>
- | |
<%= format_time(document.updated_on) %> | |
+ + <%= format_time(document.updated_on) %> + + |
+ |
+ |
<%= l(:label_no_data) %>
<% end %> +<% if @grouped.empty? %> ++ <%= l(:label_no_data) %> +
+<% end %> -<% @grouped.keys.sort.each do |group| %> - +<% if @grouped.has_key? nil %> + <% @grouped.keys.each do |group| %> + <%= render :partial => 'documents/document', :collection => @grouped[group] %> + <% end %> +<% else %> + <% @grouped.keys.sort.each do |group| %> <%= render :partial => 'documents/document', :collection => @grouped[group] %> + <% end %> <% end %> <% html_title(l(:label_document_plural)) -%> diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index b7b832fb5..fd21b97a0 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -153,7 +153,7 @@
- <%= f.text_field :subject, { size: 60, style: "width: 99%;", id: "message_subject" }.merge(extra_option) %>
+ <% if replying %>
+ <%= f.text_field :subject, { size: 60, style: "width: 99%;", id: "message_subject" }.merge(extra_option) %>
+ <% else %>
+ <%= f.text_field :subject, { size: 60, style: "width: 99%;", id: "message_subject", onblur: "regexSubject();" }.merge(extra_option) %>
+ <% end %>
+
<% unless replying %> <% if @message.safe_attribute? 'sticky' %> - <%= f.check_box :sticky %> <%= label_tag 'message_sticky', l(:label_board_sticky) %> + <%= f.check_box :sticky %> + <%= label_tag 'message_sticky', l(:label_board_sticky) %> <% end %> <% if @message.safe_attribute? 'locked' %> - <%= f.check_box :locked %> <%= label_tag 'message_locked', l(:label_board_locked) %> + <%= f.check_box :locked %> + <%= label_tag 'message_locked', l(:label_board_locked) %> <% end %> <% end %>
- -
- <%= text_area :quote,:quote,:style => 'display:none' %> + + + <%= text_area :quote,:quote,:style => 'display:none' %><%= 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', :onblur => "regexContent();" %> + <%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content', :onblur => "regexContent();", :maxlength => 5000 %>
- - -
<%= l(:label_attachment_plural) %>
<%= render :partial => 'attachments/form_course', :locals => {:container => @message,:isReply => @isReply} %>
<%= l(:label_no_ftapplication) %>
- - <% end %> -<%= l(:label_no_ftapplication) %>
+ + <% end %> +- <%= l(:label_version) %> - <%= link_to @diff.content_from.version, :action => 'show', :id => @page.title, :project_id => @page.project, :version => @diff.content_from.version %> - - (<%= @diff.content_from.author ? @diff.content_from.author.name : l(:label_user_anonymous)%>, - <%= format_time(@diff.content_from.updated_on) %>) - -→ - <%= l(:label_version) %> - <%= link_to @diff.content_to.version, :action => 'show', - :id => @page.title, :project_id => @page.project, - :version => @diff.content_to.version %> - / - <%= @page.content.version %> - - (<%= @diff.content_to.author ? link_to_user(@diff.content_to.author.name) : l(:label_user_anonymous)%>, - <%= format_time(@diff.content_to.updated_on) %>) - -
- -+ <%= l(:label_version) %> + <%= link_to @diff.content_from.version, :action => 'show', :id => @page.title, :project_id => @page.project, :version => @diff.content_from.version %> + + (<%= @diff.content_from.author ? @diff.content_from.author.name : l(:label_user_anonymous)%>, + <%= format_time(@diff.content_from.updated_on) %>) + +→ + <%= l(:label_version) %> + <%= link_to @diff.content_to.version, :action => 'show', + :id => @page.title, :project_id => @page.project, + :version => @diff.content_to.version %> + / + <%= @page.content.version %> + + (<%= @diff.content_to.author ? link_to_user(@diff.content_to.author.name) : l(:label_user_anonymous)%>, + <%= format_time(@diff.content_to.updated_on) %>) + +
+ +- <%=text_area_tag 'content[text]', @text, :required => true, :id => 'editor02', :cols => 100, :rows => 25 %> -
- -- - <%= fp.select :parent_id,content_tag('option', '', :value => '') + wiki_page_options_for_select(@wiki.pages.all(:include => :parent) - @page.self_and_descendants, @page.parent) %> -
- <% end %> - <% end %> - -- - <%= f.text_field :comments, :style => "width:75%;" %> -
-- - <%= render :partial => 'attachments/form' %> -
-- <%= submit_tag l(:button_save) %> -
- <%= wikitoolbar_for 'content_text' %> -<% end %> - -<% content_for :header_tags do %> - <%= robot_exclusion_tag %> -<% end %> -<% html_title @page.pretty_title %> +<%= wiki_page_breadcrumb(@page) %> + + ++ <%=text_area_tag 'content[text]', @text, :required => true, :id => 'editor02', :cols => 100, :rows => 25 %> +
+ ++ + <%= fp.select :parent_id,content_tag('option', '', :value => '') + wiki_page_options_for_select(@wiki.pages.all(:include => :parent) - @page.self_and_descendants, @page.parent) %> +
+ <% end %> + <% end %> + ++ + <%= f.text_field :comments, :style => "width:75%;" %> +
++ + <%= render :partial => 'attachments/form' %> +
++ <%= submit_tag l(:button_save) %> +
+ <%= wikitoolbar_for 'content_text' %> +<% end %> + +<% content_for :header_tags do %> + <%= robot_exclusion_tag %> +<% end %> +<% html_title @page.pretty_title %> diff --git a/config/configuration.yml b/config/configuration.yml index 833b19083..21337e3b4 100644 --- a/config/configuration.yml +++ b/config/configuration.yml @@ -204,6 +204,8 @@ default: # specific configuration options for production environment # that overrides the default ones production: + # CJK support + rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf # specific configuration options for development environment # that overrides the default ones diff --git a/config/locales/zh.yml b/config/locales/zh.yml index e37e6a370..32cb7dd23 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2006,7 +2006,7 @@ zh: label_work_scores: 作品得分 label_work_rating: 评分 label_work_tishi: 您可以重新打分,打分结果以最后一次打分为主! - label_work_scores_proportion: 得分比例 + label_work_scores_people: 得分人数 label_softapplication_type: 应用分类 label_work_type: 作品分类 label_work_photo: 作品截图 @@ -2168,3 +2168,4 @@ zh: label_contest_news_condition: 竞赛描述超过5000个汉字 label_no_contest_news_title: 竞赛标题不能为空 label_contest_news_title_condition: 竞赛标题超过255个汉字 + label_subject_empty: 主题不能为空 diff --git a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb index f0f06ee26..609b35415 100644 --- a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb +++ b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb @@ -1,170 +1,170 @@ -# Redmine - project management software -# Copyright (C) 2006-2013 Jean-Philippe Lang -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -module Redmine - module Acts - module Attachable - def self.included(base) - base.extend ClassMethods - end - - module ClassMethods - def acts_as_attachable(options = {}) - cattr_accessor :attachable_options - self.attachable_options = {} - attachable_options[:view_permission] = options.delete(:view_permission) || "view_#{self.name.pluralize.underscore}".to_sym - attachable_options[:delete_permission] = options.delete(:delete_permission) || "edit_#{self.name.pluralize.underscore}".to_sym - - has_many :attachments, options.merge(:as => :container, - :order => "#{Attachment.table_name}.created_on ASC, #{Attachment.table_name}.id ASC", - :dependent => :destroy) - send :include, Redmine::Acts::Attachable::InstanceMethods - before_save :attach_saved_attachments - end - end - - module InstanceMethods - def self.included(base) - base.extend ClassMethods - end - - def attachments_visible?(user=User.current) - if self.respond_to?(:project) - (respond_to?(:visible?) ? visible?(user) : true) && - user.allowed_to?(self.class.attachable_options[:view_permission], self.project) - else - return true - end - - end - - def attachments_deletable?(user=User.current) - if (self.has_attribute?(:course) ||self.has_attribute?(:course_id)) && self.course - #默认给予删除自己上传的附件的权限 - (respond_to?(:visible?) ? visible?(user) : true) && - (user.allowed_to?(self.class.attachable_options[:delete_permission], self.course) || (self.has_attribute?(:author_id) && self.author == user)) - else - #默认给予删除自己上传的附件的权限 - (respond_to?(:visible?) ? visible?(user) : true) && - (user.allowed_to?(self.class.attachable_options[:delete_permission], self.project) || (self.has_attribute?(:author_id) && self.author == user)) - end - end - - def saved_attachments - @saved_attachments ||= [] - end - - def unsaved_attachments - @unsaved_attachments ||= [] - end - - # 设置资源文件的公开属性 - # add by nwb - def set_attachment_public(res) - # 公开的资源判断他的父级的公开属性 - if res.is_public - if( (self.class.to_s=="Project" && self.is_public == false) || - (self.has_attribute?(:project) && self.project && self.project.is_public == false) || - (self.has_attribute?(:board) && self.board.project && self.board.project.is_public == false) || - (self.class.to_s=="HomeworkAttach" && self.bid.reward_type == 3) || - (self.class.to_s=="Course" && self.is_public == false) || - (self.has_attribute?(:course) && self.course && self.course.is_public == false) || - (self.has_attribute?(:board) && self.board.course && self.board.course.is_public == false) - ) - res.is_public = false - end - end - end - - def save_attachmentsex(attachments, author=User.current,attachment_type) - @curattachment_type = attachment_type - result = save_attachments(attachments,author) - result - end - - def save_attachments(attachments, author=User.current) - # 清除临时文件 - if attachments - tempAttach = attachments[:dummy] - if tempAttach && tempAttach[:file] - attachments.delete(:dummy) - end - end - - if attachments.is_a?(Hash) - attachments = attachments.stringify_keys - attachments = attachments.to_a.sort {|a, b| - if a.first.to_i > 0 && b.first.to_i > 0 - a.first.to_i <=> b.first.to_i - elsif a.first.to_i > 0 - 1 - elsif b.first.to_i > 0 - -1 - else - a.first <=> b.first - end - } - attachments = attachments.map(&:last) - end - if attachments.is_a?(Array) - attachments.each do |attachment| - if attachment.is_a?(Hash) - a = nil - file = attachment['file'] - token = attachment['token'] - t = file && file.size > 0 - if file && file.size > 0 - a = Attachment.create(:file => file, :author => author) - elsif token - a = Attachment.find_by_token_only(token) - if a - a.filename = attachment['filename'] unless attachment['filename'].blank? - a.content_type = attachment['content_type'] - end - end - end - if a && !attachment['is_public_checkbox'] - a.is_public = false - elsif a && attachment['is_public_checkbox'] - a.is_public = true - end - set_attachment_public(a) if a - next unless a - a.description = attachment['description'].to_s.strip - a.attachtype = @curattachment_type - if a.new_record? - unsaved_attachments << a - else - saved_attachments << a - end - end - end - {:files => saved_attachments, :unsaved => unsaved_attachments} - end - - def attach_saved_attachments - saved_attachments.each do |attachment| - self.attachments << attachment - end - end - - module ClassMethods - end - end - end - end -end +# Redmine - project management software +# Copyright (C) 2006-2013 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +module Redmine + module Acts + module Attachable + def self.included(base) + base.extend ClassMethods + end + + module ClassMethods + def acts_as_attachable(options = {}) + cattr_accessor :attachable_options + self.attachable_options = {} + attachable_options[:view_permission] = options.delete(:view_permission) || "view_#{self.name.pluralize.underscore}".to_sym + attachable_options[:delete_permission] = options.delete(:delete_permission) || "edit_#{self.name.pluralize.underscore}".to_sym + + has_many :attachments, options.merge(:as => :container, + :order => "#{Attachment.table_name}.created_on ASC, #{Attachment.table_name}.id ASC", + :dependent => :destroy) + send :include, Redmine::Acts::Attachable::InstanceMethods + before_save :attach_saved_attachments + end + end + + module InstanceMethods + def self.included(base) + base.extend ClassMethods + end + + def attachments_visible?(user=User.current) + if self.respond_to?(:project) + (respond_to?(:visible?) ? visible?(user) : true) && + user.allowed_to?(self.class.attachable_options[:view_permission], self.project) + else + return true + end + + end + + def attachments_deletable?(user=User.current) + if (self.has_attribute?(:course) ||self.has_attribute?(:course_id)) && self.course + #默认给予删除自己上传的附件的权限 + (respond_to?(:visible?) ? visible?(user) : true) && + (user.allowed_to?(self.class.attachable_options[:delete_permission], self.course) || (self.has_attribute?(:author_id) && self.author == user)) + else + #默认给予删除自己上传的附件的权限 + (respond_to?(:visible?) ? visible?(user) : true) && + (user.allowed_to?(self.class.attachable_options[:delete_permission], self.project) || (self.has_attribute?(:author_id) && self.author == user)) + end + end + + def saved_attachments + @saved_attachments ||= [] + end + + def unsaved_attachments + @unsaved_attachments ||= [] + end + + # 设置资源文件的公开属性 + # add by nwb + def set_attachment_public(res) + # 公开的资源判断他的父级的公开属性 + if res.is_public + if( (self.class.to_s=="Project" && self.is_public == false) || + (self.has_attribute?(:project) && self.project && self.project.is_public == false) || + (self.has_attribute?(:board) && self.board.project && self.board.project.is_public == false) || + (self.class.to_s=="HomeworkAttach" && self.bid.reward_type == 3) || + (self.class.to_s=="Course" && self.is_public == false) || + (self.has_attribute?(:course) && self.course && self.course.is_public == false) || + (self.has_attribute?(:board) && self.board.course && self.board.course.is_public == false) + ) + res.is_public = false + end + end + end + + def save_attachmentsex(attachments, author=User.current,attachment_type) + @curattachment_type = attachment_type + result = save_attachments(attachments,author) + result + end + + def save_attachments(attachments, author=User.current) + # 清除临时文件 + if attachments + tempAttach = attachments[:dummy] + if tempAttach && tempAttach[:file] + attachments.delete(:dummy) + end + end + + if attachments.is_a?(Hash) + attachments = attachments.stringify_keys + attachments = attachments.to_a.sort {|a, b| + if a.first.to_i > 0 && b.first.to_i > 0 + a.first.to_i <=> b.first.to_i + elsif a.first.to_i > 0 + 1 + elsif b.first.to_i > 0 + -1 + else + a.first <=> b.first + end + } + attachments = attachments.map(&:last) + end + if attachments.is_a?(Array) + attachments.each do |attachment| + if attachment.is_a?(Hash) + a = nil + file = attachment['file'] + token = attachment['token'] + t = file && file.size > 0 + if file && file.size > 0 + a = Attachment.create(:file => file, :author => author) + elsif token + a = Attachment.find_by_token_only(token) + if a + a.filename = attachment['filename'] unless attachment['filename'].blank? + a.content_type = attachment['content_type'] + end + end + end + if a && !attachment['is_public_checkbox'] + a.is_public = false + elsif a && attachment['is_public_checkbox'] + a.is_public = true + end + set_attachment_public(a) if a + next unless a + a.description = attachment['description'].to_s.strip + a.attachtype = @curattachment_type + if a.new_record? + unsaved_attachments << a + else + saved_attachments << a + end + end + end + {:files => saved_attachments, :unsaved => unsaved_attachments} + end + + def attach_saved_attachments + saved_attachments.each do |attachment| + self.attachments << attachment + end + end + + module ClassMethods + end + end + end + end +end diff --git a/plugins/redmine_code_review/app/views/code_review/_show.html.erb b/plugins/redmine_code_review/app/views/code_review/_show.html.erb index a626b6281..f83306ffa 100644 --- a/plugins/redmine_code_review/app/views/code_review/_show.html.erb +++ b/plugins/redmine_code_review/app/views/code_review/_show.html.erb @@ -24,10 +24,14 @@ <%= error_messages_for 'review' -%> <%= error_messages_for 'reply' -%> <% if @notice -%> -