diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index ba815bce..fc26cacc 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -1,19 +1,19 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class AccountController < ApplicationController - include CustomFieldsHelper - + include CustomFieldsHelper + # prevents login action to be filtered by check_if_login_required application scope filter skip_before_filter :check_if_login_required @@ -31,7 +31,7 @@ class AccountController < ApplicationController logout_user redirect_to home_url end - + # Enable user to choose a new password def lost_password redirect_to(home_url) && return unless Setting.lost_password? @@ -46,7 +46,7 @@ class AccountController < ApplicationController flash[:notice] = l(:notice_account_password_updated) redirect_to :action => 'login' return - end + end end render :template => "account/password_recovery" return @@ -68,7 +68,7 @@ class AccountController < ApplicationController end end end - + # User self-registration def register redirect_to(home_url) && return unless Setting.self_registration? || session[:auth_source_registration] @@ -104,7 +104,7 @@ class AccountController < ApplicationController end end end - + # Token based account activation def activate redirect_to(home_url) && return unless Setting.self_registration? && params[:token] @@ -119,9 +119,9 @@ class AccountController < ApplicationController end redirect_to :action => 'login' end - + private - + def logout_user if User.current.logged? cookies.delete Redmine::Configuration['autologin_cookie_name'] @@ -129,7 +129,7 @@ class AccountController < ApplicationController self.logged_user = nil end end - + def authenticate_user if Setting.openid? && using_open_id? open_id_authenticate(params[:openid_url]) @@ -151,7 +151,7 @@ class AccountController < ApplicationController end end - + def open_id_authenticate(openid_url) authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email], :return_to => signin_url) do |result, identity_url, registration| if result.successful? @@ -180,7 +180,7 @@ class AccountController < ApplicationController register_manually_by_administrator(user) do onthefly_creation_failed(user) end - end + end else # Existing record if user.active? @@ -192,7 +192,7 @@ class AccountController < ApplicationController end end end - + def successful_authentication(user) # Valid user self.logged_user = user @@ -203,7 +203,7 @@ class AccountController < ApplicationController call_hook(:controller_account_success_authentication_after, {:user => user }) redirect_back_or_default :controller => 'my', :action => 'page' end - + def set_autologin_cookie(user) token = Token.create(:user => user, :action => 'autologin') cookie_options = { @@ -241,7 +241,7 @@ class AccountController < ApplicationController yield if block_given? end end - + # Automatically register a user # # Pass a block for behavior when a user fails to save @@ -257,7 +257,7 @@ class AccountController < ApplicationController yield if block_given? end end - + # Manual activation by the administrator # # Pass a block for behavior when a user fails to save diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb index a7cc8976..d9cf6f1d 100644 --- a/app/controllers/activities_controller.rb +++ b/app/controllers/activities_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -18,7 +18,7 @@ class ActivitiesController < ApplicationController def index @days = Setting.activity_days_default.to_i - + if params[:from] begin; @date_to = params[:from].to_date + 1; rescue; end end @@ -27,18 +27,18 @@ class ActivitiesController < ApplicationController @date_from = @date_to - @days @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id])) - - @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, + + @activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, :with_subprojects => @with_subprojects, :author => @author) @activity.scope_select {|t| !params["show_#{t}"].nil?} @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty? events = @activity.events(@date_from, @date_to) - + if events.empty? || stale?(:etag => [@activity.scope, @date_to, @date_from, @with_subprojects, @author, events.first, User.current, current_language]) respond_to do |format| - format.html { + format.html { @events_by_day = events.group_by(&:event_date) render :layout => false if request.xhr? } @@ -53,7 +53,7 @@ class ActivitiesController < ApplicationController } end end - + rescue ActiveRecord::RecordNotFound render_404 end diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 868a92b7..df0939c2 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -1,46 +1,46 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class AdminController < ApplicationController layout 'admin' - + before_filter :require_admin - include SortHelper + include SortHelper def index @no_configuration_data = Redmine::DefaultData::Loader::no_data? end - + def projects @status = params[:status] ? params[:status].to_i : 1 c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status]) - + unless params[:name].blank? name = "%#{params[:name].strip.downcase}%" c << ["LOWER(identifier) LIKE ? OR LOWER(name) LIKE ?", name, name] end - + @projects = Project.find :all, :order => 'lft', :conditions => c.conditions render :action => "projects", :layout => false if request.xhr? end - + def plugins @plugins = Redmine::Plugin.all end - + # Loads the default configuration # (roles, trackers, statuses, workflow, enumerations) def default_configuration @@ -54,7 +54,7 @@ class AdminController < ApplicationController end redirect_to :action => 'index' end - + def test_email raise_delivery_errors = ActionMailer::Base.raise_delivery_errors # Force ActionMailer to raise delivery errors so we can catch it @@ -68,7 +68,7 @@ class AdminController < ApplicationController ActionMailer::Base.raise_delivery_errors = raise_delivery_errors redirect_to :controller => 'settings', :action => 'edit', :tab => 'notifications' end - + def info @db_adapter_name = ActiveRecord::Base.connection.adapter_name @checklist = [ @@ -77,5 +77,5 @@ class AdminController < ApplicationController [:text_plugin_assets_writable, File.writable?(Engines.public_directory)], [:text_rmagick_available, Object.const_defined?(:Magick)] ] - end + end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a5470b80..45b1261c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -18,34 +18,34 @@ class ApplicationController < ActionController::Base helper :all protected - + include Redmine::I18n layout 'base' exempt_from_layout 'builder', 'rsb' - + # Remove broken cookie after upgrade from 0.8.x (#4292) # See https://rails.lighthouseapp.com/projects/8994/tickets/3360 # TODO: remove it when Rails is fixed before_filter :delete_broken_cookies def delete_broken_cookies if cookies['_chiliproject_session'] && cookies['_chiliproject_session'] !~ /--/ - cookies.delete '_chiliproject_session' + cookies.delete '_chiliproject_session' redirect_to home_path return false end end - + before_filter :user_setup, :check_if_login_required, :set_localization filter_parameter_logging :password protect_from_forgery - + rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token - + include Redmine::Search::Controller include Redmine::MenuManager::MenuController helper Redmine::MenuManager::MenuHelper - + Redmine::Scm::Base.all.each do |scm| require_dependency "repository/#{scm.underscore}" end @@ -56,7 +56,7 @@ class ApplicationController < ActionController::Base # Find the current user User.current = find_current_user end - + # Returns the current user or nil if no user is logged in # and starts a session if needed def find_current_user @@ -94,14 +94,14 @@ class ApplicationController < ActionController::Base User.current = User.anonymous end end - + # check if login is globally required to access the application def check_if_login_required # no check needed if user is already logged in return true if User.current.logged? require_login if Setting.login_required? - end - + end + def set_localization lang = nil if User.current.logged? @@ -117,7 +117,7 @@ class ApplicationController < ActionController::Base lang ||= Setting.default_language set_language_if_valid(lang) end - + def require_login if !User.current.logged? # Extract only the basic url parameters on non-GET requests @@ -146,7 +146,7 @@ class ApplicationController < ActionController::Base end true end - + def deny_access User.current.logged? ? render_403 : require_login end @@ -197,7 +197,7 @@ class ApplicationController < ActionController::Base # Finds and sets @project based on @object.project def find_project_from_association render_404 unless @object.present? - + @project = @object.project rescue ActiveRecord::RecordNotFound render_404 @@ -226,7 +226,7 @@ class ApplicationController < ActionController::Base rescue ActiveRecord::RecordNotFound render_404 end - + # Check if project is unique before bulk operations def check_project_uniqueness unless @project @@ -235,7 +235,7 @@ class ApplicationController < ActionController::Base return false end end - + # make sure that the user is a member of the project (or admin) if project is private # used as a before_filter for actions that do not require any particular permission on the project def check_project_privacy @@ -273,26 +273,26 @@ class ApplicationController < ActionController::Base redirect_to default false end - + def render_403(options={}) @project = nil render_error({:message => :notice_not_authorized, :status => 403}.merge(options)) return false end - + def render_404(options={}) render_error({:message => :notice_file_not_found, :status => 404}.merge(options)) return false end - + # Renders an error response def render_error(arg) arg = {:message => arg} unless arg.is_a?(Hash) - + @message = arg[:message] @message = l(@message) if @message.is_a?(Symbol) @status = arg[:status] || 500 - + respond_to do |format| format.html { render :template => 'common/error', :layout => use_layout, :status => @status @@ -310,31 +310,31 @@ class ApplicationController < ActionController::Base def use_layout request.xhr? ? false : 'base' end - + def invalid_authenticity_token if api_request? logger.error "Form authenticity token is missing or is invalid. API calls must include a proper Content-type header (text/xml or text/json)." end render_error "Invalid form authenticity token." end - - def render_feed(items, options={}) + + def render_feed(items, options={}) @items = items || [] @items.sort! {|x,y| y.event_datetime <=> x.event_datetime } @items = @items.slice(0, Setting.feeds_limit.to_i) @title = options[:title] || Setting.app_title render :template => "common/feed.atom.rxml", :layout => false, :content_type => 'application/atom+xml' end - + def self.accept_key_auth(*actions) actions = actions.flatten.map(&:to_s) write_inheritable_attribute('accept_key_auth_actions', actions) end - + def accept_key_auth_actions self.class.read_inheritable_attribute('accept_key_auth_actions') || [] end - + # Returns the number of objects that should be displayed # on the paginated list def per_page_option @@ -370,10 +370,10 @@ class ApplicationController < ActionController::Base offset = 0 if offset < 0 end offset ||= 0 - + [offset, limit] end - + # qvalues http header parser # code taken from webrick def parse_qvalues(value) @@ -394,16 +394,16 @@ class ApplicationController < ActionController::Base rescue nil end - + # Returns a string that can be used as filename value in Content-Disposition header def filename_for_content_disposition(name) request.env['HTTP_USER_AGENT'] =~ %r{MSIE} ? ERB::Util.url_encode(name) : name end - + def api_request? %w(xml json).include? params[:format] end - + # Returns the API key present in the request def api_key_from_request if params[:key].present? @@ -460,7 +460,7 @@ class ApplicationController < ActionController::Base ) render options end - + # Overrides #default_template so that the api template # is used automatically if it exists def default_template(action_name = self.action_name) @@ -474,7 +474,7 @@ class ApplicationController < ActionController::Base end super end - + # Overrides #pick_layout so that #render with no arguments # doesn't use the layout for api requests def pick_layout(*args) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 32f37459..f2992a25 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -15,9 +15,9 @@ class AttachmentsController < ApplicationController before_filter :find_project before_filter :file_readable, :read_authorize, :except => :destroy before_filter :delete_authorize, :only => :destroy - + verify :method => :post, :only => :destroy - + def show if @attachment.is_diff? @diff = File.new(@attachment.diskfile, "rb").read @@ -29,19 +29,19 @@ class AttachmentsController < ApplicationController download end end - + def download if @attachment.container.is_a?(Version) || @attachment.container.is_a?(Project) @attachment.increment_download end - + # images are sent inline send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), - :type => detect_content_type(@attachment), + :type => detect_content_type(@attachment), :disposition => (@attachment.image? ? 'inline' : 'attachment') - + end - + def destroy # Make sure association callbacks are called @attachment.container.attachments.delete(@attachment) @@ -49,7 +49,7 @@ class AttachmentsController < ApplicationController rescue ::ActionController::RedirectBackError redirect_to :controller => 'projects', :action => 'show', :id => @project end - + private def find_project @attachment = Attachment.find(params[:id]) @@ -59,20 +59,20 @@ private rescue ActiveRecord::RecordNotFound render_404 end - + # Checks that the file exists and is readable def file_readable @attachment.readable? ? true : render_404 end - + def read_authorize @attachment.visible? ? true : deny_access end - + def delete_authorize @attachment.deletable? ? true : deny_access end - + def detect_content_type(attachment) content_type = attachment.content_type if content_type.blank? diff --git a/app/controllers/auth_sources_controller.rb b/app/controllers/auth_sources_controller.rb index bf90ed01..dbe11256 100644 --- a/app/controllers/auth_sources_controller.rb +++ b/app/controllers/auth_sources_controller.rb @@ -1,19 +1,19 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class AuthSourcesController < ApplicationController layout 'admin' - + before_filter :require_admin # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) @@ -54,7 +54,7 @@ class AuthSourcesController < ApplicationController render 'auth_sources/edit' end end - + def test_connection @auth_method = AuthSource.find(params[:id]) begin diff --git a/app/controllers/auto_completes_controller.rb b/app/controllers/auto_completes_controller.rb index a03e2c5f..27ef1667 100644 --- a/app/controllers/auto_completes_controller.rb +++ b/app/controllers/auto_completes_controller.rb @@ -1,19 +1,19 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class AutoCompletesController < ApplicationController before_filter :find_project - + def issues @issues = [] q = params[:q].to_s diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 7b4483ad..9e9700e7 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -19,7 +19,7 @@ class BoardsController < ApplicationController include MessagesHelper include SortHelper include WatchersHelper - + def index @boards = @project.boards render_404 if @boards.empty? @@ -37,7 +37,7 @@ class BoardsController < ApplicationController sort_update 'created_on' => "#{Message.table_name}.created_on", 'replies' => "#{Message.table_name}.replies_count", 'updated_on' => "#{Message.table_name}.updated_on" - + @topic_count = @board.topics.count @topic_pages = Paginator.new self, @topic_count, per_page_option, params['page'] @topics = @board.topics.find :all, :order => ["#{Message.table_name}.sticky DESC", sort_clause].compact.join(', '), @@ -55,7 +55,7 @@ class BoardsController < ApplicationController } end end - + verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :index } def new @@ -77,7 +77,7 @@ class BoardsController < ApplicationController @board.destroy redirect_to_settings_in_projects end - + private def redirect_to_settings_in_projects redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards' diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb index 31c574a8..6161b6ed 100644 --- a/app/controllers/calendars_controller.rb +++ b/app/controllers/calendars_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -25,11 +25,11 @@ class CalendarsController < ApplicationController @year = params[:year].to_i if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13 @month = params[:month].to_i - end + end end @year ||= Date.today.year @month ||= Date.today.month - + @calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), current_language, :month) retrieve_query @query.group_by = nil @@ -39,13 +39,13 @@ class CalendarsController < ApplicationController :conditions => ["((start_date BETWEEN ? AND ?) OR (due_date BETWEEN ? AND ?))", @calendar.startdt, @calendar.enddt, @calendar.startdt, @calendar.enddt] ) events += @query.versions(:conditions => ["effective_date BETWEEN ? AND ?", @calendar.startdt, @calendar.enddt]) - + @calendar.events = events end - + render :action => 'show', :layout => false if request.xhr? end - + def update show end diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 8500dabb..fafeea92 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -25,7 +25,7 @@ class CommentsController < ApplicationController if @news.comments << @comment flash[:notice] = l(:label_comment_added) end - + redirect_to :controller => 'news', :action => 'show', :id => @news end @@ -45,5 +45,5 @@ class CommentsController < ApplicationController @comment = nil @news end - + end diff --git a/app/controllers/context_menus_controller.rb b/app/controllers/context_menus_controller.rb index 6fbc45c3..b1099b66 100644 --- a/app/controllers/context_menus_controller.rb +++ b/app/controllers/context_menus_controller.rb @@ -1,21 +1,21 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class ContextMenusController < ApplicationController - + def issues @issues = Issue.visible.all(:conditions => {:id => params[:ids]}, :include => :project) - + if (@issues.size == 1) @issue = @issues.first @allowed_statuses = @issue.new_statuses_allowed_to(User.current) @@ -45,12 +45,12 @@ class ContextMenusController < ApplicationController @assignables = @projects.map(&:assignable_users).inject{|memo,a| memo & a} @trackers = @projects.map(&:trackers).inject{|memo,t| memo & t} end - + @priorities = IssuePriority.all.reverse @statuses = IssueStatus.find(:all, :order => 'position') @back = back_url - + render :layout => false end - + end diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb index 00adc1f9..294328ac 100644 --- a/app/controllers/custom_fields_controller.rb +++ b/app/controllers/custom_fields_controller.rb @@ -1,26 +1,26 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class CustomFieldsController < ApplicationController layout 'admin' - + before_filter :require_admin def index @custom_fields_by_type = CustomField.find(:all).group_by {|f| f.class.name } @tab = params[:tab] || 'IssueCustomField' end - + def new @custom_field = begin if params[:type].to_s.match(/.+CustomField$/) @@ -29,7 +29,7 @@ class CustomFieldsController < ApplicationController rescue end (redirect_to(:action => 'index'); return) unless @custom_field.is_a?(CustomField) - + if request.post? and @custom_field.save flash[:notice] = l(:notice_successful_create) call_hook(:controller_custom_fields_new_after_save, :params => params, :custom_field => @custom_field) @@ -49,7 +49,7 @@ class CustomFieldsController < ApplicationController @trackers = Tracker.find(:all, :order => 'position') end end - + def destroy @custom_field = CustomField.find(params[:id]).destroy redirect_to :action => 'index', :tab => @custom_field.class.name diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index f9e0d0d5..be66e1f1 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -18,8 +18,8 @@ class DocumentsController < ApplicationController before_filter :find_model_object, :except => [:index, :new] before_filter :find_project_from_association, :except => [:index, :new] before_filter :authorize - - + + def index @sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category' documents = @project.documents.find :all, :include => [:attachments, :category] @@ -36,34 +36,34 @@ class DocumentsController < ApplicationController @document = @project.documents.build render :layout => false if request.xhr? end - + def show @attachments = @document.attachments.find(:all, :order => "created_on DESC") end def new - @document = @project.documents.build(params[:document]) - if request.post? and @document.save + @document = @project.documents.build(params[:document]) + if request.post? and @document.save attachments = Attachment.attach_files(@document, params[:attachments]) render_attachment_warning_if_needed(@document) flash[:notice] = l(:notice_successful_create) redirect_to :action => 'index', :project_id => @project end end - + def edit @categories = DocumentCategory.all if request.post? and @document.update_attributes(params[:document]) flash[:notice] = l(:notice_successful_update) redirect_to :action => 'show', :id => @document end - end + end def destroy @document.destroy redirect_to :controller => 'documents', :action => 'index', :project_id => @project end - + def add_attachment attachments = Attachment.attach_files(@document, params[:attachments]) render_attachment_warning_if_needed(@document) diff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rb index cee57f05..2cebc9c5 100644 --- a/app/controllers/enumerations_controller.rb +++ b/app/controllers/enumerations_controller.rb @@ -1,23 +1,23 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class EnumerationsController < ApplicationController layout 'admin' - + before_filter :require_admin include CustomFieldsHelper - + def index list render :action => 'list' @@ -34,7 +34,7 @@ class EnumerationsController < ApplicationController begin @enumeration = params[:type].constantize.new rescue NameError - @enumeration = Enumeration.new + @enumeration = Enumeration.new end end @@ -63,7 +63,7 @@ class EnumerationsController < ApplicationController render :action => 'edit' end end - + def destroy @enumeration = Enumeration.find(params[:id]) if !@enumeration.in_use? diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index afe35be6..f2c46e76 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -25,7 +25,7 @@ class FilesController < ApplicationController 'created_on' => "#{Attachment.table_name}.created_on", 'size' => "#{Attachment.table_name}.filesize", 'downloads' => "#{Attachment.table_name}.downloads" - + @containers = [ Project.find(@project.id, :include => :attachments, :order => sort_clause)] @containers += @project.versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse render :layout => !request.xhr? diff --git a/app/controllers/gantts_controller.rb b/app/controllers/gantts_controller.rb index b7650460..34e428a9 100644 --- a/app/controllers/gantts_controller.rb +++ b/app/controllers/gantts_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -20,16 +20,16 @@ class GanttsController < ApplicationController include QueriesHelper include SortHelper include Redmine::Export::PDF - + def show @gantt = Redmine::Helpers::Gantt.new(params) @gantt.project = @project retrieve_query @query.group_by = nil @gantt.query = @query if @query.valid? - + basename = (@project ? "#{@project.identifier}-" : '') + 'gantt' - + respond_to do |format| format.html { render :action => "show", :layout => !request.xhr? } format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image') diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index e33b201e..1ba5252c 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,22 +1,22 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class GroupsController < ApplicationController layout 'admin' - + before_filter :require_admin - - + + # GET /groups # GET /groups.xml def index @@ -43,7 +43,7 @@ class GroupsController < ApplicationController # GET /groups/new.xml def new @group = Group.new - + respond_to do |format| format.html # new.html.erb format.xml { render :xml => @group } @@ -100,22 +100,22 @@ class GroupsController < ApplicationController format.xml { head :ok } end end - + def add_users @group = Group.find(params[:id]) users = User.find_all_by_id(params[:user_ids]) @group.users << users if request.post? respond_to do |format| format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'users' } - format.js { - render(:update) {|page| + format.js { + render(:update) {|page| page.replace_html "tab-content-users", :partial => 'groups/users' users.each {|user| page.visual_effect(:highlight, "user-#{user.id}") } } } end end - + def remove_user @group = Group.find(params[:id]) @group.users.delete(User.find(params[:user_id])) if request.post? @@ -124,13 +124,13 @@ class GroupsController < ApplicationController format.js { render(:update) {|page| page.replace_html "tab-content-users", :partial => 'groups/users'} } end end - + def autocomplete_for_user @group = Group.find(params[:id]) @users = User.active.not_in_group(@group).like(params[:q]).all(:limit => 100) render :layout => false end - + def edit_membership @group = Group.find(params[:id]) @membership = Member.edit_membership(params[:membership_id], params[:membership], @group) @@ -153,7 +153,7 @@ class GroupsController < ApplicationController end end end - + def destroy_membership @group = Group.find(params[:id]) Member.find(params[:membership_id]).destroy if request.post? diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index afc13abd..c0a55983 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ diff --git a/app/controllers/issue_categories_controller.rb b/app/controllers/issue_categories_controller.rb index 835abe8d..75a2aef5 100644 --- a/app/controllers/issue_categories_controller.rb +++ b/app/controllers/issue_categories_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -18,7 +18,7 @@ class IssueCategoriesController < ApplicationController before_filter :find_project_from_association, :except => :new before_filter :find_project, :only => :new before_filter :authorize - + verify :method => :post, :only => :destroy def new @@ -47,7 +47,7 @@ class IssueCategoriesController < ApplicationController end end end - + def edit if request.post? and @category.update_attributes(params[:category]) flash[:notice] = l(:notice_successful_update) @@ -77,8 +77,8 @@ private def find_model_object super @category = @object - end - + end + def find_project @project = Project.find(params[:project_id]) rescue ActiveRecord::RecordNotFound diff --git a/app/controllers/issue_moves_controller.rb b/app/controllers/issue_moves_controller.rb index 1eada442..98621b0b 100644 --- a/app/controllers/issue_moves_controller.rb +++ b/app/controllers/issue_moves_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -15,7 +15,7 @@ class IssueMovesController < ApplicationController default_search_scope :issues before_filter :find_issues, :check_project_uniqueness before_filter :authorize - + def new prepare_for_issue_move render :layout => false if request.xhr? @@ -60,7 +60,7 @@ class IssueMovesController < ApplicationController @copy = params[:copy_options] && params[:copy_options][:copy] @allowed_projects = Issue.allowed_target_projects_on_move @target_project = @allowed_projects.detect {|p| p.id.to_s == params[:new_project_id]} if params[:new_project_id] - @target_project ||= @project + @target_project ||= @project @trackers = @target_project.trackers @available_statuses = Workflow.available_statuses(@project) @notes = params[:notes] diff --git a/app/controllers/issue_relations_controller.rb b/app/controllers/issue_relations_controller.rb index b5448adb..a053dbdc 100644 --- a/app/controllers/issue_relations_controller.rb +++ b/app/controllers/issue_relations_controller.rb @@ -1,19 +1,19 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class IssueRelationsController < ApplicationController before_filter :find_issue, :find_project_from_association, :authorize - + def new @relation = IssueRelation.new(params[:relation]) @relation.issue_from = @issue @@ -35,7 +35,7 @@ class IssueRelationsController < ApplicationController end end end - + def destroy relation = IssueRelation.find(params[:id]) if request.post? && @issue.relations.include?(relation) @@ -50,7 +50,7 @@ class IssueRelationsController < ApplicationController } end end - + private def find_issue @issue = @object = Issue.find(params[:issue_id]) diff --git a/app/controllers/issue_statuses_controller.rb b/app/controllers/issue_statuses_controller.rb index 7537c8dd..3258a289 100644 --- a/app/controllers/issue_statuses_controller.rb +++ b/app/controllers/issue_statuses_controller.rb @@ -1,24 +1,24 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class IssueStatusesController < ApplicationController layout 'admin' - + before_filter :require_admin verify :method => :post, :only => [ :destroy, :create, :update, :move, :update_issue_done_ratio ], :redirect_to => { :action => :index } - + def index @issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 25, :order => "position" render :action => "index", :layout => false if request.xhr? @@ -58,8 +58,8 @@ class IssueStatusesController < ApplicationController rescue flash[:error] = l(:error_unable_delete_issue_status) redirect_to :action => 'index' - end - + end + def update_issue_done_ratio if IssueStatus.update_issue_done_ratios flash[:notice] = l(:notice_issue_done_ratios_updated) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index b8cc8117..10e2dc26 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -1,20 +1,20 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class IssuesController < ApplicationController menu_item :new_issue, :only => [:new, :create] default_search_scope :issues - + before_filter :find_issue, :only => [:show, :edit, :update] before_filter :find_issues, :only => [:bulk_edit, :bulk_update, :move, :perform_move, :destroy] before_filter :check_project_uniqueness, :only => [:move, :perform_move] @@ -26,11 +26,11 @@ class IssuesController < ApplicationController accept_key_auth :index, :show, :create, :update, :destroy rescue_from Query::StatementInvalid, :with => :query_statement_invalid - + helper :journals include JournalsHelper helper :projects - include ProjectsHelper + include ProjectsHelper include CustomFieldsHelper include IssueRelationsHelper include WatchersHelper @@ -48,12 +48,12 @@ class IssuesController < ApplicationController verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed } verify :method => :post, :only => :bulk_update, :render => {:nothing => true, :status => :method_not_allowed } verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed } - + def index retrieve_query sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria) sort_update(@query.sortable_columns) - + if @query.valid? case params[:format] when 'csv', 'pdf' @@ -65,16 +65,16 @@ class IssuesController < ApplicationController else @limit = per_page_option end - + @issue_count = @query.issue_count @issue_pages = Paginator.new self, @issue_count, @limit, params['page'] @offset ||= @issue_pages.current.offset @issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], - :order => sort_clause, - :offset => @offset, + :order => sort_clause, + :offset => @offset, :limit => @limit) @issue_count_by_group = @query.issue_count_by_group - + respond_to do |format| format.html { render :template => 'issues/index.rhtml', :layout => !request.xhr? } format.api @@ -89,7 +89,7 @@ class IssuesController < ApplicationController rescue ActiveRecord::RecordNotFound render_404 end - + def show @journals = @issue.journals.find(:all, :include => [:user], :order => "#{Journal.table_name}.created_at ASC") @journals.reverse! if User.current.wants_comments_in_reverse_order? @@ -140,7 +140,7 @@ class IssuesController < ApplicationController end end end - + def edit return render_reply(@journal) if @journal update_issue_from_params @@ -204,7 +204,7 @@ class IssuesController < ApplicationController set_flash_from_bulk_issue_save(@issues, unsaved_issue_ids) redirect_back_or_default({:controller => 'issues', :action => 'index', :project_id => @project}) end - + def destroy @hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f if @hours > 0 @@ -246,14 +246,14 @@ private rescue ActiveRecord::RecordNotFound render_404 end - + def find_project project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id] @project = Project.find(project_id) rescue ActiveRecord::RecordNotFound render_404 end - + # Used by #edit and #update to set some common instance variables # from the params # TODO: Refactor, not everything in here is needed by #edit @@ -263,7 +263,7 @@ private @edit_allowed = User.current.allowed_to?(:edit_issues, @project) @time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project) @time_entry.attributes = params[:time_entry] - + @notes = params[:notes] || (params[:issue].present? ? params[:issue][:notes] : nil) @issue.init_journal(User.current, @notes) @issue.safe_attributes = params[:issue] @@ -280,7 +280,7 @@ private else @issue = @project.issues.visible.find(params[:id]) end - + @issue.project = @project # Tracker must be set before custom field values @issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first) diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index ccdda4e2..9df0f949 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -18,7 +18,7 @@ class JournalsController < ApplicationController before_filter :authorize, :only => [:new, :edit, :diff] accept_key_auth :index menu_item :issues - + include QueriesHelper include SortHelper @@ -26,9 +26,9 @@ class JournalsController < ApplicationController retrieve_query sort_init 'id', 'desc' sort_update(@query.sortable_columns) - + if @query.valid? - @journals = @query.issue_journals(:order => "#{Journal.table_name}.created_at DESC", + @journals = @query.issue_journals(:order => "#{Journal.table_name}.created_at DESC", :limit => 25) end @title = (@project ? @project.name : Setting.app_title) + ": " + (@query.new_record? ? l(:label_changes_details) : @query.name) @@ -51,7 +51,7 @@ class JournalsController < ApplicationController text = text.to_s.strip.gsub(%r{
((.|\s)*?)}m, '[...]') content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> " content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" - + render(:update) { |page| page.<< "$('notes').value = \"#{escape_javascript content}\";" page.show 'update' @@ -60,7 +60,7 @@ class JournalsController < ApplicationController page << "$('notes').scrollTop = $('notes').scrollHeight - $('notes').clientHeight;" } end - + def edit (render_403; return false) unless @journal.editable_by?(User.current) if request.post? @@ -76,15 +76,15 @@ class JournalsController < ApplicationController respond_to do |format| format.html { # TODO: implement non-JS journal update - render :nothing => true + render :nothing => true } format.js end end end - + private - + def find_journal @journal = Journal.find(params[:id]) @project = @journal.journalized.project diff --git a/app/controllers/ldap_auth_sources_controller.rb b/app/controllers/ldap_auth_sources_controller.rb index 8e0b1148..56c5ee8d 100644 --- a/app/controllers/ldap_auth_sources_controller.rb +++ b/app/controllers/ldap_auth_sources_controller.rb @@ -1,20 +1,20 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class LdapAuthSourcesController < AuthSourcesController protected - + def auth_source_class AuthSourceLdap end diff --git a/app/controllers/mail_handler_controller.rb b/app/controllers/mail_handler_controller.rb index 71d424ef..7301503a 100644 --- a/app/controllers/mail_handler_controller.rb +++ b/app/controllers/mail_handler_controller.rb @@ -1,23 +1,23 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class MailHandlerController < ActionController::Base before_filter :check_credential - + verify :method => :post, :only => :index, :render => { :nothing => true, :status => 405 } - + # Submits an incoming email to MailHandler def index options = params.dup @@ -28,9 +28,9 @@ class MailHandlerController < ActionController::Base render :nothing => true, :status => :unprocessable_entity end end - + private - + def check_credential User.current = nil unless Setting.mail_handler_api_enabled? && params[:key].to_s == Setting.mail_handler_api_key diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index f2a73c19..a3a3e36b 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -36,8 +36,8 @@ class MembersController < ApplicationController format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project } - format.js { - render(:update) {|page| + format.js { + render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/settings/members' page << 'hideOnLoad()' members.each {|member| page.visual_effect(:highlight, "member-#{member.id}") } @@ -54,17 +54,17 @@ class MembersController < ApplicationController page.alert(l(:notice_failed_to_save_members, :errors => errors.join(', '))) } } - + end end end - + def edit if request.post? and @member.update_attributes(params[:member]) respond_to do |format| format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project } - format.js { - render(:update) {|page| + format.js { + render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/settings/members' page << 'hideOnLoad()' page.visual_effect(:highlight, "member-#{@member.id}") @@ -87,7 +87,7 @@ class MembersController < ApplicationController } end end - + def autocomplete_for_member @principals = Principal.active.like(params[:q]).find(:all, :limit => 100) - @project.principals render :layout => false diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index cd8ccce0..af34eb89 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -21,10 +21,10 @@ class MessagesController < ApplicationController verify :method => :post, :only => [ :reply, :destroy ], :redirect_to => { :action => :show } verify :xhr => true, :only => :quote - include AttachmentsHelper + include AttachmentsHelper REPLIES_PER_PAGE = 25 unless const_defined?(:REPLIES_PER_PAGE) - + # Show a topic and its replies def show page = params[:page] @@ -33,18 +33,18 @@ class MessagesController < ApplicationController offset = @topic.children.count(:conditions => ["#{Message.table_name}.id < ?", params[:r].to_i]) page = 1 + offset / REPLIES_PER_PAGE end - + @reply_count = @topic.children.count @reply_pages = Paginator.new self, @reply_count, REPLIES_PER_PAGE, page @replies = @topic.children.find(:all, :include => [:author, :attachments, {:board => :project}], :order => "#{Message.table_name}.created_on ASC", :limit => @reply_pages.items_per_page, :offset => @reply_pages.current.offset) - + @reply = Message.new(:subject => "RE: #{@message.subject}") render :action => "show", :layout => false if request.xhr? end - + # Create a new topic def new @message = Message.new(params[:message]) @@ -91,7 +91,7 @@ class MessagesController < ApplicationController redirect_to :action => 'show', :board_id => @message.board, :id => @message.root, :r => (@message.parent_id && @message.id) end end - + # Delete a messages def destroy (render_403; return false) unless @message.destroyable_by?(User.current) @@ -100,7 +100,7 @@ class MessagesController < ApplicationController { :controller => 'boards', :action => 'show', :project_id => @project, :id => @board } : { :action => 'show', :id => @message.parent, :r => @message } end - + def quote user = @message.author text = @message.content @@ -117,14 +117,14 @@ class MessagesController < ApplicationController page << "$('message_content').scrollTop = $('message_content').scrollHeight - $('message_content').clientHeight;" } end - + def preview message = @board.messages.find_by_id(params[:id]) @attachements = message.attachments if message @text = (params[:message] || params[:reply])[:content] render :partial => 'common/preview' end - + private def find_message find_board @@ -133,7 +133,7 @@ private rescue ActiveRecord::RecordNotFound render_404 end - + def find_board @board = Board.find(params[:board_id], :include => :project) @project = @board.project diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index d15fbdfd..ad70cdd3 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -24,8 +24,8 @@ class MyController < ApplicationController 'timelog' => :label_spent_time }.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze - DEFAULT_LAYOUT = { 'left' => ['issuesassignedtome'], - 'right' => ['issuesreportedbyme'] + DEFAULT_LAYOUT = { 'left' => ['issuesassignedtome'], + 'right' => ['issuesreportedbyme'] }.freeze verify :xhr => true, @@ -81,7 +81,7 @@ class MyController < ApplicationController end end end - + # Create a new feeds key def reset_rss_key if request.post? @@ -115,7 +115,7 @@ class MyController < ApplicationController @block_options = [] BLOCKS.each {|k, v| @block_options << [l("my.blocks.#{v}", :default => [v, v.to_s.humanize]), k.dasherize]} 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 @@ -129,10 +129,10 @@ class MyController < ApplicationController # add it on top layout['top'].unshift block @user.pref[:my_page_layout] = layout - @user.pref.save + @user.pref.save render :partial => "block", :locals => {:user => @user, :block_name => block} end - + # Remove a block to user's page # params[:block] : id of the block to remove def remove_block @@ -142,7 +142,7 @@ class MyController < ApplicationController 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 + @user.pref.save render :nothing => true end @@ -162,7 +162,7 @@ class MyController < ApplicationController } layout[group] = group_items @user.pref[:my_page_layout] = layout - @user.pref.save + @user.pref.save end end render :nothing => true diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 4a84ee94..c218251c 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -20,8 +20,8 @@ class NewsController < ApplicationController before_filter :authorize, :except => [:index] before_filter :find_optional_project, :only => :index accept_key_auth :index - - + + def index case params[:format] when 'xml', 'json' @@ -29,9 +29,9 @@ class NewsController < ApplicationController else @limit = 10 end - + scope = @project ? @project.news.visible : News.visible - + @news_count = scope.count @news_pages = Paginator.new self, @news_count, @limit, params['page'] @offset ||= @news_pages.current.offset @@ -39,14 +39,14 @@ class NewsController < ApplicationController :order => "#{News.table_name}.created_on DESC", :offset => @offset, :limit => @limit) - + respond_to do |format| format.html { render :layout => false if request.xhr? } format.api format.atom { render_feed(@newss, :title => (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}") } end end - + def show @comments = @news.comments @comments.reverse! if User.current.wants_comments_in_reverse_order? @@ -71,7 +71,7 @@ class NewsController < ApplicationController def edit end - + def update if request.put? and @news.update_attributes(params[:news]) flash[:notice] = l(:notice_successful_update) @@ -85,14 +85,14 @@ class NewsController < ApplicationController @news.destroy redirect_to :action => 'index', :project_id => @project end - + private def find_project @project = Project.find(params[:project_id]) rescue ActiveRecord::RecordNotFound render_404 end - + def find_optional_project return true unless params[:project_id] @project = Project.find(params[:project_id]) diff --git a/app/controllers/previews_controller.rb b/app/controllers/previews_controller.rb index 52ae6983..b863b620 100644 --- a/app/controllers/previews_controller.rb +++ b/app/controllers/previews_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -35,12 +35,12 @@ class PreviewsController < ApplicationController end private - + def find_project project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id] @project = Project.find(project_id) rescue ActiveRecord::RecordNotFound render_404 end - + end diff --git a/app/controllers/project_enumerations_controller.rb b/app/controllers/project_enumerations_controller.rb index 49a134ed..027f682d 100644 --- a/app/controllers/project_enumerations_controller.rb +++ b/app/controllers/project_enumerations_controller.rb @@ -1,20 +1,20 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class ProjectEnumerationsController < ApplicationController before_filter :find_project_by_project_id before_filter :authorize - + def update if request.put? && params[:enumerations] Project.transaction do @@ -24,7 +24,7 @@ class ProjectEnumerationsController < ApplicationController end flash[:notice] = l(:notice_successful_update) end - + redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index b11e617b..133a18cb 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -15,7 +15,7 @@ class ProjectsController < ApplicationController menu_item :overview menu_item :roadmap, :only => :roadmap menu_item :settings, :only => :settings - + before_filter :find_project, :except => [ :index, :list, :new, :create, :copy ] before_filter :authorize, :except => [ :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy] before_filter :authorize_global, :only => [:new, :create] @@ -29,16 +29,16 @@ class ProjectsController < ApplicationController end include SortHelper - include CustomFieldsHelper + include CustomFieldsHelper include QueriesHelper include RepositoriesHelper include ProjectsHelper - + # Lists visible projects def index respond_to do |format| - format.html { - @projects = Project.visible.find(:all, :order => 'lft') + format.html { + @projects = Project.visible.find(:all, :order => 'lft') } format.api { @offset, @limit = api_offset_and_limit @@ -52,7 +52,7 @@ class ProjectsController < ApplicationController } end end - + def new @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position") @trackers = Tracker.all @@ -75,7 +75,7 @@ class ProjectsController < ApplicationController @project.members << m end respond_to do |format| - format.html { + format.html { flash[:notice] = l(:notice_successful_create) redirect_to :controller => 'projects', :action => 'settings', :id => @project } @@ -87,9 +87,9 @@ class ProjectsController < ApplicationController format.api { render_validation_errors(@project) } end end - + end - + def copy @issue_custom_fields = IssueCustomField.find(:all, :order => "#{CustomField.table_name}.position") @trackers = Tracker.all @@ -103,7 +103,7 @@ class ProjectsController < ApplicationController @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers? else redirect_to :controller => 'admin', :action => 'projects' - end + end else Mailer.with_deliveries(params[:notifications] == '1') do @project = Project.new @@ -125,34 +125,34 @@ class ProjectsController < ApplicationController rescue ActiveRecord::RecordNotFound redirect_to :controller => 'admin', :action => 'projects' end - + # Show @project def show if params[:jump] # try to redirect to the requested menu item redirect_to_project_menu_item(@project, params[:jump]) && return end - + @users_by_role = @project.users_by_role @subprojects = @project.children.visible.all @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") @trackers = @project.rolled_up_trackers - + cond = @project.project_condition(Setting.display_subprojects_issues?) - + @open_issues_by_tracker = Issue.visible.count(:group => :tracker, :include => [:project, :status, :tracker], :conditions => ["(#{cond}) AND #{IssueStatus.table_name}.is_closed=?", false]) @total_issues_by_tracker = Issue.visible.count(:group => :tracker, :include => [:project, :status, :tracker], :conditions => cond) - + if User.current.allowed_to?(:view_time_entries, @project) @total_hours = TimeEntry.visible.sum(:hours, :include => :project, :conditions => cond).to_f end - + @key = User.current.rss_key - + respond_to do |format| format.html format.api @@ -167,7 +167,7 @@ class ProjectsController < ApplicationController @repository ||= @project.repository @wiki ||= @project.wiki end - + def edit end @@ -178,7 +178,7 @@ class ProjectsController < ApplicationController if validate_parent_id && @project.save @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id') respond_to do |format| - format.html { + format.html { flash[:notice] = l(:notice_successful_update) redirect_to :action => 'settings', :id => @project } @@ -186,7 +186,7 @@ class ProjectsController < ApplicationController end else respond_to do |format| - format.html { + format.html { settings render :action => 'settings' } @@ -210,12 +210,12 @@ class ProjectsController < ApplicationController end redirect_to(url_for(:controller => 'admin', :action => 'projects', :status => params[:status])) end - + def unarchive @project.unarchive if request.post? && !@project.active? redirect_to(url_for(:controller => 'admin', :action => 'projects', :status => params[:status])) end - + # Delete @project def destroy @project_to_destroy = @project diff --git a/app/controllers/queries_controller.rb b/app/controllers/queries_controller.rb index cbdfd1f5..7e1a1a99 100644 --- a/app/controllers/queries_controller.rb +++ b/app/controllers/queries_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -15,18 +15,18 @@ class QueriesController < ApplicationController menu_item :issues before_filter :find_query, :except => :new before_filter :find_optional_project, :only => :new - + def new @query = Query.new(params[:query]) @query.project = params[:query_is_for_all] ? nil : @project @query.user = User.current @query.is_public = false unless User.current.allowed_to?(:manage_public_queries, @project) || User.current.admin? - + @query.add_filters(params[:fields] || params[:f], params[:operators] || params[:op], params[:values] || params[:v]) if params[:fields] || params[:f] @query.group_by ||= params[:group_by] @query.column_names = params[:c] if params[:c] @query.column_names = nil if params[:default_columns] - + if request.post? && params[:confirm] && @query.save flash[:notice] = l(:notice_successful_create) redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :query_id => @query @@ -34,7 +34,7 @@ class QueriesController < ApplicationController end render :layout => false if request.xhr? end - + def edit if request.post? @query.filters = {} @@ -45,7 +45,7 @@ class QueriesController < ApplicationController @query.group_by ||= params[:group_by] @query.column_names = params[:c] if params[:c] @query.column_names = nil if params[:default_columns] - + if @query.save flash[:notice] = l(:notice_successful_update) redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :query_id => @query @@ -57,7 +57,7 @@ class QueriesController < ApplicationController @query.destroy if request.post? redirect_to :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 end - + private def find_query @query = Query.find(params[:id]) @@ -66,7 +66,7 @@ private rescue ActiveRecord::RecordNotFound render_404 end - + def find_optional_project @project = Project.find(params[:project_id]) if params[:project_id] render_403 unless User.current.allowed_to?(:save_queries, @project, :global => true) diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index eb077515..8f506510 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -33,7 +33,7 @@ class ReportsController < ApplicationController @issues_by_subproject = Issue.by_subproject(@project) || [] render :template => "reports/issue_report" - end + end def issue_report_details case params[:detail] diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index dd752700..14054eb9 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -22,14 +22,14 @@ class RepositoriesController < ApplicationController menu_item :repository menu_item :settings, :only => :edit default_search_scope :changesets - + before_filter :find_repository, :except => :edit before_filter :find_project, :only => :edit before_filter :authorize accept_key_auth :revisions - + rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed - + def edit @repository = @project.repository if !@repository @@ -48,7 +48,7 @@ class RepositoriesController < ApplicationController end end end - + def committers @committers = @repository.committers @users = @project.users @@ -138,7 +138,7 @@ class RepositoriesController < ApplicationController def is_entry_text_data?(ent, path) # UTF-16 contains "\x00". - # It is very strict that file contains less than 30% of ascii symbols + # It is very strict that file contains less than 30% of ascii symbols # in non Western Europe. return true if Redmine::MimeType.is_type?('text', path) # Ruby 1.8.6 has a bug of integer divisions. @@ -182,14 +182,14 @@ class RepositoriesController < ApplicationController else @diff_type = params[:type] || User.current.pref[:diff_type] || 'inline' @diff_type = 'inline' unless %w(inline sbs).include?(@diff_type) - + # Save diff type as user preference if User.current.logged? && @diff_type != User.current.pref[:diff_type] User.current.pref[:diff_type] = @diff_type User.current.preference.save end - - @cache_key = "repositories/diff/#{@repository.id}/" + Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}") + + @cache_key = "repositories/diff/#{@repository.id}/" + Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}") unless read_fragment(@cache_key) @diff = @repository.diff(@path, @rev, @rev_to) show_error_not_found unless @diff @@ -219,7 +219,7 @@ class RepositoriesController < ApplicationController render_404 end end - + private REV_PARAM_RE = %r{\A[a-f0-9]*\Z}i @@ -232,7 +232,7 @@ class RepositoriesController < ApplicationController @path ||= '' @rev = params[:rev].blank? ? @repository.default_branch : params[:rev].strip @rev_to = params[:rev_to] - + unless @rev.to_s.match(REV_PARAM_RE) && @rev_to.to_s.match(REV_PARAM_RE) if @repository.branches.blank? raise InvalidRevisionParam @@ -247,12 +247,12 @@ class RepositoriesController < ApplicationController def show_error_not_found render_error :message => l(:error_scm_not_found), :status => 404 end - + # Handler for Redmine::Scm::Adapters::CommandFailed exception def show_error_command_failed(exception) render_error l(:error_scm_command_failed, exception.message) end - + def graph_commits_per_month(repository) @date_to = Date.today @date_from = @date_to << 11 @@ -264,10 +264,10 @@ class RepositoriesController < ApplicationController changes_by_day = repository.changes.count(:all, :group => :commit_date, :conditions => ["commit_date BETWEEN ? AND ?", @date_from, @date_to]) changes_by_month = [0] * 12 changes_by_day.each {|c| changes_by_month[c.first.to_date.months_ago] += c.last } - + fields = [] 12.times {|m| fields << month_name(((Date.today.month - 1 - m) % 12) + 1)} - + graph = SVG::Graph::Bar.new( :height => 300, :width => 800, @@ -279,7 +279,7 @@ class RepositoriesController < ApplicationController :graph_title => l(:label_commits_per_month), :show_graph_title => true ) - + graph.add_data( :data => commits_by_month[0..11].reverse, :title => l(:label_revision_plural) @@ -289,7 +289,7 @@ class RepositoriesController < ApplicationController :data => changes_by_month[0..11].reverse, :title => l(:label_change_plural) ) - + graph.burn end @@ -299,18 +299,18 @@ class RepositoriesController < ApplicationController changes_by_author = repository.changes.count(:all, :group => :committer) h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o} - + fields = commits_by_author.collect {|r| r.first} commits_data = commits_by_author.collect {|r| r.last} changes_data = commits_by_author.collect {|r| h[r.first] || 0} - + fields = fields + [""]*(10 - fields.length) if fields.length<10 commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10 changes_data = changes_data + [0]*(10 - changes_data.length) if changes_data.length<10 - + # Remove email adress in usernames fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') } - + graph = SVG::Graph::BarHorizontal.new( :height => 400, :width => 800, @@ -322,7 +322,7 @@ class RepositoriesController < ApplicationController :graph_title => l(:label_commits_per_author), :show_graph_title => true ) - + graph.add_data( :data => commits_data, :title => l(:label_revision_plural) @@ -332,12 +332,12 @@ class RepositoriesController < ApplicationController :data => changes_data, :title => l(:label_change_plural) ) - + graph.burn end end - + class Date def months_ago(date = Date.today) (date.year - self.year)*12 + (date.month - self.month) diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index 17c4d376..0451cea5 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -1,19 +1,19 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class RolesController < ApplicationController layout 'admin' - + before_filter :require_admin verify :method => :post, :only => [ :destroy, :move ], @@ -46,7 +46,7 @@ class RolesController < ApplicationController flash[:notice] = l(:notice_successful_update) redirect_to :action => 'index' else - @permissions = @role.setable_permissions + @permissions = @role.setable_permissions end end @@ -58,8 +58,8 @@ class RolesController < ApplicationController flash[:error] = l(:error_can_not_remove_role) redirect_to :action => 'index' end - - def report + + def report @roles = Role.find(:all, :order => 'builtin, position') @permissions = Redmine::AccessControl.permissions.select { |p| !p.public? } if request.post? diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index a5208ac4..1c6f7a51 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -21,7 +21,7 @@ class SearchController < ApplicationController @question.strip! @all_words = params[:all_words] || (params[:submit] ? false : true) @titles_only = !params[:titles_only].nil? - + projects_to_search = case params[:scope] when 'all' @@ -33,16 +33,16 @@ class SearchController < ApplicationController else @project end - + offset = nil begin; offset = params[:offset].to_time if params[:offset]; rescue; end - + # quick jump to an issue if @question.match(/^#?(\d+)$/) && Issue.visible.find_by_id($1.to_i) redirect_to :controller => "issues", :action => "show", :id => $1 return end - + @object_types = Redmine::Search.available_search_types.dup if projects_to_search.is_a? Project # don't search projects @@ -50,23 +50,23 @@ class SearchController < ApplicationController # only show what the user is allowed to view @object_types = @object_types.select {|o| User.current.allowed_to?("view_#{o}".to_sym, projects_to_search)} end - + @scope = @object_types.select {|t| params[t]} @scope = @object_types if @scope.empty? - + # extract tokens from the question # eg. hello "bye bye" => ["hello", "bye bye"] @tokens = @question.scan(%r{((\s|^)"[\s\w]+"(\s|$)|\S+)}).collect {|m| m.first.gsub(%r{(^\s*"\s*|\s*"\s*$)}, '')} # tokens must be at least 2 characters long @tokens = @tokens.uniq.select {|w| w.length > 1 } - + if !@tokens.empty? # no more than 5 tokens to search for - @tokens.slice! 5..-1 if @tokens.size > 5 - + @tokens.slice! 5..-1 if @tokens.size > 5 + @results = [] @results_by_type = Hash.new {|h,k| h[k] = 0} - + limit = 10 @scope.each do |s| r, c = s.singularize.camelcase.constantize.search(@tokens, projects_to_search, @@ -82,13 +82,13 @@ class SearchController < ApplicationController if params[:previous].nil? @pagination_previous_date = @results[0].event_datetime if offset && @results[0] if @results.size > limit - @pagination_next_date = @results[limit-1].event_datetime + @pagination_next_date = @results[limit-1].event_datetime @results = @results[0, limit] end else @pagination_next_date = @results[-1].event_datetime if offset && @results[-1] if @results.size > limit - @pagination_previous_date = @results[-(limit)].event_datetime + @pagination_previous_date = @results[-(limit)].event_datetime @results = @results[-(limit), limit] end end @@ -98,7 +98,7 @@ class SearchController < ApplicationController render :layout => false if request.xhr? end -private +private def find_optional_project return true unless params[:id] @project = Project.find(params[:id]) diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index f7e8729e..94502279 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -1,19 +1,19 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class SettingsController < ApplicationController layout 'admin' - + before_filter :require_admin def index @@ -39,7 +39,7 @@ class SettingsController < ApplicationController @guessed_host_and_path = request.host_with_port.dup @guessed_host_and_path << ('/'+ Redmine::Utils.relative_url_root.gsub(%r{^\/}, '')) unless Redmine::Utils.relative_url_root.blank? - + Redmine::Themes.rescan end end diff --git a/app/controllers/sys_controller.rb b/app/controllers/sys_controller.rb index 15e89003..697d9147 100644 --- a/app/controllers/sys_controller.rb +++ b/app/controllers/sys_controller.rb @@ -1,24 +1,24 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class SysController < ActionController::Base before_filter :check_enabled - + def projects p = Project.active.has_module(:repository).find(:all, :include => :repository, :order => 'identifier') render :xml => p.to_xml(:include => :repository) end - + def create_project_repository project = Project.find(params[:id]) if project.repository @@ -33,7 +33,7 @@ class SysController < ActionController::Base end end end - + def fetch_changesets projects = [] if params[:id] diff --git a/app/controllers/time_entry_reports_controller.rb b/app/controllers/time_entry_reports_controller.rb index 7274b781..ab8211b9 100644 --- a/app/controllers/time_entry_reports_controller.rb +++ b/app/controllers/time_entry_reports_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -25,16 +25,16 @@ class TimeEntryReportsController < ApplicationController @criterias = @criterias.select{|criteria| @available_criterias.has_key? criteria} @criterias.uniq! @criterias = @criterias[0,3] - + @columns = (params[:columns] && %w(year month week day).include?(params[:columns])) ? params[:columns] : 'month' - + retrieve_date_range - + unless @criterias.empty? sql_select = @criterias.collect{|criteria| @available_criterias[criteria][:sql] + " AS " + criteria}.join(', ') sql_group_by = @criterias.collect{|criteria| @available_criterias[criteria][:sql]}.join(', ') sql_condition = '' - + if @project.nil? sql_condition = Project.allowed_to_condition(User.current, :view_time_entries) elsif @issue.nil? @@ -50,9 +50,9 @@ class TimeEntryReportsController < ApplicationController sql << " (%s) AND" % sql_condition sql << " (spent_on BETWEEN '%s' AND '%s')" % [ActiveRecord::Base.connection.quoted_date(@from), ActiveRecord::Base.connection.quoted_date(@to)] sql << " GROUP BY #{sql_group_by}, tyear, tmonth, tweek, spent_on" - + @hours = ActiveRecord::Base.connection.select_all(sql) - + @hours.each do |row| case @columns when 'year' @@ -65,9 +65,9 @@ class TimeEntryReportsController < ApplicationController row['day'] = "#{row['spent_on']}" end end - + @total_hours = @hours.inject(0) {|s,k| s = s + k['hours'].to_f} - + @periods = [] # Date#at_beginning_of_ not supported in Rails 1.2.x date_from = @from.to_time @@ -89,13 +89,13 @@ class TimeEntryReportsController < ApplicationController end end end - + respond_to do |format| format.html { render :layout => !request.xhr? } format.csv { send_data(report_to_csv(@criterias, @periods, @hours), :type => 'text/csv; header=present', :filename => 'timelog.csv') } end end - + private # TODO: duplicated in TimelogController @@ -150,7 +150,7 @@ class TimeEntryReportsController < ApplicationController else # default end - + @from, @to = @to, @from if @from && @to && @from > @to @from ||= (TimeEntry.earilest_date_for_project(@project) || Date.today) @to ||= (TimeEntry.latest_date_for_project(@project) || Date.today) @@ -179,7 +179,7 @@ class TimeEntryReportsController < ApplicationController :klass => Issue, :label => :label_issue} } - + # Add list and boolean custom fields as available criterias custom_fields = (@project.nil? ? IssueCustomField.for_all : @project.all_issue_custom_fields) custom_fields.select {|cf| %w(list bool).include? cf.field_format }.each do |cf| @@ -187,7 +187,7 @@ class TimeEntryReportsController < ApplicationController :format => cf.field_format, :label => cf.name} end if @project - + # Add list and boolean time entry custom fields TimeEntryCustomField.find(:all).select {|cf| %w(list bool).include? cf.field_format }.each do |cf| @available_criterias["cf_#{cf.id}"] = {:sql => "(SELECT c.value FROM #{CustomValue.table_name} c WHERE c.custom_field_id = #{cf.id} AND c.customized_type = 'TimeEntry' AND c.customized_id = #{TimeEntry.table_name}.id)", diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index d17afad1..9d174104 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -18,11 +18,11 @@ class TimelogController < ApplicationController before_filter :authorize, :except => [:index] before_filter :find_optional_project, :only => [:index] accept_key_auth :index, :show, :create, :update, :destroy - + include SortHelper include TimelogHelper include CustomFieldsHelper - + def index sort_init 'spent_on', 'desc' sort_update 'spent_on' => 'spent_on', @@ -31,14 +31,14 @@ class TimelogController < ApplicationController 'project' => "#{Project.table_name}.name", 'issue' => 'issue_id', 'hours' => 'hours' - + cond = ARCondition.new if @issue cond << "#{Issue.table_name}.root_id = #{@issue.root_id} AND #{Issue.table_name}.lft >= #{@issue.lft} AND #{Issue.table_name}.rgt <= #{@issue.rgt}" elsif @project cond << @project.project_condition(Setting.display_subprojects_issues?) end - + retrieve_date_range cond << ['spent_on BETWEEN ? AND ?', @from, @to] @@ -47,7 +47,7 @@ class TimelogController < ApplicationController # Paginate results @entry_count = TimeEntry.visible.count(:include => [:project, :issue], :conditions => cond.conditions) @entry_pages = Paginator.new self, @entry_count, per_page_option, params['page'] - @entries = TimeEntry.visible.find(:all, + @entries = TimeEntry.visible.find(:all, :include => [:project, :activity, :user, {:issue => :tracker}], :conditions => cond.conditions, :order => sort_clause, @@ -60,7 +60,7 @@ class TimelogController < ApplicationController format.api { @entry_count = TimeEntry.visible.count(:include => [:project, :issue], :conditions => cond.conditions) @entry_pages = Paginator.new self, @entry_count, per_page_option, params['page'] - @entries = TimeEntry.visible.find(:all, + @entries = TimeEntry.visible.find(:all, :include => [:project, :activity, :user, {:issue => :tracker}], :conditions => cond.conditions, :order => sort_clause, @@ -77,7 +77,7 @@ class TimelogController < ApplicationController } format.csv { # Export all entries - @entries = TimeEntry.visible.find(:all, + @entries = TimeEntry.visible.find(:all, :include => [:project, :activity, :user, {:issue => [:tracker, :assigned_to, :priority]}], :conditions => cond.conditions, :order => sort_clause) @@ -85,7 +85,7 @@ class TimelogController < ApplicationController } end end - + def show respond_to do |format| # TODO: Implement html response @@ -97,7 +97,7 @@ class TimelogController < ApplicationController def new @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today) @time_entry.attributes = params[:time_entry] - + call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) render :action => 'edit' end @@ -106,9 +106,9 @@ class TimelogController < ApplicationController def create @time_entry ||= TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => User.current.today) @time_entry.attributes = params[:time_entry] - + call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) - + if @time_entry.save respond_to do |format| format.html { @@ -122,21 +122,21 @@ class TimelogController < ApplicationController format.html { render :action => 'edit' } format.api { render_validation_errors(@time_entry) } end - end + end end - + def edit @time_entry.attributes = params[:time_entry] - + call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) end verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed } def update @time_entry.attributes = params[:time_entry] - + call_hook(:controller_timelog_edit_before_save, { :params => params, :time_entry => @time_entry }) - + if @time_entry.save respond_to do |format| format.html { @@ -150,7 +150,7 @@ class TimelogController < ApplicationController format.html { render :action => 'edit' } format.api { render_validation_errors(@time_entry) } end - end + end end verify :method => :delete, :only => :destroy, :render => {:nothing => true, :status => :method_not_allowed } @@ -201,7 +201,7 @@ private rescue ActiveRecord::RecordNotFound render_404 end - + def find_optional_project if !params[:issue_id].blank? @issue = Issue.find(params[:issue_id]) @@ -211,7 +211,7 @@ private end deny_access unless User.current.allowed_to?(:view_time_entries, @project, :global => true) end - + # Retrieves the date range based on predefined ranges or specific from/to param dates def retrieve_date_range @free_period = false @@ -252,7 +252,7 @@ private else # default end - + @from, @to = @to, @from if @from && @to && @from > @to @from ||= (TimeEntry.earilest_date_for_project(@project) || Date.today) @to ||= (TimeEntry.latest_date_for_project(@project) || Date.today) diff --git a/app/controllers/trackers_controller.rb b/app/controllers/trackers_controller.rb index f314b27f..8f3fea10 100644 --- a/app/controllers/trackers_controller.rb +++ b/app/controllers/trackers_controller.rb @@ -1,19 +1,19 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class TrackersController < ApplicationController layout 'admin' - + before_filter :require_admin verify :method => :post, :only => :destroy, :redirect_to => { :action => :index } @@ -47,7 +47,7 @@ class TrackersController < ApplicationController end @projects = Project.find(:all) end - + def destroy @tracker = Tracker.find(params[:id]) unless @tracker.issues.empty? @@ -56,5 +56,5 @@ class TrackersController < ApplicationController @tracker.destroy end redirect_to :action => 'index' - end + end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 15fc6dc9..6060e129 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,40 +1,40 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class UsersController < ApplicationController layout 'admin' - + before_filter :require_admin, :except => :show before_filter :find_user, :only => [:show, :edit, :update, :edit_membership, :destroy_membership] accept_key_auth :index, :show, :create, :update include SortHelper - include CustomFieldsHelper + include CustomFieldsHelper def index sort_init 'login', 'asc' sort_update %w(login firstname lastname mail admin created_on last_login_on) - + case params[:format] when 'xml', 'json' @offset, @limit = api_offset_and_limit else @limit = per_page_option end - + scope = User scope = scope.in_group(params[:group_id].to_i) if params[:group_id].present? - + @status = params[:status] ? params[:status].to_i : 1 c = ARCondition.new(@status == 0 ? "status <> 0" : ["status = ?", @status]) @@ -42,7 +42,7 @@ class UsersController < ApplicationController name = "%#{params[:name].strip.downcase}%" c << ["LOWER(login) LIKE ? OR LOWER(firstname) LIKE ? OR LOWER(lastname) LIKE ? OR LOWER(mail) LIKE ?", name, name, name, name] end - + @user_count = scope.count(:conditions => c.conditions) @user_pages = Paginator.new self, @user_count, @limit, params['page'] @offset ||= @user_pages.current.offset @@ -58,23 +58,23 @@ class UsersController < ApplicationController render :layout => !request.xhr? } format.api - end + end end - + def show # show projects based on current user visibility @memberships = @user.memberships.all(:conditions => Project.visible_by(User.current)) - + events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 10) @events_by_day = events.group_by(&:event_date) - + unless User.current.admin? if !@user.active? || (@user != User.current && @memberships.empty? && events.empty?) render_404 return end end - + respond_to do |format| format.html { render :layout => 'base' } format.api @@ -85,7 +85,7 @@ class UsersController < ApplicationController @user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option) @auth_sources = AuthSource.find(:all) end - + verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed } def create @user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option) @@ -103,12 +103,12 @@ class UsersController < ApplicationController @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : []) Mailer.deliver_account_information(@user, params[:user][:password]) if params[:send_information] - + respond_to do |format| format.html { flash[:notice] = l(:notice_successful_create) - redirect_to(params[:continue] ? - {:controller => 'users', :action => 'new'} : + redirect_to(params[:continue] ? + {:controller => 'users', :action => 'new'} : {:controller => 'users', :action => 'edit', :id => @user} ) } @@ -130,7 +130,7 @@ class UsersController < ApplicationController @auth_sources = AuthSource.find(:all) @membership ||= Member.new end - + verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed } def update @user.admin = params[:user][:admin] if params[:user][:admin] @@ -154,7 +154,7 @@ class UsersController < ApplicationController elsif @user.active? && params[:send_information] && !params[:user][:password].blank? && @user.change_password_allowed? Mailer.deliver_account_information(@user, params[:user][:password]) end - + respond_to do |format| format.html { flash[:notice] = l(:notice_successful_update) @@ -198,7 +198,7 @@ class UsersController < ApplicationController end end end - + def destroy_membership @membership = Member.find(params[:membership_id]) if request.post? && @membership.deletable? @@ -209,9 +209,9 @@ class UsersController < ApplicationController format.js { render(:update) {|page| page.replace_html "tab-content-memberships", :partial => 'users/memberships'} } end end - + private - + def find_user if params[:id] == 'current' require_login || return diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index e4a7f961..b8c68c30 100644 --- a/app/controllers/versions_controller.rb +++ b/app/controllers/versions_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -25,12 +25,12 @@ class VersionsController < ApplicationController retrieve_selected_tracker_ids(@trackers, @trackers.select {|t| t.is_in_roadmap?}) @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') project_ids = @with_subprojects ? @project.self_and_descendants.collect(&:id) : [@project.id] - + @versions = @project.shared_versions || [] @versions += @project.rolled_up_versions.visible if @with_subprojects @versions = @versions.uniq.sort @versions.reject! {|version| version.closed? || version.completed? } unless params[:completed] - + @issues_by_version = {} unless @selected_tracker_ids.empty? @versions.each do |version| @@ -43,13 +43,13 @@ class VersionsController < ApplicationController end @versions.reject! {|version| !project_ids.include?(version.project_id) && @issues_by_version[version].blank?} end - + def show @issues = @version.fixed_issues.visible.find(:all, :include => [:status, :tracker, :priority], :order => "#{Tracker.table_name}.position, #{Issue.table_name}.id") end - + def new @version = @project.versions.build if params[:version] @@ -95,7 +95,7 @@ class VersionsController < ApplicationController def edit end - + def update if request.put? && params[:version] attributes = params[:version].dup @@ -110,7 +110,7 @@ class VersionsController < ApplicationController end end end - + def close_completed if request.put? @project.close_completed_versions @@ -127,7 +127,7 @@ class VersionsController < ApplicationController redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project end end - + def status_by respond_to do |format| format.html { render :action => 'show' } diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index 1a3aeb80..6266a773 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -15,11 +15,11 @@ class WatchersController < ApplicationController before_filter :find_project before_filter :require_login, :check_project_privacy, :only => [:watch, :unwatch] before_filter :authorize, :only => [:new, :destroy] - + verify :method => :post, :only => [ :watch, :unwatch ], :render => { :nothing => true, :status => :method_not_allowed } - + def watch if @watched.respond_to?(:visible?) && !@watched.visible?(User.current) render_403 @@ -27,11 +27,11 @@ class WatchersController < ApplicationController set_watcher(User.current, true) end end - + def unwatch set_watcher(User.current, false) end - + def new @watcher = Watcher.new(params[:watcher]) @watcher.watchable = @watched @@ -47,7 +47,7 @@ class WatchersController < ApplicationController rescue ::ActionController::RedirectBackError render :text => 'Watcher added.', :layout => true end - + def destroy @watched.set_watcher(User.find(params[:user_id]), false) if request.post? respond_to do |format| @@ -59,7 +59,7 @@ class WatchersController < ApplicationController end end end - + private def find_project klass = Object.const_get(params[:object_type].camelcase) @@ -69,7 +69,7 @@ private rescue render_404 end - + def set_watcher(user, watching) @watched.set_watcher(user, watching) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 393b344c..750992cc 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -18,7 +18,7 @@ class WelcomeController < ApplicationController @news = News.latest User.current @projects = Project.latest User.current end - + def robots @projects = Project.all_public.active render :layout => false, :content_type => 'text/plain' diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index f00464e3..15717277 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -31,17 +31,17 @@ class WikiController < ApplicationController default_search_scope :wiki_pages before_filter :find_wiki, :authorize before_filter :find_existing_page, :only => [:rename, :protect, :history, :diff, :annotate, :add_attachment, :destroy] - + verify :method => :post, :only => [:protect], :redirect_to => { :action => :show } - include AttachmentsHelper + include AttachmentsHelper # List of pages, sorted alphabetically and by parent (hierarchy) def index load_pages_for_index @pages_by_parent_id = @pages.group_by(&:parent_id) end - + # List of page, by last update def date_index load_pages_for_index @@ -79,13 +79,13 @@ class WikiController < ApplicationController end @editable = editable? end - + # edit an existing page or a new one def edit - @page = @wiki.find_or_new_page(params[:id]) + @page = @wiki.find_or_new_page(params[:id]) return render_403 unless editable? @page.content = WikiContent.new(:page => @page) if @page.new_record? - + @content = @page.content_for_version(params[:version]) @content.text = initial_page_content(@page) if @content.text.blank? # don't keep previous comment @@ -98,10 +98,10 @@ class WikiController < ApplicationController verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed } # Creates a new page or updates an existing one def update - @page = @wiki.find_or_new_page(params[:id]) + @page = @wiki.find_or_new_page(params[:id]) return render_403 unless editable? @page.content = WikiContent.new(:page => @page) if @page.new_record? - + @content = @page.content_for_version(params[:version]) @content.text = initial_page_content(@page) if @content.text.blank? # don't keep previous comment @@ -144,7 +144,7 @@ class WikiController < ApplicationController redirect_to :action => 'show', :project_id => @project, :id => @page.title end end - + def protect @page.update_attribute :protected, params[:protected] redirect_to :action => 'show', :project_id => @project, :id => @page.title @@ -154,8 +154,8 @@ class WikiController < ApplicationController def history @version_count = @page.content.versions.count @version_pages = Paginator.new self, @version_count, per_page_option, params['p'] - # don't load text - @versions = @page.content.versions.find :all, + # don't load text + @versions = @page.content.versions.find :all, :select => "id, user_id, notes, created_at, version", :order => 'version DESC', :limit => @version_pages.items_per_page + 1, @@ -163,12 +163,12 @@ class WikiController < ApplicationController render :layout => false if request.xhr? end - + def diff @diff = @page.diff(params[:version], params[:version_from]) render_404 unless @diff end - + def annotate @annotate = @page.annotate(params[:version]) render_404 unless @annotate @@ -179,7 +179,7 @@ class WikiController < ApplicationController # Children can be either set as root pages, removed or reassigned to another parent page def destroy return render_403 unless editable? - + @descendants_count = @page.descendants.size if @descendants_count > 0 case params[:todo] @@ -214,7 +214,7 @@ class WikiController < ApplicationController redirect_to :action => 'show', :project_id => @project, :id => nil end end - + def preview page = @wiki.find_page(params[:id]) # page is nil when previewing a new page @@ -235,7 +235,7 @@ class WikiController < ApplicationController end private - + def find_wiki @project = Project.find(params[:project_id]) @wiki = @project.wiki @@ -243,13 +243,13 @@ private rescue ActiveRecord::RecordNotFound render_404 end - + # Finds the requested page and returns a 404 error if it doesn't exist def find_existing_page @page = @wiki.find_page(params[:id]) render_404 if @page.nil? end - + # Returns true if the current user is allowed to edit the page, otherwise false def editable?(page = @page) page.editable_by?(User.current) @@ -261,7 +261,7 @@ private extend helper unless self.instance_of?(helper) helper.instance_method(:initial_page_content).bind(self).call(page) end - + def load_pages_for_index @pages = @wiki.pages.with_updated_on.all(:order => 'title', :include => {:wiki => :project}) end diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb index e0d8eadd..632984da 100644 --- a/app/controllers/wikis_controller.rb +++ b/app/controllers/wikis_controller.rb @@ -1,20 +1,20 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class WikisController < ApplicationController menu_item :settings before_filter :find_project, :authorize - + # Create or update a project's wiki def edit @wiki = @project.wiki || Wiki.new(:project => @project) @@ -28,6 +28,6 @@ class WikisController < ApplicationController if request.post? && params[:confirm] && @project.wiki @project.wiki.destroy redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'wiki' - end + end end end diff --git a/app/controllers/workflows_controller.rb b/app/controllers/workflows_controller.rb index 12d0b5fc..0f9717ff 100644 --- a/app/controllers/workflows_controller.rb +++ b/app/controllers/workflows_controller.rb @@ -1,38 +1,38 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ class WorkflowsController < ApplicationController layout 'admin' - + before_filter :require_admin before_filter :find_roles before_filter :find_trackers - + def index @workflow_counts = Workflow.count_by_tracker_and_role end - + def edit @role = Role.find_by_id(params[:role_id]) - @tracker = Tracker.find_by_id(params[:tracker_id]) - + @tracker = Tracker.find_by_id(params[:tracker_id]) + if request.post? Workflow.destroy_all( ["role_id=? and tracker_id=?", @role.id, @tracker.id]) (params[:issue_status] || []).each { |status_id, transitions| transitions.each { |new_status_id, options| author = options.is_a?(Array) && options.include?('author') && !options.include?('always') assignee = options.is_a?(Array) && options.include?('assignee') && !options.include?('always') - @role.workflows.build(:tracker_id => @tracker.id, :old_status_id => status_id, :new_status_id => new_status_id, :author => author, :assignee => assignee) + @role.workflows.build(:tracker_id => @tracker.id, :old_status_id => status_id, :new_status_id => new_status_id, :author => author, :assignee => assignee) } } if @role.save @@ -41,13 +41,13 @@ class WorkflowsController < ApplicationController return end end - + @used_statuses_only = (params[:used_statuses_only] == '0' ? false : true) if @tracker && @used_statuses_only && @tracker.issue_statuses.any? @statuses = @tracker.issue_statuses end @statuses ||= IssueStatus.find(:all, :order => 'position') - + if @tracker && @role && @statuses.any? workflows = Workflow.all(:conditions => {:role_id => @role.id, :tracker_id => @tracker.id}) @workflows = {} @@ -56,9 +56,9 @@ class WorkflowsController < ApplicationController @workflows['assignee'] = workflows.select {|w| w.assignee} end end - + def copy - + if params[:source_tracker_id].blank? || params[:source_tracker_id] == 'any' @source_tracker = nil else @@ -69,10 +69,10 @@ class WorkflowsController < ApplicationController else @source_role = Role.find_by_id(params[:source_role_id].to_i) end - + @target_trackers = params[:target_tracker_ids].blank? ? nil : Tracker.find_all_by_id(params[:target_tracker_ids]) @target_roles = params[:target_role_ids].blank? ? nil : Role.find_all_by_id(params[:target_role_ids]) - + if request.post? if params[:source_tracker_id].blank? || params[:source_role_id].blank? || (@source_tracker.nil? && @source_role.nil?) flash.now[:error] = l(:error_workflow_copy_source) @@ -91,7 +91,7 @@ class WorkflowsController < ApplicationController def find_roles @roles = Role.find(:all, :order => 'builtin, position') end - + def find_trackers @trackers = Tracker.find(:all, :order => 'position') end diff --git a/app/helpers/account_helper.rb b/app/helpers/account_helper.rb index 50c0c3ee..052322e8 100644 --- a/app/helpers/account_helper.rb +++ b/app/helpers/account_helper.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index 19164ff0..1761a10a 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -1,19 +1,19 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ module AdminHelper def project_status_options_for_select(selected) - options_for_select([[l(:label_all), ''], + options_for_select([[l(:label_all), ''], [l(:status_active), 1]], selected) end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9004b9bf..57d450c6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,13 +1,13 @@ #-- copyright # ChiliProject is a project management system. -# +# # Copyright (C) 2010-2011 the ChiliProject Team -# +# # 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. -# +# # See doc/COPYRIGHT.rdoc for more details. #++ @@ -56,7 +56,7 @@ module ApplicationHelper h(user.to_s) end end - + # Show a sorted linkified (if active) comma-joined list of users def list_users(users, options={}) users.sort.collect{|u| link_to_user(u, options)}.join(", ") @@ -64,7 +64,7 @@ module ApplicationHelper # Displays a link to +issue+ with its subject. # Examples: - # + # # link_to_issue(issue) # => Defect #6: This is the subject # link_to_issue(issue, :truncate => 6) # => Defect #6: This i... # link_to_issue(issue, :subject => false) # => Defect #6 @@ -81,7 +81,7 @@ module ApplicationHelper subject = truncate(subject, :length => options[:truncate]) end end - s = link_to "#{issue.tracker} ##{issue.id}", {:controller => "issues", :action => "show", :id => issue}, + s = link_to "#{issue.tracker} ##{issue.id}", {:controller => "issues", :action => "show", :id => issue}, :class => issue.css_classes, :title => title s << ": #{h subject}" if subject @@ -110,7 +110,7 @@ module ApplicationHelper link_to(text, {:controller => 'repositories', :action => 'revision', :id => project, :rev => rev}, :title => l(:label_revision_id, format_revision(revision))) end - + # Generates a link to a message def link_to_message(message, options={}, html_options = nil) link_to( @@ -127,7 +127,7 @@ module ApplicationHelper # Generates a link to a project if active # Examples: - # + # # link_to_project(project) # => link to the specified project overview # link_to_project(project, :action=>'settings') # => link to project settings # link_to_project(project, {:only_path => false}, :class => "project") # => 3rd arg adds html options @@ -161,15 +161,15 @@ module ApplicationHelper html_options[:onclick] = "promptToRemote('#{text}', '#{param}', '#{url_for(url)}'); return false;" link_to name, {}, html_options end - + def format_activity_title(text) h(truncate_single_line(text, :length => 100)) end - + def format_activity_day(date) date == Date.today ? l(:label_today).titleize : format_date(date) end - + def format_activity_description(text) h(truncate(text.to_s, :length => 120).gsub(%r{[\r\n]*<(pre|code)>.*$}m, '...')).gsub(/[\r\n]+/, "
' + l(:label_export_to)) yield Redmine::Views::OtherFormatsBuilder.new(self) concat('
') end - + def page_header_title if @project.nil? || @project.new_record? h(Setting.app_title) @@ -459,21 +459,21 @@ module ApplicationHelper only_path = options.delete(:only_path) == false ? false : true text = Redmine::WikiFormatting.to_html(Setting.text_formatting, text, :object => obj, :attribute => attr) { |macro, args| exec_macro(macro, obj, args) } - + @parsed_headings = [] text = parse_non_pre_blocks(text) do |text| [:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links, :parse_headings].each do |method_name| send method_name, text, project, obj, attr, only_path, options end end - + if @parsed_headings.any? replace_toc(text, @parsed_headings) end - + text end - + def parse_non_pre_blocks(text) s = StringScanner.new(text) tags = [] @@ -502,13 +502,13 @@ module ApplicationHelper end parsed end - + def parse_inline_attachments(text, project, obj, attr, only_path, options) # when using an image link, try to use an attachment, if possible if options[:attachments] || (obj && obj.respond_to?(:attachments)) attachments = nil text.gsub!(/src="([^\/"]+\.(bmp|gif|jpg|jpeg|png))"(\s+alt="([^"]*)")?/i) do |m| - filename, ext, alt, alttext = $1.downcase, $2, $3, $4 + filename, ext, alt, alttext = $1.downcase, $2, $3, $4 attachments ||= (options[:attachments] || obj.attachments).sort_by(&:created_on).reverse # search for the picture in attachments if found = attachments.detect { |att| att.filename.downcase == filename } @@ -571,7 +571,7 @@ module ApplicationHelper end end end - + # Redmine links # # Examples: @@ -694,14 +694,14 @@ module ApplicationHelper leading + (link || "#{project_prefix}#{prefix}#{sep}#{identifier}") end end - + HEADING_RE = /\{\{([<>]?)toc\}\}<\/p>/i unless const_defined?(:TOC_RE)
-
+
# Renders the TOC with given headings
def replace_toc(text, headings)
text.gsub!(TOC_RE) do
@@ -795,13 +795,13 @@ module ApplicationHelper
), :class => 'progress', :style => "width: #{width};") +
content_tag('p', legend, :class => 'pourcent')
end
-
+
def checked_image(checked=true)
if checked
image_tag 'toggle_check.png'
end
end
-
+
def context_menu(url)
unless @context_menu_included
content_for :header_tags do
@@ -854,10 +854,10 @@ module ApplicationHelper
else
'' # use language
end
-
+
javascript_include_tag('calendar/calendar') +
javascript_include_tag("calendar/lang/calendar-#{current_language.to_s.downcase}.js") +
- javascript_tag(start_of_week) +
+ javascript_tag(start_of_week) +
javascript_include_tag('calendar/calendar-setup') +
stylesheet_link_tag('calendar')
end
@@ -890,7 +890,7 @@ module ApplicationHelper
''
end
end
-
+
# Returns the javascript tags that are included in the html layout head
def javascript_heads
tags = javascript_include_tag(:defaults)
@@ -911,7 +911,7 @@ module ApplicationHelper
def robot_exclusion_tag(content="NOINDEX,FOLLOW,NOARCHIVE")
""
end
-
+
# Returns true if arg is expected in the API response
def include_in_api_response?(arg)
unless @included_in_api_response
@@ -933,7 +933,7 @@ module ApplicationHelper
options
end
end
-
+
private
def wiki_helper
@@ -941,7 +941,7 @@ module ApplicationHelper
extend helper
return self
end
-
+
def link_to_content_update(text, url_params = {}, html_options = {})
link_to(text, url_params, html_options)
end
diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb
index 7a03044b..99cfca0a 100644
--- a/app/helpers/attachments_helper.rb
+++ b/app/helpers/attachments_helper.rb
@@ -1,13 +1,13 @@
#-- copyright
# ChiliProject is a project management system.
-#
+#
# Copyright (C) 2010-2011 the ChiliProject Team
-#
+#
# 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.
-#
+#
# See doc/COPYRIGHT.rdoc for more details.
#++
@@ -17,13 +17,13 @@ module AttachmentsHelper
# :author -- author names are not displayed if set to false
def link_to_attachments(container, options = {})
options.assert_valid_keys(:author)
-
+
if container.attachments.any?
options = {:deletable => container.attachments_deletable?, :author => true}.merge(options)
render :partial => 'attachments/links', :locals => {:attachments => container.attachments, :options => options}
end
end
-
+
def to_utf8_for_attachments(str)
if str.respond_to?(:force_encoding)
str.force_encoding('UTF-8')
@@ -31,7 +31,7 @@ module AttachmentsHelper
else
return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
end
-
+
begin
Iconv.conv('UTF-8//IGNORE', 'UTF-8', str + ' ')[0..-3]
rescue Iconv::InvalidEncoding
diff --git a/app/helpers/auth_sources_helper.rb b/app/helpers/auth_sources_helper.rb
index 74b4d281..6275c767 100644
--- a/app/helpers/auth_sources_helper.rb
+++ b/app/helpers/auth_sources_helper.rb
@@ -1,13 +1,13 @@
#-- copyright
# ChiliProject is a project management system.
-#
+#
# Copyright (C) 2010-2011 the ChiliProject Team
-#
+#
# 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.
-#
+#
# See doc/COPYRIGHT.rdoc for more details.
#++
diff --git a/app/helpers/boards_helper.rb b/app/helpers/boards_helper.rb
index 0558ab6a..e912eab2 100644
--- a/app/helpers/boards_helper.rb
+++ b/app/helpers/boards_helper.rb
@@ -1,13 +1,13 @@
#-- copyright
# ChiliProject is a project management system.
-#
+#
# Copyright (C) 2010-2011 the ChiliProject Team
-#
+#
# 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.
-#
+#
# See doc/COPYRIGHT.rdoc for more details.
#++
diff --git a/app/helpers/calendars_helper.rb b/app/helpers/calendars_helper.rb
index 51f66cde..b2de58f7 100644
--- a/app/helpers/calendars_helper.rb
+++ b/app/helpers/calendars_helper.rb
@@ -1,13 +1,13 @@
#-- copyright
# ChiliProject is a project management system.
-#
+#
# Copyright (C) 2010-2011 the ChiliProject Team
-#
+#
# 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.
-#
+#
# See doc/COPYRIGHT.rdoc for more details.
#++
@@ -18,7 +18,7 @@ module CalendarsHelper
else
[year, month - 1]
end
-
+
name = if target_month == 12
"#{month_name(target_month)} #{target_year}"
else
diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb
index 1b6cea22..6fb59ee4 100644
--- a/app/helpers/custom_fields_helper.rb
+++ b/app/helpers/custom_fields_helper.rb
@@ -1,13 +1,13 @@
#-- copyright
# ChiliProject is a project management system.
-#
+#
# Copyright (C) 2010-2011 the ChiliProject Team
-#
+#
# 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.
-#
+#
# See doc/COPYRIGHT.rdoc for more details.
#++
@@ -25,9 +25,9 @@ module CustomFieldsHelper
{:name => 'DocumentCategoryCustomField', :partial => 'custom_fields/index', :label => DocumentCategory::OptionName}
]
end
-
+
# Return custom field html tag corresponding to its format
- def custom_field_tag(name, custom_value)
+ def custom_field_tag(name, custom_value)
custom_field = custom_value.custom_field
field_name = "#{name}[custom_field_values][#{custom_field.id}]"
field_id = "#{name}_custom_field_values_#{custom_field.id}"
@@ -35,7 +35,7 @@ module CustomFieldsHelper
field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
case field_format.try(:edit_as)
when "date"
- text_field_tag(field_name, custom_value.value, :id => field_id, :size => 10) +
+ text_field_tag(field_name, custom_value.value, :id => field_id, :size => 10) +
calendar_for(field_id)
when "text"
text_area_tag(field_name, custom_value.value, :id => field_id, :rows => 3, :style => 'width:90%')
@@ -43,14 +43,14 @@ module CustomFieldsHelper
hidden_field_tag(field_name, '0') + check_box_tag(field_name, '1', custom_value.true?, :id => field_id)
when "list"
blank_option = custom_field.is_required? ?
- (custom_field.default_value.blank? ? "" : '') :
+ (custom_field.default_value.blank? ? "" : '') :
''
select_tag(field_name, blank_option + options_for_select(custom_field.possible_values_options(custom_value.customized), custom_value.value), :id => field_id)
else
text_field_tag(field_name, custom_value.value, :id => field_id)
end
end
-
+
# Return custom field label tag
def custom_field_label_tag(name, custom_value)
content_tag "label", custom_value.custom_field.name +
@@ -58,19 +58,19 @@ module CustomFieldsHelper
:for => "#{name}_custom_field_values_#{custom_value.custom_field.id}",
:class => (custom_value.errors.empty? ? nil : "error" )
end
-
+
# Return custom field tag with its label tag
def custom_field_tag_with_label(name, custom_value)
custom_field_label_tag(name, custom_value) + custom_field_tag(name, custom_value)
end
-
+
def custom_field_tag_for_bulk_edit(name, custom_field)
field_name = "#{name}[custom_field_values][#{custom_field.id}]"
field_id = "#{name}_custom_field_values_#{custom_field.id}"
field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
case field_format.try(:edit_as)
when "date"
- text_field_tag(field_name, '', :id => field_id, :size => 10) +
+ text_field_tag(field_name, '', :id => field_id, :size => 10) +
calendar_for(field_id)
when "text"
text_area_tag(field_name, '', :id => field_id, :rows => 3, :style => 'width:90%')
@@ -90,7 +90,7 @@ module CustomFieldsHelper
return "" unless custom_value
format_value(custom_value.value, custom_value.custom_field.field_format)
end
-
+
# Return a string used to display a custom value
def format_value(value, field_format)
Redmine::CustomFieldFormat.format_value(value, field_format) # Proxy
@@ -100,7 +100,7 @@ module CustomFieldsHelper
def custom_field_formats_for_select(custom_field)
Redmine::CustomFieldFormat.as_select(custom_field.class.customized_class.name)
end
-
+
# Renders the custom_values in api views
def render_api_custom_values(custom_values, api)
api.array :custom_fields do
diff --git a/app/helpers/documents_helper.rb b/app/helpers/documents_helper.rb
index 8891bce6..53321488 100644
--- a/app/helpers/documents_helper.rb
+++ b/app/helpers/documents_helper.rb
@@ -1,13 +1,13 @@
#-- copyright
# ChiliProject is a project management system.
-#
+#
# Copyright (C) 2010-2011 the ChiliProject Team
-#
+#
# 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.
-#
+#
# See doc/COPYRIGHT.rdoc for more details.
#++
diff --git a/app/helpers/enumerations_helper.rb b/app/helpers/enumerations_helper.rb
index cae110d3..69540fbc 100644
--- a/app/helpers/enumerations_helper.rb
+++ b/app/helpers/enumerations_helper.rb
@@ -1,13 +1,13 @@
#-- copyright
# ChiliProject is a project management system.
-#
+#
# Copyright (C) 2010-2011 the ChiliProject Team
-#
+#
# 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.
-#
+#
# See doc/COPYRIGHT.rdoc for more details.
#++
diff --git a/app/helpers/gantt_helper.rb b/app/helpers/gantt_helper.rb
index 52352b8a..1d1c439d 100644
--- a/app/helpers/gantt_helper.rb
+++ b/app/helpers/gantt_helper.rb
@@ -1,13 +1,13 @@
#-- copyright
# ChiliProject is a project management system.
-#
+#
# Copyright (C) 2010-2011 the ChiliProject Team
-#
+#
# 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.
-#
+#
# See doc/COPYRIGHT.rdoc for more details.
#++
@@ -23,7 +23,7 @@ module GanttHelper
else
content_tag('span', l(:text_zoom_in), :class => 'icon icon-zoom-in')
end
-
+
when :out
if gantt.zoom > 1
link_to_content_update l(:text_zoom_out),
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb
index 1223805c..5fd99145 100644
--- a/app/helpers/groups_helper.rb
+++ b/app/helpers/groups_helper.rb
@@ -1,13 +1,13 @@
#-- copyright
# ChiliProject is a project management system.
-#
+#
# Copyright (C) 2010-2011 the ChiliProject Team
-#
+#
# 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.
-#
+#
# See doc/COPYRIGHT.rdoc for more details.
#++
@@ -20,7 +20,7 @@ module GroupsHelper
end
options
end
-
+
def group_settings_tabs
tabs = [{:name => 'general', :partial => 'groups/general', :label => :label_general},
{:name => 'users', :partial => 'groups/users', :label => :label_user_plural},
diff --git a/app/helpers/issue_categories_helper.rb b/app/helpers/issue_categories_helper.rb
index 452d251a..a54c45c1 100644
--- a/app/helpers/issue_categories_helper.rb
+++ b/app/helpers/issue_categories_helper.rb
@@ -1,13 +1,13 @@
#-- copyright
# ChiliProject is a project management system.
-#
+#
# Copyright (C) 2010-2011 the ChiliProject Team
-#
+#
# 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.
-#
+#
# See doc/COPYRIGHT.rdoc for more details.
#++
diff --git a/app/helpers/issue_moves_helper.rb b/app/helpers/issue_moves_helper.rb
index 32b57549..a56dc0e9 100644
--- a/app/helpers/issue_moves_helper.rb
+++ b/app/helpers/issue_moves_helper.rb
@@ -1,13 +1,13 @@
#-- copyright
# ChiliProject is a project management system.
-#
+#
# Copyright (C) 2010-2011 the ChiliProject Team
-#
+#
# 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.
-#
+#
# See doc/COPYRIGHT.rdoc for more details.
#++
diff --git a/app/helpers/issue_relations_helper.rb b/app/helpers/issue_relations_helper.rb
index 64cb2ac7..21d9f389 100644
--- a/app/helpers/issue_relations_helper.rb
+++ b/app/helpers/issue_relations_helper.rb
@@ -1,13 +1,13 @@
#-- copyright
# ChiliProject is a project management system.
-#
+#
# Copyright (C) 2010-2011 the ChiliProject Team
-#
+#
# 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.
-#
+#
# See doc/COPYRIGHT.rdoc for more details.
#++
diff --git a/app/helpers/issue_statuses_helper.rb b/app/helpers/issue_statuses_helper.rb
index 78361774..038d5309 100644
--- a/app/helpers/issue_statuses_helper.rb
+++ b/app/helpers/issue_statuses_helper.rb
@@ -1,13 +1,13 @@
#-- copyright
# ChiliProject is a project management system.
-#
+#
# Copyright (C) 2010-2011 the ChiliProject Team
-#
+#
# 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.
-#
+#
# See doc/COPYRIGHT.rdoc for more details.
#++
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index fc3289ae..78c97ba6 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -1,13 +1,13 @@
#-- copyright
# ChiliProject is a project management system.
-#
+#
# Copyright (C) 2010-2011 the ChiliProject Team
-#
+#
# 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.
-#
+#
# See doc/COPYRIGHT.rdoc for more details.
#++
@@ -50,7 +50,7 @@ module IssuesHelper
"#{@cached_label_assigned_to}: #{issue.assigned_to}
" +
"#{@cached_label_priority}: #{issue.priority.name}"
end
-
+
def render_issue_subject_with_tree(issue)
s = ''
ancestors = issue.root? ? [] : issue.ancestors.all
@@ -61,7 +61,7 @@ module IssuesHelper
s << '' * (ancestors.size + 1)
s
end
-
+
def render_descendants_tree(issue)
s = '