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]+/, "
") end @@ -181,7 +181,7 @@ module ApplicationHelper h("#{version.project} - #{version}") end end - + def due_date_distance_in_words(date) if date l((date < Date.today ? :label_roadmap_overdue : :label_roadmap_due_in), distance_of_date_in_words(Date.today, date)) @@ -203,7 +203,7 @@ module ApplicationHelper end content end - + # Renders flash messages def render_flash_messages s = '' @@ -212,7 +212,7 @@ module ApplicationHelper end s end - + # Renders tabs and their content def render_tabs(tabs) if tabs.any? @@ -221,7 +221,7 @@ module ApplicationHelper content_tag 'p', l(:label_no_data), :class => "nodata" end end - + # Renders the project quick-jump box def render_project_jump_box projects = User.current.memberships.collect(&:project).compact.uniq @@ -236,7 +236,7 @@ module ApplicationHelper s end end - + def project_tree_options_for_select(projects, options = {}) s = '' project_tree(projects) do |project, level| @@ -252,14 +252,14 @@ module ApplicationHelper end s end - + # Yields the given block for each project with its level in the tree # # Wrapper for Project#project_tree def project_tree(projects, &block) Project.project_tree(projects, &block) end - + def project_nested_ul(projects, &block) s = '' if projects.any? @@ -270,7 +270,7 @@ module ApplicationHelper else ancestors.pop s << "" - while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) + while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) ancestors.pop s << "\n" end @@ -283,20 +283,20 @@ module ApplicationHelper end s end - + def principals_check_box_tags(name, principals) s = '' principals.sort.each do |principal| s << "\n" end - s + s end # Truncates and returns the string as a single line def truncate_single_line(string, *args) truncate(string.to_s, *args).gsub(%r{[\r\n]+}m, ' ') end - + # Truncates at line break after 250 characters or options[:length] def truncate_lines(string, options={}) length = options[:length] || 250 @@ -314,7 +314,7 @@ module ApplicationHelper def authoring(created, author, options={}) l(options[:label] || :label_added_time_by, :author => link_to_user(author), :age => time_tag(created)) end - + def time_tag(time) text = distance_of_time_in_words(Time.now, time) if @project @@ -347,7 +347,7 @@ module ApplicationHelper html << (pagination_links_each(paginator, options) do |n| link_to_content_update(n.to_s, url_param.merge(page_param => n)) end || '') - + if paginator.current.next html << ' ' + link_to_content_update((l(:label_next) + ' »'), url_param.merge(page_param => paginator.current.next)) end @@ -361,14 +361,14 @@ module ApplicationHelper html end - + def per_page_links(selected=nil) links = Setting.per_page_options_array.collect do |n| n == selected ? n : link_to_content_update(n, params.merge(:per_page => n)) end links.size > 1 ? l(:label_display_per_page, links.join(', ')) : nil end - + def reorder_links(name, url) link_to(image_tag('2uparrow.png', :alt => l(:label_sort_highest)), url.merge({"#{name}[move_to]" => 'highest'}), :method => :post, :title => l(:label_sort_highest)) + link_to(image_tag('1uparrow.png', :alt => l(:label_sort_higher)), url.merge({"#{name}[move_to]" => 'higher'}), :method => :post, :title => l(:label_sort_higher)) + @@ -380,13 +380,13 @@ module ApplicationHelper elements = args.flatten elements.any? ? content_tag('p', args.join(' » ') + ' » ', :class => 'breadcrumb') : nil end - + def other_formats_links(&block) concat('

' + 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 = /]+)?>(.+?)<\/h(1|2|3|4)>/i unless const_defined?(:HEADING_RE) - + # Headings and TOC # Adds ids and links to headings unless options[:headings] is set to false def parse_headings(text, project, obj, attr, only_path, options) return if options[:headings] == false - + text.gsub!(HEADING_RE) do level, attrs, content = $1.to_i, $2, $3 item = strip_tags(content).strip @@ -710,9 +710,9 @@ module ApplicationHelper "\n#{content}" end end - + TOC_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 = '

' issue_list(issue.descendants.sort_by(&:lft)) do |child, level| @@ -76,7 +76,7 @@ module IssuesHelper s << '
' s end - + def render_custom_fields_rows(issue) return if issue.custom_field_values.empty? ordered_values = [] @@ -95,14 +95,14 @@ module IssuesHelper s << "\n" s end - + def sidebar_queries unless @sidebar_queries # User can see public queries and his own queries visible = ARCondition.new(["is_public = ? OR user_id = ?", true, (User.current.logged? ? User.current.id : 0)]) # Project specific queries and global queries visible << (@project.nil? ? ["project_id IS NULL"] : ["project_id IS NULL OR project_id = ?", @project.id]) - @sidebar_queries = Query.find(:all, + @sidebar_queries = Query.find(:all, :select => 'id, name, is_public', :order => "name ASC", :conditions => visible.conditions) @@ -113,13 +113,13 @@ module IssuesHelper def query_links(title, queries) # links to #index on issues/show url_params = controller_name == 'issues' ? {:controller => 'issues', :action => 'index', :project_id => @project} : params - + content_tag('h3', title) + queries.collect {|query| link_to(h(query.name), url_params.merge(:query_id => query)) }.join('
') end - + def render_sidebar_queries out = '' queries = sidebar_queries.select {|q| !q.is_public?} @@ -167,7 +167,7 @@ module IssuesHelper label ||= detail.prop_key value ||= detail.value old_value ||= detail.old_value - + unless no_html label = content_tag('strong', label) old_value = content_tag("i", h(old_value)) if detail.old_value @@ -179,11 +179,11 @@ module IssuesHelper value = content_tag("i", h(value)) if value end end - + if detail.property == 'attr' && detail.prop_key == 'description' s = l(:text_journal_changed_no_detail, :label => label) unless no_html - diff_link = link_to 'diff', + diff_link = link_to 'diff', {:controller => 'journals', :action => 'diff', :id => detail.journal_id, :detail_id => detail.id}, :title => l(:label_view_diff) s << " (#{ diff_link })" @@ -213,7 +213,7 @@ module IssuesHelper return record.name if record end end - + # Renders issue children recursively def render_api_issue_children(issue, api) return if issue.leaf? @@ -227,14 +227,14 @@ module IssuesHelper end end end - + def issues_to_csv(issues, project = nil) - ic = Iconv.new(l(:general_csv_encoding), 'UTF-8') + ic = Iconv.new(l(:general_csv_encoding), 'UTF-8') decimal_separator = l(:general_csv_decimal_separator) export = FCSV.generate(:col_sep => l(:general_csv_separator)) do |csv| # csv header fields headers = [ "#", - l(:field_status), + l(:field_status), l(:field_project), l(:field_tracker), l(:field_priority), @@ -261,9 +261,9 @@ module IssuesHelper # csv lines issues.each do |issue| fields = [issue.id, - issue.status.name, + issue.status.name, issue.project.name, - issue.tracker.name, + issue.tracker.name, issue.priority.name, issue.subject, issue.assigned_to, @@ -275,7 +275,7 @@ module IssuesHelper issue.done_ratio, issue.estimated_hours.to_s.gsub('.', decimal_separator), issue.parent_id, - format_time(issue.created_on), + format_time(issue.created_on), format_time(issue.updated_on) ] custom_fields.each {|f| fields << show_value(issue.custom_value_for(f)) } @@ -285,11 +285,11 @@ module IssuesHelper end export end - + def send_notification_option content_tag(:p, content_tag(:label, - l(:label_notify_member_plural)) + + l(:label_notify_member_plural)) + hidden_field_tag('send_notification', '0') + check_box_tag('send_notification', '1', true)) diff --git a/app/helpers/journals_helper.rb b/app/helpers/journals_helper.rb index 627d60d0..5a9f4770 100644 --- a/app/helpers/journals_helper.rb +++ b/app/helpers/journals_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/mail_handler_helper.rb b/app/helpers/mail_handler_helper.rb index e6c45d6b..27ccbbb6 100644 --- a/app/helpers/mail_handler_helper.rb +++ b/app/helpers/mail_handler_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/members_helper.rb b/app/helpers/members_helper.rb index 2142e3f7..9e247020 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_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/messages_helper.rb b/app/helpers/messages_helper.rb index e11b25cf..e1a15bcf 100644 --- a/app/helpers/messages_helper.rb +++ b/app/helpers/messages_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/my_helper.rb b/app/helpers/my_helper.rb index fda495db..45ce166f 100644 --- a/app/helpers/my_helper.rb +++ b/app/helpers/my_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/news_helper.rb b/app/helpers/news_helper.rb index 05d9d714..945746fe 100644 --- a/app/helpers/news_helper.rb +++ b/app/helpers/news_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/projects_helper.rb b/app/helpers/projects_helper.rb index cab4546e..6824ea08 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_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. #++ @@ -16,7 +16,7 @@ module ProjectsHelper return '' unless version && version.is_a?(Version) link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, options end - + def project_settings_tabs tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural}, {:name => 'modules', :action => :select_project_modules, :partial => 'projects/settings/modules', :label => :label_module_plural}, @@ -28,9 +28,9 @@ module ProjectsHelper {:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural}, {:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities} ] - tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)} + tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)} end - + def parent_project_select_tag(project) selected = project.parent # retrieve the requested parent project @@ -38,13 +38,13 @@ module ProjectsHelper if parent_id selected = (parent_id.blank? ? nil : Project.find(parent_id)) end - + options = '' options << "" if project.allowed_parents.include?(nil) options << project_tree_options_for_select(project.allowed_parents.compact, :selected => selected) content_tag('select', options, :name => 'project[parent_id]', :id => 'project_parent_id') end - + # Renders a tree of projects as a nested set of unordered lists # The given collection may be a subset of the whole project tree # (eg. some intermediate nodes are private and can not be seen) @@ -61,7 +61,7 @@ module ProjectsHelper else ancestors.pop s << "" - while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) + while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) ancestors.pop s << "\n" end @@ -89,7 +89,7 @@ module ProjectsHelper if selected && !versions.include?(selected) grouped[selected.project.name] << [selected.name, selected.id] end - + if grouped.keys.size > 1 grouped_options_for_select(grouped, selected && selected.id) else diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index dd4c3717..b4fd07c3 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -1,31 +1,31 @@ #-- 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 QueriesHelper - + def operators_for_select(filter_type) Query.operators_by_filter_type[filter_type].collect {|o| [l(Query.operators[o]), o]} end - + def column_header(column) column.sortable ? sort_header_tag(column.name.to_s, :caption => column.caption, - :default_order => column.default_order) : + :default_order => column.default_order) : content_tag('th', column.caption) end - + def column_content(column, issue) value = column.value(issue) - + case value.class.name when 'String' if column.name == :subject diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb index 5daf0f4f..6b965fb4 100644 --- a/app/helpers/reports_helper.rb +++ b/app/helpers/reports_helper.rb @@ -1,18 +1,18 @@ #-- 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 ReportsHelper - + def aggregate(data, criteria) a = 0 data.each { |row| @@ -24,9 +24,9 @@ module ReportsHelper } unless data.nil? a end - + def aggregate_link(data, criteria, *args) a = aggregate data, criteria a > 0 ? link_to(a, *args) : '-' - end + end end diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 1b27aa81..b81778b0 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_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. #++ @@ -21,13 +21,13 @@ module RepositoriesHelper revision.to_s end end - + def truncate_at_line_break(text, length = 255) if text text.gsub(%r{^(.{#{length}}[^\n]*)\n.+$}m, '\\1...') end end - + def render_properties(properties) unless properties.nil? || properties.empty? content = '' @@ -37,7 +37,7 @@ module RepositoriesHelper content_tag('ul', content, :class => 'properties') end end - + def render_changeset_changes changes = @changeset.changes.find(:all, :limit => 1000, :order => 'path').collect do |change| case change.action @@ -53,7 +53,7 @@ module RepositoriesHelper change end end.compact - + tree = { } changes.each do |change| p = tree @@ -68,13 +68,13 @@ module RepositoriesHelper end p[:c] = change end - + render_changes_tree(tree[:s]) end - + def render_changes_tree(tree) return '' if tree.nil? - + output = '' output << '' output end - + def to_utf8_for_repositories(str) return str if str.nil? str = to_utf8_internal(str) @@ -178,7 +178,7 @@ module RepositoriesHelper scm_options << ["Repository::#{scm}".constantize.scm_name, scm] end end - select_tag('repository_scm', + select_tag('repository_scm', options_for_select(scm_options, repository.class.name.demodulize), :disabled => (repository && !repository.new_record?), :onchange => remote_function( @@ -191,11 +191,11 @@ module RepositoriesHelper :with => "Form.serialize(this.form)") ) end - + def with_leading_slash(path) path.to_s.starts_with?('/') ? path : "/#{path}" end - + def without_leading_slash(path) path.gsub(%r{^/+}, '') end @@ -215,7 +215,7 @@ module RepositoriesHelper content_tag('p', form.select(:log_encoding, [nil] + Setting::ENCODINGS, :label => l(:setting_commit_logs_encoding), :required => true)) end - + def mercurial_field_tags(form, repository) content_tag('p', form.text_field(:url, :label => :label_mercurial_path, :size => 60, :required => true, :disabled => (repository && !repository.root_url.blank?)) + '
' + l(:text_mercurial_repo_example)) + @@ -245,7 +245,7 @@ module RepositoriesHelper content_tag('p', form.select(:log_encoding, [nil] + Setting::ENCODINGS, :label => l(:setting_commit_logs_encoding), :required => true)) end - + def filesystem_field_tags(form, repository) content_tag('p', form.text_field(:url, :label => :label_filesystem_path, :size => 60, :required => true, :disabled => (repository && !repository.root_url.blank?))) + content_tag('p', form.select(:path_encoding, [nil] + Setting::ENCODINGS, diff --git a/app/helpers/roles_helper.rb b/app/helpers/roles_helper.rb index 38f6598a..ea9fc9ce 100644 --- a/app/helpers/roles_helper.rb +++ b/app/helpers/roles_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/search_helper.rb b/app/helpers/search_helper.rb index dff46b89..414e4391 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_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. #++ @@ -15,7 +15,7 @@ module SearchHelper def highlight_tokens(text, tokens) return text unless text && tokens && !tokens.empty? re_tokens = tokens.collect {|t| Regexp.escape(t)} - regexp = Regexp.new "(#{re_tokens.join('|')})", Regexp::IGNORECASE + regexp = Regexp.new "(#{re_tokens.join('|')})", Regexp::IGNORECASE result = '' text.split(regexp).each_with_index do |words, i| if result.length > 1200 @@ -33,11 +33,11 @@ module SearchHelper end result end - + def type_label(t) l("label_#{t.singularize}_plural", :default => t.to_s.humanize) end - + def project_select_tag options = [[l(:label_project_all), 'all']] options << [l(:label_my_projects), 'my_projects'] unless User.current.memberships.empty? @@ -45,7 +45,7 @@ module SearchHelper options << [@project.name, ''] unless @project.nil? select_tag('scope', options_for_select(options, params[:scope].to_s)) if options.size > 1 end - + def render_results_by_type(results_by_type) links = [] # Sorts types by results count diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb index f04c18dc..8d06bde8 100644 --- a/app/helpers/settings_helper.rb +++ b/app/helpers/settings_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 SettingsHelper {:name => 'repositories', :partial => 'settings/repositories', :label => :label_repository_plural} ] end - + def setting_select(setting, choices, options={}) if blank_text = options.delete(:blank) choices = [[blank_text.is_a?(Symbol) ? l(blank_text) : blank_text, '']] + choices @@ -31,38 +31,38 @@ module SettingsHelper setting_label(setting, options) + select_tag("settings[#{setting}]", options_for_select(choices, Setting.send(setting).to_s), options) end - + def setting_multiselect(setting, choices, options={}) setting_values = Setting.send(setting) setting_values = [] unless setting_values.is_a?(Array) - + setting_label(setting, options) + hidden_field_tag("settings[#{setting}][]", '') + choices.collect do |choice| - text, value = (choice.is_a?(Array) ? choice : [choice, choice]) + text, value = (choice.is_a?(Array) ? choice : [choice, choice]) content_tag('label', check_box_tag("settings[#{setting}][]", value, Setting.send(setting).include?(value)) + text.to_s, :class => 'block' ) end.join end - + def setting_text_field(setting, options={}) setting_label(setting, options) + text_field_tag("settings[#{setting}]", Setting.send(setting), options) end - + def setting_text_area(setting, options={}) setting_label(setting, options) + text_area_tag("settings[#{setting}]", Setting.send(setting), options) end - + def setting_check_box(setting, options={}) setting_label(setting, options) + hidden_field_tag("settings[#{setting}]", 0) + check_box_tag("settings[#{setting}]", 1, Setting.send("#{setting}?"), options) end - + def setting_label(setting, options={}) label = options.delete(:label) label != false ? content_tag("label", l(label || "setting_#{setting}")) : '' diff --git a/app/helpers/sort_helper.rb b/app/helpers/sort_helper.rb index 6d325381..daea424b 100644 --- a/app/helpers/sort_helper.rb +++ b/app/helpers/sort_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. #++ @@ -28,18 +28,18 @@ # # helper :sort # include SortHelper -# +# # def list # sort_init 'last_name' # sort_update %w(first_name last_name) # @items = Contact.find_all nil, sort_clause # end -# +# # Controller (using Pagination module): # # helper :sort # include SortHelper -# +# # def list # sort_init 'last_name' # sort_update %w(first_name last_name) @@ -47,9 +47,9 @@ # :order_by => sort_clause, # :per_page => 10 # end -# +# # View (table header in list.rhtml): -# +# # # # <%= sort_header_tag('id', :title => 'Sort by contact ID') %> @@ -65,32 +65,32 @@ module SortHelper class SortCriteria - + def initialize @criteria = [] end - + def available_criteria=(criteria) unless criteria.is_a?(Hash) criteria = criteria.inject({}) {|h,k| h[k] = k; h} end @available_criteria = criteria end - + def from_param(param) @criteria = param.to_s.split(',').collect {|s| s.split(':')[0..1]} normalize! end - + def criteria=(arg) @criteria = arg normalize! end - + def to_param @criteria.collect {|k,o| k + (o ? '' : ':desc')}.join(',') end - + def to_sql sql = @criteria.collect do |k,o| if s = @available_criteria[k] @@ -99,33 +99,33 @@ module SortHelper end.compact.join(', ') sql.blank? ? nil : sql end - + def add!(key, asc) @criteria.delete_if {|k,o| k == key} @criteria = [[key, asc]] + @criteria normalize! end - + def add(*args) r = self.class.new.from_param(to_param) r.add!(*args) r end - + def first_key @criteria.first && @criteria.first.first end - + def first_asc? @criteria.first && @criteria.first.last end - + def empty? @criteria.empty? end - + private - + def normalize! @criteria ||= [] @criteria = @criteria.collect {|s| s = s.to_a; [s.first, (s.last == false || s.last == 'desc') ? false : true]} @@ -133,7 +133,7 @@ module SortHelper @criteria.slice!(3) self end - + # Appends DESC to the sort criterion unless it has a fixed order def append_desc(criterion) if criterion =~ / (asc|desc)$/i @@ -143,14 +143,14 @@ module SortHelper end end end - + def sort_name controller_name + '_' + action_name + '_sort' end # Initializes the default sort. # Examples: - # + # # sort_init 'name' # sort_init 'id', 'desc' # sort_init ['name', ['id', 'desc']] @@ -178,7 +178,7 @@ module SortHelper @sort_criteria.criteria = @sort_default if @sort_criteria.empty? session[sort_name] = @sort_criteria.to_param end - + # Clears the sort criteria session data # def sort_clear @@ -200,7 +200,7 @@ module SortHelper # def sort_link(column, caption, default_order) css, order = nil, default_order - + if column.to_s == @sort_criteria.first_key if @sort_criteria.first_asc? css = 'sort asc' @@ -211,10 +211,10 @@ module SortHelper end end caption = column.to_s.humanize unless caption - + sort_options = { :sort => @sort_criteria.add(column.to_s, order).to_param } url_options = params.merge(sort_options) - + # Add project_id to url_options url_options = url_options.merge(:project_id => params[:project_id]) if params.has_key?(:project_id) diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb index 790dabe1..9e5336b5 100644 --- a/app/helpers/timelog_helper.rb +++ b/app/helpers/timelog_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 TimelogHelper include ApplicationHelper - + def render_timelog_breadcrumb links = [] links << link_to(l(:label_project_all), {:project_id => nil, :issue_id => nil}) @@ -48,15 +48,15 @@ module TimelogHelper activities.each { |a| collection << [a.name, a.id] } collection end - + def select_hours(data, criteria, value) if value.to_s.empty? data.select {|row| row[criteria].blank? } - else + else data.select {|row| row[criteria].to_s == value.to_s} end end - + def sum_hours(data) sum = 0 data.each do |row| @@ -64,7 +64,7 @@ module TimelogHelper end sum end - + def options_for_period_select(value) options_for_select([[l(:label_all_time), 'all'], [l(:label_today), 'today'], @@ -78,9 +78,9 @@ module TimelogHelper [l(:label_this_year), 'current_year']], value) end - + def entries_to_csv(entries) - ic = Iconv.new(l(:general_csv_encoding), 'UTF-8') + ic = Iconv.new(l(:general_csv_encoding), 'UTF-8') decimal_separator = l(:general_csv_decimal_separator) custom_fields = TimeEntryCustomField.find(:all) export = FCSV.generate(:col_sep => l(:general_csv_separator)) do |csv| @@ -97,7 +97,7 @@ module TimelogHelper ] # Export custom fields headers += custom_fields.collect(&:name) - + csv << headers.collect {|c| begin; ic.iconv(c.to_s); rescue; c.to_s; end } # csv lines entries.each do |entry| @@ -112,13 +112,13 @@ module TimelogHelper entry.comments ] fields += custom_fields.collect {|f| show_value(entry.custom_value_for(f)) } - + csv << fields.collect {|c| begin; ic.iconv(c.to_s); rescue; c.to_s; end } end end export end - + def format_criteria_value(criteria, value) if value.blank? l(:label_none) @@ -133,7 +133,7 @@ module TimelogHelper format_value(value, @available_criterias[criteria][:format]) end end - + def report_to_csv(criterias, periods, hours) export = FCSV.generate(:col_sep => l(:general_csv_separator)) do |csv| # Column headers @@ -156,7 +156,7 @@ module TimelogHelper end export end - + def report_criteria_to_csv(csv, criterias, periods, hours, level=0) hours.collect {|h| h[criterias[level]].to_s}.uniq.each do |value| hours_for_value = select_hours(hours, criterias[level], value) @@ -172,13 +172,13 @@ module TimelogHelper end row << "%.2f" %total csv << row - + if criterias.length > level + 1 report_criteria_to_csv(csv, criterias, periods, hours_for_value, level + 1) end end end - + def to_utf8_for_timelogs(s) @ic ||= Iconv.new(l(:general_csv_encoding), 'UTF-8') begin; @ic.iconv(s.to_s); rescue; s.to_s; end diff --git a/app/helpers/trackers_helper.rb b/app/helpers/trackers_helper.rb index 199cf676..3816c752 100644 --- a/app/helpers/trackers_helper.rb +++ b/app/helpers/trackers_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/users_helper.rb b/app/helpers/users_helper.rb index ba835da9..876175bf 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -1,25 +1,25 @@ #-- 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 UsersHelper def users_status_options_for_select(selected) user_count_by_status = User.count(:group => 'status').to_hash - options_for_select([[l(:label_all), ''], + options_for_select([[l(:label_all), ''], ["#{l(:status_active)} (#{user_count_by_status[1].to_i})", 1], ["#{l(:status_registered)} (#{user_count_by_status[2].to_i})", 2], ["#{l(:status_locked)} (#{user_count_by_status[3].to_i})", 3]], selected) end - + # Options for the new membership projects combo-box def options_for_membership_project_select(user, projects) options = content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---") @@ -28,14 +28,14 @@ module UsersHelper end options end - + def user_mail_notification_options(user) user.valid_notification_options.collect {|o| [l(o.last), o.first]} end - + def change_status_link(user) url = {:controller => 'users', :action => 'update', :id => user, :page => params[:page], :status => params[:status], :tab => nil} - + if user.locked? link_to l(:button_unlock), url.merge(:user => {:status => User::STATUS_ACTIVE}), :method => :put, :class => 'icon icon-unlock' elsif user.registered? @@ -44,7 +44,7 @@ module UsersHelper link_to l(:button_lock), url.merge(:user => {:status => User::STATUS_LOCKED}), :method => :put, :class => 'icon icon-lock' end end - + def user_settings_tabs tabs = [{:name => 'general', :partial => 'users/general', :label => :label_general}, {:name => 'memberships', :partial => 'users/memberships', :label => :label_project_plural} diff --git a/app/helpers/versions_helper.rb b/app/helpers/versions_helper.rb index 2e5ae802..a17597f3 100644 --- a/app/helpers/versions_helper.rb +++ b/app/helpers/versions_helper.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. #++ module VersionsHelper STATUS_BY_CRITERIAS = %w(category tracker status priority author assigned_to) - + def render_issue_status_by(version, criteria) criteria = 'category' unless STATUS_BY_CRITERIAS.include?(criteria) - + h = Hash.new {|k,v| k[v] = [0, 0]} begin # Total issue count @@ -32,10 +32,10 @@ module VersionsHelper end counts = h.keys.compact.sort.collect {|k| {:group => k, :total => h[k][0], :open => h[k][1], :closed => (h[k][0] - h[k][1])}} max = counts.collect {|c| c[:total]}.max - + render :partial => 'issue_counts', :locals => {:version => version, :criteria => criteria, :counts => counts, :max => max} end - + def status_by_options_for_select(value) options_for_select(STATUS_BY_CRITERIAS.collect {|criteria| [l("field_#{criteria}".to_sym), criteria]}, value) end diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 6a751f2d..82180461 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_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. #++ @@ -49,7 +49,7 @@ module WatchersHelper link_to_remote((watched ? l(:button_unwatch) : l(:button_watch)), url_options, html_options) end - + # Returns a comma separated list of users watching the given object def watchers_list(object) remove_allowed = User.current.allowed_to?("delete_#{object.class.name.underscore}_watchers".to_sym, object.project) diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 9b037ed3..59085afc 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_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/wiki_helper.rb b/app/helpers/wiki_helper.rb index ea286c8c..b668dfd8 100644 --- a/app/helpers/wiki_helper.rb +++ b/app/helpers/wiki_helper.rb @@ -1,18 +1,18 @@ #-- 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 WikiHelper - + def wiki_page_options_for_select(pages, selected = nil, parent = nil, level = 0) pages = pages.group_by(&:parent) unless pages.is_a?(Hash) s = '' @@ -21,8 +21,8 @@ module WikiHelper attrs = "value='#{page.id}'" attrs << " selected='selected'" if selected == page indent = (level > 0) ? (' ' * level * 2 + '» ') : nil - - s << "\n" + + + s << "\n" + wiki_page_options_for_select(pages, selected, page, level + 1) end end diff --git a/app/helpers/workflows_helper.rb b/app/helpers/workflows_helper.rb index 6f7c933b..009ef3e5 100644 --- a/app/helpers/workflows_helper.rb +++ b/app/helpers/workflows_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/models/attachment.rb b/app/models/attachment.rb index 29aa76f1..43c58e11 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.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 @@ require "digest/md5" class Attachment < ActiveRecord::Base belongs_to :container, :polymorphic => true - + # FIXME: Remove these once the Versions, Documents and Projects themselves can provide file events belongs_to :version, :foreign_key => "container_id" belongs_to :document, :foreign_key => "container_id" @@ -55,7 +55,7 @@ class Attachment < ActiveRecord::Base cattr_accessor :storage_path @@storage_path = Redmine::Configuration['attachments_storage_path'] || "#{RAILS_ROOT}/files" - + def validate if self.filesize > Setting.attachment_max_size.to_i.kilobytes errors.add(:base, :too_long, :count => Setting.attachment_max_size.to_i.kilobytes) @@ -76,7 +76,7 @@ class Attachment < ActiveRecord::Base end end end - + def file nil end @@ -87,7 +87,7 @@ class Attachment < ActiveRecord::Base if @temp_file && (@temp_file.size > 0) logger.debug("saving '#{self.diskfile}'") md5 = Digest::MD5.new - File.open(diskfile, "wb") do |f| + File.open(diskfile, "wb") do |f| buffer = "" while (buffer = @temp_file.read(8192)) f.write(buffer) @@ -111,7 +111,7 @@ class Attachment < ActiveRecord::Base def diskfile "#{@@storage_path}/#{self.disk_filename}" end - + def increment_download increment!(:downloads) end @@ -119,27 +119,27 @@ class Attachment < ActiveRecord::Base def project container.project end - + def visible?(user=User.current) container.attachments_visible?(user) end - + def deletable?(user=User.current) container.attachments_deletable?(user) end - + def image? self.filename =~ /\.(jpe?g|gif|png)$/i end - + def is_text? Redmine::MimeType.is_type?('text', filename) end - + def is_diff? self.filename =~ /\.(patch|diff)$/i end - + # Returns true if the file is readable def readable? File.readable?(diskfile) @@ -156,7 +156,7 @@ class Attachment < ActiveRecord::Base attachments.each_value do |attachment| file = attachment['file'] next unless file && file.size > 0 - a = Attachment.create(:container => obj, + a = Attachment.create(:container => obj, :file => file, :description => attachment['description'].to_s.strip, :author => User.current) @@ -171,18 +171,18 @@ class Attachment < ActiveRecord::Base end {:files => attached, :unsaved => obj.unsaved_attachments} end - + private def sanitize_filename(value) # get only the filename, not the whole path just_filename = value.gsub(/^.*(\\|\/)/, '') # NOTE: File.basename doesn't work right with Windows paths on Unix - # INCORRECT: just_filename = File.basename(value.gsub('\\\\', '/')) + # INCORRECT: just_filename = File.basename(value.gsub('\\\\', '/')) # Finally, replace all non alphanumeric, hyphens or periods with underscore - @filename = just_filename.gsub(/[^\w\.\-]/,'_') + @filename = just_filename.gsub(/[^\w\.\-]/,'_') end - + # Returns an ASCII or hashed filename def self.disk_filename(filename) timestamp = DateTime.now.strftime("%y%m%d%H%M%S") diff --git a/app/models/auth_source.rb b/app/models/auth_source.rb index 7af8ea05..6ab8f780 100644 --- a/app/models/auth_source.rb +++ b/app/models/auth_source.rb @@ -1,39 +1,39 @@ #-- 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 AuthSource < ActiveRecord::Base include Redmine::Ciphering - + has_many :users - + validates_presence_of :name validates_uniqueness_of :name validates_length_of :name, :maximum => 60 def authenticate(login, password) end - + def test_connection end - + def auth_method_name "Abstract" end - + def account_password read_ciphered_attribute(:account_password) end - + def account_password=(arg) write_ciphered_attribute(:account_password, arg) end diff --git a/app/models/auth_source_ldap.rb b/app/models/auth_source_ldap.rb index b348f385..ea1ed3a0 100644 --- a/app/models/auth_source_ldap.rb +++ b/app/models/auth_source_ldap.rb @@ -1,36 +1,36 @@ #-- 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. #++ require 'net/ldap' require 'iconv' -class AuthSourceLdap < AuthSource +class AuthSourceLdap < AuthSource validates_presence_of :host, :port, :attr_login validates_length_of :name, :host, :maximum => 60, :allow_nil => true validates_length_of :account, :account_password, :base_dn, :maximum => 255, :allow_nil => true validates_length_of :attr_login, :attr_firstname, :attr_lastname, :attr_mail, :maximum => 30, :allow_nil => true validates_numericality_of :port, :only_integer => true - + before_validation :strip_ldap_attributes - + def after_initialize self.port = 389 if self.port == 0 end - + def authenticate(login, password) return nil if login.blank? || password.blank? attrs = get_user_dn(login) - + if attrs && attrs[:dn] && authenticate_dn(attrs[:dn], password) logger.debug "Authentication successful for '#{login}'" if logger && logger.debug? return attrs.except(:dn) @@ -46,19 +46,19 @@ class AuthSourceLdap < AuthSource rescue Net::LDAP::LdapError => text raise "LdapError: " + text end - + def auth_method_name "LDAP" end - + private - + def strip_ldap_attributes [:attr_login, :attr_firstname, :attr_lastname, :attr_mail].each do |attr| write_attribute(attr, read_attribute(attr).strip) unless read_attribute(attr).nil? end end - + def initialize_ldap_con(ldap_user, ldap_password) options = { :host => self.host, :port => self.port, @@ -98,12 +98,12 @@ class AuthSourceLdap < AuthSource # Get the user's dn and any attributes for them, given their login def get_user_dn(login) ldap_con = initialize_ldap_con(self.account, self.account_password) - login_filter = Net::LDAP::Filter.eq( self.attr_login, login ) - object_filter = Net::LDAP::Filter.eq( "objectClass", "*" ) + login_filter = Net::LDAP::Filter.eq( self.attr_login, login ) + object_filter = Net::LDAP::Filter.eq( "objectClass", "*" ) attrs = {} - - ldap_con.search( :base => self.base_dn, - :filter => object_filter & login_filter, + + ldap_con.search( :base => self.base_dn, + :filter => object_filter & login_filter, :attributes=> search_attributes) do |entry| if onthefly_register? @@ -117,7 +117,7 @@ class AuthSourceLdap < AuthSource attrs end - + def self.get_attr(entry, attr_name) if !attr_name.blank? entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name] diff --git a/app/models/board.rb b/app/models/board.rb index 9c0165d4..48acc94f 100644 --- a/app/models/board.rb +++ b/app/models/board.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,23 +18,23 @@ class Board < ActiveRecord::Base belongs_to :last_message, :class_name => 'Message', :foreign_key => :last_message_id acts_as_list :scope => :project_id acts_as_watchable - + validates_presence_of :name, :description validates_length_of :name, :maximum => 30 validates_length_of :description, :maximum => 255 - + def visible?(user=User.current) !user.nil? && user.allowed_to?(:view_messages, project) end - + def to_s name end - + def reset_counters! self.class.reset_counters!(id) end - + # Updates topics_count, messages_count and last_message_id attributes for +board_id+ def self.reset_counters!(board_id) board_id = board_id.to_i diff --git a/app/models/change.rb b/app/models/change.rb index 940329ff..652fde7d 100644 --- a/app/models/change.rb +++ b/app/models/change.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 Change < ActiveRecord::Base belongs_to :changeset - + validates_presence_of :changeset_id, :action, :path before_save :init_path - + def relative_path changeset.repository.relative_path(path) end - + def init_path self.path ||= "" end diff --git a/app/models/changeset.rb b/app/models/changeset.rb index 85b86f8a..4fdaf665 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.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. #++ @@ -29,15 +29,15 @@ class Changeset < ActiveRecord::Base :include => {:repository => :project}, :project_key => "#{Repository.table_name}.project_id", :date_column => 'committed_on' - - + + validates_presence_of :repository_id, :revision, :committed_on, :commit_date validates_uniqueness_of :revision, :scope => :repository_id validates_uniqueness_of :scmid, :scope => :repository_id, :allow_nil => true - + named_scope :visible, lambda {|*args| { :include => {:repository => :project}, :conditions => Project.allowed_to_condition(args.first || User.current, :view_changesets) } } - + def revision=(r) write_attribute :revision, (r.nil? ? nil : r.to_s) end @@ -64,15 +64,15 @@ class Changeset < ActiveRecord::Base identifier end end - + def project repository.project end - + def author user || committer.to_s.split('<').first end - + def before_create self.committer = self.class.to_utf8(self.committer, repository.repo_log_encoding) self.comments = self.class.normalize_comments(self.comments, repository.repo_log_encoding) @@ -82,7 +82,7 @@ class Changeset < ActiveRecord::Base def after_create scan_comment_for_issue_ids end - + TIMELOG_RE = / ( ((\d+)(h|hours?))((\d+)(m|min)?)? @@ -94,7 +94,7 @@ class Changeset < ActiveRecord::Base (\d+([\.,]\d+)?)h? ) /x - + def scan_comment_for_issue_ids return if comments.blank? # keywords used to reference issues @@ -102,15 +102,15 @@ class Changeset < ActiveRecord::Base ref_keywords_any = ref_keywords.delete('*') # keywords used to fix issues fix_keywords = Setting.commit_fix_keywords.downcase.split(",").collect(&:strip) - + kw_regexp = (ref_keywords + fix_keywords).collect{|kw| Regexp.escape(kw)}.join("|") - + referenced_issues = [] - + comments.scan(/([\s\(\[,-]|^)((#{kw_regexp})[\s:]+)?(#\d+(\s+@#{TIMELOG_RE})?([\s,;&]+#\d+(\s+@#{TIMELOG_RE})?)*)(?=[[:punct:]]|\s|<|$)/i) do |match| action, refs = match[2], match[3] next unless action.present? || ref_keywords_any - + refs.scan(/#(\d+)(\s+@#{TIMELOG_RE})?/).each do |m| issue, hours = find_referenced_issue_by_id(m[0].to_i), m[2] if issue @@ -120,15 +120,15 @@ class Changeset < ActiveRecord::Base end end end - + referenced_issues.uniq! self.issues = referenced_issues unless referenced_issues.empty? end - + def short_comments @short_comments || split_comments.first end - + def long_comments @long_comments || split_comments.last end @@ -140,7 +140,7 @@ class Changeset < ActiveRecord::Base "r#{revision}" end end - + # Returns the previous changeset def previous @previous ||= Changeset.find(:first, :conditions => ['id < ? AND repository_id = ?', self.id, self.repository_id], :order => 'id DESC') @@ -150,7 +150,7 @@ class Changeset < ActiveRecord::Base def next @next ||= Changeset.find(:first, :conditions => ['id > ? AND repository_id = ?', self.id, self.repository_id], :order => 'id ASC') end - + # Creates a new Change from it's common parameters def create_change(change) Change.create(:changeset => self, @@ -174,19 +174,19 @@ class Changeset < ActiveRecord::Base end issue end - + def fix_issue(issue) status = IssueStatus.find_by_id(Setting.commit_fix_status_id.to_i) if status.nil? logger.warn("No status macthes commit_fix_status_id setting (#{Setting.commit_fix_status_id})") if logger return issue end - + # the issue may have been updated by the closure of another one (eg. duplicate) issue.reload # don't change the status is the issue is closed return if issue.status && issue.status.is_closed? - + issue.init_journal(user || User.anonymous, ll(Setting.default_language, :text_status_changed_by_changeset, text_tag)) issue.status = status unless Setting.commit_fix_done_ratio.blank? @@ -199,7 +199,7 @@ class Changeset < ActiveRecord::Base end issue end - + def log_time(issue, hours) time_entry = TimeEntry.new( :user => user, @@ -209,19 +209,19 @@ class Changeset < ActiveRecord::Base :comments => l(:text_time_logged_by_changeset, :value => text_tag, :locale => Setting.default_language) ) time_entry.activity = log_time_activity unless log_time_activity.nil? - + unless time_entry.save logger.warn("TimeEntry could not be created by changeset #{id}: #{time_entry.errors.full_messages}") if logger end time_entry end - + def log_time_activity if Setting.commit_logtime_activity_id.to_i > 0 TimeEntryActivity.find_by_id(Setting.commit_logtime_activity_id.to_i) end end - + def split_comments comments =~ /\A(.+?)\r?\n(.*)$/m @short_comments = $1 || comments diff --git a/app/models/comment.rb b/app/models/comment.rb index 7576ef9a..48bd34c8 100644 --- a/app/models/comment.rb +++ b/app/models/comment.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/models/comment_observer.rb b/app/models/comment_observer.rb index 1b911ed0..3ac940b1 100644 --- a/app/models/comment_observer.rb +++ b/app/models/comment_observer.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/models/custom_field.rb b/app/models/custom_field.rb index 3fb754a2..f0946169 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.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 CustomField < ActiveRecord::Base has_many :custom_values, :dependent => :delete_all acts_as_list :scope => 'type = \'#{self.class}\'' serialize :possible_values - + validates_presence_of :name, :field_format validates_uniqueness_of :name, :scope => :type validates_length_of :name, :maximum => 30 @@ -25,25 +25,25 @@ class CustomField < ActiveRecord::Base super self.possible_values ||= [] end - + def before_validation # make sure these fields are not searchable self.searchable = false if %w(int float date bool).include?(field_format) true end - + def validate if self.field_format == "list" errors.add(:possible_values, :blank) if self.possible_values.nil? || self.possible_values.empty? errors.add(:possible_values, :invalid) unless self.possible_values.is_a? Array end - + # validate default value v = CustomValue.new(:custom_field => self.clone, :value => default_value, :customized => nil) v.custom_field.is_required = false errors.add(:default_value, :invalid) unless v.valid? end - + def possible_values_options(obj=nil) case field_format when 'user', 'version' @@ -61,7 +61,7 @@ class CustomField < ActiveRecord::Base read_attribute :possible_values end end - + def possible_values(obj=nil) case field_format when 'user' @@ -70,7 +70,7 @@ class CustomField < ActiveRecord::Base read_attribute :possible_values end end - + # Makes possible_values accept a multiline string def possible_values=(arg) if arg.is_a?(Array) @@ -79,7 +79,7 @@ class CustomField < ActiveRecord::Base self.possible_values = arg.to_s.split(/[\n\r]+/) end end - + def cast_value(value) casted = nil unless value.blank? @@ -100,7 +100,7 @@ class CustomField < ActiveRecord::Base end casted end - + # Returns a ORDER BY clause that can used to sort customized # objects by their value of the custom field. # Returns false, if the custom field can not be used for sorting. @@ -108,7 +108,7 @@ class CustomField < ActiveRecord::Base case field_format when 'string', 'text', 'list', 'date', 'bool' # COALESCE is here to make sure that blank and NULL values are sorted equally - "COALESCE((SELECT cv_sort.value FROM #{CustomValue.table_name} cv_sort" + + "COALESCE((SELECT cv_sort.value FROM #{CustomValue.table_name} cv_sort" + " WHERE cv_sort.customized_type='#{self.class.customized_class.name}'" + " AND cv_sort.customized_id=#{self.class.customized_class.table_name}.id" + " AND cv_sort.custom_field_id=#{id} LIMIT 1), '')" @@ -116,7 +116,7 @@ class CustomField < ActiveRecord::Base # Make the database cast values into numeric # Postgresql will raise an error if a value can not be casted! # CustomValue validations should ensure that it doesn't occur - "(SELECT CAST(cv_sort.value AS decimal(60,3)) FROM #{CustomValue.table_name} cv_sort" + + "(SELECT CAST(cv_sort.value AS decimal(60,3)) FROM #{CustomValue.table_name} cv_sort" + " WHERE cv_sort.customized_type='#{self.class.customized_class.name}'" + " AND cv_sort.customized_id=#{self.class.customized_class.table_name}.id" + " AND cv_sort.custom_field_id=#{id} AND cv_sort.value <> '' AND cv_sort.value IS NOT NULL LIMIT 1)" @@ -128,17 +128,17 @@ class CustomField < ActiveRecord::Base def <=>(field) position <=> field.position end - + def self.customized_class self.name =~ /^(.+)CustomField$/ begin; $1.constantize; rescue nil; end end - + # to move in project_custom_field def self.for_all find(:all, :conditions => ["is_for_all=?", true], :order => 'position') end - + def type_name nil end diff --git a/app/models/custom_value.rb b/app/models/custom_value.rb index c387b8c0..60a2dce4 100644 --- a/app/models/custom_value.rb +++ b/app/models/custom_value.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,41 +20,41 @@ class CustomValue < ActiveRecord::Base self.value ||= custom_field.default_value end end - + # Returns true if the boolean custom value is true def true? self.value == '1' end - + def editable? custom_field.editable? end - + def visible? custom_field.visible? end - + def required? custom_field.is_required? end - + def to_s value.to_s end - + protected def validate if value.blank? - errors.add(:value, :blank) if custom_field.is_required? and value.blank? + errors.add(:value, :blank) if custom_field.is_required? and value.blank? else errors.add(:value, :invalid) unless custom_field.regexp.blank? or value =~ Regexp.new(custom_field.regexp) errors.add(:value, :too_short, :count => custom_field.min_length) if custom_field.min_length > 0 and value.length < custom_field.min_length errors.add(:value, :too_long, :count => custom_field.max_length) if custom_field.max_length > 0 and value.length > custom_field.max_length - + # Format specific validations case custom_field.field_format when 'int' - errors.add(:value, :not_a_number) unless value =~ /^[+-]?\d+$/ + errors.add(:value, :not_a_number) unless value =~ /^[+-]?\d+$/ when 'float' begin; Kernel.Float(value); rescue; errors.add(:value, :invalid) end when 'date' diff --git a/app/models/document.rb b/app/models/document.rb index 3a2c589d..2c425095 100644 --- a/app/models/document.rb +++ b/app/models/document.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,23 +23,23 @@ class Document < ActiveRecord::Base end) acts_as_searchable :columns => ['title', "#{table_name}.description"], :include => :project - + validates_presence_of :project, :title, :category validates_length_of :title, :maximum => 60 - + named_scope :visible, lambda {|*args| { :include => :project, :conditions => Project.allowed_to_condition(args.first || User.current, :view_documents) } } - + def visible?(user=User.current) !user.nil? && user.allowed_to?(:view_documents, project) end - + def after_initialize if new_record? self.category ||= DocumentCategory.default end end - + def updated_on unless @updated_on a = attachments.find(:first, :order => 'created_on DESC') diff --git a/app/models/document_category.rb b/app/models/document_category.rb index 9776572f..6b41c053 100644 --- a/app/models/document_category.rb +++ b/app/models/document_category.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/models/document_category_custom_field.rb b/app/models/document_category_custom_field.rb index d295d1ef..b1ea94e6 100644 --- a/app/models/document_category_custom_field.rb +++ b/app/models/document_category_custom_field.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/models/document_observer.rb b/app/models/document_observer.rb index 208016a5..afb5f66a 100644 --- a/app/models/document_observer.rb +++ b/app/models/document_observer.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/models/enabled_module.rb b/app/models/enabled_module.rb index 772e82d9..93db8cdc 100644 --- a/app/models/enabled_module.rb +++ b/app/models/enabled_module.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 EnabledModule < ActiveRecord::Base belongs_to :project - + validates_presence_of :name validates_uniqueness_of :name, :scope => :project_id - + after_create :module_enabled - + private - + # after_create callback used to do things when a module is enabled def module_enabled case name diff --git a/app/models/enumeration.rb b/app/models/enumeration.rb index c2c723cf..a1d1e816 100644 --- a/app/models/enumeration.rb +++ b/app/models/enumeration.rb @@ -1,27 +1,27 @@ #-- 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 Enumeration < ActiveRecord::Base default_scope :order => "#{Enumeration.table_name}.position ASC" - + belongs_to :project - + acts_as_list :scope => 'type = \'#{type}\'' acts_as_customizable acts_as_tree :order => 'position ASC' before_destroy :check_integrity - + validates_presence_of :name validates_uniqueness_of :name, :scope => [:type, :project_id] validates_length_of :name, :maximum => 30 @@ -40,7 +40,7 @@ class Enumeration < ActiveRecord::Base find(:first, :conditions => { :is_default => true }) end end - + # Overloaded on concrete classes def option_name nil @@ -51,12 +51,12 @@ class Enumeration < ActiveRecord::Base Enumeration.update_all("is_default = #{connection.quoted_false}", {:type => type}) end end - + # Overloaded on concrete classes def objects_count 0 end - + def in_use? self.objects_count != 0 end @@ -65,9 +65,9 @@ class Enumeration < ActiveRecord::Base def is_override? !self.parent.nil? end - + alias :destroy_without_reassign :destroy - + # Destroy the enumeration # If a enumeration is specified, objects are reassigned def destroy(reassign_to = nil) @@ -76,11 +76,11 @@ class Enumeration < ActiveRecord::Base end destroy_without_reassign end - + def <=>(enumeration) position <=> enumeration.position end - + def to_s; name end # Returns the Subclasses of Enumeration. Each Subclass needs to be @@ -110,13 +110,13 @@ class Enumeration < ActiveRecord::Base return true end - + # Are the new and previous fields equal? def self.same_active_state?(new, previous) new = (new == "1" ? true : false) return new == previous end - + private def check_integrity raise "Can't delete enumeration" if self.in_use? diff --git a/app/models/group.rb b/app/models/group.rb index c3033890..77b277ad 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,30 +1,30 @@ #-- 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 Group < Principal has_and_belongs_to_many :users, :after_add => :user_added, :after_remove => :user_removed - + acts_as_customizable - + validates_presence_of :lastname validates_uniqueness_of :lastname, :case_sensitive => false validates_length_of :lastname, :maximum => 30 - + def to_s lastname.to_s end - + def user_added(user) members.each do |member| next if member.project.nil? @@ -35,7 +35,7 @@ class Group < Principal user_member.save! end end - + def user_removed(user) members.each do |member| MemberRole.find(:all, :include => :member, diff --git a/app/models/group_custom_field.rb b/app/models/group_custom_field.rb index aac56c52..f291d913 100644 --- a/app/models/group_custom_field.rb +++ b/app/models/group_custom_field.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/models/issue.rb b/app/models/issue.rb index d366ad43..311ddabd 100644 --- a/app/models/issue.rb +++ b/app/models/issue.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 Issue < ActiveRecord::Base include Redmine::SafeAttributes - + belongs_to :project belongs_to :tracker belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id' @@ -25,10 +25,10 @@ class Issue < ActiveRecord::Base has_many :time_entries, :dependent => :delete_all has_and_belongs_to_many :changesets, :order => "#{Changeset.table_name}.committed_on ASC, #{Changeset.table_name}.id ASC" - + has_many :relations_from, :class_name => 'IssueRelation', :foreign_key => 'issue_from_id', :dependent => :delete_all has_many :relations_to, :class_name => 'IssueRelation', :foreign_key => 'issue_to_id', :dependent => :delete_all - + acts_as_nested_set :scope => 'root_id', :dependent => :destroy acts_as_attachable :after_remove => :attachment_removed acts_as_customizable @@ -67,7 +67,7 @@ class Issue < ActiveRecord::Base named_scope :visible, lambda {|*args| { :include => :project, :conditions => Issue.visible_condition(args.first || User.current) } } - + named_scope :open, :conditions => ["#{IssueStatus.table_name}.is_closed = ?", false], :include => :status named_scope :recently_updated, :order => "#{Issue.table_name}.updated_on DESC" @@ -91,7 +91,7 @@ class Issue < ActiveRecord::Base before_save :close_duplicates, :update_done_ratio_from_issue_status after_save :reschedule_following_issues, :update_nested_set_attributes, :update_parent_attributes after_destroy :update_parent_attributes - + # Returns a SQL conditions string used to find all issues visible by the specified user def self.visible_condition(user, options={}) Project.allowed_to_condition(user, :view_issues, options) @@ -101,7 +101,7 @@ class Issue < ActiveRecord::Base def visible?(usr=nil) (usr || User.current).allowed_to?(:view_issues, self.project) end - + def after_initialize if new_record? # set default values for new records only @@ -109,12 +109,12 @@ class Issue < ActiveRecord::Base self.priority ||= IssuePriority.default end end - + # Overrides Redmine::Acts::Customizable::InstanceMethods#available_custom_fields def available_custom_fields (project && tracker) ? (project.all_issue_custom_fields & tracker.custom_fields.all) : [] end - + def copy_from(arg) issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg) self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on") @@ -122,7 +122,7 @@ class Issue < ActiveRecord::Base self.status = issue.status self end - + # Moves/copies an issue to a new project and tracker # Returns the moved/copied issue on success, false on failure def move_to_project(*args) @@ -130,11 +130,11 @@ class Issue < ActiveRecord::Base move_to_project_without_transaction(*args) || raise(ActiveRecord::Rollback) end || false end - + def move_to_project_without_transaction(new_project, new_tracker = nil, options = {}) options ||= {} issue = options[:copy] ? self.class.new.copy_from(self) : self - + if new_project && issue.project_id != new_project.id # delete issue relations unless Setting.cross_project_issue_relations? @@ -174,7 +174,7 @@ class Issue < ActiveRecord::Base unless options[:copy] # Manually update project_id on related time entries TimeEntry.update_all("project_id = #{new_project.id}", {:issue_id => id}) - + issue.children.each do |child| unless child.move_to_project_without_transaction(new_project) # Move failed and transaction was rollback'd @@ -192,7 +192,7 @@ class Issue < ActiveRecord::Base self.status = nil write_attribute(:status_id, sid) end - + def priority_id=(pid) self.priority = nil write_attribute(:priority_id, pid) @@ -204,7 +204,7 @@ class Issue < ActiveRecord::Base @custom_field_values = nil result end - + # Overrides attributes= so that tracker_id gets assigned first def attributes_with_tracker_first=(new_attributes, *args) return if new_attributes.nil? @@ -216,11 +216,11 @@ class Issue < ActiveRecord::Base end # Do not redefine alias chain on reload (see #4838) alias_method_chain(:attributes=, :tracker_first) unless method_defined?(:attributes_without_tracker_first=) - + def estimated_hours=(h) write_attribute :estimated_hours, (h.is_a?(String) ? h.to_hours : h) end - + safe_attributes 'tracker_id', 'status_id', 'parent_issue_id', @@ -238,7 +238,7 @@ class Issue < ActiveRecord::Base 'custom_fields', 'lock_version', :if => lambda {|issue, user| issue.new_record? || user.allowed_to?(:edit_issues, issue.project) } - + safe_attributes 'status_id', 'assigned_to_id', 'fixed_version_id', @@ -252,26 +252,26 @@ class Issue < ActiveRecord::Base # TODO: move workflow/permission checks from controllers to here def safe_attributes=(attrs, user=User.current) return unless attrs.is_a?(Hash) - + # User can change issue attributes only if he has :edit permission or if a workflow transition is allowed attrs = delete_unsafe_attributes(attrs, user) - return if attrs.empty? - + return if attrs.empty? + # Tracker must be set before since new_statuses_allowed_to depends on it. if t = attrs.delete('tracker_id') self.tracker_id = t end - + if attrs['status_id'] unless new_statuses_allowed_to(user).collect(&:id).include?(attrs['status_id'].to_i) attrs.delete('status_id') end end - + unless leaf? attrs.reject! {|k,v| %w(priority_id done_ratio start_date due_date estimated_hours).include?(k)} end - + if attrs.has_key?('parent_issue_id') if !user.allowed_to?(:manage_subtasks, project) attrs.delete('parent_issue_id') @@ -279,10 +279,10 @@ class Issue < ActiveRecord::Base attrs.delete('parent_issue_id') unless Issue.visible(user).exists?(attrs['parent_issue_id'].to_i) end end - + self.attributes = attrs end - + def done_ratio if Issue.use_status_for_done_ratio? && status && status.default_done_ratio status.default_done_ratio @@ -298,20 +298,20 @@ class Issue < ActiveRecord::Base def self.use_field_for_done_ratio? Setting.issue_done_ratio == 'issue_field' end - + def validate if self.due_date.nil? && @attributes['due_date'] && !@attributes['due_date'].empty? errors.add :due_date, :not_a_date end - + if self.due_date and self.start_date and self.due_date < self.start_date errors.add :due_date, :greater_than_start_date end - + if start_date && soonest_start && start_date < soonest_start errors.add :start_date, :invalid end - + if fixed_version if !assignable_versions.include?(fixed_version) errors.add :fixed_version_id, :inclusion @@ -319,14 +319,14 @@ class Issue < ActiveRecord::Base errors.add_to_base I18n.t(:error_can_not_reopen_issue_on_closed_version) end end - + # Checks that the issue can not be added/moved to a disabled tracker if project && (tracker_id_changed? || project_id_changed?) unless project.trackers.include?(tracker) errors.add :tracker_id, :inclusion end end - + # Checks parent issue assignment if @parent_issue if @parent_issue.project_id != project_id @@ -343,7 +343,7 @@ class Issue < ActiveRecord::Base end end end - + # Set the done_ratio using the status if that setting is set. This will keep the done_ratios # even if the user turns off the setting later def update_done_ratio_from_issue_status @@ -351,19 +351,19 @@ class Issue < ActiveRecord::Base self.done_ratio = status.default_done_ratio end end - + # Callback on attachment deletion def attachment_removed(obj) init_journal(User.current) create_journal last_journal.update_attribute(:changes, {"attachments_" + obj.id.to_s => [obj.filename, nil]}.to_yaml) end - + # Return true if the issue is closed, otherwise false def closed? self.status.is_closed? end - + # Return true if the issue is being reopened def reopened? if !new_record? && status_id_changed? @@ -387,7 +387,7 @@ class Issue < ActiveRecord::Base end false end - + # Returns true if the issue is overdue def overdue? !due_date.nil? && (due_date < Date.today) && !status.is_closed? @@ -404,24 +404,24 @@ class Issue < ActiveRecord::Base def children? !leaf? end - + # Users the issue can be assigned to def assignable_users users = project.assignable_users users << author if author users.uniq.sort end - + # Versions that the issue can be assigned to def assignable_versions @assignable_versions ||= (project.shared_versions.open + [Version.find_by_id(fixed_version_id_was)]).compact.uniq.sort end - + # Returns true if this issue is blocked by another issue that is still open def blocked? !relations_to.detect {|ir| ir.relation_type == 'blocks' && !ir.issue_from.closed?}.nil? end - + # Returns an array of status that user is able to apply def new_statuses_allowed_to(user, include_default=false) statuses = status.find_new_statuses_allowed_to( @@ -435,7 +435,7 @@ class Issue < ActiveRecord::Base statuses = statuses.uniq.sort blocked? ? statuses.reject {|s| s.is_closed?} : statuses end - + # Returns the mail adresses of users that should be notified def recipients notified = project.notified_users @@ -448,7 +448,7 @@ class Issue < ActiveRecord::Base notified.reject! {|user| !visible?(user)} notified.collect(&:mail) end - + # Returns the total number of hours spent on this issue and its descendants # # Example: @@ -457,50 +457,50 @@ class Issue < ActiveRecord::Base def spent_hours @spent_hours ||= self_and_descendants.sum("#{TimeEntry.table_name}.hours", :include => :time_entries).to_f || 0.0 end - + def relations (relations_from + relations_to).sort end - + def all_dependent_issues(except=[]) except << self dependencies = [] relations_from.each do |relation| - if relation.issue_to && !except.include?(relation.issue_to) + if relation.issue_to && !except.include?(relation.issue_to) dependencies << relation.issue_to dependencies += relation.issue_to.all_dependent_issues(except) end end dependencies end - + # Returns an array of issues that duplicate this one def duplicates relations_to.select {|r| r.relation_type == IssueRelation::TYPE_DUPLICATES}.collect {|r| r.issue_from} end - + # Returns the due date or the target due date if any # Used on gantt chart def due_before due_date || (fixed_version ? fixed_version.effective_date : nil) end - + # Returns the time scheduled for this issue. - # + # # Example: # Start Date: 2/26/09, End Date: 3/04/09 # duration => 6 def duration (start_date && due_date) ? due_date - start_date : 0 end - + def soonest_start @soonest_start ||= ( relations_to.collect{|relation| relation.successor_soonest_start} + ancestors.collect(&:soonest_start) ).compact.max end - + def reschedule_after(date) return if date.nil? if leaf? @@ -514,7 +514,7 @@ class Issue < ActiveRecord::Base end end end - + def <=>(issue) if issue.nil? -1 @@ -524,11 +524,11 @@ class Issue < ActiveRecord::Base (lft || 0) <=> (issue.lft || 0) end end - + def to_s "#{tracker} ##{id}: #{subject}" end - + # Returns a string of css classes that apply to the issue def css_classes s = "issue status-#{status.position} priority-#{priority.position}" @@ -554,10 +554,10 @@ class Issue < ActiveRecord::Base @time_entry.attributes = params[:time_entry] self.time_entries << @time_entry end - + if valid? attachments = Attachment.attach_files(self, params[:attachments]) - + # TODO: Rename hook Redmine::Hook.call_hook(:controller_issues_edit_before_save, { :params => params, :issue => self, :time_entry => @time_entry, :journal => current_journal}) begin @@ -581,7 +581,7 @@ class Issue < ActiveRecord::Base # Update issues assigned to the version update_versions(["#{Issue.table_name}.fixed_version_id = ?", version.id]) end - + # Unassigns issues from versions that are no longer shared # after +project+ was moved def self.update_versions_from_hierarchy_change(project) @@ -599,7 +599,7 @@ class Issue < ActiveRecord::Base nil end end - + def parent_issue_id if instance_variable_defined? :@parent_issue @parent_issue.nil? ? nil : @parent_issue.id @@ -646,19 +646,19 @@ class Issue < ActiveRecord::Base end def self.by_subproject(project) - ActiveRecord::Base.connection.select_all("select s.id as status_id, - s.is_closed as closed, + ActiveRecord::Base.connection.select_all("select s.id as status_id, + s.is_closed as closed, i.project_id as project_id, - count(i.id) as total - from + count(i.id) as total + from #{Issue.table_name} i, #{IssueStatus.table_name} s - where - i.status_id=s.id + where + i.status_id=s.id and i.project_id IN (#{project.descendants.active.collect{|p| p.id}.join(',')}) group by s.id, s.is_closed, i.project_id") if project.descendants.active.any? end # End ReportsController extraction - + # Returns an array of projects that current user can move issues to def self.allowed_target_projects_on_move projects = [] @@ -674,9 +674,9 @@ class Issue < ActiveRecord::Base end projects end - + private - + def update_nested_set_attributes if root_id.nil? # issue was just created @@ -723,7 +723,7 @@ class Issue < ActiveRecord::Base end remove_instance_variable(:@parent_issue) if instance_variable_defined?(:@parent_issue) end - + def update_parent_attributes recalculate_attributes_for(parent_id) if parent_id end @@ -734,14 +734,14 @@ class Issue < ActiveRecord::Base if priority_position = p.children.maximum("#{IssuePriority.table_name}.position", :include => :priority) p.priority = IssuePriority.find_by_position(priority_position) end - + # start/due dates = lowest/highest dates of children p.start_date = p.children.minimum(:start_date) p.due_date = p.children.maximum(:due_date) if p.start_date && p.due_date && p.due_date < p.start_date p.start_date, p.due_date = p.due_date, p.start_date end - + # done ratio = weighted average ratio of leaves unless Issue.use_status_for_done_ratio? && p.status && p.status.default_done_ratio leaves_count = p.leaves.count @@ -755,16 +755,16 @@ class Issue < ActiveRecord::Base p.done_ratio = progress.round end end - + # estimate = sum of leaves estimates p.estimated_hours = p.leaves.sum(:estimated_hours).to_f p.estimated_hours = nil if p.estimated_hours == 0.0 - + # ancestors will be recursively updated p.save(false) end end - + # Update issues so their versions are not pointing to a # fixed_version that is not shared with the issue's project def self.update_versions(conditions=nil) @@ -783,7 +783,7 @@ class Issue < ActiveRecord::Base end end end - + # Default assignment based on category def default_assign if assigned_to.nil? && category && category.assigned_to @@ -830,20 +830,20 @@ class Issue < ActiveRecord::Base joins = options.delete(:joins) where = "i.#{select_field}=j.id" - - ActiveRecord::Base.connection.select_all("select s.id as status_id, - s.is_closed as closed, + + ActiveRecord::Base.connection.select_all("select s.id as status_id, + s.is_closed as closed, j.id as #{select_field}, - count(i.id) as total - from + count(i.id) as total + from #{Issue.table_name} i, #{IssueStatus.table_name} s, #{joins} j - where - i.status_id=s.id + where + i.status_id=s.id and #{where} and i.project_id=#{project.id} group by s.id, s.is_closed, j.id") end - + IssueJournal.class_eval do # Shortcut diff --git a/app/models/issue_category.rb b/app/models/issue_category.rb index c6bb3a39..81e2023e 100644 --- a/app/models/issue_category.rb +++ b/app/models/issue_category.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,13 +15,13 @@ class IssueCategory < ActiveRecord::Base belongs_to :project belongs_to :assigned_to, :class_name => 'User', :foreign_key => 'assigned_to_id' has_many :issues, :foreign_key => 'category_id', :dependent => :nullify - + validates_presence_of :name validates_uniqueness_of :name, :scope => [:project_id] validates_length_of :name, :maximum => 30 - + alias :destroy_without_reassign :destroy - + # Destroy the category # If a category is specified, issues are reassigned to this category def destroy(reassign_to = nil) @@ -30,10 +30,10 @@ class IssueCategory < ActiveRecord::Base end destroy_without_reassign end - + def <=>(category) name <=> category.name end - + def to_s; name end end diff --git a/app/models/issue_custom_field.rb b/app/models/issue_custom_field.rb index 51e171eb..e0aab007 100644 --- a/app/models/issue_custom_field.rb +++ b/app/models/issue_custom_field.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 IssueCustomField < CustomField has_and_belongs_to_many :projects, :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}", :foreign_key => "custom_field_id" has_and_belongs_to_many :trackers, :join_table => "#{table_name_prefix}custom_fields_trackers#{table_name_suffix}", :foreign_key => "custom_field_id" has_many :issues, :through => :issue_custom_values - + def type_name :label_issue_plural end diff --git a/app/models/issue_observer.rb b/app/models/issue_observer.rb index 4ce29164..63c50e6d 100644 --- a/app/models/issue_observer.rb +++ b/app/models/issue_observer.rb @@ -1,32 +1,32 @@ #-- 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 IssueObserver < ActiveRecord::Observer attr_accessor :send_notification - + def after_create(issue) if self.send_notification Mailer.deliver_issue_add(issue) if Setting.notified_events.include?('issue_added') end clear_notification end - + # Wrap send_notification so it defaults to true, when it's nil def send_notification return true if @send_notification.nil? return @send_notification end - + private # Need to clear the notification setting after each usage otherwise it might be cached diff --git a/app/models/issue_priority.rb b/app/models/issue_priority.rb index 173830ea..20239380 100644 --- a/app/models/issue_priority.rb +++ b/app/models/issue_priority.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/models/issue_priority_custom_field.rb b/app/models/issue_priority_custom_field.rb index b4c2e494..057d8563 100644 --- a/app/models/issue_priority_custom_field.rb +++ b/app/models/issue_priority_custom_field.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/models/issue_relation.rb b/app/models/issue_relation.rb index 70802314..e925015d 100644 --- a/app/models/issue_relation.rb +++ b/app/models/issue_relation.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 IssueRelation < ActiveRecord::Base belongs_to :issue_from, :class_name => 'Issue', :foreign_key => 'issue_from_id' belongs_to :issue_to, :class_name => 'Issue', :foreign_key => 'issue_to_id' - + TYPE_RELATES = "relates" TYPE_DUPLICATES = "duplicates" TYPE_DUPLICATED = "duplicated" @@ -22,7 +22,7 @@ class IssueRelation < ActiveRecord::Base TYPE_BLOCKED = "blocked" TYPE_PRECEDES = "precedes" TYPE_FOLLOWS = "follows" - + TYPES = { TYPE_RELATES => { :name => :label_relates_to, :sym_name => :label_relates_to, :order => 1, :sym => TYPE_RELATES }, TYPE_DUPLICATES => { :name => :label_duplicates, :sym_name => :label_duplicated_by, :order => 2, :sym => TYPE_DUPLICATED }, TYPE_DUPLICATED => { :name => :label_duplicated_by, :sym_name => :label_duplicates, :order => 3, :sym => TYPE_DUPLICATES, :reverse => TYPE_DUPLICATES }, @@ -31,14 +31,14 @@ class IssueRelation < ActiveRecord::Base TYPE_PRECEDES => { :name => :label_precedes, :sym_name => :label_follows, :order => 6, :sym => TYPE_FOLLOWS }, TYPE_FOLLOWS => { :name => :label_follows, :sym_name => :label_precedes, :order => 7, :sym => TYPE_PRECEDES, :reverse => TYPE_PRECEDES } }.freeze - + validates_presence_of :issue_from, :issue_to, :relation_type validates_inclusion_of :relation_type, :in => TYPES.keys validates_numericality_of :delay, :allow_nil => true validates_uniqueness_of :issue_to_id, :scope => :issue_from_id - + attr_protected :issue_from_id, :issue_to_id - + def validate if issue_from && issue_to errors.add :issue_to_id, :invalid if issue_from_id == issue_to_id @@ -47,11 +47,11 @@ class IssueRelation < ActiveRecord::Base errors.add_to_base :cant_link_an_issue_with_a_descendant if issue_from.is_descendant_of?(issue_to) || issue_from.is_ancestor_of?(issue_to) end end - + def other_issue(issue) (self.issue_from_id == issue.id) ? issue_to : issue_from end - + # Returns the relation type for +issue+ def relation_type_for(issue) if TYPES[relation_type] @@ -62,14 +62,14 @@ class IssueRelation < ActiveRecord::Base end end end - + def label_for(issue) TYPES[relation_type] ? TYPES[relation_type][(self.issue_from_id == issue.id) ? :name : :sym_name] : :unknow end - + def before_save reverse_if_needed - + if TYPE_PRECEDES == relation_type self.delay ||= 0 else @@ -77,26 +77,26 @@ class IssueRelation < ActiveRecord::Base end set_issue_to_dates end - + def set_issue_to_dates soonest_start = self.successor_soonest_start if soonest_start && issue_to issue_to.reschedule_after(soonest_start) end end - + def successor_soonest_start if (TYPE_PRECEDES == self.relation_type) && delay && issue_from && (issue_from.start_date || issue_from.due_date) (issue_from.due_date || issue_from.start_date) + 1 + delay end end - + def <=>(relation) TYPES[self.relation_type][:order] <=> TYPES[relation.relation_type][:order] end - + private - + # Reverses the relation if needed so that it gets stored in the proper way def reverse_if_needed if TYPES.has_key?(relation_type) && TYPES[relation_type][:reverse] diff --git a/app/models/issue_status.rb b/app/models/issue_status.rb index 78ad7b7e..3f38e7f9 100644 --- a/app/models/issue_status.rb +++ b/app/models/issue_status.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 IssueStatus < ActiveRecord::Base - before_destroy :check_integrity + before_destroy :check_integrity has_many :workflows, :foreign_key => "old_status_id" acts_as_list - + before_destroy :delete_workflows validates_presence_of :name @@ -25,13 +25,13 @@ class IssueStatus < ActiveRecord::Base def after_save IssueStatus.update_all("is_default=#{connection.quoted_false}", ['id <> ?', id]) if self.is_default? - end - + end + # Returns the default status for new issues def self.default find(:first, :conditions =>["is_default=?", true]) end - + # Update all the +Issues+ setting their done_ratio to the value of their +IssueStatus+ def self.update_issue_done_ratios if Issue.use_status_for_done_ratio? @@ -51,7 +51,7 @@ class IssueStatus < ActiveRecord::Base role_ids = roles.collect(&:id) transitions = workflows.select do |w| role_ids.include?(w.role_id) && - w.tracker_id == tracker.id && + w.tracker_id == tracker.id && (author || !w.author) && (assignee || !w.assignee) end @@ -60,7 +60,7 @@ class IssueStatus < ActiveRecord::Base [] end end - + # Same thing as above but uses a database query # More efficient than the previous method if called just once def find_new_statuses_allowed_to(roles, tracker, author=false, assignee=false) @@ -68,7 +68,7 @@ class IssueStatus < ActiveRecord::Base conditions = {:role_id => roles.collect(&:id), :tracker_id => tracker.id} conditions[:author] = false unless author conditions[:assignee] = false unless assignee - + workflows.find(:all, :include => :new_status, :conditions => conditions).collect{|w| w.new_status}.compact.sort @@ -80,14 +80,14 @@ class IssueStatus < ActiveRecord::Base def <=>(status) position <=> status.position end - + def to_s; name end private def check_integrity raise "Can't delete status" if Issue.find(:first, :conditions => ["status_id=?", self.id]) end - + # Deletes associated workflows def delete_workflows Workflow.delete_all(["old_status_id = :id OR new_status_id = :id", {:id => id}]) diff --git a/app/models/journal.rb b/app/models/journal.rb index 37372b32..dec83889 100644 --- a/app/models/journal.rb +++ b/app/models/journal.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. #++ @@ -79,7 +79,7 @@ class Journal < ActiveRecord::Base def old_value_for(prop) details[prop.to_s].first if details.keys.include? prop.to_s end - + # Returns a string of css classes def css_classes s = 'journal' diff --git a/app/models/journal_observer.rb b/app/models/journal_observer.rb index 443e5fc8..64fb8fe1 100644 --- a/app/models/journal_observer.rb +++ b/app/models/journal_observer.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,7 +35,7 @@ class JournalObserver < ActiveRecord::Observer return true if @send_notification.nil? return @send_notification end - + private # Need to clear the notification setting after each usage otherwise it might be cached diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index f5999611..c66b48d3 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.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,25 +17,25 @@ class MailHandler < ActionMailer::Base class UnauthorizedAction < StandardError; end class MissingInformation < StandardError; end - + attr_reader :email, :user def self.receive(email, options={}) @@handler_options = options.dup - + @@handler_options[:issue] ||= {} - + @@handler_options[:allow_override] = @@handler_options[:allow_override].split(',').collect(&:strip) if @@handler_options[:allow_override].is_a?(String) @@handler_options[:allow_override] ||= [] # Project needs to be overridable if not specified @@handler_options[:allow_override] << 'project' unless @@handler_options[:issue].has_key?(:project) # Status overridable by default - @@handler_options[:allow_override] << 'status' unless @@handler_options[:issue].has_key?(:status) - + @@handler_options[:allow_override] << 'status' unless @@handler_options[:issue].has_key?(:status) + @@handler_options[:no_permission_check] = (@@handler_options[:no_permission_check].to_s == '1' ? true : false) super email end - + # Processes incoming emails # Returns the created object (eg. an issue, a message) or false def receive(email) @@ -74,13 +74,13 @@ class MailHandler < ActionMailer::Base User.current = @user dispatch end - + private MESSAGE_ID_RE = %r{^ custom_field_values_from_keywords(issue)} issue.init_journal(user, cleaned_up_text_body) @@ -163,7 +163,7 @@ class MailHandler < ActionMailer::Base logger.info "MailHandler: issue ##{issue.id} updated by #{user}" if logger && logger.info issue.last_journal end - + # Reply will be added to the issue def receive_journal_reply(journal_id) journal = Journal.find_by_id(journal_id) @@ -171,17 +171,17 @@ class MailHandler < ActionMailer::Base receive_issue_reply(journal.journaled_id) end end - + # Receives a reply to a forum message def receive_message_reply(message_id) message = Message.find_by_id(message_id) if message message = message.root - + unless @@handler_options[:no_permission_check] raise UnauthorizedAction unless user.allowed_to?(:add_messages, message.project) end - + if !message.locked? reply = Message.new(:subject => email.subject.gsub(%r{^.*msg\d+\]}, '').strip, :content => cleaned_up_text_body) @@ -195,7 +195,7 @@ class MailHandler < ActionMailer::Base end end end - + def add_attachments(obj) if email.has_attachments? email.attachments.each do |attachment| @@ -206,7 +206,7 @@ class MailHandler < ActionMailer::Base end end end - + # Adds To and Cc as watchers of the given object if the sender has the # appropriate permission def add_watchers(obj) @@ -218,7 +218,7 @@ class MailHandler < ActionMailer::Base end end end - + def get_keyword(attr, options={}) @keywords ||= {} if @keywords.has_key?(attr) @@ -233,7 +233,7 @@ class MailHandler < ActionMailer::Base end end end - + # Destructively extracts the value for +attr+ in +text+ # Returns nil if no matching keyword found def extract_keyword!(text, attr, format=nil) @@ -257,12 +257,12 @@ class MailHandler < ActionMailer::Base raise MissingInformation.new('Unable to determine target project') if target.nil? target end - + # Returns a Hash of issue attributes extracted from keywords in the email body def issue_attributes_from_keywords(issue) assigned_to = (k = get_keyword(:assigned_to, :override => true)) && find_user_from_keyword(k) assigned_to = nil if assigned_to && !issue.assignable_users.include?(assigned_to) - + attrs = { 'tracker_id' => (k = get_keyword(:tracker)) && issue.project.trackers.find_by_name(k).try(:id), 'status_id' => (k = get_keyword(:status)) && IssueStatus.find_by_name(k).try(:id), @@ -275,16 +275,16 @@ class MailHandler < ActionMailer::Base 'estimated_hours' => get_keyword(:estimated_hours, :override => true), 'done_ratio' => get_keyword(:done_ratio, :override => true, :format => '(\d|10)?0') }.delete_if {|k, v| v.blank? } - + if issue.new_record? && attrs['tracker_id'].nil? attrs['tracker_id'] = issue.project.trackers.find(:first).try(:id) end - + attrs end - + # Returns a Hash of issue custom field values extracted from keywords in the email body - def custom_field_values_from_keywords(customized) + def custom_field_values_from_keywords(customized) customized.custom_field_values.inject({}) do |h, v| if value = get_keyword(v.custom_field.name, :override => true) h[v.custom_field.id.to_s] = value @@ -292,7 +292,7 @@ class MailHandler < ActionMailer::Base h end end - + # Returns the text/plain part of the email # If not found (eg. HTML-only email), returns the body with tags removed def plain_text_body @@ -313,7 +313,7 @@ class MailHandler < ActionMailer::Base @plain_text_body.strip! @plain_text_body end - + def cleaned_up_text_body cleanup_body(plain_text_body) end @@ -321,19 +321,19 @@ class MailHandler < ActionMailer::Base def self.full_sanitizer @full_sanitizer ||= HTML::FullSanitizer.new end - + # Creates a user account for the +email+ sender def self.create_user_from_email(email) addr = email.from_addrs.to_a.first if addr && !addr.spec.blank? user = User.new user.mail = addr.spec - + names = addr.name.blank? ? addr.spec.gsub(/@.*$/, '').split('.') : addr.name.split user.firstname = names.shift user.lastname = names.join(' ') user.lastname = '-' if user.lastname.blank? - + user.login = user.mail user.password = ActiveSupport::SecureRandom.hex(5) user.language = Setting.default_language @@ -342,7 +342,7 @@ class MailHandler < ActionMailer::Base end private - + # Removes the email body of text after the truncation configurations. def cleanup_body(body) delimiters = Setting.mail_handler_body_delimiters.to_s.split(/[\r\n]+/).reject(&:blank?).map {|s| Regexp.escape(s)} diff --git a/app/models/mailer.rb b/app/models/mailer.rb index ee8c5a9d..1962ae14 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.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. #++ @@ -28,7 +28,7 @@ class Mailer < ActionMailer::Base h = h.to_s.gsub(%r{\/.*$}, '') unless Redmine::Utils.relative_url_root.blank? { :host => h, :protocol => Setting.protocol } end - + # Builds a tmail object used to email recipients of the added issue. # # Example: @@ -135,7 +135,7 @@ class Mailer < ActionMailer::Base :added_to_url => added_to_url render_multipart('attachments_added', body) end - + # Builds a tmail object used to email recipients of a news' project when a news item is added. # # Example: @@ -151,7 +151,7 @@ class Mailer < ActionMailer::Base :news_url => url_for(:controller => 'news', :action => 'show', :id => news) render_multipart('news_added', body) end - + # Builds a tmail object used to email recipients of a news' project when a news comment is added. # # Example: @@ -170,7 +170,7 @@ class Mailer < ActionMailer::Base render_multipart('news_comment_added', body) end - # Builds a tmail object used to email the recipients of the specified message that was posted. + # Builds a tmail object used to email the recipients of the specified message that was posted. # # Example: # message_posted(message) => tmail object @@ -188,8 +188,8 @@ class Mailer < ActionMailer::Base :message_url => url_for(message.last_journal.event_url) render_multipart('message_posted', body) end - - # Builds a tmail object used to email the recipients of a project of the specified wiki content was added. + + # Builds a tmail object used to email the recipients of a project of the specified wiki content was added. # # Example: # wiki_content_added(wiki_content) => tmail object @@ -206,8 +206,8 @@ class Mailer < ActionMailer::Base :wiki_content_url => url_for(:controller => 'wiki', :action => 'show', :project_id => wiki_content.project, :id => wiki_content.page.title) render_multipart('wiki_content_added', body) end - - # Builds a tmail object used to email the recipients of a project of the specified wiki content was updated. + + # Builds a tmail object used to email the recipients of a project of the specified wiki content was updated. # # Example: # wiki_content_updated(wiki_content) => tmail object @@ -308,7 +308,7 @@ class Mailer < ActionMailer::Base return false if (recipients.nil? || recipients.empty?) && (cc.nil? || cc.empty?) && (bcc.nil? || bcc.empty?) - + # Set Message-Id and References if @message_id_object mail.message_id = self.class.message_id_for(@message_id_object) @@ -316,7 +316,7 @@ class Mailer < ActionMailer::Base if @references_objects mail.references = @references_objects.collect {|o| self.class.message_id_for(o)} end - + # Log errors when raise_delivery_errors is set to false, Rails does not raise_errors = self.class.raise_delivery_errors self.class.raise_delivery_errors = true @@ -359,7 +359,7 @@ class Mailer < ActionMailer::Base deliver_reminder(assignee, issues, days) if assignee && assignee.active? end end - + # Activates/desactivates email deliveries during +block+ def self.with_deliveries(enabled = true, &block) was_enabled = ActionMailer::Base.perform_deliveries @@ -375,7 +375,7 @@ class Mailer < ActionMailer::Base @initial_language = current_language set_language_if_valid Setting.default_language from Setting.mail_from - + # Common headers headers 'X-Mailer' => 'ChiliProject', 'X-ChiliProject-Host' => Setting.host_name, @@ -398,11 +398,11 @@ class Mailer < ActionMailer::Base recipients.delete(@author.mail) if recipients cc.delete(@author.mail) if cc end - + notified_users = [recipients, cc].flatten.compact.uniq # Rails would log recipients only, not cc and bcc mylogger.info "Sending email notification to: #{notified_users.join(', ')}" if mylogger - + # Blind carbon copy recipients if Setting.bcc_recipients? bcc(notified_users) @@ -418,7 +418,7 @@ class Mailer < ActionMailer::Base # # https://rails.lighthouseapp.com/projects/8994/tickets/2338-actionmailer-mailer-views-and-content-type # https://rails.lighthouseapp.com/projects/8994/tickets/1799-actionmailer-doesnt-set-template_format-when-rendering-layouts - + def render_multipart(method_name, body) if Setting.plain_text_mail? content_type "text/plain" @@ -434,29 +434,29 @@ class Mailer < ActionMailer::Base def self.controller_path '' end unless respond_to?('controller_path') - + # Returns a predictable Message-Id for the given object def self.message_id_for(object) # id + timestamp should reduce the odds of a collision # as far as we don't send multiple emails for the same object - timestamp = object.send(object.respond_to?(:created_on) ? :created_on : :updated_on) + timestamp = object.send(object.respond_to?(:created_on) ? :created_on : :updated_on) hash = "chiliproject.#{object.class.name.demodulize.underscore}-#{object.id}.#{timestamp.strftime("%Y%m%d%H%M%S")}" host = Setting.mail_from.to_s.gsub(%r{^.*@}, '') host = "#{::Socket.gethostname}.chiliproject" if host.empty? "<#{hash}@#{host}>" end - + private - + def message_id(object) @message_id_object = object end - + def references(object) @references_objects ||= [] @references_objects << object end - + def mylogger RAILS_DEFAULT_LOGGER end diff --git a/app/models/member.rb b/app/models/member.rb index bbfae6cd..fbd950d3 100644 --- a/app/models/member.rb +++ b/app/models/member.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,17 +22,17 @@ class Member < ActiveRecord::Base validates_uniqueness_of :user_id, :scope => :project_id after_destroy :unwatch_from_permission_change - + def name self.user.name end - + alias :base_role_ids= :role_ids= def role_ids=(arg) ids = (arg || []).collect(&:to_i) - [0] # Keep inherited roles ids += member_roles.select {|mr| !mr.inherited_from.nil?}.collect(&:role_id) - + new_role_ids = ids - role_ids # Add new roles new_role_ids.each {|id| member_roles << MemberRole.new(:role_id => id) } @@ -43,16 +43,16 @@ class Member < ActiveRecord::Base unwatch_from_permission_change end end - + def <=>(member) a, b = roles.sort.first, member.roles.sort.first a == b ? (principal <=> member.principal) : (a <=> b) end - + def deletable? member_roles.detect {|mr| mr.inherited_from}.nil? end - + def include?(user) if principal.is_a?(Group) !user.nil? && user.groups.include?(principal) @@ -60,7 +60,7 @@ class Member < ActiveRecord::Base self.user == user end end - + def before_destroy if user # remove category based auto assignments for this member @@ -74,15 +74,15 @@ class Member < ActiveRecord::Base @membership.attributes = new_attributes @membership end - + protected - + def validate errors.add_on_empty :role if member_roles.empty? && roles.empty? end - + private - + # Unwatch things that the user is no longer allowed to view inside project def unwatch_from_permission_change if user diff --git a/app/models/member_role.rb b/app/models/member_role.rb index c3718acb..4f2c41f2 100644 --- a/app/models/member_role.rb +++ b/app/models/member_role.rb @@ -1,43 +1,43 @@ #-- 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 MemberRole < ActiveRecord::Base belongs_to :member belongs_to :role - + after_destroy :remove_member_if_empty after_create :add_role_to_group_users after_destroy :remove_role_from_group_users - + validates_presence_of :role - + def validate errors.add :role_id, :invalid if role && !role.member? end - + def inherited? !inherited_from.nil? end - + private - + def remove_member_if_empty if member.roles.empty? member.destroy end end - + def add_role_to_group_users if member.principal.is_a?(Group) member.principal.users.each do |user| @@ -47,7 +47,7 @@ class MemberRole < ActiveRecord::Base end end end - + def remove_role_from_group_users MemberRole.find(:all, :conditions => { :inherited_from => id }).group_by(&:member).each do |member, member_roles| member_roles.each(&:destroy) diff --git a/app/models/message.rb b/app/models/message.rb index 1ceb1b23..498682f0 100644 --- a/app/models/message.rb +++ b/app/models/message.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,7 +17,7 @@ class Message < ActiveRecord::Base acts_as_tree :counter_cache => :replies_count, :order => "#{Message.table_name}.created_on ASC" acts_as_attachable belongs_to :last_reply, :class_name => 'Message', :foreign_key => 'last_reply_id' - + acts_as_journalized :event_title => Proc.new {|o| "#{o.board.name}: #{o.subject}"}, :event_description => :content, :event_type => Proc.new {|o| o.parent_id.nil? ? 'message' : 'reply'}, @@ -37,32 +37,32 @@ class Message < ActiveRecord::Base :date_column => "#{table_name}.created_on" acts_as_watchable - + attr_protected :locked, :sticky validates_presence_of :board, :subject, :content validates_length_of :subject, :maximum => 255 - + after_create :add_author_as_watcher - + named_scope :visible, lambda {|*args| { :include => {:board => :project}, :conditions => Project.allowed_to_condition(args.first || User.current, :view_messages) } } - + def visible?(user=User.current) !user.nil? && user.allowed_to?(:view_messages, project) end - + def validate_on_create # Can not reply to a locked topic errors.add_to_base 'Topic is locked' if root.locked? && self != root end - + def after_create if parent parent.reload.update_attribute(:last_reply_id, self.id) end board.reset_counters! end - + def after_update if board_id_changed? Message.update_all("board_id = #{board_id}", ["id = ? OR parent_id = ?", root.id, root.id]) @@ -70,19 +70,19 @@ class Message < ActiveRecord::Base Board.reset_counters!(board_id) end end - + def after_destroy board.reset_counters! end - + def sticky=(arg) write_attribute :sticky, (arg == true || arg.to_s == '1' ? 1 : 0) end - + def sticky? sticky == 1 end - + def project board.project end @@ -94,9 +94,9 @@ class Message < ActiveRecord::Base def destroyable_by?(usr) usr && usr.logged? && (usr.allowed_to?(:delete_messages, project) || (self.author == usr && usr.allowed_to?(:delete_own_messages, project))) end - + private - + def add_author_as_watcher Watcher.create(:watchable => self.root, :user => author) end diff --git a/app/models/message_observer.rb b/app/models/message_observer.rb index 70f161f9..be7c4968 100644 --- a/app/models/message_observer.rb +++ b/app/models/message_observer.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/models/news.rb b/app/models/news.rb index 0c2a5c9b..59786c96 100644 --- a/app/models/news.rb +++ b/app/models/news.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 News < ActiveRecord::Base belongs_to :project belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' has_many :comments, :as => :commented, :dependent => :delete_all, :order => "created_on" - + validates_presence_of :title, :description validates_length_of :title, :maximum => 60 validates_length_of :summary, :maximum => 255 @@ -23,25 +23,25 @@ class News < ActiveRecord::Base acts_as_journalized :event_url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.journaled_id} } acts_as_searchable :columns => ["#{table_name}.title", "#{table_name}.summary", "#{table_name}.description"], :include => :project acts_as_watchable - + after_create :add_author_as_watcher - - named_scope :visible, lambda {|*args| { + + named_scope :visible, lambda {|*args| { :include => :project, - :conditions => Project.allowed_to_condition(args.first || User.current, :view_news) + :conditions => Project.allowed_to_condition(args.first || User.current, :view_news) }} - + def visible?(user=User.current) !user.nil? && user.allowed_to?(:view_news, project) end - + # returns latest news for projects visible by user def self.latest(user = User.current, count = 5) - find(:all, :limit => count, :conditions => Project.allowed_to_condition(user, :view_news), :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") + find(:all, :limit => count, :conditions => Project.allowed_to_condition(user, :view_news), :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC") end - + private - + def add_author_as_watcher Watcher.create(:watchable => self, :user => author) end diff --git a/app/models/news_observer.rb b/app/models/news_observer.rb index 15998353..ce9f7b99 100644 --- a/app/models/news_observer.rb +++ b/app/models/news_observer.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/models/principal.rb b/app/models/principal.rb index 8c75ea7e..cf20e199 100644 --- a/app/models/principal.rb +++ b/app/models/principal.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,14 +20,14 @@ class Principal < ActiveRecord::Base # Groups and active users named_scope :active, :conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status = 1)" - - named_scope :like, lambda {|q| + + named_scope :like, lambda {|q| s = "%#{q.to_s.strip.downcase}%" {:conditions => ["LOWER(login) LIKE :s OR LOWER(firstname) LIKE :s OR LOWER(lastname) LIKE :s OR LOWER(mail) LIKE :s", {:s => s}], :order => 'type, login, lastname, firstname, mail' } } - + before_create :set_default_empty_values def name(formatter = nil) @@ -42,9 +42,9 @@ class Principal < ActiveRecord::Base principal.class.name <=> self.class.name end end - + protected - + # Make sure we don't try to insert NULL values (see #4632) def set_default_empty_values self.login ||= '' diff --git a/app/models/project.rb b/app/models/project.rb index 5f5bca00..7c3ca1aa 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1,36 +1,36 @@ #-- 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 Project < ActiveRecord::Base include Redmine::SafeAttributes - + # Project statuses STATUS_ACTIVE = 1 STATUS_ARCHIVED = 9 - + # Maximum length for project identifiers IDENTIFIER_MAX_LENGTH = 100 - + # Specific overidden Activities has_many :time_entry_activities has_many :members, :include => [:user, :roles], :conditions => "#{User.table_name}.type='User' AND #{User.table_name}.status=#{User::STATUS_ACTIVE}" has_many :memberships, :class_name => 'Member' - has_many :member_principals, :class_name => 'Member', + has_many :member_principals, :class_name => 'Member', :include => :principal, :conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{User::STATUS_ACTIVE})" has_many :users, :through => :members has_many :principals, :through => :member_principals, :source => :principal - + has_many :enabled_modules, :dependent => :delete_all has_and_belongs_to_many :trackers, :order => "#{Tracker.table_name}.position" has_many :issues, :dependent => :destroy, :order => "#{Issue.table_name}.created_on DESC", :include => [:status, :tracker] @@ -46,12 +46,12 @@ class Project < ActiveRecord::Base has_many :changesets, :through => :repository has_one :wiki, :dependent => :destroy # Custom field for the project issues - has_and_belongs_to_many :issue_custom_fields, + has_and_belongs_to_many :issue_custom_fields, :class_name => 'IssueCustomField', :order => "#{CustomField.table_name}.position", :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}", :association_foreign_key => 'custom_field_id' - + acts_as_nested_set :order => 'name', :dependent => :destroy acts_as_attachable :view_permission => :view_files, :delete_permission => :manage_files @@ -63,7 +63,7 @@ class Project < ActiveRecord::Base :author => nil attr_protected :status - + validates_presence_of :name, :identifier validates_uniqueness_of :identifier validates_associated :repository, :wiki @@ -81,12 +81,12 @@ class Project < ActiveRecord::Base named_scope :active, { :conditions => "#{Project.table_name}.status = #{STATUS_ACTIVE}"} named_scope :all_public, { :conditions => { :is_public => true } } named_scope :visible, lambda { { :conditions => Project.visible_by(User.current) } } - + def initialize(attributes = nil) super - + initialized = (attributes || {}).stringify_keys - if !initialized.key?('identifier') && Setting.sequential_project_identifiers? + if !initialized.key?('identifier') && Setting.sequential_project_identifiers? self.identifier = Project.next_identifier end if !initialized.key?('is_public') @@ -99,11 +99,11 @@ class Project < ActiveRecord::Base self.trackers = Tracker.all end end - + def identifier=(identifier) super unless identifier_frozen? end - + def identifier_frozen? errors[:identifier].nil? && !(new_record? || identifier.blank?) end @@ -111,8 +111,8 @@ class Project < ActiveRecord::Base # returns latest created projects # non public projects will be returned only if user is a member of those def self.latest(user=nil, count=5) - find(:all, :limit => count, :conditions => visible_by(user), :order => "created_on DESC") - end + find(:all, :limit => count, :conditions => visible_by(user), :order => "created_on DESC") + end # Returns a SQL :conditions string used to find all active projects for the specified user. # @@ -129,7 +129,7 @@ class Project < ActiveRecord::Base return "#{Project.table_name}.status=#{Project::STATUS_ACTIVE} AND #{Project.table_name}.is_public = #{connection.quoted_true}" end end - + def self.allowed_to_condition(user, permission, options={}) base_statement = "#{Project.table_name}.status=#{Project::STATUS_ACTIVE}" if perm = Redmine::AccessControl.permission(permission) @@ -143,7 +143,7 @@ class Project < ActiveRecord::Base project_statement << " OR (#{Project.table_name}.lft > #{options[:project].lft} AND #{Project.table_name}.rgt < #{options[:project].rgt})" if options[:with_subprojects] base_statement = "(#{project_statement}) AND (#{base_statement})" end - + if user.admin? base_statement else @@ -160,7 +160,7 @@ class Project < ActiveRecord::Base else if Role.anonymous.allowed_to?(permission) && !options[:member] statement_by_role[Role.anonymous] = "#{Project.table_name}.is_public = #{connection.quoted_true}" - end + end end if statement_by_role.empty? "1=0" @@ -191,14 +191,14 @@ class Project < ActiveRecord::Base activity.update_attributes(activity_hash) if activity end end - + # Create a new TimeEntryActivity if it overrides a system TimeEntryActivity # # This will raise a ActiveRecord::Rollback if the TimeEntryActivity # does not successfully save. def create_time_entry_activity_if_needed(activity) if activity['parent_id'] - + parent_activity = TimeEntryActivity.find(activity['parent_id']) activity['name'] = parent_activity.name activity['position'] = parent_activity.position @@ -225,7 +225,7 @@ class Project < ActiveRecord::Base cond = "(#{cond} OR (#{Project.table_name}.lft > #{lft} AND #{Project.table_name}.rgt < #{rgt}))" if with_subprojects cond end - + def self.find(*args) if args.first && args.first.is_a?(String) && !args.first.match(/^\d*$/) project = find_by_identifier(*args) @@ -235,20 +235,20 @@ class Project < ActiveRecord::Base super end end - + def to_param # id is used for projects with a numeric identifier (compatibility) @to_param ||= (identifier.to_s =~ %r{^\d*$} ? id : identifier) end - + def active? self.status == STATUS_ACTIVE end - + def archived? self.status == STATUS_ARCHIVED end - + # Archives the project and its descendants def archive # Check that there is no issue of a non descendant project that is assigned @@ -264,14 +264,14 @@ class Project < ActiveRecord::Base end true end - + # Unarchives the project # All its ancestors must be active def unarchive return false if ancestors.detect {|a| !a.active?} update_attribute :status, STATUS_ACTIVE end - + # Returns an array of projects the project can be moved to # by the current user def allowed_parents @@ -286,7 +286,7 @@ class Project < ActiveRecord::Base end @allowed_parents end - + # Sets the parent of the project with authorization check def set_allowed_parent!(p) unless p.nil? || p.is_a?(Project) @@ -306,7 +306,7 @@ class Project < ActiveRecord::Base end set_parent!(p) end - + # Sets the parent of the project # Argument can be either a Project, a String, a Fixnum or nil def set_parent!(p) @@ -345,7 +345,7 @@ class Project < ActiveRecord::Base false end end - + # Returns an array of the trackers used by the project and its active sub projects def rolled_up_trackers @rolled_up_trackers ||= @@ -354,7 +354,7 @@ class Project < ActiveRecord::Base :conditions => ["#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ? AND #{Project.table_name}.status = #{STATUS_ACTIVE}", lft, rgt], :order => "#{Tracker.table_name}.position") end - + # Closes open and locked project versions that are completed def close_completed_versions Version.transaction do @@ -372,7 +372,7 @@ class Project < ActiveRecord::Base Version.scoped(:include => :project, :conditions => ["#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ? AND #{Project.table_name}.status = #{STATUS_ACTIVE}", lft, rgt]) end - + # Returns a scope of the Versions used by the project def shared_versions @shared_versions ||= begin @@ -398,48 +398,48 @@ class Project < ActiveRecord::Base h end end - + # Deletes all project's members def delete_all_members me, mr = Member.table_name, MemberRole.table_name connection.delete("DELETE FROM #{mr} WHERE #{mr}.member_id IN (SELECT #{me}.id FROM #{me} WHERE #{me}.project_id = #{id})") Member.delete_all(['project_id = ?', id]) end - + # Users issues can be assigned to def assignable_users members.select {|m| m.roles.detect {|role| role.assignable?}}.collect {|m| m.user}.sort end - + # Returns the mail adresses of users that should be always notified on project events def recipients notified_users.collect {|user| user.mail} end - + # Returns the users that should be notified on project events def notified_users # TODO: User part should be extracted to User#notify_about? members.select {|m| m.mail_notification? || m.user.mail_notification == 'all'}.collect {|m| m.user} end - + # Returns an array of all custom fields enabled for project issues # (explictly associated custom fields and custom fields enabled for all projects) def all_issue_custom_fields @all_issue_custom_fields ||= (IssueCustomField.for_all + issue_custom_fields).uniq.sort end - + def project self end - + def <=>(project) name.downcase <=> project.name.downcase end - + def to_s name end - + # Returns a short description of the projects (first lines) def short_description(length = 255) description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description @@ -492,7 +492,7 @@ class Project < ActiveRecord::Base end end end - + # Return true if this project is allowed to do the specified action. # action can be: # * a parameter-like Hash (eg. :controller => 'projects', :action => 'edit') @@ -504,12 +504,12 @@ class Project < ActiveRecord::Base allowed_permissions.include? action end end - + def module_enabled?(module_name) module_name = module_name.to_s enabled_modules.detect {|m| m.name == module_name} end - + def enabled_module_names=(module_names) if module_names && module_names.is_a?(Array) module_names = module_names.collect(&:to_s).reject(&:blank?) @@ -518,12 +518,12 @@ class Project < ActiveRecord::Base enabled_modules.clear end end - + # Returns an array of the enabled modules names def enabled_module_names enabled_modules.collect(&:name) end - + safe_attributes 'name', 'description', 'homepage', @@ -536,7 +536,7 @@ class Project < ActiveRecord::Base safe_attributes 'enabled_module_names', :if => lambda {|project, user| project.new_record? || user.allowed_to?(:select_project_modules, project) } - + # Returns an array of projects that are in this project's hierarchy # # Example: parents, children, siblings @@ -545,7 +545,7 @@ class Project < ActiveRecord::Base descendants = project.descendants || [] project_hierarchy = parents | descendants # Set union end - + # Returns an auto-generated project identifier based on the last identifier used def self.next_identifier p = Project.find(:first, :order => 'created_on DESC') @@ -569,10 +569,10 @@ class Project < ActiveRecord::Base # project.copy(1, :only => ['members', 'versions']) # => copies members and versions def copy(project, options={}) project = project.is_a?(Project) ? project : Project.find(project) - + to_be_copied = %w(wiki versions issue_categories issues members queries boards) to_be_copied = to_be_copied & options[:only].to_a unless options[:only].nil? - + Project.transaction do if save reload @@ -585,7 +585,7 @@ class Project < ActiveRecord::Base end end - + # Copies +project+ and returns the new instance. This will not save # the copy def self.copy_from(project) @@ -612,16 +612,16 @@ class Project < ActiveRecord::Base def self.project_tree(projects, &block) ancestors = [] projects.sort_by(&:lft).each do |project| - while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) + while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) ancestors.pop end yield project, ancestors.size ancestors << project end end - + private - + # Copies wiki from +project+ def copy_wiki(project) # Check that the source project has a wiki first @@ -666,13 +666,13 @@ class Project < ActiveRecord::Base self.issue_categories << new_issue_category end end - + # Copies issues from +project+ def copy_issues(project) # Stores the source issue id as a key and the copied issues as the # value. Used to map the two togeather for issue relations. issues_map = {} - + # Get issues sorted by root_id, lft so that parent issues # get copied before their children project.issues.find(:all, :order => 'root_id, lft').each do |issue| @@ -695,7 +695,7 @@ class Project < ActiveRecord::Base new_issue.parent_issue_id = copied_parent.id end end - + self.issues << new_issue if new_issue.new_record? logger.info "Project#copy_issues: issue ##{issue.id} could not be copied: #{new_issue.errors.full_messages}" if logger && logger.info @@ -711,7 +711,7 @@ class Project < ActiveRecord::Base # Issue was not copied next end - + # Relations issue.relations_from.each do |source_relation| new_issue_relation = IssueRelation.new @@ -722,7 +722,7 @@ class Project < ActiveRecord::Base end new_issue.relations_from << new_issue_relation end - + issue.relations_to.each do |source_relation| new_issue_relation = IssueRelation.new new_issue_relation.attributes = source_relation.attributes.dup.except("id", "issue_from_id", "issue_to_id") @@ -741,7 +741,7 @@ class Project < ActiveRecord::Base members_to_copy = [] members_to_copy += project.memberships.select {|m| m.principal.is_a?(User)} members_to_copy += project.memberships.select {|m| !m.principal.is_a?(User)} - + members_to_copy.each do |member| new_member = Member.new new_member.attributes = member.attributes.dup.except("id", "project_id", "created_on") @@ -775,7 +775,7 @@ class Project < ActiveRecord::Base self.boards << new_board end end - + def allowed_permissions @allowed_permissions ||= begin module_names = enabled_modules.all(:select => :name).collect {|m| m.name} @@ -790,7 +790,7 @@ class Project < ActiveRecord::Base # Returns all the active Systemwide and project specific activities def active_activities overridden_activity_ids = self.time_entry_activities.collect(&:parent_id) - + if overridden_activity_ids.empty? return TimeEntryActivity.shared.active else @@ -824,7 +824,7 @@ class Project < ActiveRecord::Base self.time_entry_activities.active end end - + # Archives subprojects recursively def archive! children.each do |subproject| diff --git a/app/models/project_custom_field.rb b/app/models/project_custom_field.rb index dba042e3..8e7765fd 100644 --- a/app/models/project_custom_field.rb +++ b/app/models/project_custom_field.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/models/query.rb b/app/models/query.rb index c1e8bc67..e2ffd95d 100644 --- a/app/models/query.rb +++ b/app/models/query.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 QueryColumn +class QueryColumn attr_accessor :name, :sortable, :groupable, :default_order include Redmine::I18n - + def initialize(name, options={}) self.name = name self.sortable = options[:sortable] @@ -25,16 +25,16 @@ class QueryColumn self.default_order = options[:default_order] @caption_key = options[:caption] || "field_#{name}" end - + def caption l(@caption_key) end - + # Returns true if the column is sortable, otherwise false def sortable? !sortable.nil? end - + def value(issue) issue.send name end @@ -51,15 +51,15 @@ class QueryCustomFieldColumn < QueryColumn self.groupable ||= false @cf = custom_field end - + def caption @cf.name end - + def custom_field @cf end - + def value(issue) cv = issue.custom_values.detect {|v| v.custom_field_id == @cf.id} cv && @cf.cast_value(cv.value) @@ -69,19 +69,19 @@ end class Query < ActiveRecord::Base class StatementInvalid < ::ActiveRecord::StatementInvalid end - + belongs_to :project belongs_to :user serialize :filters serialize :column_names serialize :sort_criteria, Array - + attr_protected :project_id, :user_id - + validates_presence_of :name, :on => :save validates_length_of :name, :maximum => 255 - - @@operators = { "=" => :label_equals, + + @@operators = { "=" => :label_equals, "!" => :label_not_equals, "o" => :label_open_issues, "c" => :label_closed_issues, @@ -101,7 +101,7 @@ class Query < ActiveRecord::Base "!~" => :label_not_contains } cattr_reader :operators - + @@operators_by_filter_type = { :list => [ "=", "!" ], :list_status => [ "o", "=", "!", "c", "*" ], :list_optional => [ "=", "!", "!*", "*" ], @@ -133,27 +133,27 @@ class Query < ActiveRecord::Base QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on", :default_order => 'desc'), ] cattr_reader :available_columns - + def initialize(attributes = nil) super attributes self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} } end - + def after_initialize # Store the fact that project is nil (used in #editable_by?) @is_for_all = project.nil? end - + def validate filters.each_key do |field| - errors.add label_for(field), :blank unless + errors.add label_for(field), :blank unless # filter requires one or more values - (values_for(field) and !values_for(field).first.blank?) or + (values_for(field) and !values_for(field).first.blank?) or # filter doesn't require any value ["o", "c", "!*", "*", "t", "w"].include? operator_for(field) end if filters end - + def editable_by?(user) return false unless user # Admin can edit them all and regular users can edit their private queries @@ -161,23 +161,23 @@ class Query < ActiveRecord::Base # Members can not edit public queries that are for all project (only admin is allowed to) is_public && !@is_for_all && user.allowed_to?(:manage_public_queries, project) end - + def available_filters return @available_filters if @available_filters - + trackers = project.nil? ? Tracker.find(:all, :order => 'position') : project.rolled_up_trackers - - @available_filters = { "status_id" => { :type => :list_status, :order => 1, :values => IssueStatus.find(:all, :order => 'position').collect{|s| [s.name, s.id.to_s] } }, - "tracker_id" => { :type => :list, :order => 2, :values => trackers.collect{|s| [s.name, s.id.to_s] } }, + + @available_filters = { "status_id" => { :type => :list_status, :order => 1, :values => IssueStatus.find(:all, :order => 'position').collect{|s| [s.name, s.id.to_s] } }, + "tracker_id" => { :type => :list, :order => 2, :values => trackers.collect{|s| [s.name, s.id.to_s] } }, "priority_id" => { :type => :list, :order => 3, :values => IssuePriority.all.collect{|s| [s.name, s.id.to_s] } }, - "subject" => { :type => :text, :order => 8 }, - "created_on" => { :type => :date_past, :order => 9 }, + "subject" => { :type => :text, :order => 8 }, + "created_on" => { :type => :date_past, :order => 9 }, "updated_on" => { :type => :date_past, :order => 10 }, "start_date" => { :type => :date, :order => 11 }, "due_date" => { :type => :date, :order => 12 }, "estimated_hours" => { :type => :integer, :order => 13 }, "done_ratio" => { :type => :integer, :order => 14 }} - + user_values = [] user_values << ["<< #{l(:label_me)} >>", "me"] if User.current.logged? if project @@ -187,7 +187,7 @@ class Query < ActiveRecord::Base if all_projects.any? # members of visible projects user_values += User.active.find(:all, :conditions => ["#{User.table_name}.id IN (SELECT DISTINCT user_id FROM members WHERE project_id IN (?))", all_projects.collect(&:id)]).sort.collect{|s| [s.name, s.id.to_s] } - + # project filter project_values = [] Project.project_tree(all_projects) do |p, level| @@ -205,11 +205,11 @@ class Query < ActiveRecord::Base role_values = Role.givable.collect {|r| [r.name, r.id.to_s] } @available_filters["assigned_to_role"] = { :type => :list_optional, :order => 7, :values => role_values } unless role_values.empty? - + if User.current.logged? @available_filters["watcher_id"] = { :type => :list, :order => 15, :values => [["<< #{l(:label_me)} >>", "me"]] } end - + if project # project specific filters categories = @project.issue_categories.all @@ -237,7 +237,7 @@ class Query < ActiveRecord::Base end @available_filters end - + def add_filter(field, operator, values) # values must be an array return unless values and values.is_a? Array # and !values.first.empty? @@ -252,7 +252,7 @@ class Query < ActiveRecord::Base filters[field] = {:operator => operator, :values => values } end end - + def add_short_filter(field, expression) return unless expression parms = expression.scan(/^(o|c|!\*|!|\*)?(.*)$/).first @@ -267,19 +267,19 @@ class Query < ActiveRecord::Base end end end - + def has_filter?(field) filters and filters[field] end - + def operator_for(field) has_filter?(field) ? filters[field][:operator] : nil end - + def values_for(field) has_filter?(field) ? filters[field][:values] : nil end - + def label_for(field) label = available_filters[field][:name] if available_filters.has_key?(field) label ||= field.gsub(/\_id$/, "") @@ -288,20 +288,20 @@ class Query < ActiveRecord::Base def available_columns return @available_columns if @available_columns @available_columns = Query.available_columns - @available_columns += (project ? + @available_columns += (project ? project.all_issue_custom_fields : IssueCustomField.find(:all) - ).collect {|cf| QueryCustomFieldColumn.new(cf) } + ).collect {|cf| QueryCustomFieldColumn.new(cf) } end def self.available_columns=(v) self.available_columns = (v) end - + def self.add_available_column(column) self.available_columns << (column) if column.is_a?(QueryColumn) end - + # Returns an array of columns that can be used to group the results def groupable_columns available_columns.select {|c| c.groupable} @@ -314,7 +314,7 @@ class Query < ActiveRecord::Base h }) end - + def columns if has_default_columns? available_columns.select do |c| @@ -326,7 +326,7 @@ class Query < ActiveRecord::Base column_names.collect {|name| available_columns.find {|col| col.name == name}}.compact end end - + def column_names=(names) if names names = names.select {|n| n.is_a?(Symbol) || !n.blank? } @@ -338,15 +338,15 @@ class Query < ActiveRecord::Base end write_attribute(:column_names, names) end - + def has_column?(column) column_names && column_names.include?(column.name) end - + def has_default_columns? column_names.nil? || column_names.empty? end - + def sort_criteria=(arg) c = [] if arg.is_a?(Hash) @@ -355,19 +355,19 @@ class Query < ActiveRecord::Base c = arg.select {|k,o| !k.to_s.blank?}.slice(0,3).collect {|k,o| [k.to_s, o == 'desc' ? o : 'asc']} write_attribute(:sort_criteria, c) end - + def sort_criteria read_attribute(:sort_criteria) || [] end - + def sort_criteria_key(arg) sort_criteria && sort_criteria[arg] && sort_criteria[arg].first end - + def sort_criteria_order(arg) sort_criteria && sort_criteria[arg] && sort_criteria[arg].last end - + # Returns the SQL sort order that should be prepended for grouping def group_by_sort_order if grouped? && (column = group_by_column) @@ -376,20 +376,20 @@ class Query < ActiveRecord::Base "#{column.sortable} #{column.default_order}" end end - + # Returns true if the query is a grouped query def grouped? !group_by_column.nil? end - + def group_by_column groupable_columns.detect {|c| c.groupable && c.name.to_s == group_by} end - + def group_by_statement group_by_column.try(:groupable) end - + def project_statement project_clauses = [] if project && !@project.descendants.active.empty? @@ -424,12 +424,12 @@ class Query < ActiveRecord::Base v = values_for(field).clone next unless v and !v.empty? operator = operator_for(field) - + # "me" value subsitution if %w(assigned_to_id author_id watcher_id).include?(field) v.push(User.current.logged? ? User.current.id.to_s : "0") if v.delete("me") end - + sql = '' if field =~ /^cf_(\d+)$/ # custom field @@ -461,7 +461,7 @@ class Query < ActiveRecord::Base end user_ids.flatten.uniq.compact }.sort.collect(&:to_s) - + sql << '(' + sql_for_field("assigned_to_id", operator, members_of_groups, Issue.table_name, "assigned_to_id", false) + ')' elsif field == "assigned_to_role" # named field @@ -475,14 +475,14 @@ class Query < ActiveRecord::Base roles = Role.givable.find_all_by_id(v) end roles ||= [] - + members_of_roles = roles.inject([]) {|user_ids, role| if role && role.members user_ids << role.members.collect(&:user_id) end user_ids.flatten.uniq.compact }.sort.collect(&:to_s) - + sql << '(' + sql_for_field("assigned_to_id", operator, members_of_roles, Issue.table_name, "assigned_to_id", false) + ')' else # regular field @@ -491,19 +491,19 @@ class Query < ActiveRecord::Base sql << '(' + sql_for_field(field, operator, v, db_table, db_field) + ')' end filters_clauses << sql - + end if filters and valid? - + (filters_clauses << project_statement).join(' AND ') end - + # Returns the issue count def issue_count Issue.count(:include => [:status, :project], :conditions => statement) rescue ::ActiveRecord::StatementInvalid => e raise StatementInvalid.new(e.message) end - + # Returns the issue count by group or nil if query is not grouped def issue_count_by_group r = nil @@ -523,13 +523,13 @@ class Query < ActiveRecord::Base rescue ::ActiveRecord::StatementInvalid => e raise StatementInvalid.new(e.message) end - + # Returns the issues # Valid options are :order, :offset, :limit, :include, :conditions def issues(options={}) order_option = [group_by_sort_order, options[:order]].reject {|s| s.blank?}.join(',') order_option = nil if order_option.blank? - + Issue.find :all, :include => ([:status, :project] + (options[:include] || [])).uniq, :conditions => Query.merge_conditions(statement, options[:conditions]), :order => order_option, @@ -550,7 +550,7 @@ class Query < ActiveRecord::Base rescue ::ActiveRecord::StatementInvalid => e raise StatementInvalid.new(e.message) end - + # Returns the versions # Valid options are :conditions def versions(options={}) @@ -559,9 +559,9 @@ class Query < ActiveRecord::Base rescue ::ActiveRecord::StatementInvalid => e raise StatementInvalid.new(e.message) end - + private - + # Helper method to generate the WHERE sql for a +field+, +operator+ and a +value+ def sql_for_field(field, operator, value, db_table, db_field, is_custom_filter=false) sql = '' @@ -620,13 +620,13 @@ class Query < ActiveRecord::Base when "!~" sql = "LOWER(#{db_table}.#{db_field}) NOT LIKE '%#{connection.quote_string(value.first.to_s.downcase)}%'" end - + return sql end - + def add_custom_fields_filters(custom_fields) @available_filters ||= {} - + custom_fields.select(&:is_filter?).each do |field| case field.field_format when "text" @@ -646,7 +646,7 @@ class Query < ActiveRecord::Base @available_filters["cf_#{field.id}"] = options.merge({ :name => field.name }) end end - + # Returns a SQL clause for a date or datetime field. def date_range_clause(table, field, from, to) s = [] diff --git a/app/models/repository.rb b/app/models/repository.rb index ebf434bd..eaf0cdbd 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -1,27 +1,27 @@ #-- 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 Repository < ActiveRecord::Base include Redmine::Ciphering - + belongs_to :project has_many :changesets, :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC" has_many :changes, :through => :changesets - + # Raw SQL to delete changesets and changes in the database # has_many :changesets, :dependent => :destroy is too slow for big repositories before_destroy :clear_changesets - + validates_length_of :password, :maximum => 255, :allow_nil => true # Checks if the SCM is enabled when creating a repository validate_on_create { |r| r.errors.add(:type, :invalid) unless Setting.enabled_scm.include?(r.class.name.demodulize) } @@ -35,11 +35,11 @@ class Repository < ActiveRecord::Base def root_url=(arg) write_attribute(:root_url, arg ? arg.to_s.strip : nil) end - + def password read_ciphered_attribute(:password) end - + def password=(arg) write_ciphered_attribute(:password, arg) end @@ -70,15 +70,15 @@ class Repository < ActiveRecord::Base def supports_all_revisions? true end - + def supports_directory_revisions? false end - + def entry(path=nil, identifier=nil) scm.entry(path, identifier) end - + def entries(path=nil, identifier=nil) scm.entries(path, identifier) end @@ -137,13 +137,13 @@ class Repository < ActiveRecord::Base :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC", :limit => limit) else - changes.find(:all, :include => {:changeset => :user}, + changes.find(:all, :include => {:changeset => :user}, :conditions => ["path = ?", path.with_leading_slash], :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC", :limit => limit).collect(&:changeset) end end - + def scan_changesets_for_issue_ids self.changesets.each(&:scan_comment_for_issue_ids) end @@ -152,7 +152,7 @@ class Repository < ActiveRecord::Base def committers @committers ||= Changeset.connection.select_rows("SELECT DISTINCT committer, user_id FROM #{Changeset.table_name} WHERE repository_id = #{id}") end - + # Maps committers username to a user ids def committer_ids=(h) if h.is_a?(Hash) @@ -170,7 +170,7 @@ class Repository < ActiveRecord::Base false end end - + # Returns the Redmine User corresponding to the given +committer+ # It will return nil if the committer is not yet mapped and if no User # with the same username or email was found @@ -178,7 +178,7 @@ class Repository < ActiveRecord::Base unless committer.blank? @found_committer_users ||= {} return @found_committer_users[committer] if @found_committer_users.has_key?(committer) - + user = nil c = changesets.find(:first, :conditions => {:committer => committer}, :include => :user) if c && c.user @@ -222,7 +222,7 @@ class Repository < ActiveRecord::Base def self.scm_name 'Abstract' end - + def self.available_scm subclasses.collect {|klass| [klass.scm_name, klass.name]} end @@ -261,7 +261,7 @@ class Repository < ActiveRecord::Base def self.scm_available ret = false begin - ret = self.scm_adapter_class.client_available if self.scm_adapter_class + ret = self.scm_adapter_class.client_available if self.scm_adapter_class rescue Redmine::Scm::Adapters::CommandFailed => e logger.error "scm: error during get scm available: #{e.message}" end @@ -276,7 +276,7 @@ class Repository < ActiveRecord::Base root_url.strip! true end - + def clear_changesets cs, ch, ci = Changeset.table_name, Change.table_name, "#{table_name_prefix}changesets_issues#{table_name_suffix}" connection.delete("DELETE FROM #{ch} WHERE #{ch}.changeset_id IN (SELECT #{cs}.id FROM #{cs} WHERE #{cs}.repository_id = #{id})") diff --git a/app/models/repository/bazaar.rb b/app/models/repository/bazaar.rb index 94378e8a..83ba51de 100644 --- a/app/models/repository/bazaar.rb +++ b/app/models/repository/bazaar.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. #++ @@ -55,7 +55,7 @@ class Repository::Bazaar < Repository end end end - + def fetch_changesets scm_info = scm.info if scm_info @@ -73,12 +73,12 @@ class Repository::Bazaar < Repository transaction do revisions.reverse_each do |revision| changeset = Changeset.create(:repository => self, - :revision => revision.identifier, - :committer => revision.author, + :revision => revision.identifier, + :committer => revision.author, :committed_on => revision.time, :scmid => revision.scmid, :comments => revision.message) - + revision.paths.each do |change| Change.create(:changeset => changeset, :action => change[:action], diff --git a/app/models/repository/cvs.rb b/app/models/repository/cvs.rb index d343389c..ff01138e 100644 --- a/app/models/repository/cvs.rb +++ b/app/models/repository/cvs.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. #++ @@ -38,7 +38,7 @@ class Repository::Cvs < Repository rev = identifier.nil? ? nil : changesets.find_by_revision(identifier) scm.entry(path, rev.nil? ? nil : rev.committed_on) end - + def entries(path=nil, identifier=nil) rev = identifier.nil? ? nil : changesets.find_by_revision(identifier) entries = scm.entries(path, rev.nil? ? nil : rev.committed_on) @@ -59,30 +59,30 @@ class Repository::Cvs < Repository end entries end - + def cat(path, identifier=nil) rev = identifier.nil? ? nil : changesets.find_by_revision(identifier) scm.cat(path, rev.nil? ? nil : rev.committed_on) end - + def diff(path, rev, rev_to) #convert rev to revision. CVS can't handle changesets here diff=[] changeset_from=changesets.find_by_revision(rev) - if rev_to.to_i > 0 + if rev_to.to_i > 0 changeset_to=changesets.find_by_revision(rev_to) end changeset_from.changes.each() do |change_from| - + revision_from=nil - revision_to=nil - + revision_to=nil + revision_from=change_from.revision if path.nil? || (change_from.path.starts_with? scm.with_leading_slash(path)) - + if revision_from if changeset_to changeset_to.changes.each() do |change_to| - revision_to=change_to.revision if change_to.path==change_from.path + revision_to=change_to.revision if change_to.path==change_from.path end end unless revision_to @@ -94,23 +94,23 @@ class Repository::Cvs < Repository end return diff end - + def fetch_changesets # some nifty bits to introduce a commit-id with cvs # natively cvs doesn't provide any kind of changesets, there is only a revision per file. # we now take a guess using the author, the commitlog and the commit-date. - - # last one is the next step to take. the commit-date is not equal for all + + # last one is the next step to take. the commit-date is not equal for all # commits in one changeset. cvs update the commit-date when the *,v file was touched. so # we use a small delta here, to merge all changes belonging to _one_ changeset time_delta=10.seconds - + fetch_since = latest_changeset ? latest_changeset.committed_on : nil transaction do tmp_rev_num = 1 scm.revisions('', fetch_since, nil, :with_paths => true) do |revision| # only add the change to the database, if it doen't exists. the cvs log - # is not exclusive at all. + # is not exclusive at all. tmp_time = revision.time.clone unless changes.find_by_path_and_revision( scm.with_leading_slash(revision.paths[0][:path]), revision.paths[0][:revision]) @@ -120,8 +120,8 @@ class Repository::Cvs < Repository :committer=>revision.author, :comments=>cmt }) - - # create a new changeset.... + + # create a new changeset.... unless cs # we use a temporaray revision number here (just for inserting) # later on, we calculate a continous positive number @@ -131,12 +131,12 @@ class Repository::Cvs < Repository cs = Changeset.create(:repository => self, :revision => "tmp#{tmp_rev_num}", :scmid => scmid, - :committer => revision.author, + :committer => revision.author, :committed_on => tmp_time, :comments => revision.message) tmp_rev_num += 1 end - + #convert CVS-File-States to internal Action-abbrevations #default action is (M)odified action="M" @@ -145,7 +145,7 @@ class Repository::Cvs < Repository elsif revision.paths[0][:action]=="dead" action="D" #dead-state is similar to Delete end - + Change.create(:changeset => cs, :action => action, :path => scm.with_leading_slash(revision.paths[0][:path]), @@ -154,7 +154,7 @@ class Repository::Cvs < Repository ) end end - + # Renumber new changesets in chronological order changesets.find( :all, :order => 'committed_on ASC, id ASC', :conditions => "revision LIKE 'tmp%'" @@ -164,9 +164,9 @@ class Repository::Cvs < Repository end # transaction @current_revision_number = nil end - + private - + # Returns the next revision number to assign to a CVS changeset def next_revision_number # Need to retrieve existing revision numbers to sort them as integers diff --git a/app/models/repository/darcs.rb b/app/models/repository/darcs.rb index 34d5b629..7b7d5a5c 100644 --- a/app/models/repository/darcs.rb +++ b/app/models/repository/darcs.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,7 +36,7 @@ class Repository::Darcs < Repository patch = identifier.nil? ? nil : changesets.find_by_revision(identifier) scm.entry(path, patch.nil? ? nil : patch.scmid) end - + def entries(path=nil, identifier=nil) patch = identifier.nil? ? nil : changesets.find_by_revision(identifier) entries = scm.entries(path, patch.nil? ? nil : patch.scmid) @@ -54,12 +54,12 @@ class Repository::Darcs < Repository end entries end - + def cat(path, identifier=nil) patch = identifier.nil? ? nil : changesets.find_by_revision(identifier.to_s) scm.cat(path, patch.nil? ? nil : patch.scmid) end - + def diff(path, rev, rev_to) patch_from = changesets.find_by_revision(rev) return nil if patch_from.nil? @@ -69,14 +69,14 @@ class Repository::Darcs < Repository end patch_from ? scm.diff(path, patch_from.scmid, patch_to ? patch_to.scmid : nil) : nil end - + def fetch_changesets scm_info = scm.info if scm_info db_last_id = latest_changeset ? latest_changeset.scmid : nil - next_rev = latest_changeset ? latest_changeset.revision.to_i + 1 : 1 + next_rev = latest_changeset ? latest_changeset.revision.to_i + 1 : 1 # latest revision in the repository - scm_revision = scm_info.lastrev.scmid + scm_revision = scm_info.lastrev.scmid unless changesets.find_by_scmid(scm_revision) revisions = scm.revisions('', db_last_id, nil, :with_path => true) transaction do @@ -84,10 +84,10 @@ class Repository::Darcs < Repository changeset = Changeset.create(:repository => self, :revision => next_rev, :scmid => revision.scmid, - :committer => revision.author, + :committer => revision.author, :committed_on => revision.time, :comments => revision.message) - + revision.paths.each do |change| changeset.create_change(change) end diff --git a/app/models/repository/filesystem.rb b/app/models/repository/filesystem.rb index f1e269bb..f8d5416d 100644 --- a/app/models/repository/filesystem.rb +++ b/app/models/repository/filesystem.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. #++ @@ -43,5 +43,5 @@ class Repository::Filesystem < Repository def fetch_changesets nil end - + end diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb index bc9dee61..ae8ecb2d 100644 --- a/app/models/repository/git.rb +++ b/app/models/repository/git.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. #++ @@ -97,10 +97,10 @@ class Repository::Git < Repository :repository => self, :revision => rev.identifier, :scmid => rev.scmid, - :committer => rev.author, + :committer => rev.author, :committed_on => rev.time, :comments => rev.message) - + if changeset.save rev.paths.each do |file| Change.create( @@ -119,9 +119,9 @@ class Repository::Git < Repository return [] if revisions.nil? || revisions.empty? changesets.find( - :all, + :all, :conditions => [ - "scmid IN (?)", + "scmid IN (?)", revisions.map!{|c| c.scmid} ], :order => 'committed_on DESC' diff --git a/app/models/repository/mercurial.rb b/app/models/repository/mercurial.rb index fcfef55d..4b9966b8 100644 --- a/app/models/repository/mercurial.rb +++ b/app/models/repository/mercurial.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. #++ @@ -107,7 +107,7 @@ class Repository::Mercurial < Repository unless path.blank? cond << "EXISTS (SELECT * FROM #{Change.table_name} WHERE #{Change.table_name}.changeset_id = #{Changeset.table_name}.id - AND (#{Change.table_name}.path = ? + AND (#{Change.table_name}.path = ? OR #{Change.table_name}.path LIKE ? ESCAPE ?))" args << path.with_leading_slash args << "#{path.with_leading_slash.gsub(/[%_\\]/) { |s| "\\#{s}" }}/%" << '\\' diff --git a/app/models/repository/subversion.rb b/app/models/repository/subversion.rb index 9ab6b9d2..bf37ed96 100644 --- a/app/models/repository/subversion.rb +++ b/app/models/repository/subversion.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. #++ @@ -38,12 +38,12 @@ class Repository::Subversion < Repository revisions = scm.revisions(path, rev, nil, :limit => limit) revisions ? changesets.find_all_by_revision(revisions.collect(&:identifier), :order => "committed_on DESC", :include => :user) : [] end - + # Returns a path relative to the url of the repository def relative_path(path) path.gsub(Regexp.new("^\/?#{Regexp.escape(relative_url)}"), '') end - + def fetch_changesets scm_info = scm.info if scm_info @@ -61,11 +61,11 @@ class Repository::Subversion < Repository revisions.reverse_each do |revision| transaction do changeset = Changeset.create(:repository => self, - :revision => revision.identifier, - :committer => revision.author, + :revision => revision.identifier, + :committer => revision.author, :committed_on => revision.time, :comments => revision.message) - + revision.paths.each do |change| changeset.create_change(change) end unless changeset.new_record? @@ -76,9 +76,9 @@ class Repository::Subversion < Repository end end end - + private - + # Returns the relative url of the repository # Eg: root_url = file:///var/svn/foo # url = file:///var/svn/foo/bar diff --git a/app/models/role.rb b/app/models/role.rb index d49c8fb8..fee9ef9f 100644 --- a/app/models/role.rb +++ b/app/models/role.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,18 +21,18 @@ class Role < ActiveRecord::Base compare = 'not' if args.first == true { :conditions => "#{compare} builtin = 0" } } - + before_destroy :check_deletable has_many :workflows, :dependent => :delete_all do def copy(source_role) Workflow.copy(nil, source_role, nil, proxy_owner) end end - + has_many :member_roles, :dependent => :destroy has_many :members, :through => :member_roles acts_as_list - + serialize :permissions, Array attr_protected :builtin @@ -43,7 +43,7 @@ class Role < ActiveRecord::Base def permissions read_attribute(:permissions) || [] end - + def permissions=(perms) perms = perms.collect {|p| p.to_sym unless p.blank? }.compact.uniq if perms write_attribute(:permissions, perms) @@ -66,30 +66,30 @@ class Role < ActiveRecord::Base perms.each { |p| permissions.delete(p.to_sym) } save! end - + # Returns true if the role has the given permission def has_permission?(perm) !permissions.nil? && permissions.include?(perm.to_sym) end - + def <=>(role) role ? position <=> role.position : -1 end - + def to_s name end - + # Return true if the role is a builtin role def builtin? self.builtin != 0 end - + # Return true if the role is a project member role def member? !self.builtin? end - + # Return true if role is allowed to do the specified action # action can be: # * a parameter-like Hash (eg. :controller => 'projects', :action => 'edit') @@ -101,7 +101,7 @@ class Role < ActiveRecord::Base allowed_permissions.include? action end end - + # Return all the permissions that can be given to the role def setable_permissions setable_permissions = Redmine::AccessControl.permissions - Redmine::AccessControl.public_permissions @@ -141,7 +141,7 @@ class Role < ActiveRecord::Base anonymous_role end - + private def allowed_permissions @allowed_permissions ||= permissions + Redmine::AccessControl.public_permissions.collect {|p| p.name} @@ -150,7 +150,7 @@ private def allowed_actions @actions_allowed ||= allowed_permissions.inject([]) { |actions, permission| actions += Redmine::AccessControl.allowed_actions(permission) }.flatten end - + def check_deletable raise "Can't delete role" if members.any? raise "Can't delete builtin role" if builtin? diff --git a/app/models/setting.rb b/app/models/setting.rb index 2b96ca87..e36a6be3 100644 --- a/app/models/setting.rb +++ b/app/models/setting.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,12 +24,12 @@ class Setting < ActiveRecord::Base '%b %d, %Y', '%B %d, %Y' ] - + TIME_FORMATS = [ '%H:%M', '%I:%M %p' ] - + ENCODINGS = %w(US-ASCII windows-1250 windows-1251 @@ -69,18 +69,18 @@ class Setting < ActiveRecord::Base Big5 Big5-HKSCS TIS-620) - + cattr_accessor :available_settings @@available_settings = YAML::load(File.open("#{RAILS_ROOT}/config/settings.yml")) Redmine::Plugin.all.each do |plugin| next unless plugin.settings - @@available_settings["plugin_#{plugin.id}"] = {'default' => plugin.settings[:default], 'serialized' => true} + @@available_settings["plugin_#{plugin.id}"] = {'default' => plugin.settings[:default], 'serialized' => true} end - + validates_uniqueness_of :name validates_inclusion_of :name, :in => @@available_settings.keys - validates_numericality_of :value, :only_integer => true, :if => Proc.new { |setting| @@available_settings[setting.name]['format'] == 'int' } - + validates_numericality_of :value, :only_integer => true, :if => Proc.new { |setting| @@available_settings[setting.name]['format'] == 'int' } + def value v = read_attribute(:value) # Unserialize serialized settings @@ -88,17 +88,17 @@ class Setting < ActiveRecord::Base v = v.to_sym if @@available_settings[name]['format'] == 'symbol' && !v.blank? v end - + def value=(v) v = v.to_yaml if v && @@available_settings[name] && @@available_settings[name]['serialized'] write_attribute(:value, v.to_s) end - + # Returns the value of the setting named name def self.[](name) Marshal.load(Rails.cache.fetch("chiliproject/setting/#{name}") {Marshal.dump(find_or_default(name).value)}).freeze end - + def self.[]=(name, v) setting = find_or_default(name) setting.value = (v ? v : "") @@ -106,7 +106,7 @@ class Setting < ActiveRecord::Base setting.save setting.value.freeze end - + # Defines getter and setter for each setting # Then setting values can be read using: Setting.some_setting_name # or set using Setting.some_setting_name = "some value" @@ -126,16 +126,16 @@ class Setting < ActiveRecord::Base END_SRC class_eval src, __FILE__, __LINE__ end - + # Helper that returns an array based on per_page_options setting def self.per_page_options_array per_page_options.split(%r{[\s,]}).collect(&:to_i).select {|n| n > 0}.sort end - + def self.openid? Object.const_defined?(:OpenID) && self[:openid].to_i > 0 end - + # Checks if settings have changed since the values were read # and clears the cache hash if it's the case # Called once per request @@ -154,13 +154,13 @@ class Setting < ActiveRecord::Base Rails.cache.write('chiliproject/setting-cleared_on', Marshal.dump(Time.now)) logger.info 'Settings cache cleared.' if logger end - + private # Returns the Setting instance for the setting named name # (record found in database or new record with default value) def self.find_or_default(name) name = name.to_s - raise "There's no setting named #{name}" unless @@available_settings.has_key?(name) + raise "There's no setting named #{name}" unless @@available_settings.has_key?(name) setting = find_by_name(name) setting ||= new(:name => name, :value => @@available_settings[name]['default']) if @@available_settings.has_key? name end diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb index 9bc4e2b5..4467888c 100644 --- a/app/models/time_entry.rb +++ b/app/models/time_entry.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 TimeEntry < ActiveRecord::Base belongs_to :issue belongs_to :user belongs_to :activity, :class_name => 'TimeEntryActivity', :foreign_key => 'activity_id' - + attr_protected :project_id, :user_id, :tyear, :tmonth, :tweek acts_as_customizable @@ -30,10 +30,10 @@ class TimeEntry < ActiveRecord::Base validates_presence_of :user_id, :activity_id, :project_id, :hours, :spent_on validates_numericality_of :hours, :allow_nil => true, :message => :invalid validates_length_of :comments, :maximum => 255, :allow_nil => true - - named_scope :visible, lambda {|*args| { + + named_scope :visible, lambda {|*args| { :include => :project, - :conditions => Project.allowed_to_condition(args.first || User.current, :view_time_entries) + :conditions => Project.allowed_to_condition(args.first || User.current, :view_time_entries) }} def after_initialize @@ -44,21 +44,21 @@ class TimeEntry < ActiveRecord::Base self.hours = nil if hours == 0 end end - + def before_validation self.project = issue.project if issue && project.nil? end - + def validate errors.add :hours, :invalid if hours && (hours < 0 || hours >= 1000) errors.add :project_id, :invalid if project.nil? errors.add :issue_id, :invalid if (issue_id && !issue) || (issue && project!=issue.project) end - + def hours=(h) write_attribute :hours, (h.is_a?(String) ? (h.to_hours || h) : h) end - + # tyear, tmonth, tweek assigned where setting spent_on attributes # these attributes make time aggregations easier def spent_on=(date) @@ -70,12 +70,12 @@ class TimeEntry < ActiveRecord::Base self.tmonth = spent_on ? spent_on.month : nil self.tweek = spent_on ? Date.civil(spent_on.year, spent_on.month, spent_on.day).cweek : nil end - + # Returns true if the time entry can be edited by usr, otherwise false def editable_by?(usr) (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project) end - + # TODO: remove this method in 1.3.0 def self.visible_by(usr) ActiveSupport::Deprecation.warn "TimeEntry.visible_by is deprecated and will be removed in Redmine 1.3.0. Use the visible scope instead." diff --git a/app/models/time_entry_activity.rb b/app/models/time_entry_activity.rb index 980de097..3b89ba21 100644 --- a/app/models/time_entry_activity.rb +++ b/app/models/time_entry_activity.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 TimeEntryActivity < Enumeration has_many :time_entries, :foreign_key => 'activity_id' OptionName = :enumeration_activities - + def option_name OptionName end diff --git a/app/models/time_entry_activity_custom_field.rb b/app/models/time_entry_activity_custom_field.rb index ee453633..f2dfedc7 100644 --- a/app/models/time_entry_activity_custom_field.rb +++ b/app/models/time_entry_activity_custom_field.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/models/time_entry_custom_field.rb b/app/models/time_entry_custom_field.rb index d602db1f..faf88edd 100644 --- a/app/models/time_entry_custom_field.rb +++ b/app/models/time_entry_custom_field.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/models/token.rb b/app/models/token.rb index a3c65a5e..5477d952 100644 --- a/app/models/token.rb +++ b/app/models/token.rb @@ -1,43 +1,43 @@ #-- 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 Token < ActiveRecord::Base belongs_to :user validates_uniqueness_of :value - + before_create :delete_previous_tokens - + @@validity_time = 1.day - + def before_create self.value = Token.generate_token_value end - # Return true if token has expired + # Return true if token has expired def expired? return Time.now > self.created_on + @@validity_time end - + # Delete all expired tokens def self.destroy_expired Token.delete_all ["action <> 'feeds' AND created_on < ?", Time.now - @@validity_time] end - + private def self.generate_token_value ActiveSupport::SecureRandom.hex(20) end - + # Removes obsolete tokens (same user and action) def delete_previous_tokens if user diff --git a/app/models/tracker.rb b/app/models/tracker.rb index e08b2a3e..0345a7e2 100644 --- a/app/models/tracker.rb +++ b/app/models/tracker.rb @@ -1,25 +1,25 @@ #-- 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 Tracker < ActiveRecord::Base - before_destroy :check_integrity + before_destroy :check_integrity has_many :issues has_many :workflows, :dependent => :delete_all do def copy(source_tracker) Workflow.copy(source_tracker, nil, proxy_owner, nil) end end - + has_and_belongs_to_many :projects has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_trackers#{table_name_suffix}", :association_foreign_key => 'custom_field_id' acts_as_list @@ -29,7 +29,7 @@ class Tracker < ActiveRecord::Base validates_length_of :name, :maximum => 30 def to_s; name end - + def <=>(tracker) name <=> tracker.name end @@ -37,24 +37,24 @@ class Tracker < ActiveRecord::Base def self.all find(:all, :order => 'position') end - + # Returns an array of IssueStatus that are used # in the tracker's workflows def issue_statuses if @issue_statuses - return @issue_statuses + return @issue_statuses elsif new_record? return [] end - + ids = Workflow. connection.select_rows("SELECT DISTINCT old_status_id, new_status_id FROM #{Workflow.table_name} WHERE tracker_id = #{id}"). flatten. uniq - + @issue_statuses = IssueStatus.find_all_by_id(ids).sort end - + private def check_integrity raise "Can't delete tracker" if Issue.find(:first, :conditions => ["tracker_id=?", self.id]) diff --git a/app/models/user.rb b/app/models/user.rb index ce352d0b..2be5eade 100644 --- a/app/models/user.rb +++ b/app/models/user.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,13 +15,13 @@ require "digest/sha1" class User < Principal include Redmine::SafeAttributes - + # Account statuses STATUS_ANONYMOUS = 0 STATUS_ACTIVE = 1 STATUS_REGISTERED = 2 STATUS_LOCKED = 3 - + USER_FORMATS = { :firstname_lastname => '#{firstname} #{lastname}', :firstname => '#{firstname}', @@ -47,17 +47,17 @@ class User < Principal has_one :rss_token, :dependent => :destroy, :class_name => 'Token', :conditions => "action='feeds'" has_one :api_token, :dependent => :destroy, :class_name => 'Token', :conditions => "action='api'" belongs_to :auth_source - + # Active non-anonymous users scope named_scope :active, :conditions => "#{User.table_name}.status = #{STATUS_ACTIVE}" - + acts_as_customizable - + attr_accessor :password, :password_confirmation attr_accessor :last_before_login_on # Prevents unauthorized assignments attr_protected :login, :admin, :password, :password_confirmation, :hashed_password - + validates_presence_of :login, :firstname, :lastname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) } validates_uniqueness_of :login, :if => Proc.new { |user| !user.login.blank? }, :case_sensitive => false validates_uniqueness_of :mail, :if => Proc.new { |user| !user.mail.blank? }, :case_sensitive => false @@ -78,29 +78,29 @@ class User < Principal group_id = group.is_a?(Group) ? group.id : group.to_i { :conditions => ["#{User.table_name}.id NOT IN (SELECT gu.user_id FROM #{table_name_prefix}groups_users#{table_name_suffix} gu WHERE gu.group_id = ?)", group_id] } } - + def before_create self.mail_notification = Setting.default_notification_option if self.mail_notification.blank? true end - + def before_save # update hashed_password if password was set if self.password && self.auth_source_id.blank? salt_password(password) end end - + def reload(*args) @name = nil @projects_by_role = nil super end - + def mail=(arg) write_attribute(:mail, arg.to_s.strip) end - + def identity_url=(url) if url.blank? write_attribute(:identity_url, '') @@ -113,7 +113,7 @@ class User < Principal end self.read_attribute(:identity_url) end - + # Returns the user that matches provided login and password, or nil def self.try_to_login(login, password) # Make sure no one can sign in with an empty password @@ -141,13 +141,13 @@ class User < Principal logger.info("User '#{user.login}' created from external auth source: #{user.auth_source.type} - #{user.auth_source.name}") if logger && user.auth_source end end - end + end user.update_attribute(:last_login_on, Time.now) if user && !user.new_record? user rescue => text raise text end - + # Returns the user who matches the given autologin +key+ or nil def self.try_to_autologin(key) tokens = Token.find_all_by_action_and_value('autologin', key) @@ -160,7 +160,7 @@ class User < Principal end end end - + # Return user's full name for display def name(formatter = nil) if formatter @@ -169,7 +169,7 @@ class User < Principal @name ||= eval('"' + (USER_FORMATS[Setting.user_format] || USER_FORMATS[:firstname_lastname]) + '"') end end - + def active? self.status == STATUS_ACTIVE end @@ -177,7 +177,7 @@ class User < Principal def registered? self.status == STATUS_REGISTERED end - + def locked? self.status == STATUS_LOCKED end @@ -214,7 +214,7 @@ class User < Principal User.hash_password("#{salt}#{User.hash_password clear_password}") == hashed_password end end - + # Generates a random salt and computes hashed_password for +clear_password+ # The hashed password is stored in the following form: SHA1(salt + SHA1(password)) def salt_password(clear_password) @@ -239,19 +239,19 @@ class User < Principal self.password_confirmation = password self end - + def pref self.preference ||= UserPreference.new(:user => self) end - + def time_zone @time_zone ||= (self.pref.time_zone.blank? ? nil : ActiveSupport::TimeZone[self.pref.time_zone]) end - + def wants_comments_in_reverse_order? self.pref[:comments_sorting] == 'desc' end - + # Return user's RSS key (a 40 chars long string), used to access feeds def rss_key token = self.rss_token || Token.create(:user => self, :action => 'feeds') @@ -263,12 +263,12 @@ class User < Principal token = self.api_token || self.create_api_token(:action => 'api') token.value end - + # Return an array of project ids for which the user has explicitly turned mail notifications on def notified_projects_ids @notified_projects_ids ||= memberships.select {|m| m.mail_notification?}.collect(&:project_id) end - + def notified_project_ids=(ids) Member.update_all("mail_notification = #{connection.quoted_false}", ['user_id = ?', id]) Member.update_all("mail_notification = #{connection.quoted_true}", ['user_id = ? AND project_id IN (?)', id, ids]) if ids && !ids.empty? @@ -306,21 +306,21 @@ class User < Principal token = Token.find_by_value(key) token && token.user.active? ? token.user : nil end - + def self.find_by_api_key(key) token = Token.find_by_action_and_value('api', key) token && token.user.active? ? token.user : nil end - + # Makes find_by_mail case-insensitive def self.find_by_mail(mail) find(:first, :conditions => ["LOWER(mail) = ?", mail.to_s.downcase]) end - + def to_s name end - + # Returns the current day according to user's time zone def today if time_zone.nil? @@ -329,15 +329,15 @@ class User < Principal Time.now.in_time_zone(time_zone).to_date end end - + def logged? true end - + def anonymous? !logged? end - + # Return user's roles for project def roles_for_project(project) roles = [] @@ -358,16 +358,16 @@ class User < Principal end roles end - + # Return true if the user is a member of project def member_of?(project) !roles_for_project(project).detect {|role| role.member?}.nil? end - + # Returns a hash of user's projects grouped by roles def projects_by_role return @projects_by_role if @projects_by_role - + @projects_by_role = Hash.new {|h,k| h[k]=[]} memberships.each do |membership| membership.roles.each do |role| @@ -377,10 +377,10 @@ class User < Principal @projects_by_role.each do |role, projects| projects.uniq! end - + @projects_by_role end - + # Return true if the user is allowed to do the specified action on a specific context # Action can be: # * a parameter-like Hash (eg. :controller => 'projects', :action => 'edit') @@ -388,7 +388,7 @@ class User < Principal # Context can be: # * a project : returns true if user is allowed to do the specified action on this project # * a group of projects : returns true if user is allowed on every project - # * nil with options[:global] set : check if user has at least one role allowed for this action, + # * nil with options[:global] set : check if user has at least one role allowed for this action, # or falls back to Non Member / Anonymous permissions depending if the user is logged def allowed_to?(action, context, options={}) if context && context.is_a?(Project) @@ -398,11 +398,11 @@ class User < Principal return false unless context.allows_to?(action) # Admin users are authorized for anything else return true if admin? - + roles = roles_for_project(context) return false unless roles roles.detect {|role| (context.is_public? || role.member?) && role.allowed_to?(action)} - + elsif context && context.is_a?(Array) # Authorize if user is authorized on every element of the array context.map do |project| @@ -413,7 +413,7 @@ class User < Principal elsif options[:global] # Admin users are always authorized return true if admin? - + # authorize if user has at least one role that has this permission roles = memberships.collect {|m| m.roles}.flatten.uniq roles.detect {|r| r.allowed_to?(action)} || (self.logged? ? Role.non_member.allowed_to?(action) : Role.anonymous.allowed_to?(action)) @@ -437,14 +437,14 @@ class User < Principal 'custom_field_values', 'custom_fields', 'identity_url' - + safe_attributes 'status', 'auth_source_id', :if => lambda {|user, current_user| current_user.admin?} - + safe_attributes 'group_ids', :if => lambda {|user, current_user| current_user.admin? && !user.new_record?} - + # Utility method to help check if a user should be notified about an # event. # @@ -484,15 +484,15 @@ class User < Principal false end end - + def self.current=(user) @current_user = user end - + def self.current @current_user ||= User.anonymous end - + # Returns the anonymous user. If the anonymous user does not exist, it is created. There can be only # one anonymous user per database. def self.anonymous @@ -517,41 +517,41 @@ class User < Principal end end end - + protected - + def validate # Password length validation based on setting if !password.nil? && password.size < Setting.password_min_length.to_i errors.add(:password, :too_short, :count => Setting.password_min_length.to_i) end end - + private - + # Return password digest def self.hash_password(clear_password) Digest::SHA1.hexdigest(clear_password || "") end - + # Returns a 128bits random salt as a hex string (32 chars long) def self.generate_salt ActiveSupport::SecureRandom.hex(16) end - + end class AnonymousUser < User - + def validate_on_create # There should be only one AnonymousUser in the database errors.add_to_base 'An anonymous user already exists.' if AnonymousUser.find(:first) end - + def available_custom_fields [] end - + # Overrides a few properties def logged?; false end def admin; false end diff --git a/app/models/user_custom_field.rb b/app/models/user_custom_field.rb index eacb241c..862f1af3 100644 --- a/app/models/user_custom_field.rb +++ b/app/models/user_custom_field.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/models/user_preference.rb b/app/models/user_preference.rb index 06f5f55c..fac46a1c 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -1,31 +1,31 @@ #-- 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 UserPreference < ActiveRecord::Base belongs_to :user serialize :others - + attr_protected :others - + def initialize(attributes = nil) super self.others ||= {} end - + def before_save self.others ||= {} end - + def [](attr_name) if attribute_present? attr_name super @@ -33,7 +33,7 @@ class UserPreference < ActiveRecord::Base others ? others[attr_name] : nil end end - + def []=(attr_name, value) if attribute_present? attr_name super @@ -44,10 +44,10 @@ class UserPreference < ActiveRecord::Base value end end - + def comments_sorting; self[:comments_sorting] end def comments_sorting=(order); self[:comments_sorting]=order end - + def warn_on_leaving_unsaved; self[:warn_on_leaving_unsaved] || '1'; end def warn_on_leaving_unsaved=(value); self[:warn_on_leaving_unsaved]=value; end end diff --git a/app/models/version.rb b/app/models/version.rb index d1b3f7e3..829008b4 100644 --- a/app/models/version.rb +++ b/app/models/version.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 Version < ActiveRecord::Base VERSION_STATUSES = %w(open locked closed) VERSION_SHARINGS = %w(none descendants hierarchy tree system) - + validates_presence_of :name validates_uniqueness_of :name, :scope => [:project_id] validates_length_of :name, :maximum => 60 @@ -45,22 +45,22 @@ class Version < ActiveRecord::Base def start_date @start_date ||= (read_attribute(:start_date) || fixed_issues.minimum('start_date')) end - + def due_date effective_date end - + # Returns the total estimated time for this version # (sum of leaves estimated_hours) def estimated_hours @estimated_hours ||= fixed_issues.leaves.sum(:estimated_hours).to_f end - + # Returns the total reported time for this version def spent_hours @spent_hours ||= TimeEntry.sum(:hours, :include => :issue, :conditions => ["#{Issue.table_name}.fixed_version_id = ?", id]).to_f end - + def closed? status == 'closed' end @@ -68,7 +68,7 @@ class Version < ActiveRecord::Base def open? status == 'open' end - + # Returns true if the version is completed: due date reached and no open issues def completed? effective_date && (effective_date <= Date.today) && (open_issues_count == 0) @@ -84,7 +84,7 @@ class Version < ActiveRecord::Base false # No issues so it's not late end end - + # Returns the completion percentage of this version based on the amount of open/closed issues # and the time spent on the open issues. def completed_pourcent @@ -96,7 +96,7 @@ class Version < ActiveRecord::Base issues_progress(false) + issues_progress(true) end end - + # Returns the percentage of issues that have been marked as 'closed'. def closed_pourcent if issues_count == 0 @@ -105,17 +105,17 @@ class Version < ActiveRecord::Base issues_progress(false) end end - + # Returns true if the version is overdue: due date reached and some open issues def overdue? effective_date && (effective_date < Date.today) && (open_issues_count > 0) end - + # Returns assigned issues count def issues_count @issue_count ||= fixed_issues.count end - + # Returns the total amount of open issues for this version. def open_issues_count @open_issues_count ||= Issue.count(:all, :conditions => ["fixed_version_id = ? AND is_closed = ?", self.id, false], :include => :status) @@ -125,20 +125,20 @@ class Version < ActiveRecord::Base def closed_issues_count @closed_issues_count ||= Issue.count(:all, :conditions => ["fixed_version_id = ? AND is_closed = ?", self.id, true], :include => :status) end - + def wiki_page if project.wiki && !wiki_page_title.blank? @wiki_page ||= project.wiki.find_page(wiki_page_title) end @wiki_page end - + def to_s; name end def to_s_with_project "#{project} - #{name}" end - + # Versions are sorted by effective_date and "Project Name - Version name" # Those with no effective_date are at the end, sorted by "Project Name - Version name" def <=>(version) @@ -160,7 +160,7 @@ class Version < ActiveRecord::Base end end end - + # Returns the sharings that +user+ can set the version to def allowed_sharings(user = User.current) VERSION_SHARINGS.select do |s| @@ -181,7 +181,7 @@ class Version < ActiveRecord::Base end end end - + private # Update the issue's fixed versions. Used if a version's sharing changes. @@ -194,7 +194,7 @@ class Version < ActiveRecord::Base end end end - + # Returns the average estimated time of assigned issues # or 1 if no issue has an estimated time # Used to weigth unestimated issues in progress calculation @@ -208,7 +208,7 @@ class Version < ActiveRecord::Base end @estimated_average end - + # Returns the total progress of open or closed issues. The returned percentage takes into account # the amount of estimated time set for this version. # @@ -221,7 +221,7 @@ class Version < ActiveRecord::Base progress = 0 if issues_count > 0 ratio = open ? 'done_ratio' : 100 - + done = fixed_issues.sum("COALESCE(estimated_hours, #{estimated_average}) * #{ratio}", :include => :status, :conditions => ["is_closed = ?", !open]).to_f diff --git a/app/models/version_custom_field.rb b/app/models/version_custom_field.rb index 81a74980..2e363b23 100644 --- a/app/models/version_custom_field.rb +++ b/app/models/version_custom_field.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/models/watcher.rb b/app/models/watcher.rb index 5ee9b216..6d1de688 100644 --- a/app/models/watcher.rb +++ b/app/models/watcher.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 Watcher < ActiveRecord::Base belongs_to :watchable, :polymorphic => true belongs_to :user - + validates_presence_of :user validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id] @@ -30,25 +30,25 @@ class Watcher < ActiveRecord::Base pruned end end - + protected - + def validate errors.add :user_id, :invalid unless user.nil? || user.active? end - + private - + def self.prune_single_user(user, options={}) return unless user.is_a?(User) pruned = 0 find(:all, :conditions => {:user_id => user.id}).each do |watcher| next if watcher.watchable.nil? - + if options.has_key?(:project) next unless watcher.watchable.respond_to?(:project) && watcher.watchable.project == options[:project] end - + if watcher.watchable.respond_to?(:visible?) unless watcher.watchable.visible?(user) watcher.destroy diff --git a/app/models/wiki.rb b/app/models/wiki.rb index 2f8e0eb3..e37e6f4c 100644 --- a/app/models/wiki.rb +++ b/app/models/wiki.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,29 +15,29 @@ class Wiki < ActiveRecord::Base belongs_to :project has_many :pages, :class_name => 'WikiPage', :dependent => :destroy, :order => 'title' has_many :redirects, :class_name => 'WikiRedirect', :dependent => :delete_all - + acts_as_watchable - + validates_presence_of :start_page validates_format_of :start_page, :with => /^[^,\.\/\?\;\|\:]*$/ - + def visible?(user=User.current) !user.nil? && user.allowed_to?(:view_wiki_pages, project) end - + # Returns the wiki page that acts as the sidebar content # or nil if no such page exists def sidebar @sidebar ||= find_page('Sidebar', :with_redirect => false) end - + # find the page with the given title # if page doesn't exist, return a new page def find_or_new_page(title) title = start_page if title.blank? find_page(title) || WikiPage.new(:wiki => self, :title => Wiki.titleize(title)) end - + # find the page with the given title def find_page(title, options = {}) title = start_page if title.blank? @@ -50,7 +50,7 @@ class Wiki < ActiveRecord::Base end page end - + # Finds a page by title # The given string can be of one of the forms: "title" or "project:title" # Examples: @@ -69,7 +69,7 @@ class Wiki < ActiveRecord::Base end end end - + # turn a string into a valid page title def self.titleize(title) # replace spaces with _ and remove unwanted caracters @@ -77,5 +77,5 @@ class Wiki < ActiveRecord::Base # upcase the first letter title = (title.slice(0..0).upcase + (title.slice(1..-1) || '')) if title title - end + end end diff --git a/app/models/wiki_content.rb b/app/models/wiki_content.rb index 3f956006..c8c905f3 100644 --- a/app/models/wiki_content.rb +++ b/app/models/wiki_content.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 @@ class WikiContent < ActiveRecord::Base validates_length_of :comments, :maximum => 255, :allow_nil => true attr_accessor :comments - + before_save :comments_to_journal_notes acts_as_journalized :event_type => 'wiki-page', @@ -37,15 +37,15 @@ class WikiContent < ActiveRecord::Base def visible?(user=User.current) page.visible?(user) end - + def project page.project end - + def attachments page.nil? ? [] : page.attachments end - + # Returns the mail adresses of users that should be notified def recipients notified = project.notified_users @@ -68,11 +68,11 @@ class WikiContent < ActiveRecord::Base end private - + def comments_to_journal_notes self.init_journal(author, comments) end - + # FIXME: This is for backwards compatibility only. Remove once we decide it is not needed anymore WikiContentJournal.class_eval do attr_protected :data @@ -97,14 +97,14 @@ class WikiContent < ActiveRecord::Base end plain end - + def text_hash(hash) changes.delete("text") changes["data"] = hash[:text] changes["compression"] = hash[:compression] update_attribute(:changes, changes.to_yaml) end - + def text @text ||= case changes[:compression] when 'gzip' @@ -114,7 +114,7 @@ class WikiContent < ActiveRecord::Base changes["data"] end end - + # Returns the previous version or nil def previous @previous ||= journaled.journals.at(version - 1) diff --git a/app/models/wiki_content_observer.rb b/app/models/wiki_content_observer.rb index 13d1a933..f72b1c9a 100644 --- a/app/models/wiki_content_observer.rb +++ b/app/models/wiki_content_observer.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 WikiContentObserver < ActiveRecord::Observer def after_create(wiki_content) Mailer.deliver_wiki_content_added(wiki_content) if Setting.notified_events.include?('wiki_content_added') end - + def after_update(wiki_content) if wiki_content.text_changed? Mailer.deliver_wiki_content_updated(wiki_content) if Setting.notified_events.include?('wiki_content_updated') diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index b9b30d61..3beacd18 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.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,27 +31,27 @@ class WikiPage < ActiveRecord::Base :project_key => "#{Wiki.table_name}.project_id" attr_accessor :redirect_existing_links - + validates_presence_of :title validates_format_of :title, :with => /^[^,\.\/\?\;\|\s]*$/ validates_uniqueness_of :title, :scope => :wiki_id, :case_sensitive => false validates_associated :content - + # eager load information about last updates, without loading text named_scope :with_updated_on, { :select => "#{WikiPage.table_name}.*, #{WikiContent.table_name}.updated_on", :joins => "LEFT JOIN #{WikiContent.table_name} ON #{WikiContent.table_name}.page_id = #{WikiPage.table_name}.id" } - + # Wiki pages that are protected by default DEFAULT_PROTECTED_PAGES = %w(sidebar) - + def after_initialize if new_record? && DEFAULT_PROTECTED_PAGES.include?(title.to_s.downcase) self.protected = true end end - + def visible?(user=User.current) !user.nil? && user.allowed_to?(:view_wiki_pages, project) end @@ -63,7 +63,7 @@ class WikiPage < ActiveRecord::Base end def before_save - self.title = Wiki.titleize(title) + self.title = Wiki.titleize(title) # Manage redirects if the title has changed if !@previous_title.blank? && (@previous_title != title) && !new_record? # Update redirects that point to the old title @@ -78,51 +78,51 @@ class WikiPage < ActiveRecord::Base @previous_title = nil end end - + def before_destroy # Remove redirects to this page wiki.redirects.find_all_by_redirects_to(title).each(&:destroy) end - + def pretty_title WikiPage.pretty_title(title) end - + def content_for_version(version=nil) result = content.versions.find_by_version(version.to_i) if version result ||= content result end - + def diff(version_to=nil, version_from=nil) version_to = version_to ? version_to.to_i : self.content.version version_from = version_from ? version_from.to_i : version_to - 1 version_to, version_from = version_from, version_to unless version_from < version_to - + content_to = content.versions.find_by_version(version_to) content_from = content.versions.find_by_version(version_from) - + (content_to && content_from) ? WikiDiff.new(content_to, content_from) : nil end - + def annotate(version=nil) version = version ? version.to_i : self.content.version c = content.versions.find_by_version(version) c ? WikiAnnotate.new(c) : nil end - + def self.pretty_title(str) (str && str.is_a?(String)) ? str.tr('_', ' ') : str end - + def project wiki.project end - + def text content.text if content end - + def updated_on unless @updated_on if time = read_attribute(:updated_on) @@ -137,20 +137,20 @@ class WikiPage < ActiveRecord::Base end @updated_on end - + # Returns true if usr is allowed to edit the page, otherwise false def editable_by?(usr) !protected? || usr.allowed_to?(:protect_wiki_pages, wiki.project) end - + def attachments_deletable?(usr=User.current) editable_by?(usr) && super(usr) end - + def parent_title @parent_title || (self.parent && self.parent.pretty_title) end - + def parent_title=(t) @parent_title = t parent_page = t.blank? ? nil : self.wiki.find_page(t) @@ -158,7 +158,7 @@ class WikiPage < ActiveRecord::Base end protected - + def validate errors.add(:parent_title, :invalid) if !@parent_title.blank? && parent.nil? errors.add(:parent_title, :circular_dependency) if parent && (parent == self || parent.ancestors.include?(self)) @@ -168,7 +168,7 @@ end class WikiDiff < Redmine::Helpers::Diff attr_reader :content_to, :content_from - + def initialize(content_to, content_from) @content_to = content_to @content_from = content_from @@ -178,7 +178,7 @@ end class WikiAnnotate attr_reader :lines, :content - + def initialize(content) @content = content current = content diff --git a/app/models/wiki_redirect.rb b/app/models/wiki_redirect.rb index b78319b5..1fe25e59 100644 --- a/app/models/wiki_redirect.rb +++ b/app/models/wiki_redirect.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 WikiRedirect < ActiveRecord::Base belongs_to :wiki - + validates_presence_of :title, :redirects_to validates_length_of :title, :redirects_to, :maximum => 255 end diff --git a/app/models/workflow.rb b/app/models/workflow.rb index 6ff86a92..3cc094ce 100644 --- a/app/models/workflow.rb +++ b/app/models/workflow.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 @@ class Workflow < ActiveRecord::Base belongs_to :new_status, :class_name => 'IssueStatus', :foreign_key => 'new_status_id' validates_presence_of :role, :old_status, :new_status - + # Returns workflow transitions count by tracker and role def self.count_by_tracker_and_role counts = connection.select_all("SELECT role_id, tracker_id, count(id) AS c FROM #{Workflow.table_name} GROUP BY role_id, tracker_id") roles = Role.find(:all, :order => 'builtin, position') trackers = Tracker.find(:all, :order => 'position') - + result = [] trackers.each do |tracker| t = [] @@ -33,7 +33,7 @@ class Workflow < ActiveRecord::Base end result << [tracker, t] end - + result end @@ -47,19 +47,19 @@ class Workflow < ActiveRecord::Base uniq. sort end - + # Copies workflows from source to targets def self.copy(source_tracker, source_role, target_trackers, target_roles) unless source_tracker.is_a?(Tracker) || source_role.is_a?(Role) raise ArgumentError.new("source_tracker or source_role must be specified") end - + target_trackers = [target_trackers].flatten.compact target_roles = [target_roles].flatten.compact - + target_trackers = Tracker.all if target_trackers.empty? target_roles = Role.all if target_roles.empty? - + target_trackers.each do |target_tracker| target_roles.each do |target_role| copy_one(source_tracker || target_tracker, @@ -69,17 +69,17 @@ class Workflow < ActiveRecord::Base end end end - + # Copies a single set of workflows from source to target def self.copy_one(source_tracker, source_role, target_tracker, target_role) unless source_tracker.is_a?(Tracker) && !source_tracker.new_record? && source_role.is_a?(Role) && !source_role.new_record? && target_tracker.is_a?(Tracker) && !target_tracker.new_record? && target_role.is_a?(Role) && !target_role.new_record? - + raise ArgumentError.new("arguments can not be nil or unsaved objects") end - + if source_tracker == target_tracker && source_role == target_role false else diff --git a/app/views/account/password_recovery.rhtml b/app/views/account/password_recovery.rhtml index e265ca8f..9ef7c8e1 100644 --- a/app/views/account/password_recovery.rhtml +++ b/app/views/account/password_recovery.rhtml @@ -12,4 +12,4 @@ <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %>

<%= submit_tag l(:button_save) %>

-<% end %> +<% end %> diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb index a2748cc9..cb957991 100644 --- a/app/views/activities/index.html.erb +++ b/app/views/activities/index.html.erb @@ -21,12 +21,12 @@ <%= content_tag('p', l(:label_no_data), :class => 'nodata') if @events_by_day.empty? %>
-<%= link_to_content_update('« ' + l(:label_previous), +<%= link_to_content_update('« ' + l(:label_previous), params.merge(:from => @date_to - @days - 1), :title => l(:label_date_from_to, :start => format_date(@date_to - 2*@days), :end => format_date(@date_to - @days - 1))) %>
-<%= link_to_content_update(l(:label_next) + ' »', +<%= link_to_content_update(l(:label_next) + ' »', params.merge(:from => @date_to + @days - 1), :title => l(:label_date_from_to, :start => format_date(@date_to), :end => format_date(@date_to + @days - 1))) unless @date_to >= Date.today %>
diff --git a/app/views/auth_sources/index.html.erb b/app/views/auth_sources/index.html.erb index 6e8b4d7d..5867be52 100644 --- a/app/views/auth_sources/index.html.erb +++ b/app/views/auth_sources/index.html.erb @@ -17,7 +17,7 @@ "> <%= link_to source.name, :action => 'edit', :id => source%> <%= source.auth_method_name %> - <%= source.host %> + <%= source.host %> <%= source.users.count %> <%= link_to l(:button_test), :action => 'test_connection', :id => source %> diff --git a/app/views/boards/index.rhtml b/app/views/boards/index.rhtml index 6310f942..7c79835e 100644 --- a/app/views/boards/index.rhtml +++ b/app/views/boards/index.rhtml @@ -20,7 +20,7 @@ <% if board.last_message %> <%= authoring board.last_message.created_on, board.last_message.author %>
- <%= link_to_message board.last_message %> + <%= link_to_message board.last_message %> <% end %>
diff --git a/app/views/boards/show.rhtml b/app/views/boards/show.rhtml index 595038e8..54c02c81 100644 --- a/app/views/boards/show.rhtml +++ b/app/views/boards/show.rhtml @@ -14,7 +14,7 @@ <% form_for :message, @message, :url => {:controller => 'messages', :action => 'new', :board_id => @board}, :html => {:multipart => true, :id => 'message-form'} do |f| %> <%= render :partial => 'messages/form', :locals => {:f => f} %>

<%= submit_tag l(:button_create) %> - <%= link_to_remote l(:label_preview), + <%= link_to_remote l(:label_preview), { :url => { :controller => 'messages', :action => 'preview', :board_id => @board }, :method => 'post', :update => 'preview', @@ -38,7 +38,7 @@ <%= sort_header_tag('created_on', :caption => l(:field_created_on)) %> <%= sort_header_tag('replies', :caption => l(:label_reply_plural)) %> <%= sort_header_tag('updated_on', :caption => l(:label_message_last)) %> - + <% @topics.each do |topic| %> diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb index b2d1c5cd..8de39447 100644 --- a/app/views/calendars/show.html.erb +++ b/app/views/calendars/show.html.erb @@ -19,14 +19,14 @@ <%= label_tag('year', l(:label_year)) %> <%= select_year(@year, :prefix => "year", :discard_type => true) %> -<%= link_to_remote l(:button_apply), +<%= link_to_remote l(:button_apply), { :url => { :set_filter => 1 }, :update => "content", :with => "Form.serialize('query_form')" }, :class => 'icon icon-checked' %> - + <%= link_to_remote l(:button_clear), - { :url => { :project_id => @project, :set_filter => 1 }, + { :url => { :project_id => @project, :set_filter => 1 }, :method => :put, :update => "content", }, :class => 'icon icon-reload' %> diff --git a/app/views/common/_calendar.rhtml b/app/views/common/_calendar.rhtml index 14d26bad..147c49b2 100644 --- a/app/views/common/_calendar.rhtml +++ b/app/views/common/_calendar.rhtml @@ -8,7 +8,7 @@ while day <= calendar.enddt %> <%= "#{(day+(11-day.cwday)%7).cweek}" if day.cwday == calendar.first_wday %> -

<%= day.day %>

+

<%= day.day %>

<% calendar.events_on(day).each do |i| %> <% if i.is_a? Issue %>
@@ -17,7 +17,7 @@ while day <= calendar.enddt %> <%= render_issue_tooltip i %>
<% else %> - + <%= h("#{i.project} -") unless @project && @project == i.project %> <%= link_to_version i%> diff --git a/app/views/common/_tabs.rhtml b/app/views/common/_tabs.rhtml index c99c6a9f..601977d1 100644 --- a/app/views/common/_tabs.rhtml +++ b/app/views/common/_tabs.rhtml @@ -17,11 +17,11 @@ <% tabs.each do |tab| -%> - <%= content_tag('div', render(:partial => tab[:partial], :locals => {:tab => tab} ), + <%= content_tag('div', render(:partial => tab[:partial], :locals => {:tab => tab} ), :id => "tab-content-#{tab[:name]}", :style => (tab[:name] != selected_tab ? 'display:none' : nil), :class => 'tab-content') %> diff --git a/app/views/context_menus/issues.html.erb b/app/views/context_menus/issues.html.erb index f0fa350a..71bac63b 100644 --- a/app/views/context_menus/issues.html.erb +++ b/app/views/context_menus/issues.html.erb @@ -10,7 +10,7 @@ <% end %> <% if @allowed_statuses.present? %> -
  • +
  • <%= l(:field_status) %>
      <% @statuses.each do |s| -%> @@ -22,7 +22,7 @@ <% end %> <% unless @trackers.nil? %> -
    • +
    • <%= l(:field_tracker) %>
        <% @trackers.each do |t| -%> @@ -33,7 +33,7 @@ <% end %> -
      • +
      • <%= l(:field_priority) %>
          <% @priorities.each do |p| -%> @@ -45,7 +45,7 @@ <% #TODO: allow editing versions when multiple projects %> <% unless @project.nil? || @project.shared_versions.open.empty? -%> -
        • +
        • <%= l(:field_fixed_version) %>
            <% @project.shared_versions.open.sort.each do |v| -%> @@ -58,7 +58,7 @@ <% end %> <% if @assignables.present? -%> -
          • +
          • <%= l(:field_assigned_to) %>
              <% @assignables.each do |u| -%> @@ -71,7 +71,7 @@ <% end %> <% unless @project.nil? || @project.issue_categories.empty? -%> -
            • +
            • <%= l(:field_category) %>
                <% @project.issue_categories.each do |u| -%> diff --git a/app/views/custom_fields/_form.rhtml b/app/views/custom_fields/_form.rhtml index 2900af90..ec265aca 100644 --- a/app/views/custom_fields/_form.rhtml +++ b/app/views/custom_fields/_form.rhtml @@ -9,10 +9,10 @@ function toggle_custom_field_format() { p_values = $("custom_field_possible_values"); p_searchable = $("custom_field_searchable"); p_default = $("custom_field_default_value"); - + p_default.setAttribute('type','text'); Element.show(p_default.parentNode); - + switch (format.value) { case "list": Element.hide(p_length.parentNode); @@ -65,7 +65,7 @@ function toggle_custom_field_format() {

                <%= f.select :field_format, custom_field_formats_for_select(@custom_field), {}, :onchange => "toggle_custom_field_format();", :disabled => !@custom_field.new_record? %>

                - <%= f.text_field :min_length, :size => 5, :no_label => true %> - + <%= f.text_field :min_length, :size => 5, :no_label => true %> - <%= f.text_field :max_length, :size => 5, :no_label => true %>
                (<%=l(:text_min_max_length_info)%>)

                <%= f.text_field :regexp, :size => 50 %>
                (<%=l(:text_regexp_info)%>)

                @@ -79,7 +79,7 @@ function toggle_custom_field_format() {

                <% case @custom_field.class.name when "IssueCustomField" %> - +
                <%=l(:label_tracker_plural)%> <% for tracker in @trackers %> <%= check_box_tag "custom_field[tracker_ids][]", tracker.id, (@custom_field.trackers.include? tracker) %> <%= tracker.name %> @@ -91,7 +91,7 @@ when "IssueCustomField" %>

                <%= f.check_box :is_for_all %>

                <%= f.check_box :is_filter %>

                <%= f.check_box :searchable %>

                - + <% when "UserCustomField" %>

                <%= f.check_box :is_required %>

                <%= f.check_box :visible %>

                @@ -107,7 +107,7 @@ when "IssueCustomField" %> <% else %>

                <%= f.check_box :is_required %>

                - + <% end %> <%= call_hook(:"view_custom_fields_form_#{@custom_field.type.to_s.underscore}", :custom_field => @custom_field, :form => f) %>
                diff --git a/app/views/custom_fields/edit.rhtml b/app/views/custom_fields/edit.rhtml index d8a94a95..bc266784 100644 --- a/app/views/custom_fields/edit.rhtml +++ b/app/views/custom_fields/edit.rhtml @@ -1,4 +1,4 @@ -

                <%= link_to l(:label_custom_field_plural), :controller => 'custom_fields', :action => 'index' %> +

                <%= link_to l(:label_custom_field_plural), :controller => 'custom_fields', :action => 'index' %> » <%= link_to l(@custom_field.type_name), :controller => 'custom_fields', :action => 'index', :tab => @custom_field.type %> » <%=h @custom_field.name %>

                diff --git a/app/views/documents/show.rhtml b/app/views/documents/show.rhtml index 63e32101..75854357 100644 --- a/app/views/documents/show.rhtml +++ b/app/views/documents/show.rhtml @@ -22,7 +22,7 @@

                <%= render :partial => 'attachments/form' %>

                <%= submit_tag l(:button_add) %> - <% end %> + <% end %> <% end %> <% html_title @document.title -%> diff --git a/app/views/enumerations/list.rhtml b/app/views/enumerations/list.rhtml index 62e3f648..64ab4f6b 100644 --- a/app/views/enumerations/list.rhtml +++ b/app/views/enumerations/list.rhtml @@ -20,7 +20,7 @@ <%= checked_image enumeration.active? %> <%= reorder_links('enumeration', {:action => 'update', :id => enumeration}) %> - <%= link_to l(:button_delete), { :action => 'destroy', :id => enumeration }, + <%= link_to l(:button_delete), { :action => 'destroy', :id => enumeration }, :method => :post, :confirm => l(:text_are_you_sure), :class => 'icon icon-del' %> diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 5a9a5e6f..f788db3e 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -16,7 +16,7 @@ -<% @containers.each do |container| %> +<% @containers.each do |container| %> <% next if container.attachments.empty? -%> <% if container.is_a?(Version) -%> @@ -25,7 +25,7 @@ <% end -%> - <% container.attachments.each do |file| %> + <% container.attachments.each do |file| %> "> <%= link_to_attachment file, :download => true, :title => file.description %> <%= format_time(file.created_on) %> @@ -36,7 +36,7 @@ <%= link_to(image_tag('delete.png'), {:controller => 'attachments', :action => 'destroy', :id => file}, :confirm => l(:text_are_you_sure), :method => :post) if delete_allowed %> - + <% end reset_cycle %> <% end %> diff --git a/app/views/files/new.html.erb b/app/views/files/new.html.erb index d9d1b6ee..8a3ae686 100644 --- a/app/views/files/new.html.erb +++ b/app/views/files/new.html.erb @@ -13,4 +13,4 @@

                <%= render :partial => 'attachments/form' %>

                <%= submit_tag l(:button_add) %> -<% end %> +<% end %> diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb index 8007bbab..0c024528 100644 --- a/app/views/gantts/show.html.erb +++ b/app/views/gantts/show.html.erb @@ -22,14 +22,14 @@ <%= select_year(@gantt.year_from, :prefix => "year", :discard_type => true) %> <%= hidden_field_tag 'zoom', @gantt.zoom %> -<%= link_to_remote l(:button_apply), +<%= link_to_remote l(:button_apply), { :url => { :set_filter => 1 }, :update => "content", :with => "Form.serialize('query_form')" }, :class => 'icon icon-checked' %> - + <%= link_to_remote l(:button_clear), - { :url => { :project_id => @project, :set_filter => 1 }, + { :url => { :project_id => @project, :set_filter => 1 }, :method => :put, :update => "content", }, :class => 'icon icon-reload' %> @@ -57,7 +57,7 @@ if @gantt.zoom >1 end end -# Width of the entire chart +# Width of the entire chart g_width = (@gantt.date_to - @gantt.date_from + 1)*zoom @gantt.render(:top => headers_height + 8, :zoom => zoom, :g_width => g_width, :subject_width => subject_width) @@ -90,25 +90,25 @@ t_height = g_height + headers_height
                 
                -<% +<% # # Months headers # month_f = @gantt.date_from left = 0 height = (show_weeks ? header_heigth : header_heigth + g_height) -@gantt.months.times do +@gantt.months.times do width = ((month_f >> 1) - month_f) * zoom - 1 %>
                <%= link_to "#{month_f.year}-#{month_f.month}", @gantt.params.merge(:year => month_f.year, :month => month_f.month), :title => "#{month_name(month_f.month)} #{month_f.year}"%>
                - <% + <% left = left + width + 1 month_f = month_f >> 1 end %> -<% +<% # # Weeks headers # @@ -124,7 +124,7 @@ if show_weeks width = (7 - @gantt.date_from.cwday + 1) * zoom-1 %>
                 
                - <% + <% left = left + width+1 end %> <% @@ -134,13 +134,13 @@ if show_weeks
                <%= week_f.cweek if width >= 16 %>
                - <% + <% left = left + width+1 week_f = week_f+7 end end %> -<% +<% # # Days headers # @@ -148,13 +148,13 @@ if show_days left = 0 height = g_height + header_heigth - 1 wday = @gantt.date_from.cwday - (@gantt.date_to - @gantt.date_from + 1).to_i.times do + (@gantt.date_to - @gantt.date_from + 1).to_i.times do width = zoom - 1 %>
                5 %>" class="gantt_hdr"> <%= day_name(wday).first %>
                - <% + <% left = left + width+1 wday = wday + 1 wday = 1 if wday > 7 diff --git a/app/views/groups/_users.html.erb b/app/views/groups/_users.html.erb index d7c462e1..33091ea3 100644 --- a/app/views/groups/_users.html.erb +++ b/app/views/groups/_users.html.erb @@ -28,7 +28,7 @@ <% if users.any? %> <% remote_form_for(:group, @group, :url => {:controller => 'groups', :action => 'add_users', :id => @group}, :method => :post) do |f| %>
                <%=l(:label_user_new)%> - +

                <%= label_tag "user_search", l(:label_user_search) %><%= text_field_tag 'user_search', nil %>

                <%= observe_field(:user_search, :frequency => 0.5, @@ -36,11 +36,11 @@ :url => { :controller => 'groups', :action => 'autocomplete_for_user', :id => @group }, :with => 'q') %> - +
                <%= principals_check_box_tags 'user_ids[]', users %>
                - +

                <%= submit_tag l(:button_add) %>

                <% end %> diff --git a/app/views/help/wiki_syntax_detailed.html.erb b/app/views/help/wiki_syntax_detailed.html.erb index b25911d0..26603f5f 100644 --- a/app/views/help/wiki_syntax_detailed.html.erb +++ b/app/views/help/wiki_syntax_detailed.html.erb @@ -253,9 +253,9 @@ To go live, all you need to add is a database and a web server. 3 def initialize(name) 4 @name = name.capitalize 5 end - 6 + 6 7 def salute - 8 puts "Hello #{@name}!" + 8 puts "Hello #{@name}!" 9 end 10 end diff --git a/app/views/issue_statuses/index.html.erb b/app/views/issue_statuses/index.html.erb index 03f76725..5bc139d8 100644 --- a/app/views/issue_statuses/index.html.erb +++ b/app/views/issue_statuses/index.html.erb @@ -4,7 +4,7 @@

                <%=l(:label_issue_status_plural)%>

                - + @@ -16,7 +16,7 @@ - + <% for status in @issue_statuses %> "> diff --git a/app/views/issues/_attributes.rhtml b/app/views/issues/_attributes.rhtml index e10858b0..7f5151df 100644 --- a/app/views/issues/_attributes.rhtml +++ b/app/views/issues/_attributes.rhtml @@ -13,18 +13,18 @@

                <%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), :include_blank => true %> <%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'), l(:label_issue_category_new), - 'category[name]', + 'category[name]', {:controller => 'issue_categories', :action => 'new', :project_id => @project}, - :title => l(:label_issue_category_new), + :title => l(:label_issue_category_new), :tabindex => 199) if authorize_for('issue_categories', 'new') %>

                <% end %> <% unless @issue.assignable_versions.empty? %>

                <%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), :include_blank => true %> <%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'), l(:label_version_new), - 'version[name]', + 'version[name]', {:controller => 'versions', :action => 'create', :project_id => @project}, - :title => l(:label_version_new), + :title => l(:label_version_new), :tabindex => 200) if authorize_for('versions', 'new') %>

                <% end %> diff --git a/app/views/issues/_edit.rhtml b/app/views/issues/_edit.rhtml index 6c9bc3d7..d376b36a 100644 --- a/app/views/issues/_edit.rhtml +++ b/app/views/issues/_edit.rhtml @@ -31,13 +31,13 @@ <% end %> <% end %> - +
                <%= l(:field_notes) %> <%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit' %> <%= wikitoolbar_for 'notes' %> <%= call_hook(:view_issues_edit_notes_bottom, { :issue => @issue, :notes => @notes, :form => f }) %>
                - +
                <%=l(:field_status)%><%=l(:button_sort)%>
                <%= link_to status.name, :action => 'edit', :id => status %>
                diff --git a/app/views/issues/_list_simple.rhtml b/app/views/issues/_list_simple.rhtml index dd7f4894..22e61478 100644 --- a/app/views/issues/_list_simple.rhtml +++ b/app/views/issues/_list_simple.rhtml @@ -1,13 +1,13 @@ <% if issues && issues.any? %> <% form_tag({}) do %> -
                +
                - + <% for issue in issues %> - @@ -25,7 +25,7 @@
                # <%=l(:field_project)%> <%=l(:field_tracker)%> <%=l(:field_subject)%>
                diff --git a/app/views/issues/_relations.rhtml b/app/views/issues/_relations.rhtml index f8535b82..e7672dca 100644 --- a/app/views/issues/_relations.rhtml +++ b/app/views/issues/_relations.rhtml @@ -17,7 +17,7 @@ <%= relation.other_issue(@issue).status.name %> <%= format_date(relation.other_issue(@issue).start_date) %> <%= format_date(relation.other_issue(@issue).due_date) %><%= link_to_remote(image_tag('delete.png'), { :url => {:controller => 'issue_relations', :action => 'destroy', :issue_id => @issue, :id => relation}, +<%= link_to_remote(image_tag('delete.png'), { :url => {:controller => 'issue_relations', :action => 'destroy', :issue_id => @issue, :id => relation}, :method => :post }, :title => l(:label_relation_delete)) if authorize_for('issue_relations', 'destroy') %>
                <% end %> -<% remote_form_for(:relation, @relation, +<% remote_form_for(:relation, @relation, :url => {:controller => 'issue_relations', :action => 'new', :issue_id => @issue}, :method => :post, :complete => "Form.Element.focus('relation_issue_to_id');", diff --git a/app/views/issues/bulk_edit.rhtml b/app/views/issues/bulk_edit.rhtml index e9525482..eceb11b8 100644 --- a/app/views/issues/bulk_edit.rhtml +++ b/app/views/issues/bulk_edit.rhtml @@ -20,18 +20,18 @@

                <% end %>

                - + <%= select_tag('issue[priority_id]', "" + options_from_collection_for_select(IssuePriority.all, :id, :name)) %>

                - + <%= select_tag('issue[assigned_to_id]', content_tag('option', l(:label_no_change_option), :value => '') + content_tag('option', l(:label_nobody), :value => 'none') + options_from_collection_for_select(@assignables, :id, :name)) %>

                <% if @project %>

                - + <%= select_tag('issue[category_id]', content_tag('option', l(:label_no_change_option), :value => '') + content_tag('option', l(:label_none), :value => 'none') + options_from_collection_for_select(@project.issue_categories, :id, :name)) %> @@ -40,7 +40,7 @@ <% #TODO: allow editing versions when multiple projects %> <% if @project %>

                - + <%= select_tag('issue[fixed_version_id]', content_tag('option', l(:label_no_change_option), :value => '') + content_tag('option', l(:label_none), :value => 'none') + version_options_for_select(@project.shared_versions.open.sort)) %> @@ -68,12 +68,12 @@ <%= text_field_tag 'issue[start_date]', '', :size => 10 %><%= calendar_for('issue_start_date') %>

                - + <%= text_field_tag 'issue[due_date]', '', :size => 10 %><%= calendar_for('issue_due_date') %>

                <% if Issue.use_field_for_done_ratio? %>

                - + <%= select_tag 'issue[done_ratio]', options_for_select([[l(:label_no_change_option), '']] + (0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %>

                <% end %> diff --git a/app/views/issues/index.api.rsb b/app/views/issues/index.api.rsb index 1ec2acc1..a299ff01 100644 --- a/app/views/issues/index.api.rsb +++ b/app/views/issues/index.api.rsb @@ -11,16 +11,16 @@ api.array :issues, api_meta(:total_count => @issue_count, :offset => @offset, :l api.category(:id => issue.category_id, :name => issue.category.name) unless issue.category.nil? api.fixed_version(:id => issue.fixed_version_id, :name => issue.fixed_version.name) unless issue.fixed_version.nil? api.parent(:id => issue.parent_id) unless issue.parent.nil? - + api.subject issue.subject api.description issue.description api.start_date issue.start_date api.due_date issue.due_date api.done_ratio issue.done_ratio api.estimated_hours issue.estimated_hours - + render_api_custom_values issue.custom_field_values, api - + api.created_on issue.created_on api.updated_on issue.updated_on end diff --git a/app/views/issues/index.rhtml b/app/views/issues/index.rhtml index ddd5d908..3a5c41c5 100644 --- a/app/views/issues/index.rhtml +++ b/app/views/issues/index.rhtml @@ -35,20 +35,20 @@

                - <%= link_to_remote l(:button_apply), + <%= link_to_remote l(:button_apply), { :url => { :set_filter => 1 }, :before => 'selectAllOptions("selected_columns");', :update => "content", :complete => "apply_filters_observer()", :with => "Form.serialize('query_form')" }, :class => 'icon icon-checked' %> - + <%= link_to_remote l(:button_clear), { :url => { :set_filter => 1, :project_id => @project }, :method => :get, :update => "content", }, :class => 'icon icon-reload' %> - + <% if @query.new_record? && User.current.allowed_to?(:save_queries, @project, :global => true) %> <%= link_to l(:button_save), {}, :onclick => "selectAllOptions('selected_columns'); $('query_form').submit(); return false;", :class => 'icon icon-save' %> <% end %> diff --git a/app/views/issues/new.rhtml b/app/views/issues/new.rhtml index b9d6f414..23b4770e 100644 --- a/app/views/issues/new.rhtml +++ b/app/views/issues/new.rhtml @@ -9,14 +9,14 @@ <%= submit_tag l(:button_create) %> <%= submit_tag l(:button_create_and_continue), :name => 'continue' %> - <%= link_to_remote l(:label_preview), + <%= link_to_remote l(:label_preview), { :url => preview_issue_path(:project_id => @project), :method => 'post', :update => 'preview', :with => "Form.serialize('issue-form')", :complete => "Element.scrollTo('preview')" }, :accesskey => accesskey(:preview) %> - + <%= javascript_tag "Form.Element.focus('issue_subject');" %> <% end %> diff --git a/app/views/issues/show.api.rsb b/app/views/issues/show.api.rsb index 40de41fb..12e5f78d 100644 --- a/app/views/issues/show.api.rsb +++ b/app/views/issues/show.api.rsb @@ -9,7 +9,7 @@ api.issue do api.category(:id => @issue.category_id, :name => @issue.category.name) unless @issue.category.nil? api.fixed_version(:id => @issue.fixed_version_id, :name => @issue.fixed_version.name) unless @issue.fixed_version.nil? api.parent(:id => @issue.parent_id) unless @issue.parent.nil? - + api.subject @issue.subject api.description @issue.description api.start_date @issue.start_date @@ -17,20 +17,20 @@ api.issue do api.done_ratio @issue.done_ratio api.estimated_hours @issue.estimated_hours api.spent_hours(@issue.spent_hours) if User.current.allowed_to?(:view_time_entries, @project) - + render_api_custom_values @issue.custom_field_values, api - + api.created_on @issue.created_on api.updated_on @issue.updated_on - + render_api_issue_children(@issue, api) if include_in_api_response?('children') - + api.array :relations do @relations.each do |relation| api.relation(:id => relation.id, :issue_id => relation.other_issue(@issue).id, :relation_type => relation.relation_type_for(@issue), :delay => relation.delay) end end if include_in_api_response?('relations') && @relations.present? - + api.array :changesets do @issue.changesets.each do |changeset| api.changeset :revision => changeset.revision do @@ -40,7 +40,7 @@ api.issue do end end end if include_in_api_response?('changesets') && User.current.allowed_to?(:view_changesets, @project) - + api.array :journals do @issue.journals.each do |journal| api.journal :id => journal.id do diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml index 8ff405bb..4b7daba7 100644 --- a/app/views/issues/show.rhtml +++ b/app/views/issues/show.rhtml @@ -4,8 +4,8 @@

                <%= avatar(@issue.author, :size => "50") %> - -
                + +
                <%= render_issue_subject_with_tree(@issue) %>

                @@ -51,7 +51,7 @@

                <%= link_to_remote_if_authorized(l(:button_quote), { :url => {:controller => 'journals', :action => 'new', :id => @issue} }, :class => 'icon icon-comment') %>
                - +

                <%=l(:field_description)%>

                <%= textilizable @issue, :description, :attachments => @issue.attachments %> diff --git a/app/views/journals/_notes_form.rhtml b/app/views/journals/_notes_form.rhtml index 610260b3..2b0a467c 100644 --- a/app/views/journals/_notes_form.rhtml +++ b/app/views/journals/_notes_form.rhtml @@ -3,7 +3,7 @@ :rows => (@journal.notes.blank? ? 10 : [[10, @journal.notes.length / 50].max, 100].min) %> <%= call_hook(:view_journals_notes_form_after_notes, { :journal => @journal}) %>

                <%= submit_tag l(:button_save) %> - <%= link_to_remote l(:label_preview), + <%= link_to_remote l(:label_preview), { :url => preview_issue_path(:project_id => @project, :id => @journal.issue), :method => 'post', :update => "journal_#{@journal.id}_preview", diff --git a/app/views/layouts/base.rhtml b/app/views/layouts/base.rhtml index cb701f93..ea485225 100644 --- a/app/views/layouts/base.rhtml +++ b/app/views/layouts/base.rhtml @@ -31,7 +31,7 @@ <%= content_tag('div', "#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}", :id => 'loggedas') if User.current.logged? %> <%= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%>

                - +
              <% if User.current.allowed_to?(:view_issues, @project) %> -
              +

              <%=l(:label_issue_tracking)%>

                - <% for tracker in @trackers %> -
              • <%= link_to tracker.name, :controller => 'issues', :action => 'index', :project_id => @project, - :set_filter => 1, + <% for tracker in @trackers %> +
              • <%= link_to tracker.name, :controller => 'issues', :action => 'index', :project_id => @project, + :set_filter => 1, "tracker_id" => tracker.id %>: <%= l(:label_x_open_issues_abbr_on_total, :count => @open_issues_by_tracker[tracker].to_i, :total => @total_issues_by_tracker[tracker].to_i) %> @@ -52,13 +52,13 @@
                <%= render :partial => 'members_box' %> - + <% if @news.any? && authorize_for('news', 'index') %>
                -

                <%=l(:label_news_latest)%>

                +

                <%=l(:label_news_latest)%>

                <%= render :partial => 'news/news', :collection => @news %>

                <%= link_to l(:label_news_view_all), :controller => 'news', :action => 'index', :project_id => @project %>

                -
                +
                <% end %> <%= call_hook(:view_projects_show_right, :project => @project) %>
              diff --git a/app/views/queries/_filters.rhtml b/app/views/queries/_filters.rhtml index 1fb59d34..1c67f580 100644 --- a/app/views/queries/_filters.rhtml +++ b/app/views/queries/_filters.rhtml @@ -8,17 +8,17 @@ function add_filter() { check_box.checked = true; toggle_filter(field); select.selectedIndex = 0; - + for (i=0; i <%= select_tag "op[#{field}]", options_for_select(operators_for_select(options[:type]), query.operator_for(field)), :id => "operators_#{field}", :onchange => "toggle_operator('#{field}');", :class => "select-small", :style => "vertical-align: top;" %> - +
              -

              <%= setting_check_box :mail_handler_api_enabled, +

              <%= setting_check_box :mail_handler_api_enabled, :onclick => "if (this.checked) { Form.Element.enable('settings_mail_handler_api_key'); } else { Form.Element.disable('settings_mail_handler_api_key'); }"%>

              <%= setting_text_field :mail_handler_api_key, :size => 30, diff --git a/app/views/settings/_projects.rhtml b/app/views/settings/_projects.rhtml index c1255bbe..bbe6b13a 100644 --- a/app/views/settings/_projects.rhtml +++ b/app/views/settings/_projects.rhtml @@ -3,13 +3,13 @@

              <%= setting_check_box :default_projects_public %>

              -

              <%= setting_multiselect(:default_projects_modules, +

              <%= setting_multiselect(:default_projects_modules, Redmine::AccessControl.available_project_modules.collect {|m| [l_or_humanize(m, :prefix => "project_module_"), m.to_s]}) %>

              <%= setting_check_box :sequential_project_identifiers %>

              <%= setting_select :new_project_user_role_id, - Role.find_all_givable.collect {|r| [r.name, r.id.to_s]}, + Role.find_all_givable.collect {|r| [r.name, r.id.to_s]}, :blank => "--- #{l(:actionview_instancetag_blank_option)} ---" %>

              diff --git a/app/views/settings/_repositories.rhtml b/app/views/settings/_repositories.rhtml index 7f892c2d..acdb40e5 100644 --- a/app/views/settings/_repositories.rhtml +++ b/app/views/settings/_repositories.rhtml @@ -3,7 +3,7 @@

              <%= setting_check_box :autofetch_changesets %>

              -

              <%= setting_check_box :sys_api_enabled, +

              <%= setting_check_box :sys_api_enabled, :onclick => "if (this.checked) { Form.Element.enable('settings_sys_api_key'); } else { Form.Element.disable('settings_sys_api_key'); }" %>

              <%= setting_text_field :sys_api_key, :size => 30, @@ -33,7 +33,7 @@

              <%= setting_check_box :commit_logtime_enabled, :onclick => "if (this.checked) { Form.Element.enable('settings_commit_logtime_activity_id'); } else { Form.Element.disable('settings_commit_logtime_activity_id'); }"%>

              -

              <%= setting_select :commit_logtime_activity_id, +

              <%= setting_select :commit_logtime_activity_id, [[l(:label_default), 0]] + TimeEntryActivity.shared.all.collect{|activity| [activity.name, activity.id.to_s]}, :disabled => !Setting.commit_logtime_enabled?%>

              diff --git a/app/views/users/index.rhtml b/app/views/users/index.rhtml index f7bf8e0d..cf1f9696 100644 --- a/app/views/users/index.rhtml +++ b/app/views/users/index.rhtml @@ -23,7 +23,7 @@  
              - +
              <%= sort_header_tag('login', :caption => l(:field_login)) %> <%= sort_header_tag('firstname', :caption => l(:field_firstname)) %> diff --git a/app/views/users/show.api.rsb b/app/views/users/show.api.rsb index a2e31acc..26d8a998 100644 --- a/app/views/users/show.api.rsb +++ b/app/views/users/show.api.rsb @@ -6,9 +6,9 @@ api.user do api.mail @user.mail if User.current.admin? || !@user.pref.hide_mail api.created_on @user.created_on api.last_login_on @user.last_login_on - + render_api_custom_values @user.visible_custom_field_values, api - + api.array :memberships do @memberships.each do |membership| api.membership do diff --git a/app/views/versions/_issue_counts.rhtml b/app/views/versions/_issue_counts.rhtml index 7ef8c4bc..71dc5787 100644 --- a/app/views/versions/_issue_counts.rhtml +++ b/app/views/versions/_issue_counts.rhtml @@ -1,7 +1,7 @@
              -<%= l(:label_issues_by, +<%= l(:label_issues_by, select_tag('status_by', status_by_options_for_select(criteria), :id => 'status_by_select', @@ -15,7 +15,7 @@ <% counts.each do |count| %>
              diff --git a/app/views/versions/index.html.erb b/app/views/versions/index.html.erb index d0c5dcac..2fded9c6 100644 --- a/app/views/versions/index.html.erb +++ b/app/views/versions/index.html.erb @@ -4,13 +4,13 @@

              <%= l(:label_no_data) %>

              <% else %>
              -<% @versions.each do |version| %> +<% @versions.each do |version| %>

              <%= tag 'a', :name => version.name %><%= link_to_version version %>

              <%= render :partial => 'versions/overview', :locals => {:version => version} %> <%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %> <% if (issues = @issues_by_version[version]) && issues.size > 0 %> - <% form_tag({}) do -%> + <% form_tag({}) do -%>
              - <%= link_to count[:group], {:controller => 'issues', + <%= link_to count[:group], {:controller => 'issues', :action => 'index', :project_id => version.project, :set_filter => 1, @@ -23,7 +23,7 @@ :fixed_version_id => version}.merge("#{criteria}_id".to_sym => count[:group]) %> - <%= progress_bar((count[:closed].to_f / count[:total])*100, + <%= progress_bar((count[:closed].to_f / count[:total])*100, :legend => "#{count[:closed]}/#{count[:total]}", :width => "#{(count[:total].to_f / max * 200).floor}px;") %>
              <%- issues.each do |issue| -%> diff --git a/app/views/watchers/_watchers.rhtml b/app/views/watchers/_watchers.rhtml index 8e361ede..4da8c0dd 100644 --- a/app/views/watchers/_watchers.rhtml +++ b/app/views/watchers/_watchers.rhtml @@ -1,5 +1,5 @@
              -<%= link_to_remote l(:button_add), +<%= link_to_remote l(:button_add), :url => {:controller => 'watchers', :action => 'new', :object_type => watched.class.name.underscore, @@ -9,7 +9,7 @@

              <%= l(:label_issue_watchers) %> (<%= watched.watcher_users.size %>)

              <% unless @watcher.nil? %> - <% remote_form_for(:watcher, @watcher, + <% remote_form_for(:watcher, @watcher, :url => {:controller => 'watchers', :action => 'new', :object_type => watched.class.name.underscore, diff --git a/app/views/welcome/index.rhtml b/app/views/welcome/index.rhtml index 2cc0bbdf..7de009cd 100644 --- a/app/views/welcome/index.rhtml +++ b/app/views/welcome/index.rhtml @@ -29,7 +29,7 @@
              <% end %> <%= call_hook(:view_welcome_index_right, :projects => @projects) %> - + <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, {:controller => 'news', :action => 'index', :key => User.current.rss_key, :format => 'atom'}, diff --git a/app/views/wiki/edit.rhtml b/app/views/wiki/edit.rhtml index 3abe4182..62933ae8 100644 --- a/app/views/wiki/edit.rhtml +++ b/app/views/wiki/edit.rhtml @@ -9,7 +9,7 @@


              <%= render :partial => 'attachments/form' %>

              <%= submit_tag l(:button_save) %> - <%= link_to_remote l(:label_preview), + <%= link_to_remote l(:label_preview), { :url => { :controller => 'wiki', :action => 'preview', :project_id => @project, :id => @page.title }, :method => :post, :update => 'preview', diff --git a/app/views/wiki/history.rhtml b/app/views/wiki/history.rhtml index fbfdea88..78598e3f 100644 --- a/app/views/wiki/history.rhtml +++ b/app/views/wiki/history.rhtml @@ -7,7 +7,7 @@

              - + diff --git a/app/views/wiki/show.rhtml b/app/views/wiki/show.rhtml index a594c6de..92ed3a47 100644 --- a/app/views/wiki/show.rhtml +++ b/app/views/wiki/show.rhtml @@ -14,10 +14,10 @@ <%= breadcrumb(@page.ancestors.reverse.collect {|parent| link_to h(parent.pretty_title), {:id => parent.title, :project_id => parent.project}}) %> <% if @content.version != @page.content.version %> -

              +

              <%= link_to(('« ' + l(:label_previous)), :action => 'show', :id => @page.title, :project_id => @page.project, :version => (@content.version - 1)) + " - " if @content.version > 1 %> <%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %> - <%= '(' + link_to('diff', :controller => 'wiki', :action => 'diff', :id => @page.title, :project_id => @page.project, :version => @content.version) + ')' if @content.version > 1 %> - + <%= '(' + link_to('diff', :controller => 'wiki', :action => 'diff', :id => @page.title, :project_id => @page.project, :version => @content.version) + ')' if @content.version > 1 %> - <%= link_to((l(:label_next) + ' »'), :action => 'show', :id => @page.title, :project_id => @page.project, :version => (@content.version + 1)) + " - " if @content.version < @page.content.version %> <%= link_to(l(:label_current_version), :action => 'show', :id => @page.title, :project_id => @page.project) %>
              diff --git a/app/views/workflows/_form.html.erb b/app/views/workflows/_form.html.erb index e5b54c07..e319d2dd 100644 --- a/app/views/workflows/_form.html.erb +++ b/app/views/workflows/_form.html.erb @@ -25,13 +25,13 @@

              <% for new_status in @statuses -%> <% end -%> diff --git a/app/views/workflows/copy.rhtml b/app/views/workflows/copy.rhtml index 2cecc841..a7a2bad0 100644 --- a/app/views/workflows/copy.rhtml +++ b/app/views/workflows/copy.rhtml @@ -7,14 +7,14 @@

              <%= l(:label_tracker) %>
              - <%= select_tag('source_tracker_id', + <%= select_tag('source_tracker_id', "" + - "" + + "" + options_from_collection_for_select(@trackers, 'id', 'name', @source_tracker && @source_tracker.id)) %>
              <%= l(:label_role) %>
              <%= select_tag('source_role_id', "" + - "" + + "" + options_from_collection_for_select(@roles, 'id', 'name', @source_role && @source_role.id)) %>

              diff --git a/app/views/workflows/edit.rhtml b/app/views/workflows/edit.rhtml index 575500f3..22ca1916 100644 --- a/app/views/workflows/edit.rhtml +++ b/app/views/workflows/edit.rhtml @@ -11,7 +11,7 @@ <%= select_tag 'tracker_id', options_from_collection_for_select(@trackers, "id", "name", @tracker && @tracker.id) %> - + <%= hidden_field_tag 'used_statuses_only', '0' %>

              @@ -26,7 +26,7 @@ <%= hidden_field_tag 'role_id', @role.id %>
              <%= render :partial => 'form', :locals => {:name => 'always', :workflows => @workflows['always']} %> - +
              <%= l(:label_additional_workflow_transitions_for_author) %>
              @@ -34,7 +34,7 @@
              <%= javascript_tag "hideFieldset($('author_workflows'))" unless @workflows['author'].present? %> - +
              <%= l(:label_additional_workflow_transitions_for_assignee) %>
              diff --git a/app/views/workflows/index.rhtml b/app/views/workflows/index.rhtml index 21287a22..f05386c9 100644 --- a/app/views/workflows/index.rhtml +++ b/app/views/workflows/index.rhtml @@ -14,7 +14,7 @@
              - + <% end %> diff --git a/config/boot.rb b/config/boot.rb index 11bee3b2..3666efeb 100644 --- a/config/boot.rb +++ b/config/boot.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/config/environment.rb b/config/environment.rb index a08c69b7..4751b8fb 100644 --- a/config/environment.rb +++ b/config/environment.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. #++ # Be sure to restart your web server when you modify this file. -# Uncomment below to force Rails into production mode when +# Uncomment below to force Rails into production mode when # you don't control web/app server and can't set it the proper way # ENV['RAILS_ENV'] ||= 'production' @@ -32,32 +32,32 @@ end Rails::Initializer.run do |config| # Settings in config/environments/* take precedence those specified here - + # Skip frameworks you're not going to use # config.frameworks -= [ :action_web_service, :action_mailer ] # Add additional load paths for sweepers config.autoload_paths += %W( #{RAILS_ROOT}/app/sweepers ) - # Force all environments to use the same logger level + # Force all environments to use the same logger level # (by default production uses :info, the others :debug) # config.log_level = :debug # Enable page/fragment caching by setting a file-based store # (remember to create the caching directory and make it readable to the application) # config.action_controller.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache" - + # Activate observers that should always be running # config.active_record.observers = :cacher, :garbage_collector config.active_record.observers = :journal_observer, :message_observer, :issue_observer, :news_observer, :document_observer, :wiki_content_observer, :comment_observer # Make Active Record use UTC-base instead of local time # config.active_record.default_timezone = :utc - + # Use Active Record's schema dumper instead of SQL when creating the test database # (enables use of different database adapters for development and test environments) # config.active_record.schema_format = :ruby - + # Deliveries are disabled by default. Do NOT modify this section. # Define your email configuration in configuration.yml instead. # It will automatically turn deliveries on diff --git a/config/environments/demo.rb b/config/environments/demo.rb index 3d977fba..44f5d863 100644 --- a/config/environments/demo.rb +++ b/config/environments/demo.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/config/environments/development.rb b/config/environments/development.rb index 49d58561..60253304 100644 --- a/config/environments/development.rb +++ b/config/environments/development.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/config/environments/production.rb b/config/environments/production.rb index abb83923..3aea2c61 100644 --- a/config/environments/production.rb +++ b/config/environments/production.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/config/environments/test.rb b/config/environments/test.rb index 8aa6e964..bbf32bc5 100644 --- a/config/environments/test.rb +++ b/config/environments/test.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. #++ @@ -29,7 +29,7 @@ config.action_controller.perform_caching = false config.action_mailer.perform_deliveries = true config.action_mailer.delivery_method = :test -config.action_controller.session = { +config.action_controller.session = { :key => "_test_session", :secret => "some secret phrase for the tests." } diff --git a/config/environments/test_pgsql.rb b/config/environments/test_pgsql.rb index a4ad500d..e86b0b52 100644 --- a/config/environments/test_pgsql.rb +++ b/config/environments/test_pgsql.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/config/environments/test_sqlite3.rb b/config/environments/test_sqlite3.rb index a4ad500d..e86b0b52 100644 --- a/config/environments/test_sqlite3.rb +++ b/config/environments/test_sqlite3.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/config/initializers/10-patches.rb b/config/initializers/10-patches.rb index e52d4044..b9257fc8 100644 --- a/config/initializers/10-patches.rb +++ b/config/initializers/10-patches.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,7 +17,7 @@ require 'active_record' module ActiveRecord class Base include Redmine::I18n - + # Translate attribute names for validation errors display def self.human_attribute_name(attr) l("field_#{attr.to_s.gsub(/_id$/, '')}") @@ -85,7 +85,7 @@ module AsynchronousMailer define_method("perform_delivery_async_#{type}") do |mail| Thread.start do send "perform_delivery_#{type}", mail - end + end end end end diff --git a/config/initializers/20-mime_types.rb b/config/initializers/20-mime_types.rb index 619f3090..0e2e3674 100644 --- a/config/initializers/20-mime_types.rb +++ b/config/initializers/20-mime_types.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/config/initializers/30-redmine.rb b/config/initializers/30-redmine.rb index cf761f4f..601b62bb 100644 --- a/config/initializers/30-redmine.rb +++ b/config/initializers/30-redmine.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/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 540c30a1..cc603c4d 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.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/config/initializers/inflections.rb b/config/initializers/inflections.rb index c0fa9da4..d89c2a78 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.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. #++ # Be sure to restart your server when you modify this file. -# Add new inflection rules using the following format +# Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' diff --git a/config/initializers/new_rails_defaults.rb b/config/initializers/new_rails_defaults.rb index fd36ce9d..325701e4 100644 --- a/config/initializers/new_rails_defaults.rb +++ b/config/initializers/new_rails_defaults.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/config/locales/bg.yml b/config/locales/bg.yml index e5e32151..e15ca31c 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -9,10 +9,10 @@ bg: default: "%d-%m-%Y" short: "%b %d" long: "%B %d, %Y" - + day_names: [Неделя, Понеделник, Вторник, Сряда, Четвъртък, Петък, Събота] abbr_day_names: [Нед, Пон, Вто, Сря, Чет, Пет, Съб] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, Януари, Февруари, Март, Април, Май, Юни, Юли, Август, Септември, Октомври, Ноември, Декември] abbr_month_names: [~, Яну, Фев, Мар, Апр, Май, Юни, Юли, Авг, Сеп, Окт, Ное, Дек] @@ -30,7 +30,7 @@ bg: long: "%B %d, %Y %H:%M" am: "am" pm: "pm" - + datetime: distance_in_words: half_a_minute: "half a minute" @@ -78,10 +78,10 @@ bg: format: precision: 1 delimiter: "" - storage_units: + storage_units: format: "%n %u" - units: - byte: + units: + byte: one: Byte other: Bytes kb: "KB" @@ -95,7 +95,7 @@ bg: array: sentence_connector: "и" skip_last_comma: false - + activerecord: errors: template: @@ -129,7 +129,7 @@ bg: cant_link_an_issue_with_a_descendant: "Една задача не може да бъде свързвана към своя подзадача" actionview_instancetag_blank_option: Изберете - + general_text_No: 'Не' general_text_Yes: 'Да' general_text_no: 'не' @@ -140,7 +140,7 @@ bg: general_csv_encoding: UTF-8 general_pdf_encoding: UTF-8 general_first_day_of_week: '1' - + notice_account_updated: Профилът е обновен успешно. notice_account_invalid_creditentials: Невалиден потребител или парола. notice_account_password_updated: Паролата е успешно променена. @@ -171,7 +171,7 @@ bg: notice_unable_delete_time_entry: Невъзможност за изтриване на запис на time log. notice_issue_done_ratios_updated: Обновен процент на завършените задачи. notice_gantt_chart_truncated: Мрежовият график е съкратен, понеже броят на обектите, които могат да бъдат показани е твърде голям (%{max}) - + error_can_t_load_default_data: "Грешка при зареждане на примерната информация: %{value}" error_scm_not_found: Несъществуващ обект в хранилището. error_scm_command_failed: "Грешка при опит за комуникация с хранилище: %{value}" @@ -190,7 +190,7 @@ bg: error_unable_delete_issue_status: Невъзможност за изтриване на състояние на задача error_unable_to_connect: Невъзможност за свързване с (%{value}) warning_attachments_not_saved: "%{count} файла не бяха записани." - + mail_subject_lost_password: "Вашата парола (%{value})" mail_body_lost_password: 'За да смените паролата си, използвайте следния линк:' mail_subject_register: "Активация на профил (%{value})" @@ -205,10 +205,10 @@ bg: mail_body_wiki_content_added: Wiki страницата '%{id}' беше добавена от %{author}. mail_subject_wiki_content_updated: "Wiki страницата '%{id}' не беше обновена" mail_body_wiki_content_updated: Wiki страницата '%{id}' беше обновена от %{author}. - + gui_validation_error: 1 грешка gui_validation_error_plural: "%{count} грешки" - + field_name: Име field_description: Описание field_summary: Анотация @@ -264,7 +264,7 @@ bg: field_port: Порт field_account: Профил field_base_dn: Base DN - field_attr_login: Атрибут Login + field_attr_login: Атрибут Login field_attr_firstname: Атрибут Първо име (Firstname) field_attr_lastname: Атрибут Фамилия (Lastname) field_attr_mail: Атрибут Email @@ -306,7 +306,7 @@ bg: field_text: Текстово поле field_visible: Видим field_warn_on_leaving_unsaved: Предупреди ме, когато напускам страница с незаписано съдържание - + setting_app_title: Заглавие setting_app_subtitle: Описание setting_welcome_text: Допълнителен текст @@ -365,7 +365,7 @@ bg: setting_commit_logtime_enabled: Разрешаване на отчитането на работното време setting_commit_logtime_activity_id: Дейност при отчитане на работното време setting_gantt_items_limit: Максимален брой обекти, които да се показват в мрежов график - + permission_add_project: Създаване на проект permission_add_subprojects: Създаване на подпроекти permission_edit_project: Редактиране на проект @@ -843,11 +843,11 @@ bg: button_quote: Цитат button_duplicate: Дублиране button_show: Показване - + status_active: активен status_registered: регистриран status_locked: заключен - + version_status_open: отворена version_status_locked: заключена version_status_closed: затворена diff --git a/config/locales/bs.yml b/config/locales/bs.yml index 2a18d88c..8f172a58 100644 --- a/config/locales/bs.yml +++ b/config/locales/bs.yml @@ -19,7 +19,7 @@ bs: - :day - :month - :year - + time: formats: default: "%A, %e. %B %Y, %H:%M" @@ -29,7 +29,7 @@ bs: am: "prijepodne" pm: "poslijepodne" - + datetime: distance_in_words: half_a_minute: "pola minute" @@ -100,13 +100,13 @@ bs: mb: "MB" gb: "GB" tb: "TB" - + # Used in array.to_sentence. support: array: sentence_connector: "i" skip_last_comma: false - + activerecord: errors: template: @@ -140,7 +140,7 @@ bs: cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" actionview_instancetag_blank_option: Molimo odaberite - + general_text_No: 'Da' general_text_Yes: 'Ne' general_text_no: 'ne' @@ -151,7 +151,7 @@ bs: general_csv_encoding: utf8 general_pdf_encoding: utf8 general_first_day_of_week: '7' - + notice_account_activated: Vaš nalog je aktiviran. Možete se prijaviti. notice_account_invalid_creditentials: Pogrešan korisnik ili lozinka notice_account_lost_email_sent: Email sa uputstvima o izboru nove šifre je poslat na vašu adresu. @@ -182,9 +182,9 @@ bs: error_scm_annotate: "Ova stavka ne postoji ili nije označena." error_issue_not_found_in_project: 'Aktivnost nije nađena ili ne pripada ovom projektu' - + warning_attachments_not_saved: "%{count} fajl(ovi) ne mogu biti snimljen(i)." - + mail_subject_lost_password: "Vaša %{value} lozinka" mail_body_lost_password: 'Za promjenu lozinke, kliknite na sljedeći link:' mail_subject_register: "Aktivirajte %{value} vaš korisnički račun" @@ -195,10 +195,10 @@ bs: mail_body_account_activation_request: "Novi korisnik (%{value}) se registrovao. Korisnički račun čeka vaše odobrenje za aktivaciju:" mail_subject_reminder: "%{count} aktivnost(i) u kašnjenju u narednim %{days} danima" mail_body_reminder: "%{count} aktivnost(i) koje su dodjeljenje vama u narednim %{days} danima:" - + gui_validation_error: 1 greška gui_validation_error_plural: "%{count} grešaka" - + field_name: Ime field_description: Opis field_summary: Pojašnjenje @@ -286,7 +286,7 @@ bs: field_watcher: Posmatrač field_identity_url: OpenID URL field_content: Sadržaj - + setting_app_title: Naslov aplikacije setting_app_subtitle: Podnaslov aplikacije setting_welcome_text: Tekst dobrodošlice @@ -330,7 +330,7 @@ bs: setting_file_max_size_displayed: Maksimalna veličina fajla kod prikaza razlika unutar fajla (inline) setting_repository_log_display_limit: Maksimalna veličina revizija prikazanih na log fajlu setting_openid: Omogući OpenID prijavu i registraciju - + permission_edit_project: Ispravke projekta permission_select_project_modules: Odaberi module projekta permission_manage_members: Upravljanje članovima @@ -379,7 +379,7 @@ bs: permission_edit_own_messages: Ispravka sopstvenih poruka permission_delete_messages: Prisanje poruka permission_delete_own_messages: Brisanje sopstvenih poruka - + project_module_issue_tracking: Praćenje aktivnosti project_module_time_tracking: Praćenje vremena project_module_news: Novosti @@ -388,7 +388,7 @@ bs: project_module_wiki: Wiki stranice project_module_repository: Repozitorij project_module_boards: Forumi - + label_user: Korisnik label_user_plural: Korisnici label_user_new: Novi korisnik @@ -703,7 +703,7 @@ bs: label_planning: Planiranje label_incoming_emails: Dolazni email-ovi label_generate_key: Generiši ključ - label_issue_watchers: Praćeno od + label_issue_watchers: Praćeno od label_example: Primjer label_display: Prikaz @@ -743,11 +743,11 @@ bs: button_watch: Notifikacija button_configure: Konfiguracija button_quote: Citat - + status_active: aktivan status_registered: registrovan status_locked: zaključan - + text_select_mail_notifications: Odaberi događaje za koje će se slati email notifikacija. text_regexp_info: npr. ^[A-Z0-9]+$ text_min_max_length_info: 0 znači bez restrikcije @@ -793,7 +793,7 @@ bs: text_repository_usernames_mapping: "Odaberi ili ispravi redmine korisnika mapiranog za svako korisničko ima nađeno u logu repozitorija.\nKorisnici sa istim imenom u redmineu i u repozitoruju se automatski mapiraju." text_diff_truncated: '... Ovaj prikaz razlike je odsječen pošto premašuje maksimalnu veličinu za prikaz' text_custom_field_possible_values_info: 'Jedna linija za svaku vrijednost' - + default_role_manager: Menadžer default_role_developer: Programer default_role_reporter: Reporter @@ -817,7 +817,7 @@ bs: default_priority_immediate: Odmah default_activity_design: Dizajn default_activity_development: Programiranje - + enumeration_issue_priorities: Prioritet aktivnosti enumeration_doc_categories: Kategorije dokumenata enumeration_activities: Operacije (utrošak vremena) diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 1f9384b6..98e76c27 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -1,4 +1,4 @@ -# Redmine catalan translation: +# Redmine catalan translation: # by Joan Duran ca: @@ -12,10 +12,10 @@ ca: default: "%d-%m-%Y" short: "%e de %b" long: "%a, %e de %b de %Y" - + day_names: [Diumenge, Dilluns, Dimarts, Dimecres, Dijous, Divendres, Dissabte] abbr_day_names: [dg, dl, dt, dc, dj, dv, ds] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, Gener, Febrer, Març, Abril, Maig, Juny, Juliol, Agost, Setembre, Octubre, Novembre, Desembre] abbr_month_names: [~, Gen, Feb, Mar, Abr, Mai, Jun, Jul, Ago, Set, Oct, Nov, Des] @@ -33,7 +33,7 @@ ca: long: "%a, %e de %b de %Y, %H:%M" am: "am" pm: "pm" - + datetime: distance_in_words: half_a_minute: "mig minut" @@ -92,13 +92,13 @@ ca: gb: "GB" tb: "TB" - + # Used in array.to_sentence. support: array: sentence_connector: "i" skip_last_comma: false - + activerecord: errors: template: @@ -132,7 +132,7 @@ ca: cant_link_an_issue_with_a_descendant: "Un assumpte no es pot enllaçar a una de les seves subtasques" actionview_instancetag_blank_option: Seleccioneu - + general_text_No: 'No' general_text_Yes: 'Si' general_text_no: 'no' @@ -143,7 +143,7 @@ ca: general_csv_encoding: ISO-8859-15 general_pdf_encoding: ISO-8859-15 general_first_day_of_week: '1' - + notice_account_updated: "El compte s'ha actualitzat correctament." notice_account_invalid_creditentials: Usuari o contrasenya invàlid notice_account_password_updated: "La contrasenya s'ha modificat correctament." @@ -172,7 +172,7 @@ ca: notice_unable_delete_version: "No s'ha pogut suprimir la versió." notice_unable_delete_time_entry: "No s'ha pogut suprimir l'entrada del registre de temps." notice_issue_done_ratios_updated: "S'ha actualitzat el tant per cent dels assumptes." - + error_can_t_load_default_data: "No s'ha pogut carregar la configuració predeterminada: %{value} " error_scm_not_found: "No s'ha trobat l'entrada o la revisió en el dipòsit." error_scm_command_failed: "S'ha produït un error en intentar accedir al dipòsit: %{value}" @@ -191,7 +191,7 @@ ca: error_unable_delete_issue_status: "No s'ha pogut suprimir l'estat de l'assumpte" error_unable_to_connect: "No s'ha pogut connectar (%{value})" warning_attachments_not_saved: "No s'han pogut desar %{count} fitxers." - + mail_subject_lost_password: "Contrasenya de %{value}" mail_body_lost_password: "Per a canviar la contrasenya, feu clic en l'enllaç següent:" mail_subject_register: "Activació del compte de %{value}" @@ -206,17 +206,17 @@ ca: mail_body_wiki_content_added: "En %{author} ha afegit la pàgina wiki «%{id}»." mail_subject_wiki_content_updated: "S'ha actualitzat la pàgina wiki «%{id}»" mail_body_wiki_content_updated: "En %{author} ha actualitzat la pàgina wiki «%{id}»." - + gui_validation_error: 1 error gui_validation_error_plural: "%{count} errors" - + field_name: Nom field_description: Descripció field_summary: Resum field_is_required: Necessari field_firstname: Nom field_lastname: Cognom - field_mail: Correu electrònic + field_mail: Correu electrònic field_filename: Fitxer field_filesize: Mida field_downloads: Baixades @@ -302,7 +302,7 @@ ca: field_group_by: "Agrupa els resultats per" field_sharing: Compartició field_parent_issue: "Tasca pare" - + setting_app_title: "Títol de l'aplicació" setting_app_subtitle: "Subtítol de l'aplicació" setting_welcome_text: Text de benvinguda @@ -356,7 +356,7 @@ ca: setting_start_of_week: "Inicia les setmanes en" setting_rest_api_enabled: "Habilita el servei web REST" setting_cache_formatted_text: Cache formatted text - + permission_add_project: "Crea projectes" permission_add_subprojects: "Crea subprojectes" permission_edit_project: Edita el projecte @@ -412,7 +412,7 @@ ca: permission_delete_own_messages: Suprimeix els missatges propis permission_export_wiki_pages: "Exporta les pàgines wiki" permission_manage_subtasks: "Gestiona subtasques" - + project_module_issue_tracking: "Seguidor d'assumptes" project_module_time_tracking: Seguidor de temps project_module_news: Noticies @@ -423,7 +423,7 @@ ca: project_module_boards: Taulers project_module_calendar: Calendari project_module_gantt: Gantt - + label_user: Usuari label_user_plural: Usuaris label_user_new: Usuari nou @@ -608,7 +608,7 @@ ca: label_this_year: aquest any label_date_range: Abast de les dates label_less_than_ago: fa menys de - label_more_than_ago: fa més de + label_more_than_ago: fa més de label_ago: fa label_contains: conté label_not_contains: no conté @@ -781,7 +781,7 @@ ca: label_profile: Perfil label_subtask_plural: Subtasques label_project_copy_notifications: "Envia notificacions de correu electrònic durant la còpia del projecte" - + button_login: Entra button_submit: Tramet button_save: Desa @@ -825,17 +825,17 @@ ca: button_quote: Cita button_duplicate: Duplica button_show: Mostra - + status_active: actiu status_registered: informat status_locked: bloquejat - + version_status_open: oberta version_status_locked: bloquejada version_status_closed: tancada field_active: Actiu - + text_select_mail_notifications: "Seleccioneu les accions per les quals s'hauria d'enviar una notificació per correu electrònic." text_regexp_info: ex. ^[A-Z0-9]+$ text_min_max_length_info: 0 significa sense restricció @@ -893,7 +893,7 @@ ca: text_own_membership_delete_confirmation: "Esteu a punt de suprimir algun o tots els vostres permisos i potser no podreu editar més aquest projecte.\nSegur que voleu continuar?" text_zoom_in: Redueix text_zoom_out: Amplia - + default_role_manager: Gestor default_role_developer: Desenvolupador default_role_reporter: Informador @@ -917,7 +917,7 @@ ca: default_priority_immediate: Immediata default_activity_design: Disseny default_activity_development: Desenvolupament - + enumeration_issue_priorities: Prioritat dels assumptes enumeration_doc_categories: Categories del document enumeration_activities: Activitats (seguidor de temps) diff --git a/config/locales/cs.yml b/config/locales/cs.yml index 225c25bf..821ae8ec 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -13,10 +13,10 @@ cs: default: "%Y-%m-%d" short: "%b %d" long: "%B %d, %Y" - + day_names: [Neděle, Pondělí, Úterý, Středa, Čtvrtek, Pátek, Sobota] abbr_day_names: [Ne, Po, Út, St, Čt, Pá, So] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, Leden, Únor, Březen, Duben, Květen, Červen, Červenec, Srpen, Září, Říjen, Listopad, Prosinec] abbr_month_names: [~, Led, Úno, Bře, Dub, Kvě, Čer, Čec, Srp, Zář, Říj, Lis, Pro] @@ -34,7 +34,7 @@ cs: long: "%B %d, %Y %H:%M" am: "dop." pm: "odp." - + datetime: distance_in_words: half_a_minute: "půl minuty" @@ -75,7 +75,7 @@ cs: number: # Výchozí formát pro čísla format: - separator: "." + separator: "." delimiter: "" precision: 3 human: @@ -93,13 +93,13 @@ cs: gb: "GB" tb: "TB" - + # Used in array.to_sentence. support: array: sentence_connector: "a" skip_last_comma: false - + activerecord: errors: template: @@ -133,7 +133,7 @@ cs: cant_link_an_issue_with_a_descendant: "Úkol nemůže být spojen s jedním z jeho dílčích úkolů" actionview_instancetag_blank_option: Prosím vyberte - + general_text_No: 'Ne' general_text_Yes: 'Ano' general_text_no: 'ne' @@ -144,7 +144,7 @@ cs: general_csv_encoding: UTF-8 general_pdf_encoding: UTF-8 general_first_day_of_week: '1' - + notice_account_updated: Účet byl úspěšně změněn. notice_account_invalid_creditentials: Chybné jméno nebo heslo notice_account_password_updated: Heslo bylo úspěšně změněno. @@ -175,7 +175,7 @@ cs: notice_unable_delete_time_entry: Nelze smazat čas ze záznamu. notice_issue_done_ratios_updated: Koeficienty dokončení úkolu byly aktualizovány. notice_gantt_chart_truncated: Graf byl oříznut, počet položek přesáhl limit pro zobrazení (%{max}) - + error_can_t_load_default_data: "Výchozí konfigurace nebyla nahrána: %{value}" error_scm_not_found: "Položka a/nebo revize neexistují v repozitáři." error_scm_command_failed: "Při pokusu o přístup k repozitáři došlo k chybě: %{value}" @@ -194,7 +194,7 @@ cs: error_unable_delete_issue_status: Nelze smazat stavy úkolů error_unable_to_connect: Nelze se připojit (%{value}) warning_attachments_not_saved: "%{count} soubor(ů) nebylo možné uložit." - + mail_subject_lost_password: "Vaše heslo (%{value})" mail_body_lost_password: 'Pro změnu vašeho hesla klikněte na následující odkaz:' mail_subject_register: "Aktivace účtu (%{value})" @@ -209,10 +209,10 @@ cs: mail_body_wiki_content_added: "'%{id}' Wiki stránka byla přidána od %{author}." mail_subject_wiki_content_updated: "'%{id}' Wiki stránka byla aktualizována" mail_body_wiki_content_updated: "'%{id}' Wiki stránka byla aktualizována od %{author}." - + gui_validation_error: 1 chyba gui_validation_error_plural: "%{count} chyb(y)" - + field_name: Název field_description: Popis field_summary: Přehled @@ -309,7 +309,7 @@ cs: field_assigned_to_role: Role přiřaditele field_text: Textové pole field_visible: Viditelný - + setting_app_title: Název aplikace setting_app_subtitle: Podtitulek aplikace setting_welcome_text: Uvítací text @@ -335,7 +335,7 @@ cs: setting_time_format: Formát času setting_cross_project_issue_relations: Povolit vazby úkolů napříč projekty setting_issue_list_default_columns: Výchozí sloupce zobrazené v seznamu úkolů - setting_repositories_encodings: Kódování + setting_repositories_encodings: Kódování setting_commit_logs_encoding: Kódování zpráv při commitu setting_emails_header: Hlavička emailů setting_emails_footer: Patička emailů @@ -368,7 +368,7 @@ cs: setting_commit_logtime_enabled: Povolit zapisování času setting_commit_logtime_activity_id: Aktivita pro zapsaný čas setting_gantt_items_limit: Maximální počet položek zobrazený na ganttově grafu - + permission_add_project: Vytvořit projekt permission_add_subprojects: Vytvořit podprojekty permission_edit_project: Úprava projektů @@ -424,7 +424,7 @@ cs: permission_delete_own_messages: Smazat vlastní zprávy permission_export_wiki_pages: Exportovat Wiki stránky permission_manage_subtasks: Spravovat podúkoly - + project_module_issue_tracking: Sledování úkolů project_module_time_tracking: Sledování času project_module_news: Novinky @@ -435,7 +435,7 @@ cs: project_module_boards: Diskuse project_module_calendar: Kalendář project_module_gantt: Gantt - + label_user: Uživatel label_user_plural: Uživatelé label_user_new: Nový uživatel @@ -793,13 +793,13 @@ cs: label_display_used_statuses_only: Zobrazit pouze stavy které jsou použité touto frontou label_api_access_key: API přístupový klíč label_missing_api_access_key: Chybějící přístupový klíč API - label_api_access_key_created_on: API přístupový klíč vytvořen %{value} + label_api_access_key_created_on: API přístupový klíč vytvořen %{value} label_profile: Profil label_subtask_plural: Podúkol label_project_copy_notifications: Odeslat email oznámení v průběhu kopie projektu label_principal_search: "Hledat uživatele nebo skupinu:" label_user_search: "Hledat uživatele:" - + button_login: Přihlásit button_submit: Potvrdit button_save: Uložit @@ -844,17 +844,17 @@ cs: button_quote: Citovat button_duplicate: Duplikát button_show: Zobrazit - + status_active: aktivní status_registered: registrovaný status_locked: uzamčený - + version_status_open: otevřený version_status_locked: uzamčený version_status_closed: zavřený - + field_active: Aktivní - + text_select_mail_notifications: Vyberte akci při které bude zasláno upozornění emailem. text_regexp_info: např. ^[A-Z0-9]+$ text_min_max_length_info: 0 znamená bez limitu @@ -914,7 +914,7 @@ cs: text_own_membership_delete_confirmation: "Chystáte se odebrat si některá nebo všechny svá oprávnění a potom již nemusíte být schopni upravit tento projekt.\nOpravdu chcete pokračovat?" text_zoom_in: Přiblížit text_zoom_out: Oddálit - + default_role_manager: Manažer default_role_developer: Vývojář default_role_reporter: Reportér @@ -938,7 +938,7 @@ cs: default_priority_immediate: Okamžitá default_activity_design: Návhr default_activity_development: Vývoj - + enumeration_issue_priorities: Priority úkolů enumeration_doc_categories: Kategorie dokumentů enumeration_activities: Aktivity (sledování času) @@ -1104,7 +1104,7 @@ cs: label_display_used_statuses_only: Zobrazit pouze stavy které jsou použité touto frontou label_revision_id: Revize %{value} label_api_access_key: API přístupový klíč - label_api_access_key_created_on: API přístupový klíč vytvořen %{value} + label_api_access_key_created_on: API přístupový klíč vytvořen %{value} label_feeds_access_key: RSS přístupový klíč notice_api_access_key_reseted: Váš API přístupový klíč byl resetován. setting_rest_api_enabled: Zapnout službu REST diff --git a/config/locales/da.yml b/config/locales/da.yml index ffdf8863..990036c7 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -89,7 +89,7 @@ da: # precision: human: format: - # separator: + # separator: delimiter: "" precision: 1 storage_units: @@ -144,9 +144,9 @@ da: one: "En fejl forhindrede %{model} i at blive gemt" other: "%{count} fejl forhindrede denne %{model} i at blive gemt" body: "Der var problemer med følgende felter:" - + actionview_instancetag_blank_option: Vælg venligst - + general_text_No: 'Nej' general_text_Yes: 'Ja' general_text_no: 'nej' @@ -156,7 +156,7 @@ da: general_csv_encoding: ISO-8859-1 general_pdf_encoding: ISO-8859-1 general_first_day_of_week: '1' - + notice_account_updated: Kontoen er opdateret. notice_account_invalid_creditentials: Ugyldig bruger og/eller kodeord notice_account_password_updated: Kodeordet er opdateret. @@ -180,11 +180,11 @@ da: notice_no_issue_selected: "Ingen sag er valgt! Vælg venligst hvilke emner du vil rette." notice_account_pending: "Din konto er oprettet, og afventer administrators godkendelse." notice_default_data_loaded: Standardopsætningen er indlæst. - + error_can_t_load_default_data: "Standardopsætning kunne ikke indlæses: %{value}" error_scm_not_found: "Adgang nægtet og/eller revision blev ikke fundet i det valgte repository." error_scm_command_failed: "En fejl opstod under forbindelsen til det valgte repository: %{value}" - + mail_subject_lost_password: "Dit %{value} kodeord" mail_body_lost_password: 'For at ændre dit kodeord, klik på dette link:' mail_subject_register: "%{value} kontoaktivering" @@ -193,10 +193,10 @@ da: mail_body_account_information: Din kontoinformation mail_subject_account_activation_request: "%{value} kontoaktivering" mail_body_account_activation_request: "En ny bruger (%{value}) er registreret. Godkend venligst kontoen:" - + gui_validation_error: 1 fejl gui_validation_error_plural: "%{count} fejl" - + field_name: Navn field_description: Beskrivelse field_summary: Sammenfatning @@ -278,7 +278,7 @@ da: field_time_zone: Tidszone field_searchable: Søgbar field_default_value: Standardværdi - + setting_app_title: Applikationstitel setting_app_subtitle: Applikationsundertekst setting_welcome_text: Velkomsttekst @@ -306,7 +306,7 @@ da: setting_emails_footer: Email-fodnote setting_protocol: Protokol setting_user_format: Brugervisningsformat - + project_module_issue_tracking: Sagssøgning project_module_time_tracking: Tidsstyring project_module_news: Nyheder @@ -315,7 +315,7 @@ da: project_module_wiki: Wiki project_module_repository: Repository project_module_boards: Fora - + label_user: Bruger label_user_plural: Brugere label_user_new: Ny bruger @@ -613,7 +613,7 @@ da: label_plugins: Plugins label_ldap_authentication: LDAP-godkendelse label_downloads_abbr: D/L - + button_login: Login button_submit: Send button_save: Gem @@ -651,11 +651,11 @@ da: button_annotate: Annotér button_update: Opdatér button_configure: Konfigurér - + status_active: aktiv status_registered: registreret status_locked: låst - + text_select_mail_notifications: Vælg handlinger der skal sendes email besked for. text_regexp_info: f.eks. ^[A-ZÆØÅ0-9]+$ text_min_max_length_info: 0 betyder ingen begrænsninger @@ -688,7 +688,7 @@ da: text_default_administrator_account_changed: Standard administratorkonto ændret text_file_repository_writable: Filarkiv er skrivbar text_rmagick_available: RMagick tilgængelig (valgfri) - + default_role_manager: Leder default_role_developer: Udvikler default_role_reporter: Rapportør @@ -712,11 +712,11 @@ da: default_priority_immediate: Omgående default_activity_design: Design default_activity_development: Udvikling - + enumeration_issue_priorities: Sagsprioriteter enumeration_doc_categories: Dokumentkategorier enumeration_activities: Aktiviteter (tidsstyring) - + label_add_another_file: Tilføj endnu en fil label_chronological_order: I kronologisk rækkefølge setting_activity_days_default: Antal dage der vises under projektaktivitet @@ -785,7 +785,7 @@ da: permission_add_messages: Opret beskeder permission_edit_issue_notes: Redigér noter permission_manage_news: Administrér nyheder - text_plugin_assets_writable: Der er skriverettigheder til plugin assets folderen + text_plugin_assets_writable: Der er skriverettigheder til plugin assets folderen label_display: Vis label_and_its_subprojects: "%{value} og dets underprojekter" permission_view_calendar: Se kalender diff --git a/config/locales/de.yml b/config/locales/de.yml index 1e7b5f9b..f252aef7 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -104,13 +104,13 @@ de: gb: "GB" tb: "TB" - + # Used in array.to_sentence. support: array: sentence_connector: "und" skip_last_comma: true - + activerecord: errors: template: @@ -146,7 +146,7 @@ de: cant_link_an_issue_with_a_descendant: "Ein Ticket kann nicht mit einer ihrer Unteraufgaben verlinkt werden" actionview_instancetag_blank_option: Bitte auswählen - + general_text_No: 'Nein' general_text_Yes: 'Ja' general_text_no: 'nein' @@ -205,7 +205,7 @@ de: error_unable_delete_issue_status: "Der Ticket-Status konnte nicht gelöscht werden." error_unable_to_connect: Fehler beim Verbinden (%{value}) warning_attachments_not_saved: "%{count} Datei(en) konnten nicht gespeichert werden." - + mail_subject_lost_password: "Ihr %{value} Kennwort" mail_body_lost_password: 'Benutzen Sie den folgenden Link, um Ihr Kennwort zu ändern:' mail_subject_register: "%{value} Kontoaktivierung" @@ -437,7 +437,7 @@ de: project_module_boards: Foren project_module_calendar: Kalender project_module_gantt: Gantt - + label_user: Benutzer label_user_plural: Benutzer label_user_new: Neuer Benutzer @@ -797,7 +797,7 @@ de: label_project_copy_notifications: Sende Mailbenachrichtigungen beim Kopieren des Projekts. label_principal_search: "Nach Benutzer oder Gruppe suchen:" label_user_search: "Nach Benutzer suchen:" - + button_login: Anmelden button_submit: OK button_save: Speichern @@ -842,17 +842,17 @@ de: button_quote: Zitieren button_duplicate: Duplizieren button_show: Anzeigen - + status_active: aktiv status_registered: angemeldet status_locked: gesperrt - + version_status_open: offen version_status_locked: gesperrt version_status_closed: abgeschlossen field_active: Aktiv - + text_select_mail_notifications: Bitte wählen Sie die Aktionen aus, für die eine Mailbenachrichtigung gesendet werden soll. text_regexp_info: z. B. ^[A-Z0-9]+$ text_min_max_length_info: 0 heißt keine Beschränkung @@ -911,7 +911,7 @@ de: text_own_membership_delete_confirmation: "Sie sind dabei, einige oder alle Ihre Berechtigungen zu entfernen. Es ist möglich, dass Sie danach das Projekt nicht mehr ansehen oder bearbeiten dürfen.\nSind Sie sicher, dass Sie dies tun möchten?" text_zoom_in: Zoom in text_zoom_out: Zoom out - + default_role_manager: Manager default_role_developer: Entwickler default_role_reporter: Reporter @@ -935,7 +935,7 @@ de: default_priority_immediate: Sofort default_activity_design: Design default_activity_development: Entwicklung - + enumeration_issue_priorities: Ticket-Prioritäten enumeration_doc_categories: Dokumentenkategorien enumeration_activities: Aktivitäten (Zeiterfassung) diff --git a/config/locales/el.yml b/config/locales/el.yml index e4d012b8..d0ab0d10 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -11,10 +11,10 @@ el: default: "%m/%d/%Y" short: "%b %d" long: "%B %d, %Y" - + day_names: [Κυριακή, Δευτέρα, Τρίτη, Τετάρτη, Πέμπτη, Παρασκευή, Σάββατο] abbr_day_names: [Κυρ, Δευ, Τρι, Τετ, Πεμ, Παρ, Σαβ] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, Ιανουάριος, Φεβρουάριος, Μάρτιος, Απρίλιος, Μάϊος, Ιούνιος, Ιούλιος, Αύγουστος, Σεπτέμβριος, Οκτώβριος, Νοέμβριος, Δεκέμβριος] abbr_month_names: [~, Ιαν, Φεβ, Μαρ, Απρ, Μαϊ, Ιον, Ιολ, Αυγ, Σεπ, Οκτ, Νοε, Δεκ] @@ -32,7 +32,7 @@ el: long: "%B %d, %Y %H:%M" am: "πμ" pm: "μμ" - + datetime: distance_in_words: half_a_minute: "μισό λεπτό" @@ -69,23 +69,23 @@ el: almost_x_years: one: "almost 1 year" other: "almost %{count} years" - + number: format: separator: "." delimiter: "" precision: 3 - human: - format: + human: + format: precision: 1 delimiter: "" - storage_units: + storage_units: format: "%n %u" - units: + units: kb: KB tb: TB gb: GB - byte: + byte: one: Byte other: Bytes mb: MB @@ -95,7 +95,7 @@ el: array: sentence_connector: "and" skip_last_comma: false - + activerecord: errors: template: @@ -129,7 +129,7 @@ el: cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" actionview_instancetag_blank_option: Παρακαλώ επιλέξτε - + general_text_No: 'Όχι' general_text_Yes: 'Ναι' general_text_no: 'όχι' @@ -140,7 +140,7 @@ el: general_csv_encoding: UTF-8 general_pdf_encoding: UTF-8 general_first_day_of_week: '7' - + notice_account_updated: Ο λογαριασμός ενημερώθηκε επιτυχώς. notice_account_invalid_creditentials: Άκυρο όνομα χρήστη ή κωδικού πρόσβασης notice_account_password_updated: Ο κωδικός πρόσβασης ενημερώθηκε επιτυχώς. @@ -154,7 +154,7 @@ el: notice_successful_update: Επιτυχής ενημέρωση. notice_successful_delete: Επιτυχής διαγραφή. notice_successful_connection: Επιτυχής σύνδεση. - notice_file_not_found: Η σελίδα που ζητήσατε δεν υπάρχει ή έχει αφαιρεθεί. + notice_file_not_found: Η σελίδα που ζητήσατε δεν υπάρχει ή έχει αφαιρεθεί. notice_locking_conflict: Τα δεδομένα έχουν ενημερωθεί από άλλο χρήστη. notice_not_authorized: Δεν έχετε δικαίωμα πρόσβασης σε αυτή τη σελίδα. notice_email_sent: "Ένα μήνυμα ηλεκτρονικού ταχυδρομείου εστάλη στο %{value}" @@ -165,7 +165,7 @@ el: notice_account_pending: "Ο λογαριασμός σας έχει δημιουργηθεί και είναι σε στάδιο έγκρισης από τον διαχειριστή." notice_default_data_loaded: Οι προεπιλεγμένες ρυθμίσεις φορτώθηκαν επιτυχώς. notice_unable_delete_version: Αδύνατον να διαγραφεί η έκδοση. - + error_can_t_load_default_data: "Οι προεπιλεγμένες ρυθμίσεις δεν μπόρεσαν να φορτωθούν:: %{value}" error_scm_not_found: "Η εγγραφή ή η αναθεώρηση δεν βρέθηκε στο αποθετήριο." error_scm_command_failed: "Παρουσιάστηκε σφάλμα κατά την προσπάθεια πρόσβασης στο αποθετήριο: %{value}" @@ -173,9 +173,9 @@ el: error_issue_not_found_in_project: 'Το θέμα δεν βρέθηκε ή δεν ανήκει σε αυτό το έργο' error_no_tracker_in_project: 'Δεν υπάρχει ανιχνευτής για αυτό το έργο. Παρακαλώ ελέγξτε τις ρυθμίσεις του έργου.' error_no_default_issue_status: 'Δεν έχει οριστεί η προεπιλογή κατάστασης θεμάτων. Παρακαλώ ελέγξτε τις ρυθμίσεις σας (Μεταβείτε στην "Διαχείριση -> Κατάσταση θεμάτων").' - + warning_attachments_not_saved: "%{count} αρχείο(α) δε μπορούν να αποθηκευτούν." - + mail_subject_lost_password: "Ο κωδικός σας %{value}" mail_body_lost_password: 'Για να αλλάξετε τον κωδικό πρόσβασης, πατήστε τον ακόλουθο σύνδεσμο:' mail_subject_register: "Ενεργοποίηση του λογαριασμού χρήστη %{value} " @@ -190,10 +190,10 @@ el: mail_body_wiki_content_added: "Η σελίδα wiki '%{id}' προστέθηκε από τον %{author}." mail_subject_wiki_content_updated: "'ενημερώθηκε η σελίδα wiki %{id}' " mail_body_wiki_content_updated: "Η σελίδα wiki '%{id}' ενημερώθηκε από τον %{author}." - + gui_validation_error: 1 σφάλμα gui_validation_error_plural: "%{count} σφάλματα" - + field_name: Όνομα field_description: Περιγραφή field_summary: Συνοπτικά @@ -281,8 +281,8 @@ el: field_watcher: Παρατηρητής field_identity_url: OpenID URL field_content: Περιεχόμενο - field_group_by: Ομαδικά αποτελέσματα από - + field_group_by: Ομαδικά αποτελέσματα από + setting_app_title: Τίτλος εφαρμογής setting_app_subtitle: Υπότιτλος εφαρμογής setting_welcome_text: Κείμενο υποδοχής @@ -298,7 +298,7 @@ el: setting_text_formatting: Μορφοποίηση κειμένου setting_wiki_compression: Συμπίεση ιστορικού wiki setting_feeds_limit: Feed περιορισμού περιεχομένου - setting_default_projects_public: Τα νέα έργα έχουν προεπιλεγεί ως δημόσια + setting_default_projects_public: Τα νέα έργα έχουν προεπιλεγεί ως δημόσια setting_autofetch_changesets: Αυτόματη λήψη commits setting_sys_api_enabled: Ενεργοποίηση WS για διαχείριση αποθετηρίου setting_commit_ref_keywords: Αναφορά σε λέξεις-κλειδιά @@ -315,7 +315,7 @@ el: setting_per_page_options: Αντικείμενα ανά σελίδα επιλογών setting_user_format: Μορφή εμφάνισης χρηστών setting_activity_days_default: Ημέρες που εμφανίζεται στη δραστηριότητα έργου - setting_display_subprojects_issues: Εμφάνιση από προεπιλογή θεμάτων επιμέρους έργων στα κύρια έργα + setting_display_subprojects_issues: Εμφάνιση από προεπιλογή θεμάτων επιμέρους έργων στα κύρια έργα setting_enabled_scm: Ενεργοποίηση SCM setting_mail_handler_api_enabled: Ενεργοποίηση WS για εισερχόμενα email setting_mail_handler_api_key: κλειδί API @@ -327,7 +327,7 @@ el: setting_openid: Επιτρέψτε συνδέσεις OpenID και εγγραφή setting_password_min_length: Ελάχιστο μήκος κωδικού πρόσβασης setting_new_project_user_role_id: Απόδοση ρόλου σε χρήστη μη-διαχειριστή όταν δημιουργεί ένα έργο - + permission_add_project: Δημιουργία έργου permission_edit_project: Επεξεργασία έργου permission_select_project_modules: Επιλογή μονάδων έργου @@ -350,7 +350,7 @@ el: permission_add_issue_watchers: Προσθήκη παρατηρητών permission_log_time: Ιστορικό χρόνου που δαπανήθηκε permission_view_time_entries: Προβολή χρόνου που δαπανήθηκε - permission_edit_time_entries: Επεξεργασία ιστορικού χρόνου + permission_edit_time_entries: Επεξεργασία ιστορικού χρόνου permission_edit_own_time_entries: Επεξεργασία δικού μου ιστορικού χρόνου permission_manage_news: Διαχείριση νέων permission_comment_news: Σχολιασμός νέων @@ -377,7 +377,7 @@ el: permission_edit_own_messages: Επεξεργασία δικών μου μηνυμάτων permission_delete_messages: Διαγραφή μηνυμάτων permission_delete_own_messages: Διαγραφή δικών μου μηνυμάτων - + project_module_issue_tracking: Ανίχνευση θεμάτων project_module_time_tracking: Ανίχνευση χρόνου project_module_news: Νέα @@ -386,7 +386,7 @@ el: project_module_wiki: Wiki project_module_repository: Αποθετήριο project_module_boards: Πίνακες συζητήσεων - + label_user: Χρήστης label_user_plural: Χρήστες label_user_new: Νέος Χρήστης @@ -449,7 +449,7 @@ el: label_reported_issues: Εισηγμένα θέματα label_assigned_to_me_issues: Θέματα που έχουν ανατεθεί σε μένα label_last_login: Τελευταία σύνδεση - label_registered_on: Εγγράφηκε την + label_registered_on: Εγγράφηκε την label_activity: Δραστηριότητα label_overall_activity: Συνολική δραστηριότητα label_user_activity: "δραστηριότητα του %{value}" @@ -578,7 +578,7 @@ el: label_modification: "%{count} τροποποίηση" label_modification_plural: "%{count} τροποποιήσεις" label_branch: Branch - label_tag: Tag + label_tag: Tag label_revision: Αναθεώρηση label_revision_plural: Αναθεωρήσεις label_associated_revisions: Συνεταιρικές αναθεωρήσεις @@ -714,7 +714,7 @@ el: label_date_from_to: Από %{start} έως %{end} label_wiki_content_added: Η σελίδα Wiki προστέθηκε label_wiki_content_updated: Η σελίδα Wiki ενημερώθηκε - + button_login: Σύνδεση button_submit: Αποστολή button_save: Αποθήκευση @@ -754,11 +754,11 @@ el: button_update: Ενημέρωση button_configure: Ρύθμιση button_quote: Παράθεση - + status_active: ενεργό(ς)/ή status_registered: εγεγγραμμένο(ς)/η status_locked: κλειδωμένο(ς)/η - + text_select_mail_notifications: Επιλογή ενεργειών για τις οποίες θα πρέπει να αποσταλεί ειδοποίηση με email. text_regexp_info: eg. ^[A-Z0-9]+$ text_min_max_length_info: 0 σημαίνει ότι δεν υπάρχουν περιορισμοί @@ -808,7 +808,7 @@ el: text_wiki_page_nullify_children: "Διατηρήστε τις σελίδες τέκνων ως σελίδες root" text_wiki_page_destroy_children: "Διαγράψτε όλες τις σελίδες τέκνων και των απογόνων τους" text_wiki_page_reassign_children: "Επανεκχώριση των σελίδων τέκνων στη γονική σελίδα" - + default_role_manager: Manager default_role_developer: Developer default_role_reporter: Reporter @@ -832,7 +832,7 @@ el: default_priority_immediate: Άμεση default_activity_design: Σχεδιασμός default_activity_development: Ανάπτυξη - + enumeration_issue_priorities: Προτεραιότητα θέματος enumeration_doc_categories: Κατηγορία εγγράφων enumeration_activities: Δραστηριότητες (κατακερματισμός χρόνου) diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml index 2170e042..2da33ba2 100644 --- a/config/locales/en-GB.yml +++ b/config/locales/en-GB.yml @@ -8,10 +8,10 @@ en-GB: default: "%d/%m/%Y" short: "%d %b" long: "%d %B, %Y" - + day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday] abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December] abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec] @@ -29,7 +29,7 @@ en-GB: long: "%d %B, %Y %H:%M" am: "am" pm: "pm" - + datetime: distance_in_words: half_a_minute: "half a minute" @@ -93,13 +93,13 @@ en-GB: gb: "GB" tb: "TB" - + # Used in array.to_sentence. support: array: sentence_connector: "and" skip_last_comma: false - + activerecord: errors: template: @@ -133,7 +133,7 @@ en-GB: cant_link_an_issue_with_a_descendant: "An issue cannot be linked to one of its subtasks" actionview_instancetag_blank_option: Please select - + general_text_No: 'No' general_text_Yes: 'Yes' general_text_no: 'no' @@ -144,7 +144,7 @@ en-GB: general_csv_encoding: ISO-8859-1 general_pdf_encoding: ISO-8859-1 general_first_day_of_week: '1' - + notice_account_updated: Account was successfully updated. notice_account_invalid_creditentials: Invalid user or password notice_account_password_updated: Password was successfully updated. @@ -175,7 +175,7 @@ en-GB: notice_unable_delete_time_entry: Unable to delete time log entry. notice_issue_done_ratios_updated: Issue done ratios updated. notice_gantt_chart_truncated: "The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})" - + error_can_t_load_default_data: "Default configuration could not be loaded: %{value}" error_scm_not_found: "The entry or revision was not found in the repository." error_scm_command_failed: "An error occurred when trying to access the repository: %{value}" @@ -194,7 +194,7 @@ en-GB: error_unable_delete_issue_status: 'Unable to delete issue status' error_unable_to_connect: "Unable to connect (%{value})" warning_attachments_not_saved: "%{count} file(s) could not be saved." - + mail_subject_lost_password: "Your %{value} password" mail_body_lost_password: 'To change your password, click on the following link:' mail_subject_register: "Your %{value} account activation" @@ -209,10 +209,10 @@ en-GB: mail_body_wiki_content_added: "The '%{id}' wiki page has been added by %{author}." mail_subject_wiki_content_updated: "'%{id}' wiki page has been updated" mail_body_wiki_content_updated: "The '%{id}' wiki page has been updated by %{author}." - + gui_validation_error: 1 error gui_validation_error_plural: "%{count} errors" - + field_name: Name field_description: Description field_summary: Summary @@ -311,7 +311,7 @@ en-GB: field_text: Text field field_visible: Visible field_warn_on_leaving_unsaved: "Warn me when leaving a page with unsaved text" - + setting_app_title: Application title setting_app_subtitle: Application subtitle setting_welcome_text: Welcome text @@ -370,7 +370,7 @@ en-GB: setting_commit_logtime_enabled: Enable time logging setting_commit_logtime_activity_id: Activity for logged time setting_gantt_items_limit: Maximum number of items displayed on the gantt chart - + permission_add_project: Create project permission_add_subprojects: Create subprojects permission_edit_project: Edit project @@ -426,7 +426,7 @@ en-GB: permission_delete_own_messages: Delete own messages permission_export_wiki_pages: Export wiki pages permission_manage_subtasks: Manage subtasks - + project_module_issue_tracking: Issue tracking project_module_time_tracking: Time tracking project_module_news: News @@ -437,7 +437,7 @@ en-GB: project_module_boards: Forums project_module_calendar: Calendar project_module_gantt: Gantt - + label_user: User label_user_plural: Users label_user_new: New user @@ -635,7 +635,7 @@ en-GB: label_modification: "%{count} change" label_modification_plural: "%{count} changes" label_branch: Branch - label_tag: Tag + label_tag: Tag label_revision: Revision label_revision_plural: Revisions label_revision_id: "Revision %{value}" @@ -803,7 +803,7 @@ en-GB: label_project_copy_notifications: Send email notifications during the project copy label_principal_search: "Search for user or group:" label_user_search: "Search for user:" - + button_login: Login button_submit: Submit button_save: Save @@ -850,17 +850,17 @@ en-GB: button_quote: Quote button_duplicate: Duplicate button_show: Show - + status_active: active status_registered: registered status_locked: locked - + version_status_open: open version_status_locked: locked version_status_closed: closed field_active: Active - + text_select_mail_notifications: Select actions for which email notifications should be sent. text_regexp_info: eg. ^[A-Z0-9]+$ text_min_max_length_info: 0 means no restriction @@ -922,7 +922,7 @@ en-GB: text_zoom_in: Zoom in text_zoom_out: Zoom out text_warn_on_leaving_unsaved: "The current page contains unsaved text that will be lost if you leave this page." - + default_role_manager: Manager default_role_developer: Developer default_role_reporter: Reporter @@ -946,7 +946,7 @@ en-GB: default_priority_immediate: Immediate default_activity_design: Design default_activity_development: Development - + enumeration_issue_priorities: Issue priorities enumeration_doc_categories: Document categories enumeration_activities: Activities (time tracking) diff --git a/config/locales/en.yml b/config/locales/en.yml index fd6e2c98..538265f0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -9,10 +9,10 @@ en: default: "%m/%d/%Y" short: "%b %d" long: "%B %d, %Y" - + day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday] abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December] abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec] @@ -30,7 +30,7 @@ en: long: "%B %d, %Y %H:%M" am: "am" pm: "pm" - + datetime: distance_in_words: half_a_minute: "half a minute" @@ -70,7 +70,7 @@ en: number: format: - separator: "." + separator: "." delimiter: "" precision: 3 @@ -89,13 +89,13 @@ en: gb: "GB" tb: "TB" - + # Used in array.to_sentence. support: array: sentence_connector: "and" skip_last_comma: false - + activerecord: errors: template: @@ -129,7 +129,7 @@ en: cant_link_an_issue_with_a_descendant: "An issue cannot be linked to one of its subtasks" actionview_instancetag_blank_option: Please select - + general_text_No: 'No' general_text_Yes: 'Yes' general_text_no: 'no' @@ -140,7 +140,7 @@ en: general_csv_encoding: ISO-8859-1 general_pdf_encoding: ISO-8859-1 general_first_day_of_week: '7' - + notice_account_updated: Account was successfully updated. notice_account_invalid_creditentials: Invalid user or password notice_account_password_updated: Password was successfully updated. @@ -171,7 +171,7 @@ en: notice_unable_delete_time_entry: Unable to delete time log entry. notice_issue_done_ratios_updated: Issue done ratios updated. notice_gantt_chart_truncated: "The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})" - + error_can_t_load_default_data: "Default configuration could not be loaded: %{value}" error_scm_not_found: "The entry or revision was not found in the repository." error_scm_command_failed: "An error occurred when trying to access the repository: %{value}" @@ -190,7 +190,7 @@ en: error_unable_delete_issue_status: 'Unable to delete issue status' error_unable_to_connect: "Unable to connect (%{value})" warning_attachments_not_saved: "%{count} file(s) could not be saved." - + mail_subject_lost_password: "Your %{value} password" mail_body_lost_password: 'To change your password, click on the following link:' mail_subject_register: "Your %{value} account activation" @@ -205,10 +205,10 @@ en: mail_body_wiki_content_added: "The '%{id}' wiki page has been added by %{author}." mail_subject_wiki_content_updated: "'%{id}' wiki page has been updated" mail_body_wiki_content_updated: "The '%{id}' wiki page has been updated by %{author}." - + gui_validation_error: 1 error gui_validation_error_plural: "%{count} errors" - + field_name: Name field_description: Description field_summary: Summary @@ -307,7 +307,7 @@ en: field_text: Text field field_visible: Visible field_warn_on_leaving_unsaved: "Warn me when leaving a page with unsaved text" - + setting_app_title: Application title setting_app_subtitle: Application subtitle setting_welcome_text: Welcome text @@ -366,7 +366,7 @@ en: setting_commit_logtime_enabled: Enable time logging setting_commit_logtime_activity_id: Activity for logged time setting_gantt_items_limit: Maximum number of items displayed on the gantt chart - + permission_add_project: Create project permission_add_subprojects: Create subprojects permission_edit_project: Edit project @@ -422,7 +422,7 @@ en: permission_delete_own_messages: Delete own messages permission_export_wiki_pages: Export wiki pages permission_manage_subtasks: Manage subtasks - + project_module_issue_tracking: Issue tracking project_module_time_tracking: Time tracking project_module_news: News @@ -433,7 +433,7 @@ en: project_module_boards: Forums project_module_calendar: Calendar project_module_gantt: Gantt - + label_user: User label_user_plural: Users label_user_new: New user @@ -631,7 +631,7 @@ en: label_modification: "%{count} change" label_modification_plural: "%{count} changes" label_branch: Branch - label_tag: Tag + label_tag: Tag label_revision: Revision label_revision_plural: Revisions label_revision_id: "Revision %{value}" @@ -857,17 +857,17 @@ en: button_quote: Quote button_duplicate: Duplicate button_show: Show - + status_active: active status_registered: registered status_locked: locked - + version_status_open: open version_status_locked: locked version_status_closed: closed field_active: Active - + text_select_mail_notifications: Select actions for which email notifications should be sent. text_regexp_info: eg. ^[A-Z0-9]+$ text_min_max_length_info: 0 means no restriction @@ -933,7 +933,7 @@ en: text_default_encoding: "Default: UTF-8" text_mercurial_repo_example: "local repository (e.g. /hgrepo, c:\hgrepo)" text_git_repo_example: "a bare and local repository (e.g. /gitrepo, c:\gitrepo)" - + default_role_manager: Manager default_role_developer: Developer default_role_reporter: Reporter @@ -957,7 +957,7 @@ en: default_priority_immediate: Immediate default_activity_design: Design default_activity_development: Development - + enumeration_issue_priorities: Issue priorities enumeration_doc_categories: Document categories enumeration_activities: Activities (time tracking) diff --git a/config/locales/es.yml b/config/locales/es.yml index f8aad096..ce602f72 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1,6 +1,6 @@ # Spanish translations for Rails # by Francisco Fernando García Nieto (ffgarcianieto@gmail.com) -# Redmine spanish translation: +# Redmine spanish translation: # by J. Cayetano Delgado (Cayetano _dot_ Delgado _at_ ioko _dot_ com) es: @@ -9,9 +9,9 @@ es: # These are also the defaults for 'currency', 'percentage', 'precision', and 'human' format: # Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5) - separator: "," + separator: "," # Delimets thousands (e.g. 1,000,000 is a million) (always in groups of three) - delimiter: "." + delimiter: "." # Number of decimals, behind the separator (1 with a precision of 2 gives: 1.00) precision: 3 @@ -19,35 +19,35 @@ es: currency: format: # Where is the currency sign? %u is the currency unit, %n the number (default: $5.00) - format: "%n %u" - unit: "€" + format: "%n %u" + unit: "€" # These three are to override number.format and are optional - separator: "," - delimiter: "." + separator: "," + delimiter: "." precision: 2 # Used in number_to_percentage() percentage: format: # These three are to override number.format and are optional - # separator: - delimiter: "" - # precision: + # separator: + delimiter: "" + # precision: # Used in number_to_precision() precision: format: # These three are to override number.format and are optional # separator: - delimiter: "" + delimiter: "" # precision: # Used in number_to_human_size() human: format: # These three are to override number.format and are optional - # separator: - delimiter: "" + # separator: + delimiter: "" precision: 1 storage_units: format: "%n %u" @@ -63,37 +63,37 @@ es: # Used in distance_of_time_in_words(), distance_of_time_in_words_to_now(), time_ago_in_words() datetime: distance_in_words: - half_a_minute: "medio minuto" + half_a_minute: "medio minuto" less_than_x_seconds: - one: "menos de 1 segundo" + one: "menos de 1 segundo" other: "menos de %{count} segundos" x_seconds: - one: "1 segundo" - other: "%{count} segundos" + one: "1 segundo" + other: "%{count} segundos" less_than_x_minutes: - one: "menos de 1 minuto" - other: "menos de %{count} minutos" + one: "menos de 1 minuto" + other: "menos de %{count} minutos" x_minutes: - one: "1 minuto" - other: "%{count} minutos" + one: "1 minuto" + other: "%{count} minutos" about_x_hours: - one: "alrededor de 1 hora" - other: "alrededor de %{count} horas" + one: "alrededor de 1 hora" + other: "alrededor de %{count} horas" x_days: - one: "1 día" - other: "%{count} días" + one: "1 día" + other: "%{count} días" about_x_months: - one: "alrededor de 1 mes" - other: "alrededor de %{count} meses" + one: "alrededor de 1 mes" + other: "alrededor de %{count} meses" x_months: - one: "1 mes" - other: "%{count} meses" + one: "1 mes" + other: "%{count} meses" about_x_years: - one: "alrededor de 1 año" - other: "alrededor de %{count} años" + one: "alrededor de 1 año" + other: "alrededor de %{count} años" over_x_years: - one: "más de 1 año" - other: "más de %{count} años" + one: "más de 1 año" + other: "más de %{count} años" almost_x_years: one: "casi 1 año" other: "casi %{count} años" @@ -102,17 +102,17 @@ es: errors: template: header: - one: "no se pudo guardar este %{model} porque se encontró 1 error" - other: "no se pudo guardar este %{model} porque se encontraron %{count} errores" + one: "no se pudo guardar este %{model} porque se encontró 1 error" + other: "no se pudo guardar este %{model} porque se encontraron %{count} errores" # The variable :count is also available - body: "Se encontraron problemas con los siguientes campos:" + body: "Se encontraron problemas con los siguientes campos:" # The values :model, :attribute and :value are always available for interpolation # The value :count is available when applicable. Can be used for pluralization. messages: - inclusion: "no está incluido en la lista" - exclusion: "está reservado" - invalid: "no es válido" + inclusion: "no está incluido en la lista" + exclusion: "está reservado" + invalid: "no es válido" confirmation: "no coincide con la confirmación" accepted: "debe ser aceptado" empty: "no puede estar vacío" @@ -148,9 +148,9 @@ es: # Use the strftime parameters for formats. # When no format has been given, it uses default. # You can provide other formats here if you like! - default: "%Y-%m-%d" - short: "%d de %b" - long: "%d de %B de %Y" + default: "%Y-%m-%d" + short: "%d de %b" + long: "%d de %B de %Y" day_names: [Domingo, Lunes, Martes, Miércoles, Jueves, Viernes, Sábado] abbr_day_names: [Dom, Lun, Mar, Mie, Jue, Vie, Sab] @@ -168,10 +168,10 @@ es: formats: default: "%A, %d de %B de %Y %H:%M:%S %z" time: "%H:%M" - short: "%d de %b %H:%M" - long: "%d de %B de %Y %H:%M" - am: "am" - pm: "pm" + short: "%d de %b %H:%M" + long: "%d de %B de %Y %H:%M" + am: "am" + pm: "pm" # Used in array.to_sentence. support: @@ -179,7 +179,7 @@ es: sentence_connector: "y" actionview_instancetag_blank_option: Por favor seleccione - + button_activate: Activar button_add: Añadir button_annotate: Anotar @@ -886,7 +886,7 @@ es: version_status_locked: bloqueado version_status_open: abierto error_can_not_reopen_issue_on_closed_version: No se puede reabrir una petición asignada a una versión cerrada - + label_user_anonymous: Anónimo button_move_and_follow: Mover y seguir setting_default_projects_modules: Módulos activados por defecto en proyectos nuevos diff --git a/config/locales/eu.yml b/config/locales/eu.yml index da5ccde2..7d71c3cc 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -12,10 +12,10 @@ eu: default: "%Y/%m/%d" short: "%b %d" long: "%Y %B %d" - + day_names: [Igandea, Astelehena, Asteartea, Asteazkena, Osteguna, Ostirala, Larunbata] abbr_day_names: [Ig., Al., Ar., Az., Og., Or., La.] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, Urtarrila, Otsaila, Martxoa, Apirila, Maiatza, Ekaina, Uztaila, Abuztua, Iraila, Urria, Azaroa, Abendua] abbr_month_names: [~, Urt, Ots, Mar, Api, Mai, Eka, Uzt, Abu, Ira, Urr, Aza, Abe] @@ -33,7 +33,7 @@ eu: long: "%Y %B %d %H:%M" am: "am" pm: "pm" - + datetime: distance_in_words: half_a_minute: "minutu erdi" @@ -91,13 +91,13 @@ eu: gb: "GB" tb: "TB" - + # Used in array.to_sentence. support: array: sentence_connector: "eta" skip_last_comma: false - + activerecord: errors: template: @@ -131,7 +131,7 @@ eu: cant_link_an_issue_with_a_descendant: "Zeregin bat ezin da bere azpiataza batekin estekatu." actionview_instancetag_blank_option: Hautatu mesedez - + general_text_No: 'Ez' general_text_Yes: 'Bai' general_text_no: 'ez' @@ -142,7 +142,7 @@ eu: general_csv_encoding: UTF-8 general_pdf_encoding: UTF-8 general_first_day_of_week: '1' - + notice_account_updated: Kontua ongi eguneratu da. notice_account_invalid_creditentials: Erabiltzaile edo pasahitz ezegokia notice_account_password_updated: Pasahitza ongi eguneratu da. @@ -169,7 +169,7 @@ eu: notice_default_data_loaded: Lehenetsitako konfigurazioa ongi kargatu da. notice_unable_delete_version: Ezin da bertsioa ezabatu. notice_issue_done_ratios_updated: Burututako zereginen erlazioa eguneratu da. - + error_can_t_load_default_data: "Ezin izan da lehenetsitako konfigurazioa kargatu: %{value}" error_scm_not_found: "Sarrera edo berrikuspena ez da biltegian topatu." error_scm_command_failed: "Errorea gertatu da biltegia atzitzean: %{value}" @@ -182,9 +182,9 @@ eu: error_issue_done_ratios_not_updated: "Burututako zereginen erlazioa ez da eguneratu." error_workflow_copy_source: 'Mesedez hautatu iturburuko aztarnari edo rola' error_workflow_copy_target: 'Mesedez hautatu helburuko aztarnari(ak) edo rola(k)' - + warning_attachments_not_saved: "%{count} fitxategi ezin izan d(ir)a gorde." - + mail_subject_lost_password: "Zure %{value} pasahitza" mail_body_lost_password: 'Zure pasahitza aldatzeko hurrengo estekan klikatu:' mail_subject_register: "Zure %{value} kontuaren gaitzea" @@ -199,10 +199,10 @@ eu: mail_body_wiki_content_added: "%{author}-(e)k '%{id}' wiki orria gehitu du." mail_subject_wiki_content_updated: "'%{id}' wiki orria eguneratu da" mail_body_wiki_content_updated: "%{author}-(e)k '%{id}' wiki orria eguneratu du." - + gui_validation_error: akats 1 gui_validation_error_plural: "%{count} akats" - + field_name: Izena field_description: Deskribapena field_summary: Laburpena @@ -346,7 +346,7 @@ eu: setting_issue_done_ratio_issue_status: Zeregin egoera erabili setting_start_of_week: "Egutegiak noiz hasi:" setting_rest_api_enabled: Gaitu REST web zerbitzua - + permission_add_project: Proiektua sortu permission_add_subprojects: Azpiproiektuak sortu permission_edit_project: Proiektua editatu @@ -399,7 +399,7 @@ eu: permission_edit_own_messages: Nork bere mezuak aldatu permission_delete_messages: Mezuak ezabatu permission_delete_own_messages: Nork bere mezuak ezabatu - + project_module_issue_tracking: Zereginen jarraipena project_module_time_tracking: Denbora jarraipena project_module_news: Berriak @@ -408,7 +408,7 @@ eu: project_module_wiki: Wiki project_module_repository: Biltegia project_module_boards: Foroak - + label_user: Erabiltzailea label_user_plural: Erabiltzaileak label_user_new: Erabiltzaile berria @@ -604,7 +604,7 @@ eu: label_modification: "aldaketa %{count}" label_modification_plural: "%{count} aldaketa" label_branch: Adarra - label_tag: Etiketa + label_tag: Etiketa label_revision: Berrikuspena label_revision_plural: Berrikuspenak label_revision_id: "%{value} berrikuspen" @@ -760,7 +760,7 @@ eu: label_api_access_key: API atzipen giltza label_missing_api_access_key: API atzipen giltza falta da label_api_access_key_created_on: "API atzipen giltza sortuta orain dela %{value}" - + button_login: Saioa hasi button_submit: Bidali button_save: Gorde @@ -804,17 +804,17 @@ eu: button_quote: Aipatu button_duplicate: Bikoiztu button_show: Ikusi - + status_active: gaituta status_registered: izena emanda status_locked: blokeatuta - + version_status_open: irekita version_status_locked: blokeatuta version_status_closed: itxita field_active: Gaituta - + text_select_mail_notifications: Jakinarazpenak zein ekintzetarako bidaliko diren hautatu. text_regexp_info: adib. ^[A-Z0-9]+$ text_min_max_length_info: 0k mugarik gabe esan nahi du @@ -870,7 +870,7 @@ eu: text_wiki_page_destroy_children: "Orri semeak eta beraien ondorengo guztiak ezabatu" text_wiki_page_reassign_children: "Orri semeak orri guraso honetara esleitu" text_own_membership_delete_confirmation: "Zure baimen batzuk (edo guztiak) kentzera zoaz eta baliteke horren ondoren proiektu hau ezin editatzea.\n Ziur zaude jarraitu nahi duzula?" - + default_role_manager: Kudeatzailea default_role_developer: Garatzailea default_role_reporter: Berriemailea @@ -894,7 +894,7 @@ eu: default_priority_immediate: Berehalakoa default_activity_design: Diseinua default_activity_development: Garapena - + enumeration_issue_priorities: Zeregin lehentasunak enumeration_doc_categories: Dokumentu kategoriak enumeration_activities: Jarduerak (denbora kontrola)) diff --git a/config/locales/fa.yml b/config/locales/fa.yml index 4fa0a109..55ad8971 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -9,10 +9,10 @@ fa: default: "%Y/%m/%d" short: "%b %d" long: "%B %d, %Y" - + day_names: [یک‌شنبه, دوشنبه, سه‌شنبه, چهارشنبه, پنج‌شنبه, آدینه, شنبه] abbr_day_names: [یک, دو, سه, چهار, پنج, آدینه, شنبه] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, ژانویه, فوریه, مارس, آوریل, مه, ژوئن, ژوئیه, اوت, سپتامبر, اکتبر, نوامبر, دسامبر] abbr_month_names: [~, ژان, فور, مار, آور, مه, ژوئن, ژوئیه, اوت, سپت, اکت, نوا, دسا] @@ -30,7 +30,7 @@ fa: long: "%B %d, %Y %H:%M" am: "ق.ظ" pm: "ب.ظ" - + datetime: distance_in_words: half_a_minute: "نیم دقیقه" @@ -71,7 +71,7 @@ fa: number: # Default format for numbers format: - separator: "٫" + separator: "٫" delimiter: "" precision: 3 human: @@ -89,13 +89,13 @@ fa: gb: "گیگابایت" tb: "ترابایت" - + # Used in array.to_sentence. support: array: sentence_connector: "و" skip_last_comma: false - + activerecord: errors: template: @@ -129,7 +129,7 @@ fa: cant_link_an_issue_with_a_descendant: "یک پیامد نمی‌تواند به یکی از زیر کارهایش پیوند بخورد" actionview_instancetag_blank_option: گزینش کنید - + general_text_No: 'خیر' general_text_Yes: 'آری' general_text_no: 'خیر' @@ -140,7 +140,7 @@ fa: general_csv_encoding: UTF-8 general_pdf_encoding: UTF-8 general_first_day_of_week: '6' - + notice_account_updated: حساب شما بروز شد. notice_account_invalid_creditentials: نام کاربری یا گذرواژه نادرست است notice_account_password_updated: گذرواژه بروز شد @@ -171,7 +171,7 @@ fa: notice_unable_delete_time_entry: زمان گزارش شده را نمی‌توان پاک کرد. notice_issue_done_ratios_updated: اندازه انجام شده پیامد بروز شد. notice_gantt_chart_truncated: "نمودار بریده شد چون از بیشترین شماری که می‌توان نشان داد بزگتر است (%{max})." - + error_can_t_load_default_data: "پیکربندی پیش‌گزیده نمی‌تواند بار شود: %{value}" error_scm_not_found: "بخش یا نگارش در انباره پیدا نشد." error_scm_command_failed: "ایرادی در دسترسی به انباره پیش آمد: %{value}" @@ -190,7 +190,7 @@ fa: error_unable_delete_issue_status: 'وضعیت پیامد را نمی‌توان پاک کرد.' error_unable_to_connect: "نمی‌توان متصل شد (%{value})" warning_attachments_not_saved: "%{count} پرونده ذخیره نشد." - + mail_subject_lost_password: "گذرواژه حساب %{value} شما" mail_body_lost_password: 'برای جایگزینی گذرواژه خود، بر روی پیوند زیر کلیک کنید:' mail_subject_register: "فعالسازی حساب %{value} شما" @@ -205,10 +205,10 @@ fa: mail_body_wiki_content_added: "برگه ویکی «%{id}» به دست %{author} افزوده شد." mail_subject_wiki_content_updated: "برگه ویکی «%{id}» بروز شد" mail_body_wiki_content_updated: "برگه ویکی «%{id}» به دست %{author} بروز شد." - + gui_validation_error: 1 ایراد gui_validation_error_plural: "%{count} ایراد" - + field_name: نام field_description: توضیح field_summary: خلاصه @@ -306,7 +306,7 @@ fa: field_assigned_to_role: "نقش واگذار شونده" field_text: فیلد متنی field_visible: آشکار - + setting_app_title: نام برنامه setting_app_subtitle: زیرنام برنامه setting_welcome_text: نوشتار خوش‌آمد گویی @@ -365,7 +365,7 @@ fa: setting_commit_logtime_enabled: فعالسازی زمان گذاشته شده setting_commit_logtime_activity_id: فعالیت زمان گذاشته شده setting_gantt_items_limit: بیشترین شمار بخش‌های نمایش داده شده در نمودار گانت - + permission_add_project: ساخت پروژه permission_add_subprojects: ساخت زیرپروژه permission_edit_project: ویرایش پروژه @@ -421,7 +421,7 @@ fa: permission_delete_own_messages: پاک کردن پیام خود permission_export_wiki_pages: صدور برگه‌های ویکی permission_manage_subtasks: سرپرستی زیرکارها - + project_module_issue_tracking: پیگیری پیامدها project_module_time_tracking: پیگیری زمان project_module_news: رویدادها @@ -432,7 +432,7 @@ fa: project_module_boards: انجمن‌ها project_module_calendar: گاهشمار project_module_gantt: گانت - + label_user: کاربر label_user_plural: کاربر label_user_new: کاربر تازه @@ -796,7 +796,7 @@ fa: label_project_copy_notifications: در هنگام رونویسی پروژه ایمیل‌های آگاه‌سازی را بفرست label_principal_search: "جستجو برای کاربر یا دسته:" label_user_search: "جستجو برای کاربر:" - + button_login: ورود button_submit: واگذاری button_save: نگهداری @@ -841,17 +841,17 @@ fa: button_quote: نقل قول button_duplicate: نگارش دیگر button_show: نمایش - + status_active: فعال status_registered: نام‌نویسی شده status_locked: قفل - + version_status_open: باز version_status_locked: قفل version_status_closed: بسته field_active: فعال - + text_select_mail_notifications: فرمان‌هایی که برای آن‌ها باید ایمیل فرستاده شود را برگزینید. text_regexp_info: برای نمونه ^[A-Z0-9]+$ text_min_max_length_info: 0 یعنی بدون کران @@ -911,7 +911,7 @@ fa: text_own_membership_delete_confirmation: "شما دارید برخی یا همه پروانه‌های خود را برمی‌دارید و شاید پس از این دیگر نتوانید این پروژه را ویرایش کنید.\nآیا می‌خواهید این کار را بکنید؟" text_zoom_in: درشتنمایی text_zoom_out: ریزنمایی - + default_role_manager: سرپرست default_role_developer: برنامه‌نویس default_role_reporter: گزارش‌دهنده @@ -933,7 +933,7 @@ fa: default_priority_immediate: بیدرنگ default_activity_design: طراحی default_activity_development: ساخت - + enumeration_issue_priorities: برتری‌های پیامد enumeration_doc_categories: دسته‌های نوشتار enumeration_activities: فعالیت‌ها (پیگیری زمان) diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 10620c26..23794779 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -1,4 +1,4 @@ -# Finnish translations for Ruby on Rails +# Finnish translations for Ruby on Rails # by Marko Seppä (marko.seppa@gmail.com) fi: @@ -8,7 +8,7 @@ fi: default: "%e. %Bta %Y" long: "%A%e. %Bta %Y" short: "%e.%m.%Y" - + day_names: [Sunnuntai, Maanantai, Tiistai, Keskiviikko, Torstai, Perjantai, Lauantai] abbr_day_names: [Su, Ma, Ti, Ke, To, Pe, La] month_names: [~, Tammikuu, Helmikuu, Maaliskuu, Huhtikuu, Toukokuu, Kesäkuu, Heinäkuu, Elokuu, Syyskuu, Lokakuu, Marraskuu, Joulukuu] @@ -40,7 +40,7 @@ fi: separator: "," delimiter: "." precision: 3 - + currency: format: format: "%n %u" @@ -48,19 +48,19 @@ fi: separator: "," delimiter: "." precision: 2 - + percentage: format: # separator: delimiter: "" - # precision: + # precision: precision: format: # separator: delimiter: "" # precision: - + human: format: delimiter: "" @@ -75,7 +75,7 @@ fi: mb: "MB" gb: "GB" tb: "TB" - + datetime: distance_in_words: half_a_minute: "puoli minuuttia" @@ -119,7 +119,7 @@ fi: hour: "Tunti" minute: "Minuutti" second: "Sekuntia" - + activerecord: errors: template: @@ -151,9 +151,9 @@ fi: not_same_project: "ei kuulu samaan projektiin" circular_dependency: "Tämä suhde loisi kehän." cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" - + actionview_instancetag_blank_option: Valitse, ole hyvä - + general_text_No: 'Ei' general_text_Yes: 'Kyllä' general_text_no: 'ei' @@ -164,7 +164,7 @@ fi: general_csv_encoding: ISO-8859-15 general_pdf_encoding: ISO-8859-15 general_first_day_of_week: '1' - + notice_account_updated: Tilin päivitys onnistui. notice_account_invalid_creditentials: Virheellinen käyttäjätunnus tai salasana notice_account_password_updated: Salasanan päivitys onnistui. @@ -188,11 +188,11 @@ fi: notice_no_issue_selected: "Tapahtumia ei ole valittu! Valitse tapahtumat joita haluat muokata." notice_account_pending: "Tilisi on luotu ja odottaa ylläpitäjän hyväksyntää." notice_default_data_loaded: Vakioasetusten palautus onnistui. - + error_can_t_load_default_data: "Vakioasetuksia ei voitu ladata: %{value}" error_scm_not_found: "Syötettä ja/tai versiota ei löydy tietovarastosta." error_scm_command_failed: "Tietovarastoon pääsyssä tapahtui virhe: %{value}" - + mail_subject_lost_password: "Sinun %{value} salasanasi" mail_body_lost_password: 'Vaihtaaksesi salasanasi, napsauta seuraavaa linkkiä:' mail_subject_register: "%{value} tilin aktivointi" @@ -201,10 +201,10 @@ fi: mail_body_account_information: Sinun tilin tiedot mail_subject_account_activation_request: "%{value} tilin aktivointi pyyntö" mail_body_account_activation_request: "Uusi käyttäjä (%{value}) on rekisteröitynyt. Hänen tili odottaa hyväksyntääsi:" - + gui_validation_error: 1 virhe gui_validation_error_plural: "%{count} virhettä" - + field_name: Nimi field_description: Kuvaus field_summary: Yhteenveto @@ -286,7 +286,7 @@ fi: field_time_zone: Aikavyöhyke field_searchable: Haettava field_default_value: Vakioarvo - + setting_app_title: Ohjelman otsikko setting_app_subtitle: Ohjelman alaotsikko setting_welcome_text: Tervehdysteksti @@ -314,7 +314,7 @@ fi: setting_emails_footer: Sähköpostin alatunniste setting_protocol: Protokolla setting_per_page_options: Sivun objektien määrän asetukset - + label_user: Käyttäjä label_user_plural: Käyttäjät label_user_new: Uusi käyttäjä @@ -589,7 +589,7 @@ fi: label_age: Ikä label_change_properties: Vaihda asetuksia label_general: Yleinen - + button_login: Kirjaudu button_submit: Lähetä button_save: Tallenna @@ -626,11 +626,11 @@ fi: button_copy: Kopioi button_annotate: Lisää selitys button_update: Päivitä - + status_active: aktiivinen status_registered: rekisteröity status_locked: lukittu - + text_select_mail_notifications: Valitse tapahtumat joista tulisi lähettää sähköpostimuistutus. text_regexp_info: esim. ^[A-Z0-9]+$ text_min_max_length_info: 0 tarkoittaa, ei rajoitusta @@ -657,7 +657,7 @@ fi: text_user_mail_option: "Valitsemattomille projekteille, saat vain muistutuksen asioista joita seuraat tai olet mukana (esim. tapahtumat joissa olet tekijä tai nimettynä)." text_no_configuration_data: "Rooleja, tapahtumien tiloja ja työnkulkua ei vielä olla määritelty.\nOn erittäin suotavaa ladata vakioasetukset. Voit muuttaa sitä latauksen jälkeen." text_load_default_configuration: Lataa vakioasetukset - + default_role_manager: Päälikkö default_role_developer: Kehittäjä default_role_reporter: Tarkastelija @@ -681,7 +681,7 @@ fi: default_priority_immediate: Valitön default_activity_design: Suunnittelu default_activity_development: Kehitys - + enumeration_issue_priorities: Tapahtuman tärkeysjärjestys enumeration_doc_categories: Dokumentin luokat enumeration_activities: Historia (ajan seuranta) diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 7d0382e3..92e3a48b 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1,4 +1,4 @@ -# French translations for Ruby on Rails +# French translations for Ruby on Rails # by Christian Lescuyer (christian@flyingcoders.com) # contributor: Sebastien Grosjean - ZenCocoon.com # contributor: Thibaut Cuvelier - Developpez.com @@ -21,7 +21,7 @@ fr: - :day - :month - :year - + time: formats: default: "%d/%m/%Y %H:%M" @@ -78,7 +78,7 @@ fr: hour: "Heure" minute: "Minute" second: "Seconde" - + number: format: precision: 3 @@ -102,7 +102,7 @@ fr: mb: "Mo" gb: "Go" tb: "To" - + support: array: sentence_connector: 'et' @@ -110,11 +110,11 @@ fr: word_connector: ", " two_words_connector: " et " last_word_connector: " et " - + activerecord: errors: template: - header: + header: one: "Impossible d'enregistrer %{model} : une erreur" other: "Impossible d'enregistrer %{model} : %{count} erreurs." body: "Veuillez vérifier les champs suivants :" @@ -145,7 +145,7 @@ fr: cant_link_an_issue_with_a_descendant: "Une demande ne peut pas être liée à l'une de ses sous-tâches" actionview_instancetag_blank_option: Choisir - + general_text_No: 'Non' general_text_Yes: 'Oui' general_text_no: 'non' @@ -156,7 +156,7 @@ fr: general_csv_encoding: ISO-8859-1 general_pdf_encoding: ISO-8859-1 general_first_day_of_week: '1' - + notice_account_updated: Le compte a été mis à jour avec succès. notice_account_invalid_creditentials: Identifiant ou mot de passe invalide. notice_account_password_updated: Mot de passe mis à jour avec succès. @@ -185,7 +185,7 @@ fr: notice_issue_done_ratios_updated: L'avancement des demandes a été mis à jour. notice_api_access_key_reseted: Votre clé d'accès API a été réinitialisée. notice_gantt_chart_truncated: "Le diagramme a été tronqué car il excède le nombre maximal d'éléments pouvant être affichés (%{max})" - + error_can_t_load_default_data: "Une erreur s'est produite lors du chargement du paramétrage : %{value}" error_scm_not_found: "L'entrée et/ou la révision demandée n'existe pas dans le dépôt." error_scm_command_failed: "Une erreur s'est produite lors de l'accès au dépôt : %{value}" @@ -196,9 +196,9 @@ fr: error_workflow_copy_source: 'Veuillez sélectionner un tracker et/ou un rôle source' error_workflow_copy_target: 'Veuillez sélectionner les trackers et rôles cibles' error_issue_done_ratios_not_updated: L'avancement des demandes n'a pas pu être mis à jour. - + warning_attachments_not_saved: "%{count} fichier(s) n'ont pas pu être sauvegardés." - + mail_subject_lost_password: "Votre mot de passe %{value}" mail_body_lost_password: 'Pour changer votre mot de passe, cliquez sur le lien suivant :' mail_subject_register: "Activation de votre compte %{value}" @@ -213,10 +213,10 @@ fr: mail_body_wiki_content_added: "La page wiki '%{id}' a été ajoutée par %{author}." mail_subject_wiki_content_updated: "Page wiki '%{id}' mise à jour" mail_body_wiki_content_updated: "La page wiki '%{id}' a été mise à jour par %{author}." - + gui_validation_error: 1 erreur gui_validation_error_plural: "%{count} erreurs" - + field_name: Nom field_description: Description field_summary: Résumé @@ -310,7 +310,7 @@ fr: field_parent_issue: Tâche parente field_visible: Visible field_warn_on_leaving_unsaved: "M'avertir lorsque je quitte une page contenant du texte non sauvegardé" - + setting_app_title: Titre de l'application setting_app_subtitle: Sous-titre de l'application setting_welcome_text: Texte d'accueil @@ -367,7 +367,7 @@ fr: setting_commit_logtime_enabled: Permettre la saisie de temps setting_commit_logtime_activity_id: Activité pour le temps saisi setting_gantt_items_limit: Nombre maximum d'éléments affichés sur le gantt - + permission_add_project: Créer un projet permission_add_subprojects: Créer des sous-projets permission_edit_project: Modifier le projet @@ -423,7 +423,7 @@ fr: permission_export_wiki_pages: Exporter les pages permission_manage_project_activities: Gérer les activités permission_manage_subtasks: Gérer les sous-tâches - + project_module_issue_tracking: Suivi des demandes project_module_time_tracking: Suivi du temps passé project_module_news: Publication d'annonces @@ -432,7 +432,7 @@ fr: project_module_wiki: Wiki project_module_repository: Dépôt de sources project_module_boards: Forums de discussion - + label_user: Utilisateur label_user_plural: Utilisateurs label_user_new: Nouvel utilisateur @@ -791,7 +791,7 @@ fr: label_user_search: "Rechercher un utilisateur :" label_additional_workflow_transitions_for_author: Autorisations supplémentaires lorsque l'utilisateur a créé la demande label_additional_workflow_transitions_for_assignee: Autorisations supplémentaires lorsque la demande est assignée à l'utilisateur - + button_login: Connexion button_submit: Soumettre button_save: Sauvegarder @@ -837,15 +837,15 @@ fr: button_quote: Citer button_duplicate: Dupliquer button_show: Afficher - + status_active: actif status_registered: enregistré status_locked: verrouillé - + version_status_open: ouvert version_status_locked: verrouillé version_status_closed: fermé - + text_select_mail_notifications: Actions pour lesquelles une notification par e-mail est envoyée text_regexp_info: ex. ^[A-Z0-9]+$ text_min_max_length_info: 0 pour aucune restriction @@ -899,7 +899,7 @@ fr: text_wiki_page_reassign_children: "Réaffecter les sous-pages à cette page" text_own_membership_delete_confirmation: "Vous allez supprimer tout ou partie de vos permissions sur ce projet et ne serez peut-être plus autorisé à modifier ce projet.\nEtes-vous sûr de vouloir continuer ?" text_warn_on_leaving_unsaved: "Cette page contient du texte non sauvegardé qui sera perdu si vous quittez la page." - + default_role_manager: "Manager " default_role_developer: "Développeur " default_role_reporter: "Rapporteur " @@ -923,7 +923,7 @@ fr: default_priority_immediate: Immédiat default_activity_design: Conception default_activity_development: Développement - + enumeration_issue_priorities: Priorités des demandes enumeration_doc_categories: Catégories des documents enumeration_activities: Activités (suivi du temps) diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 1f24b694..0fd38bb9 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -4,34 +4,34 @@ gl: number: format: - separator: "," - delimiter: "." + separator: "," + delimiter: "." precision: 3 currency: format: - format: "%n %u" - unit: "€" - separator: "," - delimiter: "." + format: "%n %u" + unit: "€" + separator: "," + delimiter: "." precision: 2 percentage: format: - # separator: - delimiter: "" - # precision: + # separator: + delimiter: "" + # precision: precision: format: # separator: - delimiter: "" + delimiter: "" # precision: human: format: - # separator: - delimiter: "" + # separator: + delimiter: "" precision: 1 storage_units: format: "%n %u" @@ -43,8 +43,8 @@ gl: mb: "MB" gb: "GB" tb: "TB" - - + + direction: ltr date: formats: @@ -66,10 +66,10 @@ gl: time: "%H:%M hs" short: "%e/%m, %H:%M hs" long: "%A %e de %B de %Y ás %H:%M horas" - + am: '' pm: '' - + datetime: distance_in_words: half_a_minute: 'medio minuto' @@ -116,7 +116,7 @@ gl: today: 'hoxe' tomorrow: 'mañá' in: 'dentro de' - + support: array: sentence_connector: e @@ -156,7 +156,7 @@ gl: cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" actionview_instancetag_blank_option: Por favor seleccione - + button_activate: Activar button_add: Engadir button_annotate: Anotar diff --git a/config/locales/hr.yml b/config/locales/hr.yml index 837d1cc6..8c55fdf7 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -1,4 +1,4 @@ -# Croatian translations for Ruby on Rails +# Croatian translations for Ruby on Rails # by Helix d.o.o. (info@helix.hr) hr: @@ -11,10 +11,10 @@ hr: default: "%m/%d/%Y" short: "%b %d" long: "%B %d, %Y" - + day_names: [Ponedjeljak, Utorak, Srijeda, Četvrtak, Petak, Subota, Nedjelja] abbr_day_names: [Ned, Pon, Uto, Sri, Čet, Pet, Sub] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, Sijecanj, Veljaca, Ožujak, Travanj, Svibanj, Lipanj, Srpanj, Kolovoz, Rujan, Listopad, Studeni, Prosinac] abbr_month_names: [~, Sij, Velj, Ožu, Tra, Svi, Lip, Srp, Kol, Ruj, List, Stu, Pro] @@ -32,7 +32,7 @@ hr: long: "%B %d, %Y %H:%M" am: "am" pm: "pm" - + datetime: distance_in_words: half_a_minute: "pola minute" @@ -86,14 +86,14 @@ hr: mb: "MB" gb: "GB" tb: "TB" - - + + # Used in array.to_sentence. support: array: sentence_connector: "i" skip_last_comma: false - + activerecord: errors: template: @@ -127,7 +127,7 @@ hr: cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" actionview_instancetag_blank_option: Molimo odaberite - + general_text_No: 'Ne' general_text_Yes: 'Da' general_text_no: 'ne' @@ -138,7 +138,7 @@ hr: general_csv_encoding: utf8 general_pdf_encoding: utf8 general_first_day_of_week: '7' - + notice_account_updated: Vaš profil je uspješno promijenjen. notice_account_invalid_creditentials: Neispravno korisničko ime ili zaporka. notice_account_password_updated: Zaporka je uspješno promijenjena. @@ -154,7 +154,7 @@ hr: notice_successful_connection: Uspješna veza. notice_file_not_found: Stranica kojoj ste pokušali pristupiti ne postoji ili je uklonjena. notice_locking_conflict: Podataci su ažurirani od strane drugog korisnika. - notice_not_authorized: Niste ovlašteni za pristup ovoj stranici. + notice_not_authorized: Niste ovlašteni za pristup ovoj stranici. notice_email_sent: E-mail je poslan %{value}" notice_email_error: Dogodila se pogreška tijekom slanja E-maila (%{value})" notice_feeds_access_key_reseted: Vaš RSS pristup je resetovan. @@ -165,7 +165,7 @@ hr: notice_default_data_loaded: Konfiguracija je uspješno učitana. notice_unable_delete_version: Nije moguće izbrisati verziju. notice_issue_done_ratios_updated: Issue done ratios updated. - + error_can_t_load_default_data: "Zadanu konfiguracija nije učitana: %{value}" error_scm_not_found: "Unos i/ili revizija nije pronađen." error_scm_command_failed: "Dogodila se pogreška prilikom pokušaja pristupa: %{value}" @@ -178,9 +178,9 @@ hr: error_issue_done_ratios_not_updated: "Issue done ratios not updated." error_workflow_copy_source: 'Please select a source tracker or role' error_workflow_copy_target: 'Please select target tracker(s) and role(s)' - + warning_attachments_not_saved: "%{count} Datoteka/e nije mogla biti spremljena." - + mail_subject_lost_password: "Vaša %{value} zaporka" mail_body_lost_password: 'Kako biste promijenili Vašu zaporku slijedite poveznicu:' mail_subject_register: "Aktivacija korisničog računa %{value}" @@ -195,10 +195,10 @@ hr: mail_body_wiki_content_added: "The '%{id}' wiki page has been added by %{author}." mail_subject_wiki_content_updated: "'%{id}' wiki page has been updated" mail_body_wiki_content_updated: "The '%{id}' wiki page has been updated by %{author}." - + gui_validation_error: 1 pogreška gui_validation_error_plural: "%{count} pogrešaka" - + field_name: Ime field_description: Opis field_summary: Sažetak @@ -288,7 +288,7 @@ hr: field_identity_url: OpenID URL field_content: Content field_group_by: Group results by - + setting_app_title: Naziv aplikacije setting_app_subtitle: Podnaslov aplikacije setting_welcome_text: Tekst dobrodošlice @@ -335,37 +335,37 @@ hr: setting_openid: Allow OpenID login and registration setting_password_min_length: Minimum password length setting_new_project_user_role_id: Role given to a non-admin user who creates a project - setting_default_projects_modules: Default enabled modules for new projects + setting_default_projects_modules: Default enabled modules for new projects setting_issue_done_ratio: Calculate the issue done ratio with setting_issue_done_ratio_issue_field: Use the issue field setting_issue_done_ratio_issue_status: Use the issue status setting_start_of_week: Start calendars on setting_rest_api_enabled: Enable REST web service - + permission_add_project: Dodaj projekt - permission_add_subprojects: Dodaj potprojekt + permission_add_subprojects: Dodaj potprojekt permission_edit_project: Uredi projekt permission_select_project_modules: Odaberi projektne module permission_manage_members: Upravljaj članovima permission_manage_versions: Upravljaj verzijama permission_manage_categories: Upravljaj kategorijama predmeta permission_view_issues: Pregledaj zahtjeve - permission_add_issues: Dodaj predmete + permission_add_issues: Dodaj predmete permission_edit_issues: Uredi predmete permission_manage_issue_relations: Upravljaj relacijama predmeta - permission_add_issue_notes: Dodaj bilješke - permission_edit_issue_notes: Uredi bilješke + permission_add_issue_notes: Dodaj bilješke + permission_edit_issue_notes: Uredi bilješke permission_edit_own_issue_notes: Uredi vlastite bilješke - permission_move_issues: Premjesti predmete + permission_move_issues: Premjesti predmete permission_delete_issues: Brisanje predmeta permission_manage_public_queries: Upravljaj javnim upitima - permission_save_queries: Spremi upite + permission_save_queries: Spremi upite permission_view_gantt: Pregledaj gantt grafikon permission_view_calendar: Pregledaj kalendar permission_view_issue_watchers: Pregledaj listu promatraca permission_add_issue_watchers: Dodaj promatrača permission_delete_issue_watchers: Delete watchers - permission_log_time: Dnevnik utrošenog vremena + permission_log_time: Dnevnik utrošenog vremena permission_view_time_entries: Pregledaj utrošeno vrijeme permission_edit_time_entries: Uredi vremenske dnevnike permission_edit_own_time_entries: Edit own time logs @@ -391,10 +391,10 @@ hr: permission_view_messages: Pregledaj poruke permission_add_messages: Objavi poruke permission_edit_messages: Uredi poruke - permission_edit_own_messages: Uredi vlastite poruke + permission_edit_own_messages: Uredi vlastite poruke permission_delete_messages: Obriši poruke permission_delete_own_messages: Obriši vlastite poruke - + project_module_issue_tracking: Praćenje predmeta project_module_time_tracking: Praćenje vremena project_module_news: Novosti @@ -403,7 +403,7 @@ hr: project_module_wiki: Wiki project_module_repository: Skladište project_module_boards: Boards - + label_user: Korisnik label_user_plural: Korisnici label_user_new: Novi korisnik @@ -544,7 +544,7 @@ hr: label_nobody: nitko label_next: Naredni label_previous: Prethodni - label_used_by: Korišten od + label_used_by: Korišten od label_details: Detalji label_add_note: Dodaj napomenu label_per_page: Po stranici @@ -598,10 +598,10 @@ hr: label_modification: "%{count} promjena" label_modification_plural: "%{count} promjena" label_branch: Branch - label_tag: Tag + label_tag: Tag label_revision: Revizija label_revision_plural: Revizije - label_revision_id: "Revision %{value}" + label_revision_id: "Revision %{value}" label_associated_revisions: Dodijeljene revizije label_added: dodano label_modified: promijenjen @@ -680,7 +680,7 @@ hr: label_message_new: Nova poruka label_message_posted: Poruka dodana label_reply_plural: Odgovori - label_send_information: Pošalji korisniku informaciju o profilu + label_send_information: Pošalji korisniku informaciju o profilu label_year: Godina label_month: Mjesec label_week: Tjedan @@ -691,7 +691,7 @@ hr: label_send_test_email: Pošalji testno E-pismo label_feeds_access_key: RSS access key label_missing_feeds_access_key: Missing a RSS access key - label_feeds_access_key_created_on: "RSS kljuc za pristup je napravljen prije %{value}" + label_feeds_access_key_created_on: "RSS kljuc za pristup je napravljen prije %{value}" label_module_plural: Moduli label_added_time_by: "Promijenio %{author} prije %{age}" label_updated_time_by: "Dodao/la %{author} prije %{age}" @@ -754,7 +754,7 @@ hr: label_api_access_key: API access key label_missing_api_access_key: Missing an API access key label_api_access_key_created_on: "API access key created %{value} ago" - + button_login: Prijavi button_submit: Pošalji button_save: Spremi @@ -797,18 +797,18 @@ hr: button_configure: Konfiguracija button_quote: Navod button_duplicate: Duplicate - button_show: Show - + button_show: Show + status_active: aktivan status_registered: Registriran status_locked: zaključan - + version_status_open: open version_status_locked: locked version_status_closed: closed field_active: Active - + text_select_mail_notifications: Izbor akcija za koje će biti poslana obavijest e-poštom. text_regexp_info: eg. ^[A-Z0-9]+$ text_min_max_length_info: 0 znači bez ograničenja @@ -819,7 +819,7 @@ hr: text_journal_changed: "%{label} promijenjen iz %{old} u %{new}" text_journal_set_to: "%{label} postavi na %{value}" text_journal_deleted: "%{label} izbrisano (%{old})" - text_journal_added: "%{label} %{value} added" + text_journal_added: "%{label} %{value} added" text_tip_issue_begin_day: Zadaci koji počinju ovog dana text_tip_issue_end_day: zadaci koji se završavaju ovog dana text_tip_issue_begin_end_day: Zadaci koji počinju i završavaju se ovog dana @@ -840,7 +840,7 @@ hr: text_issue_category_destroy_assignments: Ukloni dodjeljivanje kategorija text_issue_category_reassign_to: Ponovo dodijeli predmete ovoj kategoriji text_user_mail_option: "Za neizabrane projekte, primit ćete obavjesti samo o stvarima koje pratite ili u kojima sudjelujete (npr. predmete koje ste vi napravili ili koje su vama dodjeljeni)." - text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded." + text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded." text_load_default_configuration: Učitaj početnu konfiguraciju text_status_changed_by_changeset: "Applied in changeset %{value}." text_issues_destroy_confirmation: 'Jeste li sigurni da želite obrisati izabrani/e predmet(e)?' @@ -889,7 +889,7 @@ hr: default_activity_development: Razvoj enumeration_issue_priorities: Prioriteti predmeta enumeration_doc_categories: Kategorija dokumenata - enumeration_activities: Aktivnosti (po vremenu) + enumeration_activities: Aktivnosti (po vremenu) enumeration_system_activity: System Activity field_sharing: Sharing text_line_separated: Multiple values allowed (one line for each value). diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 58e2e7bc..88421f95 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -1,4 +1,4 @@ -# Hungarian translations for Ruby on Rails +# Hungarian translations for Ruby on Rails # by Richard Abonyi (richard.abonyi@gmail.com) # thanks to KKata, replaced and #hup.hu # Cleaned up by László Bácsi (http://lackac.hu) @@ -149,7 +149,7 @@ cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" actionview_instancetag_blank_option: Kérem válasszon - + general_text_No: 'Nem' general_text_Yes: 'Igen' general_text_no: 'nem' @@ -160,7 +160,7 @@ general_csv_encoding: ISO-8859-2 general_pdf_encoding: ISO-8859-2 general_first_day_of_week: '1' - + notice_account_updated: A fiók adatai sikeresen frissítve. notice_account_invalid_creditentials: Hibás felhasználói név, vagy jelszó notice_account_password_updated: A jelszó módosítása megtörtént. @@ -184,13 +184,13 @@ notice_no_issue_selected: "Nincs feladat kiválasztva! Kérem jelölje meg melyik feladatot szeretné szerkeszteni!" notice_account_pending: "A fiókja létrejött, és adminisztrátori jóváhagyásra vár." notice_default_data_loaded: Az alapértelmezett konfiguráció betöltése sikeresen megtörtént. - + error_can_t_load_default_data: "Az alapértelmezett konfiguráció betöltése nem lehetséges: %{value}" error_scm_not_found: "A bejegyzés, vagy revízió nem található a tárolóban." error_scm_command_failed: "A tároló elérése közben hiba lépett fel: %{value}" error_scm_annotate: "A bejegyzés nem létezik, vagy nics jegyzetekkel ellátva." error_issue_not_found_in_project: 'A feladat nem található, vagy nem ehhez a projekthez tartozik' - + mail_subject_lost_password: Az Ön Redmine jelszava mail_body_lost_password: 'A Redmine jelszó megváltoztatásához, kattintson a következő linkre:' mail_subject_register: Redmine azonosító aktiválása @@ -199,10 +199,10 @@ mail_body_account_information: Az Ön Redmine azonosítójának információi mail_subject_account_activation_request: Redmine azonosító aktiválási kérelem mail_body_account_activation_request: "Egy új felhasználó (%{value}) regisztrált, azonosítója jóváhasgyásra várakozik:" - + gui_validation_error: 1 hiba gui_validation_error_plural: "%{count} hiba" - + field_name: Név field_description: Leírás field_summary: Összegzés @@ -285,7 +285,7 @@ field_searchable: Kereshető field_default_value: Alapértelmezett érték field_comments_sorting: Feljegyzések megjelenítése - + setting_app_title: Alkalmazás címe setting_app_subtitle: Alkalmazás alcíme setting_welcome_text: Üdvözlő üzenet @@ -318,7 +318,7 @@ setting_activity_days_default: Napok megjelenítése a project aktivitásnál setting_display_subprojects_issues: Alapértelmezettként mutassa az alprojektek feladatait is a projekteken setting_start_of_week: A hét első napja - + project_module_issue_tracking: Feladat követés project_module_time_tracking: Idő rögzítés project_module_news: Hírek @@ -327,7 +327,7 @@ project_module_wiki: Wiki project_module_repository: Tároló project_module_boards: Fórumok - + label_user: Felhasználó label_user_plural: Felhasználók label_user_new: Új felhasználó @@ -633,7 +633,7 @@ label_chronological_order: Időrendben label_reverse_chronological_order: Fordított időrendben label_planning: Tervezés - + button_login: Bejelentkezés button_submit: Elfogad button_save: Mentés @@ -671,11 +671,11 @@ button_annotate: Jegyzetel button_update: Módosít button_configure: Konfigurál - + status_active: aktív status_registered: regisztrált status_locked: zárolt - + text_select_mail_notifications: Válasszon eseményeket, amelyekről e-mail értesítést kell küldeni. text_regexp_info: pl. ^[A-Z0-9]+$ text_min_max_length_info: 0 = nincs korlátozás @@ -713,7 +713,7 @@ text_destroy_time_entries: A rögzített órák törlése text_assign_time_entries_to_project: A rögzített órák hozzárendelése a projekthez text_reassign_time_entries: 'A rögzített órák újra hozzárendelése másik feladathoz:' - + default_role_manager: Vezető default_role_developer: Fejlesztő default_role_reporter: Bejelentő @@ -737,7 +737,7 @@ default_priority_immediate: Azonnal default_activity_design: Tervezés default_activity_development: Fejlesztés - + enumeration_issue_priorities: Feladat prioritások enumeration_doc_categories: Dokumentum kategóriák enumeration_activities: Tevékenységek (idő rögzítés) diff --git a/config/locales/id.yml b/config/locales/id.yml index c543ff45..907370a2 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -1,4 +1,4 @@ -# Indonesian translations +# Indonesian translations # by Raden Prabowo (cakbowo@gmail.com) id: @@ -8,10 +8,10 @@ id: default: "%d-%m-%Y" short: "%d %b" long: "%d %B %Y" - + day_names: [Minggu, Senin, Selasa, Rabu, Kamis, Jumat, Sabtu] abbr_day_names: [Ming, Sen, Sel, Rab, Kam, Jum, Sab] - + month_names: [~, Januari, Februari, Maret, April, Mei, Juni, Juli, Agustus, September, Oktober, November, Desember] abbr_month_names: [~, Jan, Feb, Mar, Apr, Mei, Jun, Jul, Agu, Sep, Okt, Nov, Des] order: @@ -27,7 +27,7 @@ id: long: "%d %B %Y %H:%M" am: "am" pm: "pm" - + datetime: distance_in_words: half_a_minute: "setengah menit" @@ -90,12 +90,12 @@ id: gb: "GB" tb: "TB" - + support: array: sentence_connector: "dan" skip_last_comma: false - + activerecord: errors: template: @@ -129,7 +129,7 @@ id: cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" actionview_instancetag_blank_option: Silakan pilih - + general_text_No: 'Tidak' general_text_Yes: 'Ya' general_text_no: 'tidak' @@ -140,7 +140,7 @@ id: general_csv_encoding: ISO-8859-1 general_pdf_encoding: ISO-8859-1 general_first_day_of_week: '7' - + notice_account_updated: Akun sudah berhasil diperbarui. notice_account_invalid_creditentials: Pengguna atau kata sandi salah notice_account_password_updated: Kata sandi sudah berhasil diperbarui. @@ -165,7 +165,7 @@ id: notice_account_pending: "Akun anda sudah dibuat dan sekarang sedang menunggu persetujuan administrator." notice_default_data_loaded: Konfigurasi default sudah berhasil dimuat. notice_unable_delete_version: Tidak bisa menghapus versi. - + error_can_t_load_default_data: "Konfigurasi default tidak bisa dimuat: %{value}" error_scm_not_found: "Entri atau revisi tidak terdapat pada repositori." error_scm_command_failed: "Terjadi kesalahan pada saat mengakses repositori: %{value}" @@ -175,9 +175,9 @@ id: error_no_default_issue_status: 'Nilai default untuk Status masalah belum didefinisikan. Periksa kembali konfigurasi anda (Pilih "Administrasi --> Status masalah").' error_can_not_reopen_issue_on_closed_version: 'Masalah yang ditujukan pada versi tertutup tidak bisa dibuka kembali' error_can_not_archive_project: Proyek ini tidak bisa diarsipkan - + warning_attachments_not_saved: "%{count} berkas tidak bisa disimpan." - + mail_subject_lost_password: "Kata sandi %{value} anda" mail_body_lost_password: 'Untuk mengubah kata sandi anda, klik tautan berikut::' mail_subject_register: "Aktivasi akun %{value} anda" @@ -192,11 +192,11 @@ id: mail_body_wiki_content_added: "The '%{id}' halaman wiki sudah ditambahkan oleh %{author}." mail_subject_wiki_content_updated: "'%{id}' halaman wiki sudah diperbarui" mail_body_wiki_content_updated: "The '%{id}' halaman wiki sudah diperbarui oleh %{author}." - + gui_validation_error: 1 kesalahan gui_validation_error_plural: "%{count} kesalahan" - + field_name: Nama field_description: Deskripsi field_summary: Ringkasan @@ -214,7 +214,7 @@ id: field_is_for_all: Untuk semua proyek field_possible_values: Nilai yang mungkin field_regexp: Regular expression - field_min_length: Panjang minimum + field_min_length: Panjang minimum field_max_length: Panjang maksimum field_value: Nilai field_category: Kategori @@ -285,9 +285,9 @@ id: field_watcher: Pemantau field_identity_url: OpenID URL field_content: Isi - field_group_by: Dikelompokkan berdasar + field_group_by: Dikelompokkan berdasar field_sharing: Berbagi - + setting_app_title: Judul aplikasi setting_app_subtitle: Subjudul aplikasi setting_welcome_text: Teks sambutan @@ -325,8 +325,8 @@ id: setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_key: API key setting_sequential_project_identifiers: Buat pengenal proyek terurut - setting_gravatar_enabled: Gunakan icon pengguna dari Gravatar - setting_gravatar_default: Gambar default untuk Gravatar + setting_gravatar_enabled: Gunakan icon pengguna dari Gravatar + setting_gravatar_default: Gambar default untuk Gravatar setting_diff_max_lines_displayed: Maksimum perbedaan baris tertampil setting_file_max_size_displayed: Maksimum berkas tertampil secara inline setting_repository_log_display_limit: Nilai maksimum dari revisi ditampilkan di log berkas @@ -334,7 +334,7 @@ id: setting_password_min_length: Panjang minimum untuk kata sandi setting_new_project_user_role_id: Peran diberikan pada pengguna non-admin yang membuat proyek setting_default_projects_modules: Modul yang diaktifkan pada proyek baru - + permission_add_project: Tambahkan proyek permission_edit_project: Sunting proyek permission_select_project_modules: Pilih modul proyek @@ -385,7 +385,7 @@ id: permission_edit_own_messages: Sunting pesan saya permission_delete_messages: Hapus pesan permission_delete_own_messages: Hapus pesan saya - + project_module_issue_tracking: Pelacak masalah project_module_time_tracking: Pelacak waktu project_module_news: Berita @@ -394,19 +394,19 @@ id: project_module_wiki: Wiki project_module_repository: Repositori project_module_boards: Forum - + label_user: Pengguna label_user_plural: Pengguna label_user_new: Pengguna baru label_user_anonymous: Anonymous label_project: Proyek label_project_new: Proyek baru - label_project_plural: Proyek + label_project_plural: Proyek label_x_projects: - zero: tidak ada proyek - one: 1 proyek + zero: tidak ada proyek + one: 1 proyek other: "%{count} proyek" - label_project_all: Semua Proyek + label_project_all: Semua Proyek label_project_latest: Proyek terakhir label_issue: Masalah label_issue_new: Masalah baru @@ -588,7 +588,7 @@ id: label_modification: "%{count} perubahan" label_modification_plural: "%{count} perubahan" label_branch: Cabang - label_tag: Tag + label_tag: Tag label_revision: Revisi label_revision_plural: Revisi label_associated_revisions: Revisi terkait @@ -614,9 +614,9 @@ id: label_result_plural: Hasil label_all_words: Semua kata label_wiki: Wiki - label_wiki_edit: Sunting wiki - label_wiki_edit_plural: Sunting wiki - label_wiki_page: Halaman wiki + label_wiki_edit: Sunting wiki + label_wiki_edit_plural: Sunting wiki + label_wiki_page: Halaman wiki label_wiki_page_plural: Halaman wiki label_index_by_title: Indeks menurut judul label_index_by_date: Indeks menurut tanggal @@ -686,7 +686,7 @@ id: label_jump_to_a_project: Pilih proyek... label_file_plural: Berkas label_changeset_plural: Set perubahan - label_default_columns: Kolom default + label_default_columns: Kolom default label_no_change_option: (Tak ada perubahan) label_bulk_edit_selected_issues: Ubah masalah terpilih secara masal label_theme: Tema @@ -696,7 +696,7 @@ id: label_user_mail_option_selected: "Hanya untuk semua kejadian pada proyek yang saya pilih ..." label_user_mail_no_self_notified: "Saya tak ingin diberitahu untuk perubahan yang saya buat sendiri" label_user_mail_assigned_only_mail_notification: "Kirim email hanya bila saya ditugaskan untuk masalah terkait" - label_user_mail_block_mail_notification: "Saya tidak ingin menerima email. Terima kasih." + label_user_mail_block_mail_notification: "Saya tidak ingin menerima email. Terima kasih." label_registration_activation_by_email: aktivasi akun melalui email label_registration_manual_activation: aktivasi akun secara manual label_registration_automatic_activation: aktivasi akun secara otomatis @@ -779,17 +779,17 @@ id: button_configure: Konfigur button_quote: Kutip button_duplicate: Duplikat - + status_active: aktif status_registered: terdaftar status_locked: terkunci - + version_status_open: terbuka version_status_locked: terkunci version_status_closed: tertutup field_active: Aktif - + text_select_mail_notifications: Pilih aksi dimana email notifikasi akan dikirimkan. text_regexp_info: mis. ^[A-Z0-9]+$ text_min_max_length_info: 0 berarti tidak ada pembatasan @@ -843,7 +843,7 @@ id: text_wiki_page_nullify_children: "Biarkan halaman anak sebagai halaman teratas (root)" text_wiki_page_destroy_children: "Hapus halaman anak dan semua turunannya" text_wiki_page_reassign_children: "Tujukan halaman anak ke halaman induk yang ini" - + default_role_manager: Manager default_role_developer: Pengembang default_role_reporter: Pelapor @@ -867,7 +867,7 @@ id: default_priority_immediate: Segera default_activity_design: Rancangan default_activity_development: Pengembangan - + enumeration_issue_priorities: Prioritas masalah enumeration_doc_categories: Kategori dokumen enumeration_activities: Kegiatan diff --git a/config/locales/it.yml b/config/locales/it.yml index a5290802..63efe94d 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -1,4 +1,4 @@ -# Italian translations for Ruby on Rails +# Italian translations for Ruby on Rails # by Claudio Poli (masterkain@gmail.com) # by Diego Pierotto (ita.translations@tiscali.it) # by Emidio Stani (emidiostani@gmail.com) @@ -20,7 +20,7 @@ it: - :day - :month - :year - + time: formats: default: "%a %d %b %Y, %H:%M:%S %z" @@ -28,14 +28,14 @@ it: short: "%d %b %H:%M" long: "%d %B %Y %H:%M" only_second: "%S" - + datetime: formats: default: "%d-%m-%YT%H:%M:%S%Z" - + am: 'am' pm: 'pm' - + datetime: distance_in_words: half_a_minute: "mezzo minuto" @@ -72,7 +72,7 @@ it: almost_x_years: one: "quasi 1 anno" other: "quasi %{count} anni" - + number: format: precision: 3 @@ -94,16 +94,16 @@ it: mb: "MB" gb: "GB" tb: "TB" - + support: array: sentence_connector: "e" skip_last_comma: false - + activerecord: errors: template: - header: + header: one: "Non posso salvare questo %{model}: 1 errore" other: "Non posso salvare questo %{model}: %{count} errori." body: "Per favore ricontrolla i seguenti campi:" @@ -133,7 +133,7 @@ it: cant_link_an_issue_with_a_descendant: "Una segnalazione non può essere collegata a una delle sue discendenti" actionview_instancetag_blank_option: Scegli - + general_text_No: 'No' general_text_Yes: 'Sì' general_text_no: 'no' @@ -144,7 +144,7 @@ it: general_csv_encoding: ISO-8859-1 general_pdf_encoding: ISO-8859-1 general_first_day_of_week: '1' - + notice_account_updated: L'utente è stato aggiornato. notice_account_invalid_creditentials: Nome utente o password non validi. notice_account_password_updated: La password è stata aggiornata. @@ -164,18 +164,18 @@ it: notice_email_sent: "Una email è stata spedita a %{value}" notice_email_error: "Si è verificato un errore durante l'invio di una email (%{value})" notice_feeds_access_key_reseted: La tua chiave di accesso RSS è stata reimpostata. - + error_scm_not_found: "La risorsa e/o la versione non esistono nel repository." error_scm_command_failed: "Si è verificato un errore durante l'accesso al repository: %{value}" - + mail_subject_lost_password: "Password %{value}" mail_body_lost_password: 'Per cambiare la password, usa il seguente collegamento:' mail_subject_register: "Attivazione utente %{value}" mail_body_register: "Per attivare l'utente, usa il seguente collegamento:" - + gui_validation_error: 1 errore gui_validation_error_plural: "%{count} errori" - + field_name: Nome field_description: Descrizione field_summary: Sommario @@ -254,7 +254,7 @@ it: field_redirect_existing_links: Redirige i collegamenti esistenti field_estimated_hours: Tempo stimato field_default_value: Stato predefinito - + setting_app_title: Titolo applicazione setting_app_subtitle: Sottotitolo applicazione setting_welcome_text: Testo di benvenuto @@ -275,7 +275,7 @@ it: setting_autologin: Connessione automatica setting_date_format: Formato data setting_cross_project_issue_relations: Consenti la creazione di relazioni tra segnalazioni in progetti differenti - + label_user: Utente label_user_plural: Utenti label_user_new: Nuovo utente @@ -531,7 +531,7 @@ it: label_added_time_by: "Aggiunto da %{author} %{age} fa" label_updated_time: "Aggiornato %{value} fa" label_jump_to_a_project: Vai al progetto... - + button_login: Entra button_submit: Invia button_save: Salva @@ -564,11 +564,11 @@ it: button_unarchive: Ripristina button_reset: Reimposta button_rename: Rinomina - + status_active: attivo status_registered: registrato status_locked: bloccato - + text_select_mail_notifications: Seleziona le azioni per cui deve essere inviata una notifica. text_regexp_info: es. ^[A-Z0-9]+$ text_min_max_length_info: 0 significa nessuna restrizione @@ -591,7 +591,7 @@ it: text_issue_category_destroy_question: "Alcune segnalazioni (%{count}) risultano assegnate a questa categoria. Cosa vuoi fare ?" text_issue_category_destroy_assignments: Rimuovi le assegnazioni a questa categoria text_issue_category_reassign_to: Riassegna segnalazioni a questa categoria - + default_role_manager: Gestore default_role_developer: Sviluppatore default_role_reporter: Segnalatore @@ -615,7 +615,7 @@ it: default_priority_immediate: Immediata default_activity_design: Progettazione default_activity_development: Sviluppo - + enumeration_issue_priorities: Priorità segnalazioni enumeration_doc_categories: Categorie di documenti enumeration_activities: Attività (time tracking) diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 37d56f4c..a769c2d2 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -1,4 +1,4 @@ -# Japanese translations for Ruby on Rails +# Japanese translations for Ruby on Rails # by Akira Matsuda (ronnie@dio.jp) # AR error messages are basically taken from Ruby-GetText-Package. Thanks to Masao Mutoh. @@ -12,10 +12,10 @@ ja: default: "%Y/%m/%d" short: "%m/%d" long: "%Y年%m月%d日(%a)" - + day_names: [日曜日, 月曜日, 火曜日, 水曜日, 木曜日, 金曜日, 土曜日] abbr_day_names: [日, 月, 火, 水, 木, 金, 土] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月] abbr_month_names: [~, 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月] @@ -33,7 +33,7 @@ ja: long: "%Y年%m月%d日(%a) %H時%M分%S秒 %Z" am: "午前" pm: "午後" - + datetime: distance_in_words: half_a_minute: "30秒前後" @@ -108,13 +108,13 @@ ja: gb: "GB" tb: "TB" - + # Used in array.to_sentence. support: array: sentence_connector: "及び" skip_last_comma: true - + activerecord: errors: template: @@ -150,7 +150,7 @@ ja: cant_link_an_issue_with_a_descendant: "指定したチケットとは親子関係になっているため関連づけられません" actionview_instancetag_blank_option: 選んでください - + general_text_No: 'いいえ' general_text_Yes: 'はい' general_text_no: 'いいえ' @@ -161,7 +161,7 @@ ja: general_csv_encoding: CP932 general_pdf_encoding: CP932 general_first_day_of_week: '7' - + notice_account_updated: アカウントが更新されました。 notice_account_invalid_creditentials: ユーザ名もしくはパスワードが無効 notice_account_password_updated: パスワードが更新されました。 @@ -192,7 +192,7 @@ ja: notice_unable_delete_time_entry: 作業時間を削除できません notice_issue_done_ratios_updated: チケットの進捗が更新されました。 notice_gantt_chart_truncated: ガントチャートは、最大表示項目数(%{max})を超えたたため切り捨てられました。 - + error_can_t_load_default_data: "デフォルト設定がロードできませんでした: %{value}" error_scm_not_found: リポジトリに、エントリ/リビジョンが存在しません。 error_scm_command_failed: "リポジトリへアクセスしようとしてエラーになりました: %{value}" @@ -210,9 +210,9 @@ ja: error_workflow_copy_source: 'コピー元となるトラッカーまたはロールを選択してください' error_workflow_copy_target: 'コピー先となるトラッカーとロールを選択してください' error_can_not_delete_tracker: 'このトラッカーは使用されています。削除できません。' - + warning_attachments_not_saved: "%{count}個の添付ファイルが保存できませんでした。" - + mail_subject_lost_password: "%{value} パスワード再発行" mail_body_lost_password: 'パスワードを変更するには、以下のリンクをクリックしてください:' mail_subject_register: "%{value} アカウント登録の確認" @@ -227,10 +227,10 @@ ja: mail_body_wiki_content_added: "%{author} によってWikiページ %{id} が追加されました。" mail_subject_wiki_content_updated: "Wikiページ %{id} が更新されました" mail_body_wiki_content_updated: "%{author} によってWikiページ %{id} が更新されました。" - + gui_validation_error: 1件のエラー gui_validation_error_plural: "%{count}件のエラー" - + field_name: 名称 field_description: 説明 field_summary: サマリー @@ -328,7 +328,7 @@ ja: field_text: テキスト field_visible: 表示 field_warn_on_leaving_unsaved: セーブされていないページから移動するときに警告する - + setting_app_title: アプリケーションのタイトル setting_app_subtitle: アプリケーションのサブタイトル setting_welcome_text: ウェルカムメッセージ @@ -387,7 +387,7 @@ ja: setting_commit_logtime_enabled: コミット時に作業時間を記録する setting_commit_logtime_activity_id: 作業時間の作業分類 setting_gantt_items_limit: ガントチャート最大表示項目数 - + permission_add_project: プロジェクトの追加 permission_add_subprojects: サブプロジェクトの追加 permission_edit_project: プロジェクトの編集 @@ -443,7 +443,7 @@ ja: permission_delete_messages: メッセージの削除 permission_delete_own_messages: 自身が記入したメッセージの削除 permission_manage_subtasks: 子チケットの管理 - + project_module_issue_tracking: チケットトラッキング project_module_time_tracking: 時間トラッキング project_module_news: ニュース @@ -454,7 +454,7 @@ ja: project_module_boards: フォーラム project_module_gantt: ガントチャート project_module_calendar: カレンダー - + label_user: ユーザ label_user_plural: ユーザ label_user_new: 新しいユーザ @@ -820,7 +820,7 @@ ja: label_project_copy_notifications: コピーしたチケットのメール通知を送信する label_principal_search: "ユーザまたはグループの検索:" label_user_search: "ユーザの検索:" - + button_login: ログイン button_submit: 変更 button_save: 保存 @@ -867,17 +867,17 @@ ja: button_quote: 引用 button_duplicate: 複製 button_show: 表示 - + status_active: 有効 status_registered: 登録 status_locked: ロック - + version_status_open: 進行中 version_status_locked: ロック中 version_status_closed: 終了 field_active: 有効 - + text_select_mail_notifications: どのメール通知を送信するか、アクションを選択してください。 text_regexp_info: 例) ^[A-Z0-9]+$ text_min_max_length_info: 0だと無制限になります @@ -939,7 +939,7 @@ ja: text_zoom_in: 拡大 text_zoom_out: 縮小 text_warn_on_leaving_unsaved: このページから移動すると、セーブされていないデータが失われます。 - + default_role_manager: 管理者 default_role_developer: 開発者 default_role_reporter: 報告者 @@ -963,7 +963,7 @@ ja: default_priority_immediate: 今すぐ default_activity_design: 設計作業 default_activity_development: 開発作業 - + enumeration_issue_priorities: チケットの優先度 enumeration_doc_categories: 文書カテゴリ enumeration_activities: 作業分類 (時間トラッキング) diff --git a/config/locales/ko.yml b/config/locales/ko.yml index fd0c078c..e344b875 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -1,4 +1,4 @@ -# Korean translations for Ruby on Rails +# Korean translations for Ruby on Rails # by Kihyun Yoon(ddumbugie@gmail.com),http://plenum.textcube.com/ # by John Hwang (jhwang@tavon.org),http://github.com/tavon # by Yonghwan SO(please insert your email), last update at 2009-09-11 @@ -13,10 +13,10 @@ ko: default: "%Y/%m/%d" short: "%m/%d" long: "%Y년 %m월 %d일 (%a)" - + day_names: [일요일, 월요일, 화요일, 수요일, 목요일, 금요일, 토요일] abbr_day_names: [일, 월, 화, 수, 목, 금, 토] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, 1월, 2월, 3월, 4월, 5월, 6월, 7월, 8월, 9월, 10월, 11월, 12월] abbr_month_names: [~, 1월, 2월, 3월, 4월, 5월, 6월, 7월, 8월, 9월, 10월, 11월, 12월] @@ -34,7 +34,7 @@ ko: long: "%Y년 %B월 %d일, %H시 %M분 %S초 %Z" am: "오전" pm: "오후" - + datetime: distance_in_words: half_a_minute: "30초" @@ -78,7 +78,7 @@ ko: hour: "시" minute: "분" second: "초" - + number: # Used in number_with_delimiter() # These are also the defaults for 'currency', 'percentage', 'precision', and 'human' @@ -89,7 +89,7 @@ ko: delimiter: "," # Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00) precision: 3 - + # Used in number_to_currency() currency: format: @@ -100,15 +100,15 @@ ko: separator: "." delimiter: "," precision: 0 - + # Used in number_to_percentage() percentage: format: # These three are to override number.format and are optional - # separator: + # separator: delimiter: "" - # precision: - + # precision: + # Used in number_to_precision() precision: format: @@ -116,12 +116,12 @@ ko: # separator: delimiter: "" # precision: - + # Used in number_to_human_size() human: format: # These three are to override number.format and are optional - # separator: + # separator: delimiter: "" precision: 1 storage_units: @@ -143,7 +143,7 @@ ko: last_word_connector: ", " sentence_connector: "그리고" skip_last_comma: false - + activerecord: errors: template: @@ -179,7 +179,7 @@ ko: cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" actionview_instancetag_blank_option: 선택하세요 - + general_text_No: '아니오' general_text_Yes: '예' general_text_no: '아니오' @@ -190,7 +190,7 @@ ko: general_csv_encoding: CP949 general_pdf_encoding: CP949 general_first_day_of_week: '7' - + notice_account_updated: 계정이 성공적으로 변경되었습니다. notice_account_invalid_creditentials: 잘못된 계정 또는 비밀번호 notice_account_password_updated: 비밀번호가 잘 변경되었습니다. @@ -215,7 +215,7 @@ ko: notice_account_pending: "계정이 만들어졌으며 관리자 승인 대기중입니다." notice_default_data_loaded: 기본값을 성공적으로 읽어들였습니다. notice_unable_delete_version: 삭제할 수 없는 버전입니다. - + error_can_t_load_default_data: "기본값을 읽어들일 수 없습니다.: %{value}" error_scm_not_found: 항목이나 리비젼이 저장소에 존재하지 않습니다. error_scm_command_failed: "저장소에 접근하는 도중에 오류가 발생하였습니다.: %{value}" @@ -223,7 +223,7 @@ ko: error_issue_not_found_in_project: '일감이 없거나 이 프로젝트의 것이 아닙니다.' warning_attachments_not_saved: "%{count}개 파일을 저장할 수 없습니다." - + mail_subject_lost_password: "%{value} 비밀번호" mail_body_lost_password: '비밀번호를 변경하려면 다음 링크를 클릭하세요.' mail_subject_register: "%{value} 계정 활성화" @@ -238,10 +238,10 @@ ko: mail_subject_wiki_content_updated: "'위키페이지 %{id}'이(가) 수정되었습니다." mail_body_wiki_content_added: "%{author}이(가) 위키페이지 '%{id}'을(를) 추가하였습니다." mail_body_wiki_content_updated: "%{author}이(가) 위키페이지 '%{id}'을(를) 수정하였습니다." - + gui_validation_error: 에러 gui_validation_error_plural: "%{count}개 에러" - + field_name: 이름 field_description: 설명 field_summary: 요약 @@ -330,7 +330,7 @@ ko: field_identity_url: OpenID URL field_content: 내용 field_group_by: 결과를 묶어 보여줄 기준 - + setting_app_title: 레드마인 제목 setting_app_subtitle: 레드마인 부제목 setting_welcome_text: 환영 메시지 @@ -350,12 +350,12 @@ ko: setting_autofetch_changesets: 제출(commit)된 변경묶음을 자동으로 가져오기 setting_sys_api_enabled: 저장소 관리에 WS를 사용 setting_commit_ref_keywords: 일감 참조에 사용할 키워드들 - setting_commit_fix_keywords: 일감 해결에 사용할 키워드들 + setting_commit_fix_keywords: 일감 해결에 사용할 키워드들 setting_autologin: 자동 로그인 setting_date_format: 날짜 형식 setting_time_format: 시간 형식 setting_cross_project_issue_relations: 다른 프로젝트의 일감과 연결하는 것을 허용 - setting_issue_list_default_columns: 일감 목록에 표시할 항목 + setting_issue_list_default_columns: 일감 목록에 표시할 항목 setting_repositories_encodings: 저장소 인코딩 setting_commit_logs_encoding: 제출(commit) 기록 인코딩 setting_emails_footer: 메일 꼬리 @@ -434,7 +434,7 @@ ko: project_module_wiki: 위키 project_module_repository: 저장소 project_module_boards: 게시판 - + label_user: 사용자 label_user_plural: 사용자 label_user_new: 새 사용자 @@ -577,7 +577,7 @@ ko: label_add_note: 일감덧글 추가 label_per_page: 페이지별 label_calendar: 달력 - label_months_from: 개월 동안 | 다음부터 + label_months_from: 개월 동안 | 다음부터 label_gantt: Gantt 챠트 label_internal: 내부 label_last_changes: "최근 %{count}개의 변경사항" @@ -743,10 +743,10 @@ ko: label_ldap_authentication: LDAP 인증 label_downloads_abbr: D/L label_optional_description: 부가적인 설명 - label_add_another_file: 다른 파일 추가 + label_add_another_file: 다른 파일 추가 label_preferences: 설정 label_chronological_order: 시간 순으로 정렬 - label_reverse_chronological_order: 시간 역순으로 정렬 + label_reverse_chronological_order: 시간 역순으로 정렬 label_planning: 프로젝트계획 label_incoming_emails: 수신 메일 label_generate_key: 키 생성 @@ -799,11 +799,11 @@ ko: button_update: 수정 button_configure: 설정 button_quote: 댓글달기 - + status_active: 사용중 status_registered: 등록대기 status_locked: 잠김 - + text_select_mail_notifications: 알림메일이 필요한 작업을 선택하세요. text_regexp_info: 예) ^[A-Z0-9]+$ text_min_max_length_info: 0 는 제한이 없음을 의미함 @@ -853,7 +853,7 @@ ko: text_wiki_page_nullify_children: 하위 페이지를 최상위 페이지 아래로 지정 text_wiki_page_destroy_children: 모든 하위 페이지와 관련 내용을 삭제 text_wiki_page_reassign_children: 하위 페이지를 이 페이지 아래로 지정 - + default_role_manager: 관리자 default_role_developer: 개발자 default_role_reporter: 보고자 diff --git a/config/locales/lt.yml b/config/locales/lt.yml index ada822a0..75566334 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -89,7 +89,7 @@ lt: separator: "," delimiter: " " precision: 3 - + currency: format: format: "%n %u" @@ -97,15 +97,15 @@ lt: separator: "," delimiter: " " precision: 2 - + percentage: format: delimiter: "" - + precision: format: delimiter: "" - + human: format: delimiter: "" @@ -183,9 +183,9 @@ lt: not_same_project: "nepriklauso tam pačiam projektui" circular_dependency: "Šis ryšys sukurtų ciklinę priklausomybę" cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" - + actionview_instancetag_blank_option: prašom parinkti - + general_text_No: 'Ne' general_text_Yes: 'Taip' general_text_no: 'ne' @@ -196,7 +196,7 @@ lt: general_csv_encoding: UTF-8 general_pdf_encoding: UTF-8 general_first_day_of_week: '1' - + notice_account_updated: Paskyra buvo sėkmingai atnaujinta. notice_account_invalid_creditentials: Negaliojantis vartotojo vardas ar slaptažodis notice_account_password_updated: Slaptažodis buvo sėkmingai atnaujintas. @@ -221,7 +221,7 @@ lt: notice_account_pending: "Jūsų paskyra buvo sukurta ir dabar laukiama administratoriaus patvirtinimo." notice_default_data_loaded: Numatytoji konfiguracija sėkmingai užkrauta. notice_unable_delete_version: Neįmanoma panaikinti versiją - + error_can_t_load_default_data: "Numatytoji konfiguracija negali būti užkrauta: %{value}" error_scm_not_found: "Duomenys ir/ar pakeitimai saugykloje(repozitorojoje) neegzistuoja." error_scm_command_failed: "Įvyko klaida jungiantis prie saugyklos: %{value}" @@ -251,7 +251,7 @@ lt: gui_validation_error: 1 klaida gui_validation_error_plural: "%{count} klaidų(os)" - + field_name: Pavadinimas field_description: Aprašas field_summary: Santrauka @@ -451,7 +451,7 @@ lt: project_module_wiki: Wiki project_module_repository: Saugykla project_module_boards: Forumai - + label_user: Vartotojas label_user_plural: Vartotojai label_user_new: Naujas vartotojas @@ -919,7 +919,7 @@ lt: default_priority_immediate: Neatidėliotinas default_activity_design: Projektavimas default_activity_development: Vystymas - + enumeration_issue_priorities: Darbo prioritetai enumeration_doc_categories: Dokumento kategorijos enumeration_activities: Veiklos (laiko sekimas) diff --git a/config/locales/lv.yml b/config/locales/lv.yml index 12b5ddab..cd291b76 100644 --- a/config/locales/lv.yml +++ b/config/locales/lv.yml @@ -7,10 +7,10 @@ lv: default: "%d.%m.%Y" short: "%d %b" long: "%d %B %Y" - + day_names: [Svētdiena, Pirmdiena, Otrdiena, Trešdiena, Ceturtdiena, Piektdiena, Sestdiena] abbr_day_names: [Sv, Pr, Ot, Tr, Ct, Pk, St] - + month_names: [~, Janvāris, Februāris, Marts, Aprīlis , Maijs, Jūnijs, Jūlijs, Augusts, Septembris, Oktobris, Novembris, Decembris] abbr_month_names: [~, Jan, Feb, Mar, Apr, Mai, Jūn, Jūl, Aug, Sep, Okt, Nov, Dec] order: @@ -26,7 +26,7 @@ lv: long: "%B %d, %Y %H:%M" am: "rītā" pm: "vakarā" - + datetime: distance_in_words: half_a_minute: "pus minūte" @@ -84,12 +84,12 @@ lv: gb: "GB" tb: "TB" - + support: array: sentence_connector: "un" skip_last_comma: false - + activerecord: errors: template: @@ -123,7 +123,7 @@ lv: cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" actionview_instancetag_blank_option: Izvēlieties - + general_text_No: 'Nē' general_text_Yes: 'Jā' general_text_no: 'nē' @@ -134,7 +134,7 @@ lv: general_csv_encoding: UTF-8 general_pdf_encoding: UTF-8 general_first_day_of_week: '1' - + notice_account_updated: Konts tika atjaunots veiksmīgi. notice_account_invalid_creditentials: Nepareizs lietotāja vārds vai parole. notice_account_password_updated: Parole tika veiksmīgi atjaunota. @@ -161,7 +161,7 @@ lv: notice_default_data_loaded: Noklusētā konfigurācija tika veiksmīgi ielādēta. notice_unable_delete_version: Neizdevās dzēst versiju. notice_issue_done_ratios_updated: Uzdevuma izpildes koeficients atjaunots. - + error_can_t_load_default_data: "Nevar ielādēt noklusētos konfigurācijas datus: %{value}" error_scm_not_found: "Ieraksts vai versija nebija repozitorijā." error_scm_command_failed: "Mēģinot piekļūt repozitorijam, notika kļūda: %{value}" @@ -174,9 +174,9 @@ lv: error_issue_done_ratios_not_updated: "Uzdevuma izpildes koeficients nav atjaunots." error_workflow_copy_source: 'Lūdzu izvēlieties avota trakeri vai lomu' error_workflow_copy_target: 'Lūdzu izvēlēties mērķa trakeri(us) un lomu(as)' - + warning_attachments_not_saved: "%{count} datnes netika saglabātas." - + mail_subject_lost_password: "Jūsu %{value} parole" mail_body_lost_password: 'Lai mainītu paroli, spiediet uz šīs saites:' mail_subject_register: "Jūsu %{value} konta aktivizācija" @@ -191,10 +191,10 @@ lv: mail_body_wiki_content_added: "The '%{id}' Wiki lapu pievienojis %{author}." mail_subject_wiki_content_updated: "'%{id}' Wiki lapa atjaunota" mail_body_wiki_content_updated: "The '%{id}' Wiki lapu atjaunojis %{author}." - + gui_validation_error: 1 kļūda gui_validation_error_plural: "%{count} kļūdas" - + field_name: Nosaukums field_description: Apraksts field_summary: Kopsavilkums @@ -284,7 +284,7 @@ lv: field_content: Saturs field_group_by: Grupēt rezultātus pēc field_sharing: Koplietošana - + setting_app_title: Programmas nosaukums setting_app_subtitle: Programmas apakš-nosaukums setting_welcome_text: Sveiciena teksts @@ -338,7 +338,7 @@ lv: setting_start_of_week: Sākt kalendāru ar setting_rest_api_enabled: Lietot REST web-servisu setting_cache_formatted_text: Kešot formatētu tekstu - + permission_add_project: Izveidot projektu permission_add_subprojects: Izveidot apakšprojektu permission_edit_project: Rediģēt projektu @@ -383,7 +383,7 @@ lv: permission_protect_wiki_pages: Projekta wiki lapas permission_manage_repository: Pārvaldīt repozitoriju permission_browse_repository: Pārlūkot repozitoriju - permission_view_changesets: Skatīt izmaiņu kopumus + permission_view_changesets: Skatīt izmaiņu kopumus permission_commit_access: Atļaut piekļuvi permission_manage_boards: Pārvaldīt ziņojumu dēļus permission_view_messages: Skatīt ziņas @@ -393,7 +393,7 @@ lv: permission_delete_messages: Dzēst ziņas permission_delete_own_messages: Dzēst savas ziņas permission_export_wiki_pages: Eksportēt Wiki lapas - + project_module_issue_tracking: Uzdevumu uzskaite project_module_time_tracking: Laika uzskaite project_module_news: Jaunumi @@ -402,7 +402,7 @@ lv: project_module_wiki: Wiki project_module_repository: Repozitorijs project_module_boards: Ziņojumu dēļi - + label_user: Lietotājs label_user_plural: Lietotāji label_user_new: Jauns lietotājs @@ -597,7 +597,7 @@ lv: label_modification: "%{count} izmaiņa" label_modification_plural: "%{count} izmaiņas" label_branch: Zars - label_tag: Birka + label_tag: Birka label_revision: Revīzija label_revision_plural: Revīzijas label_revision_id: "Revīzija %{value}" @@ -755,7 +755,7 @@ lv: label_api_access_key: API pieejas atslēga label_missing_api_access_key: Trūkst API pieejas atslēga label_api_access_key_created_on: "API pieejas atslēga izveidota pirms %{value}" - + button_login: Pieslēgties button_submit: Nosūtīt button_save: Saglabāt @@ -799,17 +799,17 @@ lv: button_quote: Citāts button_duplicate: Dublēt button_show: Rādīt - + status_active: aktīvs status_registered: reģistrēts status_locked: slēgts - + version_status_open: atvērta version_status_locked: slēgta version_status_closed: aizvērta field_active: Aktīvs - + text_select_mail_notifications: "Izvēlieties darbības, par kurām vēlaties saņemt ziņojumus e-pastā" text_regexp_info: "piem. ^[A-Z0-9]+$" text_min_max_length_info: "0 nozīmē, ka nav ierobežojumu" @@ -839,7 +839,7 @@ lv: text_issue_category_destroy_question: "Daži uzdevumi (%{count}) ir nozīmēti šai kategorijai. Ko Jūs vēlaties darīt?" text_issue_category_destroy_assignments: Dzēst kategoriju nozīmējumus text_issue_category_reassign_to: Nozīmēt uzdevumus šai kategorijai - text_user_mail_option: "No neizvēlētajiem projektiem Jūs saņemsiet ziņojumus e-pastā tikai par notikumiem, kuriem Jūs sekojat vai kuros esat iesaistīts." + text_user_mail_option: "No neizvēlētajiem projektiem Jūs saņemsiet ziņojumus e-pastā tikai par notikumiem, kuriem Jūs sekojat vai kuros esat iesaistīts." text_no_configuration_data: "Lomas, trakeri, uzdevumu statusi un darba plūsmas vēl nav konfigurētas.\nĻoti ieteicams ielādēt noklusēto konfigurāciju. Pēc ielādēšanas to būs iespējams modificēt." text_load_default_configuration: Ielādēt noklusēto konfigurāciju text_status_changed_by_changeset: "Apstiprināts izmaiņu kopumā %{value}." @@ -865,7 +865,7 @@ lv: text_wiki_page_destroy_children: "Dzēst apakšlapas un visus pēcnācējus" text_wiki_page_reassign_children: "Piešķirt apakšlapas šai lapai" text_own_membership_delete_confirmation: "Jūs tūlīt dzēsīsiet dažas vai visas atļaujas, un Jums pēc tam var nebūt atļauja labot šo projektu.\nVai turpināt?" - + default_role_manager: Menedžeris default_role_developer: Izstrādātājs default_role_reporter: Ziņotājs @@ -889,7 +889,7 @@ lv: default_priority_immediate: Tūlītēja default_activity_design: Dizains default_activity_development: Izstrādāšana - + enumeration_issue_priorities: Uzdevumu prioritātes enumeration_doc_categories: Dokumentu kategorijas enumeration_activities: Aktivitātes (laika uzskaite) diff --git a/config/locales/mn.yml b/config/locales/mn.yml index 3eb21c5c..2c62135a 100644 --- a/config/locales/mn.yml +++ b/config/locales/mn.yml @@ -8,10 +8,10 @@ mn: default: "%Y/%m/%d" short: "%b %d" long: "%Y, %B %d" - + day_names: [Даваа, Мягмар, Лхагва, Пүрэв, Баасан, Бямба, Ням] abbr_day_names: [Дав, Мяг, Лха, Пүр, Бсн, Бям, Ням] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, 1-р сар, 2-р сар, 3-р сар, 4-р сар, 5-р сар, 6-р сар, 7-р сар, 8-р сар, 9-р сар, 10-р сар, 11-р сар, 12-р сар] abbr_month_names: [~, 1сар, 2сар, 3сар, 4сар, 5сар, 6сар, 7сар, 8сар, 9сар, 10сар, 11сар, 12сар] @@ -29,7 +29,7 @@ mn: long: "%Y, %B %d %H:%M" am: "am" pm: "pm" - + datetime: distance_in_words: half_a_minute: "хагас минут" @@ -87,13 +87,13 @@ mn: gb: "GB" tb: "TB" - + # Used in array.to_sentence. support: array: sentence_connector: "бас" skip_last_comma: false - + activerecord: errors: template: @@ -127,7 +127,7 @@ mn: cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" actionview_instancetag_blank_option: Сонгоно уу - + general_text_No: 'Үгүй' general_text_Yes: 'Тийм' general_text_no: 'үгүй' @@ -138,7 +138,7 @@ mn: general_csv_encoding: UTF-8 general_pdf_encoding: UTF-8 general_first_day_of_week: '7' - + notice_account_updated: Дансыг амжилттай өөрчиллөө. notice_account_invalid_creditentials: Хэрэглэгчийн нэр эсвэл нууц үг буруу байна notice_account_password_updated: Нууц үгийг амжилттай өөрчиллөө. @@ -165,7 +165,7 @@ mn: notice_default_data_loaded: Стандарт тохиргоог амжилттай ачааллаа. notice_unable_delete_version: Хувилбарыг устгах боломжгүй. notice_issue_done_ratios_updated: Issue done ratios updated. - + error_can_t_load_default_data: "Стандарт тохиргоог ачаалж чадсангүй: %{value}" error_scm_not_found: "Repository дотор тухайн бичлэг эсвэл хувилбарыг олсонгүй." error_scm_command_failed: "Repository-д хандахад алдаа гарлаа: %{value}" @@ -178,9 +178,9 @@ mn: error_issue_done_ratios_not_updated: "Issue done ratios not updated." error_workflow_copy_source: 'Please select a source tracker or role' error_workflow_copy_target: 'Please select target tracker(s) and role(s)' - + warning_attachments_not_saved: "%{count} file(s) файлыг хадгалж чадсангүй." - + mail_subject_lost_password: "Таны %{value} нууц үг" mail_body_lost_password: 'Нууц үгээ өөрчлөхийн тулд доорх холбоос дээр дарна уу:' mail_subject_register: "Таны %{value} дансыг идэвхжүүлэх" @@ -195,10 +195,10 @@ mn: mail_body_wiki_content_added: "The '%{id}' wiki page has been added by %{author}." mail_subject_wiki_content_updated: "'%{id}' wiki page has been updated" mail_body_wiki_content_updated: "The '%{id}' wiki page has been updated by %{author}." - + gui_validation_error: 1 алдаа gui_validation_error_plural: "%{count} алдаа" - + field_name: Нэр field_description: Тайлбар field_summary: Дүгнэлт @@ -288,7 +288,7 @@ mn: field_content: Агуулга field_group_by: Үр дүнгээр бүлэглэх field_sharing: Sharing - + setting_app_title: Программын гарчиг setting_app_subtitle: Программын дэд гарчиг setting_welcome_text: Мэндчилгээ @@ -342,7 +342,7 @@ mn: setting_start_of_week: Start calendars on setting_rest_api_enabled: Enable REST web service setting_cache_formatted_text: Cache formatted text - + permission_add_project: Create project permission_add_subprojects: Create subprojects permission_edit_project: Төслийг засварлах @@ -397,7 +397,7 @@ mn: permission_delete_messages: Зурвасуудыг устгах permission_delete_own_messages: Өөрийн зурвасуудыг устгах permission_export_wiki_pages: Вики хуудсуудыг экспорт хийх - + project_module_issue_tracking: Асуудал хянах project_module_time_tracking: Хугацаа хянах project_module_news: Мэдээ мэдээллүүд @@ -406,7 +406,7 @@ mn: project_module_wiki: Вики project_module_repository: Репозитори project_module_boards: Самбарууд - + label_user: Хэрэглэгч label_user_plural: Хэрэглэгчид label_user_new: Шинэ хэрэглэгч @@ -505,7 +505,7 @@ mn: label_attachment_plural: Файлууд label_file_added: Файл нэмэгдлээ label_report: Тайлан - label_report_plural: Тайлангууд + label_report_plural: Тайлангууд label_news: Мэдээ label_news_new: Шинэ мэдээ label_news_plural: Мэдээ @@ -602,7 +602,7 @@ mn: label_modification: "%{count} өөрчлөлт" label_modification_plural: "%{count} өөрчлөлтүүд" label_branch: Салбар - label_tag: Шошго + label_tag: Шошго label_revision: Хувилбар label_revision_plural: Хувилбарууд label_revision_id: "%{value} Хувилбар" @@ -760,7 +760,7 @@ mn: label_api_access_key: API access key label_missing_api_access_key: Missing an API access key label_api_access_key_created_on: "API access key created %{value} ago" - + button_login: Нэвтрэх button_submit: Илгээх button_save: Хадгалах @@ -804,17 +804,17 @@ mn: button_quote: Ишлэл button_duplicate: Хуулбар button_show: Үзэх - + status_active: идэвхтэй status_registered: бүртгүүлсэн status_locked: түгжээтэй - + version_status_open: нээлттэй version_status_locked: түгжээтэй version_status_closed: хаалттай field_active: идэвхтэй - + text_select_mail_notifications: Ямар үед имэйлээр мэдэгдэл илгээхийг сонгоно уу. text_regexp_info: eg. ^[A-Z0-9]+$ text_min_max_length_info: 0 гэвэл ямар ч хязгааргүй гэсэн үг @@ -870,7 +870,7 @@ mn: text_wiki_page_destroy_children: "Delete child pages and all their descendants" text_wiki_page_reassign_children: "Reassign child pages to this parent page" text_own_membership_delete_confirmation: "You are about to remove some or all of your permissions and may no longer be able to edit this project after that.\nAre you sure you want to continue?" - + default_role_manager: Менежер default_role_developer: Хөгжүүлэгч default_role_reporter: Мэдэгдэгч @@ -895,7 +895,7 @@ mn: default_priority_immediate: Нэн даруй default_activity_design: Дизайн default_activity_development: Хөгжүүлэлт - + enumeration_issue_priorities: Асуудлын зэрэглэлүүд enumeration_doc_categories: Бичиг баримтын ангиллууд enumeration_activities: Үйл ажиллагаанууд (хугацааг хянах) diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 8854a14c..7fa08fc5 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -8,10 +8,10 @@ nl: default: "%d-%m-%Y" short: "%e %b" long: "%d %B, %Y" - + day_names: [zondag, maandag, dinsdag, woensdag, donderdag, vrijdag, zaterdag] abbr_day_names: [zo, ma, di, wo, do, vr, za] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, januari, februari, maart, april, mei, juni, juli, augustus, september, oktober, november, december] abbr_month_names: [~, jan, feb, mar, apr, mei, jun, jul, aug, sep, okt, nov, dec] @@ -29,7 +29,7 @@ nl: long: "%d %B, %Y %H:%M" am: "am" pm: "pm" - + datetime: distance_in_words: half_a_minute: "halve minuut" @@ -72,27 +72,27 @@ nl: separator: "." delimiter: "" precision: 3 - human: - format: + human: + format: precision: 1 delimiter: "" - storage_units: + storage_units: format: "%n %u" - units: + units: kb: KB tb: TB gb: GB - byte: + byte: one: Byte other: Bytes mb: MB - + # Used in array.to_sentence. support: array: sentence_connector: "en" skip_last_comma: false - + activerecord: errors: template: @@ -126,7 +126,7 @@ nl: cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" actionview_instancetag_blank_option: Selecteer - + button_activate: Activeer button_add: Voeg toe button_annotate: Annoteer @@ -717,7 +717,7 @@ nl: setting_gravatar_enabled: Gebruik Gravatar gebruikersiconen setting_host_name: Hostnaam setting_issue_list_default_columns: Standaardkolommen getoond op de lijst met issues - setting_issues_export_limit: Max aantal te exporteren issues + setting_issues_export_limit: Max aantal te exporteren issues setting_login_required: Authenticatie vereist setting_mail_from: Afzender e-mail adres setting_mail_handler_api_enabled: Schakel WS in voor inkomende mail. @@ -786,7 +786,7 @@ nl: text_custom_field_possible_values_info: 'Per lijn een waarde' label_display: Toon field_editable: Bewerkbaar - setting_repository_log_display_limit: Max aantal revisies zichbaar + setting_repository_log_display_limit: Max aantal revisies zichbaar setting_file_max_size_displayed: Max grootte van tekst bestanden inline zichtbaar field_watcher: Watcher setting_openid: Sta OpenID login en registratie toe diff --git a/config/locales/no.yml b/config/locales/no.yml index d1f3042c..14e2a953 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -116,9 +116,9 @@ circular_dependency: "Denne relasjonen ville lagd en sirkulær avhengighet" cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" - + actionview_instancetag_blank_option: Vennligst velg - + general_text_No: 'Nei' general_text_Yes: 'Ja' general_text_no: 'nei' @@ -129,7 +129,7 @@ general_csv_encoding: ISO-8859-1 general_pdf_encoding: ISO-8859-1 general_first_day_of_week: '1' - + notice_account_updated: Kontoen er oppdatert. notice_account_invalid_creditentials: Feil brukernavn eller passord notice_account_password_updated: Passordet er oppdatert. @@ -153,13 +153,13 @@ notice_no_issue_selected: "Ingen sak valgt! Vennligst merk sakene du vil endre." notice_account_pending: "Din konto ble opprettet og avventer nå administrativ godkjenning." notice_default_data_loaded: Standardkonfigurasjonen lastet inn. - + error_can_t_load_default_data: "Standardkonfigurasjonen kunne ikke lastes inn: %{value}" error_scm_not_found: "Elementet og/eller revisjonen eksisterer ikke i depoet." error_scm_command_failed: "En feil oppstod under tilkobling til depoet: %{value}" error_scm_annotate: "Elementet eksisterer ikke, eller kan ikke noteres." error_issue_not_found_in_project: 'Saken eksisterer ikke, eller hører ikke til dette prosjektet' - + mail_subject_lost_password: "Ditt %{value} passord" mail_body_lost_password: 'Klikk følgende lenke for å endre ditt passord:' mail_subject_register: "%{value} kontoaktivering" @@ -170,10 +170,10 @@ mail_body_account_activation_request: "En ny bruker (%{value}) er registrert, og avventer din godkjenning:" mail_subject_reminder: "%{count} sak(er) har frist de kommende %{days} dagene" mail_body_reminder: "%{count} sak(er) som er tildelt deg har frist de kommende %{days} dager:" - + gui_validation_error: 1 feil gui_validation_error_plural: "%{count} feil" - + field_name: Navn field_description: Beskrivelse field_summary: Oppsummering @@ -256,7 +256,7 @@ field_searchable: Søkbar field_default_value: Standardverdi field_comments_sorting: Vis kommentarer - + setting_app_title: Applikasjonstittel setting_app_subtitle: Applikasjonens undertittel setting_welcome_text: Velkomsttekst @@ -289,7 +289,7 @@ setting_activity_days_default: Dager vist på prosjektaktivitet setting_display_subprojects_issues: Vis saker fra underprosjekter på hovedprosjekt som standard setting_enabled_scm: Aktiviserte SCM - + project_module_issue_tracking: Sakssporing project_module_time_tracking: Tidssporing project_module_news: Nyheter @@ -298,7 +298,7 @@ project_module_wiki: Wiki project_module_repository: Depot project_module_boards: Forumer - + label_user: Bruker label_user_plural: Brukere label_user_new: Ny bruker @@ -358,7 +358,7 @@ label_logout: Logg ut label_help: Hjelp label_reported_issues: Rapporterte saker - label_assigned_to_me_issues: Saker tildelt meg + label_assigned_to_me_issues: Saker tildelt meg label_last_login: Sist innlogget label_registered_on: Registrert label_activity: Aktivitet @@ -605,7 +605,7 @@ label_chronological_order: I kronologisk rekkefølge label_reverse_chronological_order: I omvendt kronologisk rekkefølge label_planning: Planlegging - + button_login: Logg inn button_submit: Send button_save: Lagre @@ -643,11 +643,11 @@ button_annotate: Notér button_update: Oppdater button_configure: Konfigurer - + status_active: aktiv status_registered: registrert status_locked: låst - + text_select_mail_notifications: Velg hendelser som skal varsles med e-post. text_regexp_info: eg. ^[A-Z0-9]+$ text_min_max_length_info: 0 betyr ingen begrensning @@ -686,7 +686,7 @@ text_assign_time_entries_to_project: Overfør førte timer til prosjektet text_reassign_time_entries: 'Overfør førte timer til denne saken:' text_user_wrote: "%{value} skrev:" - + default_role_manager: Leder default_role_developer: Utvikler default_role_reporter: Rapportør @@ -710,7 +710,7 @@ default_priority_immediate: Omgående default_activity_design: Design default_activity_development: Utvikling - + enumeration_issue_priorities: Sakssprioriteringer enumeration_doc_categories: Dokument-kategorier enumeration_activities: Aktiviteter (tidssporing) diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 8f459418..bd83c30a 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -39,10 +39,10 @@ pl: default: "%Y-%m-%d" short: "%d %b" long: "%d %B %Y" - + day_names: [Niedziela, Poniedziałek, Wtorek, Środa, Czwartek, Piątek, Sobota] abbr_day_names: [nie, pon, wto, śro, czw, pia, sob] - + month_names: [~, Styczeń, Luty, Marzec, Kwiecień, Maj, Czerwiec, Lipiec, Sierpień, Wrzesień, Październik, Listopad, Grudzień] abbr_month_names: [~, sty, lut, mar, kwi, maj, cze, lip, sie, wrz, paź, lis, gru] order: @@ -133,7 +133,7 @@ pl: not_same_project: "nie należy do tego samego projektu" circular_dependency: "Ta relacja może wytworzyć kołową zależność" cant_link_an_issue_with_a_descendant: "Zagadnienie nie może zostać powiązane z jednym z własnych podzagadnień" - + support: array: sentence_connector: "i" @@ -143,7 +143,7 @@ pl: # Best regards from Lublin@Poland :-) # PL translation by Mariusz@Olejnik.net, actionview_instancetag_blank_option: Proszę wybierz - + button_activate: Aktywuj button_add: Dodaj button_annotate: Adnotuj @@ -809,7 +809,7 @@ pl: text_user_wrote: "%{value} napisał:" text_wiki_destroy_confirmation: Jesteś pewien, że chcesz usunąć to wiki i całą jego zawartość ? text_workflow_edit: Zaznacz rolę i typ zagadnienia do edycji przepływu - + label_user_activity: "Aktywność: %{value}" label_updated_time_by: "Uaktualnione przez %{author} %{age} temu" text_diff_truncated: '... Ten plik różnic został przycięty ponieważ jest zbyt długi.' @@ -911,7 +911,7 @@ pl: version_status_closed: zamknięta version_status_locked: zablokowana version_status_open: otwarta - + label_board_sticky: Przyklejona label_board_locked: Zamknięta permission_export_wiki_pages: Eksport stron wiki diff --git a/config/locales/pt.yml b/config/locales/pt.yml index d9ec309a..d99fbb75 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -5,7 +5,7 @@ pt: array: sentence_connector: "e" skip_last_comma: true - + direction: ltr date: formats: @@ -21,16 +21,16 @@ pt: - :day - :month - :year - + time: - formats: + formats: default: "%A, %d de %B de %Y, %H:%Mh" time: "%H:%M" short: "%d/%m, %H:%M hs" long: "%A, %d de %B de %Y, %H:%Mh" am: '' pm: '' - + datetime: distance_in_words: half_a_minute: "meio minuto" @@ -40,7 +40,7 @@ pt: x_seconds: one: "1 segundo" other: "%{count} segundos" - less_than_x_minutes: + less_than_x_minutes: one: "menos de um minuto" other: "menos de %{count} minutos" x_minutes: @@ -67,7 +67,7 @@ pt: almost_x_years: one: "almost 1 year" other: "almost %{count} years" - + number: format: precision: 3 @@ -135,7 +135,7 @@ pt: ## Translated by: Pedro Araújo actionview_instancetag_blank_option: Seleccione - + general_text_No: 'Não' general_text_Yes: 'Sim' general_text_no: 'não' @@ -146,7 +146,7 @@ pt: general_csv_encoding: ISO-8859-15 general_pdf_encoding: ISO-8859-15 general_first_day_of_week: '1' - + notice_account_updated: A conta foi actualizada com sucesso. notice_account_invalid_creditentials: Utilizador ou palavra-chave inválidos. notice_account_password_updated: A palavra-chave foi alterada com sucesso. @@ -171,13 +171,13 @@ pt: notice_account_pending: "A sua conta foi criada e está agora à espera de aprovação do administrador." notice_default_data_loaded: Configuração padrão carregada com sucesso. notice_unable_delete_version: Não foi possível apagar a versão. - + error_can_t_load_default_data: "Não foi possível carregar a configuração padrão: %{value}" error_scm_not_found: "A entrada ou revisão não foi encontrada no repositório." error_scm_command_failed: "Ocorreu um erro ao tentar aceder ao repositório: %{value}" error_scm_annotate: "A entrada não existe ou não pode ser anotada." error_issue_not_found_in_project: 'A tarefa não foi encontrada ou não pertence a este projecto.' - + mail_subject_lost_password: "Palavra-chave de %{value}" mail_body_lost_password: 'Para mudar a sua palavra-chave, clique na ligação abaixo:' mail_subject_register: "Activação de conta de %{value}" @@ -188,10 +188,10 @@ pt: mail_body_account_activation_request: "Um novo utilizador (%{value}) registou-se. A sua conta está à espera de aprovação:" mail_subject_reminder: "%{count} tarefa(s) para entregar nos próximos %{days} dias" mail_body_reminder: "%{count} tarefa(s) que estão atribuídas a si estão agendadas para estarem completas nos próximos %{days} dias:" - + gui_validation_error: 1 erro gui_validation_error_plural: "%{count} erros" - + field_name: Nome field_description: Descrição field_summary: Sumário @@ -275,7 +275,7 @@ pt: field_default_value: Valor por omissão field_comments_sorting: Mostrar comentários field_parent_title: Página pai - + setting_app_title: Título da aplicação setting_app_subtitle: Sub-título da aplicação setting_welcome_text: Texto de boas vindas @@ -312,7 +312,7 @@ pt: setting_mail_handler_api_enabled: Activar Web Service para e-mails recebidos setting_mail_handler_api_key: Chave da API setting_sequential_project_identifiers: Gerar identificadores de projecto sequênciais - + project_module_issue_tracking: Tarefas project_module_time_tracking: Registo de tempo project_module_news: Notícias @@ -321,7 +321,7 @@ pt: project_module_wiki: Wiki project_module_repository: Repositório project_module_boards: Forum - + label_user: Utilizador label_user_plural: Utilizadores label_user_new: Novo utilizador @@ -633,7 +633,7 @@ pt: label_incoming_emails: E-mails a chegar label_generate_key: Gerar uma chave label_issue_watchers: Observadores - + button_login: Entrar button_submit: Submeter button_save: Guardar @@ -672,11 +672,11 @@ pt: button_update: Actualizar button_configure: Configurar button_quote: Citar - + status_active: activo status_registered: registado status_locked: bloqueado - + text_select_mail_notifications: Seleccionar as acções que originam uma notificação por e-mail. text_regexp_info: ex. ^[A-Z0-9]+$ text_min_max_length_info: 0 siginifica sem restrição @@ -718,7 +718,7 @@ pt: text_enumeration_destroy_question: "%{count} objectos estão atribuídos a este valor." text_enumeration_category_reassign_to: 'Re-atribuí-los para este valor:' text_email_delivery_not_configured: "Entrega por e-mail não está configurada, e as notificação estão desactivadas.\nConfigure o seu servidor de SMTP em config/configuration.yml e reinicie a aplicação para activar estas funcionalidades." - + default_role_manager: Gestor default_role_developer: Programador default_role_reporter: Repórter @@ -742,7 +742,7 @@ pt: default_priority_immediate: Imediata default_activity_design: Planeamento default_activity_development: Desenvolvimento - + enumeration_issue_priorities: Prioridade de tarefas enumeration_doc_categories: Categorias de documentos enumeration_activities: Actividades (Registo de tempo) @@ -869,7 +869,7 @@ pt: button_duplicate: Duplicar button_copy_and_follow: Copiar e seguir label_copy_source: Origem - setting_issue_done_ratio: Calcular a percentagem de progresso da tarefa + setting_issue_done_ratio: Calcular a percentagem de progresso da tarefa setting_issue_done_ratio_issue_status: Através do estado da tarefa error_issue_done_ratios_not_updated: Percentagens de progresso da tarefa não foram actualizadas. error_workflow_copy_target: Seleccione os tipos de tarefas e funções desejadas diff --git a/config/locales/ro.yml b/config/locales/ro.yml index c0a41e76..360be912 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -6,10 +6,10 @@ ro: short: "%d %b" long: "%d %B %Y" only_day: "%e" - + day_names: [Duminică, Luni, Marti, Miercuri, Joi, Vineri, Sâmbătă] abbr_day_names: [Dum, Lun, Mar, Mie, Joi, Vin, Sâm] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, Ianuarie, Februarie, Martie, Aprilie, Mai, Iunie, Iulie, August, Septembrie, Octombrie, Noiembrie, Decembrie] abbr_month_names: [~, Ian, Feb, Mar, Apr, Mai, Iun, Iul, Aug, Sep, Oct, Noi, Dec] @@ -27,7 +27,7 @@ ro: long: "%B %d, %Y %H:%M" am: "am" pm: "pm" - + datetime: distance_in_words: half_a_minute: "jumătate de minut" @@ -65,28 +65,28 @@ ro: one: "almost 1 year" other: "almost %{count} years" - number: - human: - format: + number: + human: + format: precision: 1 delimiter: "" - storage_units: + storage_units: format: "%n %u" - units: + units: kb: KB tb: TB gb: GB - byte: + byte: one: Byte other: Bytes mb: MB - + # Used in array.to_sentence. support: array: sentence_connector: "și" skip_last_comma: true - + activerecord: errors: template: @@ -120,7 +120,7 @@ ro: cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" actionview_instancetag_blank_option: Selectați - + general_text_No: 'Nu' general_text_Yes: 'Da' general_text_no: 'nu' @@ -131,7 +131,7 @@ ro: general_csv_encoding: UTF-8 general_pdf_encoding: UTF-8 general_first_day_of_week: '2' - + notice_account_updated: Cont actualizat. notice_account_invalid_creditentials: Utilizator sau parola nevalidă notice_account_password_updated: Parolă actualizată. @@ -156,15 +156,15 @@ ro: notice_account_pending: "Contul dumneavoastră a fost creat și așteaptă aprobarea administratorului." notice_default_data_loaded: S-a încărcat configurația implicită. notice_unable_delete_version: Nu se poate șterge versiunea. - + error_can_t_load_default_data: "Nu s-a putut încărca configurația implicită: %{value}" error_scm_not_found: "Nu s-a găsit articolul sau revizia în depozit." error_scm_command_failed: "A intervenit o eroare la accesarea depozitului: %{value}" error_scm_annotate: "Nu există sau nu poate fi adnotată." error_issue_not_found_in_project: 'Tichetul nu a fost găsit sau nu aparține acestui proiect' - + warning_attachments_not_saved: "Nu s-au putut salva %{count} fișiere." - + mail_subject_lost_password: "Parola dumneavoastră: %{value}" mail_body_lost_password: 'Pentru a schimba parola, accesați:' mail_subject_register: "Activarea contului %{value}" @@ -175,10 +175,10 @@ ro: mail_body_account_activation_request: "S-a înregistrat un utilizator nou (%{value}). Contul așteaptă aprobarea dumneavoastră:" mail_subject_reminder: "%{count} tichete trebuie rezolvate în următoarele %{days} zile" mail_body_reminder: "%{count} tichete atribuite dumneavoastră trebuie rezolvate în următoarele %{days} zile:" - + gui_validation_error: o eroare gui_validation_error_plural: "%{count} erori" - + field_name: Nume field_description: Descriere field_summary: Rezumat @@ -266,7 +266,7 @@ ro: field_watcher: Urmărește field_identity_url: URL OpenID field_content: Conținut - + setting_app_title: Titlu aplicație setting_app_subtitle: Subtitlu aplicație setting_welcome_text: Text de întâmpinare @@ -309,7 +309,7 @@ ro: setting_file_max_size_displayed: Număr maxim de fișiere text afișate în pagină (inline) setting_repository_log_display_limit: Număr maxim de revizii afișate în istoricul fișierului setting_openid: Permite înregistrare și autentificare cu OpenID - + permission_edit_project: Editează proiectul permission_select_project_modules: Alege module pentru proiect permission_manage_members: Editează membri @@ -358,7 +358,7 @@ ro: permission_edit_own_messages: Editează mesajele proprii permission_delete_messages: Șterge mesaje permission_delete_own_messages: Șterge mesajele proprii - + project_module_issue_tracking: Tichete project_module_time_tracking: Timp de lucru project_module_news: Știri @@ -367,7 +367,7 @@ ro: project_module_wiki: Wiki project_module_repository: Depozit project_module_boards: Forum - + label_user: Utilizator label_user_plural: Utilizatori label_user_new: Utilizator nou @@ -684,13 +684,13 @@ ro: label_issue_watchers: Cine urmărește label_example: Exemplu label_display: Afișează - + label_sort: Sortează label_ascending: Crescător label_descending: Descrescător label_date_from_to: De la %{start} la %{end} - + button_login: Autentificare button_submit: Trimite button_save: Salvează @@ -730,11 +730,11 @@ ro: button_update: Actualizează button_configure: Configurează button_quote: Citează - + status_active: activ status_registered: înregistrat status_locked: blocat - + text_select_mail_notifications: Selectați acțiunile notificate prin email. text_regexp_info: ex. ^[A-Z0-9]+$ text_min_max_length_info: 0 înseamnă fără restricții @@ -777,10 +777,10 @@ ro: text_enumeration_destroy_question: "Această valoare are %{count} obiecte." text_enumeration_category_reassign_to: 'Atribuie la această valoare:' text_email_delivery_not_configured: "Trimiterea de emailuri nu este configurată și ca urmare, notificările sunt dezactivate.\nConfigurați serverul SMTP în config/configuration.yml și reporniți aplicația pentru a le activa." - text_repository_usernames_mapping: "Selectați sau modificați contul Redmine echivalent contului din istoricul depozitului.\nUtilizatorii cu un cont (sau e-mail) identic în Redmine și depozit sunt echivalate automat." + text_repository_usernames_mapping: "Selectați sau modificați contul Redmine echivalent contului din istoricul depozitului.\nUtilizatorii cu un cont (sau e-mail) identic în Redmine și depozit sunt echivalate automat." text_diff_truncated: '... Comparația a fost trunchiată pentru ca depășește lungimea maximă de text care poate fi afișat.' text_custom_field_possible_values_info: 'O linie pentru fiecare valoare' - + default_role_manager: Manager default_role_developer: Dezvoltator default_role_reporter: Creator de rapoarte @@ -804,7 +804,7 @@ ro: default_priority_immediate: imediată default_activity_design: Design default_activity_development: Dezvoltare - + enumeration_issue_priorities: Priorități tichete enumeration_doc_categories: Categorii documente enumeration_activities: Activități (timp de lucru) diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 382f0bbf..94deeee3 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -60,7 +60,7 @@ ru: percentage: format: delimiter: "" - + precision: format: delimiter: "" @@ -207,7 +207,7 @@ ru: # Rails 2.2 sentence_connector: "и" skip_last_comma: true - + # Rails 2.3 words_connector: ", " two_words_connector: " и " @@ -283,7 +283,7 @@ ru: enumeration_activities: Действия (учет времени) enumeration_doc_categories: Категории документов enumeration_issue_priorities: Приоритеты задач - + error_can_not_remove_role: Эта роль используется и не может быть удалена. error_can_not_delete_custom_field: Невозможно удалить настраиваемое поле error_can_not_delete_tracker: Этот трекер содержит задачи и не может быть удален. @@ -905,7 +905,7 @@ ru: status_active: активен status_locked: заблокирован status_registered: зарегистрирован - + text_are_you_sure_with_children: Удалить задачу и все ее подзадачи? text_are_you_sure: Подтвердите text_assign_time_entries_to_project: Прикрепить зарегистрированное время к проекту diff --git a/config/locales/sk.yml b/config/locales/sk.yml index c7c28ecd..a1323505 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -8,10 +8,10 @@ sk: default: "%Y-%m-%d" short: "%b %d" long: "%B %d, %Y" - + day_names: [Nedeľa, Pondelok, Utorok, Streda, Štvrtok, Piatok, Sobota] abbr_day_names: [Ne, Po, Ut, St, Št, Pi, So] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, Január, Február, Marec, Apríl, Máj, Jún, Júl, August, September, Október, November, December] abbr_month_names: [~, Jan, Feb, Mar, Apr, Máj, Jún, Júl, Aug, Sep, Okt, Nov, Dec] @@ -29,7 +29,7 @@ sk: long: "%B %d, %Y %H:%M" am: "am" pm: "pm" - + datetime: distance_in_words: half_a_minute: "pol minúty" @@ -67,28 +67,28 @@ sk: one: "almost 1 year" other: "almost %{count} years" - number: - human: - format: + number: + human: + format: precision: 1 delimiter: "" - storage_units: + storage_units: format: "%n %u" - units: + units: kb: KB tb: TB gb: GB - byte: + byte: one: Byte other: Bytes mb: MB - + # Used in array.to_sentence. support: array: sentence_connector: "a" skip_last_comma: false - + activerecord: errors: template: @@ -122,9 +122,9 @@ sk: cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" # SK translation by Stanislav Pach | stano.pach@seznam.cz - + actionview_instancetag_blank_option: Prosím vyberte - + general_text_No: 'Nie' general_text_Yes: 'Áno' general_text_no: 'nie' @@ -135,7 +135,7 @@ sk: general_csv_encoding: UTF-8 general_pdf_encoding: UTF-8 general_first_day_of_week: '1' - + notice_account_updated: Účet bol úspešne zmenený. notice_account_invalid_creditentials: Chybné meno alebo heslo notice_account_password_updated: Heslo bolo úspešne zmenené. @@ -160,12 +160,12 @@ sk: notice_no_issue_selected: "Nebola zvolená žiadná úloha. Prosím, zvoľte úlohy, ktoré chcete upraviť" notice_account_pending: "Váš účet bol vytvorený, teraz čaká na schválenie administrátorom." notice_default_data_loaded: Výchozia konfigurácia úspešne nahraná. - + error_can_t_load_default_data: "Výchozia konfigurácia nebola nahraná: %{value}" error_scm_not_found: "Položka a/alebo revízia neexistuje v repozitári." error_scm_command_failed: "Pri pokuse o prístup k repozitári došlo k chybe: %{value}" error_issue_not_found_in_project: 'Úloha nebola nájdená alebo nepatrí k tomuto projektu' - + mail_subject_lost_password: "Vaše heslo (%{value})" mail_body_lost_password: 'Pre zmenu vašeho hesla kliknite na následujúci odkaz:' mail_subject_register: "Aktivácia účtu (%{value})" @@ -174,10 +174,10 @@ sk: mail_body_account_information: Informácie o vašom účte mail_subject_account_activation_request: "Aktivácia %{value} účtu" mail_body_account_activation_request: "Bol zaregistrovaný nový uživateľ %{value}. Aktivácia jeho účtu závisí na vašom potvrdení." - + gui_validation_error: 1 chyba gui_validation_error_plural: "%{count} chyb(y)" - + field_name: Názov field_description: Popis field_summary: Prehľad @@ -260,7 +260,7 @@ sk: field_searchable: Umožniť vyhľadávanie field_default_value: Východzia hodnota field_comments_sorting: Zobraziť komentáre - + setting_app_title: Názov aplikácie setting_app_subtitle: Podtitulok aplikácie setting_welcome_text: Uvítací text @@ -273,7 +273,7 @@ sk: setting_bcc_recipients: Príjemcovia skrytej kópie (bcc) setting_host_name: Hostname setting_text_formatting: Formátovanie textu - setting_wiki_compression: Kompresia histórie Wiki + setting_wiki_compression: Kompresia histórie Wiki setting_feeds_limit: Limit zobrazených položiek (Atom feed) setting_default_projects_public: Nové projekty nastavovať ako verejné setting_autofetch_changesets: Automatický prenos zmien @@ -285,23 +285,23 @@ sk: setting_time_format: Formát času setting_cross_project_issue_relations: Povoliť väzby úloh skrz projekty setting_issue_list_default_columns: Východzie stĺpce zobrazené v zozname úloh - setting_ itories_encodings: Kódovanie + setting_ itories_encodings: Kódovanie setting_emails_footer: Zapätie emailov setting_protocol: Protokol setting_per_page_options: Povolené množstvo riadkov na stránke setting_user_format: Formát zobrazenia užívateľa - setting_activity_days_default: "Zobrazené dni aktivity projektu:" + setting_activity_days_default: "Zobrazené dni aktivity projektu:" setting_display_subprojects_issues: Prednastavenie zobrazenia úloh podporojektov v hlavnom projekte - + project_module_issue_tracking: Sledovanie úloh project_module_time_tracking: Sledovanie času project_module_news: Novinky project_module_documents: Dokumenty project_module_files: Súbory - project_module_wiki: Wiki + project_module_wiki: Wiki project_module_repository: Repozitár project_module_boards: Diskusie - + label_user: Užívateľ label_user_plural: Užívatelia label_user_new: Nový užívateľ @@ -508,7 +508,7 @@ sk: label_search: Hľadať label_result_plural: Výsledky label_all_words: Všetky slova - label_wiki: Wiki + label_wiki: Wiki label_wiki_edit: Wiki úprava label_wiki_edit_plural: Wiki úpravy label_wiki_page: Wiki stránka @@ -605,7 +605,7 @@ sk: label_preferences: Nastavenia label_chronological_order: V chronologickom poradí label_reverse_chronological_order: V obrátenom chronologickom poradí - + button_login: Prihlásiť button_submit: Potvrdiť button_save: Uložiť @@ -643,11 +643,11 @@ sk: button_annotate: Komentovať button_update: Aktualizovať button_configure: Konfigurovať - + status_active: aktívny status_registered: registrovaný status_locked: uzamknutý - + text_select_mail_notifications: Vyberte akciu, pri ktorej bude zaslané upozornenie emailom text_regexp_info: napr. ^[A-Z0-9]+$ text_min_max_length_info: 0 znamená bez limitu @@ -684,7 +684,7 @@ sk: text_destroy_time_entries: Odstrániť evidované hodiny. text_assign_time_entries_to_project: Priradiť evidované hodiny projektu text_reassign_time_entries: 'Preradiť evidované hodiny k tejto úlohe:' - + default_role_manager: Manažér default_role_developer: Vývojár default_role_reporter: Reportér @@ -708,7 +708,7 @@ sk: default_priority_immediate: Okamžitá default_activity_design: Design default_activity_development: Vývoj - + enumeration_issue_priorities: Priority úloh enumeration_doc_categories: Kategorie dokumentov enumeration_activities: Aktivity (sledovanie času) @@ -746,7 +746,7 @@ sk: permission_view_changesets: Zobrazenie sád zmien permission_view_time_entries: Zobrazenie stráveného času permission_manage_versions: Správa verzií - permission_manage_wiki: Správa Wiki + permission_manage_wiki: Správa Wiki permission_manage_categories: Správa kategórií úloh permission_protect_wiki_pages: Ochrana Wiki strániek permission_comment_news: Komentovanie noviniek @@ -888,7 +888,7 @@ sk: label_subproject_new: Nový podprojekt text_own_membership_delete_confirmation: |- Práve sa pokúšate o odstránenie niektorých alebo všetkých prístupových práv a možno nebudete mať možnost naďalej upravovať tento projekt. - Ste si istý(á), že chcete pokračovat? + Ste si istý(á), že chcete pokračovat? label_close_versions: Uzavrieť ukončené verzie label_board_sticky: Sticky label_board_locked: Uzamknuté diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 6a928928..c6461fc8 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -8,10 +8,10 @@ sl: default: "%Y-%m-%d" short: "%b %d" long: "%B %d, %Y" - + day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday] abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December] abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec] @@ -29,7 +29,7 @@ sl: long: "%B %d, %Y %H:%M" am: "am" pm: "pm" - + datetime: distance_in_words: half_a_minute: "half a minute" @@ -72,27 +72,27 @@ sl: separator: "," delimiter: "." precision: 3 - human: - format: + human: + format: precision: 1 delimiter: "" - storage_units: + storage_units: format: "%n %u" - units: + units: kb: KB tb: TB gb: GB - byte: + byte: one: Byte other: Bytes mb: MB - + # Used in array.to_sentence. support: array: sentence_connector: "and" skip_last_comma: false - + activerecord: errors: template: @@ -126,7 +126,7 @@ sl: cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" actionview_instancetag_blank_option: Prosimo izberite - + general_text_No: 'Ne' general_text_Yes: 'Da' general_text_no: 'ne' @@ -137,7 +137,7 @@ sl: general_csv_encoding: UTF-8 general_pdf_encoding: UTF-8 general_first_day_of_week: '1' - + notice_account_updated: Račun je bil uspešno posodobljen. notice_account_invalid_creditentials: Napačno uporabniško ime ali geslo notice_account_password_updated: Geslo je bilo uspešno posodobljeno. @@ -162,13 +162,13 @@ sl: notice_account_pending: "Vaš račun je bil ustvarjen in čaka na potrditev s strani administratorja." notice_default_data_loaded: Privzete nastavitve so bile uspešno naložene. notice_unable_delete_version: Verzije ni bilo mogoče izbrisati. - + error_can_t_load_default_data: "Privzetih nastavitev ni bilo mogoče naložiti: %{value}" error_scm_not_found: "Vnos ali revizija v shrambi ni bila najdena ." error_scm_command_failed: "Med vzpostavljem povezave s shrambo je prišlo do napake: %{value}" error_scm_annotate: "Vnos ne obstaja ali pa ga ni mogoče komentirati." error_issue_not_found_in_project: 'Zahtevek ni bil najden ali pa ne pripada temu projektu' - + mail_subject_lost_password: "Vaše %{value} geslo" mail_body_lost_password: 'Za spremembo glesla kliknite na naslednjo povezavo:' mail_subject_register: "Aktivacija %{value} vašega računa" @@ -179,10 +179,10 @@ sl: mail_body_account_activation_request: "Registriral se je nov uporabnik (%{value}). Račun čaka na vašo odobritev:" mail_subject_reminder: "%{count} zahtevek(zahtevki) zapadejo v naslednjih %{days} dneh" mail_body_reminder: "%{count} zahtevek(zahtevki), ki so vam dodeljeni bodo zapadli v naslednjih %{days} dneh:" - + gui_validation_error: 1 napaka gui_validation_error_plural: "%{count} napak" - + field_name: Ime field_description: Opis field_summary: Povzetek @@ -266,7 +266,7 @@ sl: field_default_value: Privzeta vrednost field_comments_sorting: Prikaži komentarje field_parent_title: Matična stran - + setting_app_title: Naslov aplikacije setting_app_subtitle: Podnaslov aplikacije setting_welcome_text: Pozdravno besedilo @@ -306,7 +306,7 @@ sl: setting_sequential_project_identifiers: Generiraj projektne identifikatorje sekvenčno setting_gravatar_enabled: Uporabljaj Gravatar ikone setting_diff_max_lines_displayed: Maksimalno število prikazanih vrstic različnosti - + permission_edit_project: Uredi projekt permission_select_project_modules: Izberi module projekta permission_manage_members: Uredi člane @@ -355,7 +355,7 @@ sl: permission_edit_own_messages: Uredi lastna sporočila permission_delete_messages: Izbriši sporočila permission_delete_own_messages: Izbriši lastna sporočila - + project_module_issue_tracking: Sledenje zahtevkom project_module_time_tracking: Sledenje časa project_module_news: Novice @@ -364,7 +364,7 @@ sl: project_module_wiki: Wiki project_module_repository: Shramba project_module_boards: Table - + label_user: Uporabnik label_user_plural: Uporabniki label_user_new: Nov uporabnik @@ -679,7 +679,7 @@ sl: label_generate_key: Ustvari ključ label_issue_watchers: Spremljevalci label_example: Vzorec - + button_login: Prijavi se button_submit: Pošlji button_save: Shrani @@ -718,11 +718,11 @@ sl: button_update: Posodobi button_configure: Konfiguriraj button_quote: Citiraj - + status_active: aktivni status_registered: registriran status_locked: zaklenjen - + text_select_mail_notifications: Izberi dejanja za katera naj bodo poslana oznanila preko e-pošto. text_regexp_info: npr. ^[A-Z0-9]+$ text_min_max_length_info: 0 pomeni brez omejitev @@ -766,7 +766,7 @@ sl: text_email_delivery_not_configured: "E-poštna dostava ni nastavljena in oznanila so onemogočena.\nNastavite vaš SMTP strežnik v config/configuration.yml in ponovno zaženite aplikacijo da ga omogočite.\n" text_repository_usernames_mapping: "Izberite ali posodobite Redmine uporabnika dodeljenega vsakemu uporabniškemu imenu najdenemu v zapisniku shrambe.\n Uporabniki z enakim Redmine ali shrambinem uporabniškem imenu ali e-poštnem naslovu so samodejno dodeljeni." text_diff_truncated: '... Ta sprememba je bila odsekana ker presega največjo velikost ki je lahko prikazana.' - + default_role_manager: Upravnik default_role_developer: Razvijalec default_role_reporter: Poročevalec @@ -790,7 +790,7 @@ sl: default_priority_immediate: Takojšnje ukrepanje default_activity_design: Oblikovanje default_activity_development: Razvoj - + enumeration_issue_priorities: Prioritete zahtevkov enumeration_doc_categories: Kategorije dokumentov enumeration_activities: Aktivnosti (sledenje časa) diff --git a/config/locales/sr-YU.yml b/config/locales/sr-YU.yml index d70a6f50..8f83a5d0 100644 --- a/config/locales/sr-YU.yml +++ b/config/locales/sr-YU.yml @@ -10,10 +10,10 @@ sr-YU: default: "%d.%m.%Y." short: "%e %b" long: "%B %e, %Y" - + day_names: [nedelja, ponedeljak, utorak, sreda, četvrtak, petak, subota] abbr_day_names: [ned, pon, uto, sre, čet, pet, sub] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, januar, februar, mart, april, maj, jun, jul, avgust, septembar, oktobar, novembar, decembar] abbr_month_names: [~, jan, feb, mar, apr, maj, jun, jul, avg, sep, okt, nov, dec] @@ -95,7 +95,7 @@ sr-YU: array: sentence_connector: "i" skip_last_comma: false - + activerecord: errors: template: @@ -129,7 +129,7 @@ sr-YU: cant_link_an_issue_with_a_descendant: "Problem ne može biti povezan sa jednim od svojih podzadataka" actionview_instancetag_blank_option: Molim odaberite - + general_text_No: 'Ne' general_text_Yes: 'Da' general_text_no: 'ne' @@ -140,7 +140,7 @@ sr-YU: general_csv_encoding: UTF-8 general_pdf_encoding: UTF-8 general_first_day_of_week: '1' - + notice_account_updated: Nalog je uspešno ažuriran. notice_account_invalid_creditentials: Neispravno korisničko ime ili lozinka. notice_account_password_updated: Lozinka je uspešno ažurirana. @@ -169,7 +169,7 @@ sr-YU: notice_unable_delete_version: Verziju je nemoguće izbrisati. notice_unable_delete_time_entry: Stavku evidencije vremena je nemoguće izbrisati. notice_issue_done_ratios_updated: Odnos rešenih problema je ažuriran. - + error_can_t_load_default_data: "Podrazumevano konfigurisanje je nemoguće učitati: %{value}" error_scm_not_found: "Stavka ili ispravka nisu pronađene u spremištu." error_scm_command_failed: "Greška se javila prilikom pokušaja pristupa spremištu: %{value}" @@ -186,9 +186,9 @@ sr-YU: error_workflow_copy_source: 'Molimo odaberite izvorno praćenje ili ulogu' error_workflow_copy_target: 'Molimo odaberite odredišno praćenje i ulogu' error_unable_delete_issue_status: 'Status problema je nemoguće obrisati' - error_unable_to_connect: "Povezivanje sa (%{value}) je nemoguće" + error_unable_to_connect: "Povezivanje sa (%{value}) je nemoguće" warning_attachments_not_saved: "%{count} datoteka ne može biti snimljena." - + mail_subject_lost_password: "Vaša %{value} lozinka" mail_body_lost_password: 'Za promenu vaše lozinke, kliknite na sledeći link:' mail_subject_register: "Aktivacija vašeg %{value} naloga" @@ -203,10 +203,10 @@ sr-YU: mail_body_wiki_content_added: "%{author} je dodao wiki stranicu '%{id}'." mail_subject_wiki_content_updated: "Wiki stranica '%{id}' je ažurirana" mail_body_wiki_content_updated: "%{author} je ažurirao wiki stranicu '%{id}'." - + gui_validation_error: jedna greška gui_validation_error_plural: "%{count} grešaka" - + field_name: Naziv field_description: Opis field_summary: Rezime @@ -298,7 +298,7 @@ sr-YU: field_group_by: Grupisanje rezultata po field_sharing: Deljenje field_parent_issue: Matični zadatak - + setting_app_title: Naslov aplikacije setting_app_subtitle: Podnaslov aplikacije setting_welcome_text: Tekst dobrodošlice @@ -352,7 +352,7 @@ sr-YU: setting_start_of_week: Prvi dan u sedmici setting_rest_api_enabled: Omogući REST web usluge setting_cache_formatted_text: Keširanje obrađenog teksta - + permission_add_project: Kreiranje projekta permission_add_subprojects: Kreiranje potpojekta permission_edit_project: Izmena projekata @@ -408,7 +408,7 @@ sr-YU: permission_delete_own_messages: Brisanje sopstvenih poruka permission_export_wiki_pages: Izvoz wiki stranica permission_manage_subtasks: Upravljanje podzadacima - + project_module_issue_tracking: Praćenje problema project_module_time_tracking: Praćenje vremena project_module_news: Vesti @@ -417,7 +417,7 @@ sr-YU: project_module_wiki: Wiki project_module_repository: Spremište project_module_boards: Forumi - + label_user: Korisnik label_user_plural: Korisnici label_user_new: Novi korisnik @@ -774,8 +774,8 @@ sr-YU: label_api_access_key_created_on: "API pristupni ključ je kreiran pre %{value}" label_profile: Profil label_subtask_plural: Podzadatak - label_project_copy_notifications: Pošalji e-poruku sa obaveštenjem prilikom kopiranja projekta - + label_project_copy_notifications: Pošalji e-poruku sa obaveštenjem prilikom kopiranja projekta + button_login: Prijava button_submit: Pošalji button_save: Snimi @@ -819,17 +819,17 @@ sr-YU: button_quote: Pod navodnicima button_duplicate: Dupliraj button_show: Prikaži - + status_active: aktivni status_registered: registrovani status_locked: zaključani - + version_status_open: otvoren version_status_locked: zaključan version_status_closed: zatvoren field_active: Aktivan - + text_select_mail_notifications: Odaberi akcije za koje će obaveštenje biti poslato putem e-pošte. text_regexp_info: npr. ^[A-Z0-9]+$ text_min_max_length_info: 0 znači bez ograničenja @@ -887,7 +887,7 @@ sr-YU: text_own_membership_delete_confirmation: "Nakon uklanjanja pojedinih ili svih vaših dozvola nećete više moći da uređujete ovaj projekat.\nŽelite li da nastavite?" text_zoom_in: Uvećaj text_zoom_out: Umanji - + default_role_manager: Menadžer default_role_developer: Programer default_role_reporter: Izveštač @@ -911,12 +911,12 @@ sr-YU: default_priority_immediate: Neposredno default_activity_design: Dizajn default_activity_development: Razvoj - + enumeration_issue_priorities: Prioriteti problema enumeration_doc_categories: Kategorije dokumenta enumeration_activities: Aktivnosti (praćenje vremena) enumeration_system_activity: Sistemska aktivnost - + field_time_entries: Vreme evidencije project_module_gantt: Gantov dijagram project_module_calendar: Kalendar diff --git a/config/locales/sr.yml b/config/locales/sr.yml index a53b4840..77403621 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -10,10 +10,10 @@ sr: default: "%d.%m.%Y." short: "%e %b" long: "%B %e, %Y" - + day_names: [недеља, понедељак, уторак, среда, четвртак, петак, субота] abbr_day_names: [нед, пон, уто, сре, чет, пет, суб] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, јануар, фебруар, март, април, мај, јун, јул, август, септембар, октобар, новембар, децембар] abbr_month_names: [~, јан, феб, мар, апр, мај, јун, јул, авг, сеп, окт, нов, дец] @@ -95,7 +95,7 @@ sr: array: sentence_connector: "и" skip_last_comma: false - + activerecord: errors: template: @@ -129,7 +129,7 @@ sr: cant_link_an_issue_with_a_descendant: "Проблем не може бити повезан са једним од својих подзадатака" actionview_instancetag_blank_option: Молим одаберите - + general_text_No: 'Не' general_text_Yes: 'Да' general_text_no: 'не' @@ -140,7 +140,7 @@ sr: general_csv_encoding: UTF-8 general_pdf_encoding: UTF-8 general_first_day_of_week: '1' - + notice_account_updated: Налог је успешно ажуриран. notice_account_invalid_creditentials: Неисправно корисничко име или лозинка. notice_account_password_updated: Лозинка је успешно ажурирана. @@ -169,7 +169,7 @@ sr: notice_unable_delete_version: Верзију је немогуће избрисати. notice_unable_delete_time_entry: Ставку евиденције времена је немогуће избрисати. notice_issue_done_ratios_updated: Однос решених проблема је ажуриран. - + error_can_t_load_default_data: "Подразумевано конфигурисање је немогуће учитати: %{value}" error_scm_not_found: "Ставка или исправка нису пронађене у спремишту." error_scm_command_failed: "Грешка се јавила приликом покушаја приступа спремишту: %{value}" @@ -186,9 +186,9 @@ sr: error_workflow_copy_source: 'Молимо одаберите изворно праћење или улогу' error_workflow_copy_target: 'Молимо одаберите одредишно праћење и улогу' error_unable_delete_issue_status: 'Статус проблема је немогуће обрисати' - error_unable_to_connect: "Повезивање са (%{value}) је немогуће" + error_unable_to_connect: "Повезивање са (%{value}) је немогуће" warning_attachments_not_saved: "%{count} датотека не може бити снимљена." - + mail_subject_lost_password: "Ваша %{value} лозинка" mail_body_lost_password: 'За промену ваше лозинке, кликните на следећи линк:' mail_subject_register: "Активација вашег %{value} налога" @@ -203,10 +203,10 @@ sr: mail_body_wiki_content_added: "%{author} је додао wiki страницу '%{id}'." mail_subject_wiki_content_updated: "Wiki страница '%{id}' је ажурирана" mail_body_wiki_content_updated: "%{author} је ажурирао wiki страницу '%{id}'." - + gui_validation_error: једна грешка gui_validation_error_plural: "%{count} грешака" - + field_name: Назив field_description: Опис field_summary: Резиме @@ -298,7 +298,7 @@ sr: field_group_by: Груписање резултата по field_sharing: Дељење field_parent_issue: Матични задатак - + setting_app_title: Наслов апликације setting_app_subtitle: Поднаслов апликације setting_welcome_text: Текст добродошлице @@ -352,7 +352,7 @@ sr: setting_start_of_week: Први дан у седмици setting_rest_api_enabled: Омогући REST web услуге setting_cache_formatted_text: Кеширање обрађеног текста - + permission_add_project: Креирање пројекта permission_add_subprojects: Креирање потпојекта permission_edit_project: Измена пројеката @@ -408,7 +408,7 @@ sr: permission_delete_own_messages: Брисање сопствених порука permission_export_wiki_pages: Извоз wiki страница permission_manage_subtasks: Управљање подзадацима - + project_module_issue_tracking: Праћење проблема project_module_time_tracking: Праћење времена project_module_news: Вести @@ -417,7 +417,7 @@ sr: project_module_wiki: Wiki project_module_repository: Спремиште project_module_boards: Форуми - + label_user: Корисник label_user_plural: Корисници label_user_new: Нови корисник @@ -774,8 +774,8 @@ sr: label_api_access_key_created_on: "API приступни кључ је креиран пре %{value}" label_profile: Профил label_subtask_plural: Подзадатак - label_project_copy_notifications: Пошаљи е-поруку са обавештењем приликом копирања пројекта - + label_project_copy_notifications: Пошаљи е-поруку са обавештењем приликом копирања пројекта + button_login: Пријава button_submit: Пошаљи button_save: Сними @@ -819,17 +819,17 @@ sr: button_quote: Под наводницима button_duplicate: Дуплирај button_show: Прикажи - + status_active: активни status_registered: регистровани status_locked: закључани - + version_status_open: отворен version_status_locked: закључан version_status_closed: затворен field_active: Активан - + text_select_mail_notifications: Одабери акције за које ће обавештење бити послато путем е-поште. text_regexp_info: нпр. ^[A-Z0-9]+$ text_min_max_length_info: 0 значи без ограничења @@ -887,7 +887,7 @@ sr: text_own_membership_delete_confirmation: "Након уклањања појединих или свих ваших дозвола нећете више моћи да уређујете овај пројекат.\nЖелите ли да наставите?" text_zoom_in: Увећај text_zoom_out: Умањи - + default_role_manager: Менаџер default_role_developer: Програмер default_role_reporter: Извештач @@ -911,12 +911,12 @@ sr: default_priority_immediate: Непосредно default_activity_design: Дизајн default_activity_development: Развој - + enumeration_issue_priorities: Приоритети проблема enumeration_doc_categories: Категорије документа enumeration_activities: Активности (праћење времена) enumeration_system_activity: Системска активност - + field_time_entries: Време евиденције project_module_gantt: Гантов дијаграм project_module_calendar: Календар diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 3d9a0122..d034af42 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -13,7 +13,7 @@ sv: delimiter: "." # Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00) precision: 2 - + # Used in number_to_currency() currency: format: @@ -24,15 +24,15 @@ sv: # separator: "." # delimiter: "," # precision: 2 - + # Used in number_to_percentage() percentage: format: # These three are to override number.format and are optional - # separator: + # separator: delimiter: "" - # precision: - + # precision: + # Used in number_to_precision() precision: format: @@ -40,12 +40,12 @@ sv: # separator: delimiter: "" # precision: - + # Used in number_to_human_size() human: format: # These three are to override number.format and are optional - # separator: + # separator: delimiter: "" # precision: 1 storage_units: @@ -96,7 +96,7 @@ sv: almost_x_years: one: "nästan 1 år" other: "nästan %{count} år" - + activerecord: errors: template: @@ -141,10 +141,10 @@ sv: default: "%Y-%m-%d" short: "%e %b" long: "%e %B, %Y" - + day_names: [söndag, måndag, tisdag, onsdag, torsdag, fredag, lördag] abbr_day_names: [sön, mån, tis, ons, tor, fre, lör] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, januari, februari, mars, april, maj, juni, juli, augusti, september, oktober, november, december] abbr_month_names: [~, jan, feb, mar, apr, maj, jun, jul, aug, sep, okt, nov, dec] @@ -162,7 +162,7 @@ sv: long: "%d %B, %Y %H:%M" am: "" pm: "" - + # Used in array.to_sentence. support: array: @@ -170,7 +170,7 @@ sv: skip_last_comma: true actionview_instancetag_blank_option: Var god välj - + general_text_No: 'Nej' general_text_Yes: 'Ja' general_text_no: 'nej' @@ -181,7 +181,7 @@ sv: general_csv_encoding: ISO-8859-1 general_pdf_encoding: ISO-8859-1 general_first_day_of_week: '1' - + notice_account_updated: Kontot har uppdaterats notice_account_invalid_creditentials: Fel användarnamn eller lösenord notice_account_password_updated: Lösenordet har uppdaterats @@ -212,7 +212,7 @@ sv: notice_unable_delete_time_entry: Tidloggning kunde inte tas bort. notice_issue_done_ratios_updated: "% klart uppdaterade." notice_gantt_chart_truncated: "Schemat förminskades eftersom det överskrider det maximala antalet aktiviteter som får visas (%{max})" - + error_can_t_load_default_data: "Standardkonfiguration gick inte att läsa in: %{value}" error_scm_not_found: "Inlägg och/eller revision finns inte i detta versionsarkiv." error_scm_command_failed: "Ett fel inträffade vid försök att nå versionsarkivet: %{value}" @@ -230,9 +230,9 @@ sv: error_workflow_copy_target: 'Vänligen välj ärendetyp(er) och roll(er) för mål' error_unable_delete_issue_status: 'Ärendestatus kunde inte tas bort' error_unable_to_connect: "Kan inte ansluta (%{value})" - + warning_attachments_not_saved: "%{count} fil(er) kunde inte sparas." - + mail_subject_lost_password: "Ditt %{value} lösenord" mail_body_lost_password: 'För att ändra ditt lösenord, klicka på följande länk:' mail_subject_register: "Din %{value} kontoaktivering" @@ -247,10 +247,10 @@ sv: mail_body_wiki_content_added: "The '%{id}' wikisida has lagts till av %{author}." mail_subject_wiki_content_updated: "'%{id}' wikisida har uppdaterats" mail_body_wiki_content_updated: "The '%{id}' wikisida har uppdaterats av %{author}." - + gui_validation_error: 1 fel gui_validation_error_plural: "%{count} fel" - + field_name: Namn field_description: Beskrivning field_summary: Sammanfattning @@ -337,7 +337,7 @@ sv: field_comments_sorting: Visa kommentarer field_parent_title: Föräldersida field_editable: Redigerbar - field_watcher: Bevakare + field_watcher: Bevakare field_identity_url: OpenID URL field_content: Innehåll field_group_by: Gruppera resultat efter @@ -348,7 +348,7 @@ sv: field_text: Textfält field_visible: Synlig field_warn_on_leaving_unsaved: Varna om jag lämnar en sida med osparad text - + setting_app_title: Applikationsrubrik setting_app_subtitle: Applikationsunderrubrik setting_welcome_text: Välkomsttext @@ -407,7 +407,7 @@ sv: setting_commit_logtime_enabled: Aktivera tidloggning setting_commit_logtime_activity_id: Aktivitet för loggad tid setting_gantt_items_limit: Maximalt antal aktiviteter som visas i gantt-schemat - + permission_add_project: Skapa projekt permission_add_subprojects: Skapa underprojekt permission_edit_project: Ändra projekt @@ -463,7 +463,7 @@ sv: permission_delete_own_messages: Ta bort egna meddelanden permission_export_wiki_pages: Exportera wikisidor permission_manage_subtasks: Hantera underaktiviteter - + project_module_issue_tracking: Ärendeuppföljning project_module_time_tracking: Tidsuppföljning project_module_news: Nyheter @@ -474,7 +474,7 @@ sv: project_module_boards: Forum project_module_calendar: Kalender project_module_gantt: Gantt - + label_user: Användare label_user_plural: Användare label_user_new: Ny användare @@ -839,7 +839,7 @@ sv: label_project_copy_notifications: Skicka mailnotifieringar när projektet kopieras label_principal_search: "Sök efter användare eller grupp:" label_user_search: "Sök efter användare:" - + button_login: Logga in button_submit: Skicka button_save: Spara @@ -884,17 +884,17 @@ sv: button_quote: Citera button_duplicate: Duplicera button_show: Visa - + status_active: aktiv status_registered: registrerad status_locked: låst - + version_status_open: öppen version_status_locked: låst version_status_closed: stängd - + field_active: Aktiv - + text_select_mail_notifications: Välj för vilka händelser mail ska skickas. text_regexp_info: eg. ^[A-Z0-9]+$ text_min_max_length_info: 0 betyder ingen gräns @@ -956,7 +956,7 @@ sv: text_zoom_out: Zooma ut text_zoom_in: Zooma in text_warn_on_leaving_unsaved: Nuvarande sida innehåller osparad text som kommer försvinna om du lämnar sidan. - + default_role_manager: Projektledare default_role_developer: Utvecklare default_role_reporter: Rapportör @@ -980,7 +980,7 @@ sv: default_priority_immediate: Omedelbar default_activity_design: Design default_activity_development: Utveckling - + enumeration_issue_priorities: Ärendeprioriteter enumeration_doc_categories: Dokumentkategorier enumeration_activities: Aktiviteter (tidsuppföljning) diff --git a/config/locales/th.yml b/config/locales/th.yml index febda7c3..86b45445 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -8,10 +8,10 @@ th: default: "%Y-%m-%d" short: "%b %d" long: "%B %d, %Y" - + day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday] abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December] abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec] @@ -29,7 +29,7 @@ th: long: "%B %d, %Y %H:%M" am: "am" pm: "pm" - + datetime: distance_in_words: half_a_minute: "half a minute" @@ -72,27 +72,27 @@ th: separator: "." delimiter: "" precision: 3 - human: - format: + human: + format: precision: 1 delimiter: "" - storage_units: + storage_units: format: "%n %u" - units: + units: kb: KB tb: TB gb: GB - byte: + byte: one: Byte other: Bytes mb: MB - + # Used in array.to_sentence. support: array: sentence_connector: "and" skip_last_comma: false - + activerecord: errors: template: @@ -126,7 +126,7 @@ th: cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" actionview_instancetag_blank_option: กรุณาเลือก - + general_text_No: 'ไม่' general_text_Yes: 'ใช่' general_text_no: 'ไม่' @@ -137,7 +137,7 @@ th: general_csv_encoding: Windows-874 general_pdf_encoding: cp874 general_first_day_of_week: '1' - + notice_account_updated: บัญชีได้ถูกปรับปรุงแล้ว. notice_account_invalid_creditentials: ชื้ผู้ใช้หรือรหัสผ่านไม่ถูกต้อง notice_account_password_updated: รหัสได้ถูกปรับปรุงแล้ว. @@ -161,13 +161,13 @@ th: notice_no_issue_selected: "ไม่มีปัญหาที่ถูกเลือก! กรุณาเลือกปัญหาที่คุณต้องการแก้ไข." notice_account_pending: "บัญชีของคุณสร้างเสร็จแล้ว ขณะนี้รอการอนุมัติจากผู้บริหารจัดการ." notice_default_data_loaded: ค่าเริ่มต้นโหลดเสร็จแล้ว. - + error_can_t_load_default_data: "ค่าเริ่มต้นโหลดไม่สำเร็จ: %{value}" error_scm_not_found: "ไม่พบรุ่นที่ต้องการในแหล่งเก็บต้นฉบับ." error_scm_command_failed: "เกิดความผิดพลาดในการเข้าถึงแหล่งเก็บต้นฉบับ: %{value}" error_scm_annotate: "entry ไม่มีอยู่จริง หรือไม่สามารถเขียนหมายเหตุประกอบ." error_issue_not_found_in_project: 'ไม่พบปัญหานี้ หรือปัญหาไม่ได้อยู่ในโครงการนี้' - + mail_subject_lost_password: "รหัสผ่าน %{value} ของคุณ" mail_body_lost_password: 'คลิ๊กที่ลิงค์ต่อไปนี้เพื่อเปลี่ยนรหัสผ่าน:' mail_subject_register: "เปิดบัญชี %{value} ของคุณ" @@ -176,10 +176,10 @@ th: mail_body_account_information: ข้อมูลบัญชีของคุณ mail_subject_account_activation_request: "กรุณาเปิดบัญชี %{value}" mail_body_account_activation_request: "ผู้ใช้ใหม่ (%{value}) ได้ลงทะเบียน. บัญชีของเขากำลังรออนุมัติ:" - + gui_validation_error: 1 ข้อผิดพลาด gui_validation_error_plural: "%{count} ข้อผิดพลาด" - + field_name: ชื่อ field_description: รายละเอียด field_summary: สรุปย่อ @@ -262,7 +262,7 @@ th: field_searchable: ค้นหาได้ field_default_value: ค่าเริ่มต้น field_comments_sorting: แสดงความเห็น - + setting_app_title: ชื่อโปรแกรม setting_app_subtitle: ชื่อโปรแกรมรอง setting_welcome_text: ข้อความต้อนรับ @@ -294,7 +294,7 @@ th: setting_user_format: รูปแบบการแสดงชื่อผู้ใช้ setting_activity_days_default: จำนวนวันที่แสดงในกิจกรรมของโครงการ setting_display_subprojects_issues: แสดงปัญหาของโครงการย่อยในโครงการหลัก - + project_module_issue_tracking: การติดตามปัญหา project_module_time_tracking: การใช้เวลา project_module_news: ข่าว @@ -303,7 +303,7 @@ th: project_module_wiki: Wiki project_module_repository: ที่เก็บต้นฉบับ project_module_boards: กระดานข้อความ - + label_user: ผู้ใช้ label_user_plural: ผู้ใช้ label_user_new: ผู้ใช้ใหม่ @@ -610,7 +610,7 @@ th: label_chronological_order: เรียงจากเก่าไปใหม่ label_reverse_chronological_order: เรียงจากใหม่ไปเก่า label_planning: การวางแผน - + button_login: เข้าระบบ button_submit: จัดส่งข้อมูล button_save: จัดเก็บ @@ -648,11 +648,11 @@ th: button_annotate: หมายเหตุประกอบ button_update: ปรับปรุง button_configure: ปรับแต่ง - + status_active: เปิดใช้งานแล้ว status_registered: รอการอนุมัติ status_locked: ล็อค - + text_select_mail_notifications: เลือกการกระทำที่ต้องการให้ส่งอีเมล์แจ้ง. text_regexp_info: ตัวอย่าง ^[A-Z0-9]+$ text_min_max_length_info: 0 หมายถึงไม่จำกัด @@ -690,7 +690,7 @@ th: text_destroy_time_entries: ลบเวลาที่รายงานไว้ text_assign_time_entries_to_project: ระบุเวลาที่ใช้ในโครงการนี้ text_reassign_time_entries: 'ระบุเวลาที่ใช้ในโครงการนี่อีกครั้ง:' - + default_role_manager: ผู้จัดการ default_role_developer: ผู้พัฒนา default_role_reporter: ผู้รายงาน @@ -714,7 +714,7 @@ th: default_priority_immediate: ด่วนมาก default_activity_design: ออกแบบ default_activity_development: พัฒนา - + enumeration_issue_priorities: ความสำคัญของปัญหา enumeration_doc_categories: ประเภทเอกสาร enumeration_activities: กิจกรรม (ใช้ในการติดตามเวลา) diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 02d0cff6..368bc7ae 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -1,4 +1,4 @@ -# Turkish translations for Ruby on Rails +# Turkish translations for Ruby on Rails # by Ozgun Ataman (ozataman@gmail.com) tr: @@ -22,7 +22,7 @@ tr: - :day - :month - :year - + time: formats: default: "%a %d.%b.%y %H:%M" @@ -33,7 +33,7 @@ tr: am: "öğleden önce" pm: "öğleden sonra" - + datetime: distance_in_words: half_a_minute: 'yarım dakika' @@ -72,7 +72,7 @@ tr: almost_x_years: one: "almost 1 year" other: "almost %{count} years" - + number: format: precision: 2 @@ -114,7 +114,7 @@ tr: array: sentence_connector: "ve" skip_last_comma: true - + activerecord: errors: template: @@ -148,9 +148,9 @@ tr: circular_dependency: "Bu ilişki döngüsel bağımlılık meydana getirecektir" cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" models: - + actionview_instancetag_blank_option: Lütfen Seçin - + general_text_No: 'Hayır' general_text_Yes: 'Evet' general_text_no: 'hayır' @@ -160,7 +160,7 @@ tr: general_csv_encoding: ISO-8859-1 general_pdf_encoding: ISO-8859-1 general_first_day_of_week: '7' - + notice_account_updated: Hesap başarıyla güncelleştirildi. notice_account_invalid_creditentials: Geçersiz kullanıcı ya da parola notice_account_password_updated: Parola başarıyla güncellendi. @@ -184,13 +184,13 @@ tr: notice_no_issue_selected: "Seçili ileti yok! Lütfen, düzenlemek istediğiniz iletileri işaretleyin." notice_account_pending: "Hesabınız oluşturuldu ve yönetici onayı bekliyor." notice_default_data_loaded: Varasayılan konfigürasyon başarılıyla yüklendi. - + error_can_t_load_default_data: "Varsayılan konfigürasyon yüklenemedi: %{value}" error_scm_not_found: "Depoda, giriş ya da revizyon yok." error_scm_command_failed: "Depoya erişmeye çalışırken bir hata meydana geldi: %{value}" error_scm_annotate: "Giriş mevcut değil veya izah edilemedi." error_issue_not_found_in_project: 'İleti bilgisi bulunamadı veya bu projeye ait değil' - + mail_subject_lost_password: "Parolanız %{value}" mail_body_lost_password: 'Parolanızı değiştirmek için, aşağıdaki bağlantıya tıklayın:' mail_subject_register: "Your %{value} hesap aktivasyonu" @@ -199,10 +199,10 @@ tr: mail_body_account_information: Hesap bilgileriniz mail_subject_account_activation_request: "%{value} hesabı etkinleştirme isteği" mail_body_account_activation_request: "Yeni bir kullanıcı (%{value}) kaydedildi. Hesap onaylanmayı bekliyor:" - + gui_validation_error: 1 hata gui_validation_error_plural: "%{count} hata" - + field_name: İsim field_description: Açıklama field_summary: Özet @@ -285,7 +285,7 @@ tr: field_searchable: Aranabilir field_default_value: Varsayılan değer field_comments_sorting: Açıklamaları göster - + setting_app_title: Uygulama Bağlığı setting_app_subtitle: Uygulama alt başlığı setting_welcome_text: Hoşgeldin Mesajı @@ -317,7 +317,7 @@ tr: setting_user_format: Kullanıcı gösterim formatı setting_activity_days_default: Proje Faaliyetlerinde gösterilen gün sayısı setting_display_subprojects_issues: Varsayılan olarak ana projenin ileti listesinde alt proje iletilerini göster - + project_module_issue_tracking: İleti Takibi project_module_time_tracking: Zaman Takibi project_module_news: Haberler @@ -326,7 +326,7 @@ tr: project_module_wiki: Wiki project_module_repository: Depo project_module_boards: Tartışma Alanı - + label_user: Kullanıcı label_user_plural: Kullanıcılar label_user_new: Yeni Kullanıcı @@ -631,7 +631,7 @@ tr: label_chronological_order: Tarih sırasına göre label_reverse_chronological_order: Ters tarih sırasına göre label_planning: Planlanıyor - + button_login: Giriş button_submit: Gönder button_save: Kaydet @@ -669,11 +669,11 @@ tr: button_annotate: Revizyon geçmişine göre göster button_update: Güncelle button_configure: Yapılandır - + status_active: faal status_registered: kayıtlı status_locked: kilitli - + text_select_mail_notifications: Gönderilecek e-posta uyarısına göre hareketi seçin. text_regexp_info: eg. ^[A-Z0-9]+$ text_min_max_length_info: 0 sınırlama yok demektir @@ -711,7 +711,7 @@ tr: text_destroy_time_entries: Raporlanmış saatleri sil text_assign_time_entries_to_project: Raporlanmış saatleri projeye ata text_reassign_time_entries: 'Raporlanmış saatleri bu iletiye tekrar ata:' - + default_role_manager: Yönetici default_role_developer: Geliştirici default_role_reporter: Raporlayıcı @@ -735,7 +735,7 @@ tr: default_priority_immediate: Derhal default_activity_design: Tasarım default_activity_development: Geliştirim - + enumeration_issue_priorities: İleti önceliği enumeration_doc_categories: Belge Kategorileri enumeration_activities: Faaliyetler (zaman takibi) diff --git a/config/locales/uk.yml b/config/locales/uk.yml index ac8afd0a..c7d0f7a3 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -8,10 +8,10 @@ uk: default: "%Y-%m-%d" short: "%b %d" long: "%B %d, %Y" - + day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday] abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat] - + # Don't forget the nil at the beginning; there's no such thing as a 0th month month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December] abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec] @@ -29,7 +29,7 @@ uk: long: "%B %d, %Y %H:%M" am: "am" pm: "pm" - + datetime: distance_in_words: half_a_minute: "half a minute" @@ -67,32 +67,32 @@ uk: one: "almost 1 year" other: "almost %{count} years" - number: + number: format: separator: "." delimiter: "" precision: 3 - human: - format: + human: + format: precision: 1 delimiter: "" - storage_units: + storage_units: format: "%n %u" - units: + units: kb: KB tb: TB gb: GB - byte: + byte: one: Byte other: Bytes mb: MB - + # Used in array.to_sentence. support: array: sentence_connector: "and" skip_last_comma: false - + activerecord: errors: template: @@ -126,7 +126,7 @@ uk: cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" actionview_instancetag_blank_option: Оберіть - + general_text_No: 'Ні' general_text_Yes: 'Так' general_text_no: 'Ні' @@ -137,7 +137,7 @@ uk: general_csv_encoding: UTF-8 general_pdf_encoding: UTF-8 general_first_day_of_week: '1' - + notice_account_updated: Обліковий запис успішно оновлений. notice_account_invalid_creditentials: Неправильне ім'я користувача або пароль notice_account_password_updated: Пароль успішно оновлений. @@ -161,7 +161,7 @@ uk: notice_failed_to_save_issues: "Не вдалося зберегти %{count} пункт(ів) з %{total} вибраних: %{ids}." notice_no_issue_selected: "Не вибрано жодної задачі! Будь ласка, відзначте задачу, яку ви хочете відредагувати." notice_account_pending: "Ваш обліковий запис створено і він чекає на підтвердження адміністратором." - + mail_subject_lost_password: "Ваш %{value} пароль" mail_body_lost_password: 'Для зміни пароля, зайдіть за наступним посиланням:' mail_subject_register: "Активація облікового запису %{value}" @@ -170,10 +170,10 @@ uk: mail_body_account_information: Інформація по Вашому обліковому запису mail_subject_account_activation_request: "Запит на активацію облікового запису %{value}" mail_body_account_activation_request: "Новий користувач (%{value}) зареєструвався. Його обліковий запис чекає на ваше підтвердження:" - + gui_validation_error: 1 помилка gui_validation_error_plural: "%{count} помилки(ок)" - + field_name: Ім'я field_description: Опис field_summary: Короткий опис @@ -191,8 +191,8 @@ uk: field_is_for_all: Для усіх проектів field_possible_values: Можливі значення field_regexp: Регулярний вираз - field_min_length: Мінімальна довжина - field_max_length: Максимальна довжина + field_min_length: Мінімальна довжина + field_max_length: Максимальна довжина field_value: Значення field_category: Категорія field_title: Назва @@ -214,9 +214,9 @@ uk: field_is_public: Публічний field_parent: Підпроект field_is_in_roadmap: Питання, що відображаються в оперативному плані - field_login: Вхід + field_login: Вхід field_mail_notification: Повідомлення за електронною поштою - field_admin: Адміністратор + field_admin: Адміністратор field_last_login_on: Останнє підключення field_language: Мова field_password: Пароль @@ -254,7 +254,7 @@ uk: field_column_names: Колонки field_time_zone: Часовий пояс field_searchable: Вживається у пошуку - + setting_app_title: Назва додатку setting_app_subtitle: Підзаголовок додатку setting_welcome_text: Текст привітання @@ -281,7 +281,7 @@ uk: setting_repositories_encodings: Кодування репозиторія setting_emails_footer: Підпис до електронної пошти setting_protocol: Протокол - + label_user: Користувач label_user_plural: Користувачі label_user_new: Новий користувач @@ -404,15 +404,15 @@ uk: label_total: Всього label_permissions: Права доступу label_current_status: Поточний статус - label_new_statuses_allowed: Дозволені нові статуси + label_new_statuses_allowed: Дозволені нові статуси label_all: Усі label_none: Нікому label_nobody: Ніхто label_next: Наступний label_previous: Попередній - label_used_by: Використовується + label_used_by: Використовується label_details: Подробиці - label_add_note: Додати зауваження + label_add_note: Додати зауваження label_per_page: На сторінку label_calendar: Календар label_months_from: місяців(ця) з @@ -442,8 +442,8 @@ uk: label_in: у label_today: сьогодні label_this_week: цього тижня - label_less_than_ago: менш ніж днів(я) назад - label_more_than_ago: більш ніж днів(я) назад + label_less_than_ago: менш ніж днів(я) назад + label_more_than_ago: більш ніж днів(я) назад label_ago: днів(я) назад label_contains: містить label_not_contains: не містить @@ -455,7 +455,7 @@ uk: label_revision: Версія label_revision_plural: Версій label_added: додано - label_modified: змінене + label_modified: змінене label_deleted: видалено label_latest_revision: Остання версія label_latest_revision_plural: Останні версії @@ -470,11 +470,11 @@ uk: label_roadmap_overdue: "%{value} запізнення" label_roadmap_no_issues: Немає питань для даної версії label_search: Пошук - label_result_plural: Результати + label_result_plural: Результати label_all_words: Всі слова label_wiki: Wiki label_wiki_edit: Редагування Wiki - label_wiki_edit_plural: Редагування Wiki + label_wiki_edit_plural: Редагування Wiki label_wiki_page: Сторінка Wiki label_wiki_page_plural: Сторінки Wiki label_index_by_title: Індекс за назвою @@ -482,7 +482,7 @@ uk: label_current_version: Поточна версія label_preview: Попередній перегляд label_feed_plural: Подання - label_changes_details: Подробиці по всіх змінах + label_changes_details: Подробиці по всіх змінах label_issue_tracking: Координація питань label_spent_time: Витрачений час label_f_hour: "%{value} година" @@ -491,7 +491,7 @@ uk: label_change_plural: Зміни label_statistics: Статистика label_commits_per_month: Подань на місяць - label_commits_per_author: Подань на користувача + label_commits_per_author: Подань на користувача label_view_diff: Проглянути відмінності label_diff_inline: підключений label_diff_side_by_side: поряд @@ -507,7 +507,7 @@ uk: label_relates_to: пов'язане з label_duplicates: дублює label_blocks: блокує - label_blocked_by: заблоковане + label_blocked_by: заблоковане label_precedes: передує label_follows: наступний за label_end_to_start: з кінця до початку @@ -555,12 +555,12 @@ uk: label_registration_manual_activation: ручна активація облікового запису label_registration_automatic_activation: автоматична активація облыкового label_my_time_report: Мій звіт витраченого часу - + button_login: Вхід button_submit: Відправити button_save: Зберегти - button_check_all: Відзначити все - button_uncheck_all: Очистити + button_check_all: Відзначити все + button_uncheck_all: Очистити button_delete: Видалити button_create: Створити button_test: Перевірити @@ -588,14 +588,14 @@ uk: button_unarchive: Розархівувати button_reset: Перезапустити button_rename: Перейменувати - button_change_password: Змінити пароль + button_change_password: Змінити пароль button_copy: Копіювати button_annotate: Анотувати - + status_active: Активний - status_registered: Зареєстрований + status_registered: Зареєстрований status_locked: Заблокований - + text_select_mail_notifications: Виберіть дії, на які відсилатиметься повідомлення на електронну пошту. text_regexp_info: eg. ^[A-Z0-9]+$ text_min_max_length_info: 0 означає відсутність заборон @@ -620,12 +620,12 @@ uk: text_issue_category_destroy_assignments: Видалити призначення категорії text_issue_category_reassign_to: Перепризначити задачі до даної категорії text_user_mail_option: "Для невибраних проектів ви отримуватимете повідомлення тільки про те, що проглядаєте або в чому берете участь (наприклад, питання автором яких ви є або які вам призначені)." - + default_role_manager: Менеджер default_role_developer: Розробник default_role_reporter: Репортер звітів default_tracker_bug: Помилка - default_tracker_feature: Властивість + default_tracker_feature: Властивість default_tracker_support: Підтримка default_issue_status_new: Новий default_issue_status_in_progress: In Progress @@ -634,7 +634,7 @@ uk: default_issue_status_closed: Зачинено default_issue_status_rejected: Відмовлено default_doc_category_user: Документація користувача - default_doc_category_tech: Технічна документація + default_doc_category_tech: Технічна документація default_priority_low: Низький default_priority_normal: Нормальний default_priority_high: Високий @@ -642,7 +642,7 @@ uk: default_priority_immediate: Негайний default_activity_design: Проектування default_activity_development: Розробка - + enumeration_issue_priorities: Пріоритети питань enumeration_doc_categories: Категорії документів enumeration_activities: Дії (облік часу) diff --git a/config/locales/vi.yml b/config/locales/vi.yml index df038cd5..8daf9b80 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -178,9 +178,9 @@ vi: words_connector: ", " two_words_connector: " và " last_word_connector: ", và " - + actionview_instancetag_blank_option: Vui lòng chọn - + general_text_No: 'Không' general_text_Yes: 'Có' general_text_no: 'không' @@ -191,7 +191,7 @@ vi: general_csv_encoding: UTF-8 general_pdf_encoding: UTF-8 general_first_day_of_week: '1' - + notice_account_updated: Cập nhật tài khoản thành công. notice_account_invalid_creditentials: Tài khoản hoặc mật mã không hợp lệ notice_account_password_updated: Cập nhật mật mã thành công. @@ -216,13 +216,13 @@ vi: notice_account_pending: "Thông tin tài khoản đã được tạo ra và đang chờ chứng thực từ ban quản trị." notice_default_data_loaded: Đã nạp cấu hình mặc định. notice_unable_delete_version: Không thể xóa phiên bản. - + error_can_t_load_default_data: "Không thể nạp cấu hình mặc định: %{value}" error_scm_not_found: "The entry or revision was not found in the repository." error_scm_command_failed: "Lỗi xảy ra khi truy cập vào kho lưu trữ: %{value}" error_scm_annotate: "The entry does not exist or can not be annotated." error_issue_not_found_in_project: 'Vấn đề không tồn tại hoặc không thuộc dự án' - + mail_subject_lost_password: "%{value}: mật mã của bạn" mail_body_lost_password: "Để đổi mật mã, hãy click chuột vào liên kết sau:" mail_subject_register: "%{value}: kích hoạt tài khoản" @@ -233,10 +233,10 @@ vi: mail_body_account_activation_request: "Người dùng (%{value}) mới đăng ký và cần bạn xác nhận:" mail_subject_reminder: "%{count} vấn đề hết hạn trong các %{days} ngày tới" mail_body_reminder: "%{count} vấn đề gán cho bạn sẽ hết hạn trong %{days} ngày tới:" - + gui_validation_error: 1 lỗi gui_validation_error_plural: "%{count} lỗi" - + field_name: Tên field_description: Mô tả field_summary: Tóm tắt @@ -320,7 +320,7 @@ vi: field_default_value: Giá trị mặc định field_comments_sorting: Liệt kê bình luận field_parent_title: Trang mẹ - + setting_app_title: Tựa đề ứng dụng setting_app_subtitle: Tựa đề nhỏ của ứng dụng setting_welcome_text: Thông điệp chào mừng @@ -357,7 +357,7 @@ vi: setting_mail_handler_api_enabled: Enable WS for incoming emails setting_mail_handler_api_key: Mã số API setting_sequential_project_identifiers: Tự sinh chuỗi ID dự án - + project_module_issue_tracking: Theo dõi vấn đề project_module_time_tracking: Theo dõi thời gian project_module_news: Tin tức @@ -366,7 +366,7 @@ vi: project_module_wiki: Wiki project_module_repository: Kho lưu trữ project_module_boards: Diễn đàn - + label_user: Tài khoản label_user_plural: Tài khoản label_user_new: Tài khoản mới @@ -678,7 +678,7 @@ vi: label_incoming_emails: Nhận mail label_generate_key: Tạo mã label_issue_watchers: Theo dõi - + button_login: Đăng nhập button_submit: Gửi button_save: Lưu @@ -717,11 +717,11 @@ vi: button_update: Cập nhật button_configure: Cấu hình button_quote: Trích dẫn - + status_active: hoạt động status_registered: đăng ký status_locked: khóa - + text_select_mail_notifications: Chọn hành động đối với mỗi email thông báo sẽ gửi. text_regexp_info: eg. ^[A-Z0-9]+$ text_min_max_length_info: 0 để chỉ không hạn chế @@ -763,7 +763,7 @@ vi: text_enumeration_destroy_question: "%{count} objects are assigned to this value." text_enumeration_category_reassign_to: 'Reassign them to this value:' text_email_delivery_not_configured: "Email delivery is not configured, and notifications are disabled.\nConfigure your SMTP server in config/configuration.yml and restart the application to enable them." - + default_role_manager: Điều hành default_role_developer: Phát triển default_role_reporter: Báo cáo @@ -787,11 +787,11 @@ vi: default_priority_immediate: Trung bình default_activity_design: Thiết kế default_activity_development: Phát triển - + enumeration_issue_priorities: Mức độ ưu tiên vấn đề enumeration_doc_categories: Chủ đề tài liệu enumeration_activities: Hoạt động (theo dõi thời gian) - + setting_plain_text_mail: mail dạng text đơn giản (không dùng HTML) setting_gravatar_enabled: Dùng biểu tượng Gravatar permission_edit_project: Chỉnh dự án diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 4ef2277b..b67b01da 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -1,4 +1,4 @@ -# Chinese (Taiwan) translations for Ruby on Rails +# Chinese (Taiwan) translations for Ruby on Rails # by tsechingho (http://github.com/tsechingho) # See http://github.com/svenfuchs/rails-i18n/ for details. @@ -24,7 +24,7 @@ - :year - :month - :day - + time: formats: default: "%Y年%b%d日 %A %H:%M:%S %Z" @@ -69,9 +69,9 @@ percentage: format: # 下列三個選項設定, 若有設定值將會取代 number.format 成為預設值 - # separator: + # separator: delimiter: "" - # precision: + # precision: # 使用於 number_to_precision() precision: @@ -79,13 +79,13 @@ # 下列三個選項設定, 若有設定值將會取代 number.format 成為預設值 # separator: delimiter: "" - # precision: + # precision: # 使用於 number_to_human_size() human: format: # 下列三個選項設定, 若有設定值將會取代 number.format 成為預設值 - # separator: + # separator: delimiter: "" precision: 1 # 儲存單位輸出格式. @@ -149,7 +149,7 @@ activerecord: errors: template: - header: + header: one: "有 1 個錯誤發生使得「%{model}」無法被儲存。" other: "有 %{count} 個錯誤發生使得「%{model}」無法被儲存。" # The variable :count is also available @@ -192,16 +192,16 @@ # attributes: # login: # blank: "This is a custom blank message for User login" - # Will define custom blank validation message for User model and + # Will define custom blank validation message for User model and # custom blank validation message for login attribute of User model. #models: - + # Translate model names. Used in Model.human_name(). #models: # For example, # user: "Dude" # will translate User model name to "Dude" - + # Translate model attribute names. Used in Model.human_attribute_name(attribute). #attributes: # For example, @@ -210,7 +210,7 @@ # will translate User attribute "login" as "Handle" actionview_instancetag_blank_option: 請選擇 - + general_text_No: '否' general_text_Yes: '是' general_text_no: '否' @@ -221,7 +221,7 @@ general_csv_encoding: Big5 general_pdf_encoding: Big5 general_first_day_of_week: '7' - + notice_account_updated: 帳戶更新資訊已儲存 notice_account_invalid_creditentials: 帳戶或密碼不正確 notice_account_password_updated: 帳戶新密碼已儲存 @@ -271,7 +271,7 @@ error_unable_delete_issue_status: '無法刪除項目狀態' error_unable_to_connect: "無法連線至(%{value})" warning_attachments_not_saved: "%{count} 個附加檔案無法被儲存。" - + mail_subject_lost_password: 您的 Redmine 網站密碼 mail_body_lost_password: '欲變更您的 Redmine 網站密碼, 請點選以下鏈結:' mail_subject_register: 啟用您的 Redmine 帳號 @@ -286,10 +286,10 @@ mail_body_wiki_content_added: "此 '%{id}' wiki 頁面已被 %{author} 新增。" mail_subject_wiki_content_updated: "'%{id}' wiki 頁面已被更新" mail_body_wiki_content_updated: "此 '%{id}' wiki 頁面已被 %{author} 更新。" - + gui_validation_error: 1 個錯誤 gui_validation_error_plural: "%{count} 個錯誤" - + field_name: 名稱 field_description: 概述 field_summary: 摘要 @@ -388,7 +388,7 @@ field_text: 內容文字 field_visible: 可被看見 field_warn_on_leaving_unsaved: "提醒我將要離開的頁面中尚有未儲存的資料" - + setting_app_title: 標題 setting_app_subtitle: 副標題 setting_welcome_text: 歡迎詞 @@ -447,7 +447,7 @@ setting_commit_logtime_enabled: 啟用送交中的時間記錄 setting_commit_logtime_activity_id: 時間記錄對應的活動 setting_gantt_items_limit: 甘特圖中項目顯示數量的最大值 - + permission_add_project: 建立專案 permission_add_subprojects: 建立子專案 permission_edit_project: 編輯專案 @@ -503,7 +503,7 @@ permission_delete_own_messages: 刪除自己的訊息 permission_export_wiki_pages: 匯出 wiki 頁面 permission_manage_subtasks: 管理子工作項目 - + project_module_issue_tracking: 項目追蹤 project_module_time_tracking: 工時追蹤 project_module_news: 新聞 @@ -514,7 +514,7 @@ project_module_boards: 討論區 project_module_calendar: 日曆 project_module_gantt: 甘特圖 - + label_user: 用戶 label_user_plural: 用戶清單 label_user_new: 建立新用戶 @@ -711,7 +711,7 @@ label_modification: "%{count} 變更" label_modification_plural: "%{count} 變更" label_branch: 分支 - label_tag: 標籤 + label_tag: 標籤 label_revision: 版次 label_revision_plural: 版次清單 label_revision_id: "版次 %{value}" @@ -924,17 +924,17 @@ button_quote: 引用 button_duplicate: 重製 button_show: 顯示 - + status_active: 活動中 status_registered: 註冊完成 status_locked: 鎖定中 - + version_status_open: 進行中 version_status_locked: 已鎖定 version_status_closed: 已結束 - + field_active: 活動中 - + text_select_mail_notifications: 選擇欲寄送提醒通知郵件之動作 text_regexp_info: eg. ^[A-Z0-9]+$ text_min_max_length_info: 0 代表「不限制」 @@ -996,7 +996,7 @@ text_zoom_in: 放大 text_zoom_out: 縮小 text_warn_on_leaving_unsaved: "若您離開這個頁面,此頁面所包含的未儲存資料將會遺失。" - + default_role_manager: 管理人員 default_role_developer: 開發人員 default_role_reporter: 報告人員 @@ -1020,7 +1020,7 @@ default_priority_immediate: 急 default_activity_design: 設計 default_activity_development: 開發 - + enumeration_issue_priorities: 項目優先權 enumeration_doc_categories: 文件分類 enumeration_activities: 活動 (時間追蹤) diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 6c42072e..aec61201 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1,4 +1,4 @@ -# Chinese (China) translations for Ruby on Rails +# Chinese (China) translations for Ruby on Rails # by tsechingho (http://github.com/tsechingho) zh: @@ -16,7 +16,7 @@ zh: - :year - :month - :day - + time: formats: default: "%Y年%b%d日 %A %H:%M:%S" @@ -26,7 +26,7 @@ zh: long: "%Y年%b%d日 %H:%M" am: "上午" pm: "下午" - + datetime: distance_in_words: half_a_minute: "半分钟" @@ -70,7 +70,7 @@ zh: hour: "时" minute: "分" second: "秒" - + number: format: separator: "." @@ -103,17 +103,17 @@ zh: mb: "MB" gb: "GB" tb: "TB" - + support: array: words_connector: ", " two_words_connector: " 和 " last_word_connector: ", 和 " - + activerecord: errors: template: - header: + header: one: "有 1 个错误发生导致「%{model}」无法被保存。" other: "有 %{count} 个错误发生导致「%{model}」无法被保存。" body: "如下字段出现错误:" @@ -143,7 +143,7 @@ zh: cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks" actionview_instancetag_blank_option: 请选择 - + general_text_No: '否' general_text_Yes: '是' general_text_no: '否' @@ -154,7 +154,7 @@ zh: general_csv_encoding: gb18030 general_pdf_encoding: gb18030 general_first_day_of_week: '7' - + notice_account_updated: 帐号更新成功 notice_account_invalid_creditentials: 无效的用户名或密码 notice_account_password_updated: 密码更新成功 @@ -196,7 +196,7 @@ zh: error_workflow_copy_target: 请选择目标跟踪标签和角色 warning_attachments_not_saved: "%{count} 个文件保存失败。" - + mail_subject_lost_password: "您的 %{value} 密码" mail_body_lost_password: '请点击以下链接来修改您的密码:' mail_subject_register: "%{value}帐号激活" @@ -214,7 +214,7 @@ zh: gui_validation_error: 1 个错误 gui_validation_error_plural: "%{count} 个错误" - + field_name: 名称 field_description: 描述 field_summary: 摘要 @@ -419,7 +419,7 @@ zh: project_module_wiki: Wiki project_module_repository: 版本库 project_module_boards: 讨论区 - + label_user: 用户 label_user_plural: 用户 label_user_new: 新建用户 @@ -770,7 +770,7 @@ zh: label_api_access_key: API访问键 label_missing_api_access_key: 缺少API访问键 label_api_access_key_created_on: API访问键是在 %{value} 之前建立的 - + button_login: 登录 button_submit: 提交 button_save: 保存 @@ -904,7 +904,7 @@ zh: default_priority_immediate: 立刻 default_activity_design: 设计 default_activity_development: 开发 - + enumeration_issue_priorities: 问题优先级 enumeration_doc_categories: 文档类别 enumeration_activities: 活动(时间跟踪) diff --git a/config/preinitializer.rb b/config/preinitializer.rb index 3d90b701..ed24a10e 100644 --- a/config/preinitializer.rb +++ b/config/preinitializer.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/config/routes.rb b/config/routes.rb index 97feddde..971966ac 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,29 +1,29 @@ #-- 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. #++ ActionController::Routing::Routes.draw do |map| # Add your own custom routes here. # The priority is based upon order of creation: first created -> highest priority. - + # Here's a sample route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :controller and :action map.home '', :controller => 'welcome' - + map.signin 'login', :controller => 'account', :action => 'login' map.signout 'logout', :controller => 'account', :action => 'logout' - + map.connect 'roles/workflow/:id/:role_id/:tracker_id', :controller => 'roles', :action => 'workflow' map.connect 'help/:ctrl/:page', :controller => 'help' @@ -37,11 +37,11 @@ ActionController::Routing::Routes.draw do |map| end map.resources :time_entries, :controller => 'timelog' - + map.connect 'projects/:id/wiki', :controller => 'wikis', :action => 'edit', :conditions => {:method => :post} map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :get} map.connect 'projects/:id/wiki/destroy', :controller => 'wikis', :action => 'destroy', :conditions => {:method => :post} - + map.with_options :controller => 'messages' do |messages_routes| messages_routes.with_options :conditions => {:method => :get} do |messages_views| messages_views.connect 'boards/:board_id/topics/new', :action => 'new' @@ -54,7 +54,7 @@ ActionController::Routing::Routes.draw do |map| messages_actions.connect 'boards/:board_id/topics/:id/:action', :action => /edit|destroy/ end end - + map.with_options :controller => 'boards' do |board_routes| board_routes.with_options :conditions => {:method => :get} do |board_views| board_views.connect 'projects/:project_id/boards', :action => 'index' @@ -68,7 +68,7 @@ ActionController::Routing::Routes.draw do |map| board_actions.connect 'projects/:project_id/boards/:id/:action', :action => /edit|destroy/ end end - + map.with_options :controller => 'documents' do |document_routes| document_routes.with_options :conditions => {:method => :get} do |document_views| document_views.connect 'projects/:project_id/documents', :action => 'index' @@ -107,11 +107,11 @@ ActionController::Routing::Routes.draw do |map| # Following two routes conflict with the resources because #index allows POST map.connect '/issues', :controller => 'issues', :action => 'index', :conditions => { :method => :post } map.connect '/issues/create', :controller => 'issues', :action => 'index', :conditions => { :method => :post } - + map.resources :issues, :member => { :edit => :post }, :collection => {} do |issues| issues.resources :time_entries, :controller => 'timelog' end - + map.resources :issues, :path_prefix => '/projects/:project_id', :collection => { :create => :post } do |issues| issues.resources :time_entries, :controller => 'timelog' end @@ -125,7 +125,7 @@ ActionController::Routing::Routes.draw do |map| map.with_options :controller => 'users' do |users| users.connect 'users/:id/edit/:tab', :action => 'edit', :tab => nil, :conditions => {:method => :get} - + users.with_options :conditions => {:method => :post} do |user_actions| user_actions.connect 'users/:id/memberships', :action => 'edit_membership' user_actions.connect 'users/:id/memberships/:membership_id', :action => 'edit_membership' @@ -189,7 +189,7 @@ ActionController::Routing::Routes.draw do |map| project_views.connect 'projects/:project_id/issues/:copy_from/copy', :controller => 'issues', :action => 'new' end end - + map.with_options :controller => 'activities', :action => 'index', :conditions => {:method => :get} do |activity| activity.connect 'projects/:id/activity' activity.connect 'projects/:id/activity.:format' @@ -197,11 +197,11 @@ ActionController::Routing::Routes.draw do |map| activity.connect 'activity.:format', :id => nil end - + map.with_options :controller => 'issue_categories' do |categories| categories.connect 'projects/:project_id/issue_categories/new', :action => 'new' end - + map.with_options :controller => 'repositories' do |repositories| repositories.with_options :conditions => {:method => :get} do |repository_views| repository_views.connect 'projects/:id/repository', :action => 'show' @@ -219,16 +219,16 @@ ActionController::Routing::Routes.draw do |map| repository_views.connect 'projects/:id/repository/entry/*path', :action => 'entry' repository_views.connect 'projects/:id/repository/:action/*path' end - + repositories.connect 'projects/:id/repository/:action', :conditions => {:method => :post} end - + map.connect 'attachments/:id', :controller => 'attachments', :action => 'show', :id => /\d+/ map.connect 'attachments/:id/:filename', :controller => 'attachments', :action => 'show', :id => /\d+/, :filename => /.*/ map.connect 'attachments/download/:id/:filename', :controller => 'attachments', :action => 'download', :id => /\d+/, :filename => /.*/ - + map.resources :groups - + #left old routes at the bottom for backwards compat map.connect 'projects/:project_id/issues/:action', :controller => 'issues' map.connect 'projects/:project_id/documents/:action', :controller => 'documents' @@ -236,7 +236,7 @@ ActionController::Routing::Routes.draw do |map| map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages' map.connect 'wiki/:id/:page/:action', :page => nil, :controller => 'wiki' map.connect 'issues/:issue_id/relations/:action/:id', :controller => 'issue_relations' - map.connect 'projects/:project_id/news/:action', :controller => 'news' + map.connect 'projects/:project_id/news/:action', :controller => 'news' map.connect 'projects/:project_id/timelog/:action/:id', :controller => 'timelog', :project_id => /.+/ map.with_options :controller => 'repositories' do |omap| omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse' @@ -246,12 +246,12 @@ ActionController::Routing::Routes.draw do |map| omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate' omap.connect 'repositories/revision/:id/:rev', :action => 'revision' end - + map.with_options :controller => 'sys' do |sys| sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} end - + # Install the default route as the lowest priority. map.connect ':controller/:action/:id' map.connect 'robots.txt', :controller => 'welcome', :action => 'robots' diff --git a/config/settings.yml b/config/settings.yml index 0dbf1800..79bfdf35 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -61,7 +61,7 @@ diff_max_lines_displayed: default: 1500 enabled_scm: serialized: true - default: + default: - Subversion - Darcs - Mercurial @@ -89,7 +89,7 @@ commit_logtime_activity_id: format: int default: 0 # autologin duration in days -# 0 means autologin is disabled +# 0 means autologin is disabled autologin: format: int default: 0 @@ -105,7 +105,7 @@ cross_project_issue_relations: default: 0 notified_events: serialized: true - default: + default: - issue_added - issue_updated mail_handler_body_delimiters: @@ -113,10 +113,10 @@ mail_handler_body_delimiters: mail_handler_api_enabled: default: 0 mail_handler_api_key: - default: + default: issue_list_default_columns: serialized: true - default: + default: - tracker - status - priority @@ -131,7 +131,7 @@ default_projects_public: default: 1 default_projects_modules: serialized: true - default: + default: - issue_tracking - time_tracking - news @@ -164,7 +164,7 @@ emails_footer: default: |- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://hostname/my/account -gravatar_enabled: +gravatar_enabled: default: 0 openid: default: 0 diff --git a/db/migrate/001_setup.rb b/db/migrate/001_setup.rb index 40457827..b190b6e3 100644 --- a/db/migrate/001_setup.rb +++ b/db/migrate/001_setup.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,22 +18,22 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class Setup < ActiveRecord::Migration - + class User < ActiveRecord::Base; end # model removed class Permission < ActiveRecord::Base; end - + def self.up create_table "attachments", :force => true do |t| t.column "container_id", :integer, :default => 0, :null => false @@ -62,7 +62,7 @@ class Setup < ActiveRecord::Migration t.column "attr_mail", :string, :limit => 30 t.column "onthefly_register", :boolean, :default => false, :null => false end - + create_table "custom_fields", :force => true do |t| t.column "type", :string, :limit => 30, :default => "", :null => false t.column "name", :string, :limit => 30, :default => "", :null => false @@ -74,7 +74,7 @@ class Setup < ActiveRecord::Migration t.column "is_required", :boolean, :default => false, :null => false t.column "is_for_all", :boolean, :default => false, :null => false end - + create_table "custom_fields_projects", :id => false, :force => true do |t| t.column "custom_field_id", :integer, :default => 0, :null => false t.column "project_id", :integer, :default => 0, :null => false @@ -91,7 +91,7 @@ class Setup < ActiveRecord::Migration t.column "custom_field_id", :integer, :default => 0, :null => false t.column "value", :text end - + create_table "documents", :force => true do |t| t.column "project_id", :integer, :default => 0, :null => false t.column "category_id", :integer, :default => 0, :null => false @@ -99,21 +99,21 @@ class Setup < ActiveRecord::Migration t.column "description", :text t.column "created_on", :timestamp end - + add_index "documents", ["project_id"], :name => "documents_project_id" - + create_table "enumerations", :force => true do |t| t.column "opt", :string, :limit => 4, :default => "", :null => false t.column "name", :string, :limit => 30, :default => "", :null => false end - + create_table "issue_categories", :force => true do |t| t.column "project_id", :integer, :default => 0, :null => false t.column "name", :string, :limit => 30, :default => "", :null => false end - + add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" - + create_table "issue_histories", :force => true do |t| t.column "issue_id", :integer, :default => 0, :null => false t.column "status_id", :integer, :default => 0, :null => false @@ -121,7 +121,7 @@ class Setup < ActiveRecord::Migration t.column "notes", :text t.column "created_on", :timestamp end - + add_index "issue_histories", ["issue_id"], :name => "issue_histories_issue_id" create_table "issue_statuses", :force => true do |t| @@ -130,7 +130,7 @@ class Setup < ActiveRecord::Migration t.column "is_default", :boolean, :default => false, :null => false t.column "html_color", :string, :limit => 6, :default => "FFFFFF", :null => false end - + create_table "issues", :force => true do |t| t.column "tracker_id", :integer, :default => 0, :null => false t.column "project_id", :integer, :default => 0, :null => false @@ -147,16 +147,16 @@ class Setup < ActiveRecord::Migration t.column "created_on", :timestamp t.column "updated_on", :timestamp end - + add_index "issues", ["project_id"], :name => "issues_project_id" - + create_table "members", :force => true do |t| t.column "user_id", :integer, :default => 0, :null => false t.column "project_id", :integer, :default => 0, :null => false t.column "role_id", :integer, :default => 0, :null => false t.column "created_on", :timestamp end - + create_table "news", :force => true do |t| t.column "project_id", :integer t.column "title", :string, :limit => 60, :default => "", :null => false @@ -165,9 +165,9 @@ class Setup < ActiveRecord::Migration t.column "author_id", :integer, :default => 0, :null => false t.column "created_on", :timestamp end - + add_index "news", ["project_id"], :name => "news_project_id" - + create_table "permissions", :force => true do |t| t.column "controller", :string, :limit => 30, :default => "", :null => false t.column "action", :string, :limit => 30, :default => "", :null => false @@ -177,14 +177,14 @@ class Setup < ActiveRecord::Migration t.column "mail_option", :boolean, :default => false, :null => false t.column "mail_enabled", :boolean, :default => false, :null => false end - + create_table "permissions_roles", :id => false, :force => true do |t| t.column "permission_id", :integer, :default => 0, :null => false t.column "role_id", :integer, :default => 0, :null => false end - + add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id" - + create_table "projects", :force => true do |t| t.column "name", :string, :limit => 30, :default => "", :null => false t.column "description", :string, :default => "", :null => false @@ -195,7 +195,7 @@ class Setup < ActiveRecord::Migration t.column "created_on", :timestamp t.column "updated_on", :timestamp end - + create_table "roles", :force => true do |t| t.column "name", :string, :limit => 30, :default => "", :null => false end @@ -206,12 +206,12 @@ class Setup < ActiveRecord::Migration t.column "value", :string, :limit => 40, :default => "", :null => false t.column "created_on", :datetime, :null => false end - + create_table "trackers", :force => true do |t| t.column "name", :string, :limit => 30, :default => "", :null => false t.column "is_in_chlog", :boolean, :default => false, :null => false end - + create_table "users", :force => true do |t| t.column "login", :string, :limit => 30, :default => "", :null => false t.column "hashed_password", :string, :limit => 40, :default => "", :null => false @@ -227,7 +227,7 @@ class Setup < ActiveRecord::Migration t.column "created_on", :timestamp t.column "updated_on", :timestamp end - + create_table "versions", :force => true do |t| t.column "project_id", :integer, :default => 0, :null => false t.column "name", :string, :limit => 30, :default => "", :null => false @@ -236,16 +236,16 @@ class Setup < ActiveRecord::Migration t.column "created_on", :timestamp t.column "updated_on", :timestamp end - + add_index "versions", ["project_id"], :name => "versions_project_id" - + create_table "workflows", :force => true do |t| t.column "tracker_id", :integer, :default => 0, :null => false t.column "old_status_id", :integer, :default => 0, :null => false t.column "new_status_id", :integer, :default => 0, :null => false t.column "role_id", :integer, :default => 0, :null => false end - + # project Permission.create :controller => "projects", :action => "show", :description => "label_overview", :sort => 100, :is_public => true Permission.create :controller => "projects", :action => "changelog", :description => "label_change_log", :sort => 105, :is_public => true @@ -296,7 +296,7 @@ class Setup < ActiveRecord::Migration Permission.create :controller => "versions", :action => "download", :description => "button_download", :sort => 1301, :is_public => true Permission.create :controller => "projects", :action => "add_file", :description => "button_add", :sort => 1320 Permission.create :controller => "versions", :action => "destroy_file", :description => "button_delete", :sort => 1322 - + # create default administrator account user = User.create :login => "admin", :hashed_password => "d033e22ae348aeb5660fc2140aec35850c4da997", diff --git a/db/migrate/002_issue_move.rb b/db/migrate/002_issue_move.rb index 4746959a..eb547f90 100644 --- a/db/migrate/002_issue_move.rb +++ b/db/migrate/002_issue_move.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/db/migrate/003_issue_add_note.rb b/db/migrate/003_issue_add_note.rb index 8ef591e4..abad975e 100644 --- a/db/migrate/003_issue_add_note.rb +++ b/db/migrate/003_issue_add_note.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/db/migrate/004_export_pdf.rb b/db/migrate/004_export_pdf.rb index 7765d0ce..81786055 100644 --- a/db/migrate/004_export_pdf.rb +++ b/db/migrate/004_export_pdf.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/db/migrate/005_issue_start_date.rb b/db/migrate/005_issue_start_date.rb index 32ffef90..8e307d13 100644 --- a/db/migrate/005_issue_start_date.rb +++ b/db/migrate/005_issue_start_date.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/db/migrate/006_calendar_and_activity.rb b/db/migrate/006_calendar_and_activity.rb index 7ace3f98..1327ced8 100644 --- a/db/migrate/006_calendar_and_activity.rb +++ b/db/migrate/006_calendar_and_activity.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/db/migrate/007_create_journals.rb b/db/migrate/007_create_journals.rb index 7a021fa6..e53a0af8 100644 --- a/db/migrate/007_create_journals.rb +++ b/db/migrate/007_create_journals.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,7 +17,7 @@ class CreateJournals < ActiveRecord::Migration class IssueHistory < ActiveRecord::Base; belongs_to :issue; end # model removed class Permission < ActiveRecord::Base; end - + def self.up create_table :journals, :force => true do |t| t.column "journalized_id", :integer, :default => 0, :null => false @@ -33,19 +33,19 @@ class CreateJournals < ActiveRecord::Migration t.column "old_value", :string t.column "value", :string end - + # indexes add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - + Permission.create :controller => "issues", :action => "history", :description => "label_history", :sort => 1006, :is_public => true, :mail_option => 0, :mail_enabled => 0 # data migration IssueHistory.find(:all, :include => :issue).each {|h| j = Journal.new(:journalized => h.issue, :user_id => h.author_id, :notes => h.notes, :created_on => h.created_on) j.details << JournalDetail.new(:property => 'attr', :prop_key => 'status_id', :value => h.status_id) - j.save - } + j.save + } drop_table :issue_histories end @@ -53,7 +53,7 @@ class CreateJournals < ActiveRecord::Migration def self.down drop_table :journal_details drop_table :journals - + create_table "issue_histories", :force => true do |t| t.column "issue_id", :integer, :default => 0, :null => false t.column "status_id", :integer, :default => 0, :null => false @@ -61,7 +61,7 @@ class CreateJournals < ActiveRecord::Migration t.column "notes", :text, :default => "" t.column "created_on", :timestamp end - + add_index "issue_histories", ["issue_id"], :name => "issue_histories_issue_id" Permission.find(:first, :conditions => ["controller=? and action=?", 'issues', 'history']).destroy diff --git a/db/migrate/008_create_user_preferences.rb b/db/migrate/008_create_user_preferences.rb index d7aed855..a9375eed 100644 --- a/db/migrate/008_create_user_preferences.rb +++ b/db/migrate/008_create_user_preferences.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/db/migrate/009_add_hide_mail_pref.rb b/db/migrate/009_add_hide_mail_pref.rb index a9bc2106..34a93549 100644 --- a/db/migrate/009_add_hide_mail_pref.rb +++ b/db/migrate/009_add_hide_mail_pref.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/db/migrate/010_create_comments.rb b/db/migrate/010_create_comments.rb index b393ef33..af428144 100644 --- a/db/migrate/010_create_comments.rb +++ b/db/migrate/010_create_comments.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/db/migrate/011_add_news_comments_count.rb b/db/migrate/011_add_news_comments_count.rb index efefacaf..3dd6f418 100644 --- a/db/migrate/011_add_news_comments_count.rb +++ b/db/migrate/011_add_news_comments_count.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/db/migrate/012_add_comments_permissions.rb b/db/migrate/012_add_comments_permissions.rb index 049be0a7..b6738522 100644 --- a/db/migrate/012_add_comments_permissions.rb +++ b/db/migrate/012_add_comments_permissions.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/db/migrate/013_create_queries.rb b/db/migrate/013_create_queries.rb index 6c5f452c..b7acd2e3 100644 --- a/db/migrate/013_create_queries.rb +++ b/db/migrate/013_create_queries.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/db/migrate/014_add_queries_permissions.rb b/db/migrate/014_add_queries_permissions.rb index 2669c2db..ac04869c 100644 --- a/db/migrate/014_add_queries_permissions.rb +++ b/db/migrate/014_add_queries_permissions.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/db/migrate/015_create_repositories.rb b/db/migrate/015_create_repositories.rb index cf27052a..f0ec0189 100644 --- a/db/migrate/015_create_repositories.rb +++ b/db/migrate/015_create_repositories.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/db/migrate/016_add_repositories_permissions.rb b/db/migrate/016_add_repositories_permissions.rb index 1dcf5fba..eb6e7bd1 100644 --- a/db/migrate/016_add_repositories_permissions.rb +++ b/db/migrate/016_add_repositories_permissions.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/db/migrate/017_create_settings.rb b/db/migrate/017_create_settings.rb index 5a645dd3..9fe59661 100644 --- a/db/migrate/017_create_settings.rb +++ b/db/migrate/017_create_settings.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/db/migrate/018_set_doc_and_files_notifications.rb b/db/migrate/018_set_doc_and_files_notifications.rb index 0993f4a8..9848c60d 100644 --- a/db/migrate/018_set_doc_and_files_notifications.rb +++ b/db/migrate/018_set_doc_and_files_notifications.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/db/migrate/019_add_issue_status_position.rb b/db/migrate/019_add_issue_status_position.rb index 16f9b28e..aa588426 100644 --- a/db/migrate/019_add_issue_status_position.rb +++ b/db/migrate/019_add_issue_status_position.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/db/migrate/020_add_role_position.rb b/db/migrate/020_add_role_position.rb index 272c3e4a..5e39691e 100644 --- a/db/migrate/020_add_role_position.rb +++ b/db/migrate/020_add_role_position.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/db/migrate/021_add_tracker_position.rb b/db/migrate/021_add_tracker_position.rb index 601b05ed..712fa20f 100644 --- a/db/migrate/021_add_tracker_position.rb +++ b/db/migrate/021_add_tracker_position.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/db/migrate/022_serialize_possibles_values.rb b/db/migrate/022_serialize_possibles_values.rb index 5af8c050..3360f1f3 100644 --- a/db/migrate/022_serialize_possibles_values.rb +++ b/db/migrate/022_serialize_possibles_values.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/db/migrate/023_add_tracker_is_in_roadmap.rb b/db/migrate/023_add_tracker_is_in_roadmap.rb index a0a7cdc4..c521f652 100644 --- a/db/migrate/023_add_tracker_is_in_roadmap.rb +++ b/db/migrate/023_add_tracker_is_in_roadmap.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/db/migrate/024_add_roadmap_permission.rb b/db/migrate/024_add_roadmap_permission.rb index 2880fe60..fffcde10 100644 --- a/db/migrate/024_add_roadmap_permission.rb +++ b/db/migrate/024_add_roadmap_permission.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/db/migrate/025_add_search_permission.rb b/db/migrate/025_add_search_permission.rb index 6210b438..e279abe8 100644 --- a/db/migrate/025_add_search_permission.rb +++ b/db/migrate/025_add_search_permission.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/db/migrate/026_add_repository_login_and_password.rb b/db/migrate/026_add_repository_login_and_password.rb index 91fee350..a1c69f5b 100644 --- a/db/migrate/026_add_repository_login_and_password.rb +++ b/db/migrate/026_add_repository_login_and_password.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/db/migrate/027_create_wikis.rb b/db/migrate/027_create_wikis.rb index bb820c43..43529353 100644 --- a/db/migrate/027_create_wikis.rb +++ b/db/migrate/027_create_wikis.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,7 +17,7 @@ class CreateWikis < ActiveRecord::Migration t.column :project_id, :integer, :null => false t.column :start_page, :string, :limit => 255, :null => false t.column :status, :integer, :default => 1, :null => false - end + end add_index :wikis, :project_id, :name => :wikis_project_id end diff --git a/db/migrate/028_create_wiki_pages.rb b/db/migrate/028_create_wiki_pages.rb index ec62e4b5..4b32a206 100644 --- a/db/migrate/028_create_wiki_pages.rb +++ b/db/migrate/028_create_wiki_pages.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. #++ @@ -16,7 +16,7 @@ class CreateWikiPages < ActiveRecord::Migration create_table :wiki_pages do |t| t.column :wiki_id, :integer, :null => false t.column :title, :string, :limit => 255, :null => false - t.column :created_on, :datetime, :null => false + t.column :created_on, :datetime, :null => false end add_index :wiki_pages, [:wiki_id, :title], :name => :wiki_pages_wiki_id_title end diff --git a/db/migrate/029_create_wiki_contents.rb b/db/migrate/029_create_wiki_contents.rb index b1f1a7ca..26ec9ca7 100644 --- a/db/migrate/029_create_wiki_contents.rb +++ b/db/migrate/029_create_wiki_contents.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,7 +22,7 @@ class CreateWikiContents < ActiveRecord::Migration t.column :version, :integer, :null => false end add_index :wiki_contents, :page_id, :name => :wiki_contents_page_id - + create_table :wiki_content_versions do |t| t.column :wiki_content_id, :integer, :null => false t.column :page_id, :integer, :null => false diff --git a/db/migrate/030_add_projects_feeds_permissions.rb b/db/migrate/030_add_projects_feeds_permissions.rb index e18c7345..79808041 100644 --- a/db/migrate/030_add_projects_feeds_permissions.rb +++ b/db/migrate/030_add_projects_feeds_permissions.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/db/migrate/031_add_repository_root_url.rb b/db/migrate/031_add_repository_root_url.rb index 641fa28d..85d8a5e8 100644 --- a/db/migrate/031_add_repository_root_url.rb +++ b/db/migrate/031_add_repository_root_url.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/db/migrate/032_create_time_entries.rb b/db/migrate/032_create_time_entries.rb index 1313c63b..cee090a8 100644 --- a/db/migrate/032_create_time_entries.rb +++ b/db/migrate/032_create_time_entries.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/db/migrate/033_add_timelog_permissions.rb b/db/migrate/033_add_timelog_permissions.rb index 680c3fb7..023ea13b 100644 --- a/db/migrate/033_add_timelog_permissions.rb +++ b/db/migrate/033_add_timelog_permissions.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/db/migrate/034_create_changesets.rb b/db/migrate/034_create_changesets.rb index 8b8e1d71..79cd3efa 100644 --- a/db/migrate/034_create_changesets.rb +++ b/db/migrate/034_create_changesets.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/db/migrate/035_create_changes.rb b/db/migrate/035_create_changes.rb index c4e655d5..7054e5dd 100644 --- a/db/migrate/035_create_changes.rb +++ b/db/migrate/035_create_changes.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/db/migrate/036_add_changeset_commit_date.rb b/db/migrate/036_add_changeset_commit_date.rb index c6e9745f..69c3d7c8 100644 --- a/db/migrate/036_add_changeset_commit_date.rb +++ b/db/migrate/036_add_changeset_commit_date.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/db/migrate/037_add_project_identifier.rb b/db/migrate/037_add_project_identifier.rb index 34b7f0cc..ef5bcdaf 100644 --- a/db/migrate/037_add_project_identifier.rb +++ b/db/migrate/037_add_project_identifier.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/db/migrate/038_add_custom_field_is_filter.rb b/db/migrate/038_add_custom_field_is_filter.rb index 36c423f0..28cfae74 100644 --- a/db/migrate/038_add_custom_field_is_filter.rb +++ b/db/migrate/038_add_custom_field_is_filter.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/db/migrate/039_create_watchers.rb b/db/migrate/039_create_watchers.rb index 96679afd..e0f80a54 100644 --- a/db/migrate/039_create_watchers.rb +++ b/db/migrate/039_create_watchers.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/db/migrate/040_create_changesets_issues.rb b/db/migrate/040_create_changesets_issues.rb index 7e10be14..125f3fca 100644 --- a/db/migrate/040_create_changesets_issues.rb +++ b/db/migrate/040_create_changesets_issues.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/db/migrate/041_rename_comment_to_comments.rb b/db/migrate/041_rename_comment_to_comments.rb index 8568daf2..d9e7f460 100644 --- a/db/migrate/041_rename_comment_to_comments.rb +++ b/db/migrate/041_rename_comment_to_comments.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/db/migrate/042_create_issue_relations.rb b/db/migrate/042_create_issue_relations.rb index 84e44280..8c3fd6de 100644 --- a/db/migrate/042_create_issue_relations.rb +++ b/db/migrate/042_create_issue_relations.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/db/migrate/043_add_relations_permissions.rb b/db/migrate/043_add_relations_permissions.rb index 3beb1ab6..a505b905 100644 --- a/db/migrate/043_add_relations_permissions.rb +++ b/db/migrate/043_add_relations_permissions.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/db/migrate/044_set_language_length_to_five.rb b/db/migrate/044_set_language_length_to_five.rb index c63829aa..9443f107 100644 --- a/db/migrate/044_set_language_length_to_five.rb +++ b/db/migrate/044_set_language_length_to_five.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/db/migrate/045_create_boards.rb b/db/migrate/045_create_boards.rb index a6b871e0..c998933a 100644 --- a/db/migrate/045_create_boards.rb +++ b/db/migrate/045_create_boards.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/db/migrate/046_create_messages.rb b/db/migrate/046_create_messages.rb index d82e5aa3..0c4eecf4 100644 --- a/db/migrate/046_create_messages.rb +++ b/db/migrate/046_create_messages.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/db/migrate/047_add_boards_permissions.rb b/db/migrate/047_add_boards_permissions.rb index d276a3ad..eae89db2 100644 --- a/db/migrate/047_add_boards_permissions.rb +++ b/db/migrate/047_add_boards_permissions.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/db/migrate/048_allow_null_version_effective_date.rb b/db/migrate/048_allow_null_version_effective_date.rb index 2cf5f017..6e762340 100644 --- a/db/migrate/048_allow_null_version_effective_date.rb +++ b/db/migrate/048_allow_null_version_effective_date.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/db/migrate/049_add_wiki_destroy_page_permission.rb b/db/migrate/049_add_wiki_destroy_page_permission.rb index 5b806cce..0fe37d64 100644 --- a/db/migrate/049_add_wiki_destroy_page_permission.rb +++ b/db/migrate/049_add_wiki_destroy_page_permission.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/db/migrate/050_add_wiki_attachments_permissions.rb b/db/migrate/050_add_wiki_attachments_permissions.rb index d215b70f..a365993f 100644 --- a/db/migrate/050_add_wiki_attachments_permissions.rb +++ b/db/migrate/050_add_wiki_attachments_permissions.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/db/migrate/051_add_project_status.rb b/db/migrate/051_add_project_status.rb index 5af94413..3ee33450 100644 --- a/db/migrate/051_add_project_status.rb +++ b/db/migrate/051_add_project_status.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/db/migrate/052_add_changes_revision.rb b/db/migrate/052_add_changes_revision.rb index cfeee798..ce3d8eda 100644 --- a/db/migrate/052_add_changes_revision.rb +++ b/db/migrate/052_add_changes_revision.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/db/migrate/053_add_changes_branch.rb b/db/migrate/053_add_changes_branch.rb index 4c559aa1..4a8bc5dd 100644 --- a/db/migrate/053_add_changes_branch.rb +++ b/db/migrate/053_add_changes_branch.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/db/migrate/054_add_changesets_scmid.rb b/db/migrate/054_add_changesets_scmid.rb index 634238b4..7de569bf 100644 --- a/db/migrate/054_add_changesets_scmid.rb +++ b/db/migrate/054_add_changesets_scmid.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/db/migrate/055_add_repositories_type.rb b/db/migrate/055_add_repositories_type.rb index 0a2bbf63..1fb4f9e5 100644 --- a/db/migrate/055_add_repositories_type.rb +++ b/db/migrate/055_add_repositories_type.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 AddRepositoriesType < ActiveRecord::Migration def self.up - add_column :repositories, :type, :string + add_column :repositories, :type, :string # Set class name for existing SVN repositories Repository.update_all "type = 'Subversion'" end diff --git a/db/migrate/056_add_repositories_changes_permission.rb b/db/migrate/056_add_repositories_changes_permission.rb index 99fa82ff..9275e820 100644 --- a/db/migrate/056_add_repositories_changes_permission.rb +++ b/db/migrate/056_add_repositories_changes_permission.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/db/migrate/057_add_versions_wiki_page_title.rb b/db/migrate/057_add_versions_wiki_page_title.rb index 6b48d736..6c7af230 100644 --- a/db/migrate/057_add_versions_wiki_page_title.rb +++ b/db/migrate/057_add_versions_wiki_page_title.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/db/migrate/058_add_issue_categories_assigned_to_id.rb b/db/migrate/058_add_issue_categories_assigned_to_id.rb index 58b34cc4..f0c533d4 100644 --- a/db/migrate/058_add_issue_categories_assigned_to_id.rb +++ b/db/migrate/058_add_issue_categories_assigned_to_id.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/db/migrate/059_add_roles_assignable.rb b/db/migrate/059_add_roles_assignable.rb index 10b82c3e..fe08e30c 100644 --- a/db/migrate/059_add_roles_assignable.rb +++ b/db/migrate/059_add_roles_assignable.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/db/migrate/060_change_changesets_committer_limit.rb b/db/migrate/060_change_changesets_committer_limit.rb index 0d2e86f4..07380fe0 100644 --- a/db/migrate/060_change_changesets_committer_limit.rb +++ b/db/migrate/060_change_changesets_committer_limit.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/db/migrate/061_add_roles_builtin.rb b/db/migrate/061_add_roles_builtin.rb index 7d4d1831..ffd9eb48 100644 --- a/db/migrate/061_add_roles_builtin.rb +++ b/db/migrate/061_add_roles_builtin.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/db/migrate/062_insert_builtin_roles.rb b/db/migrate/062_insert_builtin_roles.rb index ad7330ee..5e0ebfed 100644 --- a/db/migrate/062_insert_builtin_roles.rb +++ b/db/migrate/062_insert_builtin_roles.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. #++ @@ -16,10 +16,10 @@ class InsertBuiltinRoles < ActiveRecord::Migration nonmember = Role.new(:name => 'Non member', :position => 0) nonmember.builtin = Role::BUILTIN_NON_MEMBER nonmember.save - + anonymous = Role.new(:name => 'Anonymous', :position => 0) anonymous.builtin = Role::BUILTIN_ANONYMOUS - anonymous.save + anonymous.save end def self.down diff --git a/db/migrate/063_add_roles_permissions.rb b/db/migrate/063_add_roles_permissions.rb index 6b9bfcd2..f5f4d0c5 100644 --- a/db/migrate/063_add_roles_permissions.rb +++ b/db/migrate/063_add_roles_permissions.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/db/migrate/064_drop_permissions.rb b/db/migrate/064_drop_permissions.rb index 784889cf..92db77d1 100644 --- a/db/migrate/064_drop_permissions.rb +++ b/db/migrate/064_drop_permissions.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/db/migrate/065_add_settings_updated_on.rb b/db/migrate/065_add_settings_updated_on.rb index d47ef193..bcce8777 100644 --- a/db/migrate/065_add_settings_updated_on.rb +++ b/db/migrate/065_add_settings_updated_on.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/db/migrate/066_add_custom_value_customized_index.rb b/db/migrate/066_add_custom_value_customized_index.rb index 3802e719..4f312dc1 100644 --- a/db/migrate/066_add_custom_value_customized_index.rb +++ b/db/migrate/066_add_custom_value_customized_index.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/db/migrate/067_create_wiki_redirects.rb b/db/migrate/067_create_wiki_redirects.rb index f743e5c0..d771ae29 100644 --- a/db/migrate/067_create_wiki_redirects.rb +++ b/db/migrate/067_create_wiki_redirects.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/db/migrate/068_create_enabled_modules.rb b/db/migrate/068_create_enabled_modules.rb index dc6ceba7..88710ab7 100644 --- a/db/migrate/068_create_enabled_modules.rb +++ b/db/migrate/068_create_enabled_modules.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 CreateEnabledModules < ActiveRecord::Migration t.column :name, :string, :null => false end add_index :enabled_modules, [:project_id], :name => :enabled_modules_project_id - + # Enable all modules for existing projects Project.find(:all).each do |project| project.enabled_module_names = Redmine::AccessControl.available_project_modules diff --git a/db/migrate/069_add_issues_estimated_hours.rb b/db/migrate/069_add_issues_estimated_hours.rb index f72e8c97..ad0ba91a 100644 --- a/db/migrate/069_add_issues_estimated_hours.rb +++ b/db/migrate/069_add_issues_estimated_hours.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/db/migrate/070_change_attachments_content_type_limit.rb b/db/migrate/070_change_attachments_content_type_limit.rb index 7b409994..96f2e386 100644 --- a/db/migrate/070_change_attachments_content_type_limit.rb +++ b/db/migrate/070_change_attachments_content_type_limit.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/db/migrate/071_add_queries_column_names.rb b/db/migrate/071_add_queries_column_names.rb index 95cc3f32..d16f9d96 100644 --- a/db/migrate/071_add_queries_column_names.rb +++ b/db/migrate/071_add_queries_column_names.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/db/migrate/072_add_enumerations_position.rb b/db/migrate/072_add_enumerations_position.rb index 2a054e8e..15ca532e 100644 --- a/db/migrate/072_add_enumerations_position.rb +++ b/db/migrate/072_add_enumerations_position.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/db/migrate/073_add_enumerations_is_default.rb b/db/migrate/073_add_enumerations_is_default.rb index a11df89b..6a304f9d 100644 --- a/db/migrate/073_add_enumerations_is_default.rb +++ b/db/migrate/073_add_enumerations_is_default.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/db/migrate/074_add_auth_sources_tls.rb b/db/migrate/074_add_auth_sources_tls.rb index 8b229cfd..0c86fa41 100644 --- a/db/migrate/074_add_auth_sources_tls.rb +++ b/db/migrate/074_add_auth_sources_tls.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/db/migrate/075_add_members_mail_notification.rb b/db/migrate/075_add_members_mail_notification.rb index 24920fa6..d818f685 100644 --- a/db/migrate/075_add_members_mail_notification.rb +++ b/db/migrate/075_add_members_mail_notification.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/db/migrate/076_allow_null_position.rb b/db/migrate/076_allow_null_position.rb index d9e7bae1..78e43976 100644 --- a/db/migrate/076_allow_null_position.rb +++ b/db/migrate/076_allow_null_position.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/db/migrate/077_remove_issue_statuses_html_color.rb b/db/migrate/077_remove_issue_statuses_html_color.rb index 50b82bf8..3c68bd32 100644 --- a/db/migrate/077_remove_issue_statuses_html_color.rb +++ b/db/migrate/077_remove_issue_statuses_html_color.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/db/migrate/078_add_custom_fields_position.rb b/db/migrate/078_add_custom_fields_position.rb index 66ab3645..7d904c6e 100644 --- a/db/migrate/078_add_custom_fields_position.rb +++ b/db/migrate/078_add_custom_fields_position.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/db/migrate/079_add_user_preferences_time_zone.rb b/db/migrate/079_add_user_preferences_time_zone.rb index 8ed6f5b0..842d307c 100644 --- a/db/migrate/079_add_user_preferences_time_zone.rb +++ b/db/migrate/079_add_user_preferences_time_zone.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/db/migrate/080_add_users_type.rb b/db/migrate/080_add_users_type.rb index 664771b3..9e4ad2ac 100644 --- a/db/migrate/080_add_users_type.rb +++ b/db/migrate/080_add_users_type.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/db/migrate/081_create_projects_trackers.rb b/db/migrate/081_create_projects_trackers.rb index 0aa6626c..645ac63a 100644 --- a/db/migrate/081_create_projects_trackers.rb +++ b/db/migrate/081_create_projects_trackers.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 CreateProjectsTrackers < ActiveRecord::Migration t.column :tracker_id, :integer, :default => 0, :null => false end add_index :projects_trackers, :project_id, :name => :projects_trackers_project_id - + # Associates all trackers to all projects (as it was before) tracker_ids = Tracker.find(:all).collect(&:id) Project.find(:all).each do |project| diff --git a/db/migrate/082_add_messages_locked.rb b/db/migrate/082_add_messages_locked.rb index 2e52a28e..44ba4bc2 100644 --- a/db/migrate/082_add_messages_locked.rb +++ b/db/migrate/082_add_messages_locked.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/db/migrate/083_add_messages_sticky.rb b/db/migrate/083_add_messages_sticky.rb index 9b5512aa..d6e3ff27 100644 --- a/db/migrate/083_add_messages_sticky.rb +++ b/db/migrate/083_add_messages_sticky.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/db/migrate/084_change_auth_sources_account_limit.rb b/db/migrate/084_change_auth_sources_account_limit.rb index 607d74d9..e7e58781 100644 --- a/db/migrate/084_change_auth_sources_account_limit.rb +++ b/db/migrate/084_change_auth_sources_account_limit.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/db/migrate/085_add_role_tracker_old_status_index_to_workflows.rb b/db/migrate/085_add_role_tracker_old_status_index_to_workflows.rb index b95f97a7..fc5a7952 100644 --- a/db/migrate/085_add_role_tracker_old_status_index_to_workflows.rb +++ b/db/migrate/085_add_role_tracker_old_status_index_to_workflows.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/db/migrate/086_add_custom_fields_searchable.rb b/db/migrate/086_add_custom_fields_searchable.rb index bd8f8be7..0e311f6c 100644 --- a/db/migrate/086_add_custom_fields_searchable.rb +++ b/db/migrate/086_add_custom_fields_searchable.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/db/migrate/087_change_projects_description_to_text.rb b/db/migrate/087_change_projects_description_to_text.rb index 12fbb222..a167d87d 100644 --- a/db/migrate/087_change_projects_description_to_text.rb +++ b/db/migrate/087_change_projects_description_to_text.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/db/migrate/088_add_custom_fields_default_value.rb b/db/migrate/088_add_custom_fields_default_value.rb index 0f186148..b9c14dde 100644 --- a/db/migrate/088_add_custom_fields_default_value.rb +++ b/db/migrate/088_add_custom_fields_default_value.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/db/migrate/089_add_attachments_description.rb b/db/migrate/089_add_attachments_description.rb index fd66c1e4..b11c96cc 100644 --- a/db/migrate/089_add_attachments_description.rb +++ b/db/migrate/089_add_attachments_description.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/db/migrate/090_change_versions_name_limit.rb b/db/migrate/090_change_versions_name_limit.rb index ca4ab56c..90a608e7 100644 --- a/db/migrate/090_change_versions_name_limit.rb +++ b/db/migrate/090_change_versions_name_limit.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/db/migrate/091_change_changesets_revision_to_string.rb b/db/migrate/091_change_changesets_revision_to_string.rb index 376a15f6..126f3a15 100644 --- a/db/migrate/091_change_changesets_revision_to_string.rb +++ b/db/migrate/091_change_changesets_revision_to_string.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/db/migrate/092_change_changes_from_revision_to_string.rb b/db/migrate/092_change_changes_from_revision_to_string.rb index bc2ea737..5793631a 100644 --- a/db/migrate/092_change_changes_from_revision_to_string.rb +++ b/db/migrate/092_change_changes_from_revision_to_string.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/db/migrate/093_add_wiki_pages_protected.rb b/db/migrate/093_add_wiki_pages_protected.rb index 76007068..c28bd4d9 100644 --- a/db/migrate/093_add_wiki_pages_protected.rb +++ b/db/migrate/093_add_wiki_pages_protected.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/db/migrate/094_change_projects_homepage_limit.rb b/db/migrate/094_change_projects_homepage_limit.rb index df233f1a..e403c2b7 100644 --- a/db/migrate/094_change_projects_homepage_limit.rb +++ b/db/migrate/094_change_projects_homepage_limit.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/db/migrate/095_add_wiki_pages_parent_id.rb b/db/migrate/095_add_wiki_pages_parent_id.rb index 258d57a2..73e67b03 100644 --- a/db/migrate/095_add_wiki_pages_parent_id.rb +++ b/db/migrate/095_add_wiki_pages_parent_id.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/db/migrate/096_add_commit_access_permission.rb b/db/migrate/096_add_commit_access_permission.rb index f724899b..8482053e 100644 --- a/db/migrate/096_add_commit_access_permission.rb +++ b/db/migrate/096_add_commit_access_permission.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/db/migrate/097_add_view_wiki_edits_permission.rb b/db/migrate/097_add_view_wiki_edits_permission.rb index 1cd47452..c5e37155 100644 --- a/db/migrate/097_add_view_wiki_edits_permission.rb +++ b/db/migrate/097_add_view_wiki_edits_permission.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/db/migrate/098_set_topic_authors_as_watchers.rb b/db/migrate/098_set_topic_authors_as_watchers.rb index f26a9744..e79ac1d5 100644 --- a/db/migrate/098_set_topic_authors_as_watchers.rb +++ b/db/migrate/098_set_topic_authors_as_watchers.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/db/migrate/099_add_delete_wiki_pages_attachments_permission.rb b/db/migrate/099_add_delete_wiki_pages_attachments_permission.rb index f18fd8e7..0e73fead 100644 --- a/db/migrate/099_add_delete_wiki_pages_attachments_permission.rb +++ b/db/migrate/099_add_delete_wiki_pages_attachments_permission.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/db/migrate/100_add_changesets_user_id.rb b/db/migrate/100_add_changesets_user_id.rb index 5c1ad593..16ce342f 100644 --- a/db/migrate/100_add_changesets_user_id.rb +++ b/db/migrate/100_add_changesets_user_id.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/db/migrate/101_populate_changesets_user_id.rb b/db/migrate/101_populate_changesets_user_id.rb index f2e9638a..a3576eed 100644 --- a/db/migrate/101_populate_changesets_user_id.rb +++ b/db/migrate/101_populate_changesets_user_id.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/db/migrate/102_add_custom_fields_editable.rb b/db/migrate/102_add_custom_fields_editable.rb index 691a32cc..fdc2ad19 100644 --- a/db/migrate/102_add_custom_fields_editable.rb +++ b/db/migrate/102_add_custom_fields_editable.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/db/migrate/103_set_custom_fields_editable.rb b/db/migrate/103_set_custom_fields_editable.rb index 8ec0c1be..a662cb11 100644 --- a/db/migrate/103_set_custom_fields_editable.rb +++ b/db/migrate/103_set_custom_fields_editable.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/db/migrate/104_add_projects_lft_and_rgt.rb b/db/migrate/104_add_projects_lft_and_rgt.rb index 4d9de933..8d8eed87 100644 --- a/db/migrate/104_add_projects_lft_and_rgt.rb +++ b/db/migrate/104_add_projects_lft_and_rgt.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/db/migrate/105_build_projects_tree.rb b/db/migrate/105_build_projects_tree.rb index f2f5f157..8e819869 100644 --- a/db/migrate/105_build_projects_tree.rb +++ b/db/migrate/105_build_projects_tree.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/db/migrate/106_remove_projects_projects_count.rb b/db/migrate/106_remove_projects_projects_count.rb index 7bff6cb0..2f4b1ea8 100644 --- a/db/migrate/106_remove_projects_projects_count.rb +++ b/db/migrate/106_remove_projects_projects_count.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/db/migrate/107_add_open_id_authentication_tables.rb b/db/migrate/107_add_open_id_authentication_tables.rb index 94dc876e..7f102d3e 100644 --- a/db/migrate/107_add_open_id_authentication_tables.rb +++ b/db/migrate/107_add_open_id_authentication_tables.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/db/migrate/108_add_identity_url_to_users.rb b/db/migrate/108_add_identity_url_to_users.rb index 9bfeba74..ab73c15a 100644 --- a/db/migrate/108_add_identity_url_to_users.rb +++ b/db/migrate/108_add_identity_url_to_users.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/db/migrate/20090214190337_add_watchers_user_id_type_index.rb b/db/migrate/20090214190337_add_watchers_user_id_type_index.rb index 833f69f4..bf3210d8 100644 --- a/db/migrate/20090214190337_add_watchers_user_id_type_index.rb +++ b/db/migrate/20090214190337_add_watchers_user_id_type_index.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/db/migrate/20090312172426_add_queries_sort_criteria.rb b/db/migrate/20090312172426_add_queries_sort_criteria.rb index 1358780d..0e7605c8 100644 --- a/db/migrate/20090312172426_add_queries_sort_criteria.rb +++ b/db/migrate/20090312172426_add_queries_sort_criteria.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/db/migrate/20090312194159_add_projects_trackers_unique_index.rb b/db/migrate/20090312194159_add_projects_trackers_unique_index.rb index f6510ea7..034f68d1 100644 --- a/db/migrate/20090312194159_add_projects_trackers_unique_index.rb +++ b/db/migrate/20090312194159_add_projects_trackers_unique_index.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/db/migrate/20090318181151_extend_settings_name.rb b/db/migrate/20090318181151_extend_settings_name.rb index 151fb08e..769da1a9 100644 --- a/db/migrate/20090318181151_extend_settings_name.rb +++ b/db/migrate/20090318181151_extend_settings_name.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/db/migrate/20090323224724_add_type_to_enumerations.rb b/db/migrate/20090323224724_add_type_to_enumerations.rb index 2839b180..2f8f27e8 100644 --- a/db/migrate/20090323224724_add_type_to_enumerations.rb +++ b/db/migrate/20090323224724_add_type_to_enumerations.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/db/migrate/20090401221305_update_enumerations_to_sti.rb b/db/migrate/20090401221305_update_enumerations_to_sti.rb index 3c6c8bb5..c2b36d83 100644 --- a/db/migrate/20090401221305_update_enumerations_to_sti.rb +++ b/db/migrate/20090401221305_update_enumerations_to_sti.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/db/migrate/20090401231134_add_active_field_to_enumerations.rb b/db/migrate/20090401231134_add_active_field_to_enumerations.rb index a0b4efc1..6917adab 100644 --- a/db/migrate/20090401231134_add_active_field_to_enumerations.rb +++ b/db/migrate/20090401231134_add_active_field_to_enumerations.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/db/migrate/20090403001910_add_project_to_enumerations.rb b/db/migrate/20090403001910_add_project_to_enumerations.rb index e0f37195..88e023ec 100644 --- a/db/migrate/20090403001910_add_project_to_enumerations.rb +++ b/db/migrate/20090403001910_add_project_to_enumerations.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/db/migrate/20090406161854_add_parent_id_to_enumerations.rb b/db/migrate/20090406161854_add_parent_id_to_enumerations.rb index 566c5756..31840f73 100644 --- a/db/migrate/20090406161854_add_parent_id_to_enumerations.rb +++ b/db/migrate/20090406161854_add_parent_id_to_enumerations.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/db/migrate/20090425161243_add_queries_group_by.rb b/db/migrate/20090425161243_add_queries_group_by.rb index f01ac3fa..55683da2 100644 --- a/db/migrate/20090425161243_add_queries_group_by.rb +++ b/db/migrate/20090425161243_add_queries_group_by.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/db/migrate/20090503121501_create_member_roles.rb b/db/migrate/20090503121501_create_member_roles.rb index e12b5222..cea37740 100644 --- a/db/migrate/20090503121501_create_member_roles.rb +++ b/db/migrate/20090503121501_create_member_roles.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/db/migrate/20090503121505_populate_member_roles.rb b/db/migrate/20090503121505_populate_member_roles.rb index 04f9844f..c986b22e 100644 --- a/db/migrate/20090503121505_populate_member_roles.rb +++ b/db/migrate/20090503121505_populate_member_roles.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/db/migrate/20090503121510_drop_members_role_id.rb b/db/migrate/20090503121510_drop_members_role_id.rb index 4f643b93..b0d10c1c 100644 --- a/db/migrate/20090503121510_drop_members_role_id.rb +++ b/db/migrate/20090503121510_drop_members_role_id.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/db/migrate/20090614091200_fix_messages_sticky_null.rb b/db/migrate/20090614091200_fix_messages_sticky_null.rb index 92106ed9..c094195a 100644 --- a/db/migrate/20090614091200_fix_messages_sticky_null.rb +++ b/db/migrate/20090614091200_fix_messages_sticky_null.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/db/migrate/20090704172350_populate_users_type.rb b/db/migrate/20090704172350_populate_users_type.rb index 30348e86..02bd40ef 100644 --- a/db/migrate/20090704172350_populate_users_type.rb +++ b/db/migrate/20090704172350_populate_users_type.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/db/migrate/20090704172355_create_groups_users.rb b/db/migrate/20090704172355_create_groups_users.rb index d3701edf..6ba77ba2 100644 --- a/db/migrate/20090704172355_create_groups_users.rb +++ b/db/migrate/20090704172355_create_groups_users.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/db/migrate/20090704172358_add_member_roles_inherited_from.rb b/db/migrate/20090704172358_add_member_roles_inherited_from.rb index 7445b448..57f3ef08 100644 --- a/db/migrate/20090704172358_add_member_roles_inherited_from.rb +++ b/db/migrate/20090704172358_add_member_roles_inherited_from.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/db/migrate/20091010093521_fix_users_custom_values.rb b/db/migrate/20091010093521_fix_users_custom_values.rb index 88cd149b..031a8594 100644 --- a/db/migrate/20091010093521_fix_users_custom_values.rb +++ b/db/migrate/20091010093521_fix_users_custom_values.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/db/migrate/20091017212227_add_missing_indexes_to_workflows.rb b/db/migrate/20091017212227_add_missing_indexes_to_workflows.rb index a2d32313..b4e75c9a 100644 --- a/db/migrate/20091017212227_add_missing_indexes_to_workflows.rb +++ b/db/migrate/20091017212227_add_missing_indexes_to_workflows.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/db/migrate/20091017212457_add_missing_indexes_to_custom_fields_projects.rb b/db/migrate/20091017212457_add_missing_indexes_to_custom_fields_projects.rb index cd9f6d04..cd9fae6d 100644 --- a/db/migrate/20091017212457_add_missing_indexes_to_custom_fields_projects.rb +++ b/db/migrate/20091017212457_add_missing_indexes_to_custom_fields_projects.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/db/migrate/20091017212644_add_missing_indexes_to_messages.rb b/db/migrate/20091017212644_add_missing_indexes_to_messages.rb index b8a94ae7..ce88cda2 100644 --- a/db/migrate/20091017212644_add_missing_indexes_to_messages.rb +++ b/db/migrate/20091017212644_add_missing_indexes_to_messages.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/db/migrate/20091017212938_add_missing_indexes_to_repositories.rb b/db/migrate/20091017212938_add_missing_indexes_to_repositories.rb index ff8994eb..962d7c60 100644 --- a/db/migrate/20091017212938_add_missing_indexes_to_repositories.rb +++ b/db/migrate/20091017212938_add_missing_indexes_to_repositories.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/db/migrate/20091017213027_add_missing_indexes_to_comments.rb b/db/migrate/20091017213027_add_missing_indexes_to_comments.rb index a689b74f..9dd1e1c5 100644 --- a/db/migrate/20091017213027_add_missing_indexes_to_comments.rb +++ b/db/migrate/20091017213027_add_missing_indexes_to_comments.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/db/migrate/20091017213113_add_missing_indexes_to_enumerations.rb b/db/migrate/20091017213113_add_missing_indexes_to_enumerations.rb index 05865510..04cc792a 100644 --- a/db/migrate/20091017213113_add_missing_indexes_to_enumerations.rb +++ b/db/migrate/20091017213113_add_missing_indexes_to_enumerations.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/db/migrate/20091017213151_add_missing_indexes_to_wiki_pages.rb b/db/migrate/20091017213151_add_missing_indexes_to_wiki_pages.rb index a58abc44..7c949acb 100644 --- a/db/migrate/20091017213151_add_missing_indexes_to_wiki_pages.rb +++ b/db/migrate/20091017213151_add_missing_indexes_to_wiki_pages.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/db/migrate/20091017213228_add_missing_indexes_to_watchers.rb b/db/migrate/20091017213228_add_missing_indexes_to_watchers.rb index f596c652..fb398e57 100644 --- a/db/migrate/20091017213228_add_missing_indexes_to_watchers.rb +++ b/db/migrate/20091017213228_add_missing_indexes_to_watchers.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/db/migrate/20091017213257_add_missing_indexes_to_auth_sources.rb b/db/migrate/20091017213257_add_missing_indexes_to_auth_sources.rb index 06f94ebe..c2861d97 100644 --- a/db/migrate/20091017213257_add_missing_indexes_to_auth_sources.rb +++ b/db/migrate/20091017213257_add_missing_indexes_to_auth_sources.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/db/migrate/20091017213332_add_missing_indexes_to_documents.rb b/db/migrate/20091017213332_add_missing_indexes_to_documents.rb index 97d9f090..99b57071 100644 --- a/db/migrate/20091017213332_add_missing_indexes_to_documents.rb +++ b/db/migrate/20091017213332_add_missing_indexes_to_documents.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/db/migrate/20091017213444_add_missing_indexes_to_tokens.rb b/db/migrate/20091017213444_add_missing_indexes_to_tokens.rb index 3f9a607e..bea4f061 100644 --- a/db/migrate/20091017213444_add_missing_indexes_to_tokens.rb +++ b/db/migrate/20091017213444_add_missing_indexes_to_tokens.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/db/migrate/20091017213536_add_missing_indexes_to_changesets.rb b/db/migrate/20091017213536_add_missing_indexes_to_changesets.rb index 74852c0d..1c2f1f23 100644 --- a/db/migrate/20091017213536_add_missing_indexes_to_changesets.rb +++ b/db/migrate/20091017213536_add_missing_indexes_to_changesets.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/db/migrate/20091017213642_add_missing_indexes_to_issue_categories.rb b/db/migrate/20091017213642_add_missing_indexes_to_issue_categories.rb index 8773fb2b..9dae5a05 100644 --- a/db/migrate/20091017213642_add_missing_indexes_to_issue_categories.rb +++ b/db/migrate/20091017213642_add_missing_indexes_to_issue_categories.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/db/migrate/20091017213716_add_missing_indexes_to_member_roles.rb b/db/migrate/20091017213716_add_missing_indexes_to_member_roles.rb index e8f68f69..e4e531c4 100644 --- a/db/migrate/20091017213716_add_missing_indexes_to_member_roles.rb +++ b/db/migrate/20091017213716_add_missing_indexes_to_member_roles.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/db/migrate/20091017213757_add_missing_indexes_to_boards.rb b/db/migrate/20091017213757_add_missing_indexes_to_boards.rb index 6b606482..13f3c6b7 100644 --- a/db/migrate/20091017213757_add_missing_indexes_to_boards.rb +++ b/db/migrate/20091017213757_add_missing_indexes_to_boards.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/db/migrate/20091017213835_add_missing_indexes_to_user_preferences.rb b/db/migrate/20091017213835_add_missing_indexes_to_user_preferences.rb index ffe682a1..33881775 100644 --- a/db/migrate/20091017213835_add_missing_indexes_to_user_preferences.rb +++ b/db/migrate/20091017213835_add_missing_indexes_to_user_preferences.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/db/migrate/20091017213910_add_missing_indexes_to_issues.rb b/db/migrate/20091017213910_add_missing_indexes_to_issues.rb index 665b6a50..a5eec39a 100644 --- a/db/migrate/20091017213910_add_missing_indexes_to_issues.rb +++ b/db/migrate/20091017213910_add_missing_indexes_to_issues.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/db/migrate/20091017214015_add_missing_indexes_to_members.rb b/db/migrate/20091017214015_add_missing_indexes_to_members.rb index 4a631ad8..08d7aa71 100644 --- a/db/migrate/20091017214015_add_missing_indexes_to_members.rb +++ b/db/migrate/20091017214015_add_missing_indexes_to_members.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/db/migrate/20091017214107_add_missing_indexes_to_custom_fields.rb b/db/migrate/20091017214107_add_missing_indexes_to_custom_fields.rb index 9b520ee2..f7589259 100644 --- a/db/migrate/20091017214107_add_missing_indexes_to_custom_fields.rb +++ b/db/migrate/20091017214107_add_missing_indexes_to_custom_fields.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/db/migrate/20091017214136_add_missing_indexes_to_queries.rb b/db/migrate/20091017214136_add_missing_indexes_to_queries.rb index b5813b37..d237ff51 100644 --- a/db/migrate/20091017214136_add_missing_indexes_to_queries.rb +++ b/db/migrate/20091017214136_add_missing_indexes_to_queries.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/db/migrate/20091017214236_add_missing_indexes_to_time_entries.rb b/db/migrate/20091017214236_add_missing_indexes_to_time_entries.rb index e6a1f864..124f4ec2 100644 --- a/db/migrate/20091017214236_add_missing_indexes_to_time_entries.rb +++ b/db/migrate/20091017214236_add_missing_indexes_to_time_entries.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/db/migrate/20091017214308_add_missing_indexes_to_news.rb b/db/migrate/20091017214308_add_missing_indexes_to_news.rb index ba2fb304..59527b14 100644 --- a/db/migrate/20091017214308_add_missing_indexes_to_news.rb +++ b/db/migrate/20091017214308_add_missing_indexes_to_news.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/db/migrate/20091017214336_add_missing_indexes_to_users.rb b/db/migrate/20091017214336_add_missing_indexes_to_users.rb index c38bf151..6ea4e199 100644 --- a/db/migrate/20091017214336_add_missing_indexes_to_users.rb +++ b/db/migrate/20091017214336_add_missing_indexes_to_users.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/db/migrate/20091017214406_add_missing_indexes_to_attachments.rb b/db/migrate/20091017214406_add_missing_indexes_to_attachments.rb index d1c80dbe..29aa7771 100644 --- a/db/migrate/20091017214406_add_missing_indexes_to_attachments.rb +++ b/db/migrate/20091017214406_add_missing_indexes_to_attachments.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/db/migrate/20091017214440_add_missing_indexes_to_wiki_contents.rb b/db/migrate/20091017214440_add_missing_indexes_to_wiki_contents.rb index bc6c4ddf..aa1574a7 100644 --- a/db/migrate/20091017214440_add_missing_indexes_to_wiki_contents.rb +++ b/db/migrate/20091017214440_add_missing_indexes_to_wiki_contents.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/db/migrate/20091017214519_add_missing_indexes_to_custom_values.rb b/db/migrate/20091017214519_add_missing_indexes_to_custom_values.rb index 6427d071..d68553ef 100644 --- a/db/migrate/20091017214519_add_missing_indexes_to_custom_values.rb +++ b/db/migrate/20091017214519_add_missing_indexes_to_custom_values.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/db/migrate/20091017214611_add_missing_indexes_to_journals.rb b/db/migrate/20091017214611_add_missing_indexes_to_journals.rb index 3d6f2d6c..cce7be58 100644 --- a/db/migrate/20091017214611_add_missing_indexes_to_journals.rb +++ b/db/migrate/20091017214611_add_missing_indexes_to_journals.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/db/migrate/20091017214644_add_missing_indexes_to_issue_relations.rb b/db/migrate/20091017214644_add_missing_indexes_to_issue_relations.rb index e0c57684..57204150 100644 --- a/db/migrate/20091017214644_add_missing_indexes_to_issue_relations.rb +++ b/db/migrate/20091017214644_add_missing_indexes_to_issue_relations.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/db/migrate/20091017214720_add_missing_indexes_to_wiki_redirects.rb b/db/migrate/20091017214720_add_missing_indexes_to_wiki_redirects.rb index 0037b4d1..f5a38e43 100644 --- a/db/migrate/20091017214720_add_missing_indexes_to_wiki_redirects.rb +++ b/db/migrate/20091017214720_add_missing_indexes_to_wiki_redirects.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/db/migrate/20091017214750_add_missing_indexes_to_custom_fields_trackers.rb b/db/migrate/20091017214750_add_missing_indexes_to_custom_fields_trackers.rb index 5d8d1894..f40e50d9 100644 --- a/db/migrate/20091017214750_add_missing_indexes_to_custom_fields_trackers.rb +++ b/db/migrate/20091017214750_add_missing_indexes_to_custom_fields_trackers.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/db/migrate/20091025163651_add_activity_indexes.rb b/db/migrate/20091025163651_add_activity_indexes.rb index becc1c1f..87933314 100644 --- a/db/migrate/20091025163651_add_activity_indexes.rb +++ b/db/migrate/20091025163651_add_activity_indexes.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/db/migrate/20091108092559_add_versions_status.rb b/db/migrate/20091108092559_add_versions_status.rb index 6a60183f..e310c3c6 100644 --- a/db/migrate/20091108092559_add_versions_status.rb +++ b/db/migrate/20091108092559_add_versions_status.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/db/migrate/20091114105931_add_view_issues_permission.rb b/db/migrate/20091114105931_add_view_issues_permission.rb index 1f0b11d2..a4db24b5 100644 --- a/db/migrate/20091114105931_add_view_issues_permission.rb +++ b/db/migrate/20091114105931_add_view_issues_permission.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/db/migrate/20091123212029_add_default_done_ratio_to_issue_status.rb b/db/migrate/20091123212029_add_default_done_ratio_to_issue_status.rb index 1dbebd08..c05adc96 100644 --- a/db/migrate/20091123212029_add_default_done_ratio_to_issue_status.rb +++ b/db/migrate/20091123212029_add_default_done_ratio_to_issue_status.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/db/migrate/20091205124427_add_versions_sharing.rb b/db/migrate/20091205124427_add_versions_sharing.rb index 1f5bdd0f..918a71d5 100644 --- a/db/migrate/20091205124427_add_versions_sharing.rb +++ b/db/migrate/20091205124427_add_versions_sharing.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/db/migrate/20091220183509_add_lft_and_rgt_indexes_to_projects.rb b/db/migrate/20091220183509_add_lft_and_rgt_indexes_to_projects.rb index 39e80e21..cbcbf6b7 100644 --- a/db/migrate/20091220183509_add_lft_and_rgt_indexes_to_projects.rb +++ b/db/migrate/20091220183509_add_lft_and_rgt_indexes_to_projects.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/db/migrate/20091220183727_add_index_to_settings_name.rb b/db/migrate/20091220183727_add_index_to_settings_name.rb index 47c0f0f2..628f0d5f 100644 --- a/db/migrate/20091220183727_add_index_to_settings_name.rb +++ b/db/migrate/20091220183727_add_index_to_settings_name.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/db/migrate/20091220184736_add_indexes_to_issue_status.rb b/db/migrate/20091220184736_add_indexes_to_issue_status.rb index 5603d654..8879e3d9 100644 --- a/db/migrate/20091220184736_add_indexes_to_issue_status.rb +++ b/db/migrate/20091220184736_add_indexes_to_issue_status.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/db/migrate/20091225164732_remove_enumerations_opt.rb b/db/migrate/20091225164732_remove_enumerations_opt.rb index abd310c2..089a095d 100644 --- a/db/migrate/20091225164732_remove_enumerations_opt.rb +++ b/db/migrate/20091225164732_remove_enumerations_opt.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/db/migrate/20091227112908_change_wiki_contents_text_limit.rb b/db/migrate/20091227112908_change_wiki_contents_text_limit.rb index 408a98c3..bbb4a8f9 100644 --- a/db/migrate/20091227112908_change_wiki_contents_text_limit.rb +++ b/db/migrate/20091227112908_change_wiki_contents_text_limit.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/db/migrate/20100129193402_change_users_mail_notification_to_string.rb b/db/migrate/20100129193402_change_users_mail_notification_to_string.rb index 930c8a47..ddc68418 100644 --- a/db/migrate/20100129193402_change_users_mail_notification_to_string.rb +++ b/db/migrate/20100129193402_change_users_mail_notification_to_string.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/db/migrate/20100129193813_update_mail_notification_values.rb b/db/migrate/20100129193813_update_mail_notification_values.rb index a2d2d90f..96535f11 100644 --- a/db/migrate/20100129193813_update_mail_notification_values.rb +++ b/db/migrate/20100129193813_update_mail_notification_values.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/db/migrate/20100221100219_add_index_on_changesets_scmid.rb b/db/migrate/20100221100219_add_index_on_changesets_scmid.rb index 392afe8a..11303fd9 100644 --- a/db/migrate/20100221100219_add_index_on_changesets_scmid.rb +++ b/db/migrate/20100221100219_add_index_on_changesets_scmid.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/db/migrate/20100313132032_add_issues_nested_sets_columns.rb b/db/migrate/20100313132032_add_issues_nested_sets_columns.rb index 55362618..f1eb1377 100644 --- a/db/migrate/20100313132032_add_issues_nested_sets_columns.rb +++ b/db/migrate/20100313132032_add_issues_nested_sets_columns.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,7 +17,7 @@ class AddIssuesNestedSetsColumns < ActiveRecord::Migration add_column :issues, :root_id, :integer, :default => nil add_column :issues, :lft, :integer, :default => nil add_column :issues, :rgt, :integer, :default => nil - + Issue.update_all("parent_id = NULL, root_id = id, lft = 1, rgt = 2") end diff --git a/db/migrate/20100313171051_add_index_on_issues_nested_set.rb b/db/migrate/20100313171051_add_index_on_issues_nested_set.rb index 0929fa2d..76884ad7 100644 --- a/db/migrate/20100313171051_add_index_on_issues_nested_set.rb +++ b/db/migrate/20100313171051_add_index_on_issues_nested_set.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/db/migrate/20100705164950_change_changes_path_length_limit.rb b/db/migrate/20100705164950_change_changes_path_length_limit.rb index fad4de7a..9a302702 100644 --- a/db/migrate/20100705164950_change_changes_path_length_limit.rb +++ b/db/migrate/20100705164950_change_changes_path_length_limit.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. #++ @@ -16,7 +16,7 @@ class ChangeChangesPathLengthLimit < ActiveRecord::Migration # these are two steps to please MySQL 5 on Win32 change_column :changes, :path, :text, :default => nil, :null => true change_column :changes, :path, :text, :null => false - + change_column :changes, :from_path, :text end diff --git a/db/migrate/20100714111651_generalize_journals.rb b/db/migrate/20100714111651_generalize_journals.rb index 3eff0ecb..b0ecfcf6 100644 --- a/db/migrate/20100714111651_generalize_journals.rb +++ b/db/migrate/20100714111651_generalize_journals.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/db/migrate/20100804112053_merge_wiki_versions_with_journals.rb b/db/migrate/20100804112053_merge_wiki_versions_with_journals.rb index a5c16608..8d13d13e 100644 --- a/db/migrate/20100804112053_merge_wiki_versions_with_journals.rb +++ b/db/migrate/20100804112053_merge_wiki_versions_with_journals.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/db/migrate/20100819172912_enable_calendar_and_gantt_modules_where_appropriate.rb b/db/migrate/20100819172912_enable_calendar_and_gantt_modules_where_appropriate.rb index d47776fc..cf00f20c 100644 --- a/db/migrate/20100819172912_enable_calendar_and_gantt_modules_where_appropriate.rb +++ b/db/migrate/20100819172912_enable_calendar_and_gantt_modules_where_appropriate.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/db/migrate/20101104182107_add_unique_index_on_members.rb b/db/migrate/20101104182107_add_unique_index_on_members.rb index d9b047d1..8b8899df 100644 --- a/db/migrate/20101104182107_add_unique_index_on_members.rb +++ b/db/migrate/20101104182107_add_unique_index_on_members.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,7 +24,7 @@ class AddUniqueIndexOnMembers < ActiveRecord::Migration " WHERE m.id > (SELECT min(m1.id) FROM #{Member.table_name} m1 WHERE m1.user_id = m.user_id AND m1.project_id = m.project_id)").each do |i| Member.delete_all(["id = ?", i]) end - + # Then add a unique index add_index :members, [:user_id, :project_id], :unique => true end diff --git a/db/migrate/20101107130441_add_custom_fields_visible.rb b/db/migrate/20101107130441_add_custom_fields_visible.rb index 30bc647b..be554fb3 100644 --- a/db/migrate/20101107130441_add_custom_fields_visible.rb +++ b/db/migrate/20101107130441_add_custom_fields_visible.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/db/migrate/20101114115114_change_projects_name_limit.rb b/db/migrate/20101114115114_change_projects_name_limit.rb index 126d8818..9821c6fc 100644 --- a/db/migrate/20101114115114_change_projects_name_limit.rb +++ b/db/migrate/20101114115114_change_projects_name_limit.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/db/migrate/20101114115359_change_projects_identifier_limit.rb b/db/migrate/20101114115359_change_projects_identifier_limit.rb index d72be54b..56d8b696 100644 --- a/db/migrate/20101114115359_change_projects_identifier_limit.rb +++ b/db/migrate/20101114115359_change_projects_identifier_limit.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/db/migrate/20110220160626_add_workflows_assignee_and_author.rb b/db/migrate/20110220160626_add_workflows_assignee_and_author.rb index 1585eb64..5b21ac2d 100644 --- a/db/migrate/20110220160626_add_workflows_assignee_and_author.rb +++ b/db/migrate/20110220160626_add_workflows_assignee_and_author.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/db/migrate/20110223180944_add_users_salt.rb b/db/migrate/20110223180944_add_users_salt.rb index 7e31332c..5d52fcb7 100644 --- a/db/migrate/20110223180944_add_users_salt.rb +++ b/db/migrate/20110223180944_add_users_salt.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/db/migrate/20110223180953_salt_user_passwords.rb b/db/migrate/20110223180953_salt_user_passwords.rb index 4bd232d4..19293bb0 100644 --- a/db/migrate/20110223180953_salt_user_passwords.rb +++ b/db/migrate/20110223180953_salt_user_passwords.rb @@ -1,18 +1,18 @@ #-- 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 SaltUserPasswords < ActiveRecord::Migration - + def self.up say_with_time "Salting user passwords, this may take some time..." do User.salt_unsalted_passwords! diff --git a/db/migrate/20110224000000_add_repositories_path_encoding.rb b/db/migrate/20110224000000_add_repositories_path_encoding.rb index 95df6e5c..db50890b 100644 --- a/db/migrate/20110224000000_add_repositories_path_encoding.rb +++ b/db/migrate/20110224000000_add_repositories_path_encoding.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/db/migrate/20110226120112_change_repositories_password_limit.rb b/db/migrate/20110226120112_change_repositories_password_limit.rb index 44a5cc69..f6b70e0d 100644 --- a/db/migrate/20110226120112_change_repositories_password_limit.rb +++ b/db/migrate/20110226120112_change_repositories_password_limit.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/db/migrate/20110226120132_change_auth_sources_account_password_limit.rb b/db/migrate/20110226120132_change_auth_sources_account_password_limit.rb index 8ab41db0..af43c6e7 100644 --- a/db/migrate/20110226120132_change_auth_sources_account_password_limit.rb +++ b/db/migrate/20110226120132_change_auth_sources_account_password_limit.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/db/migrate/20110227125750_change_journal_details_values_to_text.rb b/db/migrate/20110227125750_change_journal_details_values_to_text.rb index 578e181b..50b0253a 100644 --- a/db/migrate/20110227125750_change_journal_details_values_to_text.rb +++ b/db/migrate/20110227125750_change_journal_details_values_to_text.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/db/migrate/20110228000000_add_repositories_log_encoding.rb b/db/migrate/20110228000000_add_repositories_log_encoding.rb index 07af360a..df4632c1 100644 --- a/db/migrate/20110228000000_add_repositories_log_encoding.rb +++ b/db/migrate/20110228000000_add_repositories_log_encoding.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/db/migrate/20110228000100_copy_repositories_log_encoding.rb b/db/migrate/20110228000100_copy_repositories_log_encoding.rb index 6400fc6d..aecbcc39 100644 --- a/db/migrate/20110228000100_copy_repositories_log_encoding.rb +++ b/db/migrate/20110228000100_copy_repositories_log_encoding.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 CopyRepositoriesLogEncoding < ActiveRecord::Migration Repository.find(:all).each do |repo| scm = repo.scm_name case scm - when 'Subversion', 'Mercurial', 'Git', 'Filesystem' + when 'Subversion', 'Mercurial', 'Git', 'Filesystem' repo.update_attribute(:log_encoding, nil) else repo.update_attribute(:log_encoding, encoding) diff --git a/db/migrate/20110314014400_add_start_date_to_versions.rb b/db/migrate/20110314014400_add_start_date_to_versions.rb index 3d585b7c..c62e370e 100644 --- a/db/migrate/20110314014400_add_start_date_to_versions.rb +++ b/db/migrate/20110314014400_add_start_date_to_versions.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/db/migrate/20110401192910_add_index_to_users_type.rb b/db/migrate/20110401192910_add_index_to_users_type.rb index 665d2587..d8bb8879 100644 --- a/db/migrate/20110401192910_add_index_to_users_type.rb +++ b/db/migrate/20110401192910_add_index_to_users_type.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/db/migrate/20110519194936_remove_comments_from_wiki_content.rb b/db/migrate/20110519194936_remove_comments_from_wiki_content.rb index 5e30b52b..52860d08 100644 --- a/db/migrate/20110519194936_remove_comments_from_wiki_content.rb +++ b/db/migrate/20110519194936_remove_comments_from_wiki_content.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/db/seeds.rb b/db/seeds.rb index 485a540f..df5cc90e 100644 --- a/db/seeds.rb +++ b/db/seeds.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,6 +15,6 @@ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: -# +# # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) # Major.create(:name => 'Daley', :city => cities.first) diff --git a/extra/mail_handler/rdm-mailhandler.rb b/extra/mail_handler/rdm-mailhandler.rb index 457b31e2..d5d535b8 100644 --- a/extra/mail_handler/rdm-mailhandler.rb +++ b/extra/mail_handler/rdm-mailhandler.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,10 +23,10 @@ # rdm-mailhandler [options] --url= --key= # # == Arguments -# +# # -u, --url URL of the Redmine server # -k, --key Redmine API key -# +# # General options: # --unknown-user=ACTION how to handle emails from an unknown user # ACTION can be one of the following values: @@ -38,7 +38,7 @@ # -h, --help show this help # -v, --verbose show extra information # -V, --version show version information and exit -# +# # Issue attributes control options: # -p, --project=PROJECT identifier of the target project # -s, --status=STATUS name of the target status @@ -48,15 +48,15 @@ # -o, --allow-override=ATTRS allow email content to override attributes # specified by previous options # ATTRS is a comma separated list of attributes -# +# # == Examples # No project specified. Emails MUST contain the 'Project' keyword: -# +# # rdm-mailhandler --url http://redmine.domain.foo --key secret -# +# # Fixed project and default tracker specified, but emails can override # both tracker and priority attributes using keywords: -# +# # rdm-mailhandler --url https://domain.foo/redmine --key secret \\ # --project foo \\ # --tracker bug \\ @@ -84,12 +84,12 @@ end class RedmineMailHandler VERSION = '0.1' - + attr_accessor :verbose, :issue_attributes, :allow_override, :unknown_user, :no_permission_check, :url, :key def initialize self.issue_attributes = {} - + opts = GetoptLong.new( [ '--help', '-h', GetoptLong::NO_ARGUMENT ], [ '--version', '-V', GetoptLong::NO_ARGUMENT ], @@ -128,28 +128,28 @@ class RedmineMailHandler self.no_permission_check = '1' end end - + RDoc.usage if url.nil? end - + def submit(email) uri = url.gsub(%r{/*$}, '') + '/mail_handler' - + headers = { 'User-Agent' => "Redmine mail handler/#{VERSION}" } - - data = { 'key' => key, 'email' => email, + + data = { 'key' => key, 'email' => email, 'allow_override' => allow_override, 'unknown_user' => unknown_user, 'no_permission_check' => no_permission_check} issue_attributes.each { |attr, value| data["issue[#{attr}]"] = value } - + debug "Posting to #{uri}..." response = Net::HTTPS.post_form(URI.parse(uri), data, headers) debug "Response received: #{response.code}" - + case response.code.to_i when 403 - warn "Request was denied by your Redmine server. " + + warn "Request was denied by your Redmine server. " + "Make sure that 'WS for incoming emails' is enabled in application settings and that you provided the correct API key." return 77 when 422 @@ -169,9 +169,9 @@ class RedmineMailHandler return 1 end end - + private - + def debug(msg) puts msg if verbose end diff --git a/extra/sample_plugin/app/controllers/example_controller.rb b/extra/sample_plugin/app/controllers/example_controller.rb index 2eebde87..6528c6f3 100644 --- a/extra/sample_plugin/app/controllers/example_controller.rb +++ b/extra/sample_plugin/app/controllers/example_controller.rb @@ -1,33 +1,33 @@ #-- 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. #++ # Sample plugin controller class ExampleController < ApplicationController unloadable - - layout 'base' + + layout 'base' before_filter :find_project, :authorize menu_item :sample_plugin - + def say_hello @value = Setting.plugin_sample_plugin['sample_setting'] end def say_goodbye end - + private - def find_project + def find_project @project=Project.find(params[:id]) end end diff --git a/extra/sample_plugin/app/models/meeting.rb b/extra/sample_plugin/app/models/meeting.rb index 9bd92fbb..cfdc6635 100644 --- a/extra/sample_plugin/app/models/meeting.rb +++ b/extra/sample_plugin/app/models/meeting.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/extra/sample_plugin/db/migrate/001_create_meetings.rb b/extra/sample_plugin/db/migrate/001_create_meetings.rb index 0b126dcf..1a9b7386 100644 --- a/extra/sample_plugin/db/migrate/001_create_meetings.rb +++ b/extra/sample_plugin/db/migrate/001_create_meetings.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/extra/sample_plugin/init.rb b/extra/sample_plugin/init.rb index dd5025d9..a6720ccd 100644 --- a/extra/sample_plugin/init.rb +++ b/extra/sample_plugin/init.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. #++ @@ -37,7 +37,7 @@ Redmine::Plugin.register :sample_plugin do # A new item is added to the project menu menu :project_menu, :sample_plugin, { :controller => 'example', :action => 'say_hello' }, :caption => 'Sample' - + # Meetings are added to the activity view activity_provider :meetings end diff --git a/extra/svn/reposman.rb b/extra/svn/reposman.rb index 72cd647b..b0c7cc39 100755 --- a/extra/svn/reposman.rb +++ b/extra/svn/reposman.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/lib/ar_condition.rb b/lib/ar_condition.rb index 44ec16cb..5426ca44 100644 --- a/lib/ar_condition.rb +++ b/lib/ar_condition.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 ARCondition attr_reader :conditions - + def initialize(condition=nil) @conditions = ['1=1'] add(condition) if condition end - + def add(condition) if condition.is_a?(Array) @conditions.first << " AND (#{condition.first})" diff --git a/lib/chili_project.rb b/lib/chili_project.rb index b3e839f1..a5a58d36 100644 --- a/lib/chili_project.rb +++ b/lib/chili_project.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/lib/chili_project/database.rb b/lib/chili_project/database.rb index fe96176d..02469e4a 100644 --- a/lib/chili_project/database.rb +++ b/lib/chili_project/database.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. #++ @@ -42,7 +42,7 @@ module ChiliProject self.adapter_name =~ regex }[0] end - + # Provide helper methods to quickly check the database type # ChiliProject::Database.mysql? returns true, if we have a MySQL DB supported_adapters.keys.each do |adapter| diff --git a/lib/generators/chiliproject_plugin/chiliproject_plugin_generator.rb b/lib/generators/chiliproject_plugin/chiliproject_plugin_generator.rb index a48e2566..d7d09bbf 100644 --- a/lib/generators/chiliproject_plugin/chiliproject_plugin_generator.rb +++ b/lib/generators/chiliproject_plugin/chiliproject_plugin_generator.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 ChiliprojectPluginGenerator < Rails::Generator::NamedBase attr_reader :plugin_path, :plugin_name, :plugin_pretty_name - + def initialize(runtime_args, runtime_options = {}) super @plugin_name = "chiliproject_#{file_name.underscore}" @plugin_pretty_name = plugin_name.titleize @plugin_path = "vendor/plugins/#{plugin_name}" end - + def manifest record do |m| m.directory "#{plugin_path}/app/controllers" @@ -35,7 +35,7 @@ class ChiliprojectPluginGenerator < Rails::Generator::NamedBase m.directory "#{plugin_path}/lang" m.directory "#{plugin_path}/config/locales" m.directory "#{plugin_path}/test" - + m.template 'README.rdoc', "#{plugin_path}/README.rdoc" m.template 'init.rb.erb', "#{plugin_path}/init.rb" m.template 'en.yml', "#{plugin_path}/lang/en.yml" diff --git a/lib/generators/chiliproject_plugin_controller/chiliproject_plugin_controller_generator.rb b/lib/generators/chiliproject_plugin_controller/chiliproject_plugin_controller_generator.rb index 352e1663..975b23f2 100644 --- a/lib/generators/chiliproject_plugin_controller/chiliproject_plugin_controller_generator.rb +++ b/lib/generators/chiliproject_plugin_controller/chiliproject_plugin_controller_generator.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. #++ @@ -16,7 +16,7 @@ require 'rails_generator/generators/components/controller/controller_generator' class ChiliprojectPluginControllerGenerator < ControllerGenerator attr_reader :plugin_path, :plugin_name, :plugin_pretty_name - + def initialize(runtime_args, runtime_options = {}) runtime_args = runtime_args.dup usage if runtime_args.empty? @@ -25,11 +25,11 @@ class ChiliprojectPluginControllerGenerator < ControllerGenerator @plugin_path = "vendor/plugins/#{plugin_name}" super(runtime_args, runtime_options) end - + def destination_root File.join(RAILS_ROOT, plugin_path) end - + def manifest record do |m| # Check for class naming collisions. diff --git a/lib/generators/chiliproject_plugin_model/chiliproject_plugin_model_generator.rb b/lib/generators/chiliproject_plugin_model/chiliproject_plugin_model_generator.rb index 7fa2134c..ad6be64c 100644 --- a/lib/generators/chiliproject_plugin_model/chiliproject_plugin_model_generator.rb +++ b/lib/generators/chiliproject_plugin_model/chiliproject_plugin_model_generator.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. #++ @@ -16,7 +16,7 @@ require 'rails_generator/generators/components/model/model_generator' class ChiliprojectPluginModelGenerator < ModelGenerator attr_accessor :plugin_path, :plugin_name, :plugin_pretty_name - + def initialize(runtime_args, runtime_options = {}) runtime_args = runtime_args.dup usage if runtime_args.empty? @@ -25,11 +25,11 @@ class ChiliprojectPluginModelGenerator < ModelGenerator @plugin_path = "vendor/plugins/#{plugin_name}" super(runtime_args, runtime_options) end - + def destination_root File.join(RAILS_ROOT, plugin_path) end - + def manifest record do |m| # Check for class naming collisions. @@ -44,7 +44,7 @@ class ChiliprojectPluginModelGenerator < ModelGenerator m.template 'model.rb.erb', File.join('app/models', class_path, "#{file_name}.rb") m.template 'unit_test.rb.erb', File.join('test/unit', class_path, "#{file_name}_test.rb") - unless options[:skip_fixture] + unless options[:skip_fixture] m.template 'fixtures.yml', File.join('test/fixtures', "#{table_name}.yml") end diff --git a/lib/redmine.rb b/lib/redmine.rb index a38d9803..983ceee6 100644 --- a/lib/redmine.rb +++ b/lib/redmine.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. #++ @@ -68,7 +68,7 @@ Redmine::AccessControl.map do |map| map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member - + map.project_module :issue_tracking do |map| # Issue categories map.permission :manage_categories, {:projects => :settings, :issue_categories => [:new, :edit, :destroy]}, :require => :member @@ -97,7 +97,7 @@ Redmine::AccessControl.map do |map| map.permission :add_issue_watchers, {:watchers => :new} map.permission :delete_issue_watchers, {:watchers => :destroy} end - + map.project_module :time_tracking do |map| map.permission :log_time, {:timelog => [:new, :create, :edit, :update]}, :require => :loggedin map.permission :view_time_entries, :timelog => [:index, :show], :time_entry_reports => [:report] @@ -105,7 +105,7 @@ Redmine::AccessControl.map do |map| map.permission :edit_own_time_entries, {:timelog => [:new, :create, :edit, :update, :destroy]}, :require => :loggedin map.permission :manage_project_activities, {:project_enumerations => [:update, :destroy]}, :require => :member end - + map.project_module :news do |map| map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member map.permission :view_news, {:news => [:index, :show]}, :public => true @@ -116,12 +116,12 @@ Redmine::AccessControl.map do |map| map.permission :manage_documents, {:documents => [:new, :edit, :destroy, :add_attachment]}, :require => :loggedin map.permission :view_documents, :documents => [:index, :show, :download] end - + map.project_module :files do |map| map.permission :manage_files, {:files => [:new, :create]}, :require => :loggedin map.permission :view_files, :files => :index, :versions => :download end - + map.project_module :wiki do |map| map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member @@ -133,7 +133,7 @@ Redmine::AccessControl.map do |map| map.permission :delete_wiki_pages_attachments, {} map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member end - + map.project_module :repository do |map| map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph] diff --git a/lib/redmine/about.rb b/lib/redmine/about.rb index 526619cf..14c23ac6 100644 --- a/lib/redmine/about.rb +++ b/lib/redmine/about.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/lib/redmine/access_control.rb b/lib/redmine/access_control.rb index 7eba40e0..dabe531d 100644 --- a/lib/redmine/access_control.rb +++ b/lib/redmine/access_control.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 Redmine module AccessControl - + class << self def map mapper = Mapper.new @@ -21,69 +21,69 @@ module Redmine @permissions ||= [] @permissions += mapper.mapped_permissions end - + def permissions @permissions end - + # Returns the permission of given name or nil if it wasn't found # Argument should be a symbol def permission(name) permissions.detect {|p| p.name == name} end - + # Returns the actions that are allowed by the permission of given name def allowed_actions(permission_name) perm = permission(permission_name) perm ? perm.actions : [] end - + def public_permissions @public_permissions ||= @permissions.select {|p| p.public?} end - + def members_only_permissions @members_only_permissions ||= @permissions.select {|p| p.require_member?} end - + def loggedin_only_permissions @loggedin_only_permissions ||= @permissions.select {|p| p.require_loggedin?} end - + def available_project_modules @available_project_modules ||= @permissions.collect(&:project_module).uniq.compact end - + def modules_permissions(modules) @permissions.select {|p| p.project_module.nil? || modules.include?(p.project_module.to_s)} end end - + class Mapper def initialize @project_module = nil end - + def permission(name, hash, options={}) @permissions ||= [] options.merge!(:project_module => @project_module) @permissions << Permission.new(name, hash, options) end - + def project_module(name, options={}) @project_module = name yield self @project_module = nil end - + def mapped_permissions @permissions end end - + class Permission attr_reader :name, :actions, :project_module - + def initialize(name, hash, options) @name = name @actions = [] @@ -99,18 +99,18 @@ module Redmine end @actions.flatten! end - + def public? @public end - + def require_member? @require && @require == :member end - + def require_loggedin? @require && (@require == :member || @require == :loggedin) end - end + end end end diff --git a/lib/redmine/access_keys.rb b/lib/redmine/access_keys.rb index d352ccd3..d1165049 100644 --- a/lib/redmine/access_keys.rb +++ b/lib/redmine/access_keys.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 @@ module Redmine :search => '4', :new_issue => '7' }.freeze unless const_defined?(:ACCESSKEYS) - + def self.key_for(action) ACCESSKEYS[action] end diff --git a/lib/redmine/activity.rb b/lib/redmine/activity.rb index b78eb02b..b38484dd 100644 --- a/lib/redmine/activity.rb +++ b/lib/redmine/activity.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. #++ module Redmine module Activity - + mattr_accessor :available_event_types, :default_event_types, :providers - + @@available_event_types = [] @@default_event_types = [] @@providers = Hash.new {|h,k| h[k]=[] } @@ -24,15 +24,15 @@ module Redmine def map(&block) yield self end - + # Registers an activity provider def register(event_type, options={}) options.assert_valid_keys(:class_name, :default) - + event_type = event_type.to_s providers = options[:class_name] || event_type.classify providers = ([] << providers) unless providers.is_a?(Array) - + @@available_event_types << event_type unless @@available_event_types.include?(event_type) @@default_event_types << event_type unless options[:default] == false @@providers[event_type] += providers diff --git a/lib/redmine/activity/fetcher.rb b/lib/redmine/activity/fetcher.rb index 0d820b31..6ded1405 100644 --- a/lib/redmine/activity/fetcher.rb +++ b/lib/redmine/activity/fetcher.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. #++ @@ -16,23 +16,23 @@ module Redmine # Class used to retrieve activity events class Fetcher attr_reader :user, :project, :scope - + # Needs to be unloaded in development mode @@constantized_providers = Hash.new {|h,k| h[k] = Redmine::Activity.providers[k].collect {|t| t.constantize } } - + def initialize(user, options={}) options.assert_valid_keys(:project, :with_subprojects, :author) @user = user @project = options[:project] @options = options - + @scope = event_types end - + # Returns an array of available event types def event_types return @event_types unless @event_types.nil? - + @event_types = Redmine::Activity.available_event_types if @project @event_types = @event_types.select do |o| @@ -47,12 +47,12 @@ module Redmine end @event_types end - + # Yields to filter the activity scope def scope_select(&block) @scope = @scope.select {|t| yield t } end - + # Sets the scope # Argument can be :all, :default or an array of event types def scope=(s) @@ -65,34 +65,34 @@ module Redmine @scope = s & event_types end end - + # Resets the scope to the default scope def default_scope! @scope = Redmine::Activity.default_event_types end - + # Returns an array of events for the given date range # sorted in reverse chronological order def events(from = nil, to = nil, options={}) e = [] @options[:limit] = options[:limit] - + @scope.each do |event_type| constantized_providers(event_type).each do |provider| e += provider.find_events(event_type, @user, from, to, @options) end end - + e.sort! {|a,b| b.event_datetime <=> a.event_datetime} - + if options[:limit] e = e.slice(0, options[:limit]) end e end - + private - + def constantized_providers(event_type) @@constantized_providers[event_type] end diff --git a/lib/redmine/ciphering.rb b/lib/redmine/ciphering.rb index 76219231..a8f7a8d0 100644 --- a/lib/redmine/ciphering.rb +++ b/lib/redmine/ciphering.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. #++ module Redmine module Ciphering - def self.included(base) + def self.included(base) base.extend ClassMethods end - + class << self def encrypt_text(text) if cipher_key.blank? @@ -32,7 +32,7 @@ module Redmine "aes-256-cbc:" + [e, iv].map {|v| Base64.encode64(v).strip}.join('--') end end - + def decrypt_text(text) if text && match = text.match(/\Aaes-256-cbc:(.+)\Z/) text = match[1] @@ -47,13 +47,13 @@ module Redmine text end end - + def cipher_key key = Redmine::Configuration['database_cipher_key'].to_s key.blank? ? nil : Digest::SHA256.hexdigest(key) end end - + module ClassMethods def encrypt_all(attribute) transaction do @@ -64,7 +64,7 @@ module Redmine end end ? true : false end - + def decrypt_all(attribute) transaction do all.each do |object| @@ -75,14 +75,14 @@ module Redmine end end ? true : false end - + private - + # Returns the value of the given ciphered attribute def read_ciphered_attribute(attribute) Redmine::Ciphering.decrypt_text(read_attribute(attribute)) end - + # Sets the value of the given ciphered attribute def write_ciphered_attribute(attribute, value) write_attribute(attribute, Redmine::Ciphering.encrypt_text(value)) diff --git a/lib/redmine/configuration.rb b/lib/redmine/configuration.rb index 563167b8..3e4dedb6 100644 --- a/lib/redmine/configuration.rb +++ b/lib/redmine/configuration.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 Redmine module Configuration - + # Configuration default values @defaults = { 'email_delivery' => nil, @@ -22,25 +22,25 @@ module Redmine 'autologin_cookie_path' => '/', 'autologin_cookie_secure' => false, } - + @config = nil - + class << self # Loads the Redmine configuration file # Valid options: # * :file: the configuration file to load (default: config/configuration.yml) - # * :env: the environment to load the configuration for (default: Rails.env) + # * :env: the environment to load the configuration for (default: Rails.env) def load(options={}) filename = options[:file] || File.join(Rails.root, 'config', 'configuration.yml') env = options[:env] || Rails.env - + @config = @defaults.dup - + load_deprecated_email_configuration(env) if File.file?(filename) @config.merge!(load_from_yaml(filename, env)) end - + # Compatibility mode for those who copy email.yml over configuration.yml %w(delivery_method smtp_settings sendmail_settings).each do |key| if value = @config.delete(key) @@ -48,7 +48,7 @@ module Redmine @config['email_delivery'][key] = value end end - + if @config['email_delivery'] ActionMailer::Base.perform_deliveries = true @config['email_delivery'].each do |k, v| @@ -56,16 +56,16 @@ module Redmine ActionMailer::Base.send("#{k}=", v) end end - + @config end - + # Returns a configuration setting def [](name) load unless @config @config[name] end - + # Yields a block with the specified hash configuration settings def with(settings) settings.stringify_keys! @@ -75,9 +75,9 @@ module Redmine yield if block_given? @config.merge! was end - + private - + def load_from_yaml(filename, env) yaml = YAML::load_file(filename) conf = {} @@ -94,7 +94,7 @@ module Redmine end conf end - + def load_deprecated_email_configuration(env) deprecated_email_conf = File.join(Rails.root, 'config', 'email.yml') if File.file?(deprecated_email_conf) diff --git a/lib/redmine/core_ext.rb b/lib/redmine/core_ext.rb index 81dcc33a..324f5737 100644 --- a/lib/redmine/core_ext.rb +++ b/lib/redmine/core_ext.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/lib/redmine/core_ext/string.rb b/lib/redmine/core_ext/string.rb index 3e9429c6..b9d90b4d 100644 --- a/lib/redmine/core_ext/string.rb +++ b/lib/redmine/core_ext/string.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/lib/redmine/core_ext/string/conversions.rb b/lib/redmine/core_ext/string/conversions.rb index a6b16049..19256020 100644 --- a/lib/redmine/core_ext/string/conversions.rb +++ b/lib/redmine/core_ext/string/conversions.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. #++ @@ -32,7 +32,7 @@ module Redmine #:nodoc: s.gsub!(',', '.') begin; Kernel.Float(s); rescue; nil; end end - + # Object#to_a removed in ruby1.9 if RUBY_VERSION > '1.9' def to_a diff --git a/lib/redmine/core_ext/string/inflections.rb b/lib/redmine/core_ext/string/inflections.rb index 4b24da91..7d574ff9 100644 --- a/lib/redmine/core_ext/string/inflections.rb +++ b/lib/redmine/core_ext/string/inflections.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/lib/redmine/custom_field_format.rb b/lib/redmine/custom_field_format.rb index 6880b193..ee4c7bd2 100644 --- a/lib/redmine/custom_field_format.rb +++ b/lib/redmine/custom_field_format.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. #++ @@ -45,7 +45,7 @@ module Redmine return value } end - + ['user', 'version'].each do |name| define_method("format_as_#{name}") {|value| return value.blank? ? "" : name.classify.constantize.find_by_id(value.to_i).to_s @@ -56,7 +56,7 @@ module Redmine def map(&block) yield self end - + # Registers a custom field format def register(custom_field_format, options={}) @@available[custom_field_format.name] = custom_field_format unless @@available.keys.include?(custom_field_format.name) @@ -96,5 +96,5 @@ module Redmine end end end - end + end end diff --git a/lib/redmine/default_data/loader.rb b/lib/redmine/default_data/loader.rb index e8419154..a278ce5c 100644 --- a/lib/redmine/default_data/loader.rb +++ b/lib/redmine/default_data/loader.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,7 +17,7 @@ module Redmine module Loader include Redmine::I18n - + class << self # Returns true if no data is already loaded in the database # otherwise false @@ -27,23 +27,23 @@ module Redmine !IssueStatus.find(:first) && !Enumeration.find(:first) end - + # Loads the default data # Raises a RecordNotSaved exception if something goes wrong def load(lang=nil) raise DataAlreadyLoaded.new("Some configuration data is already loaded.") unless no_data? set_language_if_valid(lang) - + Role.transaction do # Roles - manager = Role.create! :name => l(:default_role_manager), + manager = Role.create! :name => l(:default_role_manager), :position => 1 manager.permissions = manager.setable_permissions.collect {|p| p.name} manager.save! - - developer = Role.create! :name => l(:default_role_developer), - :position => 2, - :permissions => [:manage_versions, + + developer = Role.create! :name => l(:default_role_developer), + :position => 2, + :permissions => [:manage_versions, :manage_categories, :view_issues, :add_issues, @@ -69,7 +69,7 @@ module Redmine :browse_repository, :view_changesets, :commit_access] - + reporter = Role.create! :name => l(:default_role_reporter), :position => 3, :permissions => [:view_issues, @@ -89,7 +89,7 @@ module Redmine :view_files, :browse_repository, :view_changesets] - + Role.non_member.update_attributes :name => l(:default_role_non_member), :permissions => [:view_issues, :add_issues, @@ -106,7 +106,7 @@ module Redmine :view_files, :browse_repository, :view_changesets] - + Role.anonymous.update_attributes :name => l(:default_role_anonymous), :permissions => [:view_issues, :view_gantt, @@ -118,12 +118,12 @@ module Redmine :view_files, :browse_repository, :view_changesets] - + # Trackers Tracker.create!(:name => l(:default_tracker_bug), :is_in_chlog => true, :is_in_roadmap => false, :position => 1) Tracker.create!(:name => l(:default_tracker_feature), :is_in_chlog => true, :is_in_roadmap => true, :position => 2) Tracker.create!(:name => l(:default_tracker_support), :is_in_chlog => false, :is_in_roadmap => false, :position => 3) - + # Issue statuses new = IssueStatus.create!(:name => l(:default_issue_status_new), :is_closed => false, :is_default => true, :position => 1) in_progress = IssueStatus.create!(:name => l(:default_issue_status_in_progress), :is_closed => false, :is_default => false, :position => 2) @@ -131,43 +131,43 @@ module Redmine feedback = IssueStatus.create!(:name => l(:default_issue_status_feedback), :is_closed => false, :is_default => false, :position => 4) closed = IssueStatus.create!(:name => l(:default_issue_status_closed), :is_closed => true, :is_default => false, :position => 5) rejected = IssueStatus.create!(:name => l(:default_issue_status_rejected), :is_closed => true, :is_default => false, :position => 6) - + # Workflow Tracker.find(:all).each { |t| IssueStatus.find(:all).each { |os| IssueStatus.find(:all).each { |ns| Workflow.create!(:tracker_id => t.id, :role_id => manager.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns - } - } + } + } } - + Tracker.find(:all).each { |t| [new, in_progress, resolved, feedback].each { |os| [in_progress, resolved, feedback, closed].each { |ns| Workflow.create!(:tracker_id => t.id, :role_id => developer.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns - } - } + } + } } - + Tracker.find(:all).each { |t| [new, in_progress, resolved, feedback].each { |os| [closed].each { |ns| Workflow.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns - } + } } Workflow.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => resolved.id, :new_status_id => feedback.id) } - + # Enumerations DocumentCategory.create!(:name => l(:default_doc_category_user), :position => 1) DocumentCategory.create!(:name => l(:default_doc_category_tech), :position => 2) - + IssuePriority.create!(:name => l(:default_priority_low), :position => 1) IssuePriority.create!(:name => l(:default_priority_normal), :position => 2, :is_default => true) IssuePriority.create!(:name => l(:default_priority_high), :position => 3) IssuePriority.create!(:name => l(:default_priority_urgent), :position => 4) IssuePriority.create!(:name => l(:default_priority_immediate), :position => 5) - + TimeEntryActivity.create!(:name => l(:default_activity_design), :position => 1) TimeEntryActivity.create!(:name => l(:default_activity_development), :position => 2) end diff --git a/lib/redmine/export/pdf.rb b/lib/redmine/export/pdf.rb index a5f29836..99969725 100644 --- a/lib/redmine/export/pdf.rb +++ b/lib/redmine/export/pdf.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,11 +24,11 @@ module Redmine module PDF include ActionView::Helpers::TextHelper include ActionView::Helpers::NumberHelper - + class ITCPDF < TCPDF include Redmine::I18n attr_accessor :footer_date - + def initialize(lang) super() set_language_if_valid lang @@ -37,11 +37,11 @@ module Redmine SetCreator(Redmine::Info.app_name) SetFont(@font_for_content) end - + def SetFontStyle(style, size) SetFont(@font_for_content, style, size) end - + def SetTitle(txt) txt = begin utf16txt = Iconv.conv('UTF-16BE', 'UTF-8', txt) @@ -53,7 +53,7 @@ module Redmine end || '' super(txt) end - + def textstring(s) # Format a text string if s =~ /^ space_left @@ -271,21 +271,21 @@ module Redmine base_x = pdf.GetX base_y = pdf.GetY end - + # write the cells on page pdf.Cell(col_id_width, row_height, issue.id.to_s, "T", 0, 'C', 1) issues_to_pdf_write_cells(pdf, col_values, col_width, row_height) issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_id_width, col_width) pdf.SetY(base_y + max_height); end - + if issues.size == Setting.issues_export_limit.to_i pdf.SetFontStyle('B',10) pdf.RDMCell(0, row_height, '...') end pdf.Output end - + # Renders MultiCells and returns the maximum height used def issues_to_pdf_write_cells(pdf, col_values, col_widths, row_height) base_y = pdf.GetY @@ -298,7 +298,7 @@ module Redmine end return max_height end - + # Draw lines to close the row (MultiCell border drawing in not uniform) def issues_to_pdf_draw_borders(pdf, top_x, top_y, lower_y, id_width, col_widths) col_x = top_x + id_width @@ -310,7 +310,7 @@ module Redmine pdf.Line(top_x, top_y, top_x, lower_y) # left border pdf.Line(top_x, lower_y, col_x, lower_y) # bottom border end - + # Returns a PDF string of a single issue def issue_to_pdf(issue) if ( current_language.to_s.downcase == 'ko' || @@ -326,13 +326,13 @@ module Redmine pdf.alias_nb_pages pdf.footer_date = format_date(Date.today) pdf.AddPage - - pdf.SetFontStyle('B',11) + + pdf.SetFontStyle('B',11) pdf.RDMMultiCell(190,5, "#{issue.project} - #{issue.tracker} # #{issue.id}: #{issue.subject}") pdf.Ln - + y0 = pdf.GetY - + pdf.SetFontStyle('B',9) pdf.RDMCell(35,5, l(:field_status) + ":","LT") pdf.SetFontStyle('',9) @@ -340,9 +340,9 @@ module Redmine pdf.SetFontStyle('B',9) pdf.RDMCell(35,5, l(:field_priority) + ":","LT") pdf.SetFontStyle('',9) - pdf.RDMCell(60,5, issue.priority.to_s,"RT") + pdf.RDMCell(60,5, issue.priority.to_s,"RT") pdf.Ln - + pdf.SetFontStyle('B',9) pdf.RDMCell(35,5, l(:field_author) + ":","L") pdf.SetFontStyle('',9) @@ -351,8 +351,8 @@ module Redmine pdf.RDMCell(35,5, l(:field_category) + ":","L") pdf.SetFontStyle('',9) pdf.RDMCell(60,5, issue.category.to_s,"R") - pdf.Ln - + pdf.Ln + pdf.SetFontStyle('B',9) pdf.RDMCell(35,5, l(:field_created_on) + ":","L") pdf.SetFontStyle('',9) @@ -362,7 +362,7 @@ module Redmine pdf.SetFontStyle('',9) pdf.RDMCell(60,5, issue.assigned_to.to_s,"R") pdf.Ln - + pdf.SetFontStyle('B',9) pdf.RDMCell(35,5, l(:field_updated_on) + ":","LB") pdf.SetFontStyle('',9) @@ -372,23 +372,23 @@ module Redmine pdf.SetFontStyle('',9) pdf.RDMCell(60,5, format_date(issue.due_date),"RB") pdf.Ln - + for custom_value in issue.custom_field_values pdf.SetFontStyle('B',9) pdf.RDMCell(35,5, custom_value.custom_field.name + ":","L") pdf.SetFontStyle('',9) pdf.RDMMultiCell(155,5, (show_value custom_value),"R") end - + pdf.SetFontStyle('B',9) pdf.RDMCell(35,5, l(:field_description) + ":") pdf.SetFontStyle('',9) pdf.RDMMultiCell(155,5, issue.description.to_s,"BR") - + pdf.Line(pdf.GetX, y0, pdf.GetX, pdf.GetY) pdf.Line(pdf.GetX, pdf.GetY, pdf.GetX + 190, pdf.GetY) pdf.Ln - + if issue.changesets.any? && User.current.allowed_to?(:view_changesets, issue.project) pdf.SetFontStyle('B',9) pdf.RDMCell(190,5, l(:label_associated_revisions), "B") @@ -400,14 +400,14 @@ module Redmine unless changeset.comments.blank? pdf.SetFontStyle('',8) pdf.RDMMultiCell(190,5, changeset.comments.to_s) - end + end pdf.Ln end end - + pdf.SetFontStyle('B',9) pdf.RDMCell(190,5, l(:label_history), "B") - pdf.Ln + pdf.Ln for journal in issue.journals.find(:all, :include => [:user], :order => "#{Journal.table_name}.created_at ASC") pdf.SetFontStyle('B',8) pdf.RDMCell(190,5, format_time(journal.created_at) + " - " + journal.user.name) @@ -421,10 +421,10 @@ module Redmine pdf.Ln unless journal.details.empty? pdf.SetFontStyle('',8) pdf.RDMMultiCell(190,5, journal.notes.to_s) - end + end pdf.Ln end - + if issue.attachments.any? pdf.SetFontStyle('B',9) pdf.RDMCell(190,5, l(:label_attachment_plural), "B") diff --git a/lib/redmine/helpers/calendar.rb b/lib/redmine/helpers/calendar.rb index d22e4be9..2a06ff3b 100644 --- a/lib/redmine/helpers/calendar.rb +++ b/lib/redmine/helpers/calendar.rb @@ -1,30 +1,30 @@ #-- 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 Redmine module Helpers - + # Simple class to compute the start and end dates of a calendar class Calendar include Redmine::I18n attr_reader :startdt, :enddt - + def initialize(date, lang = current_language, period = :month) @date = date @events = [] @ending_events_by_days = {} @starting_events_by_days = {} - set_language_if_valid lang + set_language_if_valid lang case period when :month @startdt = Date.civil(date.year, date.month, 1) @@ -40,24 +40,24 @@ module Redmine raise 'Invalid period' end end - + # Sets calendar events def events=(events) @events = events @ending_events_by_days = @events.group_by {|event| event.due_date} @starting_events_by_days = @events.group_by {|event| event.start_date} end - + # Returns events for the given day def events_on(day) ((@ending_events_by_days[day] || []) + (@starting_events_by_days[day] || [])).uniq end - + # Calendar current month def month @date.month end - + # Return the first day of week # 1 = Monday ... 7 = Sunday def first_wday @@ -72,10 +72,10 @@ module Redmine @first_dow ||= (l(:general_first_day_of_week).to_i - 1)%7 + 1 end end - + def last_wday @last_dow ||= (first_wday + 5)%7 + 1 end - end + end end end diff --git a/lib/redmine/helpers/diff.rb b/lib/redmine/helpers/diff.rb index b49c279a..65ec46bd 100644 --- a/lib/redmine/helpers/diff.rb +++ b/lib/redmine/helpers/diff.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,15 +18,15 @@ module Redmine include ActionView::Helpers::TagHelper include ActionView::Helpers::TextHelper attr_reader :diff, :words - + def initialize(content_to, content_from) @words = content_to.to_s.split(/(\s+)/) @words = @words.select {|word| word != ' '} words_from = content_from.to_s.split(/(\s+)/) - words_from = words_from.select {|word| word != ' '} + words_from = words_from.select {|word| word != ' '} @diff = words_from.diff @words end - + def to_html words = self.words.collect{|word| h(word)} words_add = 0 @@ -37,7 +37,7 @@ module Redmine add_at = nil add_to = nil del_at = nil - deleted = "" + deleted = "" diff.each do |change| pos = change[1] if change[0] == "+" diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index 1cd8c9cf..a10a5824 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.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. #++ @@ -34,10 +34,10 @@ module Redmine attr_accessor :query attr_accessor :project attr_accessor :view - + def initialize(options={}) options = options.dup - + if options[:year] && options[:year].to_i >0 @year_from = options[:year].to_i if options[:month] && options[:month].to_i >=1 && options[:month].to_i <= 12 @@ -49,27 +49,27 @@ module Redmine @month_from ||= Date.today.month @year_from ||= Date.today.year end - + zoom = (options[:zoom] || User.current.pref[:gantt_zoom]).to_i - @zoom = (zoom > 0 && zoom < 5) ? zoom : 2 + @zoom = (zoom > 0 && zoom < 5) ? zoom : 2 months = (options[:months] || User.current.pref[:gantt_months]).to_i @months = (months > 0 && months < 25) ? months : 6 - + # Save gantt parameters as user preference (zoom and months count) if (User.current.logged? && (@zoom != User.current.pref[:gantt_zoom] || @months != User.current.pref[:gantt_months])) User.current.pref[:gantt_zoom], User.current.pref[:gantt_months] = @zoom, @months User.current.preference.save end - + @date_from = Date.civil(@year_from, @month_from, 1) @date_to = (@date_from >> @months) - 1 - + @subjects = '' @lines = '' @number_of_rows = nil - + @issue_ancestors = [] - + @truncated = false if options.has_key?(:max_rows) @max_rows = options[:max_rows] @@ -81,15 +81,15 @@ module Redmine def common_params { :controller => 'gantts', :action => 'show', :project_id => @project } end - + def params common_params.merge({ :zoom => zoom, :year => year_from, :month => month_from, :months => months }) end - + def params_previous common_params.merge({:year => (date_from << months).year, :month => (date_from << months).month, :zoom => zoom, :months => months }) end - + def params_next common_params.merge({:year => (date_from >> months).year, :month => (date_from >> months).month, :zoom => zoom, :months => months }) end @@ -97,7 +97,7 @@ module Redmine # Returns the number of rows that will be rendered on the Gantt chart def number_of_rows return @number_of_rows if @number_of_rows - + rows = projects.inject(0) {|total, p| total += number_of_rows_on_project(p)} if @max_rows.present? @@ -128,20 +128,20 @@ module Redmine render(options.merge(:only => :lines)) unless @lines_rendered @lines end - + # Returns issues that will be rendered def issues @issues ||= @query.issues( :include => [:assigned_to, :tracker, :priority, :category, :fixed_version], - :order => "#{Project.table_name}.lft ASC, #{Issue.table_name}.id ASC", + :order => "#{Project.table_name}.lft ASC, #{Issue.table_name}.id ASC", :limit => @max_rows ) end - + # Return all the project nodes that will be displayed def projects return @projects if @projects - + ids = issues.collect(&:project).uniq.collect(&:id) if ids.any? # All issues projects and their visible ancestors @@ -154,59 +154,59 @@ module Redmine @projects = [] end end - + # Returns the issues that belong to +project+ def project_issues(project) @issues_by_project ||= issues.group_by(&:project) @issues_by_project[project] || [] end - + # Returns the distinct versions of the issues that belong to +project+ def project_versions(project) project_issues(project).collect(&:fixed_version).compact.uniq end - + # Returns the issues that belong to +project+ and are assigned to +version+ def version_issues(project, version) project_issues(project).select {|issue| issue.fixed_version == version} end - + def render(options={}) options = {:top => 0, :top_increment => 20, :indent_increment => 20, :render => :subject, :format => :html}.merge(options) indent = options[:indent] || 4 - + @subjects = '' unless options[:only] == :lines @lines = '' unless options[:only] == :subjects @number_of_rows = 0 - + Project.project_tree(projects) do |project, level| options[:indent] = indent + level * options[:indent_increment] render_project(project, options) break if abort? end - + @subjects_rendered = true unless options[:only] == :lines @lines_rendered = true unless options[:only] == :subjects - + render_end(options) end def render_project(project, options={}) subject_for_project(project, options) unless options[:only] == :lines line_for_project(project, options) unless options[:only] == :subjects - + options[:top] += options[:top_increment] options[:indent] += options[:indent_increment] @number_of_rows += 1 return if abort? - + issues = project_issues(project).select {|i| i.fixed_version.nil?} sort_issues!(issues) if issues render_issues(issues, options) return if abort? end - + versions = project_versions(project) versions.each do |version| render_version(project, version, options) @@ -218,16 +218,16 @@ module Redmine def render_issues(issues, options={}) @issue_ancestors = [] - + issues.each do |i| subject_for_issue(i, options) unless options[:only] == :lines line_for_issue(i, options) unless options[:only] == :subjects - + options[:top] += options[:top_increment] @number_of_rows += 1 break if abort? end - + options[:indent] -= (options[:indent_increment] * @issue_ancestors.size) end @@ -235,11 +235,11 @@ module Redmine # Version header subject_for_version(version, options) unless options[:only] == :lines line_for_version(version, options) unless options[:only] == :subjects - + options[:top] += options[:top_increment] @number_of_rows += 1 return if abort? - + issues = version_issues(project, version) if issues sort_issues!(issues) @@ -249,10 +249,10 @@ module Redmine options[:indent] -= options[:indent_increment] end end - + def render_end(options={}) case options[:format] - when :pdf + when :pdf options[:pdf].Line(15, options[:top], PDF::TotalWidth, options[:top]) end end @@ -277,10 +277,10 @@ module Redmine if project.is_a?(Project) && project.start_date && project.due_date options[:zoom] ||= 1 options[:g_width] ||= (self.date_to - self.date_from + 1) * options[:zoom] - + coords = coordinates(project.start_date, project.due_date, nil, options[:zoom]) label = h(project) - + case options[:format] when :html html_task(options, coords, :css => "project task", :label => label, :markers => true) @@ -315,7 +315,7 @@ module Redmine if version.is_a?(Version) && version.start_date && version.due_date options[:zoom] ||= 1 options[:g_width] ||= (self.date_to - self.date_from + 1) * options[:zoom] - + coords = coordinates(version.start_date, version.due_date, version.completed_pourcent, options[:zoom]) label = "#{h version } #{h version.completed_pourcent.to_i.to_s}%" label = h("#{version.project} -") + label unless @project && @project == version.project @@ -339,14 +339,14 @@ module Redmine @issue_ancestors.pop options[:indent] -= options[:indent_increment] end - + output = case options[:format] when :html css_classes = '' css_classes << ' issue-overdue' if issue.overdue? css_classes << ' issue-behind-schedule' if issue.behind_schedule? css_classes << ' icon icon-issue' unless Setting.gravatar_enabled? && issue.assigned_to - + subject = "" if issue.assigned_to.present? assigned_string = l(:field_assigned_to) + ": " + issue.assigned_to.name @@ -366,7 +366,7 @@ module Redmine @issue_ancestors << issue options[:indent] += options[:indent_increment] end - + output end @@ -375,7 +375,7 @@ module Redmine if issue.is_a?(Issue) && issue.due_before coords = coordinates(issue.start_date, issue.due_before, issue.done_ratio, options[:zoom]) label = "#{ issue.status.name } #{ issue.done_ratio }%" - + case options[:format] when :html html_task(options, coords, :css => "task " + (issue.leaf? ? 'leaf' : 'parent'), :label => label, :issue => issue, :markers => !issue.leaf?) @@ -393,10 +393,10 @@ module Redmine # Generates a gantt image # Only defined if RMagick is avalaible def to_image(format='PNG') - date_to = (@date_from >> @months)-1 + date_to = (@date_from >> @months)-1 show_weeks = @zoom > 1 show_days = @zoom > 2 - + subject_width = 400 header_heigth = 18 # width of one day in pixels @@ -405,19 +405,19 @@ module Redmine g_height = 20 * number_of_rows + 30 headers_heigth = (show_weeks ? 2*header_heigth : header_heigth) height = g_height + headers_heigth - + imgl = Magick::ImageList.new imgl.new_image(subject_width+g_width+1, height) gc = Magick::Draw.new - + # Subjects gc.stroke('transparent') subjects(:image => gc, :top => (headers_heigth + 20), :indent => 4, :format => :image) - + # Months headers month_f = @date_from left = subject_width - @months.times do + @months.times do width = ((month_f >> 1) - month_f) * zoom gc.fill('white') gc.stroke('grey') @@ -430,7 +430,7 @@ module Redmine left = left + width month_f = month_f >> 1 end - + # Weeks headers if show_weeks left = subject_width @@ -462,13 +462,13 @@ module Redmine week_f = week_f+7 end end - + # Days details (week-end in grey) if show_days left = subject_width height = g_height + header_heigth - 1 wday = @date_from.cwday - (date_to - @date_from + 1).to_i.times do + (date_to - @date_from + 1).to_i.times do width = zoom gc.fill(wday == 6 || wday == 7 ? '#eee' : 'white') gc.stroke('#ddd') @@ -479,7 +479,7 @@ module Redmine wday = 1 if wday > 7 end end - + # border gc.fill('transparent') gc.stroke('grey') @@ -487,20 +487,20 @@ module Redmine gc.rectangle(0, 0, subject_width+g_width, headers_heigth) gc.stroke('black') gc.rectangle(0, 0, subject_width+g_width, g_height+ headers_heigth-1) - + # content top = headers_heigth + 20 gc.stroke('transparent') lines(:image => gc, :top => top, :zoom => zoom, :subject_width => subject_width, :format => :image) - + # today red line if Date.today >= @date_from and Date.today <= date_to gc.stroke('red') x = (Date.today-@date_from+1)*zoom + subject_width - gc.line(x, headers_heigth, x, headers_heigth + g_height-1) - end - + gc.line(x, headers_heigth, x, headers_heigth + g_height-1) + end + gc.draw(imgl) imgl.format = format imgl.to_blob @@ -525,14 +525,14 @@ module Redmine pdf.RDMCell(PDF::LeftPaneWidth, 20, project.to_s) pdf.Ln pdf.SetFontStyle('B',9) - + subject_width = PDF::LeftPaneWidth header_heigth = 5 - + headers_heigth = header_heigth show_weeks = false show_days = false - + if self.months < 7 show_weeks = true headers_heigth = 2*header_heigth @@ -541,27 +541,27 @@ module Redmine headers_heigth = 3*header_heigth end end - + g_width = PDF.right_pane_width zoom = (g_width) / (self.date_to - self.date_from + 1) g_height = 120 t_height = g_height + headers_heigth - + y_start = pdf.GetY - + # Months headers month_f = self.date_from left = subject_width height = header_heigth - self.months.times do - width = ((month_f >> 1) - month_f) * zoom + self.months.times do + width = ((month_f >> 1) - month_f) * zoom pdf.SetY(y_start) pdf.SetX(left) pdf.RDMCell(width, height, "#{month_f.year}-#{month_f.month}", "LTR", 0, "C") left = left + width month_f = month_f >> 1 - end - + end + # Weeks headers if show_weeks left = subject_width @@ -587,14 +587,14 @@ module Redmine week_f = week_f+7 end end - + # Days headers if show_days left = subject_width height = header_heigth wday = self.date_from.cwday pdf.SetFontStyle('B',7) - (self.date_to - self.date_from + 1).to_i.times do + (self.date_to - self.date_from + 1).to_i.times do width = zoom pdf.SetY(y_start + 2 * header_heigth) pdf.SetX(left) @@ -604,11 +604,11 @@ module Redmine wday = 1 if wday > 7 end end - + pdf.SetY(y_start) pdf.SetX(15) pdf.RDMCell(subject_width+g_width-15, headers_heigth, "", 1) - + # Tasks top = headers_heigth + y_start options = { @@ -625,12 +625,12 @@ module Redmine render(options) pdf.Output end - + private - + def coordinates(start_date, end_date, progress, zoom=nil) zoom ||= @zoom - + coords = {} if start_date && end_date && start_date < self.date_to && end_date > self.date_from if start_date > self.date_from @@ -645,7 +645,7 @@ module Redmine else coords[:bar_end] = self.date_to - self.date_from + 1 end - + if progress progress_date = start_date + (end_date - start_date + 1) * (progress / 100.0) if progress_date > self.date_from && progress_date > start_date @@ -655,7 +655,7 @@ module Redmine coords[:bar_progress_end] = self.date_to - self.date_from + 1 end end - + if progress_date < Date.today late_date = [Date.today, end_date].min if late_date > self.date_from && late_date > start_date @@ -668,7 +668,7 @@ module Redmine end end end - + # Transforms dates into pixels witdh coords.keys.each do |key| coords[key] = (coords[key] * zoom).floor @@ -680,7 +680,7 @@ module Redmine def sort_issues!(issues) issues.sort! { |a, b| gantt_issue_compare(a, b, issues) } end - + # TODO: top level issues should be sorted by start date def gantt_issue_compare(x, y, issues) if x.root_id == y.root_id @@ -689,7 +689,7 @@ module Redmine x.root_id <=> y.root_id end end - + def current_limit if @max_rows @max_rows - @number_of_rows @@ -697,13 +697,13 @@ module Redmine nil end end - + def abort? if @max_rows && @number_of_rows >= @max_rows @truncated = true end end - + def pdf_new_page?(options) if options[:top] > 180 options[:pdf].Line(15, options[:top], PDF::TotalWidth, options[:top]) @@ -712,41 +712,41 @@ module Redmine options[:pdf].Line(15, options[:top] - 0.1, PDF::TotalWidth, options[:top] - 0.1) end end - + def html_subject(params, subject, options={}) style = "position: absolute;top:#{params[:top]}px;left:#{params[:indent]}px;" style << "width:#{params[:subject_width] - params[:indent]}px;" if params[:subject_width] - + output = view.content_tag 'div', subject, :class => options[:css], :style => style, :title => options[:title] @subjects << output output end - + def pdf_subject(params, subject, options={}) params[:pdf].SetY(params[:top]) params[:pdf].SetX(15) - + char_limit = PDF::MaxCharactorsForSubject - params[:indent] params[:pdf].RDMCell(params[:subject_width]-15, 5, (" " * params[:indent]) + subject.to_s.sub(/^(.{#{char_limit}}[^\s]*\s).*$/, '\1 (...)'), "LR") - + params[:pdf].SetY(params[:top]) params[:pdf].SetX(params[:subject_width]) params[:pdf].RDMCell(params[:g_width], 5, "", "LR") end - + def image_subject(params, subject, options={}) params[:image].fill('black') params[:image].stroke('transparent') params[:image].stroke_width(1) params[:image].text(params[:indent], params[:top] + 2, subject) end - + def html_task(params, coords, options={}) output = '' # Renders the task bar, with progress and late if coords[:bar_start] && coords[:bar_end] output << "
               
              " - + if coords[:bar_late_end] output << "
               
              " end @@ -779,17 +779,17 @@ module Redmine @lines << output output end - + def pdf_task(params, coords, options={}) height = options[:height] || 2 - + # Renders the task bar, with progress and late if coords[:bar_start] && coords[:bar_end] params[:pdf].SetY(params[:top]+1.5) params[:pdf].SetX(params[:subject_width] + coords[:bar_start]) params[:pdf].SetFillColor(200,200,200) params[:pdf].RDMCell(coords[:bar_end] - coords[:bar_start], height, "", 0, 0, "", 1) - + if coords[:bar_late_end] params[:pdf].SetY(params[:top]+1.5) params[:pdf].SetX(params[:subject_width] + coords[:bar_start]) @@ -809,13 +809,13 @@ module Redmine params[:pdf].SetY(params[:top] + 1) params[:pdf].SetX(params[:subject_width] + coords[:start] - 1) params[:pdf].SetFillColor(50,50,200) - params[:pdf].RDMCell(2, 2, "", 0, 0, "", 1) + params[:pdf].RDMCell(2, 2, "", 0, 0, "", 1) end if coords[:end] params[:pdf].SetY(params[:top] + 1) params[:pdf].SetX(params[:subject_width] + coords[:end] - 1) params[:pdf].SetFillColor(50,50,200) - params[:pdf].RDMCell(2, 2, "", 0, 0, "", 1) + params[:pdf].RDMCell(2, 2, "", 0, 0, "", 1) end end # Renders the label on the right @@ -827,12 +827,12 @@ module Redmine def image_task(params, coords, options={}) height = options[:height] || 6 - + # Renders the task bar, with progress and late if coords[:bar_start] && coords[:bar_end] params[:image].fill('#aaa') params[:image].rectangle(params[:subject_width] + coords[:bar_start], params[:top], params[:subject_width] + coords[:bar_end], params[:top] - height) - + if coords[:bar_late_end] params[:image].fill('#f66') params[:image].rectangle(params[:subject_width] + coords[:bar_start], params[:top], params[:subject_width] + coords[:bar_late_end], params[:top] - height) diff --git a/lib/redmine/hook.rb b/lib/redmine/hook.rb index 42a42fdf..c5b92459 100644 --- a/lib/redmine/hook.rb +++ b/lib/redmine/hook.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 Redmine @@listener_classes = [] @@listeners = nil @@hook_listeners = {} - + class << self # Adds a listener class. # Automatically called when a class inherits from Redmine::Hook::Listener. @@ -27,29 +27,29 @@ module Redmine @@listener_classes << klass clear_listeners_instances end - + # Returns all the listerners instances. def listeners @@listeners ||= @@listener_classes.collect {|listener| listener.instance} end - + # Returns the listeners instances for the given hook. def hook_listeners(hook) @@hook_listeners[hook] ||= listeners.select {|listener| listener.respond_to?(hook)} end - + # Clears all the listeners. def clear_listeners @@listener_classes = [] clear_listeners_instances end - + # Clears all the listeners instances. def clear_listeners_instances @@listeners = nil @@hook_listeners = {} end - + # Calls a hook. # Returns the listeners response. def call_hook(hook, context={}) @@ -97,11 +97,11 @@ module Redmine def self.default_url_options {:only_path => true } end - + # Helper method to directly render a partial using the context: - # + # # class MyHook < Redmine::Hook::ViewListener - # render_on :view_issues_show_details_bottom, :partial => "show_more_data" + # render_on :view_issues_show_details_bottom, :partial => "show_more_data" # end # def self.render_on(hook, options={}) @@ -113,23 +113,23 @@ module Redmine # Helper module included in ApplicationHelper and ActionControllerso that # hooks can be called in views like this: - # + # # <%= call_hook(:some_hook) %> # <%= call_hook(:another_hook, :foo => 'bar' %> - # + # # Or in controllers like: # call_hook(:some_hook) # call_hook(:another_hook, :foo => 'bar' - # + # # Hooks added to views will be concatenated into a string. Hooks added to # controllers will return an array of results. # # Several objects are automatically added to the call context: - # + # # * project => current project # * request => Request instance # * controller => current Controller instance - # + # module Helper def call_hook(hook, context={}) if is_a?(ActionController::Base) @@ -138,7 +138,7 @@ module Redmine else default_context = {:controller => controller, :project => @project, :request => request} Redmine::Hook.call_hook(hook, default_context.merge(context)).join(' ') - end + end end end end diff --git a/lib/redmine/i18n.rb b/lib/redmine/i18n.rb index 8b4a36c9..3b4dc4ff 100644 --- a/lib/redmine/i18n.rb +++ b/lib/redmine/i18n.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. #++ @@ -16,7 +16,7 @@ module Redmine def self.included(base) base.extend Redmine::I18n end - + def l(*args) case args.size when 1 @@ -38,12 +38,12 @@ module Redmine k = "#{options[:prefix]}#{s}".to_sym ::I18n.t(k, :default => s.to_s.humanize) end - + def l_hours(hours) hours = hours.to_f l((hours < 2.0 ? :label_f_hour : :label_f_hour_plural), :value => ("%.2f" % hours.to_f)) end - + def ll(lang, str, value=nil) ::I18n.t(str.to_s, :value => value, :locale => lang.to_s.gsub(%r{(.+)\-(.+)$}) { "#{$1}-#{$2.upcase}" }) end @@ -52,7 +52,7 @@ module Redmine return nil unless date Setting.date_format.blank? ? ::I18n.l(date.to_date) : date.strftime(Setting.date_format) end - + def format_time(time, include_date = true) return nil unless time time = time.to_time if time.is_a?(String) @@ -65,26 +65,26 @@ module Redmine def day_name(day) ::I18n.t('date.day_names')[day % 7] end - + def month_name(month) ::I18n.t('date.month_names')[month] end - + def valid_languages @@valid_languages ||= Dir.glob(File.join(RAILS_ROOT, 'config', 'locales', '*.yml')).collect {|f| File.basename(f).split('.').first}.collect(&:to_sym) end - + def find_language(lang) @@languages_lookup = valid_languages.inject({}) {|k, v| k[v.to_s.downcase] = v; k } @@languages_lookup[lang.to_s.downcase] end - + def set_language_if_valid(lang) if l = find_language(lang) ::I18n.locale = l end end - + def current_language ::I18n.locale end diff --git a/lib/redmine/imap.rb b/lib/redmine/imap.rb index 9756191e..d509062d 100644 --- a/lib/redmine/imap.rb +++ b/lib/redmine/imap.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,8 +21,8 @@ module Redmine port = imap_options[:port] || '143' ssl = !imap_options[:ssl].nil? folder = imap_options[:folder] || 'INBOX' - - imap = Net::IMAP.new(host, port, ssl) + + imap = Net::IMAP.new(host, port, ssl) imap.login(imap_options[:username], imap_options[:password]) unless imap_options[:username].nil? imap.select(folder) imap.search(['NOT', 'SEEN']).each do |message_id| @@ -45,9 +45,9 @@ module Redmine end imap.expunge end - + private - + def logger RAILS_DEFAULT_LOGGER end diff --git a/lib/redmine/info.rb b/lib/redmine/info.rb index 3ed0067e..c2a7e357 100644 --- a/lib/redmine/info.rb +++ b/lib/redmine/info.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/lib/redmine/menu_manager.rb b/lib/redmine/menu_manager.rb index 17c11e18..4beb21ca 100644 --- a/lib/redmine/menu_manager.rb +++ b/lib/redmine/menu_manager.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 @@ module Redmine::MenuManager mapper end end - + def self.items(menu_name) @items[menu_name.to_sym] || Redmine::MenuManager::TreeNode.new(:root, {}) end diff --git a/lib/redmine/menu_manager/mapper.rb b/lib/redmine/menu_manager/mapper.rb index 172f7d8d..77e2248b 100644 --- a/lib/redmine/menu_manager/mapper.rb +++ b/lib/redmine/menu_manager/mapper.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,9 +17,9 @@ class Redmine::MenuManager::Mapper @menu = menu @menu_items = items[menu] end - + @@last_items_count = Hash.new {|h,k| h[k] = 0} - + # Adds an item at the end of the menu. Available options: # * param: the parameter name that is used for the project id (default is :id) # * if: a Proc that is called before rendering the item, the item is displayed only if it returns true @@ -66,14 +66,14 @@ class Redmine::MenuManager::Mapper else target_root.add(Redmine::MenuManager::MenuItem.new(name, url, options)) end - + elsif options[:last] # don't delete, needs to be stored target_root.add_last(Redmine::MenuManager::MenuItem.new(name, url, options)) else target_root.add(Redmine::MenuManager::MenuItem.new(name, url, options)) end end - + # Removes a menu item def delete(name) if found = self.find(name) diff --git a/lib/redmine/menu_manager/menu_controller.rb b/lib/redmine/menu_manager/menu_controller.rb index e3acb50b..56513e68 100644 --- a/lib/redmine/menu_manager/menu_controller.rb +++ b/lib/redmine/menu_manager/menu_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,13 +19,13 @@ module Redmine::MenuManager::MenuController module ClassMethods @@menu_items = Hash.new {|hash, key| hash[key] = {:default => key, :actions => {}}} mattr_accessor :menu_items - + # Set the menu item name for a controller or specific actions # Examples: # * menu_item :tickets # => sets the menu name to :tickets for the whole controller # * menu_item :tickets, :only => :list # => sets the menu name to :tickets for the 'list' action only # * menu_item :tickets, :only => [:list, :show] # => sets the menu name to :tickets for 2 actions only - # + # # The default menu item name for a controller is controller_name by default # Eg. the default menu item name for ProjectsController is :projects def menu_item(id, options = {}) @@ -37,17 +37,17 @@ module Redmine::MenuManager::MenuController end end end - + def menu_items self.class.menu_items end - + # Returns the menu item name according to the current action def current_menu_item @current_menu_item ||= menu_items[controller_name.to_sym][:actions][action_name.to_sym] || menu_items[controller_name.to_sym][:default] end - + # Redirects user to the menu item of the given project # Returns false if user is not authorized def redirect_to_project_menu_item(project, name) diff --git a/lib/redmine/menu_manager/menu_error.rb b/lib/redmine/menu_manager/menu_error.rb index d33e0e32..16279b5f 100644 --- a/lib/redmine/menu_manager/menu_error.rb +++ b/lib/redmine/menu_manager/menu_error.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/lib/redmine/menu_manager/menu_helper.rb b/lib/redmine/menu_manager/menu_helper.rb index e77e8513..3053693a 100644 --- a/lib/redmine/menu_manager/menu_helper.rb +++ b/lib/redmine/menu_manager/menu_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. #++ @@ -16,12 +16,12 @@ module Redmine::MenuManager::MenuHelper def current_menu_item @controller.current_menu_item end - + # Renders the application main menu def render_main_menu(project) render_menu((project && !project.new_record?) ? :project_menu : :application_menu, project) end - + def display_main_menu?(project) menu_name = project && !project.new_record? ? :project_menu : :application_menu Redmine::MenuManager.items(menu_name).size > 1 # 1 element is the root @@ -80,7 +80,7 @@ module Redmine::MenuManager::MenuHelper # Tree nodes support #each so we need to do object detection if unattached_children.is_a? Array unattached_children.each do |child| - child_html << content_tag(:li, render_unattached_menu_item(child, project)) + child_html << content_tag(:li, render_unattached_menu_item(child, project)) end else raise Redmine::MenuManager::MenuError, ":child_menus must be an array of MenuItems" @@ -101,7 +101,7 @@ module Redmine::MenuManager::MenuHelper menu_item.html_options) end end - + def menu_items_for(menu, project=nil) items = [] Redmine::MenuManager.items(menu).root.children.each do |node| diff --git a/lib/redmine/menu_manager/menu_item.rb b/lib/redmine/menu_manager/menu_item.rb index 680d6edf..f2608456 100644 --- a/lib/redmine/menu_manager/menu_item.rb +++ b/lib/redmine/menu_manager/menu_item.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 Redmine::MenuManager::MenuItem < Redmine::MenuManager::TreeNode include Redmine::I18n attr_reader :name, :url, :param, :condition, :parent, :child_menus, :last - + def initialize(name, url, options) raise ArgumentError, "Invalid option :if for menu item '#{name}'" if options[:if] && !options[:if].respond_to?(:call) raise ArgumentError, "Invalid option :html for menu item '#{name}'" if options[:html] && !options[:html].is_a?(Hash) @@ -33,7 +33,7 @@ class Redmine::MenuManager::MenuItem < Redmine::MenuManager::TreeNode @last = options[:last] || false super @name.to_sym end - + def caption(project=nil) if @caption.is_a?(Proc) c = @caption.call(project).to_s @@ -47,7 +47,7 @@ class Redmine::MenuManager::MenuItem < Redmine::MenuManager::TreeNode end end end - + def html_options(options={}) if options[:selected] o = @html_options.dup @@ -57,4 +57,4 @@ class Redmine::MenuManager::MenuItem < Redmine::MenuManager::TreeNode @html_options end end -end +end diff --git a/lib/redmine/menu_manager/tree_node.rb b/lib/redmine/menu_manager/tree_node.rb index a6a149bb..94cd2260 100644 --- a/lib/redmine/menu_manager/tree_node.rb +++ b/lib/redmine/menu_manager/tree_node.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/lib/redmine/mime_type.rb b/lib/redmine/mime_type.rb index 2eb09b08..51d25e65 100644 --- a/lib/redmine/mime_type.rb +++ b/lib/redmine/mime_type.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. #++ @@ -58,36 +58,36 @@ module Redmine 'application/zip' => 'zip', 'application/x-gzip' => 'gz', }.freeze - + EXTENSIONS = MIME_TYPES.inject({}) do |map, (type, exts)| exts.split(',').each {|ext| map[ext.strip] = type} map end - + # returns mime type for name or nil if unknown def self.of(name) return nil unless name m = name.to_s.match(/(^|\.)([^\.]+)$/) EXTENSIONS[m[2].downcase] if m end - + # Returns the css class associated to # the mime type of name def self.css_class_of(name) mime = of(name) mime && mime.gsub('/', '-') end - + def self.main_mimetype_of(name) mimetype = of(name) mimetype.split('/').first if mimetype end - + # return true if mime-type for name is type/* # otherwise false def self.is_type?(type, name) main_mimetype = main_mimetype_of(name) type.to_s == main_mimetype - end + end end end diff --git a/lib/redmine/notifiable.rb b/lib/redmine/notifiable.rb index 4ca9c09d..c959d3c2 100644 --- a/lib/redmine/notifiable.rb +++ b/lib/redmine/notifiable.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,7 +17,7 @@ module Redmine def to_s name end - + # TODO: Plugin API for adding a new notification? def self.all notifications = [] diff --git a/lib/redmine/platform.rb b/lib/redmine/platform.rb index 51b18920..1ed3a987 100644 --- a/lib/redmine/platform.rb +++ b/lib/redmine/platform.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/lib/redmine/plugin.rb b/lib/redmine/plugin.rb index 5f0860cc..5fdbb2f3 100644 --- a/lib/redmine/plugin.rb +++ b/lib/redmine/plugin.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,10 +15,10 @@ module Redmine #:nodoc: class PluginNotFound < StandardError; end class PluginRequirementError < StandardError; end - + # Base class for Redmine plugins. # Plugins are registered using the register class method that acts as the public constructor. - # + # # Redmine::Plugin.register :example do # name 'Example plugin' # author 'John Smith' @@ -26,9 +26,9 @@ module Redmine #:nodoc: # version '0.0.1' # settings :default => {'foo'=>'bar'}, :partial => 'settings/settings' # end - # + # # === Plugin attributes - # + # # +settings+ is an optional attribute that let the plugin be configurable. # It must be a hash with the following keys: # * :default: default value for the plugin settings @@ -36,7 +36,7 @@ module Redmine #:nodoc: # Example: # settings :default => {'foo'=>'bar'}, :partial => 'settings/settings' # In this example, the settings partial will be found here in the plugin directory: app/views/settings/_settings.rhtml. - # + # # When rendered, the plugin settings value is available as the local variable +settings+ class Plugin @registered_plugins = {} @@ -45,9 +45,9 @@ module Redmine #:nodoc: private :new def def_field(*names) - class_eval do + class_eval do names.each do |name| - define_method(name) do |*args| + define_method(name) do |*args| args.empty? ? instance_variable_get("@#{name}") : instance_variable_set("@#{name}", *args) end end @@ -56,7 +56,7 @@ module Redmine #:nodoc: end def_field :name, :description, :url, :author, :author_url, :version, :settings attr_reader :id - + # Plugin constructor def self.register(id, &block) p = new(id) @@ -68,18 +68,18 @@ module Redmine #:nodoc: ::I18n.load_path += Dir.glob(File.join(RAILS_ROOT, 'vendor', 'plugins', id.to_s, 'config', 'locales', '*.yml')) registered_plugins[id] = p end - + # Returns an array off all registered plugins def self.all registered_plugins.values.sort end - + # Finds a plugin by its id # Returns a PluginNotFound exception if the plugin doesn't exist def self.find(id) registered_plugins[id.to_sym] || raise(PluginNotFound) end - + # Clears the registered plugins hash # It doesn't unload installed plugins def self.clear @@ -92,15 +92,15 @@ module Redmine #:nodoc: def self.installed?(id) registered_plugins[id.to_sym].present? end - + def initialize(id) @id = id.to_sym end - + def <=>(plugin) self.id.to_s <=> plugin.id.to_s end - + # Sets a requirement on Redmine version # Raises a PluginRequirementError exception if the requirement is not met # @@ -115,7 +115,7 @@ module Redmine #:nodoc: def requires_redmine(arg) arg = { :version_or_higher => arg } unless arg.is_a?(Hash) arg.assert_valid_keys(:version, :version_or_higher) - + current = Redmine::VERSION.to_a arg.each do |k, v| v = [] << v unless v.is_a?(Array) @@ -174,39 +174,39 @@ module Redmine #:nodoc: # Adds an item to the given +menu+. # The +id+ parameter (equals to the project id) is automatically added to the url. # menu :project_menu, :plugin_example, { :controller => 'example', :action => 'say_hello' }, :caption => 'Sample' - # + # # +name+ parameter can be: :top_menu, :account_menu, :application_menu or :project_menu - # + # def menu(menu, item, url, options={}) Redmine::MenuManager.map(menu).push(item, url, options) end alias :add_menu_item :menu - + # Removes +item+ from the given +menu+. def delete_menu_item(menu, item) Redmine::MenuManager.map(menu).delete(item) end # Defines a permission called +name+ for the given +actions+. - # + # # The +actions+ argument is a hash with controllers as keys and actions as values (a single value or an array): # permission :destroy_contacts, { :contacts => :destroy } # permission :view_contacts, { :contacts => [:index, :show] } - # + # # The +options+ argument can be used to make the permission public (implicitly given to any user) # or to restrict users the permission can be given to. - # + # # Examples # # A permission that is implicitly given to any user # # This permission won't appear on the Roles & Permissions setup screen # permission :say_hello, { :example => :say_hello }, :public => true - # + # # # A permission that can be given to any user # permission :say_hello, { :example => :say_hello } - # + # # # A permission that can be given to registered users only # permission :say_hello, { :example => :say_hello }, :require => :loggedin - # + # # # A permission that can be given to project members only # permission :say_hello, { :example => :say_hello }, :require => :member def permission(name, actions, options = {}) @@ -216,10 +216,10 @@ module Redmine #:nodoc: Redmine::AccessControl.map {|map| map.permission(name, actions, options)} end end - + # Defines a project module, that can be enabled/disabled for each project. # Permissions defined inside +block+ will be bind to the module. - # + # # project_module :things do # permission :view_contacts, { :contacts => [:list, :show] }, :public => true # permission :destroy_contacts, { :contacts => :destroy } @@ -229,33 +229,33 @@ module Redmine #:nodoc: self.instance_eval(&block) @project_module = nil end - + # Registers an activity provider. # # Options: # * :class_name - one or more model(s) that provide these events (inferred from event_type by default) # * :default - setting this option to false will make the events not displayed by default - # + # # A model can provide several activity event types. - # + # # Examples: # register :news # register :scrums, :class_name => 'Meeting' # register :issues, :class_name => ['Issue', 'Journal'] - # + # # Retrieving events: # Associated model(s) must implement the find_events class method. # ActiveRecord models can use acts_as_activity_provider as a way to implement this class method. - # - # The following call should return all the scrum events visible by current user that occured in the 5 last days: + # + # The following call should return all the scrum events visible by current user that occured in the 5 last days: # Meeting.find_events('scrums', User.current, 5.days.ago, Date.today) # Meeting.find_events('scrums', User.current, 5.days.ago, Date.today, :project => foo) # events for project foo only - # + # # Note that :view_scrums permission is required to view these events in the activity view. def activity_provider(*args) Redmine::Activity.register(*args) end - + # Registers a wiki formatter. # # Parameters: diff --git a/lib/redmine/pop3.rb b/lib/redmine/pop3.rb index 3e2d5c66..33dadac3 100644 --- a/lib/redmine/pop3.rb +++ b/lib/redmine/pop3.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. #++ @@ -47,7 +47,7 @@ module Redmine end end end - + private def logger diff --git a/lib/redmine/safe_attributes.rb b/lib/redmine/safe_attributes.rb index 0bdfbd86..a9673aa5 100644 --- a/lib/redmine/safe_attributes.rb +++ b/lib/redmine/safe_attributes.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. #++ @@ -16,7 +16,7 @@ module Redmine def self.included(base) base.extend(ClassMethods) end - + module ClassMethods # Declares safe attributes # An optional Proc can be given for conditional inclusion @@ -54,10 +54,10 @@ module Redmine end names.uniq end - + # Returns a hash with unsafe attributes removed # from the given attrs hash - # + # # Example: # book.delete_unsafe_attributes({'title' => 'My book', 'foo' => 'bar'}) # # => {'title' => 'My book'} @@ -65,7 +65,7 @@ module Redmine safe = safe_attribute_names(user) attrs.dup.delete_if {|k,v| !safe.include?(k.to_s)} end - + # Sets attributes from attrs that are safe # attrs is a Hash with string keys def safe_attributes=(attrs, user=User.current) diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb index b720d910..51926180 100644 --- a/lib/redmine/scm/adapters/abstract_adapter.rb +++ b/lib/redmine/scm/adapters/abstract_adapter.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. #++ @@ -86,12 +86,12 @@ module Redmine def url @url end - + # get info about the svn repository def info return nil end - + # Returns the entry identified by path and revision identifier # or nil if entry doesn't exist in the repository def entry(path=nil, identifier=nil) @@ -107,7 +107,7 @@ module Redmine es ? es.detect {|e| e.name == search_name} : nil end end - + # Returns an Entries collection # or nil if the given path doesn't exist in the repository def entries(path=nil, identifier=nil) @@ -118,30 +118,30 @@ module Redmine return nil end - def tags + def tags return nil end def default_branch return nil end - + def properties(path, identifier=nil) return nil end - + def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={}) return nil end - + def diff(path, identifier_from, identifier_to=nil) return nil end - + def cat(path, identifier=nil) return nil end - + def with_leading_slash(path) path ||= '' (path[0,1]!="/") ? "/#{path}" : path @@ -171,7 +171,7 @@ module Redmine info = self.info info ? info.root_url : nil end - + def target(path) path ||= '' base = path.match(/^\//) ? root_url : url @@ -219,7 +219,7 @@ module Redmine q = (Redmine::Platform.mswin? ? '"' : "'") cmd.to_s.gsub(/(\-\-(password|username))\s+(#{q}[^#{q}]+#{q}|[^#{q}]\S+)/, '\\1 xxxx') end - + def strip_credential(cmd) self.class.strip_credential(cmd) end @@ -238,7 +238,7 @@ module Redmine class Entries < Array def sort_by_name - sort {|x,y| + sort {|x,y| if x.kind == y.kind x.name.to_s <=> y.name.to_s else @@ -246,12 +246,12 @@ module Redmine end } end - + def revisions revisions ||= Revisions.new(collect{|entry| entry.lastrev}.compact) end end - + class Info attr_accessor :root_url, :lastrev def initialize(attributes={}) @@ -259,7 +259,7 @@ module Redmine self.lastrev = attributes[:lastrev] end end - + class Entry attr_accessor :name, :path, :kind, :size, :lastrev def initialize(attributes={}) @@ -269,20 +269,20 @@ module Redmine self.size = attributes[:size].to_i if attributes[:size] self.lastrev = attributes[:lastrev] end - + def is_file? 'file' == self.kind end - + def is_dir? 'dir' == self.kind end - + def is_text? Redmine::MimeType.is_type?('text', name) end end - + class Revisions < Array def latest sort {|x,y| @@ -292,9 +292,9 @@ module Redmine 0 end }.last - end + end end - + class Revision attr_accessor :scmid, :name, :author, :time, :message, :paths, :revision, :branch attr_writer :identifier @@ -324,21 +324,21 @@ module Redmine class Annotate attr_reader :lines, :revisions - + def initialize @lines = [] @revisions = [] end - + def add_line(line, revision) @lines << line @revisions << revision end - + def content content = lines.join("\n") end - + def empty? lines.empty? end diff --git a/lib/redmine/scm/adapters/bazaar_adapter.rb b/lib/redmine/scm/adapters/bazaar_adapter.rb index 4525f422..bff38ce4 100644 --- a/lib/redmine/scm/adapters/bazaar_adapter.rb +++ b/lib/redmine/scm/adapters/bazaar_adapter.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. #++ @@ -78,8 +78,8 @@ module Redmine path ||= '' entries = Entries.new cmd = "#{self.class.sq_bin} ls -v --show-ids" - identifier = -1 unless identifier && identifier.to_i > 0 - cmd << " -r#{identifier.to_i}" + identifier = -1 unless identifier && identifier.to_i > 0 + cmd << " -r#{identifier.to_i}" cmd << " #{target(path)}" shellout(cmd) do |io| prefix = "#{url}/#{path}".gsub('\\', '/') @@ -116,7 +116,7 @@ module Redmine parsing = nil else next unless revision - + if line =~ /^revno: (\d+)($|\s\[merge\]$)/ revision.identifier = $1.to_i elsif line =~ /^committer: (.+)$/ @@ -164,7 +164,7 @@ module Redmine def diff(path, identifier_from, identifier_to=nil) path ||= '' if identifier_to - identifier_to = identifier_to.to_i + identifier_to = identifier_to.to_i else identifier_to = identifier_from.to_i - 1 end diff --git a/lib/redmine/scm/adapters/cvs_adapter.rb b/lib/redmine/scm/adapters/cvs_adapter.rb index cfc72b3c..dfab8668 100644 --- a/lib/redmine/scm/adapters/cvs_adapter.rb +++ b/lib/redmine/scm/adapters/cvs_adapter.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. #++ @@ -156,11 +156,11 @@ module Redmine path_with_project="#{url}#{with_leading_slash(path)}" cmd_args = %w|rlog| - cmd_args << "-d" << ">#{time_to_cvstime_rlog(identifier_from)}" if identifier_from + cmd_args << "-d" << ">#{time_to_cvstime_rlog(identifier_from)}" if identifier_from cmd_args << path_with_project scm_cmd(*cmd_args) do |io| state="entry_start" - + commit_log=String.new revision=nil date=nil @@ -169,15 +169,15 @@ module Redmine entry_name=nil file_state=nil branch_map=nil - + io.each_line() do |line| - + if state!="revision" && /^#{ENDLOG}/ =~ line commit_log=String.new revision=nil state="entry_start" end - + if state=="entry_start" branch_map=Hash.new if /^RCS file: #{Regexp.escape(root_url_path)}\/#{Regexp.escape(path_with_project)}(.+),v$/ =~ line @@ -191,15 +191,15 @@ module Redmine elsif /^#{STARTLOG}/ =~ line commit_log=String.new state="revision" - end + end next elsif state=="symbolic" - if /^(.*):\s(.*)/ =~ (line.strip) + if /^(.*):\s(.*)/ =~ (line.strip) branch_map[$1]=$2 else state="tags" next - end + end elsif state=="tags" if /^#{STARTLOG}/ =~ line commit_log = "" @@ -214,15 +214,15 @@ module Redmine revHelper=CvsRevisionHelper.new(revision) revBranch="HEAD" - + branch_map.each() do |branch_name,branch_point| if revHelper.is_in_branch_with_symbol(branch_point) revBranch=branch_name end end - + logger.debug("********** YIELD Revision #{revision}::#{revBranch}") - + yield Revision.new({ :time => date, :author => author, @@ -240,7 +240,7 @@ module Redmine commit_log=String.new revision=nil - + if /^#{ENDLOG}/ =~ line state="entry_start" end @@ -250,7 +250,7 @@ module Redmine if /^branches: (.+)$/ =~ line #TODO: version.branch = $1 elsif /^revision (\d+(?:\.\d+)+).*$/ =~ line - revision = $1 + revision = $1 elsif /^date:\s+(\d+.\d+.\d+\s+\d+:\d+:\d+)/ =~ line date = Time.parse($1) author = /author: ([^;]+)/.match(line)[1] @@ -334,7 +334,7 @@ module Redmine def time_to_cvstime(time) return nil if time.nil? return Time.now if time == 'HEAD' - + unless time.kind_of? Time time = Time.parse(time) end @@ -346,14 +346,14 @@ module Redmine t1 = time.clone.localtime return t1.strftime("%Y-%m-%d %H:%M:%S") end - + def normalize_cvs_path(path) normalize_path(path.gsub(/Attic\//,'')) end - + def normalize_path(path) path.sub(/^(\/)*(.*)/,'\2').sub(/(.*)(,v)+/,'\1') - end + end def scm_cmd(*args, &block) full_args = [CVS_BIN, '-d', root_url] @@ -365,44 +365,44 @@ module Redmine ret end private :scm_cmd - end + end class CvsRevisionHelper attr_accessor :complete_rev, :revision, :base, :branchid - + def initialize(complete_rev) @complete_rev = complete_rev parseRevision() end - + def branchPoint return @base end - + def branchVersion if isBranchRevision return @base+"."+@branchid end return @base end - + def isBranchRevision !@branchid.nil? end - + def prevRev unless @revision==0 return buildRevision(@revision-1) end - return buildRevision(@revision) + return buildRevision(@revision) end - + def is_in_branch_with_symbol(branch_symbol) bpieces=branch_symbol.split(".") branch_start="#{bpieces[0..-3].join(".")}.#{bpieces[-1]}" return (branchVersion==branch_start) end - + private def buildRevision(rev) if rev== 0 @@ -411,13 +411,13 @@ module Redmine else @base end - elsif @branchid.nil? + elsif @branchid.nil? @base+"."+rev.to_s else @base+"."+@branchid+"."+rev.to_s end end - + # Interpretiert die cvs revisionsnummern wie z.b. 1.14 oder 1.3.0.15 def parseRevision() pieces=@complete_rev.split(".") @@ -427,7 +427,7 @@ module Redmine @base=pieces[0..-baseSize].join(".") if baseSize > 2 @branchid=pieces[-2] - end + end end end end diff --git a/lib/redmine/scm/adapters/darcs_adapter.rb b/lib/redmine/scm/adapters/darcs_adapter.rb index 6a20337b..6af646c9 100644 --- a/lib/redmine/scm/adapters/darcs_adapter.rb +++ b/lib/redmine/scm/adapters/darcs_adapter.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/lib/redmine/scm/adapters/filesystem_adapter.rb b/lib/redmine/scm/adapters/filesystem_adapter.rb index 9717889f..96402585 100644 --- a/lib/redmine/scm/adapters/filesystem_adapter.rb +++ b/lib/redmine/scm/adapters/filesystem_adapter.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. #++ @@ -32,10 +32,10 @@ module Redmine end def format_path_ends(path, leading=true, trailling=true) - path = leading ? with_leading_slash(path) : + path = leading ? with_leading_slash(path) : without_leading_slash(path) - trailling ? with_trailling_slash(path) : - without_trailling_slash(path) + trailling ? with_trailling_slash(path) : + without_trailling_slash(path) end def info @@ -53,7 +53,7 @@ module Redmine trgt = scm_iconv(@path_encoding, 'UTF-8', trgt_utf8) Dir.new(trgt).each do |e1| e_utf8 = scm_iconv('UTF-8', @path_encoding, e1) - next if e_utf8.blank? + next if e_utf8.blank? relative_path_utf8 = format_path_ends( (format_path_ends(path,false,true) + e_utf8),false,false) t1_utf8 = target(relative_path_utf8) @@ -71,7 +71,7 @@ module Redmine :path => utf_8_path, :kind => (File.directory?(t1) ? 'dir' : 'file'), :size => (File.directory?(t1) ? nil : [File.size(t1)].pack('l').unpack('L').first), - :lastrev => + :lastrev => Revision.new({:time => (File.mtime(t1)) }) }) end diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb index 149a6542..641eedbb 100644 --- a/lib/redmine/scm/adapters/git_adapter.rb +++ b/lib/redmine/scm/adapters/git_adapter.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. #++ @@ -140,7 +140,7 @@ module Redmine def lastrev(path, rev) return nil if path.nil? cmd_args = %w|log --no-color --encoding=UTF-8 --date=iso --pretty=fuller --no-merges -n 1| - cmd_args << rev if rev + cmd_args << rev if rev cmd_args << "--" << path unless path.empty? lines = [] scm_cmd(*cmd_args) { |io| lines = io.readlines } @@ -152,10 +152,10 @@ module Redmine Revision.new({ :identifier => id, :scmid => id, - :author => author, + :author => author, :time => time, - :message => nil, - :paths => nil + :message => nil, + :paths => nil }) rescue NoMethodError => e logger.error("The revision '#{path}' has a wrong format") diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb index 5c290756..63bbbbb8 100644 --- a/lib/redmine/scm/adapters/mercurial_adapter.rb +++ b/lib/redmine/scm/adapters/mercurial_adapter.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. #++ @@ -114,7 +114,7 @@ module Redmine end def summary - return @summary if @summary + return @summary if @summary hg 'rhsummary' do |io| output = io.read if output.respond_to?(:force_encoding) diff --git a/lib/redmine/scm/adapters/subversion_adapter.rb b/lib/redmine/scm/adapters/subversion_adapter.rb index 5106370a..89b8e8ec 100644 --- a/lib/redmine/scm/adapters/subversion_adapter.rb +++ b/lib/redmine/scm/adapters/subversion_adapter.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. #++ @@ -66,7 +66,7 @@ module Redmine end begin doc = ActiveSupport::XmlMini.parse(output) - #root_url = doc.elements["info/entry/repository/root"].text + #root_url = doc.elements["info/entry/repository/root"].text info = Info.new({:root_url => doc['info']['entry']['repository']['root']['__content__'], :lastrev => Revision.new({ :identifier => doc['info']['entry']['commit']['revision'], @@ -129,7 +129,7 @@ module Redmine def properties(path, identifier=nil) # proplist xml output supported in svn 1.5.0 and higher return nil unless self.class.client_version_above?([1, 5, 0]) - + identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD" cmd = "#{self.class.sq_bin} proplist --verbose --xml #{target(path)}@#{identifier}" cmd << credentials_string @@ -178,7 +178,7 @@ module Redmine } end if logentry['paths'] && logentry['paths']['path'] paths.sort! { |x,y| x[:path] <=> y[:path] } - + revisions << Revision.new({:identifier => logentry['revision'], :author => (logentry['author'] ? logentry['author']['__content__'] : ""), :time => Time.parse(logentry['date']['__content__'].to_s).localtime, @@ -241,9 +241,9 @@ module Redmine return nil if $? && $?.exitstatus != 0 blame end - + private - + def credentials_string str = '' str << " --username #{shell_quote(@login)}" unless @login.blank? @@ -251,7 +251,7 @@ module Redmine str << " --no-auth-cache --non-interactive" str end - + # Helper that iterates over the child elements of a xml node # MiniXml returns a hash when a single child is found or an array of hashes for multiple children def each_xml_element(node, name) diff --git a/lib/redmine/scm/base.rb b/lib/redmine/scm/base.rb index 4ae88ec8..195769b9 100644 --- a/lib/redmine/scm/base.rb +++ b/lib/redmine/scm/base.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/lib/redmine/search.rb b/lib/redmine/search.rb index 91ff892a..17bfc974 100644 --- a/lib/redmine/search.rb +++ b/lib/redmine/search.rb @@ -1,35 +1,35 @@ #-- 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 Redmine module Search - + mattr_accessor :available_search_types - + @@available_search_types = [] class << self def map(&block) yield self end - + # Registers a search provider def register(search_type, options={}) search_type = search_type.to_s @@available_search_types << search_type unless @@available_search_types.include?(search_type) end end - + module Controller def self.included(base) base.extend(ClassMethods) @@ -38,7 +38,7 @@ module Redmine module ClassMethods @@default_search_scopes = Hash.new {|hash, key| hash[key] = {:default => nil, :actions => {}}} mattr_accessor :default_search_scopes - + # Set the default search scope for a controller or specific actions # Examples: # * search_scope :issues # => sets the search scope to :issues for the whole controller diff --git a/lib/redmine/syntax_highlighting.rb b/lib/redmine/syntax_highlighting.rb index 79356939..ff16b967 100644 --- a/lib/redmine/syntax_highlighting.rb +++ b/lib/redmine/syntax_highlighting.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. #++ module Redmine module SyntaxHighlighting - + class << self attr_reader :highlighter delegate :highlight_by_filename, :highlight_by_language, :to => :highlighter - + def highlighter=(name) if name.is_a?(Module) @highlighter = name @@ -26,11 +26,11 @@ module Redmine end end end - + module CodeRay require 'coderay' require 'coderay/helpers/file_type' - + class << self # Highlights +text+ as the content of +filename+ # Should not return line numbers nor outer pre tag @@ -38,7 +38,7 @@ module Redmine language = ::CodeRay::FileType[filename] language ? ::CodeRay.scan(text, language).html : ERB::Util.h(text) end - + # Highlights +text+ using +language+ syntax # Should not return outer pre tag def highlight_by_language(text, language) @@ -47,6 +47,6 @@ module Redmine end end end - + SyntaxHighlighting.highlighter = 'CodeRay' end diff --git a/lib/redmine/themes.rb b/lib/redmine/themes.rb index 2844be97..a30c8307 100644 --- a/lib/redmine/themes.rb +++ b/lib/redmine/themes.rb @@ -1,33 +1,33 @@ #-- 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 Redmine module Themes - + # Return an array of installed themes def self.themes @@installed_themes ||= scan_themes end - + # Rescan themes directory def self.rescan @@installed_themes = scan_themes end - + # Return theme for given id, or nil if it's not found def self.theme(id, options={}) return nil if id.blank? - + found = themes.find {|t| t.id == id} if found.nil? && options[:rescan] != false rescan @@ -35,11 +35,11 @@ module Redmine end found end - + # Class used to represent a theme class Theme attr_reader :path, :name, :dir - + def initialize(path) @path = path @dir = File.basename(path) @@ -47,43 +47,43 @@ module Redmine @stylesheets = nil @javascripts = nil end - + # Directory name used as the theme id def id; dir end - + def ==(theme) theme.is_a?(Theme) && theme.dir == dir end - + def <=>(theme) name <=> theme.name end - + def stylesheets @stylesheets ||= assets("stylesheets", "css") end - + def javascripts @javascripts ||= assets("javascripts", "js") end - + def stylesheet_path(source) "/themes/#{dir}/stylesheets/#{source}" end - + def javascript_path(source) "/themes/#{dir}/javascripts/#{source}" end - + private - + def assets(dir, ext) Dir.glob("#{path}/#{dir}/*.#{ext}").collect {|f| File.basename(f).gsub(/\.#{ext}$/, '')} end end - + private - + def self.scan_themes theme_paths.inject([]) do |themes, path| dirs = Dir.glob(File.join(path, '*')).select do |f| @@ -112,7 +112,7 @@ module ApplicationHelper end @current_theme end - + def stylesheet_path(source) if current_theme && current_theme.stylesheets.include?(source) super current_theme.stylesheet_path(source) @@ -120,11 +120,11 @@ module ApplicationHelper super end end - + def path_to_stylesheet(source) stylesheet_path source end - + # Returns the header tags for the current theme def heads_for_theme if current_theme && current_theme.javascripts.include?('theme') diff --git a/lib/redmine/unified_diff.rb b/lib/redmine/unified_diff.rb index 7ef948b7..7d4cd1c2 100644 --- a/lib/redmine/unified_diff.rb +++ b/lib/redmine/unified_diff.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 @@ module Redmine # Class used to parse unified diffs class UnifiedDiff < Array attr_reader :diff_type - + def initialize(diff, options={}) options.assert_valid_keys(:type, :max_lines) diff = diff.split("\n") if diff.is_a?(String) @@ -51,7 +51,7 @@ module Redmine end # Class that represents a file diff - class DiffTable < Array + class DiffTable < Array attr_reader :file_name # Initialize with a Diff file and the type of Diff View @@ -82,12 +82,12 @@ module Redmine @line_num_l = $2.to_i @line_num_r = $5.to_i else - parse_line(line, @type) + parse_line(line, @type) end end return true end - + def each_line prev_line_left, prev_line_right = nil, nil each do |line| @@ -112,7 +112,7 @@ module Redmine def escapeHTML(line) CGI.escapeHTML(line) end - + def diff_for_added_line if @type == 'sbs' && @removed > 0 && @added < @removed self[-(@removed - @added)] @@ -160,7 +160,7 @@ module Redmine end end end - + def write_offsets if @added > 0 && @added == @removed @added.times do |i| @@ -173,7 +173,7 @@ module Redmine @added = 0 @removed = 0 end - + def offsets(line_left, line_right) if line_left.present? && line_right.present? && line_left != line_right max = [line_left.size, line_right.size].min @@ -193,7 +193,7 @@ module Redmine end # A line of diff - class Diff + class Diff attr_accessor :nb_line_left attr_accessor :line_left attr_accessor :nb_line_right @@ -201,7 +201,7 @@ module Redmine attr_accessor :type_diff_right attr_accessor :type_diff_left attr_accessor :offsets - + def initialize() self.nb_line_left = '' self.nb_line_right = '' @@ -210,15 +210,15 @@ module Redmine self.type_diff_right = '' self.type_diff_left = '' end - + def type_diff type_diff_right == 'diff_in' ? type_diff_right : type_diff_left end - + def line type_diff_right == 'diff_in' ? line_right : line_left end - + def html_line_left if offsets line_left.dup.insert(offsets.first, '').insert(offsets.last, '') @@ -226,7 +226,7 @@ module Redmine line_left end end - + def html_line_right if offsets line_right.dup.insert(offsets.first, '').insert(offsets.last, '') @@ -234,7 +234,7 @@ module Redmine line_right end end - + def html_line if offsets line.dup.insert(offsets.first, '').insert(offsets.last, '') diff --git a/lib/redmine/utils.rb b/lib/redmine/utils.rb index fd494a80..5e0b05ec 100644 --- a/lib/redmine/utils.rb +++ b/lib/redmine/utils.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 Redmine ActionController::Base.relative_url_root.to_s : ActionController::AbstractRequest.relative_url_root.to_s end - + # Sets the relative root url of the application def relative_url_root=(arg) if ActionController::Base.respond_to?('relative_url_root=') diff --git a/lib/redmine/version.rb b/lib/redmine/version.rb index b0dcb1c7..38e94cd7 100644 --- a/lib/redmine/version.rb +++ b/lib/redmine/version.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,24 +17,9 @@ module Redmine module VERSION #:nodoc: MAJOR = 1 MINOR = 4 - PATCH = 0 + PATCH = 0 TINY = PATCH # Redmine compat - # Used by semver to define the special version (if any). - # A special version "satify but have a lower precedence than the associated - # normal version". So 2.0.0RC1 would be part of the 2.0.0 series but - # be considered to be an older version. - # - # 1.4.0 < 2.0.0RC1 < 2.0.0RC2 < 2.0.0 < 2.1.0 - # - # This method may be overridden by third party code to provide vendor or - # distribution specific versions. They may or may not follow semver.org: - # - # 2.0.0debian-2 - def self.special - 'RC1' - end - def self.revision revision = nil entries_path = "#{RAILS_ROOT}/.svn/entries" @@ -59,9 +44,9 @@ module Redmine REVISION = self.revision ARRAY = [MAJOR, MINOR, PATCH, REVISION].compact STRING = ARRAY.join('.') - + def self.to_a; ARRAY end - def self.to_s; STRING end + def self.to_s; STRING end def self.to_semver [MAJOR, MINOR, PATCH].join('.') + special end diff --git a/lib/redmine/views/api_template_handler.rb b/lib/redmine/views/api_template_handler.rb index 8e3da64f..47550657 100644 --- a/lib/redmine/views/api_template_handler.rb +++ b/lib/redmine/views/api_template_handler.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. #++ @@ -16,7 +16,7 @@ module Redmine class ApiTemplateHandler < ActionView::TemplateHandler include ActionView::TemplateHandlers::Compilable - def compile(template) + def compile(template) "Redmine::Views::Builders.for(params[:format]) do |api|; #{template.source}; self.output_buffer = api.output; end" end end diff --git a/lib/redmine/views/builders.rb b/lib/redmine/views/builders.rb index 65b59b3e..453ba48f 100644 --- a/lib/redmine/views/builders.rb +++ b/lib/redmine/views/builders.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/lib/redmine/views/builders/json.rb b/lib/redmine/views/builders/json.rb index 03a7a063..25d4a61a 100644 --- a/lib/redmine/views/builders/json.rb +++ b/lib/redmine/views/builders/json.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/lib/redmine/views/builders/structure.rb b/lib/redmine/views/builders/structure.rb index 2810f055..7ad312cb 100644 --- a/lib/redmine/views/builders/structure.rb +++ b/lib/redmine/views/builders/structure.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 Redmine def initialize @struct = [{}] end - + def array(tag, options={}, &block) @struct << [] block.call(self) @@ -28,7 +28,7 @@ module Redmine @struct.last[tag] = ret @struct.last.merge!(options) if options end - + def method_missing(sym, *args, &block) if args.any? if args.first.is_a?(Hash) @@ -45,7 +45,7 @@ module Redmine end end end - + if block @struct << (args.first.is_a?(Hash) ? args.first : {}) block.call(self) @@ -61,7 +61,7 @@ module Redmine end end end - + def output raise "Need to implement #{self.class.name}#output" end diff --git a/lib/redmine/views/builders/xml.rb b/lib/redmine/views/builders/xml.rb index 6be1e6a6..8daf59a7 100644 --- a/lib/redmine/views/builders/xml.rb +++ b/lib/redmine/views/builders/xml.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,11 +19,11 @@ module Redmine super instruct! end - + def output target! end - + def method_missing(sym, *args, &block) if args.size == 1 && args.first.is_a?(Time) __send__ sym, args.first.xmlschema, &block @@ -31,7 +31,7 @@ module Redmine super end end - + def array(name, options={}, &block) __send__ name, (options || {}).merge(:type => 'array'), &block end diff --git a/lib/redmine/views/my_page/block.rb b/lib/redmine/views/my_page/block.rb index e42b0888..410f34c0 100644 --- a/lib/redmine/views/my_page/block.rb +++ b/lib/redmine/views/my_page/block.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/lib/redmine/views/other_formats_builder.rb b/lib/redmine/views/other_formats_builder.rb index 21421c53..752ba209 100644 --- a/lib/redmine/views/other_formats_builder.rb +++ b/lib/redmine/views/other_formats_builder.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,7 +17,7 @@ module Redmine def initialize(view) @view = view end - + def link_to(name, options={}) url = { :format => name.to_s.downcase }.merge(options.delete(:url) || {}) caption = options.delete(:caption) || name diff --git a/lib/redmine/wiki_formatting.rb b/lib/redmine/wiki_formatting.rb index e6b4c206..d75b0db7 100644 --- a/lib/redmine/wiki_formatting.rb +++ b/lib/redmine/wiki_formatting.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,26 +19,26 @@ module Redmine def map yield self end - + def register(name, formatter, helper) raise ArgumentError, "format name '#{name}' is already taken" if @@formatters[name.to_s] @@formatters[name.to_s] = {:formatter => formatter, :helper => helper} end - + def formatter_for(name) entry = @@formatters[name.to_s] (entry && entry[:formatter]) || Redmine::WikiFormatting::NullFormatter::Formatter end - + def helper_for(name) entry = @@formatters[name.to_s] (entry && entry[:helper]) || Redmine::WikiFormatting::NullFormatter::Helper end - + def format_names @@formatters.keys.map end - + def to_html(format, text, options = {}, &block) text = if Setting.cache_formatted_text? && text.size > 2.kilobyte && cache_store && cache_key = cache_key_for(format, options[:object], options[:attribute]) # Text retrieved from the cache store may be frozen @@ -61,12 +61,12 @@ module Redmine "formatted_text/#{format}/#{object.class.model_name.cache_key}/#{object.id}-#{attribute}-#{object.updated_on.to_s(:number)}" end end - + # Returns the cache store used to cache HTML output def cache_store ActionController::Base.cache_store end - + MACROS_RE = / (!)? # escaping ( @@ -76,7 +76,7 @@ module Redmine \}\} # closing tag ) /x unless const_defined?(:MACROS_RE) - + # Macros substitution def execute_macros(text, macros_runner) text.gsub!(MACROS_RE) do @@ -94,30 +94,30 @@ module Redmine end end end - + # Default formatter module module NullFormatter class Formatter include ActionView::Helpers::TagHelper include ActionView::Helpers::TextHelper include ActionView::Helpers::UrlHelper - + def initialize(text) @text = text end - + def to_html(*args) simple_format(auto_link(CGI::escapeHTML(@text))) end end - + module Helper def wikitoolbar_for(field_id) end - + def heads_for_wiki_formatter end - + def initial_page_content(page) page.pretty_title.to_s end diff --git a/lib/redmine/wiki_formatting/macros.rb b/lib/redmine/wiki_formatting/macros.rb index ba8573bc..615d1b41 100644 --- a/lib/redmine/wiki_formatting/macros.rb +++ b/lib/redmine/wiki_formatting/macros.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 @@ module Redmine method_name = "macro_#{name}" send(method_name, obj, args) if respond_to?(method_name) end - + def extract_macro_options(args, *keys) options = {} while args.last.to_s.strip =~ %r{^(.+)\=(.+)$} && keys.include?($1.downcase.to_sym) @@ -29,17 +29,17 @@ module Redmine return [args, options] end end - + @@available_macros = {} - + class << self # Called with a block to define additional macros. # Macro blocks accept 2 arguments: # * obj: the object that is rendered # * args: macro arguments - # + # # Plugins can use this method to define new macros: - # + # # Redmine::WikiFormatting::Macros.register do # desc "This is my macro" # macro :my_macro do |obj, args| @@ -49,7 +49,7 @@ module Redmine def register(&block) class_eval(&block) if block_given? end - + private # Defines a new macro with the given name and block. def macro(name, &block) @@ -59,19 +59,19 @@ module Redmine raise "Can not create a macro without a block!" unless block_given? Definitions.send :define_method, "macro_#{name}".downcase, &block end - + # Sets description for the next macro to be defined def desc(txt) @@desc = txt end end - + # Builtin macros desc "Sample macro." macro :hello_world do |obj, args| "Hello world! Object: #{obj.class.name}, " + (args.empty? ? "Called with no argument." : "Arguments: #{args.join(', ')}") end - + desc "Displays a list of all available macros, including description if available." macro :macro_list do out = '' @@ -81,7 +81,7 @@ module Redmine end content_tag('dl', out) end - + desc "Displays a list of child pages. With no argument, it displays the child pages of the current wiki page. Examples:\n\n" + " !{{child_pages}} -- can be used from a wiki page only\n" + " !{{child_pages(Foo)}} -- lists all children of page Foo\n" + @@ -100,7 +100,7 @@ module Redmine pages = ([page] + page.descendants).group_by(&:parent_id) render_page_hierarchy(pages, options[:parent] ? page.parent_id : page.id) end - + desc "Include a wiki page. Example:\n\n !{{include(Foo)}}\n\nor to include a page of a specific project wiki:\n\n !{{include(projectname:Foo)}}" macro :include do |obj, args| page = Wiki.find_page(args.first.to_s, :project => @project) diff --git a/lib/redmine/wiki_formatting/textile/formatter.rb b/lib/redmine/wiki_formatting/textile/formatter.rb index 69aeab95..a96833fa 100644 --- a/lib/redmine/wiki_formatting/textile/formatter.rb +++ b/lib/redmine/wiki_formatting/textile/formatter.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,30 +18,30 @@ module Redmine module Textile class Formatter < RedCloth3 include ActionView::Helpers::TagHelper - + # auto_link rule after textile rules so that it doesn't break !image_url! tags RULES = [:textile, :block_markdown_rule, :inline_auto_link, :inline_auto_mailto] - + def initialize(*args) super self.hard_breaks=true self.no_span_caps=true self.filter_styles=true end - + def to_html(*rules) @toc = [] super(*RULES).to_s end - + private - + # Patch for RedCloth. Fixed in RedCloth r128 but _why hasn't released it yet. # http://code.whytheluckystiff.net/redcloth/changeset/128 - def hard_break( text ) + def hard_break( text ) text.gsub!( /(.)\n(?!\n|\Z| *([#*=]+(\s|$)|[{|]))/, "\\1
              " ) if hard_breaks end - + # Patch to add code highlighting support to RedCloth def smooth_offtags( text ) unless @pre_list.empty? @@ -49,18 +49,18 @@ module Redmine text.gsub!(//) do content = @pre_list[$1.to_i] if content.match(/\s?(.+)/m) - content = "" + + content = "" + Redmine::SyntaxHighlighting.highlight_by_language($2, $1) end content end end end - + AUTO_LINK_RE = %r{ ( # leading text <\w+.*?>| # leading HTML tag, or - [^=<>!:'"/]| # leading punctuation, or + [^=<>!:'"/]| # leading punctuation, or ^ # beginning of line ) ( @@ -75,7 +75,7 @@ module Redmine ((?:>)?|[^\w\=\/;\(\)]*?) # post (?=<|\s|$) }x unless const_defined?(:AUTO_LINK_RE) - + # Turns all urls into clickable links (code from Rails). def inline_auto_link(text) text.gsub!(AUTO_LINK_RE) do @@ -96,7 +96,7 @@ module Redmine end end end - + # Turns all email addresses into clickable links (code from Rails). def inline_auto_mailto(text) text.gsub!(/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/) do diff --git a/lib/redmine/wiki_formatting/textile/helper.rb b/lib/redmine/wiki_formatting/textile/helper.rb index f9c19382..aefc8da5 100644 --- a/lib/redmine/wiki_formatting/textile/helper.rb +++ b/lib/redmine/wiki_formatting/textile/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. #++ @@ -21,14 +21,14 @@ module Redmine help_link = link_to(l(:setting_text_formatting), url, :onclick => "window.open(\"#{ url }\", \"\", \"resizable=yes, location=no, width=300, height=640, menubar=no, status=no, scrollbars=yes\"); return false;", :tabindex => -1) - + javascript_tag("var wikiToolbar = new jsToolBar($('#{field_id}')); wikiToolbar.setHelpLink('#{escape_javascript help_link}'); wikiToolbar.draw();") end - + def initial_page_content(page) "h1. #{@page.pretty_title}" end - + def heads_for_wiki_formatter unless @heads_for_wiki_formatter_included content_for :header_tags do diff --git a/lib/tabular_form_builder.rb b/lib/tabular_form_builder.rb index 9c6fb15c..303f9a83 100644 --- a/lib/tabular_form_builder.rb +++ b/lib/tabular_form_builder.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,33 +15,33 @@ require 'action_view/helpers/form_helper' class TabularFormBuilder < ActionView::Helpers::FormBuilder include Redmine::I18n - + def initialize(object_name, object, template, options, proc) set_language_if_valid options.delete(:lang) super - end - + end + (field_helpers - %w(radio_button hidden_field fields_for) + %w(date_select)).each do |selector| src = <<-END_SRC - def #{selector}(field, options = {}) + def #{selector}(field, options = {}) label_for_field(field, options) + super end END_SRC class_eval src, __FILE__, __LINE__ end - - def select(field, choices, options = {}, html_options = {}) + + def select(field, choices, options = {}, html_options = {}) label_for_field(field, options) + super end - + # Returns a label tag for the given field def label_for_field(field, options = {}) return '' if options.delete(:no_label) text = options[:label].is_a?(Symbol) ? l(options[:label]) : options[:label] text ||= l(("field_" + field.to_s.gsub(/\_id$/, "")).to_sym) text += @template.content_tag("span", " *", :class => "required") if options.delete(:required) - @template.content_tag("label", text, - :class => (@object && @object.errors[field] ? "error" : nil), + @template.content_tag("label", text, + :class => (@object && @object.errors[field] ? "error" : nil), :for => (@object_name.to_s + "_" + field.to_s)) end end diff --git a/lib/tasks/ci.rake b/lib/tasks/ci.rake index f554b68d..702307a8 100644 --- a/lib/tasks/ci.rake +++ b/lib/tasks/ci.rake @@ -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. #++ @@ -51,7 +51,7 @@ namespace :ci do result = `#{command}` "$ #{command}\n#{result}" end.join("\n") - + end end diff --git a/lib/tasks/ciphering.rake b/lib/tasks/ciphering.rake index 6cea5508..6581fe59 100644 --- a/lib/tasks/ciphering.rake +++ b/lib/tasks/ciphering.rake @@ -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,12 +15,12 @@ namespace :db do desc 'Encrypts SCM and LDAP passwords in the database.' task :encrypt => :environment do - unless (Repository.encrypt_all(:password) && + unless (Repository.encrypt_all(:password) && AuthSource.encrypt_all(:account_password)) raise "Some objects could not be saved after encryption, update was rollback'ed." end end - + desc 'Decrypts SCM and LDAP passwords in the database.' task :decrypt => :environment do unless (Repository.decrypt_all(:password) && diff --git a/lib/tasks/code.rake b/lib/tasks/code.rake index b4e2eb1d..e4e67050 100644 --- a/lib/tasks/code.rake +++ b/lib/tasks/code.rake @@ -1,27 +1,33 @@ #-- 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. #++ namespace :code do desc "Fix line endings of all source files" task :fix_line_endings do - unless `which fromdos`.present? - raise "fromdos command not found" + Dir.chdir(File.join(File.dirname(__FILE__), "../..")) do + files = Dir['**/**{.rb,.html.erb,.rhtml,.rjs,.rsb,.plain.erb,.rxml,.yml,.rake,.eml}'] + files.reject!{ |f| + f.include?("vendor") || + f.include?("lib/SVG") || + f.include?("lib/faster_csv") || + f.include?("lib/redcloth") || + f.include?("lib/diff") + } + + # handle files in chunks of 50 to avoid too long command lines + while (slice = files.slice!(0, 50)).present? + system('ruby', '-i', '-pe', 'gsub(/\s+$/,"\n")', *slice) + end end - - Dir['**/**{.rb,.html.erb,.rhtml,.rjs,.rsb,.plain.erb,.rxml,.yml,.rake,.eml}'].each do |file_name| - next if file_name.include?("vendor") - system("fromdos #{file_name}") - end - end end diff --git a/lib/tasks/copyright.rake b/lib/tasks/copyright.rake index cf1e3b04..c9468087 100644 --- a/lib/tasks/copyright.rake +++ b/lib/tasks/copyright.rake @@ -1,11 +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. +#++ + namespace :copyright do desc "Update the copyright on the source files" task :update do short_copyright = File.readlines("doc/COPYRIGHT_short.rdoc").collect do |line| - "# #{line}" - end.join("") + "# #{line}".rstrip + end.join("\n") - short_copyright_as_rdoc = "#-- copyright\n" + short_copyright + "#++" + short_copyright_as_rdoc = "#-- copyright\n" + short_copyright + "\n#++" Dir['**/**{.rb,.rake}'].each do |file_name| # Skip 3rd party code @@ -14,22 +27,20 @@ namespace :copyright do file_name.include?("lib/faster_csv") || file_name.include?("lib/redcloth") || file_name.include?("lib/diff") - next if file_name.include?("lib/tasks/copyright") # skip self - next if file_name.include?("unified_diff_test") # confict file_content = File.read(file_name) - @copyright_regex = /#-- copyright.*\+\+/m + @copyright_regex = /^#--\s*copyright.*?\+\+/m if file_content.match(@copyright_regex) file_content.gsub!(@copyright_regex, short_copyright_as_rdoc) else file_content = short_copyright_as_rdoc + "\n\n" + file_content # Prepend end - + File.open(file_name, "w") do |file| file.write file_content end - + end - + end end diff --git a/lib/tasks/deprecated.rake b/lib/tasks/deprecated.rake index 3b58406b..d31f6b3b 100644 --- a/lib/tasks/deprecated.rake +++ b/lib/tasks/deprecated.rake @@ -1,18 +1,18 @@ #-- 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. #++ def deprecated_task(name, new_name) - task name=>new_name do + task name=>new_name do $stderr.puts "\nNote: The rake task #{name} has been deprecated, please use the replacement version #{new_name}" end end diff --git a/lib/tasks/documentation.rake b/lib/tasks/documentation.rake index 08554c6e..8da8f434 100644 --- a/lib/tasks/documentation.rake +++ b/lib/tasks/documentation.rake @@ -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/lib/tasks/email.rake b/lib/tasks/email.rake index 080b3609..be618cf4 100644 --- a/lib/tasks/email.rake +++ b/lib/tasks/email.rake @@ -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. #++ @@ -26,7 +26,7 @@ General options: create: create a user account no_permission_check=1 disable permission checking when receiving the email - + Issue attributes control options: project=PROJECT identifier of the target project status=STATUS name of the target status @@ -55,10 +55,10 @@ END_DESC options[:allow_override] = ENV['allow_override'] if ENV['allow_override'] options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user'] options[:no_permission_check] = ENV['no_permission_check'] if ENV['no_permission_check'] - + MailHandler.receive(STDIN.read, options) end - + desc <<-END_DESC Read emails from an IMAP server. @@ -70,7 +70,7 @@ General options: create: create a user account no_permission_check=1 disable permission checking when receiving the email - + Available IMAP options: host=HOST IMAP server host (default: 127.0.0.1) port=PORT IMAP server port (default: 143) @@ -78,7 +78,7 @@ Available IMAP options: username=USERNAME IMAP account password=PASSWORD IMAP password folder=FOLDER IMAP folder to read (default: INBOX) - + Issue attributes control options: project=PROJECT identifier of the target project status=STATUS name of the target status @@ -88,22 +88,22 @@ Issue attributes control options: allow_override=ATTRS allow email content to override attributes specified by previous options ATTRS is a comma separated list of attributes - + Processed emails control options: move_on_success=MAILBOX move emails that were successfully received to MAILBOX instead of deleting them move_on_failure=MAILBOX move emails that were ignored to MAILBOX - + Examples: # No project specified. Emails MUST contain the 'Project' keyword: - + rake redmine:email:receive_iamp RAILS_ENV="production" \\ host=imap.foo.bar username=redmine@example.net password=xxx # Fixed project and default tracker specified, but emails can override # both tracker and priority attributes: - + rake redmine:email:receive_iamp RAILS_ENV="production" \\ host=imap.foo.bar username=redmine@example.net password=xxx ssl=1 \\ project=foo \\ @@ -120,7 +120,7 @@ END_DESC :folder => ENV['folder'], :move_on_success => ENV['move_on_success'], :move_on_failure => ENV['move_on_failure']} - + options = { :issue => {} } %w(project status tracker category priority).each { |a| options[:issue][a.to_sym] = ENV[a] if ENV[a] } options[:allow_override] = ENV['allow_override'] if ENV['allow_override'] @@ -129,7 +129,7 @@ END_DESC Redmine::IMAP.check(imap_options, options) end - + desc <<-END_DESC Read emails from an POP3 server. @@ -145,7 +145,7 @@ Available POP3 options: See redmine:email:receive_imap for more options and examples. END_DESC - + task :receive_pop3 => :environment do pop_options = {:host => ENV['host'], :port => ENV['port'], @@ -153,16 +153,16 @@ END_DESC :username => ENV['username'], :password => ENV['password'], :delete_unprocessed => ENV['delete_unprocessed']} - + options = { :issue => {} } %w(project status tracker category priority).each { |a| options[:issue][a.to_sym] = ENV[a] if ENV[a] } options[:allow_override] = ENV['allow_override'] if ENV['allow_override'] options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user'] options[:no_permission_check] = ENV['no_permission_check'] if ENV['no_permission_check'] - + Redmine::POP3.check(pop_options, options) end - + desc "Send a test email to the user with the provided login name" task :test, [:login] => :environment do |task, args| include Redmine::I18n @@ -170,7 +170,7 @@ END_DESC user = User.find_by_login(args[:login]) abort l(:notice_email_error, "User #{args[:login]} not found") unless user && user.logged? - + ActionMailer::Base.raise_delivery_errors = true begin Mailer.deliver_test(User.current) diff --git a/lib/tasks/extract_fixtures.rake b/lib/tasks/extract_fixtures.rake index 19a1672a..d97865fb 100644 --- a/lib/tasks/extract_fixtures.rake +++ b/lib/tasks/extract_fixtures.rake @@ -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,12 +23,12 @@ task :extract_fixtures => :environment do File.open("#{RAILS_ROOT}/#{table_name}.yml", 'w' ) do |file| data = ActiveRecord::Base.connection.select_all(sql % table_name) file.write data.inject({}) { |hash, record| - + # cast extracted values ActiveRecord::Base.connection.columns(table_name).each { |col| - record[col.name] = col.type_cast(record[col.name]) if record[col.name] - } - + record[col.name] = col.type_cast(record[col.name]) if record[col.name] + } + hash["#{table_name}_#{i.succ!}"] = record hash }.to_yaml diff --git a/lib/tasks/fetch_changesets.rake b/lib/tasks/fetch_changesets.rake index 18855c0d..2803f4c4 100644 --- a/lib/tasks/fetch_changesets.rake +++ b/lib/tasks/fetch_changesets.rake @@ -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/lib/tasks/initializers.rake b/lib/tasks/initializers.rake index 5e2556b6..a4b02c7c 100644 --- a/lib/tasks/initializers.rake +++ b/lib/tasks/initializers.rake @@ -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 @@ file 'config/initializers/session_store.rb' do # If you have a load-balancing Redmine cluster, you will need to use the # same version of this file on each machine. And be sure to restart your # server when you modify this file. - + # Your secret key for verifying cookie session data integrity. If you # change this key, all old sessions will become invalid! Make sure the # secret is at least 30 characters and all random, no regular words or diff --git a/lib/tasks/jdbc.rake b/lib/tasks/jdbc.rake index bc1cdbfa..48ba4a10 100644 --- a/lib/tasks/jdbc.rake +++ b/lib/tasks/jdbc.rake @@ -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/lib/tasks/load_default_data.rake b/lib/tasks/load_default_data.rake index c5b71f3c..5a0fec70 100644 --- a/lib/tasks/load_default_data.rake +++ b/lib/tasks/load_default_data.rake @@ -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,7 +17,7 @@ namespace :redmine do task :load_default_data => :environment do include Redmine::I18n set_language_if_valid('en') - + envlang = ENV['REDMINE_LANG'] if !envlang || !set_language_if_valid(envlang) puts @@ -34,7 +34,7 @@ namespace :redmine do STDOUT.flush puts "====================================" end - + begin Redmine::DefaultData::Loader.load(current_language) puts "Default configuration data loaded." diff --git a/lib/tasks/locales.rake b/lib/tasks/locales.rake index f6a35c2f..86d3688e 100644 --- a/lib/tasks/locales.rake +++ b/lib/tasks/locales.rake @@ -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,21 +22,21 @@ namespace :locales do desc 'Updates language files based on en.yml content (only works for new top level keys).' task :update do dir = ENV['DIR'] || './config/locales' - + en_strings = YAML.load(File.read(File.join(dir,'en.yml')))['en'] - + files = Dir.glob(File.join(dir,'*.{yaml,yml}')) files.each do |file| puts "Updating file #{file}" file_strings = YAML.load(File.read(file)) file_strings = file_strings[file_strings.keys.first] - + missing_keys = en_strings.keys - file_strings.keys next if missing_keys.empty? - + puts "==> Missing #{missing_keys.size} keys (#{missing_keys.join(', ')})" lang = File.open(file, 'a') - + missing_keys.each do |key| {key => en_strings[key]}.to_yaml.each_line do |line| next if line =~ /^---/ || line.empty? @@ -44,11 +44,11 @@ namespace :locales do lang << " #{line}" end end - + lang.close end end - + desc 'Checks interpolation arguments in locals against en.yml' task :check_interpolation do dir = ENV['DIR'] || './config/locales' @@ -57,7 +57,7 @@ namespace :locales do files.each do |file| file_strings = YAML.load(File.read(file)) file_strings = file_strings[file_strings.keys.first] - + file_strings.each do |key, string| next unless string.is_a?(String) string.scan /%\{\w+\}/ do |match| @@ -84,7 +84,7 @@ END_DESC deletes = ENV['key'] ? Regexp.union(ENV['key'].split(',')) : nil # Ignore multiline keys (begin with | or >) and keys with children (nothing meaningful after :) delete_regex = /\A #{deletes}: +[^\|>\s#].*\z/ - + files.each do |path| # Skip certain locales (puts "Skipping #{path}"; next) if File.basename(path, ".yml") =~ skips @@ -93,7 +93,7 @@ END_DESC File.open(path, 'w') {|file| orig_content.each_line {|line| file.puts line unless line.chomp =~ delete_regex}} end end - + desc <<-END_DESC Adds a new top-level translation string to all locale file (only works for childless keys, probably doesn\'t work on windows, doesn't check for duplicates). diff --git a/lib/tasks/metrics.rake b/lib/tasks/metrics.rake index cae7d0cd..d0197cf1 100644 --- a/lib/tasks/metrics.rake +++ b/lib/tasks/metrics.rake @@ -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/lib/tasks/migrate_from_mantis.rake b/lib/tasks/migrate_from_mantis.rake index f1188188..af65ed10 100644 --- a/lib/tasks/migrate_from_mantis.rake +++ b/lib/tasks/migrate_from_mantis.rake @@ -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,9 +20,9 @@ require 'pp' namespace :redmine do task :migrate_from_mantis => :environment do - + module MantisMigrate - + DEFAULT_STATUS = IssueStatus.default assigned_status = IssueStatus.find_by_position(2) resolved_status = IssueStatus.find_by_position(3) @@ -36,7 +36,7 @@ task :migrate_from_mantis => :environment do 80 => resolved_status, # resolved 90 => closed_status # closed } - + priorities = IssuePriority.all DEFAULT_PRIORITY = priorities[2] PRIORITY_MAPPING = {10 => priorities[1], # none @@ -46,10 +46,10 @@ task :migrate_from_mantis => :environment do 50 => priorities[4], # urgent 60 => priorities[5] # immediate } - + TRACKER_BUG = Tracker.find_by_position(1) TRACKER_FEATURE = Tracker.find_by_position(2) - + roles = Role.find(:all, :conditions => {:builtin => 0}, :order => 'position ASC') manager_role = roles[0] developer_role = roles[1] @@ -61,7 +61,7 @@ task :migrate_from_mantis => :environment do 70 => manager_role, # manager 90 => manager_role # administrator } - + CUSTOM_FIELD_TYPE_MAPPING = {0 => 'string', # String 1 => 'int', # Numeric 2 => 'int', # Float @@ -72,28 +72,28 @@ task :migrate_from_mantis => :environment do 7 => 'list', # Multiselection list 8 => 'date', # Date } - + RELATION_TYPE_MAPPING = {1 => IssueRelation::TYPE_RELATES, # related to 2 => IssueRelation::TYPE_RELATES, # parent of 3 => IssueRelation::TYPE_RELATES, # child of 0 => IssueRelation::TYPE_DUPLICATES, # duplicate of 4 => IssueRelation::TYPE_DUPLICATES # has duplicate } - + class MantisUser < ActiveRecord::Base set_table_name :mantis_user_table - + def firstname @firstname = realname.blank? ? username : realname.split.first[0..29] @firstname end - + def lastname @lastname = realname.blank? ? '-' : realname.split[1..-1].join(' ')[0..29] @lastname = '-' if @lastname.blank? @lastname end - + def email if read_attribute(:email).match(/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i) && !User.find_by_mail(read_attribute(:email)) @@ -102,44 +102,44 @@ task :migrate_from_mantis => :environment do @email = "#{username}@foo.bar" end end - + def username read_attribute(:username)[0..29].gsub(/[^a-zA-Z0-9_\-@\.]/, '-') end end - + class MantisProject < ActiveRecord::Base set_table_name :mantis_project_table has_many :versions, :class_name => "MantisVersion", :foreign_key => :project_id has_many :categories, :class_name => "MantisCategory", :foreign_key => :project_id has_many :news, :class_name => "MantisNews", :foreign_key => :project_id has_many :members, :class_name => "MantisProjectUser", :foreign_key => :project_id - + def identifier read_attribute(:name).gsub(/[^a-z0-9\-]+/, '-').slice(0, Project::IDENTIFIER_MAX_LENGTH) end end - + class MantisVersion < ActiveRecord::Base set_table_name :mantis_project_version_table - + def version read_attribute(:version)[0..29] end - + def description read_attribute(:description)[0..254] end end - + class MantisCategory < ActiveRecord::Base set_table_name :mantis_project_category_table end - + class MantisProjectUser < ActiveRecord::Base set_table_name :mantis_project_user_list_table end - + class MantisBug < ActiveRecord::Base set_table_name :mantis_bug_table belongs_to :bug_text, :class_name => "MantisBugText", :foreign_key => :bug_text_id @@ -147,10 +147,10 @@ task :migrate_from_mantis => :environment do has_many :bug_files, :class_name => "MantisBugFile", :foreign_key => :bug_id has_many :bug_monitors, :class_name => "MantisBugMonitor", :foreign_key => :bug_id end - + class MantisBugText < ActiveRecord::Base set_table_name :mantis_bug_text_table - + # Adds Mantis steps_to_reproduce and additional_information fields # to description if any def full_description @@ -160,32 +160,32 @@ task :migrate_from_mantis => :environment do full_description end end - + class MantisBugNote < ActiveRecord::Base set_table_name :mantis_bugnote_table belongs_to :bug, :class_name => "MantisBug", :foreign_key => :bug_id belongs_to :bug_note_text, :class_name => "MantisBugNoteText", :foreign_key => :bugnote_text_id end - + class MantisBugNoteText < ActiveRecord::Base set_table_name :mantis_bugnote_text_table end - + class MantisBugFile < ActiveRecord::Base set_table_name :mantis_bug_file_table - + def size filesize end - + def original_filename MantisMigrate.encode(filename) end - + def content_type file_type end - + def read(*args) if @read_finished nil @@ -195,52 +195,52 @@ task :migrate_from_mantis => :environment do end end end - + class MantisBugRelationship < ActiveRecord::Base set_table_name :mantis_bug_relationship_table end - + class MantisBugMonitor < ActiveRecord::Base set_table_name :mantis_bug_monitor_table end - + class MantisNews < ActiveRecord::Base set_table_name :mantis_news_table end - + class MantisCustomField < ActiveRecord::Base set_table_name :mantis_custom_field_table - set_inheritance_column :none + set_inheritance_column :none has_many :values, :class_name => "MantisCustomFieldString", :foreign_key => :field_id has_many :projects, :class_name => "MantisCustomFieldProject", :foreign_key => :field_id - + def format read_attribute :type end - + def name read_attribute(:name)[0..29] end end - + class MantisCustomFieldProject < ActiveRecord::Base - set_table_name :mantis_custom_field_project_table + set_table_name :mantis_custom_field_project_table end - + class MantisCustomFieldString < ActiveRecord::Base - set_table_name :mantis_custom_field_string_table + set_table_name :mantis_custom_field_string_table end - - + + def self.migrate - + # Users print "Migrating users" User.delete_all "login <> 'admin'" users_map = {} users_migrated = 0 MantisUser.find(:all).each do |user| - u = User.new :firstname => encode(user.firstname), + u = User.new :firstname => encode(user.firstname), :lastname => encode(user.lastname), :mail => user.email, :last_login_on => user.last_visit @@ -254,7 +254,7 @@ task :migrate_from_mantis => :environment do print '.' end puts - + # Projects print "Migrating projects" Project.destroy_all @@ -262,7 +262,7 @@ task :migrate_from_mantis => :environment do versions_map = {} categories_map = {} MantisProject.find(:all).each do |project| - p = Project.new :name => encode(project.name), + p = Project.new :name => encode(project.name), :description => encode(project.description) p.identifier = project.identifier next unless p.save @@ -271,15 +271,15 @@ task :migrate_from_mantis => :environment do p.trackers << TRACKER_BUG p.trackers << TRACKER_FEATURE print '.' - + # Project members project.members.each do |member| m = Member.new :user => User.find_by_id(users_map[member.user_id]), :roles => [ROLE_MAPPING[member.access_level] || DEFAULT_ROLE] m.project = p m.save - end - + end + # Project versions project.versions.each do |version| v = Version.new :name => encode(version.version), @@ -289,7 +289,7 @@ task :migrate_from_mantis => :environment do v.save versions_map[version.id] = v.id end - + # Project categories project.categories.each do |category| g = IssueCategory.new :name => category.category[0,30] @@ -297,9 +297,9 @@ task :migrate_from_mantis => :environment do g.save categories_map[category.category] = g.id end - end - puts - + end + puts + # Bugs print "Migrating bugs" Issue.destroy_all @@ -307,7 +307,7 @@ task :migrate_from_mantis => :environment do keep_bug_ids = (Issue.count == 0) MantisBug.find_each(:batch_size => 200) do |bug| next unless projects_map[bug.project_id] && users_map[bug.reporter_id] - i = Issue.new :project_id => projects_map[bug.project_id], + i = Issue.new :project_id => projects_map[bug.project_id], :subject => encode(bug.summary), :description => encode(bug.bug_text.full_description), :priority => PRIORITY_MAPPING[bug.priority] || DEFAULT_PRIORITY, @@ -329,8 +329,8 @@ task :migrate_from_mantis => :environment do if (bug.handler_id && users_map[bug.handler_id]) i.assigned_to = User.find_by_id(users_map[bug.handler_id]) i.save_with_validation(false) - end - + end + # Bug notes bug.bug_notes.each do |note| next unless users_map[note.reporter_id] @@ -340,7 +340,7 @@ task :migrate_from_mantis => :environment do n.journalized = i n.save end - + # Bug files bug.bug_files.each do |file| a = Attachment.new :created_on => file.date_added @@ -349,18 +349,18 @@ task :migrate_from_mantis => :environment do a.container = i a.save end - + # Bug monitors bug.bug_monitors.each do |monitor| next unless users_map[monitor.user_id] i.add_watcher(User.find_by_id(users_map[monitor.user_id])) end end - + # update issue id sequence if needed (postgresql) Issue.connection.reset_pk_sequence!(Issue.table_name) if Issue.connection.respond_to?('reset_pk_sequence!') puts - + # Bug relationships print "Migrating bug relations" MantisBugRelationship.find(:all).each do |relation| @@ -373,7 +373,7 @@ task :migrate_from_mantis => :environment do STDOUT.flush end puts - + # News print "Migrating news" News.destroy_all @@ -389,7 +389,7 @@ task :migrate_from_mantis => :environment do STDOUT.flush end puts - + # Custom fields print "Migrating custom fields" IssueCustomField.destroy_all @@ -406,12 +406,12 @@ task :migrate_from_mantis => :environment do STDOUT.flush # Trackers association f.trackers = Tracker.find :all - + # Projects association field.projects.each do |project| f.projects << Project.find_by_id(projects_map[project.project_id]) if projects_map[project.project_id] end - + # Values field.values.each do |value| v = CustomValue.new :custom_field_id => f.id, @@ -421,7 +421,7 @@ task :migrate_from_mantis => :environment do end unless f.new_record? end puts - + puts puts "Users: #{users_migrated}/#{MantisUser.count}" puts "Projects: #{Project.count}/#{MantisProject.count}" @@ -436,13 +436,13 @@ task :migrate_from_mantis => :environment do puts "News: #{News.count}/#{MantisNews.count}" puts "Custom fields: #{IssueCustomField.count}/#{MantisCustomField.count}" end - + def self.encoding(charset) @ic = Iconv.new('UTF-8', charset) rescue Iconv::InvalidEncoding - return false + return false end - + def self.establish_connection(params) constants.each do |const| klass = const_get(const) @@ -450,14 +450,14 @@ task :migrate_from_mantis => :environment do klass.establish_connection params end end - + def self.encode(text) @ic.iconv text rescue text end end - + puts if Redmine::DefaultData::Loader.no_data? puts "Redmine configuration need to be loaded before importing data." @@ -466,27 +466,27 @@ task :migrate_from_mantis => :environment do puts " rake redmine:load_default_data RAILS_ENV=\"#{ENV['RAILS_ENV']}\"" exit end - + puts "WARNING: Your Redmine data will be deleted during this process." print "Are you sure you want to continue ? [y/N] " STDOUT.flush break unless STDIN.gets.match(/^y$/i) - + # Default Mantis database settings - db_params = {:adapter => 'mysql', - :database => 'bugtracker', - :host => 'localhost', - :username => 'root', + db_params = {:adapter => 'mysql', + :database => 'bugtracker', + :host => 'localhost', + :username => 'root', :password => '' } - puts - puts "Please enter settings for your Mantis database" + puts + puts "Please enter settings for your Mantis database" [:adapter, :host, :database, :username, :password].each do |param| print "#{param} [#{db_params[param]}]: " value = STDIN.gets.chomp! db_params[param] = value unless value.blank? end - + while true print "encoding [UTF-8]: " STDOUT.flush @@ -496,13 +496,13 @@ task :migrate_from_mantis => :environment do puts "Invalid encoding!" end puts - + # Make sure bugs can refer bugs in other projects Setting.cross_project_issue_relations = 1 if Setting.respond_to? 'cross_project_issue_relations' - + # Turn off email notifications Setting.notified_events = [] - + MantisMigrate.establish_connection db_params MantisMigrate.migrate end diff --git a/lib/tasks/migrate_from_trac.rake b/lib/tasks/migrate_from_trac.rake index 63e035fe..08b2d24f 100644 --- a/lib/tasks/migrate_from_trac.rake +++ b/lib/tasks/migrate_from_trac.rake @@ -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. #++ @@ -755,10 +755,10 @@ namespace :redmine do prompt('Trac database encoding', :default => 'UTF-8') {|encoding| TracMigrate.encoding encoding} prompt('Target project identifier') {|identifier| TracMigrate.target_project_identifier identifier} puts - + # Turn off email notifications Setting.notified_events = [] - + TracMigrate.migrate end end diff --git a/lib/tasks/migrate_plugins.rake b/lib/tasks/migrate_plugins.rake index 14577c7e..fb279d62 100644 --- a/lib/tasks/migrate_plugins.rake +++ b/lib/tasks/migrate_plugins.rake @@ -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/lib/tasks/permissions.rake b/lib/tasks/permissions.rake index a36bb229..f04448d2 100644 --- a/lib/tasks/permissions.rake +++ b/lib/tasks/permissions.rake @@ -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/lib/tasks/plugins.rake b/lib/tasks/plugins.rake index 862a07cd..33013011 100644 --- a/lib/tasks/plugins.rake +++ b/lib/tasks/plugins.rake @@ -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/lib/tasks/reminder.rake b/lib/tasks/reminder.rake index 46db106e..721c3610 100644 --- a/lib/tasks/reminder.rake +++ b/lib/tasks/reminder.rake @@ -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. #++ @@ -32,7 +32,7 @@ namespace :redmine do options[:project] = ENV['project'] if ENV['project'] options[:tracker] = ENV['tracker'].to_i if ENV['tracker'] options[:users] = (ENV['users'] || '').split(',').each(&:strip!) - + Mailer.reminders(options) end end diff --git a/lib/tasks/testing.rake b/lib/tasks/testing.rake index 7a67441b..18633348 100644 --- a/lib/tasks/testing.rake +++ b/lib/tasks/testing.rake @@ -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. #++ @@ -43,16 +43,16 @@ namespace :test do task :create_dir do FileUtils.mkdir_p Rails.root + '/tmp/test' end - + supported_scms = [:subversion, :cvs, :bazaar, :mercurial, :git, :darcs, :filesystem] - + desc "Creates a test subversion repository" task :subversion => :create_dir do repo_path = "tmp/test/subversion_repository" system "svnadmin create #{repo_path}" system "gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load #{repo_path}" end - + desc "Creates a test mercurial repository" task :mercurial => :create_dir do repo_path = "tmp/test/mercurial_repository" @@ -60,7 +60,7 @@ namespace :test do system "hg init #{repo_path}" system "hg -R #{repo_path} pull #{bundle_path}" end - + (supported_scms - [:subversion, :mercurial]).each do |scm| desc "Creates a test #{scm} repository" task scm => :create_dir do @@ -68,11 +68,11 @@ namespace :test do system "tar -xvz -C tmp/test -f test/fixtures/repositories/#{scm}_repository.tar.gz" end end - + desc "Creates all test repositories" task :all => supported_scms end - + desc "Updates installed test repositories" task :update do require 'fileutils' @@ -81,19 +81,19 @@ namespace :test do scm = $1 next unless fixture = Dir.glob("test/fixtures/repositories/#{scm}_repository.*").first next if File.stat(dir).ctime > File.stat(fixture).mtime - + FileUtils.rm_rf dir Rake::Task["test:scm:setup:#{scm}"].execute end end - + Rake::TestTask.new(:units => "db:test:prepare") do |t| t.libs << "test" t.verbose = true t.test_files = FileList['test/unit/repository*_test.rb'] + FileList['test/unit/lib/redmine/scm/**/*_test.rb'] end Rake::Task['test:scm:units'].comment = "Run the scm unit tests" - + Rake::TestTask.new(:functionals => "db:test:prepare") do |t| t.libs << "test" t.verbose = true diff --git a/lib/tasks/watchers.rake b/lib/tasks/watchers.rake index 7dc07f46..d9235f57 100644 --- a/lib/tasks/watchers.rake +++ b/lib/tasks/watchers.rake @@ -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/lib/tasks/yardoc.rake b/lib/tasks/yardoc.rake index bcfd9a4f..41e1efa7 100644 --- a/lib/tasks/yardoc.rake +++ b/lib/tasks/yardoc.rake @@ -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/test/exemplars/attachment_exemplar.rb b/test/exemplars/attachment_exemplar.rb index 6101d5d7..a97fd9ff 100644 --- a/test/exemplars/attachment_exemplar.rb +++ b/test/exemplars/attachment_exemplar.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/test/exemplars/auth_source_exemplar.rb b/test/exemplars/auth_source_exemplar.rb index 115183a8..970cee13 100644 --- a/test/exemplars/auth_source_exemplar.rb +++ b/test/exemplars/auth_source_exemplar.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/test/exemplars/board_exemplar.rb b/test/exemplars/board_exemplar.rb index 776ba851..481891ae 100644 --- a/test/exemplars/board_exemplar.rb +++ b/test/exemplars/board_exemplar.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/test/exemplars/change_exemplar.rb b/test/exemplars/change_exemplar.rb index 0272bcd0..67c219b7 100644 --- a/test/exemplars/change_exemplar.rb +++ b/test/exemplars/change_exemplar.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/test/exemplars/changeset_exemplar.rb b/test/exemplars/changeset_exemplar.rb index b2bceb16..57a0d934 100644 --- a/test/exemplars/changeset_exemplar.rb +++ b/test/exemplars/changeset_exemplar.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/test/exemplars/comment_exemplar.rb b/test/exemplars/comment_exemplar.rb index f1d80077..46a909fa 100644 --- a/test/exemplars/comment_exemplar.rb +++ b/test/exemplars/comment_exemplar.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/test/exemplars/custom_field_exemplar.rb b/test/exemplars/custom_field_exemplar.rb index e9302fea..b2564ff3 100644 --- a/test/exemplars/custom_field_exemplar.rb +++ b/test/exemplars/custom_field_exemplar.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/test/exemplars/custom_value_exemplar.rb b/test/exemplars/custom_value_exemplar.rb index 93f26b04..d7f94e27 100644 --- a/test/exemplars/custom_value_exemplar.rb +++ b/test/exemplars/custom_value_exemplar.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/test/exemplars/document_category_exemplar.rb b/test/exemplars/document_category_exemplar.rb index b9872dbd..03ad6e95 100644 --- a/test/exemplars/document_category_exemplar.rb +++ b/test/exemplars/document_category_exemplar.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/test/exemplars/document_exemplar.rb b/test/exemplars/document_exemplar.rb index 7c9b357c..bf62b5a8 100644 --- a/test/exemplars/document_exemplar.rb +++ b/test/exemplars/document_exemplar.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/test/exemplars/enabled_module_exemplar.rb b/test/exemplars/enabled_module_exemplar.rb index 60b65e35..b14991ca 100644 --- a/test/exemplars/enabled_module_exemplar.rb +++ b/test/exemplars/enabled_module_exemplar.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/test/exemplars/enumeration_exemplar.rb b/test/exemplars/enumeration_exemplar.rb index a2862907..f82e1100 100644 --- a/test/exemplars/enumeration_exemplar.rb +++ b/test/exemplars/enumeration_exemplar.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/test/exemplars/group_exemplar.rb b/test/exemplars/group_exemplar.rb index 100c4117..585f30e2 100644 --- a/test/exemplars/group_exemplar.rb +++ b/test/exemplars/group_exemplar.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/test/exemplars/issue_category_exemplar.rb b/test/exemplars/issue_category_exemplar.rb index d0e4c11a..90c8a0d4 100644 --- a/test/exemplars/issue_category_exemplar.rb +++ b/test/exemplars/issue_category_exemplar.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 IssueCategory < ActiveRecord::Base generator_for :name, :method => :next_name - + def self.next_name @last_name ||= 'Category 0001' @last_name.succ! diff --git a/test/exemplars/issue_exemplar.rb b/test/exemplars/issue_exemplar.rb index f11be166..bd572004 100644 --- a/test/exemplars/issue_exemplar.rb +++ b/test/exemplars/issue_exemplar.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 Issue < ActiveRecord::Base generator_for :subject, :method => :next_subject generator_for :author, :method => :next_author generator_for :priority, :method => :fetch_priority - + def self.next_subject @last_subject ||= 'Subject 0' @last_subject.succ! diff --git a/test/exemplars/issue_priority_exemplar.rb b/test/exemplars/issue_priority_exemplar.rb index 5e98ba66..6e5cdc42 100644 --- a/test/exemplars/issue_priority_exemplar.rb +++ b/test/exemplars/issue_priority_exemplar.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/test/exemplars/issue_status_exemplar.rb b/test/exemplars/issue_status_exemplar.rb index 791f4d6d..0bc6f620 100644 --- a/test/exemplars/issue_status_exemplar.rb +++ b/test/exemplars/issue_status_exemplar.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/test/exemplars/journal_exemplar.rb b/test/exemplars/journal_exemplar.rb index 935dd707..a28c3774 100644 --- a/test/exemplars/journal_exemplar.rb +++ b/test/exemplars/journal_exemplar.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/test/exemplars/member_exemplar.rb b/test/exemplars/member_exemplar.rb index 2a54294f..99d3623f 100644 --- a/test/exemplars/member_exemplar.rb +++ b/test/exemplars/member_exemplar.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/test/exemplars/member_role_exemplar.rb b/test/exemplars/member_role_exemplar.rb index e9c7878c..76fdbee2 100644 --- a/test/exemplars/member_role_exemplar.rb +++ b/test/exemplars/member_role_exemplar.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/test/exemplars/message_exemplar.rb b/test/exemplars/message_exemplar.rb index 341fabf6..cba78052 100644 --- a/test/exemplars/message_exemplar.rb +++ b/test/exemplars/message_exemplar.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/test/exemplars/news_exemplar.rb b/test/exemplars/news_exemplar.rb index 4861abce..768d0bab 100644 --- a/test/exemplars/news_exemplar.rb +++ b/test/exemplars/news_exemplar.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/test/exemplars/project_exemplar.rb b/test/exemplars/project_exemplar.rb index 6aefaf7a..383d92b7 100644 --- a/test/exemplars/project_exemplar.rb +++ b/test/exemplars/project_exemplar.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. #++ @@ -16,7 +16,7 @@ class Project < ActiveRecord::Base generator_for :identifier, :method => :next_identifier_from_object_daddy generator_for :enabled_modules, :method => :all_modules generator_for :trackers, :method => :next_tracker - + def self.next_name @last_name ||= 'Project 0' @last_name.succ! diff --git a/test/exemplars/query_exemplar.rb b/test/exemplars/query_exemplar.rb index f61ec171..2eb3e8b5 100644 --- a/test/exemplars/query_exemplar.rb +++ b/test/exemplars/query_exemplar.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/test/exemplars/repository_exemplar.rb b/test/exemplars/repository_exemplar.rb index 6899ac06..0a24468f 100644 --- a/test/exemplars/repository_exemplar.rb +++ b/test/exemplars/repository_exemplar.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/test/exemplars/role_exemplar.rb b/test/exemplars/role_exemplar.rb index a1e95932..c3fbc988 100644 --- a/test/exemplars/role_exemplar.rb +++ b/test/exemplars/role_exemplar.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/test/exemplars/subversion_repository_exemplar.rb b/test/exemplars/subversion_repository_exemplar.rb index 2d406308..16fd1ff0 100644 --- a/test/exemplars/subversion_repository_exemplar.rb +++ b/test/exemplars/subversion_repository_exemplar.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/test/exemplars/time_entry_activity.rb b/test/exemplars/time_entry_activity.rb index 97a77f93..242461d1 100644 --- a/test/exemplars/time_entry_activity.rb +++ b/test/exemplars/time_entry_activity.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/test/exemplars/time_entry_exemplar.rb b/test/exemplars/time_entry_exemplar.rb index 2bec3cc9..b89991be 100644 --- a/test/exemplars/time_entry_exemplar.rb +++ b/test/exemplars/time_entry_exemplar.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,5 +19,5 @@ class TimeEntry < ActiveRecord::Base def self.generate_user User.generate_with_protected! end - + end diff --git a/test/exemplars/tracker_exemplar.rb b/test/exemplars/tracker_exemplar.rb index 31c52c41..420e10cc 100644 --- a/test/exemplars/tracker_exemplar.rb +++ b/test/exemplars/tracker_exemplar.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/test/exemplars/user_exemplar.rb b/test/exemplars/user_exemplar.rb index af4867d9..82623350 100644 --- a/test/exemplars/user_exemplar.rb +++ b/test/exemplars/user_exemplar.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. #++ @@ -16,13 +16,13 @@ class User < Principal generator_for :mail, :method => :next_email generator_for :firstname, :method => :next_firstname generator_for :lastname, :method => :next_lastname - + def self.next_login @gen_login ||= 'user1' @gen_login.succ! @gen_login end - + def self.next_email @last_email ||= 'user1' @last_email.succ! diff --git a/test/exemplars/version_exemplar.rb b/test/exemplars/version_exemplar.rb index 6d4bc89b..1204d5a9 100644 --- a/test/exemplars/version_exemplar.rb +++ b/test/exemplars/version_exemplar.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 Version < ActiveRecord::Base generator_for :name, :method => :next_name generator_for :status => 'open' - + def self.next_name @last_name ||= 'Version 1.0.0' @last_name.succ! diff --git a/test/exemplars/watcher_exemplar.rb b/test/exemplars/watcher_exemplar.rb index 1b30c3f0..8746a6b1 100644 --- a/test/exemplars/watcher_exemplar.rb +++ b/test/exemplars/watcher_exemplar.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/test/exemplars/wiki_content_exemplar.rb b/test/exemplars/wiki_content_exemplar.rb index d13a1625..efb68b2e 100644 --- a/test/exemplars/wiki_content_exemplar.rb +++ b/test/exemplars/wiki_content_exemplar.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/test/exemplars/wiki_exemplar.rb b/test/exemplars/wiki_exemplar.rb index 23d12085..03ce71e3 100644 --- a/test/exemplars/wiki_exemplar.rb +++ b/test/exemplars/wiki_exemplar.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/test/exemplars/wiki_page_exemplar.rb b/test/exemplars/wiki_page_exemplar.rb index f94f93bc..6131af42 100644 --- a/test/exemplars/wiki_page_exemplar.rb +++ b/test/exemplars/wiki_page_exemplar.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/test/exemplars/wiki_redirect_exemplar.rb b/test/exemplars/wiki_redirect_exemplar.rb index ea5b3112..36b39f8e 100644 --- a/test/exemplars/wiki_redirect_exemplar.rb +++ b/test/exemplars/wiki_redirect_exemplar.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/test/fixtures/attachments.yml b/test/fixtures/attachments.yml index bd4a86ac..eed1bf95 100644 --- a/test/fixtures/attachments.yml +++ b/test/fixtures/attachments.yml @@ -1,5 +1,5 @@ ---- -attachments_001: +--- +attachments_001: created_on: 2006-07-19 21:07:27 +02:00 downloads: 0 content_type: text/plain @@ -11,7 +11,7 @@ attachments_001: filesize: 28 filename: error281.txt author_id: 2 -attachments_002: +attachments_002: created_on: 2007-01-27 15:08:27 +01:00 downloads: 0 content_type: text/plain @@ -23,7 +23,7 @@ attachments_002: filesize: 28 filename: document.txt author_id: 2 -attachments_003: +attachments_003: created_on: 2006-07-19 21:07:27 +02:00 downloads: 0 content_type: image/gif @@ -36,7 +36,7 @@ attachments_003: filename: logo.gif description: This is a logo author_id: 2 -attachments_004: +attachments_004: created_on: 2006-07-19 21:07:27 +02:00 container_type: Issue container_id: 3 @@ -49,7 +49,7 @@ attachments_004: author_id: 2 description: This is a Ruby source file content_type: application/x-ruby -attachments_005: +attachments_005: created_on: 2006-07-19 21:07:27 +02:00 container_type: Issue container_id: 3 @@ -61,7 +61,7 @@ attachments_005: filename: changeset_iso8859-1.diff author_id: 2 content_type: text/x-diff -attachments_006: +attachments_006: created_on: 2006-07-19 21:07:27 +02:00 container_type: Issue container_id: 3 @@ -73,7 +73,7 @@ attachments_006: filename: archive.zip author_id: 2 content_type: application/octet-stream -attachments_007: +attachments_007: created_on: 2006-07-19 21:07:27 +02:00 container_type: Issue container_id: 4 @@ -85,7 +85,7 @@ attachments_007: filename: archive.zip author_id: 1 content_type: application/octet-stream -attachments_008: +attachments_008: created_on: 2006-07-19 21:07:27 +02:00 container_type: Project container_id: 1 @@ -97,7 +97,7 @@ attachments_008: filename: project_file.zip author_id: 2 content_type: application/octet-stream -attachments_009: +attachments_009: created_on: 2006-07-19 21:07:27 +02:00 container_type: Version container_id: 1 @@ -109,7 +109,7 @@ attachments_009: filename: version_file.zip author_id: 2 content_type: application/octet-stream -attachments_010: +attachments_010: created_on: 2006-07-19 21:07:27 +02:00 container_type: Issue container_id: 2 @@ -121,7 +121,7 @@ attachments_010: filename: picture.jpg author_id: 2 content_type: image/jpeg -attachments_011: +attachments_011: created_on: 2007-02-12 15:08:27 +01:00 container_type: Document container_id: 1 @@ -157,7 +157,7 @@ attachments_013: filename: foo.zip author_id: 2 content_type: application/octet-stream -attachments_014: +attachments_014: created_on: 2006-07-19 21:07:27 +02:00 container_type: Issue container_id: 3 diff --git a/test/fixtures/auth_sources.yml b/test/fixtures/auth_sources.yml index e478ad0a..804aea65 100644 --- a/test/fixtures/auth_sources.yml +++ b/test/fixtures/auth_sources.yml @@ -1,5 +1,5 @@ ---- -auth_sources_001: +--- +auth_sources_001: id: 1 type: AuthSourceLdap name: 'LDAP test server' diff --git a/test/fixtures/boards.yml b/test/fixtures/boards.yml index cce3fdcc..53791b6d 100644 --- a/test/fixtures/boards.yml +++ b/test/fixtures/boards.yml @@ -1,5 +1,5 @@ ---- -boards_001: +--- +boards_001: name: Help project_id: 1 topics_count: 2 @@ -8,21 +8,21 @@ boards_001: position: 1 last_message_id: 6 messages_count: 6 -boards_002: +boards_002: name: Discussion project_id: 1 topics_count: 0 id: 2 description: Discussion board position: 2 - last_message_id: + last_message_id: messages_count: 0 -boards_003: +boards_003: name: Discussion project_id: 2 topics_count: 0 id: 3 description: Discussion board position: 1 - last_message_id: + last_message_id: messages_count: 0 diff --git a/test/fixtures/changes.yml b/test/fixtures/changes.yml index ae606f2b..aef68153 100644 --- a/test/fixtures/changes.yml +++ b/test/fixtures/changes.yml @@ -1,23 +1,23 @@ ---- -changes_001: +--- +changes_001: id: 1 changeset_id: 100 action: A path: /test/some/path/in/the/repo from_path: from_revision: -changes_002: +changes_002: id: 2 changeset_id: 100 action: A path: /test/some/path/elsewhere/in/the/repo from_path: from_revision: -changes_003: +changes_003: id: 3 changeset_id: 101 action: M path: /test/some/path/in/the/repo from_path: from_revision: - \ No newline at end of file + diff --git a/test/fixtures/changesets.yml b/test/fixtures/changesets.yml index a7d168a6..50d16984 100644 --- a/test/fixtures/changesets.yml +++ b/test/fixtures/changesets.yml @@ -1,5 +1,5 @@ ---- -changesets_001: +--- +changesets_001: commit_date: 2007-04-11 committed_on: 2007-04-11 15:14:44 +02:00 revision: 1 @@ -8,7 +8,7 @@ changesets_001: repository_id: 10 committer: dlopper user_id: 3 -changesets_002: +changesets_002: commit_date: 2007-04-12 committed_on: 2007-04-12 15:14:44 +02:00 revision: 2 @@ -17,7 +17,7 @@ changesets_002: repository_id: 10 committer: dlopper user_id: 3 -changesets_003: +changesets_003: commit_date: 2007-04-12 committed_on: 2007-04-12 15:14:44 +02:00 revision: 3 @@ -28,7 +28,7 @@ changesets_003: repository_id: 10 committer: dlopper user_id: 3 -changesets_004: +changesets_004: commit_date: 2007-04-12 committed_on: 2007-04-12 15:14:44 +02:00 revision: 4 @@ -39,7 +39,7 @@ changesets_004: repository_id: 10 committer: dlopper user_id: 3 -changesets_005: +changesets_005: commit_date: "2007-09-10" comments: Modified one file in the folder. committed_on: 2007-09-10 19:01:08 @@ -49,7 +49,7 @@ changesets_005: user_id: 3 repository_id: 10 committer: dlopper -changesets_006: +changesets_006: commit_date: "2007-09-10" comments: Moved helloworld.rb from / to /folder. committed_on: 2007-09-10 19:01:47 @@ -59,7 +59,7 @@ changesets_006: user_id: 3 repository_id: 10 committer: dlopper -changesets_007: +changesets_007: commit_date: "2007-09-10" comments: Removed one file. committed_on: 2007-09-10 19:02:16 @@ -69,7 +69,7 @@ changesets_007: user_id: 3 repository_id: 10 committer: dlopper -changesets_008: +changesets_008: commit_date: "2007-09-10" comments: |- This commits references an issue. @@ -81,7 +81,7 @@ changesets_008: user_id: 3 repository_id: 10 committer: dlopper -changesets_009: +changesets_009: commit_date: "2009-09-10" comments: One file added. committed_on: 2009-09-10 19:04:35 @@ -91,7 +91,7 @@ changesets_009: user_id: 3 repository_id: 10 committer: dlopper -changesets_010: +changesets_010: commit_date: "2009-09-10" comments: Same file modified. committed_on: 2009-09-10 19:04:35 @@ -101,4 +101,4 @@ changesets_010: user_id: 3 repository_id: 10 committer: dlopper - \ No newline at end of file + diff --git a/test/fixtures/comments.yml b/test/fixtures/comments.yml index 538f67ed..8388fd1f 100644 --- a/test/fixtures/comments.yml +++ b/test/fixtures/comments.yml @@ -1,5 +1,5 @@ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html -comments_001: +comments_001: commented_type: News commented_id: 1 id: 1 @@ -7,7 +7,7 @@ comments_001: comments: my first comment created_on: 2006-12-10 18:10:10 +01:00 updated_on: 2006-12-10 18:10:10 +01:00 -comments_002: +comments_002: commented_type: News commented_id: 1 id: 2 @@ -15,4 +15,4 @@ comments_002: comments: This is an other comment created_on: 2006-12-10 18:12:10 +01:00 updated_on: 2006-12-10 18:12:10 +01:00 - \ No newline at end of file + diff --git a/test/fixtures/configuration/default.yml b/test/fixtures/configuration/default.yml index 89a60f13..09fc1466 100644 --- a/test/fixtures/configuration/default.yml +++ b/test/fixtures/configuration/default.yml @@ -1,6 +1,6 @@ default: somesetting: foo - + production: development: diff --git a/test/fixtures/configuration/no_default.yml b/test/fixtures/configuration/no_default.yml index 161224a4..42f855ff 100644 --- a/test/fixtures/configuration/no_default.yml +++ b/test/fixtures/configuration/no_default.yml @@ -1,5 +1,5 @@ default: - + production: development: diff --git a/test/fixtures/configuration/overrides.yml b/test/fixtures/configuration/overrides.yml index d9be392b..6509fc5b 100644 --- a/test/fixtures/configuration/overrides.yml +++ b/test/fixtures/configuration/overrides.yml @@ -1,6 +1,6 @@ default: somesetting: foo - + production: development: diff --git a/test/fixtures/custom_fields.yml b/test/fixtures/custom_fields.yml index c80f85df..f884e759 100644 --- a/test/fixtures/custom_fields.yml +++ b/test/fixtures/custom_fields.yml @@ -1,5 +1,5 @@ ---- -custom_fields_001: +--- +custom_fields_001: name: Database min_length: 0 regexp: "" @@ -7,7 +7,7 @@ custom_fields_001: is_filter: true type: IssueCustomField max_length: 0 - possible_values: + possible_values: - MySQL - PostgreSQL - Oracle @@ -16,7 +16,7 @@ custom_fields_001: field_format: list default_value: "" editable: true -custom_fields_002: +custom_fields_002: name: Searchable field min_length: 1 regexp: "" @@ -30,7 +30,7 @@ custom_fields_002: searchable: true default_value: "Default string" editable: true -custom_fields_003: +custom_fields_003: name: Development status min_length: 0 regexp: "" @@ -38,7 +38,7 @@ custom_fields_003: is_filter: true type: ProjectCustomField max_length: 0 - possible_values: + possible_values: - Stable - Beta - Alpha @@ -48,7 +48,7 @@ custom_fields_003: field_format: list default_value: "" editable: true -custom_fields_004: +custom_fields_004: name: Phone number min_length: 0 regexp: "" @@ -61,7 +61,7 @@ custom_fields_004: field_format: string default_value: "" editable: true -custom_fields_005: +custom_fields_005: name: Money min_length: 0 regexp: "" @@ -74,7 +74,7 @@ custom_fields_005: field_format: float default_value: "" editable: true -custom_fields_006: +custom_fields_006: name: Float field min_length: 0 regexp: "" @@ -87,7 +87,7 @@ custom_fields_006: field_format: float default_value: "" editable: true -custom_fields_007: +custom_fields_007: name: Billable min_length: 0 regexp: "" @@ -101,7 +101,7 @@ custom_fields_007: field_format: bool default_value: "" editable: true -custom_fields_008: +custom_fields_008: name: Custom date min_length: 0 regexp: "" @@ -115,7 +115,7 @@ custom_fields_008: field_format: date default_value: "" editable: true -custom_fields_009: +custom_fields_009: name: Project 1 cf min_length: 0 regexp: "" diff --git a/test/fixtures/custom_fields_projects.yml b/test/fixtures/custom_fields_projects.yml index bb9788bc..ae97574d 100644 --- a/test/fixtures/custom_fields_projects.yml +++ b/test/fixtures/custom_fields_projects.yml @@ -1,4 +1,4 @@ ---- -custom_fields_projects_001: +--- +custom_fields_projects_001: custom_field_id: 9 project_id: 1 diff --git a/test/fixtures/custom_fields_trackers.yml b/test/fixtures/custom_fields_trackers.yml index a356e4b8..30010f32 100644 --- a/test/fixtures/custom_fields_trackers.yml +++ b/test/fixtures/custom_fields_trackers.yml @@ -1,19 +1,19 @@ ---- -custom_fields_trackers_001: +--- +custom_fields_trackers_001: custom_field_id: 1 tracker_id: 1 -custom_fields_trackers_002: +custom_fields_trackers_002: custom_field_id: 2 tracker_id: 1 -custom_fields_trackers_003: +custom_fields_trackers_003: custom_field_id: 2 tracker_id: 3 -custom_fields_trackers_004: +custom_fields_trackers_004: custom_field_id: 6 tracker_id: 1 -custom_fields_trackers_005: +custom_fields_trackers_005: custom_field_id: 6 tracker_id: 2 -custom_fields_trackers_006: +custom_fields_trackers_006: custom_field_id: 6 tracker_id: 3 diff --git a/test/fixtures/custom_values.yml b/test/fixtures/custom_values.yml index d0dfe3a5..70c44494 100644 --- a/test/fixtures/custom_values.yml +++ b/test/fixtures/custom_values.yml @@ -1,101 +1,101 @@ ---- -custom_values_006: +--- +custom_values_006: customized_type: Issue custom_field_id: 2 customized_id: 3 id: 6 value: "125" -custom_values_007: +custom_values_007: customized_type: Project custom_field_id: 3 customized_id: 1 id: 7 value: Stable -custom_values_001: +custom_values_001: customized_type: Principal custom_field_id: 4 customized_id: 3 id: 1 value: "" -custom_values_002: +custom_values_002: customized_type: Principal custom_field_id: 4 customized_id: 4 id: 2 value: 01 23 45 67 89 -custom_values_003: +custom_values_003: customized_type: Principal custom_field_id: 4 customized_id: 2 id: 3 value: "01 42 50 00 00" -custom_values_004: +custom_values_004: customized_type: Issue custom_field_id: 2 customized_id: 1 id: 4 value: "125" -custom_values_005: +custom_values_005: customized_type: Issue custom_field_id: 2 customized_id: 2 id: 5 value: "" -custom_values_008: +custom_values_008: customized_type: Issue custom_field_id: 1 customized_id: 3 id: 8 value: "MySQL" -custom_values_009: +custom_values_009: customized_type: Issue custom_field_id: 2 customized_id: 7 id: 9 value: "this is a stringforcustomfield search" -custom_values_010: +custom_values_010: customized_type: Issue custom_field_id: 6 customized_id: 1 id: 10 value: "2.1" -custom_values_011: +custom_values_011: customized_type: Issue custom_field_id: 6 customized_id: 2 id: 11 value: "2.05" -custom_values_012: +custom_values_012: customized_type: Issue custom_field_id: 6 customized_id: 3 id: 12 value: "11.65" -custom_values_013: +custom_values_013: customized_type: Issue custom_field_id: 6 customized_id: 7 id: 13 value: "" -custom_values_014: +custom_values_014: customized_type: Issue custom_field_id: 6 customized_id: 5 id: 14 value: "-7.6" -custom_values_015: +custom_values_015: customized_type: Enumeration custom_field_id: 7 customized_id: 10 id: 15 value: true -custom_values_016: +custom_values_016: customized_type: Enumeration custom_field_id: 7 customized_id: 11 id: 16 value: '1' -custom_values_017: +custom_values_017: customized_type: Issue custom_field_id: 8 customized_id: 1 diff --git a/test/fixtures/documents.yml b/test/fixtures/documents.yml index 4f5d441d..e7ff9b34 100644 --- a/test/fixtures/documents.yml +++ b/test/fixtures/documents.yml @@ -1,11 +1,11 @@ -documents_001: +documents_001: created_on: 2007-01-27 15:08:27 +01:00 project_id: 1 title: "Test document" id: 1 description: "Document description" category_id: 1 -documents_002: +documents_002: created_on: 2007-02-12 15:08:27 +01:00 project_id: 1 title: "An other document" diff --git a/test/fixtures/enabled_modules.yml b/test/fixtures/enabled_modules.yml index 3b4eb7ac..4c132f70 100644 --- a/test/fixtures/enabled_modules.yml +++ b/test/fixtures/enabled_modules.yml @@ -1,101 +1,101 @@ ---- -enabled_modules_001: +--- +enabled_modules_001: name: issue_tracking project_id: 1 id: 1 -enabled_modules_002: +enabled_modules_002: name: time_tracking project_id: 1 id: 2 -enabled_modules_003: +enabled_modules_003: name: news project_id: 1 id: 3 -enabled_modules_004: +enabled_modules_004: name: documents project_id: 1 id: 4 -enabled_modules_005: +enabled_modules_005: name: files project_id: 1 id: 5 -enabled_modules_006: +enabled_modules_006: name: wiki project_id: 1 id: 6 -enabled_modules_007: +enabled_modules_007: name: repository project_id: 1 id: 7 -enabled_modules_008: +enabled_modules_008: name: boards project_id: 1 id: 8 -enabled_modules_009: +enabled_modules_009: name: repository project_id: 3 id: 9 -enabled_modules_010: +enabled_modules_010: name: wiki project_id: 3 id: 10 -enabled_modules_011: +enabled_modules_011: name: issue_tracking project_id: 2 id: 11 -enabled_modules_012: +enabled_modules_012: name: time_tracking project_id: 3 id: 12 -enabled_modules_013: +enabled_modules_013: name: issue_tracking project_id: 3 id: 13 -enabled_modules_014: +enabled_modules_014: name: issue_tracking project_id: 5 id: 14 -enabled_modules_015: +enabled_modules_015: name: wiki project_id: 2 id: 15 -enabled_modules_016: +enabled_modules_016: name: boards project_id: 2 id: 16 -enabled_modules_017: +enabled_modules_017: name: calendar project_id: 1 id: 17 -enabled_modules_018: - name: gantt +enabled_modules_018: + name: gantt project_id: 1 id: 18 -enabled_modules_019: +enabled_modules_019: name: calendar project_id: 2 id: 19 -enabled_modules_020: - name: gantt +enabled_modules_020: + name: gantt project_id: 2 id: 20 -enabled_modules_021: +enabled_modules_021: name: calendar project_id: 3 id: 21 -enabled_modules_022: +enabled_modules_022: name: gantt project_id: 3 id: 22 -enabled_modules_023: +enabled_modules_023: name: calendar project_id: 5 id: 23 -enabled_modules_024: - name: gantt +enabled_modules_024: + name: gantt project_id: 5 id: 24 -enabled_modules_025: - name: news +enabled_modules_025: + name: news project_id: 2 id: 25 diff --git a/test/fixtures/enumerations.yml b/test/fixtures/enumerations.yml index c4a25d95..451a4f7f 100644 --- a/test/fixtures/enumerations.yml +++ b/test/fixtures/enumerations.yml @@ -1,64 +1,64 @@ ---- -enumerations_001: +--- +enumerations_001: name: Uncategorized id: 1 type: DocumentCategory active: true -enumerations_002: +enumerations_002: name: User documentation id: 2 type: DocumentCategory active: true -enumerations_003: +enumerations_003: name: Technical documentation id: 3 type: DocumentCategory active: true -enumerations_004: +enumerations_004: name: Low id: 4 type: IssuePriority active: true position: 1 -enumerations_005: +enumerations_005: name: Normal id: 5 type: IssuePriority is_default: true active: true position: 2 -enumerations_006: +enumerations_006: name: High id: 6 type: IssuePriority active: true position: 3 -enumerations_007: +enumerations_007: name: Urgent id: 7 type: IssuePriority active: true position: 4 -enumerations_008: +enumerations_008: name: Immediate id: 8 type: IssuePriority active: true position: 5 -enumerations_009: +enumerations_009: name: Design id: 9 type: TimeEntryActivity position: 1 active: true -enumerations_010: +enumerations_010: name: Development id: 10 type: TimeEntryActivity position: 2 is_default: true active: true -enumerations_011: +enumerations_011: name: QA id: 11 type: TimeEntryActivity @@ -75,7 +75,7 @@ enumerations_013: id: 13 type: Enumeration active: true -enumerations_014: +enumerations_014: name: Inactive Activity id: 14 type: TimeEntryActivity diff --git a/test/fixtures/files/060719210727_source.rb b/test/fixtures/files/060719210727_source.rb index 507ce25f..4fa90e72 100644 --- a/test/fixtures/files/060719210727_source.rb +++ b/test/fixtures/files/060719210727_source.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,6 +18,6 @@ class Greeter end def salute - puts "Hello #{@name}!" + puts "Hello #{@name}!" end end diff --git a/test/fixtures/groups_users.yml b/test/fixtures/groups_users.yml index a7ee94e8..9c786267 100644 --- a/test/fixtures/groups_users.yml +++ b/test/fixtures/groups_users.yml @@ -1,8 +1,8 @@ ---- -groups_users_001: +--- +groups_users_001: group_id: 10 user_id: 8 -groups_users_002: +groups_users_002: group_id: 11 user_id: 8 - \ No newline at end of file + diff --git a/test/fixtures/issue_categories.yml b/test/fixtures/issue_categories.yml index bb68b5ff..e85d9f78 100644 --- a/test/fixtures/issue_categories.yml +++ b/test/fixtures/issue_categories.yml @@ -1,22 +1,22 @@ ---- -issue_categories_001: +--- +issue_categories_001: name: Printing project_id: 1 assigned_to_id: 2 id: 1 -issue_categories_002: +issue_categories_002: name: Recipes project_id: 1 - assigned_to_id: + assigned_to_id: id: 2 -issue_categories_003: +issue_categories_003: name: Stock management project_id: 2 - assigned_to_id: + assigned_to_id: id: 3 -issue_categories_004: +issue_categories_004: name: Printing project_id: 2 - assigned_to_id: + assigned_to_id: id: 4 - \ No newline at end of file + diff --git a/test/fixtures/issue_relations.yml b/test/fixtures/issue_relations.yml index 088b2b33..9af4cb9a 100644 --- a/test/fixtures/issue_relations.yml +++ b/test/fixtures/issue_relations.yml @@ -10,4 +10,4 @@ issue_relation_002: issue_to_id: 3 relation_type: relates delay: - + diff --git a/test/fixtures/issue_statuses.yml b/test/fixtures/issue_statuses.yml index ff40b1c5..b6baed8c 100644 --- a/test/fixtures/issue_statuses.yml +++ b/test/fixtures/issue_statuses.yml @@ -1,35 +1,35 @@ ---- -issue_statuses_001: +--- +issue_statuses_001: id: 1 name: New is_default: true is_closed: false position: 1 -issue_statuses_002: +issue_statuses_002: id: 2 name: Assigned is_default: false is_closed: false position: 2 -issue_statuses_003: +issue_statuses_003: id: 3 name: Resolved is_default: false is_closed: false position: 3 -issue_statuses_004: +issue_statuses_004: name: Feedback id: 4 is_default: false is_closed: false position: 4 -issue_statuses_005: +issue_statuses_005: id: 5 name: Closed is_default: false is_closed: true position: 5 -issue_statuses_006: +issue_statuses_006: id: 6 name: Rejected is_default: false diff --git a/test/fixtures/issues.yml b/test/fixtures/issues.yml index e1381778..4fe0e92b 100644 --- a/test/fixtures/issues.yml +++ b/test/fixtures/issues.yml @@ -1,16 +1,16 @@ ---- -issues_001: +--- +issues_001: created_on: <%= 3.days.ago.to_date.to_s(:db) %> project_id: 1 updated_on: <%= 1.day.ago.to_date.to_s(:db) %> priority_id: 4 subject: Can't print recipes id: 1 - fixed_version_id: + fixed_version_id: category_id: 1 description: Unable to print recipes tracker_id: 1 - assigned_to_id: + assigned_to_id: author_id: 2 status_id: 1 start_date: <%= 1.day.ago.to_date.to_s(:db) %> @@ -18,7 +18,7 @@ issues_001: root_id: 1 lft: 1 rgt: 2 -issues_002: +issues_002: created_on: 2006-07-19 21:04:21 +02:00 project_id: 1 updated_on: 2006-07-19 21:09:50 +02:00 @@ -26,28 +26,28 @@ issues_002: subject: Add ingredients categories id: 2 fixed_version_id: 2 - category_id: + category_id: description: Ingredients of the recipe should be classified by categories tracker_id: 2 assigned_to_id: 3 author_id: 2 status_id: 2 start_date: <%= 2.day.ago.to_date.to_s(:db) %> - due_date: + due_date: root_id: 2 lft: 1 rgt: 2 lock_version: 3 done_ratio: 30 -issues_003: +issues_003: created_on: 2006-07-19 21:07:27 +02:00 project_id: 1 updated_on: 2006-07-19 21:07:27 +02:00 priority_id: 4 subject: Error 281 when updating a recipe id: 3 - fixed_version_id: - category_id: + fixed_version_id: + category_id: description: Error 281 is encountered when saving a recipe tracker_id: 1 assigned_to_id: 3 @@ -58,15 +58,15 @@ issues_003: root_id: 3 lft: 1 rgt: 2 -issues_004: +issues_004: created_on: <%= 5.days.ago.to_date.to_s(:db) %> project_id: 2 updated_on: <%= 2.days.ago.to_date.to_s(:db) %> priority_id: 4 subject: Issue on project 2 id: 4 - fixed_version_id: - category_id: + fixed_version_id: + category_id: description: Issue on project 2 tracker_id: 1 assigned_to_id: 2 @@ -75,35 +75,35 @@ issues_004: root_id: 4 lft: 1 rgt: 2 -issues_005: +issues_005: created_on: <%= 5.days.ago.to_date.to_s(:db) %> project_id: 3 updated_on: <%= 2.days.ago.to_date.to_s(:db) %> priority_id: 4 subject: Subproject issue id: 5 - fixed_version_id: - category_id: + fixed_version_id: + category_id: description: This is an issue on a cookbook subproject tracker_id: 1 - assigned_to_id: + assigned_to_id: author_id: 2 status_id: 1 root_id: 5 lft: 1 rgt: 2 -issues_006: +issues_006: created_on: <%= 1.minute.ago.to_date.to_s(:db) %> project_id: 5 updated_on: <%= 1.minute.ago.to_date.to_s(:db) %> priority_id: 4 subject: Issue of a private subproject id: 6 - fixed_version_id: - category_id: + fixed_version_id: + category_id: description: This is an issue of a private subproject of cookbook tracker_id: 1 - assigned_to_id: + assigned_to_id: author_id: 2 status_id: 1 start_date: <%= Date.today.to_s(:db) %> @@ -111,18 +111,18 @@ issues_006: root_id: 6 lft: 1 rgt: 2 -issues_007: +issues_007: created_on: <%= 10.days.ago.to_date.to_s(:db) %> project_id: 1 updated_on: <%= 10.days.ago.to_date.to_s(:db) %> priority_id: 5 subject: Issue due today id: 7 - fixed_version_id: - category_id: + fixed_version_id: + category_id: description: This is an issue that is due today tracker_id: 1 - assigned_to_id: + assigned_to_id: author_id: 2 status_id: 1 start_date: <%= 10.days.ago.to_s(:db) %> @@ -131,38 +131,38 @@ issues_007: root_id: 7 lft: 1 rgt: 2 -issues_008: +issues_008: created_on: <%= 10.days.ago.to_date.to_s(:db) %> project_id: 1 updated_on: <%= 10.days.ago.to_date.to_s(:db) %> priority_id: 5 subject: Closed issue id: 8 - fixed_version_id: - category_id: + fixed_version_id: + category_id: description: This is a closed issue. tracker_id: 1 - assigned_to_id: + assigned_to_id: author_id: 2 status_id: 5 - start_date: - due_date: + start_date: + due_date: lock_version: 0 root_id: 8 lft: 1 rgt: 2 -issues_009: +issues_009: created_on: <%= 1.minute.ago.to_date.to_s(:db) %> project_id: 5 updated_on: <%= 1.minute.ago.to_date.to_s(:db) %> priority_id: 5 subject: Blocked Issue id: 9 - fixed_version_id: - category_id: + fixed_version_id: + category_id: description: This is an issue that is blocked by issue #10 tracker_id: 1 - assigned_to_id: + assigned_to_id: author_id: 2 status_id: 1 start_date: <%= Date.today.to_s(:db) %> @@ -170,18 +170,18 @@ issues_009: root_id: 9 lft: 1 rgt: 2 -issues_010: +issues_010: created_on: <%= 1.minute.ago.to_date.to_s(:db) %> project_id: 5 updated_on: <%= 1.minute.ago.to_date.to_s(:db) %> priority_id: 5 subject: Issue Doing the Blocking id: 10 - fixed_version_id: - category_id: + fixed_version_id: + category_id: description: This is an issue that blocks issue #9 tracker_id: 1 - assigned_to_id: + assigned_to_id: author_id: 2 status_id: 1 start_date: <%= Date.today.to_s(:db) %> @@ -189,18 +189,18 @@ issues_010: root_id: 10 lft: 1 rgt: 2 -issues_011: +issues_011: created_on: <%= 3.days.ago.to_date.to_s(:db) %> project_id: 1 updated_on: <%= 1.day.ago.to_date.to_s(:db) %> priority_id: 5 subject: Closed issue on a closed version id: 11 - fixed_version_id: 1 + fixed_version_id: 1 category_id: 1 description: tracker_id: 1 - assigned_to_id: + assigned_to_id: author_id: 2 status_id: 5 start_date: <%= 1.day.ago.to_date.to_s(:db) %> @@ -208,18 +208,18 @@ issues_011: root_id: 11 lft: 1 rgt: 2 -issues_012: +issues_012: created_on: <%= 3.days.ago.to_date.to_s(:db) %> project_id: 1 updated_on: <%= 1.day.ago.to_date.to_s(:db) %> priority_id: 5 subject: Closed issue on a locked version id: 12 - fixed_version_id: 2 + fixed_version_id: 2 category_id: 1 description: tracker_id: 1 - assigned_to_id: + assigned_to_id: author_id: 3 status_id: 5 start_date: <%= 1.day.ago.to_date.to_s(:db) %> @@ -234,11 +234,11 @@ issues_013: priority_id: 4 subject: Subproject issue two id: 13 - fixed_version_id: - category_id: + fixed_version_id: + category_id: description: This is a second issue on a cookbook subproject tracker_id: 1 - assigned_to_id: + assigned_to_id: author_id: 2 status_id: 1 root_id: 13 diff --git a/test/fixtures/mail_handler/issue_update_with_multiple_quoted_reply_above.eml b/test/fixtures/mail_handler/issue_update_with_multiple_quoted_reply_above.eml index 13684349..ff96d9d0 100644 --- a/test/fixtures/mail_handler/issue_update_with_multiple_quoted_reply_above.eml +++ b/test/fixtures/mail_handler/issue_update_with_multiple_quoted_reply_above.eml @@ -21,28 +21,28 @@ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 An update to the issue by the sender. -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet -turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus -blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti -sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In -in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras -sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum -id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus -eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique -sed, mauris --- Pellentesque habitant morbi tristique senectus et netus et -malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet +turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus +blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti +sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In +in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras +sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum +id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus +eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique +sed, mauris --- Pellentesque habitant morbi tristique senectus et netus et +malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse platea dictumst. >> > --- Reply above. Do not remove this line. --- ->> > +>> > >> > Issue #6779 has been updated by Eric Davis. ->> > +>> > >> > Subject changed from Projects with JSON to Project JSON API >> > Status changed from New to Assigned >> > Assignee set to Eric Davis >> > Priority changed from Low to Normal >> > Estimated time deleted (1.00) ->> > +>> > >> > Looks like the JSON api for projects was missed. I'm going to be >> > reviewing the existing APIs and trying to clean them up over the next >> > few weeks. diff --git a/test/fixtures/mail_handler/issue_update_with_quoted_reply_above.eml b/test/fixtures/mail_handler/issue_update_with_quoted_reply_above.eml index d70b918e..fd931f58 100644 --- a/test/fixtures/mail_handler/issue_update_with_quoted_reply_above.eml +++ b/test/fixtures/mail_handler/issue_update_with_quoted_reply_above.eml @@ -21,28 +21,28 @@ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 An update to the issue by the sender. -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet -turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus -blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti -sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In -in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras -sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum -id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus -eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique -sed, mauris --- Pellentesque habitant morbi tristique senectus et netus et -malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet +turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus +blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti +sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In +in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras +sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum +id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus +eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique +sed, mauris --- Pellentesque habitant morbi tristique senectus et netus et +malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse platea dictumst. > --- Reply above. Do not remove this line. --- -> +> > Issue #6779 has been updated by Eric Davis. -> +> > Subject changed from Projects with JSON to Project JSON API > Status changed from New to Assigned > Assignee set to Eric Davis > Priority changed from Low to Normal > Estimated time deleted (1.00) -> +> > Looks like the JSON api for projects was missed. I'm going to be > reviewing the existing APIs and trying to clean them up over the next > few weeks. diff --git a/test/fixtures/mail_handler/ticket_on_given_project.eml b/test/fixtures/mail_handler/ticket_on_given_project.eml index 5e6d9113..a0842140 100644 --- a/test/fixtures/mail_handler/ticket_on_given_project.eml +++ b/test/fixtures/mail_handler/ticket_on_given_project.eml @@ -18,16 +18,16 @@ X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet -turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus -blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti -sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In -in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras -sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum -id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus -eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique -sed, mauris --- Pellentesque habitant morbi tristique senectus et netus et -malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet +turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus +blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti +sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In +in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras +sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum +id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus +eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique +sed, mauris --- Pellentesque habitant morbi tristique senectus et netus et +malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse platea dictumst. --- This line starts with a delimiter and should not be stripped @@ -42,11 +42,11 @@ This paragraph is between delimiters. This paragraph is after the delimiter so it shouldn't appear. -Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque -sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. -Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, -dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, -massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo +Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque +sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. +Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, +dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, +massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo pulvinar dui, a gravida orci mi eget odio. Nunc a lacus. Project: onlinestore diff --git a/test/fixtures/mail_handler/ticket_with_attributes.eml b/test/fixtures/mail_handler/ticket_with_attributes.eml index 11852349..c3c976fe 100644 --- a/test/fixtures/mail_handler/ticket_with_attributes.eml +++ b/test/fixtures/mail_handler/ticket_with_attributes.eml @@ -18,23 +18,23 @@ X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet -turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus -blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti -sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In -in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras -sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum -id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus -eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique -sed, mauris. Pellentesque habitant morbi tristique senectus et netus et -malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet +turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus +blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti +sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In +in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras +sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum +id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus +eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique +sed, mauris. Pellentesque habitant morbi tristique senectus et netus et +malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse platea dictumst. -Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque -sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. -Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, -dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, -massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo +Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque +sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. +Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, +dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, +massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo pulvinar dui, a gravida orci mi eget odio. Nunc a lacus. Project: onlinestore diff --git a/test/fixtures/mail_handler/ticket_with_cc.eml b/test/fixtures/mail_handler/ticket_with_cc.eml index f809fed7..353a0cd0 100644 --- a/test/fixtures/mail_handler/ticket_with_cc.eml +++ b/test/fixtures/mail_handler/ticket_with_cc.eml @@ -19,22 +19,22 @@ X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet -turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus -blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti -sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In -in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras -sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum -id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus -eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique -sed, mauris. Pellentesque habitant morbi tristique senectus et netus et -malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet +turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus +blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti +sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In +in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras +sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum +id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus +eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique +sed, mauris. Pellentesque habitant morbi tristique senectus et netus et +malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse platea dictumst. -Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque -sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. -Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, -dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, -massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo +Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque +sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. +Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, +dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, +massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo pulvinar dui, a gravida orci mi eget odio. Nunc a lacus. diff --git a/test/fixtures/mail_handler/ticket_with_custom_fields.eml b/test/fixtures/mail_handler/ticket_with_custom_fields.eml index f3798a4b..df2e7a48 100644 --- a/test/fixtures/mail_handler/ticket_with_custom_fields.eml +++ b/test/fixtures/mail_handler/ticket_with_custom_fields.eml @@ -18,23 +18,23 @@ X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet -turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus -blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti -sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In -in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras -sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum -id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus -eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique -sed, mauris. Pellentesque habitant morbi tristique senectus et netus et -malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet +turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus +blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti +sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In +in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras +sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum +id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus +eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique +sed, mauris. Pellentesque habitant morbi tristique senectus et netus et +malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse platea dictumst. -Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque -sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. -Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, -dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, -massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo +Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque +sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. +Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, +dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, +massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo pulvinar dui, a gravida orci mi eget odio. Nunc a lacus. category: Stock management diff --git a/test/fixtures/mail_handler/ticket_with_invalid_attributes.eml b/test/fixtures/mail_handler/ticket_with_invalid_attributes.eml index cdb72474..1bc04897 100644 --- a/test/fixtures/mail_handler/ticket_with_invalid_attributes.eml +++ b/test/fixtures/mail_handler/ticket_with_invalid_attributes.eml @@ -18,23 +18,23 @@ X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet -turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus -blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti -sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In -in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras -sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum -id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus -eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique -sed, mauris. Pellentesque habitant morbi tristique senectus et netus et -malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet +turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus +blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti +sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In +in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras +sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum +id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus +eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique +sed, mauris. Pellentesque habitant morbi tristique senectus et netus et +malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse platea dictumst. -Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque -sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. -Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, -dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, -massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo +Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque +sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. +Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, +dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, +massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo pulvinar dui, a gravida orci mi eget odio. Nunc a lacus. Project: onlinestore @@ -43,5 +43,5 @@ category: Stock management assigned to: miscuser9@foo.bar priority: foo done ratio: x -start date: some day +start date: some day due date: never diff --git a/test/fixtures/mail_handler/ticket_with_localized_attributes.eml b/test/fixtures/mail_handler/ticket_with_localized_attributes.eml index 34b39a3c..6540ae66 100644 --- a/test/fixtures/mail_handler/ticket_with_localized_attributes.eml +++ b/test/fixtures/mail_handler/ticket_with_localized_attributes.eml @@ -18,23 +18,23 @@ X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet -turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus -blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti -sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In -in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras -sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum -id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus -eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique -sed, mauris. Pellentesque habitant morbi tristique senectus et netus et -malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet +turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus +blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti +sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In +in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras +sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum +id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus +eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique +sed, mauris. Pellentesque habitant morbi tristique senectus et netus et +malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse platea dictumst. -Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque -sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. -Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, -dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, -massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo +Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque +sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. +Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, +dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, +massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo pulvinar dui, a gravida orci mi eget odio. Nunc a lacus. Projet: onlinestore diff --git a/test/fixtures/mail_handler/ticket_with_long_subject.eml b/test/fixtures/mail_handler/ticket_with_long_subject.eml index 0c379af5..7912c196 100644 --- a/test/fixtures/mail_handler/ticket_with_long_subject.eml +++ b/test/fixtures/mail_handler/ticket_with_long_subject.eml @@ -18,16 +18,16 @@ X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet -turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus -blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti -sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In -in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras -sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum -id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus -eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique -sed, mauris --- Pellentesque habitant morbi tristique senectus et netus et -malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet +turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus +blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti +sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In +in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras +sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum +id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus +eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique +sed, mauris --- Pellentesque habitant morbi tristique senectus et netus et +malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse platea dictumst. --- This line starts with a delimiter and should not be stripped @@ -42,11 +42,11 @@ This paragraph is between delimiters. This paragraph is after the delimiter so it shouldn't appear. -Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque -sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. -Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, -dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, -massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo +Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque +sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. +Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, +dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, +massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo pulvinar dui, a gravida orci mi eget odio. Nunc a lacus. Project: onlinestore diff --git a/test/fixtures/mail_handler/ticket_with_spaces_between_attribute_and_separator.eml b/test/fixtures/mail_handler/ticket_with_spaces_between_attribute_and_separator.eml index 995ef01e..d194647e 100644 --- a/test/fixtures/mail_handler/ticket_with_spaces_between_attribute_and_separator.eml +++ b/test/fixtures/mail_handler/ticket_with_spaces_between_attribute_and_separator.eml @@ -18,23 +18,23 @@ X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet -turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus -blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti -sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In -in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras -sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum -id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus -eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique -sed, mauris. Pellentesque habitant morbi tristique senectus et netus et -malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet +turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus +blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti +sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In +in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras +sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum +id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus +eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique +sed, mauris. Pellentesque habitant morbi tristique senectus et netus et +malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse platea dictumst. -Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque -sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. -Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, -dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, -massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo +Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque +sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. +Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, +dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, +massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo pulvinar dui, a gravida orci mi eget odio. Nunc a lacus. Project : onlinestore diff --git a/test/fixtures/mail_handler/ticket_without_from_header.eml b/test/fixtures/mail_handler/ticket_without_from_header.eml index b49f22ce..ac944ff5 100644 --- a/test/fixtures/mail_handler/ticket_without_from_header.eml +++ b/test/fixtures/mail_handler/ticket_without_from_header.eml @@ -16,23 +16,23 @@ X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet -turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus -blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti -sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In -in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras -sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum -id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus -eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique -sed, mauris. Pellentesque habitant morbi tristique senectus et netus et -malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas imperdiet +turpis et odio. Integer eget pede vel dolor euismod varius. Phasellus +blandit eleifend augue. Nulla facilisi. Duis id diam. Class aptent taciti +sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In +in urna sed tellus aliquet lobortis. Morbi scelerisque tortor in dolor. Cras +sagittis odio eu lacus. Aliquam sem tortor, consequat sit amet, vestibulum +id, iaculis at, lectus. Fusce tortor libero, congue ut, euismod nec, luctus +eget, eros. Pellentesque tortor enim, feugiat in, dignissim eget, tristique +sed, mauris. Pellentesque habitant morbi tristique senectus et netus et +malesuada fames ac turpis egestas. Quisque sit amet libero. In hac habitasse platea dictumst. -Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque -sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. -Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, -dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, -massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo +Nulla et nunc. Duis pede. Donec et ipsum. Nam ut dui tincidunt neque +sollicitudin iaculis. Duis vitae dolor. Vestibulum eget massa. Sed lorem. +Nullam volutpat cursus erat. Cras felis dolor, lacinia quis, rutrum et, +dictum et, ligula. Sed erat nibh, gravida in, accumsan non, placerat sed, +massa. Sed sodales, ante fermentum ultricies sollicitudin, massa leo pulvinar dui, a gravida orci mi eget odio. Nunc a lacus. Project: onlinestore diff --git a/test/fixtures/member_roles.yml b/test/fixtures/member_roles.yml index 7ddcb878..7df3f25f 100644 --- a/test/fixtures/member_roles.yml +++ b/test/fixtures/member_roles.yml @@ -1,48 +1,48 @@ ---- -member_roles_001: +--- +member_roles_001: id: 1 role_id: 1 member_id: 1 -member_roles_002: +member_roles_002: id: 2 role_id: 2 member_id: 2 -member_roles_003: +member_roles_003: id: 3 role_id: 2 member_id: 3 -member_roles_004: +member_roles_004: id: 4 role_id: 2 member_id: 4 -member_roles_005: +member_roles_005: id: 5 role_id: 1 member_id: 5 -member_roles_006: +member_roles_006: id: 6 role_id: 1 member_id: 6 -member_roles_007: +member_roles_007: id: 7 role_id: 2 member_id: 6 -member_roles_008: +member_roles_008: id: 8 role_id: 1 member_id: 7 inherited_from: 6 -member_roles_009: +member_roles_009: id: 9 role_id: 2 member_id: 7 inherited_from: 7 -member_roles_010: +member_roles_010: id: 10 role_id: 2 member_id: 9 inherited_from: -member_roles_011: +member_roles_011: id: 11 role_id: 2 member_id: 10 diff --git a/test/fixtures/members.yml b/test/fixtures/members.yml index f4d39fb8..cae67f2d 100644 --- a/test/fixtures/members.yml +++ b/test/fixtures/members.yml @@ -1,42 +1,42 @@ ---- -members_001: +--- +members_001: created_on: 2006-07-19 19:35:33 +02:00 project_id: 1 id: 1 user_id: 2 mail_notification: true -members_002: +members_002: created_on: 2006-07-19 19:35:36 +02:00 project_id: 1 id: 2 user_id: 3 mail_notification: true -members_003: +members_003: created_on: 2006-07-19 19:35:36 +02:00 project_id: 2 id: 3 user_id: 2 mail_notification: true -members_004: +members_004: id: 4 created_on: 2006-07-19 19:35:36 +02:00 project_id: 1 # Locked user user_id: 5 mail_notification: true -members_005: +members_005: id: 5 created_on: 2006-07-19 19:35:33 +02:00 project_id: 5 user_id: 2 mail_notification: true -members_006: +members_006: id: 6 created_on: 2006-07-19 19:35:33 +02:00 project_id: 5 user_id: 10 mail_notification: false -members_007: +members_007: id: 7 created_on: 2006-07-19 19:35:33 +02:00 project_id: 5 @@ -48,13 +48,13 @@ members_008: id: 8 user_id: 1 mail_notification: true -members_009: +members_009: id: 9 created_on: 2006-07-19 19:35:33 +02:00 project_id: 2 user_id: 11 mail_notification: false -members_010: +members_010: id: 10 created_on: 2006-07-19 19:35:33 +02:00 project_id: 2 diff --git a/test/fixtures/messages.yml b/test/fixtures/messages.yml index b193599d..586e4796 100644 --- a/test/fixtures/messages.yml +++ b/test/fixtures/messages.yml @@ -1,5 +1,5 @@ ---- -messages_001: +--- +messages_001: created_on: 2007-05-12 17:15:32 +02:00 updated_on: 2007-05-12 17:15:32 +02:00 subject: First post @@ -9,31 +9,31 @@ messages_001: content: "This is the very first post\n\ in the forum" author_id: 1 - parent_id: + parent_id: board_id: 1 -messages_002: +messages_002: created_on: 2007-05-12 17:18:00 +02:00 updated_on: 2007-05-12 17:18:00 +02:00 subject: First reply id: 2 replies_count: 0 - last_reply_id: + last_reply_id: content: "Reply to the first post" author_id: 1 parent_id: 1 board_id: 1 -messages_003: +messages_003: created_on: 2007-05-12 17:18:02 +02:00 updated_on: 2007-05-12 17:18:02 +02:00 subject: "RE: First post" id: 3 replies_count: 0 - last_reply_id: + last_reply_id: content: "An other reply" author_id: 2 parent_id: 1 board_id: 1 -messages_004: +messages_004: created_on: 2007-08-12 17:15:32 +02:00 updated_on: 2007-08-12 17:15:32 +02:00 subject: Post 2 @@ -41,39 +41,39 @@ messages_004: replies_count: 2 last_reply_id: 6 content: "This is an other post" - author_id: - parent_id: + author_id: + parent_id: board_id: 1 -messages_005: +messages_005: created_on: <%= 3.days.ago.to_date.to_s(:db) %> updated_on: <%= 3.days.ago.to_date.to_s(:db) %> subject: 'RE: post 2' id: 5 replies_count: 0 - last_reply_id: + last_reply_id: content: "Reply to the second post" author_id: 1 parent_id: 4 board_id: 1 -messages_006: +messages_006: created_on: <%= 2.days.ago.to_date.to_s(:db) %> updated_on: <%= 2.days.ago.to_date.to_s(:db) %> subject: 'RE: post 2' id: 6 replies_count: 0 - last_reply_id: + last_reply_id: content: "Another reply to the second post" author_id: 3 parent_id: 4 board_id: 1 -messages_007: +messages_007: created_on: <%= 2.days.ago.to_date.to_s(:db) %> updated_on: <%= 2.days.ago.to_date.to_s(:db) %> subject: 'Message on a private project' id: 7 replies_count: 0 - last_reply_id: + last_reply_id: content: "This is a private message" author_id: 1 - parent_id: + parent_id: board_id: 3 diff --git a/test/fixtures/news.yml b/test/fixtures/news.yml index 9876065e..7f791167 100644 --- a/test/fixtures/news.yml +++ b/test/fixtures/news.yml @@ -1,17 +1,17 @@ ---- -news_001: +--- +news_001: created_on: 2006-07-19 22:40:26 +02:00 project_id: 1 title: eCookbook first release ! id: 1 description: |- eCookbook 1.0 has been released. - + Visit http://ecookbook.somenet.foo/ summary: First version was released... author_id: 2 comments_count: 1 -news_002: +news_002: created_on: 2006-07-19 22:42:58 +02:00 project_id: 1 title: 100,000 downloads for eCookbook @@ -20,7 +20,7 @@ news_002: summary: eCookbook 1.0 have downloaded 100,000 times author_id: 2 comments_count: 0 -news_003: +news_003: created_on: 2006-07-19 22:42:58 +02:00 project_id: 2 title: News on a private project diff --git a/test/fixtures/projects.yml b/test/fixtures/projects.yml index 6ecc8ad7..2fe967c2 100644 --- a/test/fixtures/projects.yml +++ b/test/fixtures/projects.yml @@ -1,5 +1,5 @@ ---- -projects_001: +--- +projects_001: created_on: 2006-07-19 19:13:59 +02:00 name: eCookbook updated_on: 2006-07-19 22:53:01 +02:00 @@ -8,10 +8,10 @@ projects_001: homepage: http://ecookbook.somenet.foo/ is_public: true identifier: ecookbook - parent_id: + parent_id: lft: 1 rgt: 10 -projects_002: +projects_002: created_on: 2006-07-19 19:14:19 +02:00 name: OnlineStore updated_on: 2006-07-19 19:14:19 +02:00 @@ -20,10 +20,10 @@ projects_002: homepage: "" is_public: false identifier: onlinestore - parent_id: + parent_id: lft: 11 rgt: 12 -projects_003: +projects_003: created_on: 2006-07-19 19:15:21 +02:00 name: eCookbook Subproject 1 updated_on: 2006-07-19 19:18:12 +02:00 @@ -35,7 +35,7 @@ projects_003: parent_id: 1 lft: 6 rgt: 7 -projects_004: +projects_004: created_on: 2006-07-19 19:15:51 +02:00 name: eCookbook Subproject 2 updated_on: 2006-07-19 19:17:07 +02:00 @@ -47,7 +47,7 @@ projects_004: parent_id: 1 lft: 8 rgt: 9 -projects_005: +projects_005: created_on: 2006-07-19 19:15:51 +02:00 name: Private child of eCookbook updated_on: 2006-07-19 19:17:07 +02:00 @@ -59,7 +59,7 @@ projects_005: parent_id: 1 lft: 2 rgt: 5 -projects_006: +projects_006: created_on: 2006-07-19 19:15:51 +02:00 name: Child of private child updated_on: 2006-07-19 19:17:07 +02:00 @@ -71,4 +71,4 @@ projects_006: parent_id: 5 lft: 3 rgt: 4 - \ No newline at end of file + diff --git a/test/fixtures/projects_trackers.yml b/test/fixtures/projects_trackers.yml index 4766a9f8..424a239d 100644 --- a/test/fixtures/projects_trackers.yml +++ b/test/fixtures/projects_trackers.yml @@ -1,44 +1,44 @@ ---- -projects_trackers_001: +--- +projects_trackers_001: project_id: 4 tracker_id: 3 -projects_trackers_002: +projects_trackers_002: project_id: 1 tracker_id: 1 -projects_trackers_003: +projects_trackers_003: project_id: 5 tracker_id: 1 -projects_trackers_004: +projects_trackers_004: project_id: 1 tracker_id: 2 -projects_trackers_005: +projects_trackers_005: project_id: 5 tracker_id: 2 -projects_trackers_006: +projects_trackers_006: project_id: 5 tracker_id: 3 -projects_trackers_007: +projects_trackers_007: project_id: 2 tracker_id: 1 -projects_trackers_008: +projects_trackers_008: project_id: 2 tracker_id: 2 -projects_trackers_009: +projects_trackers_009: project_id: 2 tracker_id: 3 -projects_trackers_010: +projects_trackers_010: project_id: 3 tracker_id: 2 -projects_trackers_011: +projects_trackers_011: project_id: 3 tracker_id: 3 -projects_trackers_012: +projects_trackers_012: project_id: 4 tracker_id: 1 -projects_trackers_013: +projects_trackers_013: project_id: 4 tracker_id: 2 -projects_trackers_014: +projects_trackers_014: project_id: 1 tracker_id: 3 - \ No newline at end of file + diff --git a/test/fixtures/queries.yml b/test/fixtures/queries.yml index a49f82fb..21c9dd38 100644 --- a/test/fixtures/queries.yml +++ b/test/fixtures/queries.yml @@ -1,156 +1,156 @@ ---- -queries_001: +--- +queries_001: id: 1 project_id: 1 is_public: true name: Multiple custom fields query filters: | - --- - cf_1: - :values: + --- + cf_1: + :values: - MySQL :operator: "=" - status_id: - :values: + status_id: + :values: - "1" :operator: o - cf_2: - :values: + cf_2: + :values: - "125" :operator: "=" user_id: 1 - column_names: -queries_002: + column_names: +queries_002: id: 2 project_id: 1 is_public: false name: Private query for cookbook filters: | - --- - tracker_id: - :values: + --- + tracker_id: + :values: - "3" :operator: "=" - status_id: - :values: + status_id: + :values: - "1" :operator: o user_id: 3 - column_names: -queries_003: + column_names: +queries_003: id: 3 - project_id: + project_id: is_public: false name: Private query for all projects filters: | - --- - tracker_id: - :values: + --- + tracker_id: + :values: - "3" :operator: "=" user_id: 3 - column_names: -queries_004: + column_names: +queries_004: id: 4 - project_id: + project_id: is_public: true name: Public query for all projects filters: | - --- - tracker_id: - :values: + --- + tracker_id: + :values: - "3" :operator: "=" user_id: 2 - column_names: -queries_005: + column_names: +queries_005: id: 5 - project_id: + project_id: is_public: true name: Open issues by priority and tracker filters: | - --- - status_id: - :values: + --- + status_id: + :values: - "1" :operator: o user_id: 1 - column_names: + column_names: sort_criteria: | - --- + --- - - priority - desc - - tracker - asc -queries_006: +queries_006: id: 6 - project_id: + project_id: is_public: true name: Open issues grouped by tracker filters: | - --- - status_id: - :values: + --- + status_id: + :values: - "1" :operator: o user_id: 1 - column_names: + column_names: group_by: tracker sort_criteria: | - --- + --- - - priority - desc -queries_007: +queries_007: id: 7 project_id: 2 is_public: true name: Public query for project 2 filters: | - --- - tracker_id: - :values: + --- + tracker_id: + :values: - "3" :operator: "=" user_id: 2 - column_names: -queries_008: + column_names: +queries_008: id: 8 project_id: 2 is_public: false name: Private query for project 2 filters: | - --- - tracker_id: - :values: + --- + tracker_id: + :values: - "3" :operator: "=" user_id: 2 - column_names: -queries_009: + column_names: +queries_009: id: 9 - project_id: + project_id: is_public: true name: Open issues grouped by list custom field filters: | - --- - status_id: - :values: + --- + status_id: + :values: - "1" :operator: o user_id: 1 - column_names: + column_names: group_by: cf_1 sort_criteria: | - --- + --- - - priority - desc diff --git a/test/fixtures/repositories.yml b/test/fixtures/repositories.yml index c5510589..f3b9e604 100644 --- a/test/fixtures/repositories.yml +++ b/test/fixtures/repositories.yml @@ -1,5 +1,5 @@ ---- -repositories_001: +--- +repositories_001: project_id: 1 url: file:///<%= RAILS_ROOT.gsub(%r{config\/\.\.}, '') %>/tmp/test/subversion_repository id: 10 @@ -7,7 +7,7 @@ repositories_001: password: "" login: "" type: Subversion -repositories_002: +repositories_002: project_id: 2 url: svn://localhost/test id: 11 diff --git a/test/fixtures/roles.yml b/test/fixtures/roles.yml index 979cc321..cd2538cc 100644 --- a/test/fixtures/roles.yml +++ b/test/fixtures/roles.yml @@ -1,10 +1,10 @@ ---- -roles_001: +--- +roles_001: name: Manager id: 1 builtin: 0 permissions: | - --- + --- - :add_project - :edit_project - :select_project_modules @@ -54,12 +54,12 @@ roles_001: - :manage_project_activities position: 1 -roles_002: +roles_002: name: Developer id: 2 builtin: 0 permissions: | - --- + --- - :edit_project - :manage_members - :manage_versions @@ -98,12 +98,12 @@ roles_002: - :view_changesets position: 2 -roles_003: +roles_003: name: Reporter id: 3 builtin: 0 permissions: | - --- + --- - :edit_project - :manage_members - :manage_versions @@ -136,12 +136,12 @@ roles_003: - :view_changesets position: 3 -roles_004: +roles_004: name: Non member id: 4 builtin: 1 permissions: | - --- + --- - :view_issues - :add_issues - :edit_issues @@ -166,12 +166,12 @@ roles_004: - :view_changesets position: 4 -roles_005: +roles_005: name: Anonymous id: 5 builtin: 2 permissions: | - --- + --- - :view_issues - :add_issue_notes - :view_gantt diff --git a/test/fixtures/time_entries.yml b/test/fixtures/time_entries.yml index f56b05aa..9404267f 100644 --- a/test/fixtures/time_entries.yml +++ b/test/fixtures/time_entries.yml @@ -1,5 +1,5 @@ ---- -time_entries_001: +--- +time_entries_001: created_on: 2007-03-23 12:54:18 +01:00 tweek: 12 tmonth: 3 @@ -13,7 +13,7 @@ time_entries_001: hours: 4.25 user_id: 2 tyear: 2007 -time_entries_002: +time_entries_002: created_on: 2007-03-23 14:11:04 +01:00 tweek: 11 tmonth: 3 @@ -27,7 +27,7 @@ time_entries_002: hours: 150.0 user_id: 1 tyear: 2007 -time_entries_003: +time_entries_003: created_on: 2007-04-21 12:20:48 +02:00 tweek: 16 tmonth: 4 @@ -41,7 +41,7 @@ time_entries_003: hours: 1.0 user_id: 1 tyear: 2007 -time_entries_004: +time_entries_004: created_on: 2007-04-22 12:20:48 +02:00 tweek: 16 tmonth: 4 @@ -50,9 +50,9 @@ time_entries_004: updated_on: 2007-04-22 12:20:48 +02:00 activity_id: 10 spent_on: 2007-04-22 - issue_id: + issue_id: id: 4 hours: 7.65 user_id: 1 tyear: 2007 - + diff --git a/test/fixtures/tokens.yml b/test/fixtures/tokens.yml index 166d37ed..0334f5a7 100644 --- a/test/fixtures/tokens.yml +++ b/test/fixtures/tokens.yml @@ -1,11 +1,11 @@ ---- -tokens_001: +--- +tokens_001: created_on: 2007-01-21 00:39:12 +01:00 action: register id: 1 value: DwMJ2yIxBNeAk26znMYzYmz5dAiIina0GFrPnGTM user_id: 1 -tokens_002: +tokens_002: created_on: 2007-01-21 00:39:52 +01:00 action: recovery id: 2 diff --git a/test/fixtures/trackers.yml b/test/fixtures/trackers.yml index 43395a2e..5671179f 100644 --- a/test/fixtures/trackers.yml +++ b/test/fixtures/trackers.yml @@ -1,15 +1,15 @@ ---- -trackers_001: +--- +trackers_001: name: Bug id: 1 is_in_chlog: true position: 1 -trackers_002: +trackers_002: name: Feature request id: 2 is_in_chlog: true position: 2 -trackers_003: +trackers_003: name: Support request id: 3 is_in_chlog: false diff --git a/test/fixtures/user_preferences.yml b/test/fixtures/user_preferences.yml index 01e008dc..890e167b 100644 --- a/test/fixtures/user_preferences.yml +++ b/test/fixtures/user_preferences.yml @@ -1,31 +1,31 @@ ---- -user_preferences_001: +--- +user_preferences_001: others: | - --- - :my_page_layout: - left: + --- + :my_page_layout: + left: - latestnews - documents - right: + right: - issuesassignedtome - top: + top: - calendar id: 1 user_id: 1 hide_mail: true -user_preferences_002: +user_preferences_002: others: | - --- - :my_page_layout: - left: + --- + :my_page_layout: + left: - latestnews - documents - right: + right: - issuesassignedtome - top: + top: - calendar - + id: 2 user_id: 3 hide_mail: false \ No newline at end of file diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 1e612fc9..bcd13693 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -1,8 +1,8 @@ ---- -users_004: +--- +users_004: created_on: 2006-07-19 19:34:07 +02:00 status: 1 - last_login_on: + last_login_on: language: en # password = foo salt: 3126f764c3c5ac61cbfc103f25f934cf @@ -13,11 +13,11 @@ users_004: lastname: Hill firstname: Robert id: 4 - auth_source_id: + auth_source_id: mail_notification: all login: rhill type: User -users_001: +users_001: created_on: 2006-07-19 19:12:21 +02:00 status: 1 last_login_on: 2006-07-19 22:57:52 +02:00 @@ -31,11 +31,11 @@ users_001: lastname: Admin firstname: redMine id: 1 - auth_source_id: + auth_source_id: mail_notification: all login: admin type: User -users_002: +users_002: created_on: 2006-07-19 19:32:09 +02:00 status: 1 last_login_on: 2006-07-19 22:42:15 +02:00 @@ -49,14 +49,14 @@ users_002: lastname: Smith firstname: John id: 2 - auth_source_id: + auth_source_id: mail_notification: all login: jsmith type: User -users_003: +users_003: created_on: 2006-07-19 19:33:19 +02:00 status: 1 - last_login_on: + last_login_on: language: en # password = foo salt: 7599f9963ec07b5a3b55b354407120c0 @@ -67,16 +67,16 @@ users_003: lastname: Lopper firstname: Dave id: 3 - auth_source_id: + auth_source_id: mail_notification: all login: dlopper type: User -users_005: +users_005: id: 5 created_on: 2006-07-19 19:33:19 +02:00 # Locked status: 3 - last_login_on: + last_login_on: language: en hashed_password: 1 updated_on: 2006-07-19 19:33:19 +02:00 @@ -84,15 +84,15 @@ users_005: mail: dlopper2@somenet.foo lastname: Lopper2 firstname: Dave2 - auth_source_id: + auth_source_id: mail_notification: all login: dlopper2 type: User -users_006: +users_006: id: 6 created_on: 2006-07-19 19:33:19 +02:00 status: 0 - last_login_on: + last_login_on: language: '' hashed_password: 1 updated_on: 2006-07-19 19:33:19 +02:00 @@ -100,15 +100,15 @@ users_006: mail: '' lastname: Anonymous firstname: '' - auth_source_id: + auth_source_id: mail_notification: only_my_events login: '' type: AnonymousUser -users_007: +users_007: id: 7 created_on: 2006-07-19 19:33:19 +02:00 status: 1 - last_login_on: + last_login_on: language: '' hashed_password: 1 updated_on: 2006-07-19 19:33:19 +02:00 @@ -116,15 +116,15 @@ users_007: mail: someone@foo.bar lastname: One firstname: Some - auth_source_id: + auth_source_id: mail_notification: only_my_events login: someone type: User -users_008: +users_008: id: 8 created_on: 2006-07-19 19:33:19 +02:00 status: 1 - last_login_on: + last_login_on: language: 'it' hashed_password: 1 updated_on: 2006-07-19 19:33:19 +02:00 @@ -132,15 +132,15 @@ users_008: mail: miscuser8@foo.bar lastname: Misc firstname: User - auth_source_id: + auth_source_id: mail_notification: only_my_events login: miscuser8 type: User -users_009: +users_009: id: 9 created_on: 2006-07-19 19:33:19 +02:00 status: 1 - last_login_on: + last_login_on: language: 'it' hashed_password: 1 updated_on: 2006-07-19 19:33:19 +02:00 @@ -148,17 +148,17 @@ users_009: mail: miscuser9@foo.bar lastname: Misc firstname: User - auth_source_id: + auth_source_id: mail_notification: only_my_events login: miscuser9 type: User -groups_010: +groups_010: id: 10 lastname: A Team type: Group -groups_011: +groups_011: id: 11 lastname: B Team type: Group - + diff --git a/test/fixtures/versions.yml b/test/fixtures/versions.yml index 3b59a2fe..26881c43 100644 --- a/test/fixtures/versions.yml +++ b/test/fixtures/versions.yml @@ -1,5 +1,5 @@ ---- -versions_001: +--- +versions_001: created_on: 2006-07-19 21:00:07 +02:00 name: "0.1" project_id: 1 @@ -9,7 +9,7 @@ versions_001: effective_date: 2006-07-01 status: closed sharing: 'none' -versions_002: +versions_002: created_on: 2006-07-19 21:00:33 +02:00 name: "1.0" project_id: 1 @@ -19,27 +19,27 @@ versions_002: effective_date: <%= 20.day.from_now.to_date.to_s(:db) %> status: locked sharing: 'none' -versions_003: +versions_003: created_on: 2006-07-19 21:00:33 +02:00 name: "2.0" project_id: 1 updated_on: 2006-07-19 21:00:33 +02:00 id: 3 description: Future version - effective_date: + effective_date: status: open sharing: 'none' -versions_004: +versions_004: created_on: 2006-07-19 21:00:33 +02:00 name: "2.0" project_id: 3 updated_on: 2006-07-19 21:00:33 +02:00 id: 4 description: Future version on subproject - effective_date: + effective_date: status: open sharing: 'tree' -versions_005: +versions_005: created_on: 2006-07-19 21:00:07 +02:00 name: "Alpha" project_id: 2 @@ -49,23 +49,23 @@ versions_005: effective_date: 2006-07-01 status: open sharing: 'none' -versions_006: +versions_006: created_on: 2006-07-19 21:00:07 +02:00 name: "Private Version of public subproject" project_id: 5 updated_on: 2006-07-19 21:00:07 +02:00 id: 6 description: "Should be done any day now..." - effective_date: + effective_date: status: open sharing: 'tree' -versions_007: +versions_007: created_on: 2006-07-19 21:00:07 +02:00 name: "Systemwide visible version" project_id: 2 updated_on: 2006-07-19 21:00:07 +02:00 id: 7 description: - effective_date: + effective_date: status: open sharing: 'system' diff --git a/test/fixtures/watchers.yml b/test/fixtures/watchers.yml index 803b03e5..d89f64a5 100644 --- a/test/fixtures/watchers.yml +++ b/test/fixtures/watchers.yml @@ -1,14 +1,14 @@ ---- -watchers_001: +--- +watchers_001: watchable_type: Issue watchable_id: 2 user_id: 3 -watchers_002: +watchers_002: watchable_type: Message watchable_id: 1 user_id: 1 -watchers_003: +watchers_003: watchable_type: Issue watchable_id: 2 user_id: 1 - \ No newline at end of file + diff --git a/test/fixtures/wiki_contents.yml b/test/fixtures/wiki_contents.yml index ba6087cf..bf2797b8 100644 --- a/test/fixtures/wiki_contents.yml +++ b/test/fixtures/wiki_contents.yml @@ -14,7 +14,7 @@ wiki_contents_001: wiki_contents_002: text: |- h1. Another page - + This is a link to a ticket: #2 And this is an included page: {{include(Page with an inline image)}} @@ -26,7 +26,7 @@ wiki_contents_002: wiki_contents_003: text: |- h1. Start page - + E-commerce web site start page updated_on: 2007-03-08 00:18:07 +01:00 page_id: 3 @@ -36,9 +36,9 @@ wiki_contents_003: wiki_contents_004: text: |- h1. Page with an inline image - + This is an inline image: - + !logo.gif! updated_on: 2007-03-08 00:18:07 +01:00 page_id: 4 @@ -48,7 +48,7 @@ wiki_contents_004: wiki_contents_005: text: |- h1. Child page 1 - + This is a child page updated_on: 2007-03-08 00:18:07 +01:00 page_id: 5 @@ -58,7 +58,7 @@ wiki_contents_005: wiki_contents_006: text: |- h1. Child page 2 - + This is a child page updated_on: 2007-03-08 00:18:07 +01:00 page_id: 6 @@ -93,4 +93,4 @@ wiki_contents_010: id: 10 lock_version: 1 author_id: 1 - + diff --git a/test/fixtures/wiki_pages.yml b/test/fixtures/wiki_pages.yml index 2d2e2ece..40577265 100644 --- a/test/fixtures/wiki_pages.yml +++ b/test/fixtures/wiki_pages.yml @@ -1,71 +1,71 @@ ---- -wiki_pages_001: +--- +wiki_pages_001: created_on: 2007-03-07 00:08:07 +01:00 title: CookBook_documentation id: 1 wiki_id: 1 protected: true - parent_id: -wiki_pages_002: + parent_id: +wiki_pages_002: created_on: 2007-03-08 00:18:07 +01:00 title: Another_page id: 2 wiki_id: 1 protected: false - parent_id: -wiki_pages_003: + parent_id: +wiki_pages_003: created_on: 2007-03-08 00:18:07 +01:00 title: Start_page id: 3 wiki_id: 2 protected: false - parent_id: -wiki_pages_004: + parent_id: +wiki_pages_004: created_on: 2007-03-08 00:18:07 +01:00 title: Page_with_an_inline_image id: 4 wiki_id: 1 protected: false parent_id: 1 -wiki_pages_005: +wiki_pages_005: created_on: 2007-03-08 00:18:07 +01:00 title: Child_1 id: 5 wiki_id: 1 protected: false parent_id: 2 -wiki_pages_006: +wiki_pages_006: created_on: 2007-03-08 00:18:07 +01:00 title: Child_2 id: 6 wiki_id: 1 protected: false parent_id: 2 -wiki_pages_007: +wiki_pages_007: created_on: 2007-03-08 00:18:07 +01:00 title: Child_page_1 id: 7 wiki_id: 2 protected: false parent_id: 8 -wiki_pages_008: +wiki_pages_008: created_on: 2007-03-08 00:18:07 +01:00 title: Parent_page id: 8 wiki_id: 2 protected: false - parent_id: -wiki_pages_009: + parent_id: +wiki_pages_009: created_on: 2007-03-08 00:18:07 +01:00 title: Child_page_2 id: 9 wiki_id: 2 protected: false parent_id: 8 -wiki_pages_010: +wiki_pages_010: created_on: 2007-03-08 00:18:07 +01:00 title: Этика_менеджмента id: 10 wiki_id: 1 protected: false - parent_id: + parent_id: diff --git a/test/fixtures/wikis.yml b/test/fixtures/wikis.yml index 1e74039d..f135eaba 100644 --- a/test/fixtures/wikis.yml +++ b/test/fixtures/wikis.yml @@ -1,12 +1,12 @@ ---- -wikis_001: +--- +wikis_001: status: 1 start_page: CookBook documentation project_id: 1 id: 1 -wikis_002: +wikis_002: status: 1 start_page: Start page project_id: 2 id: 2 - \ No newline at end of file + diff --git a/test/fixtures/workflows.yml b/test/fixtures/workflows.yml index 6126055c..76e0a043 100644 --- a/test/fixtures/workflows.yml +++ b/test/fixtures/workflows.yml @@ -1,1613 +1,1613 @@ ---- -workflows_189: +--- +workflows_189: new_status_id: 5 role_id: 1 old_status_id: 2 id: 189 tracker_id: 3 -workflows_001: +workflows_001: new_status_id: 2 role_id: 1 old_status_id: 1 id: 1 tracker_id: 1 -workflows_002: +workflows_002: new_status_id: 3 role_id: 1 old_status_id: 1 id: 2 tracker_id: 1 -workflows_003: +workflows_003: new_status_id: 4 role_id: 1 old_status_id: 1 id: 3 tracker_id: 1 -workflows_110: +workflows_110: new_status_id: 6 role_id: 1 old_status_id: 4 id: 110 tracker_id: 2 -workflows_004: +workflows_004: new_status_id: 5 role_id: 1 old_status_id: 1 id: 4 tracker_id: 1 -workflows_030: +workflows_030: new_status_id: 5 role_id: 1 old_status_id: 6 id: 30 tracker_id: 1 -workflows_111: +workflows_111: new_status_id: 1 role_id: 1 old_status_id: 5 id: 111 tracker_id: 2 -workflows_005: +workflows_005: new_status_id: 6 role_id: 1 old_status_id: 1 id: 5 tracker_id: 1 -workflows_031: +workflows_031: new_status_id: 2 role_id: 2 old_status_id: 1 id: 31 tracker_id: 1 -workflows_112: +workflows_112: new_status_id: 2 role_id: 1 old_status_id: 5 id: 112 tracker_id: 2 -workflows_006: +workflows_006: new_status_id: 1 role_id: 1 old_status_id: 2 id: 6 tracker_id: 1 -workflows_032: +workflows_032: new_status_id: 3 role_id: 2 old_status_id: 1 id: 32 tracker_id: 1 -workflows_113: +workflows_113: new_status_id: 3 role_id: 1 old_status_id: 5 id: 113 tracker_id: 2 -workflows_220: +workflows_220: new_status_id: 6 role_id: 2 old_status_id: 2 id: 220 tracker_id: 3 -workflows_007: +workflows_007: new_status_id: 3 role_id: 1 old_status_id: 2 id: 7 tracker_id: 1 -workflows_033: +workflows_033: new_status_id: 4 role_id: 2 old_status_id: 1 id: 33 tracker_id: 1 -workflows_060: +workflows_060: new_status_id: 5 role_id: 2 old_status_id: 6 id: 60 tracker_id: 1 -workflows_114: +workflows_114: new_status_id: 4 role_id: 1 old_status_id: 5 id: 114 tracker_id: 2 -workflows_140: +workflows_140: new_status_id: 6 role_id: 2 old_status_id: 4 id: 140 tracker_id: 2 -workflows_221: +workflows_221: new_status_id: 1 role_id: 2 old_status_id: 3 id: 221 tracker_id: 3 -workflows_008: +workflows_008: new_status_id: 4 role_id: 1 old_status_id: 2 id: 8 tracker_id: 1 -workflows_034: +workflows_034: new_status_id: 5 role_id: 2 old_status_id: 1 id: 34 tracker_id: 1 -workflows_115: +workflows_115: new_status_id: 6 role_id: 1 old_status_id: 5 id: 115 tracker_id: 2 -workflows_141: +workflows_141: new_status_id: 1 role_id: 2 old_status_id: 5 id: 141 tracker_id: 2 -workflows_222: +workflows_222: new_status_id: 2 role_id: 2 old_status_id: 3 id: 222 tracker_id: 3 -workflows_223: +workflows_223: new_status_id: 4 role_id: 2 old_status_id: 3 id: 223 tracker_id: 3 -workflows_009: +workflows_009: new_status_id: 5 role_id: 1 old_status_id: 2 id: 9 tracker_id: 1 -workflows_035: +workflows_035: new_status_id: 6 role_id: 2 old_status_id: 1 id: 35 tracker_id: 1 -workflows_061: +workflows_061: new_status_id: 2 role_id: 3 old_status_id: 1 id: 61 tracker_id: 1 -workflows_116: +workflows_116: new_status_id: 1 role_id: 1 old_status_id: 6 id: 116 tracker_id: 2 -workflows_142: +workflows_142: new_status_id: 2 role_id: 2 old_status_id: 5 id: 142 tracker_id: 2 -workflows_250: +workflows_250: new_status_id: 6 role_id: 3 old_status_id: 2 id: 250 tracker_id: 3 -workflows_224: +workflows_224: new_status_id: 5 role_id: 2 old_status_id: 3 id: 224 tracker_id: 3 -workflows_036: +workflows_036: new_status_id: 1 role_id: 2 old_status_id: 2 id: 36 tracker_id: 1 -workflows_062: +workflows_062: new_status_id: 3 role_id: 3 old_status_id: 1 id: 62 tracker_id: 1 -workflows_117: +workflows_117: new_status_id: 2 role_id: 1 old_status_id: 6 id: 117 tracker_id: 2 -workflows_143: +workflows_143: new_status_id: 3 role_id: 2 old_status_id: 5 id: 143 tracker_id: 2 -workflows_170: +workflows_170: new_status_id: 6 role_id: 3 old_status_id: 4 id: 170 tracker_id: 2 -workflows_251: +workflows_251: new_status_id: 1 role_id: 3 old_status_id: 3 id: 251 tracker_id: 3 -workflows_225: +workflows_225: new_status_id: 6 role_id: 2 old_status_id: 3 id: 225 tracker_id: 3 -workflows_063: +workflows_063: new_status_id: 4 role_id: 3 old_status_id: 1 id: 63 tracker_id: 1 -workflows_090: +workflows_090: new_status_id: 5 role_id: 3 old_status_id: 6 id: 90 tracker_id: 1 -workflows_118: +workflows_118: new_status_id: 3 role_id: 1 old_status_id: 6 id: 118 tracker_id: 2 -workflows_144: +workflows_144: new_status_id: 4 role_id: 2 old_status_id: 5 id: 144 tracker_id: 2 -workflows_252: +workflows_252: new_status_id: 2 role_id: 3 old_status_id: 3 id: 252 tracker_id: 3 -workflows_226: +workflows_226: new_status_id: 1 role_id: 2 old_status_id: 4 id: 226 tracker_id: 3 -workflows_038: +workflows_038: new_status_id: 4 role_id: 2 old_status_id: 2 id: 38 tracker_id: 1 -workflows_064: +workflows_064: new_status_id: 5 role_id: 3 old_status_id: 1 id: 64 tracker_id: 1 -workflows_091: +workflows_091: new_status_id: 2 role_id: 1 old_status_id: 1 id: 91 tracker_id: 2 -workflows_119: +workflows_119: new_status_id: 4 role_id: 1 old_status_id: 6 id: 119 tracker_id: 2 -workflows_145: +workflows_145: new_status_id: 6 role_id: 2 old_status_id: 5 id: 145 tracker_id: 2 -workflows_171: +workflows_171: new_status_id: 1 role_id: 3 old_status_id: 5 id: 171 tracker_id: 2 -workflows_253: +workflows_253: new_status_id: 4 role_id: 3 old_status_id: 3 id: 253 tracker_id: 3 -workflows_227: +workflows_227: new_status_id: 2 role_id: 2 old_status_id: 4 id: 227 tracker_id: 3 -workflows_039: +workflows_039: new_status_id: 5 role_id: 2 old_status_id: 2 id: 39 tracker_id: 1 -workflows_065: +workflows_065: new_status_id: 6 role_id: 3 old_status_id: 1 id: 65 tracker_id: 1 -workflows_092: +workflows_092: new_status_id: 3 role_id: 1 old_status_id: 1 id: 92 tracker_id: 2 -workflows_146: +workflows_146: new_status_id: 1 role_id: 2 old_status_id: 6 id: 146 tracker_id: 2 -workflows_172: +workflows_172: new_status_id: 2 role_id: 3 old_status_id: 5 id: 172 tracker_id: 2 -workflows_254: +workflows_254: new_status_id: 5 role_id: 3 old_status_id: 3 id: 254 tracker_id: 3 -workflows_228: +workflows_228: new_status_id: 3 role_id: 2 old_status_id: 4 id: 228 tracker_id: 3 -workflows_066: +workflows_066: new_status_id: 1 role_id: 3 old_status_id: 2 id: 66 tracker_id: 1 -workflows_093: +workflows_093: new_status_id: 4 role_id: 1 old_status_id: 1 id: 93 tracker_id: 2 -workflows_147: +workflows_147: new_status_id: 2 role_id: 2 old_status_id: 6 id: 147 tracker_id: 2 -workflows_173: +workflows_173: new_status_id: 3 role_id: 3 old_status_id: 5 id: 173 tracker_id: 2 -workflows_255: +workflows_255: new_status_id: 6 role_id: 3 old_status_id: 3 id: 255 tracker_id: 3 -workflows_229: +workflows_229: new_status_id: 5 role_id: 2 old_status_id: 4 id: 229 tracker_id: 3 -workflows_067: +workflows_067: new_status_id: 3 role_id: 3 old_status_id: 2 id: 67 tracker_id: 1 -workflows_148: +workflows_148: new_status_id: 3 role_id: 2 old_status_id: 6 id: 148 tracker_id: 2 -workflows_174: +workflows_174: new_status_id: 4 role_id: 3 old_status_id: 5 id: 174 tracker_id: 2 -workflows_256: +workflows_256: new_status_id: 1 role_id: 3 old_status_id: 4 id: 256 tracker_id: 3 -workflows_068: +workflows_068: new_status_id: 4 role_id: 3 old_status_id: 2 id: 68 tracker_id: 1 -workflows_094: +workflows_094: new_status_id: 5 role_id: 1 old_status_id: 1 id: 94 tracker_id: 2 -workflows_149: +workflows_149: new_status_id: 4 role_id: 2 old_status_id: 6 id: 149 tracker_id: 2 -workflows_175: +workflows_175: new_status_id: 6 role_id: 3 old_status_id: 5 id: 175 tracker_id: 2 -workflows_257: +workflows_257: new_status_id: 2 role_id: 3 old_status_id: 4 id: 257 tracker_id: 3 -workflows_069: +workflows_069: new_status_id: 5 role_id: 3 old_status_id: 2 id: 69 tracker_id: 1 -workflows_095: +workflows_095: new_status_id: 6 role_id: 1 old_status_id: 1 id: 95 tracker_id: 2 -workflows_176: +workflows_176: new_status_id: 1 role_id: 3 old_status_id: 6 id: 176 tracker_id: 2 -workflows_258: +workflows_258: new_status_id: 3 role_id: 3 old_status_id: 4 id: 258 tracker_id: 3 -workflows_096: +workflows_096: new_status_id: 1 role_id: 1 old_status_id: 2 id: 96 tracker_id: 2 -workflows_177: +workflows_177: new_status_id: 2 role_id: 3 old_status_id: 6 id: 177 tracker_id: 2 -workflows_259: +workflows_259: new_status_id: 5 role_id: 3 old_status_id: 4 id: 259 tracker_id: 3 -workflows_097: +workflows_097: new_status_id: 3 role_id: 1 old_status_id: 2 id: 97 tracker_id: 2 -workflows_178: +workflows_178: new_status_id: 3 role_id: 3 old_status_id: 6 id: 178 tracker_id: 2 -workflows_098: +workflows_098: new_status_id: 4 role_id: 1 old_status_id: 2 id: 98 tracker_id: 2 -workflows_179: +workflows_179: new_status_id: 4 role_id: 3 old_status_id: 6 id: 179 tracker_id: 2 -workflows_099: +workflows_099: new_status_id: 5 role_id: 1 old_status_id: 2 id: 99 tracker_id: 2 -workflows_100: +workflows_100: new_status_id: 6 role_id: 1 old_status_id: 2 id: 100 tracker_id: 2 -workflows_020: +workflows_020: new_status_id: 6 role_id: 1 old_status_id: 4 id: 20 tracker_id: 1 -workflows_101: +workflows_101: new_status_id: 1 role_id: 1 old_status_id: 3 id: 101 tracker_id: 2 -workflows_021: +workflows_021: new_status_id: 1 role_id: 1 old_status_id: 5 id: 21 tracker_id: 1 -workflows_102: +workflows_102: new_status_id: 2 role_id: 1 old_status_id: 3 id: 102 tracker_id: 2 -workflows_210: +workflows_210: new_status_id: 5 role_id: 1 old_status_id: 6 id: 210 tracker_id: 3 -workflows_022: +workflows_022: new_status_id: 2 role_id: 1 old_status_id: 5 id: 22 tracker_id: 1 -workflows_103: +workflows_103: new_status_id: 4 role_id: 1 old_status_id: 3 id: 103 tracker_id: 2 -workflows_023: +workflows_023: new_status_id: 3 role_id: 1 old_status_id: 5 id: 23 tracker_id: 1 -workflows_104: +workflows_104: new_status_id: 5 role_id: 1 old_status_id: 3 id: 104 tracker_id: 2 -workflows_130: +workflows_130: new_status_id: 6 role_id: 2 old_status_id: 2 id: 130 tracker_id: 2 -workflows_211: +workflows_211: new_status_id: 2 role_id: 2 old_status_id: 1 id: 211 tracker_id: 3 -workflows_024: +workflows_024: new_status_id: 4 role_id: 1 old_status_id: 5 id: 24 tracker_id: 1 -workflows_050: +workflows_050: new_status_id: 6 role_id: 2 old_status_id: 4 id: 50 tracker_id: 1 -workflows_105: +workflows_105: new_status_id: 6 role_id: 1 old_status_id: 3 id: 105 tracker_id: 2 -workflows_131: +workflows_131: new_status_id: 1 role_id: 2 old_status_id: 3 id: 131 tracker_id: 2 -workflows_212: +workflows_212: new_status_id: 3 role_id: 2 old_status_id: 1 id: 212 tracker_id: 3 -workflows_025: +workflows_025: new_status_id: 6 role_id: 1 old_status_id: 5 id: 25 tracker_id: 1 -workflows_051: +workflows_051: new_status_id: 1 role_id: 2 old_status_id: 5 id: 51 tracker_id: 1 -workflows_106: +workflows_106: new_status_id: 1 role_id: 1 old_status_id: 4 id: 106 tracker_id: 2 -workflows_132: +workflows_132: new_status_id: 2 role_id: 2 old_status_id: 3 id: 132 tracker_id: 2 -workflows_213: +workflows_213: new_status_id: 4 role_id: 2 old_status_id: 1 id: 213 tracker_id: 3 -workflows_240: +workflows_240: new_status_id: 5 role_id: 2 old_status_id: 6 id: 240 tracker_id: 3 -workflows_026: +workflows_026: new_status_id: 1 role_id: 1 old_status_id: 6 id: 26 tracker_id: 1 -workflows_052: +workflows_052: new_status_id: 2 role_id: 2 old_status_id: 5 id: 52 tracker_id: 1 -workflows_107: +workflows_107: new_status_id: 2 role_id: 1 old_status_id: 4 id: 107 tracker_id: 2 -workflows_133: +workflows_133: new_status_id: 4 role_id: 2 old_status_id: 3 id: 133 tracker_id: 2 -workflows_214: +workflows_214: new_status_id: 5 role_id: 2 old_status_id: 1 id: 214 tracker_id: 3 -workflows_241: +workflows_241: new_status_id: 2 role_id: 3 old_status_id: 1 id: 241 tracker_id: 3 -workflows_027: +workflows_027: new_status_id: 2 role_id: 1 old_status_id: 6 id: 27 tracker_id: 1 -workflows_053: +workflows_053: new_status_id: 3 role_id: 2 old_status_id: 5 id: 53 tracker_id: 1 -workflows_080: +workflows_080: new_status_id: 6 role_id: 3 old_status_id: 4 id: 80 tracker_id: 1 -workflows_108: +workflows_108: new_status_id: 3 role_id: 1 old_status_id: 4 id: 108 tracker_id: 2 -workflows_134: +workflows_134: new_status_id: 5 role_id: 2 old_status_id: 3 id: 134 tracker_id: 2 -workflows_160: +workflows_160: new_status_id: 6 role_id: 3 old_status_id: 2 id: 160 tracker_id: 2 -workflows_215: +workflows_215: new_status_id: 6 role_id: 2 old_status_id: 1 id: 215 tracker_id: 3 -workflows_242: +workflows_242: new_status_id: 3 role_id: 3 old_status_id: 1 id: 242 tracker_id: 3 -workflows_028: +workflows_028: new_status_id: 3 role_id: 1 old_status_id: 6 id: 28 tracker_id: 1 -workflows_054: +workflows_054: new_status_id: 4 role_id: 2 old_status_id: 5 id: 54 tracker_id: 1 -workflows_081: +workflows_081: new_status_id: 1 role_id: 3 old_status_id: 5 id: 81 tracker_id: 1 -workflows_109: +workflows_109: new_status_id: 5 role_id: 1 old_status_id: 4 id: 109 tracker_id: 2 -workflows_135: +workflows_135: new_status_id: 6 role_id: 2 old_status_id: 3 id: 135 tracker_id: 2 -workflows_161: +workflows_161: new_status_id: 1 role_id: 3 old_status_id: 3 id: 161 tracker_id: 2 -workflows_216: +workflows_216: new_status_id: 1 role_id: 2 old_status_id: 2 id: 216 tracker_id: 3 -workflows_243: +workflows_243: new_status_id: 4 role_id: 3 old_status_id: 1 id: 243 tracker_id: 3 -workflows_029: +workflows_029: new_status_id: 4 role_id: 1 old_status_id: 6 id: 29 tracker_id: 1 -workflows_055: +workflows_055: new_status_id: 6 role_id: 2 old_status_id: 5 id: 55 tracker_id: 1 -workflows_082: +workflows_082: new_status_id: 2 role_id: 3 old_status_id: 5 id: 82 tracker_id: 1 -workflows_136: +workflows_136: new_status_id: 1 role_id: 2 old_status_id: 4 id: 136 tracker_id: 2 -workflows_162: +workflows_162: new_status_id: 2 role_id: 3 old_status_id: 3 id: 162 tracker_id: 2 -workflows_217: +workflows_217: new_status_id: 3 role_id: 2 old_status_id: 2 id: 217 tracker_id: 3 -workflows_270: +workflows_270: new_status_id: 5 role_id: 3 old_status_id: 6 id: 270 tracker_id: 3 -workflows_244: +workflows_244: new_status_id: 5 role_id: 3 old_status_id: 1 id: 244 tracker_id: 3 -workflows_056: +workflows_056: new_status_id: 1 role_id: 2 old_status_id: 6 id: 56 tracker_id: 1 -workflows_137: +workflows_137: new_status_id: 2 role_id: 2 old_status_id: 4 id: 137 tracker_id: 2 -workflows_163: +workflows_163: new_status_id: 4 role_id: 3 old_status_id: 3 id: 163 tracker_id: 2 -workflows_190: +workflows_190: new_status_id: 6 role_id: 1 old_status_id: 2 id: 190 tracker_id: 3 -workflows_218: +workflows_218: new_status_id: 4 role_id: 2 old_status_id: 2 id: 218 tracker_id: 3 -workflows_245: +workflows_245: new_status_id: 6 role_id: 3 old_status_id: 1 id: 245 tracker_id: 3 -workflows_057: +workflows_057: new_status_id: 2 role_id: 2 old_status_id: 6 id: 57 tracker_id: 1 -workflows_083: +workflows_083: new_status_id: 3 role_id: 3 old_status_id: 5 id: 83 tracker_id: 1 -workflows_138: +workflows_138: new_status_id: 3 role_id: 2 old_status_id: 4 id: 138 tracker_id: 2 -workflows_164: +workflows_164: new_status_id: 5 role_id: 3 old_status_id: 3 id: 164 tracker_id: 2 -workflows_191: +workflows_191: new_status_id: 1 role_id: 1 old_status_id: 3 id: 191 tracker_id: 3 -workflows_219: +workflows_219: new_status_id: 5 role_id: 2 old_status_id: 2 id: 219 tracker_id: 3 -workflows_246: +workflows_246: new_status_id: 1 role_id: 3 old_status_id: 2 id: 246 tracker_id: 3 -workflows_058: +workflows_058: new_status_id: 3 role_id: 2 old_status_id: 6 id: 58 tracker_id: 1 -workflows_084: +workflows_084: new_status_id: 4 role_id: 3 old_status_id: 5 id: 84 tracker_id: 1 -workflows_139: +workflows_139: new_status_id: 5 role_id: 2 old_status_id: 4 id: 139 tracker_id: 2 -workflows_165: +workflows_165: new_status_id: 6 role_id: 3 old_status_id: 3 id: 165 tracker_id: 2 -workflows_192: +workflows_192: new_status_id: 2 role_id: 1 old_status_id: 3 id: 192 tracker_id: 3 -workflows_247: +workflows_247: new_status_id: 3 role_id: 3 old_status_id: 2 id: 247 tracker_id: 3 -workflows_059: +workflows_059: new_status_id: 4 role_id: 2 old_status_id: 6 id: 59 tracker_id: 1 -workflows_085: +workflows_085: new_status_id: 6 role_id: 3 old_status_id: 5 id: 85 tracker_id: 1 -workflows_166: +workflows_166: new_status_id: 1 role_id: 3 old_status_id: 4 id: 166 tracker_id: 2 -workflows_248: +workflows_248: new_status_id: 4 role_id: 3 old_status_id: 2 id: 248 tracker_id: 3 -workflows_086: +workflows_086: new_status_id: 1 role_id: 3 old_status_id: 6 id: 86 tracker_id: 1 -workflows_167: +workflows_167: new_status_id: 2 role_id: 3 old_status_id: 4 id: 167 tracker_id: 2 -workflows_193: +workflows_193: new_status_id: 4 role_id: 1 old_status_id: 3 id: 193 tracker_id: 3 -workflows_249: +workflows_249: new_status_id: 5 role_id: 3 old_status_id: 2 id: 249 tracker_id: 3 -workflows_087: +workflows_087: new_status_id: 2 role_id: 3 old_status_id: 6 id: 87 tracker_id: 1 -workflows_168: +workflows_168: new_status_id: 3 role_id: 3 old_status_id: 4 id: 168 tracker_id: 2 -workflows_194: +workflows_194: new_status_id: 5 role_id: 1 old_status_id: 3 id: 194 tracker_id: 3 -workflows_088: +workflows_088: new_status_id: 3 role_id: 3 old_status_id: 6 id: 88 tracker_id: 1 -workflows_169: +workflows_169: new_status_id: 5 role_id: 3 old_status_id: 4 id: 169 tracker_id: 2 -workflows_195: +workflows_195: new_status_id: 6 role_id: 1 old_status_id: 3 id: 195 tracker_id: 3 -workflows_089: +workflows_089: new_status_id: 4 role_id: 3 old_status_id: 6 id: 89 tracker_id: 1 -workflows_196: +workflows_196: new_status_id: 1 role_id: 1 old_status_id: 4 id: 196 tracker_id: 3 -workflows_197: +workflows_197: new_status_id: 2 role_id: 1 old_status_id: 4 id: 197 tracker_id: 3 -workflows_198: +workflows_198: new_status_id: 3 role_id: 1 old_status_id: 4 id: 198 tracker_id: 3 -workflows_199: +workflows_199: new_status_id: 5 role_id: 1 old_status_id: 4 id: 199 tracker_id: 3 -workflows_010: +workflows_010: new_status_id: 6 role_id: 1 old_status_id: 2 id: 10 tracker_id: 1 -workflows_011: +workflows_011: new_status_id: 1 role_id: 1 old_status_id: 3 id: 11 tracker_id: 1 -workflows_012: +workflows_012: new_status_id: 2 role_id: 1 old_status_id: 3 id: 12 tracker_id: 1 -workflows_200: +workflows_200: new_status_id: 6 role_id: 1 old_status_id: 4 id: 200 tracker_id: 3 -workflows_013: +workflows_013: new_status_id: 4 role_id: 1 old_status_id: 3 id: 13 tracker_id: 1 -workflows_120: +workflows_120: new_status_id: 5 role_id: 1 old_status_id: 6 id: 120 tracker_id: 2 -workflows_201: +workflows_201: new_status_id: 1 role_id: 1 old_status_id: 5 id: 201 tracker_id: 3 -workflows_040: +workflows_040: new_status_id: 6 role_id: 2 old_status_id: 2 id: 40 tracker_id: 1 -workflows_121: +workflows_121: new_status_id: 2 role_id: 2 old_status_id: 1 id: 121 tracker_id: 2 -workflows_202: +workflows_202: new_status_id: 2 role_id: 1 old_status_id: 5 id: 202 tracker_id: 3 -workflows_014: +workflows_014: new_status_id: 5 role_id: 1 old_status_id: 3 id: 14 tracker_id: 1 -workflows_041: +workflows_041: new_status_id: 1 role_id: 2 old_status_id: 3 id: 41 tracker_id: 1 -workflows_122: +workflows_122: new_status_id: 3 role_id: 2 old_status_id: 1 id: 122 tracker_id: 2 -workflows_203: +workflows_203: new_status_id: 3 role_id: 1 old_status_id: 5 id: 203 tracker_id: 3 -workflows_015: +workflows_015: new_status_id: 6 role_id: 1 old_status_id: 3 id: 15 tracker_id: 1 -workflows_230: +workflows_230: new_status_id: 6 role_id: 2 old_status_id: 4 id: 230 tracker_id: 3 -workflows_123: +workflows_123: new_status_id: 4 role_id: 2 old_status_id: 1 id: 123 tracker_id: 2 -workflows_204: +workflows_204: new_status_id: 4 role_id: 1 old_status_id: 5 id: 204 tracker_id: 3 -workflows_016: +workflows_016: new_status_id: 1 role_id: 1 old_status_id: 4 id: 16 tracker_id: 1 -workflows_042: +workflows_042: new_status_id: 2 role_id: 2 old_status_id: 3 id: 42 tracker_id: 1 -workflows_231: +workflows_231: new_status_id: 1 role_id: 2 old_status_id: 5 id: 231 tracker_id: 3 -workflows_070: +workflows_070: new_status_id: 6 role_id: 3 old_status_id: 2 id: 70 tracker_id: 1 -workflows_124: +workflows_124: new_status_id: 5 role_id: 2 old_status_id: 1 id: 124 tracker_id: 2 -workflows_150: +workflows_150: new_status_id: 5 role_id: 2 old_status_id: 6 id: 150 tracker_id: 2 -workflows_205: +workflows_205: new_status_id: 6 role_id: 1 old_status_id: 5 id: 205 tracker_id: 3 -workflows_017: +workflows_017: new_status_id: 2 role_id: 1 old_status_id: 4 id: 17 tracker_id: 1 -workflows_043: +workflows_043: new_status_id: 4 role_id: 2 old_status_id: 3 id: 43 tracker_id: 1 -workflows_232: +workflows_232: new_status_id: 2 role_id: 2 old_status_id: 5 id: 232 tracker_id: 3 -workflows_125: +workflows_125: new_status_id: 6 role_id: 2 old_status_id: 1 id: 125 tracker_id: 2 -workflows_151: +workflows_151: new_status_id: 2 role_id: 3 old_status_id: 1 id: 151 tracker_id: 2 -workflows_206: +workflows_206: new_status_id: 1 role_id: 1 old_status_id: 6 id: 206 tracker_id: 3 -workflows_018: +workflows_018: new_status_id: 3 role_id: 1 old_status_id: 4 id: 18 tracker_id: 1 -workflows_044: +workflows_044: new_status_id: 5 role_id: 2 old_status_id: 3 id: 44 tracker_id: 1 -workflows_071: +workflows_071: new_status_id: 1 role_id: 3 old_status_id: 3 id: 71 tracker_id: 1 -workflows_233: +workflows_233: new_status_id: 3 role_id: 2 old_status_id: 5 id: 233 tracker_id: 3 -workflows_126: +workflows_126: new_status_id: 1 role_id: 2 old_status_id: 2 id: 126 tracker_id: 2 -workflows_152: +workflows_152: new_status_id: 3 role_id: 3 old_status_id: 1 id: 152 tracker_id: 2 -workflows_207: +workflows_207: new_status_id: 2 role_id: 1 old_status_id: 6 id: 207 tracker_id: 3 -workflows_019: +workflows_019: new_status_id: 5 role_id: 1 old_status_id: 4 id: 19 tracker_id: 1 -workflows_045: +workflows_045: new_status_id: 6 role_id: 2 old_status_id: 3 id: 45 tracker_id: 1 -workflows_260: +workflows_260: new_status_id: 6 role_id: 3 old_status_id: 4 id: 260 tracker_id: 3 -workflows_234: +workflows_234: new_status_id: 4 role_id: 2 old_status_id: 5 id: 234 tracker_id: 3 -workflows_127: +workflows_127: new_status_id: 3 role_id: 2 old_status_id: 2 id: 127 tracker_id: 2 -workflows_153: +workflows_153: new_status_id: 4 role_id: 3 old_status_id: 1 id: 153 tracker_id: 2 -workflows_180: +workflows_180: new_status_id: 5 role_id: 3 old_status_id: 6 id: 180 tracker_id: 2 -workflows_208: +workflows_208: new_status_id: 3 role_id: 1 old_status_id: 6 id: 208 tracker_id: 3 -workflows_046: +workflows_046: new_status_id: 1 role_id: 2 old_status_id: 4 id: 46 tracker_id: 1 -workflows_072: +workflows_072: new_status_id: 2 role_id: 3 old_status_id: 3 id: 72 tracker_id: 1 -workflows_261: +workflows_261: new_status_id: 1 role_id: 3 old_status_id: 5 id: 261 tracker_id: 3 -workflows_235: +workflows_235: new_status_id: 6 role_id: 2 old_status_id: 5 id: 235 tracker_id: 3 -workflows_154: +workflows_154: new_status_id: 5 role_id: 3 old_status_id: 1 id: 154 tracker_id: 2 -workflows_181: +workflows_181: new_status_id: 2 role_id: 1 old_status_id: 1 id: 181 tracker_id: 3 -workflows_209: +workflows_209: new_status_id: 4 role_id: 1 old_status_id: 6 id: 209 tracker_id: 3 -workflows_047: +workflows_047: new_status_id: 2 role_id: 2 old_status_id: 4 id: 47 tracker_id: 1 -workflows_073: +workflows_073: new_status_id: 4 role_id: 3 old_status_id: 3 id: 73 tracker_id: 1 -workflows_128: +workflows_128: new_status_id: 4 role_id: 2 old_status_id: 2 id: 128 tracker_id: 2 -workflows_262: +workflows_262: new_status_id: 2 role_id: 3 old_status_id: 5 id: 262 tracker_id: 3 -workflows_236: +workflows_236: new_status_id: 1 role_id: 2 old_status_id: 6 id: 236 tracker_id: 3 -workflows_155: +workflows_155: new_status_id: 6 role_id: 3 old_status_id: 1 id: 155 tracker_id: 2 -workflows_048: +workflows_048: new_status_id: 3 role_id: 2 old_status_id: 4 id: 48 tracker_id: 1 -workflows_074: +workflows_074: new_status_id: 5 role_id: 3 old_status_id: 3 id: 74 tracker_id: 1 -workflows_129: +workflows_129: new_status_id: 5 role_id: 2 old_status_id: 2 id: 129 tracker_id: 2 -workflows_263: +workflows_263: new_status_id: 3 role_id: 3 old_status_id: 5 id: 263 tracker_id: 3 -workflows_237: +workflows_237: new_status_id: 2 role_id: 2 old_status_id: 6 id: 237 tracker_id: 3 -workflows_182: +workflows_182: new_status_id: 3 role_id: 1 old_status_id: 1 id: 182 tracker_id: 3 -workflows_049: +workflows_049: new_status_id: 5 role_id: 2 old_status_id: 4 id: 49 tracker_id: 1 -workflows_075: +workflows_075: new_status_id: 6 role_id: 3 old_status_id: 3 id: 75 tracker_id: 1 -workflows_156: +workflows_156: new_status_id: 1 role_id: 3 old_status_id: 2 id: 156 tracker_id: 2 -workflows_264: +workflows_264: new_status_id: 4 role_id: 3 old_status_id: 5 id: 264 tracker_id: 3 -workflows_238: +workflows_238: new_status_id: 3 role_id: 2 old_status_id: 6 id: 238 tracker_id: 3 -workflows_183: +workflows_183: new_status_id: 4 role_id: 1 old_status_id: 1 id: 183 tracker_id: 3 -workflows_076: +workflows_076: new_status_id: 1 role_id: 3 old_status_id: 4 id: 76 tracker_id: 1 -workflows_157: +workflows_157: new_status_id: 3 role_id: 3 old_status_id: 2 id: 157 tracker_id: 2 -workflows_265: +workflows_265: new_status_id: 6 role_id: 3 old_status_id: 5 id: 265 tracker_id: 3 -workflows_239: +workflows_239: new_status_id: 4 role_id: 2 old_status_id: 6 id: 239 tracker_id: 3 -workflows_077: +workflows_077: new_status_id: 2 role_id: 3 old_status_id: 4 id: 77 tracker_id: 1 -workflows_158: +workflows_158: new_status_id: 4 role_id: 3 old_status_id: 2 id: 158 tracker_id: 2 -workflows_184: +workflows_184: new_status_id: 5 role_id: 1 old_status_id: 1 id: 184 tracker_id: 3 -workflows_266: +workflows_266: new_status_id: 1 role_id: 3 old_status_id: 6 id: 266 tracker_id: 3 -workflows_078: +workflows_078: new_status_id: 3 role_id: 3 old_status_id: 4 id: 78 tracker_id: 1 -workflows_159: +workflows_159: new_status_id: 5 role_id: 3 old_status_id: 2 id: 159 tracker_id: 2 -workflows_185: +workflows_185: new_status_id: 6 role_id: 1 old_status_id: 1 id: 185 tracker_id: 3 -workflows_267: +workflows_267: new_status_id: 2 role_id: 3 old_status_id: 6 id: 267 tracker_id: 3 -workflows_079: +workflows_079: new_status_id: 5 role_id: 3 old_status_id: 4 id: 79 tracker_id: 1 -workflows_186: +workflows_186: new_status_id: 1 role_id: 1 old_status_id: 2 id: 186 tracker_id: 3 -workflows_268: +workflows_268: new_status_id: 3 role_id: 3 old_status_id: 6 id: 268 tracker_id: 3 -workflows_187: +workflows_187: new_status_id: 3 role_id: 1 old_status_id: 2 id: 187 tracker_id: 3 -workflows_269: +workflows_269: new_status_id: 4 role_id: 3 old_status_id: 6 id: 269 tracker_id: 3 -workflows_188: +workflows_188: new_status_id: 4 role_id: 1 old_status_id: 2 diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index 43320bc7..67927b37 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,20 +18,20 @@ class AccountController; def rescue_action(e) raise e end; end class AccountControllerTest < ActionController::TestCase fixtures :users, :roles - + def setup @controller = AccountController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil end - + def test_login_should_redirect_to_back_url_param # request.uri is "test.host" in test environment post :login, :username => 'jsmith', :password => 'jsmith', :back_url => 'http%3A%2F%2Ftest.host%2Fissues%2Fshow%2F1' assert_redirected_to '/issues/show/1' end - + def test_login_should_not_redirect_to_another_host post :login, :username => 'jsmith', :password => 'jsmith', :back_url => 'http%3A%2F%2Ftest.foo%2Ffake' assert_redirected_to '/my/page' @@ -45,9 +45,9 @@ class AccountControllerTest < ActionController::TestCase :attributes => { :class => "flash error" }, :content => /Invalid user or password/ end - + if Object.const_defined?(:OpenID) - + def test_login_with_openid_for_existing_user Setting.self_registration = '3' Setting.openid = '1' @@ -68,7 +68,7 @@ class AccountControllerTest < ActionController::TestCase post :login, :openid_url => 'http;//openid.example.com/good_user' assert_redirected_to home_url end - + def test_login_with_openid_for_existing_non_active_user Setting.self_registration = '2' Setting.openid = '1' @@ -115,7 +115,7 @@ class AccountControllerTest < ActionController::TestCase token = Token.find_by_user_id_and_action(user.id, 'register') assert token end - + def test_login_with_openid_with_new_user_created_with_manual_activation Setting.self_registration = '2' Setting.openid = '1' @@ -125,30 +125,30 @@ class AccountControllerTest < ActionController::TestCase assert user assert_equal User::STATUS_REGISTERED, user.status end - + def test_login_with_openid_with_new_user_with_conflict_should_register Setting.self_registration = '3' Setting.openid = '1' existing_user = User.new(:firstname => 'Cool', :lastname => 'User', :mail => 'user@somedomain.com') existing_user.login = 'cool_user' assert existing_user.save! - + post :login, :openid_url => 'http://openid.example.com/good_user' assert_response :success assert_template 'register' assert assigns(:user) assert_equal 'http://openid.example.com/good_user', assigns(:user)[:identity_url] end - + def test_setting_openid_should_return_true_when_set_to_true Setting.openid = '1' assert_equal true, Setting.openid? end - + else puts "Skipping openid tests." end - + def test_logout @request.session[:user_id] = 2 get :logout @@ -162,12 +162,12 @@ class AccountControllerTest < ActionController::TestCase Setting.self_registration = '3' get :register end - + should_respond_with :success should_render_template :register should_assign_to :user end - + context "with self registration off" do setup do Setting.self_registration = '0' @@ -192,7 +192,7 @@ class AccountControllerTest < ActionController::TestCase :mail => 'register@example.com' } end - + should_respond_with :redirect should_assign_to :user should_redirect_to('my page') { {:controller => 'my', :action => 'account'} } @@ -205,7 +205,7 @@ class AccountControllerTest < ActionController::TestCase assert_equal User::STATUS_ACTIVE, user.status end end - + context "with self registration off" do setup do Setting.self_registration = '0' diff --git a/test/functional/activities_controller_test.rb b/test/functional/activities_controller_test.rb index 574ed68c..89823c19 100644 --- a/test/functional/activities_controller_test.rb +++ b/test/functional/activities_controller_test.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,8 +21,8 @@ class ActivitiesControllerTest < ActionController::TestCase assert_response :success assert_template 'index' assert_not_nil assigns(:events_by_day) - - assert_tag :tag => "h3", + + assert_tag :tag => "h3", :content => /#{1.day.ago.to_date.day}/, :sibling => { :tag => "dl", :child => { :tag => "dt", @@ -33,14 +33,14 @@ class ActivitiesControllerTest < ActionController::TestCase } } end - + def test_previous_project_index get :index, :id => 1, :from => 3.days.ago.to_date assert_response :success assert_template 'index' assert_not_nil assigns(:events_by_day) - - assert_tag :tag => "h3", + + assert_tag :tag => "h3", :content => /#{3.day.ago.to_date.day}/, :sibling => { :tag => "dl", :child => { :tag => "dt", @@ -51,14 +51,14 @@ class ActivitiesControllerTest < ActionController::TestCase } } end - + def test_global_index get :index assert_response :success assert_template 'index' assert_not_nil assigns(:events_by_day) - - assert_tag :tag => "h3", + + assert_tag :tag => "h3", :content => /#{3.day.ago.to_date.day}/, :sibling => { :tag => "dl", :child => { :tag => "dt", @@ -69,14 +69,14 @@ class ActivitiesControllerTest < ActionController::TestCase } } end - + def test_user_index get :index, :user_id => 2 assert_response :success assert_template 'index' assert_not_nil assigns(:events_by_day) - - assert_tag :tag => "h3", + + assert_tag :tag => "h3", :content => /#{3.day.ago.to_date.day}/, :sibling => { :tag => "dl", :child => { :tag => "dt", @@ -87,7 +87,7 @@ class ActivitiesControllerTest < ActionController::TestCase } } end - + def test_index_atom_feed get :index, :format => 'atom' assert_response :success @@ -96,5 +96,5 @@ class ActivitiesControllerTest < ActionController::TestCase :tag => 'link', :attributes => {:href => 'http://test.host/issues/11'}} end - + end diff --git a/test/functional/admin_controller_test.rb b/test/functional/admin_controller_test.rb index da5fdba8..b7ff1036 100644 --- a/test/functional/admin_controller_test.rb +++ b/test/functional/admin_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,7 +18,7 @@ class AdminController; def rescue_action(e) raise e end; end class AdminControllerTest < ActionController::TestCase fixtures :projects, :users, :roles - + def setup @controller = AdminController.new @request = ActionController::TestRequest.new @@ -26,20 +26,20 @@ class AdminControllerTest < ActionController::TestCase User.current = nil @request.session[:user_id] = 1 # admin end - + def test_index get :index assert_no_tag :tag => 'div', :attributes => { :class => /nodata/ } end - + def test_index_with_no_configuration_data delete_configuration_data get :index assert_tag :tag => 'div', :attributes => { :class => /nodata/ } end - + def test_projects get :projects assert_response :success @@ -48,7 +48,7 @@ class AdminControllerTest < ActionController::TestCase # active projects only assert_nil assigns(:projects).detect {|u| !u.active?} end - + def test_projects_with_name_filter get :projects, :name => 'store', :status => '' assert_response :success @@ -58,7 +58,7 @@ class AdminControllerTest < ActionController::TestCase assert_equal 1, projects.size assert_equal 'OnlineStore', projects.first.name end - + def test_load_default_configuration_data delete_configuration_data post :default_configuration, :lang => 'fr' @@ -66,7 +66,7 @@ class AdminControllerTest < ActionController::TestCase assert_nil flash[:error] assert IssueStatus.find_by_name('Nouveau') end - + def test_test_email get :test_email assert_redirected_to '/settings/edit?tab=notifications' @@ -75,15 +75,15 @@ class AdminControllerTest < ActionController::TestCase user = User.find(1) assert_equal [user.mail], mail.bcc end - + def test_no_plugins Redmine::Plugin.clear - + get :plugins assert_response :success assert_template 'plugins' end - + def test_plugins # Register a few plugins Redmine::Plugin.register :foo do @@ -95,11 +95,11 @@ class AdminControllerTest < ActionController::TestCase end Redmine::Plugin.register :bar do end - + get :plugins assert_response :success assert_template 'plugins' - + assert_tag :td, :child => { :tag => 'span', :content => 'Foo plugin' } assert_tag :td, :child => { :tag => 'span', :content => 'Bar' } end @@ -109,24 +109,24 @@ class AdminControllerTest < ActionController::TestCase assert_response :success assert_template 'info' end - + def test_admin_menu_plugin_extension Redmine::MenuManager.map :admin_menu do |menu| menu.push :test_admin_menu_plugin_extension, '/foo/bar', :caption => 'Test' end - + get :index assert_response :success assert_tag :a, :attributes => { :href => '/foo/bar' }, :content => 'Test' - + Redmine::MenuManager.map :admin_menu do |menu| menu.delete :test_admin_menu_plugin_extension end end - + private - + def delete_configuration_data Role.delete_all('builtin = 0') Tracker.delete_all diff --git a/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb index 17b64f9c..17460fea 100644 --- a/test/functional/application_controller_test.rb +++ b/test/functional/application_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,7 +18,7 @@ class ApplicationController; def rescue_action(e) raise e end; end class ApplicationControllerTest < ActionController::TestCase include Redmine::I18n - + def setup @controller = ApplicationController.new @request = ActionController::TestRequest.new @@ -34,23 +34,23 @@ class ApplicationControllerTest < ActionController::TestCase end set_language_if_valid('en') end - + def test_call_hook_mixed_in assert @controller.respond_to?(:call_hook) end - + context "test_api_offset_and_limit" do context "without params" do should "return 0, 25" do assert_equal [0, 25], @controller.send(:api_offset_and_limit, {}) end end - + context "with limit" do should "return 0, limit" do assert_equal [0, 30], @controller.send(:api_offset_and_limit, {:limit => 30}) end - + should "not exceed 100" do assert_equal [0, 100], @controller.send(:api_offset_and_limit, {:limit => 120}) end @@ -59,7 +59,7 @@ class ApplicationControllerTest < ActionController::TestCase assert_equal [0, 25], @controller.send(:api_offset_and_limit, {:limit => -10}) end end - + context "with offset" do should "return offset, 25" do assert_equal [10, 25], @controller.send(:api_offset_and_limit, {:offset => 10}) @@ -68,14 +68,14 @@ class ApplicationControllerTest < ActionController::TestCase should "not be negative" do assert_equal [0, 25], @controller.send(:api_offset_and_limit, {:offset => -10}) end - + context "and limit" do should "return offset, limit" do assert_equal [10, 50], @controller.send(:api_offset_and_limit, {:offset => 10, :limit => 50}) end end end - + context "with page" do should "return offset, 25" do assert_equal [0, 25], @controller.send(:api_offset_and_limit, {:page => 1}) @@ -86,7 +86,7 @@ class ApplicationControllerTest < ActionController::TestCase assert_equal [0, 25], @controller.send(:api_offset_and_limit, {:page => 0}) assert_equal [0, 25], @controller.send(:api_offset_and_limit, {:page => -2}) end - + context "and limit" do should "return offset, limit" do assert_equal [0, 100], @controller.send(:api_offset_and_limit, {:page => 1, :limit => 100}) diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb index e6f44b77..388cf57b 100644 --- a/test/functional/attachments_controller_test.rb +++ b/test/functional/attachments_controller_test.rb @@ -1,14 +1,14 @@ # -*- coding: utf-8 -*- #-- 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,7 +22,7 @@ class AttachmentsController; def rescue_action(e) raise e end; end class AttachmentsControllerTest < ActionController::TestCase fixtures :users, :projects, :roles, :members, :member_roles, :enabled_modules, :issues, :trackers, :attachments, :versions, :wiki_pages, :wikis, :documents - + def setup @controller = AttachmentsController.new @request = ActionController::TestRequest.new @@ -30,13 +30,13 @@ class AttachmentsControllerTest < ActionController::TestCase Attachment.storage_path = "#{RAILS_ROOT}/test/fixtures/files" User.current = nil end - + def test_show_diff get :show, :id => 14 # 060719210727_changeset_utf8.diff assert_response :success assert_template 'diff' assert_equal 'text/html', @response.content_type - + assert_tag 'th', :attributes => {:class => /filename/}, :content => /issues_controller.rb\t\(révision 1484\)/ @@ -44,13 +44,13 @@ class AttachmentsControllerTest < ActionController::TestCase :attributes => {:class => /line-code/}, :content => /Demande créée avec succès/ end - + def test_show_diff_should_strip_non_utf8_content get :show, :id => 5 # 060719210727_changeset_iso8859-1.diff assert_response :success assert_template 'diff' assert_equal 'text/html', @response.content_type - + assert_tag 'th', :attributes => {:class => /filename/}, :content => /issues_controller.rb\t\(rvision 1484\)/ @@ -58,57 +58,57 @@ class AttachmentsControllerTest < ActionController::TestCase :attributes => {:class => /line-code/}, :content => /Demande cre avec succs/ end - + def test_show_text_file get :show, :id => 4 assert_response :success assert_template 'file' assert_equal 'text/html', @response.content_type end - + def test_show_text_file_should_send_if_too_big Setting.file_max_size_displayed = 512 Attachment.find(4).update_attribute :filesize, 754.kilobyte - + get :show, :id => 4 assert_response :success assert_equal 'application/x-ruby', @response.content_type end - + def test_show_other get :show, :id => 6 assert_response :success assert_equal 'application/octet-stream', @response.content_type end - + def test_download_text_file get :download, :id => 4 assert_response :success assert_equal 'application/x-ruby', @response.content_type end - + def test_download_should_assign_content_type_if_blank Attachment.find(4).update_attribute(:content_type, '') - + get :download, :id => 4 assert_response :success assert_equal 'text/x-ruby', @response.content_type end - + def test_download_missing_file get :download, :id => 2 assert_response 404 end - + def test_anonymous_on_private_private get :download, :id => 7 assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2Fdownload%2F7' end - + def test_destroy_issue_attachment issue = Issue.find(3) @request.session[:user_id] = 2 - + assert_difference 'issue.attachments.count', -1 do post :destroy, :id => 1 end @@ -119,7 +119,7 @@ class AttachmentsControllerTest < ActionController::TestCase assert_equal ['attachments_1'], j.details.keys assert_equal 'error281.txt', j.details['attachments_1'].first end - + def test_destroy_wiki_page_attachment @request.session[:user_id] = 2 assert_difference 'Attachment.count', -1 do @@ -127,7 +127,7 @@ class AttachmentsControllerTest < ActionController::TestCase assert_response 302 end end - + def test_destroy_project_attachment @request.session[:user_id] = 2 assert_difference 'Attachment.count', -1 do @@ -135,7 +135,7 @@ class AttachmentsControllerTest < ActionController::TestCase assert_response 302 end end - + def test_destroy_version_attachment @request.session[:user_id] = 2 assert_difference 'Attachment.count', -1 do @@ -143,7 +143,7 @@ class AttachmentsControllerTest < ActionController::TestCase assert_response 302 end end - + def test_destroy_without_permission post :destroy, :id => 3 assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2Fdestroy%2F3' diff --git a/test/functional/auth_sources_controller_test.rb b/test/functional/auth_sources_controller_test.rb index dfda4da6..9d31ba87 100644 --- a/test/functional/auth_sources_controller_test.rb +++ b/test/functional/auth_sources_controller_test.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. #++ @@ -82,7 +82,7 @@ class AuthSourcesControllerTest < ActionController::TestCase setup do @auth_source = AuthSource.generate!(:name => 'TestEdit') end - + context "without users" do setup do post :destroy, :id => @auth_source.id @@ -92,13 +92,13 @@ class AuthSourcesControllerTest < ActionController::TestCase should_redirect_to("index") {{:action => 'index'}} should_set_the_flash_to /deletion/i end - + context "with users" do setup do User.generate!(:auth_source => @auth_source) post :destroy, :id => @auth_source.id end - + should_respond_with :redirect should "not destroy the AuthSource" do assert AuthSource.find(@auth_source.id) diff --git a/test/functional/auto_completes_controller_test.rb b/test/functional/auto_completes_controller_test.rb index 4f3fd8ac..ae0e02c6 100644 --- a/test/functional/auto_completes_controller_test.rb +++ b/test/functional/auto_completes_controller_test.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,7 +22,7 @@ class AutoCompletesControllerTest < ActionController::TestCase assert_not_nil assigns(:issues) assert assigns(:issues).detect {|issue| issue.subject.match /recipe/} end - + def test_issues_should_return_issue_with_given_id get :issues, :project_id => 'subproject1', :q => '13' assert_response :success @@ -47,7 +47,7 @@ class AutoCompletesControllerTest < ActionController::TestCase assert assigns(:issues).include?(@issue_with_subject) assert_equal assigns(:issues).size, assigns(:issues).uniq.size, "Issues list includes duplicates" end - + def test_auto_complete_with_scope_all_and_cross_project_relations Setting.cross_project_issue_relations = '1' get :issues, :project_id => 'ecookbook', :q => '13', :scope => 'all' @@ -55,7 +55,7 @@ class AutoCompletesControllerTest < ActionController::TestCase assert_not_nil assigns(:issues) assert assigns(:issues).include?(Issue.find(13)) end - + def test_auto_complete_with_scope_all_without_cross_project_relations Setting.cross_project_issue_relations = '0' get :issues, :project_id => 'ecookbook', :q => '13', :scope => 'all' diff --git a/test/functional/boards_controller_test.rb b/test/functional/boards_controller_test.rb index 16508456..b73d0275 100644 --- a/test/functional/boards_controller_test.rb +++ b/test/functional/boards_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,14 +18,14 @@ class BoardsController; def rescue_action(e) raise e end; end class BoardsControllerTest < ActionController::TestCase fixtures :projects, :users, :members, :member_roles, :roles, :boards, :messages, :enabled_modules - + def setup @controller = BoardsController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil end - + def test_index get :index, :project_id => 1 assert_response :success @@ -33,21 +33,21 @@ class BoardsControllerTest < ActionController::TestCase assert_not_nil assigns(:boards) assert_not_nil assigns(:project) end - + def test_index_not_found get :index, :project_id => 97 assert_response 404 end - + def test_index_should_show_messages_if_only_one_board Project.find(1).boards.slice(1..-1).each(&:destroy) - + get :index, :project_id => 1 assert_response :success assert_template 'show' assert_not_nil assigns(:topics) end - + def test_post_new @request.session[:user_id] = 2 assert_difference 'Board.count' do @@ -55,7 +55,7 @@ class BoardsControllerTest < ActionController::TestCase end assert_redirected_to '/projects/ecookbook/settings/boards' end - + def test_show get :show, :project_id => 1, :id => 1 assert_response :success @@ -64,7 +64,7 @@ class BoardsControllerTest < ActionController::TestCase assert_not_nil assigns(:project) assert_not_nil assigns(:topics) end - + def test_show_atom get :show, :project_id => 1, :id => 1, :format => 'atom' assert_response :success @@ -73,7 +73,7 @@ class BoardsControllerTest < ActionController::TestCase assert_not_nil assigns(:project) assert_not_nil assigns(:messages) end - + def test_post_edit @request.session[:user_id] = 2 assert_no_difference 'Board.count' do @@ -82,7 +82,7 @@ class BoardsControllerTest < ActionController::TestCase assert_redirected_to '/projects/ecookbook/settings/boards' assert_equal 'Testing', Board.find(2).name end - + def test_post_destroy @request.session[:user_id] = 2 assert_difference 'Board.count', -1 do @@ -91,10 +91,10 @@ class BoardsControllerTest < ActionController::TestCase assert_redirected_to '/projects/ecookbook/settings/boards' assert_nil Board.find_by_id(2) end - + def test_index_should_404_with_no_board Project.find(1).boards.each(&:destroy) - + get :index, :project_id => 1 assert_response 404 end diff --git a/test/functional/calendars_controller_test.rb b/test/functional/calendars_controller_test.rb index 31ffdb4c..54f367c5 100644 --- a/test/functional/calendars_controller_test.rb +++ b/test/functional/calendars_controller_test.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,7 +22,7 @@ class CalendarsControllerTest < ActionController::TestCase assert_template 'calendar' assert_not_nil assigns(:calendar) end - + def test_cross_project_calendar get :show assert_response :success @@ -33,19 +33,19 @@ class CalendarsControllerTest < ActionController::TestCase context "GET :show" do should "run custom queries" do @query = Query.generate_default! - + get :show, :query_id => @query.id assert_response :success end - + end - + def test_week_number_calculation Setting.start_of_week = 7 - + get :show, :month => '1', :year => '2010' assert_response :success - + assert_tag :tag => 'tr', :descendant => {:tag => 'td', :attributes => {:class => 'week-number'}, :content => '53'}, diff --git a/test/functional/comments_controller_test.rb b/test/functional/comments_controller_test.rb index 64f9b7bf..74cf4261 100644 --- a/test/functional/comments_controller_test.rb +++ b/test/functional/comments_controller_test.rb @@ -1,35 +1,35 @@ #-- 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. #++ require File.expand_path('../../test_helper', __FILE__) class CommentsControllerTest < ActionController::TestCase fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :news, :comments - + def setup User.current = nil end - + def test_add_comment @request.session[:user_id] = 2 post :create, :id => 1, :comment => { :comments => 'This is a test comment' } assert_redirected_to '/news/1' - + comment = News.find(1).comments.find(:first, :order => 'created_on DESC') assert_not_nil comment assert_equal 'This is a test comment', comment.comments assert_equal User.find(2), comment.author end - + def test_empty_comment_should_not_be_added @request.session[:user_id] = 2 assert_no_difference 'Comment.count' do @@ -47,6 +47,6 @@ class CommentsControllerTest < ActionController::TestCase assert_nil Comment.find_by_id(2) assert_equal comments_count - 1, News.find(1).comments.size end - + end diff --git a/test/functional/context_menus_controller_test.rb b/test/functional/context_menus_controller_test.rb index 5fb94f0c..98e9c176 100644 --- a/test/functional/context_menus_controller_test.rb +++ b/test/functional/context_menus_controller_test.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. #++ @@ -63,7 +63,7 @@ class ContextMenusControllerTest < ActionController::TestCase :attributes => { :href => '#', :class => 'icon-del disabled' } end - + def test_context_menu_multiple_issues_of_same_project @request.session[:user_id] = 2 get :issues, :ids => [1, 2] @@ -71,7 +71,7 @@ class ContextMenusControllerTest < ActionController::TestCase assert_template 'context_menu' assert_not_nil assigns(:issues) assert_equal [1, 2], assigns(:issues).map(&:id).sort - + ids = assigns(:issues).map(&:id).map {|i| "ids%5B%5D=#{i}"}.join('&') assert_tag :tag => 'a', :content => 'Edit', :attributes => { :href => "/issues/bulk_edit?#{ids}", @@ -103,7 +103,7 @@ class ContextMenusControllerTest < ActionController::TestCase assert_template 'context_menu' assert_not_nil assigns(:issues) assert_equal [1, 2, 6], assigns(:issues).map(&:id).sort - + ids = assigns(:issues).map(&:id).map {|i| "ids%5B%5D=#{i}"}.join('&') assert_tag :tag => 'a', :content => 'Edit', :attributes => { :href => "/issues/bulk_edit?#{ids}", @@ -121,7 +121,7 @@ class ContextMenusControllerTest < ActionController::TestCase :attributes => { :href => "/issues/destroy?#{ids}", :class => 'icon-del' } end - + def test_context_menu_issue_visibility get :issues, :ids => [1, 4] assert_response :success diff --git a/test/functional/custom_fields_controller_test.rb b/test/functional/custom_fields_controller_test.rb index a490be3b..ec80b54c 100644 --- a/test/functional/custom_fields_controller_test.rb +++ b/test/functional/custom_fields_controller_test.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,14 +19,14 @@ class CustomFieldsController; def rescue_action(e) raise e end; end class CustomFieldsControllerTest < ActionController::TestCase fixtures :custom_fields, :trackers, :users - + def setup @controller = CustomFieldsController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new @request.session[:user_id] = 1 end - + def test_get_new_issue_custom_field get :new, :type => 'IssueCustomField' assert_response :success @@ -46,12 +46,12 @@ class CustomFieldsControllerTest < ActionController::TestCase :content => 'Version' } end - + def test_get_new_with_invalid_custom_field_class_should_redirect_to_list get :new, :type => 'UnknownCustomField' assert_redirected_to '/custom_fields' end - + def test_post_new_list_custom_field assert_difference 'CustomField.count' do post :new, :type => "IssueCustomField", @@ -67,7 +67,7 @@ class CustomFieldsControllerTest < ActionController::TestCase :is_required =>"0", :field_format => "list", :tracker_ids => ["1", ""]} - end + end assert_redirected_to '/custom_fields?tab=IssueCustomField' field = IssueCustomField.find_by_name('test_post_new_list') assert_not_nil field diff --git a/test/functional/documents_controller_test.rb b/test/functional/documents_controller_test.rb index 486e66f3..fbf226b0 100644 --- a/test/functional/documents_controller_test.rb +++ b/test/functional/documents_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,30 +18,30 @@ class DocumentsController; def rescue_action(e) raise e end; end class DocumentsControllerTest < ActionController::TestCase fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :documents, :enumerations - + def setup @controller = DocumentsController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil end - + def test_index # Sets a default category e = Enumeration.find_by_name('Technical documentation') e.update_attributes(:is_default => true) - + get :index, :project_id => 'ecookbook' assert_response :success assert_template 'index' assert_not_nil assigns(:grouped) - + # Default category selected in the new document form assert_tag :select, :attributes => {:name => 'document[category_id]'}, :child => {:tag => 'option', :attributes => {:selected => 'selected'}, :content => 'Technical documentation'} end - + def test_index_with_long_description # adds a long description to the first document doc = documents(:documents_001) @@ -50,7 +50,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut egestas, mi vehicula Vestibulum non velit mi. Aliquam scelerisque libero ut nulla fringilla a sollicitudin magna rhoncus. Praesent a nunc lorem, ac porttitor eros. Sed ac diam nec neque interdum adipiscing quis quis justo. Donec arcu nunc, fringilla eu dictum at, venenatis ac sem. Vestibulum quis elit urna, ac mattis sapien. Lorem ipsum dolor sit amet, consectetur adipiscing elit. LOREM - + get :index, :project_id => 'ecookbook' assert_response :success assert_template 'index' @@ -59,21 +59,21 @@ LOREM assert_select '.wiki p', :text => (doc.description.split("\n").first + '...') assert_select '.wiki p', :text => Regexp.new(Regexp.escape("EndOfLineHere...")) end - + def test_new_with_one_attachment ActionMailer::Base.deliveries.clear Setting.notified_events = Setting.notified_events.dup << 'document_added' @request.session[:user_id] = 2 set_tmp_attachments_directory - + post :new, :project_id => 'ecookbook', :document => { :title => 'DocumentsControllerTest#test_post_new', :description => 'This is a new document', :category_id => 2}, :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} - + assert_redirected_to '/projects/ecookbook/documents' - + document = Document.find_by_title('DocumentsControllerTest#test_post_new') assert_not_nil document assert_equal Enumeration.find(2), document.category @@ -81,7 +81,7 @@ LOREM assert_equal 'testfile.txt', document.attachments.first.filename assert_equal 1, ActionMailer::Base.deliveries.size end - + def test_destroy @request.session[:user_id] = 2 post :destroy, :id => 1 diff --git a/test/functional/enumerations_controller_test.rb b/test/functional/enumerations_controller_test.rb index bec49b34..1a1c16c4 100644 --- a/test/functional/enumerations_controller_test.rb +++ b/test/functional/enumerations_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,7 +18,7 @@ class EnumerationsController; def rescue_action(e) raise e end; end class EnumerationsControllerTest < ActionController::TestCase fixtures :enumerations, :issues, :users - + def setup @controller = EnumerationsController.new @request = ActionController::TestRequest.new @@ -31,20 +31,20 @@ class EnumerationsControllerTest < ActionController::TestCase assert_response :success assert_template 'list' end - + def test_destroy_enumeration_not_in_use post :destroy, :id => 7 assert_redirected_to :controller => 'enumerations', :action => 'index' assert_nil Enumeration.find_by_id(7) end - + def test_destroy_enumeration_in_use post :destroy, :id => 4 assert_response :success assert_template 'destroy' assert_not_nil Enumeration.find_by_id(4) end - + def test_destroy_enumeration_in_use_with_reassignment issue = Issue.find(:first, :conditions => {:priority_id => 4}) post :destroy, :id => 4, :reassign_to_id => 6 diff --git a/test/functional/files_controller_test.rb b/test/functional/files_controller_test.rb index 84b24777..914b3652 100644 --- a/test/functional/files_controller_test.rb +++ b/test/functional/files_controller_test.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 @@ require File.expand_path('../../test_helper', __FILE__) class FilesControllerTest < ActionController::TestCase fixtures :all - + def setup @controller = FilesController.new @request = ActionController::TestRequest.new @@ -29,11 +29,11 @@ class FilesControllerTest < ActionController::TestCase assert_response :success assert_template 'index' assert_not_nil assigns(:containers) - + # file attached to the project assert_tag :a, :content => 'project_file.zip', :attributes => { :href => '/attachments/download/8/project_file.zip' } - + # file attached to a project's version assert_tag :a, :content => 'version_file.zip', :attributes => { :href => '/attachments/download/9/version_file.zip' } @@ -44,7 +44,7 @@ class FilesControllerTest < ActionController::TestCase @request.session[:user_id] = 2 Setting.notified_events = ['file_added'] ActionMailer::Base.deliveries.clear - + assert_difference 'Attachment.count' do post :create, :project_id => 1, :version_id => '', :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} @@ -60,12 +60,12 @@ class FilesControllerTest < ActionController::TestCase assert_equal "[eCookbook] New file", mail.subject assert mail.body.include?('testfile.txt') end - + def test_create_version_file set_tmp_attachments_directory @request.session[:user_id] = 2 Setting.notified_events = ['file_added'] - + assert_difference 'Attachment.count' do post :create, :project_id => 1, :version_id => '2', :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} @@ -76,5 +76,5 @@ class FilesControllerTest < ActionController::TestCase assert_equal 'testfile.txt', a.filename assert_equal Version.find(2), a.container end - + end diff --git a/test/functional/gantts_controller_test.rb b/test/functional/gantts_controller_test.rb index 0742fa62..5890a3f5 100644 --- a/test/functional/gantts_controller_test.rb +++ b/test/functional/gantts_controller_test.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 @@ class GanttsControllerTest < ActionController::TestCase should "work" do i2 = Issue.find(2) i2.update_attribute(:due_date, 1.month.from_now) - + get :show, :project_id => 1 assert_response :success assert_template 'show.html.erb' @@ -33,20 +33,20 @@ class GanttsControllerTest < ActionController::TestCase i = Issue.find(2) assert_select "div a.issue", /##{i.id}/ end - + should "work without issue due dates" do Issue.update_all("due_date = NULL") - + get :show, :project_id => 1 assert_response :success assert_template 'show.html.erb' assert_not_nil assigns(:gantt) end - + should "work without issue and version due dates" do Issue.update_all("due_date = NULL") Version.update_all("effective_date = NULL") - + get :show, :project_id => 1 assert_response :success assert_template 'show.html.erb' @@ -66,7 +66,7 @@ class GanttsControllerTest < ActionController::TestCase get :show assert_response :success assert_template 'show.html.erb' - + assert_tag 'a', :content => /eCookbook/ # Root private project assert_no_tag 'a', {:content => /OnlineStore/} @@ -89,7 +89,7 @@ class GanttsControllerTest < ActionController::TestCase assert @response.body.starts_with?('%PDF') assert_not_nil assigns(:gantt) end - + should "export to png" do get :show, :project_id => 1, :format => 'png' assert_response :success diff --git a/test/functional/groups_controller_test.rb b/test/functional/groups_controller_test.rb index 2c8fc34c..31c55299 100644 --- a/test/functional/groups_controller_test.rb +++ b/test/functional/groups_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,7 +18,7 @@ class GroupsController; def rescue_action(e) raise e end; end class GroupsControllerTest < ActionController::TestCase fixtures :projects, :users, :members, :member_roles, :groups_users - + def setup @controller = GroupsController.new @request = ActionController::TestRequest.new @@ -26,80 +26,80 @@ class GroupsControllerTest < ActionController::TestCase User.current = nil @request.session[:user_id] = 1 end - + def test_index get :index assert_response :success assert_template 'index' end - + def test_show get :show, :id => 10 assert_response :success assert_template 'show' end - + def test_new get :new assert_response :success assert_template 'new' end - + def test_create assert_difference 'Group.count' do post :create, :group => {:lastname => 'New group'} end assert_redirected_to '/groups' end - + def test_edit get :edit, :id => 10 assert_response :success assert_template 'edit' end - + def test_update post :update, :id => 10 assert_redirected_to '/groups' end - + def test_destroy assert_difference 'Group.count', -1 do post :destroy, :id => 10 end assert_redirected_to '/groups' end - + def test_add_users assert_difference 'Group.find(10).users.count', 2 do post :add_users, :id => 10, :user_ids => ['2', '3'] end end - + def test_remove_user assert_difference 'Group.find(10).users.count', -1 do post :remove_user, :id => 10, :user_id => '8' end end - + def test_new_membership assert_difference 'Group.find(10).members.count' do post :edit_membership, :id => 10, :membership => { :project_id => 2, :role_ids => ['1', '2']} end end - + def test_edit_membership assert_no_difference 'Group.find(10).members.count' do post :edit_membership, :id => 10, :membership_id => 6, :membership => { :role_ids => ['1', '3']} end end - + def test_destroy_membership assert_difference 'Group.find(10).members.count', -1 do post :destroy_membership, :id => 10, :membership_id => 6 end end - + def test_autocomplete_for_user get :autocomplete_for_user, :id => 10, :q => 'mis' assert_response :success diff --git a/test/functional/help_controller_test.rb b/test/functional/help_controller_test.rb index 99b99417..f155303f 100644 --- a/test/functional/help_controller_test.rb +++ b/test/functional/help_controller_test.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/test/functional/issue_categories_controller_test.rb b/test/functional/issue_categories_controller_test.rb index 2eebd87d..30bdf246 100644 --- a/test/functional/issue_categories_controller_test.rb +++ b/test/functional/issue_categories_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,7 +18,7 @@ class IssueCategoriesController; def rescue_action(e) raise e end; end class IssueCategoriesControllerTest < ActionController::TestCase fixtures :projects, :users, :members, :member_roles, :roles, :enabled_modules, :issue_categories - + def setup @controller = IssueCategoriesController.new @request = ActionController::TestRequest.new @@ -26,14 +26,14 @@ class IssueCategoriesControllerTest < ActionController::TestCase User.current = nil @request.session[:user_id] = 2 end - + def test_get_new @request.session[:user_id] = 2 # manager get :new, :project_id => '1' assert_response :success assert_template 'new' end - + def test_post_new @request.session[:user_id] = 2 # manager assert_difference 'IssueCategory.count' do @@ -44,7 +44,7 @@ class IssueCategoriesControllerTest < ActionController::TestCase assert_not_nil category assert_equal 1, category.project_id end - + def test_post_edit assert_no_difference 'IssueCategory.count' do post :edit, :id => 2, :category => { :name => 'Testing' } @@ -52,25 +52,25 @@ class IssueCategoriesControllerTest < ActionController::TestCase assert_redirected_to '/projects/ecookbook/settings/categories' assert_equal 'Testing', IssueCategory.find(2).name end - + def test_edit_not_found post :edit, :id => 97, :category => { :name => 'Testing' } assert_response 404 end - + def test_destroy_category_not_in_use post :destroy, :id => 2 assert_redirected_to '/projects/ecookbook/settings/categories' assert_nil IssueCategory.find_by_id(2) end - + def test_destroy_category_in_use post :destroy, :id => 1 assert_response :success assert_template 'destroy' assert_not_nil IssueCategory.find_by_id(1) end - + def test_destroy_category_in_use_with_reassignment issue = Issue.find(:first, :conditions => {:category_id => 1}) post :destroy, :id => 1, :todo => 'reassign', :reassign_to_id => 2 @@ -79,7 +79,7 @@ class IssueCategoriesControllerTest < ActionController::TestCase # check that the issue was reassign assert_equal 2, issue.reload.category_id end - + def test_destroy_category_in_use_without_reassignment issue = Issue.find(:first, :conditions => {:category_id => 1}) post :destroy, :id => 1, :todo => 'nullify' diff --git a/test/functional/issue_moves_controller_test.rb b/test/functional/issue_moves_controller_test.rb index 1e289659..b490f571 100644 --- a/test/functional/issue_moves_controller_test.rb +++ b/test/functional/issue_moves_controller_test.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. #++ @@ -44,7 +44,7 @@ class IssueMovesControllerTest < ActionController::TestCase assert_equal 1, Issue.find(1).tracker_id assert_equal 2, Issue.find(2).tracker_id end - + def test_bulk_create_to_another_tracker @request.session[:user_id] = 2 post :create, :ids => [1, 2], :new_tracker_id => 2 @@ -57,7 +57,7 @@ class IssueMovesControllerTest < ActionController::TestCase setup do @request.session[:user_id] = 2 end - + should "allow changing the issue priority" do post :create, :ids => [1, 2], :priority_id => 6 @@ -75,7 +75,7 @@ class IssueMovesControllerTest < ActionController::TestCase assert_equal 'Moving two issues', Issue.find(2).journals.sort_by(&:id).last.notes end - + end def test_bulk_copy_to_another_project @@ -102,12 +102,12 @@ class IssueMovesControllerTest < ActionController::TestCase assert_equal issue_before_move.status_id, issue_after_move.status_id assert_equal issue_before_move.assigned_to_id, issue_after_move.assigned_to_id end - + should "allow changing the issue's attributes" do # Fixes random test failure with Mysql # where Issue.all(:limit => 2, :order => 'id desc', :conditions => {:project_id => 2}) doesn't return the expected results Issue.delete_all("project_id=2") - + @request.session[:user_id] = 2 assert_difference 'Issue.count', 2 do assert_no_difference 'Project.find(1).issues.count' do @@ -126,7 +126,7 @@ class IssueMovesControllerTest < ActionController::TestCase end end end - + def test_copy_to_another_project_should_follow_when_needed @request.session[:user_id] = 2 post :create, :ids => [1], :new_project_id => 2, :copy_options => {:copy => '1'}, :follow => '1' diff --git a/test/functional/issue_relations_controller_test.rb b/test/functional/issue_relations_controller_test.rb index 3bd7ba84..3c81d0db 100644 --- a/test/functional/issue_relations_controller_test.rb +++ b/test/functional/issue_relations_controller_test.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. #++ @@ -30,27 +30,27 @@ class IssueRelationsControllerTest < ActionController::TestCase :enabled_modules, :enumerations, :trackers - + def setup @controller = IssueRelationsController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil end - + def test_new assert_difference 'IssueRelation.count' do @request.session[:user_id] = 3 - post :new, :issue_id => 1, + post :new, :issue_id => 1, :relation => {:issue_to_id => '2', :relation_type => 'relates', :delay => ''} end end - + def test_new_xhr assert_difference 'IssueRelation.count' do @request.session[:user_id] = 3 xhr :post, :new, - :issue_id => 3, + :issue_id => 3, :relation => {:issue_to_id => '1', :relation_type => 'relates', :delay => ''} assert_select_rjs 'relations' do assert_select 'table', 1 @@ -58,49 +58,49 @@ class IssueRelationsControllerTest < ActionController::TestCase end end end - + def test_new_should_accept_id_with_hash assert_difference 'IssueRelation.count' do @request.session[:user_id] = 3 - post :new, :issue_id => 1, + post :new, :issue_id => 1, :relation => {:issue_to_id => '#2', :relation_type => 'relates', :delay => ''} end end - + def test_new_should_not_break_with_non_numerical_id assert_no_difference 'IssueRelation.count' do assert_nothing_raised do @request.session[:user_id] = 3 - post :new, :issue_id => 1, + post :new, :issue_id => 1, :relation => {:issue_to_id => 'foo', :relation_type => 'relates', :delay => ''} end end end - + def test_should_create_relations_with_visible_issues_only Setting.cross_project_issue_relations = '1' assert_nil Issue.visible(User.find(3)).find_by_id(4) - + assert_no_difference 'IssueRelation.count' do @request.session[:user_id] = 3 - post :new, :issue_id => 1, + post :new, :issue_id => 1, :relation => {:issue_to_id => '4', :relation_type => 'relates', :delay => ''} end end - + def test_destroy assert_difference 'IssueRelation.count', -1 do @request.session[:user_id] = 3 post :destroy, :id => '2', :issue_id => '3' end end - + def test_destroy_xhr IssueRelation.create!(:relation_type => IssueRelation::TYPE_RELATES) do |r| r.issue_from_id = 3 r.issue_to_id = 1 end - + assert_difference 'IssueRelation.count', -1 do @request.session[:user_id] = 3 xhr :post, :destroy, :id => '2', :issue_id => '3' diff --git a/test/functional/issue_statuses_controller_test.rb b/test/functional/issue_statuses_controller_test.rb index 636b1072..85beda05 100644 --- a/test/functional/issue_statuses_controller_test.rb +++ b/test/functional/issue_statuses_controller_test.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 @@ class IssueStatusesController; def rescue_action(e) raise e end; end class IssueStatusesControllerTest < ActionController::TestCase fixtures :issue_statuses, :issues - + def setup @controller = IssueStatusesController.new @request = ActionController::TestRequest.new @@ -28,19 +28,19 @@ class IssueStatusesControllerTest < ActionController::TestCase User.current = nil @request.session[:user_id] = 1 # admin end - + def test_index get :index assert_response :success assert_template 'index' end - + def test_new get :new assert_response :success assert_template 'new' end - + def test_create assert_difference 'IssueStatus.count' do post :create, :issue_status => {:name => 'New status'} @@ -49,33 +49,33 @@ class IssueStatusesControllerTest < ActionController::TestCase status = IssueStatus.find(:first, :order => 'id DESC') assert_equal 'New status', status.name end - + def test_edit get :edit, :id => '3' assert_response :success assert_template 'edit' end - + def test_update post :update, :id => '3', :issue_status => {:name => 'Renamed status'} assert_redirected_to :action => 'index' status = IssueStatus.find(3) assert_equal 'Renamed status', status.name end - + def test_destroy Issue.delete_all("status_id = 1") - + assert_difference 'IssueStatus.count', -1 do post :destroy, :id => '1' end assert_redirected_to :action => 'index' assert_nil IssueStatus.find_by_id(1) end - + def test_destroy_should_block_if_status_in_use assert_not_nil Issue.find_by_status_id(1) - + assert_no_difference 'IssueStatus.count' do post :destroy, :id => '1' end @@ -104,5 +104,5 @@ class IssueStatusesControllerTest < ActionController::TestCase should_redirect_to('the index') { '/issue_statuses' } end end - + end diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 2a3a769a..18985ea6 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -39,17 +39,17 @@ class IssuesControllerTest < ActionController::TestCase :time_entries, :journals, :queries - + def setup @controller = IssuesController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil end - + def test_index Setting.default_language = 'en' - + get :index assert_response :success assert_template 'index.rhtml' @@ -63,7 +63,7 @@ class IssuesControllerTest < ActionController::TestCase # project column assert_tag :tag => 'th', :content => /Project/ end - + def test_index_should_not_list_issues_when_module_disabled EnabledModule.delete_all("name = 'issue_tracking' AND project_id = 1") get :index @@ -85,7 +85,7 @@ class IssuesControllerTest < ActionController::TestCase assert_no_tag :tag => 'a', :content => /Can't print recipes/ assert_tag :tag => 'a', :content => /Subproject issue/ end - + def test_index_with_project Setting.display_subprojects_issues = 0 get :index, :project_id => 1 @@ -95,7 +95,7 @@ class IssuesControllerTest < ActionController::TestCase assert_tag :tag => 'a', :content => /Can't print recipes/ assert_no_tag :tag => 'a', :content => /Subproject issue/ end - + def test_index_with_project_and_subprojects Setting.display_subprojects_issues = 1 get :index, :project_id => 1 @@ -106,7 +106,7 @@ class IssuesControllerTest < ActionController::TestCase assert_tag :tag => 'a', :content => /Subproject issue/ assert_no_tag :tag => 'a', :content => /Issue of a private subproject/ end - + def test_index_with_project_and_subprojects_should_show_private_subprojects @request.session[:user_id] = 2 Setting.display_subprojects_issues = 1 @@ -118,45 +118,45 @@ class IssuesControllerTest < ActionController::TestCase assert_tag :tag => 'a', :content => /Subproject issue/ assert_tag :tag => 'a', :content => /Issue of a private subproject/ end - + def test_index_with_project_and_default_filter get :index, :project_id => 1, :set_filter => 1 assert_response :success assert_template 'index.rhtml' assert_not_nil assigns(:issues) - + query = assigns(:query) assert_not_nil query # default filter assert_equal({'status_id' => {:operator => 'o', :values => ['']}}, query.filters) end - + def test_index_with_project_and_filter - get :index, :project_id => 1, :set_filter => 1, + get :index, :project_id => 1, :set_filter => 1, :f => ['tracker_id'], :op => {'tracker_id' => '='}, - :v => {'tracker_id' => ['1']} + :v => {'tracker_id' => ['1']} assert_response :success assert_template 'index.rhtml' assert_not_nil assigns(:issues) - + query = assigns(:query) assert_not_nil query assert_equal({'tracker_id' => {:operator => '=', :values => ['1']}}, query.filters) end - + def test_index_with_project_and_empty_filters get :index, :project_id => 1, :set_filter => 1, :fields => [''] assert_response :success assert_template 'index.rhtml' assert_not_nil assigns(:issues) - + query = assigns(:query) assert_not_nil query # no filter assert_equal({}, query.filters) end - + def test_index_with_query get :index, :project_id => 1, :query_id => 5 assert_response :success @@ -164,7 +164,7 @@ class IssuesControllerTest < ActionController::TestCase assert_not_nil assigns(:issues) assert_nil assigns(:issue_count_by_group) end - + def test_index_with_query_grouped_by_tracker get :index, :project_id => 1, :query_id => 6 assert_response :success @@ -172,7 +172,7 @@ class IssuesControllerTest < ActionController::TestCase assert_not_nil assigns(:issues) assert_not_nil assigns(:issue_count_by_group) end - + def test_index_with_query_grouped_by_list_custom_field get :index, :project_id => 1, :query_id => 9 assert_response :success @@ -180,15 +180,15 @@ class IssuesControllerTest < ActionController::TestCase assert_not_nil assigns(:issues) assert_not_nil assigns(:issue_count_by_group) end - + def test_index_sort_by_field_not_included_in_columns Setting.issue_list_default_columns = %w(subject author) get :index, :sort => 'tracker' end - + def test_index_csv_with_project Setting.default_language = 'en' - + get :index, :format => 'csv' assert_response :success assert_not_nil assigns(:issues) @@ -200,24 +200,24 @@ class IssuesControllerTest < ActionController::TestCase assert_not_nil assigns(:issues) assert_equal 'text/csv', @response.content_type end - + def test_index_pdf get :index, :format => 'pdf' assert_response :success assert_not_nil assigns(:issues) assert_equal 'application/pdf', @response.content_type - + get :index, :project_id => 1, :format => 'pdf' assert_response :success assert_not_nil assigns(:issues) assert_equal 'application/pdf', @response.content_type - + get :index, :project_id => 1, :query_id => 6, :format => 'pdf' assert_response :success assert_not_nil assigns(:issues) assert_equal 'application/pdf', @response.content_type end - + def test_index_pdf_with_query_grouped_by_list_custom_field get :index, :project_id => 1, :query_id => 9, :format => 'pdf' assert_response :success @@ -225,31 +225,31 @@ class IssuesControllerTest < ActionController::TestCase assert_not_nil assigns(:issue_count_by_group) assert_equal 'application/pdf', @response.content_type end - + def test_index_sort get :index, :sort => 'tracker,id:desc' assert_response :success - + sort_params = @request.session['issues_index_sort'] assert sort_params.is_a?(String) assert_equal 'tracker,id:desc', sort_params - + issues = assigns(:issues) assert_not_nil issues assert !issues.empty? assert_equal issues.sort {|a,b| a.tracker == b.tracker ? b.id <=> a.id : a.tracker <=> b.tracker }.collect(&:id), issues.collect(&:id) end - + def test_index_with_columns columns = ['tracker', 'subject', 'assigned_to'] get :index, :set_filter => 1, :c => columns assert_response :success - + # query should use specified columns query = assigns(:query) assert_kind_of Query, query assert_equal columns, query.column_names.map(&:to_s) - + # columns should be stored in session assert_kind_of Hash, session[:query] assert_kind_of Array, session[:query][:column_names] @@ -262,69 +262,69 @@ class IssuesControllerTest < ActionController::TestCase assert_template 'show.rhtml' assert_not_nil assigns(:issue) assert_equal Issue.find(1), assigns(:issue) - + # anonymous role is allowed to add a note assert_tag :tag => 'form', :descendant => { :tag => 'fieldset', - :child => { :tag => 'legend', + :child => { :tag => 'legend', :content => /Notes/ } } end - + def test_show_by_manager @request.session[:user_id] = 2 get :show, :id => 1 assert_response :success - + assert_tag :tag => 'a', :content => /Quote/ - + assert_tag :tag => 'form', :descendant => { :tag => 'fieldset', - :child => { :tag => 'legend', + :child => { :tag => 'legend', :content => /Change properties/ } }, :descendant => { :tag => 'fieldset', - :child => { :tag => 'legend', + :child => { :tag => 'legend', :content => /Log time/ } }, :descendant => { :tag => 'fieldset', - :child => { :tag => 'legend', + :child => { :tag => 'legend', :content => /Notes/ } } end - + def test_show_should_deny_anonymous_access_without_permission Role.anonymous.remove_permission!(:view_issues) get :show, :id => 1 assert_response :redirect end - + def test_show_should_deny_non_member_access_without_permission Role.non_member.remove_permission!(:view_issues) @request.session[:user_id] = 9 get :show, :id => 1 assert_response 403 end - + def test_show_should_deny_member_access_without_permission Role.find(1).remove_permission!(:view_issues) @request.session[:user_id] = 2 get :show, :id => 1 assert_response 403 end - + def test_show_should_not_disclose_relations_to_invisible_issues Setting.cross_project_issue_relations = '1' IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => Issue.find(2), :relation_type => 'relates') # Relation to a private project issue IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => Issue.find(4), :relation_type => 'relates') - + get :show, :id => 1 assert_response :success - + assert_tag :div, :attributes => { :id => 'relations' }, :descendant => { :tag => 'a', :content => /#2$/ } assert_no_tag :div, :attributes => { :id => 'relations' }, :descendant => { :tag => 'a', :content => /#4$/ } end - + def test_show_atom get :show, :id => 2, :format => 'atom' assert_response :success @@ -332,7 +332,7 @@ class IssuesControllerTest < ActionController::TestCase # Inline image assert_select 'content', :text => Regexp.new(Regexp.quote('http://test.host/attachments/download/10')) end - + def test_show_export_to_pdf get :show, :id => 3, :format => 'pdf' assert_response :success @@ -346,7 +346,7 @@ class IssuesControllerTest < ActionController::TestCase get :new, :project_id => 1, :tracker_id => 1 assert_response :success assert_template 'new' - + assert_tag :tag => 'input', :attributes => { :name => 'issue[custom_field_values][2]', :value => 'Default string' } end @@ -356,51 +356,51 @@ class IssuesControllerTest < ActionController::TestCase get :new, :project_id => 1 assert_response :success assert_template 'new' - + issue = assigns(:issue) assert_not_nil issue assert_equal Project.find(1).trackers.first, issue.tracker end - + def test_get_new_with_no_default_status_should_display_an_error @request.session[:user_id] = 2 IssueStatus.delete_all - + get :new, :project_id => 1 assert_response 500 assert_error_tag :content => /No default issue/ end - + def test_get_new_with_no_tracker_should_display_an_error @request.session[:user_id] = 2 Tracker.delete_all - + get :new, :project_id => 1 assert_response 500 assert_error_tag :content => /No tracker/ end - + def test_update_new_form @request.session[:user_id] = 2 xhr :post, :new, :project_id => 1, - :issue => {:tracker_id => 2, + :issue => {:tracker_id => 2, :subject => 'This is the test_new issue', :description => 'This is the description', :priority_id => 5} assert_response :success assert_template 'attributes' - + issue = assigns(:issue) assert_kind_of Issue, issue assert_equal 1, issue.project_id assert_equal 2, issue.tracker_id assert_equal 'This is the test_new issue', issue.subject end - + def test_post_create @request.session[:user_id] = 2 assert_difference 'Issue.count' do - post :create, :project_id => 1, + post :create, :project_id => 1, :issue => {:tracker_id => 3, :status_id => 2, :subject => 'This is the test_new issue', @@ -411,7 +411,7 @@ class IssuesControllerTest < ActionController::TestCase :custom_field_values => {'2' => 'Value for field 2'}} end assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id - + issue = Issue.find_by_subject('This is the test_new issue') assert_not_nil issue assert_equal 2, issue.author_id @@ -423,11 +423,11 @@ class IssuesControllerTest < ActionController::TestCase assert_not_nil v assert_equal 'Value for field 2', v.value end - + def test_post_new_should_not_send_a_notification_if_send_notification_is_off ActionMailer::Base.deliveries.clear @request.session[:user_id] = 2 - post :create, :project_id => 1, + post :create, :project_id => 1, :send_notification => 0, :issue => {:tracker_id => 3, :subject => 'This is the test_new issue', @@ -436,14 +436,14 @@ class IssuesControllerTest < ActionController::TestCase :estimated_hours => '', :custom_field_values => {'2' => 'Value for field 2'}} assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id - + assert_equal 0, ActionMailer::Base.deliveries.size end def test_post_create_without_start_date @request.session[:user_id] = 2 assert_difference 'Issue.count' do - post :create, :project_id => 1, + post :create, :project_id => 1, :issue => {:tracker_id => 3, :status_id => 2, :subject => 'This is the test_new issue', @@ -454,15 +454,15 @@ class IssuesControllerTest < ActionController::TestCase :custom_field_values => {'2' => 'Value for field 2'}} end assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id - + issue = Issue.find_by_subject('This is the test_new issue') assert_not_nil issue assert_nil issue.start_date end - + def test_post_create_and_continue @request.session[:user_id] = 2 - post :create, :project_id => 1, + post :create, :project_id => 1, :issue => {:tracker_id => 3, :subject => 'This is first issue', :priority_id => 5}, @@ -470,11 +470,11 @@ class IssuesControllerTest < ActionController::TestCase assert_redirected_to :controller => 'issues', :action => 'new', :project_id => 'ecookbook', :issue => {:tracker_id => 3} end - + def test_post_create_without_custom_fields_param @request.session[:user_id] = 2 assert_difference 'Issue.count' do - post :create, :project_id => 1, + post :create, :project_id => 1, :issue => {:tracker_id => 1, :subject => 'This is the test_new issue', :description => 'This is the description', @@ -488,7 +488,7 @@ class IssuesControllerTest < ActionController::TestCase field.update_attribute(:is_required, true) @request.session[:user_id] = 2 - post :create, :project_id => 1, + post :create, :project_id => 1, :issue => {:tracker_id => 1, :subject => 'This is the test_new issue', :description => 'This is the description', @@ -499,13 +499,13 @@ class IssuesControllerTest < ActionController::TestCase assert_not_nil issue assert_equal I18n.translate('activerecord.errors.messages.invalid'), issue.errors.on(:custom_values) end - + def test_post_create_with_watchers @request.session[:user_id] = 2 ActionMailer::Base.deliveries.clear - + assert_difference 'Watcher.count', 2 do - post :create, :project_id => 1, + post :create, :project_id => 1, :issue => {:tracker_id => 1, :subject => 'This is a new issue with watchers', :description => 'This is the description', @@ -515,7 +515,7 @@ class IssuesControllerTest < ActionController::TestCase issue = Issue.find_by_subject('This is a new issue with watchers') assert_not_nil issue assert_redirected_to :controller => 'issues', :action => 'show', :id => issue - + # Watchers added assert_equal [2, 3], issue.watcher_user_ids.sort assert issue.watched_by?(User.find(3)) @@ -524,12 +524,12 @@ class IssuesControllerTest < ActionController::TestCase assert_kind_of TMail::Mail, mail assert [mail.bcc, mail.cc].flatten.include?(User.find(3).mail) end - + def test_post_create_subissue @request.session[:user_id] = 2 - + assert_difference 'Issue.count' do - post :create, :project_id => 1, + post :create, :project_id => 1, :issue => {:tracker_id => 1, :subject => 'This is a child issue', :parent_issue_id => 2} @@ -541,9 +541,9 @@ class IssuesControllerTest < ActionController::TestCase def test_post_create_subissue_with_non_numeric_parent_id @request.session[:user_id] = 2 - + assert_difference 'Issue.count' do - post :create, :project_id => 1, + post :create, :project_id => 1, :issue => {:tracker_id => 1, :subject => 'This is a child issue', :parent_issue_id => 'ABC'} @@ -552,12 +552,12 @@ class IssuesControllerTest < ActionController::TestCase assert_not_nil issue assert_nil issue.parent end - + def test_post_create_should_send_a_notification ActionMailer::Base.deliveries.clear @request.session[:user_id] = 2 assert_difference 'Issue.count' do - post :create, :project_id => 1, + post :create, :project_id => 1, :issue => {:tracker_id => 3, :subject => 'This is the test_new issue', :description => 'This is the description', @@ -566,13 +566,13 @@ class IssuesControllerTest < ActionController::TestCase :custom_field_values => {'2' => 'Value for field 2'}} end assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id - + assert_equal 1, ActionMailer::Base.deliveries.size end - + def test_post_create_should_preserve_fields_values_on_validation_failure @request.session[:user_id] = 2 - post :create, :project_id => 1, + post :create, :project_id => 1, :issue => {:tracker_id => 1, # empty subject :subject => '', @@ -581,35 +581,35 @@ class IssuesControllerTest < ActionController::TestCase :custom_field_values => {'1' => 'Oracle', '2' => 'Value for field 2'}} assert_response :success assert_template 'new' - + assert_tag :textarea, :attributes => { :name => 'issue[description]' }, :content => 'This is a description' assert_tag :select, :attributes => { :name => 'issue[priority_id]' }, :child => { :tag => 'option', :attributes => { :selected => 'selected', :value => '6' }, - :content => 'High' } + :content => 'High' } # Custom fields assert_tag :select, :attributes => { :name => 'issue[custom_field_values][1]' }, :child => { :tag => 'option', :attributes => { :selected => 'selected', :value => 'Oracle' }, - :content => 'Oracle' } + :content => 'Oracle' } assert_tag :input, :attributes => { :name => 'issue[custom_field_values][2]', :value => 'Value for field 2'} end - + def test_post_create_should_ignore_non_safe_attributes @request.session[:user_id] = 2 assert_nothing_raised do post :create, :project_id => 1, :issue => { :tracker => "A param can not be a Tracker" } end end - + context "without workflow privilege" do setup do Workflow.delete_all(["role_id = ?", Role.anonymous.id]) Role.anonymous.add_permission! :add_issues, :add_issue_notes end - + context "#new" do should "propose default status only" do get :new, :project_id => 1 @@ -620,10 +620,10 @@ class IssuesControllerTest < ActionController::TestCase :children => {:count => 1}, :child => {:tag => 'option', :attributes => {:value => IssueStatus.default.id.to_s}} end - + should "accept default status" do assert_difference 'Issue.count' do - post :create, :project_id => 1, + post :create, :project_id => 1, :issue => {:tracker_id => 1, :subject => 'This is an issue', :status_id => 1} @@ -631,10 +631,10 @@ class IssuesControllerTest < ActionController::TestCase issue = Issue.last(:order => 'id') assert_equal IssueStatus.default, issue.status end - + should "accept default status" do assert_difference 'Issue.count' do - post :create, :project_id => 1, + post :create, :project_id => 1, :issue => {:tracker_id => 1, :subject => 'This is an issue', :status_id => 1} @@ -642,10 +642,10 @@ class IssuesControllerTest < ActionController::TestCase issue = Issue.last(:order => 'id') assert_equal IssueStatus.default, issue.status end - + should "ignore unauthorized status" do assert_difference 'Issue.count' do - post :create, :project_id => 1, + post :create, :project_id => 1, :issue => {:tracker_id => 1, :subject => 'This is an issue', :status_id => 3} @@ -654,7 +654,7 @@ class IssuesControllerTest < ActionController::TestCase assert_equal IssueStatus.default, issue.status end end - + context "#update" do should "ignore status change" do assert_difference 'IssueJournal.count' do @@ -662,7 +662,7 @@ class IssuesControllerTest < ActionController::TestCase end assert_equal 1, Issue.find(1).status_id end - + should "ignore attributes changes" do assert_difference 'IssueJournal.count' do put :update, :id => 1, :notes => 'just trying', :issue => {:subject => 'changed', :assigned_to_id => 2} @@ -673,7 +673,7 @@ class IssuesControllerTest < ActionController::TestCase end end end - + context "with workflow privilege" do setup do Workflow.delete_all(["role_id = ?", Role.anonymous.id]) @@ -681,7 +681,7 @@ class IssuesControllerTest < ActionController::TestCase Workflow.create!(:role => Role.anonymous, :tracker_id => 1, :old_status_id => 1, :new_status_id => 4) Role.anonymous.add_permission! :add_issues, :add_issue_notes end - + context "#update" do should "accept authorized status" do assert_difference 'IssueJournal.count' do @@ -689,14 +689,14 @@ class IssuesControllerTest < ActionController::TestCase end assert_equal 3, Issue.find(1).status_id end - + should "ignore unauthorized status" do assert_difference 'IssueJournal.count' do put :update, :id => 1, :notes => 'just trying', :issue => {:status_id => 2} end assert_equal 1, Issue.find(1).status_id end - + should "accept authorized attributes changes" do assert_difference 'IssueJournal.count' do put :update, :id => 1, :notes => 'just trying', :issue => {:assigned_to_id => 2} @@ -704,7 +704,7 @@ class IssuesControllerTest < ActionController::TestCase issue = Issue.find(1) assert_equal 2, issue.assigned_to_id end - + should "ignore unauthorized attributes changes" do assert_difference 'IssueJournal.count' do put :update, :id => 1, :notes => 'just trying', :issue => {:subject => 'changed'} @@ -713,7 +713,7 @@ class IssuesControllerTest < ActionController::TestCase assert_equal "Can't print recipes", issue.subject end end - + context "and :edit_issues permission" do setup do Role.anonymous.add_permission! :add_issues, :edit_issues @@ -725,14 +725,14 @@ class IssuesControllerTest < ActionController::TestCase end assert_equal 3, Issue.find(1).status_id end - + should "ignore unauthorized status" do assert_difference 'IssueJournal.count' do put :update, :id => 1, :notes => 'just trying', :issue => {:status_id => 2} end assert_equal 1, Issue.find(1).status_id end - + should "accept authorized attributes changes" do assert_difference 'IssueJournal.count' do put :update, :id => 1, :notes => 'just trying', :issue => {:subject => 'changed', :assigned_to_id => 2} @@ -743,7 +743,7 @@ class IssuesControllerTest < ActionController::TestCase end end end - + def test_copy_issue @request.session[:user_id] = 2 get :new, :project_id => 1, :copy_from => 1 @@ -752,7 +752,7 @@ class IssuesControllerTest < ActionController::TestCase orig = Issue.find(1) assert_equal orig.subject, assigns(:issue).subject end - + def test_get_edit @request.session[:user_id] = 2 get :edit, :id => 1 @@ -761,26 +761,26 @@ class IssuesControllerTest < ActionController::TestCase assert_not_nil assigns(:issue) assert_equal Issue.find(1), assigns(:issue) end - + def test_get_edit_with_params @request.session[:user_id] = 2 get :edit, :id => 1, :issue => { :status_id => 5, :priority_id => 7 }, :time_entry => { :hours => '2.5', :comments => 'test_get_edit_with_params', :activity_id => TimeEntryActivity.first.id } assert_response :success assert_template 'edit' - + issue = assigns(:issue) assert_not_nil issue - + assert_equal 5, issue.status_id assert_tag :select, :attributes => { :name => 'issue[status_id]' }, - :child => { :tag => 'option', + :child => { :tag => 'option', :content => 'Closed', :attributes => { :selected => 'selected' } } - + assert_equal 7, issue.priority_id assert_tag :select, :attributes => { :name => 'issue[priority_id]' }, - :child => { :tag => 'option', + :child => { :tag => 'option', :content => 'Urgent', :attributes => { :selected => 'selected' } } @@ -795,13 +795,13 @@ class IssuesControllerTest < ActionController::TestCase @request.session[:user_id] = 2 xhr :post, :new, :project_id => 1, :id => 1, - :issue => {:tracker_id => 2, + :issue => {:tracker_id => 2, :subject => 'This is the test_new issue', :description => 'This is the description', :priority_id => 5} assert_response :success assert_template 'attributes' - + issue = assigns(:issue) assert_kind_of Issue, issue assert_equal 1, issue.id @@ -809,7 +809,7 @@ class IssuesControllerTest < ActionController::TestCase assert_equal 2, issue.tracker_id assert_equal 'This is the test_new issue', issue.subject end - + def test_update_using_invalid_http_verbs @request.session[:user_id] = 2 subject = 'Updated by an invalid http verb' @@ -827,7 +827,7 @@ class IssuesControllerTest < ActionController::TestCase def test_put_update_without_custom_fields_param @request.session[:user_id] = 2 ActionMailer::Base.deliveries.clear - + issue = Issue.find(1) assert_equal '125', issue.custom_value_for(2).value old_subject = issue.subject @@ -848,19 +848,19 @@ class IssuesControllerTest < ActionController::TestCase assert_equal new_subject, issue.subject # Make sure custom fields were not cleared assert_equal '125', issue.custom_value_for(2).value - + mail = ActionMailer::Base.deliveries.last assert_kind_of TMail::Mail, mail assert mail.subject.starts_with?("[#{issue.project.name} - #{issue.tracker.name} ##{issue.id}]") assert mail.body.include?("Subject changed from #{old_subject} to #{new_subject}") end - + def test_put_update_with_custom_field_change @request.session[:user_id] = 2 issue = Issue.find(1) ActionMailer::Base.deliveries.clear assert_equal '125', issue.custom_value_for(2).value - + assert_difference('IssueJournal.count') do put :update, :id => 1, :issue => {:subject => 'Custom field change', :priority_id => '6', @@ -876,12 +876,12 @@ class IssuesControllerTest < ActionController::TestCase assert_redirected_to :action => 'show', :id => '1' issue.reload assert_equal 'New custom value', issue.custom_value_for(2).value - + mail = ActionMailer::Base.deliveries.last assert_kind_of TMail::Mail, mail assert mail.body.include?("Searchable field changed from 125 to New custom value") end - + def test_put_update_with_status_and_assignee_change issue = Issue.find(1) assert_equal 1, issue.status_id @@ -899,13 +899,13 @@ class IssuesControllerTest < ActionController::TestCase j = IssueJournal.find(:first, :order => 'id DESC') assert_equal 'Assigned to dlopper', j.notes assert_equal 2, j.details.size - + mail = ActionMailer::Base.deliveries.last assert mail.body.include?("Status changed from New to Assigned") # subject should contain the new status assert mail.subject.include?("(#{ IssueStatus.find(2).name })") end - + def test_put_update_with_note_only notes = 'Note added by IssuesControllerTest#test_update_with_note_only' # anonymous user @@ -917,11 +917,11 @@ class IssuesControllerTest < ActionController::TestCase assert_equal notes, j.notes assert_equal 0, j.details.size assert_equal User.anonymous, j.user - + mail = ActionMailer::Base.deliveries.last assert mail.body.include?(notes) end - + def test_put_update_with_note_and_spent_time @request.session[:user_id] = 2 spent_hours_before = Issue.find(1).spent_hours @@ -932,19 +932,19 @@ class IssuesControllerTest < ActionController::TestCase :time_entry => { :hours => '2.5', :comments => 'test_put_update_with_note_and_spent_time', :activity_id => TimeEntryActivity.first.id } end assert_redirected_to :action => 'show', :id => '1' - + issue = Issue.find(1) - + j = IssueJournal.find(:first, :order => 'id DESC') assert_equal '2.5 hours added', j.notes assert_equal 0, j.details.size - + t = issue.time_entries.find_by_comments('test_put_update_with_note_and_spent_time') assert_not_nil t assert_equal 2.5, t.hours assert_equal spent_hours_before + 2.5, issue.spent_hours end - + def test_put_update_with_attachment_only set_tmp_attachments_directory @@ -959,21 +959,21 @@ class IssuesControllerTest < ActionController::TestCase assert_equal 1, j.details.size assert_equal 'testfile.txt', j.value(j.details.to_a.first) assert_equal User.anonymous, j.user - + mail = ActionMailer::Base.deliveries.last assert mail.body.include?('testfile.txt') end def test_put_update_with_attachment_that_fails_to_save set_tmp_attachments_directory - + # Delete all fixtured journals, a race condition can occur causing the wrong # journal to get fetched in the next find. IssueJournal.delete_all # Mock out the unsaved attachment Attachment.any_instance.stubs(:create).returns(Attachment.new) - + # anonymous user put :update, :id => 1, @@ -987,14 +987,14 @@ class IssuesControllerTest < ActionController::TestCase def test_put_update_with_no_change issue = Issue.find(1) ActionMailer::Base.deliveries.clear - + assert_no_difference('IssueJournal.count') do put :update, :id => 1, :notes => '' end assert_redirected_to :action => 'show', :id => '1' - + issue.reload # No email should be sent assert ActionMailer::Base.deliveries.empty? @@ -1006,7 +1006,7 @@ class IssuesControllerTest < ActionController::TestCase issue = Issue.find(1) old_subject = issue.subject new_subject = 'Subject modified by IssuesControllerTest#test_post_edit' - + put :update, :id => 1, :issue => {:subject => new_subject, :priority_id => '6', :category_id => '1' # no change @@ -1020,7 +1020,7 @@ class IssuesControllerTest < ActionController::TestCase issue = Issue.find(1) old_subject = issue.subject new_subject = 'Subject modified by IssuesControllerTest#test_post_edit' - + put :update, :id => 1, :send_notification => 0, :issue => {:subject => new_subject, @@ -1029,11 +1029,11 @@ class IssuesControllerTest < ActionController::TestCase } assert_equal 0, ActionMailer::Base.deliveries.size end - + def test_put_update_with_invalid_spent_time_hours_only @request.session[:user_id] = 2 notes = 'Note added by IssuesControllerTest#test_post_edit_with_invalid_spent_time' - + assert_no_difference('IssueJournal.count') do put :update, :id => 1, @@ -1042,16 +1042,16 @@ class IssuesControllerTest < ActionController::TestCase end assert_response :success assert_template 'edit' - + assert_error_tag :descendant => {:content => /Activity can't be blank/} assert_tag :textarea, :attributes => { :name => 'notes' }, :content => notes assert_tag :input, :attributes => { :name => 'time_entry[hours]', :value => "2z" } end - + def test_put_update_with_invalid_spent_time_comments_only @request.session[:user_id] = 2 notes = 'Note added by IssuesControllerTest#test_post_edit_with_invalid_spent_time' - + assert_no_difference('IssueJournal.count') do put :update, :id => 1, @@ -1060,13 +1060,13 @@ class IssuesControllerTest < ActionController::TestCase end assert_response :success assert_template 'edit' - + assert_error_tag :descendant => {:content => /Activity can't be blank/} assert_error_tag :descendant => {:content => /Hours can't be blank/} assert_tag :textarea, :attributes => { :name => 'notes' }, :content => notes assert_tag :input, :attributes => { :name => 'time_entry[comments]', :value => "this is my comment" } end - + def test_put_update_should_allow_fixed_version_to_be_set_to_a_subproject issue = Issue.find(2) @request.session[:user_id] = 2 @@ -1097,7 +1097,7 @@ class IssuesControllerTest < ActionController::TestCase assert_response :redirect assert_redirected_to '/issues' end - + def test_put_update_should_not_redirect_back_using_the_back_url_parameter_off_the_host issue = Issue.find(2) @request.session[:user_id] = 2 @@ -1112,21 +1112,21 @@ class IssuesControllerTest < ActionController::TestCase assert_response :redirect assert_redirected_to :controller => 'issues', :action => 'show', :id => issue.id end - + def test_get_bulk_edit @request.session[:user_id] = 2 get :bulk_edit, :ids => [1, 2] assert_response :success assert_template 'bulk_edit' - + assert_tag :input, :attributes => {:name => 'issue[parent_issue_id]'} - + # Project specific custom field, date type field = CustomField.find(9) assert !field.is_for_all? assert_equal 'date', field.field_format assert_tag :input, :attributes => {:name => 'issue[custom_field_values][9]'} - + # System wide custom field assert CustomField.find(1).is_for_all? assert_tag :select, :attributes => {:name => 'issue[custom_field_values][1]'} @@ -1137,10 +1137,10 @@ class IssuesControllerTest < ActionController::TestCase get :bulk_edit, :ids => [1, 2, 6] assert_response :success assert_template 'bulk_edit' - + # Can not set issues from different projects as children of an issue assert_no_tag :input, :attributes => {:name => 'issue[parent_issue_id]'} - + # Project specific custom field, date type field = CustomField.find(9) assert !field.is_for_all? @@ -1155,11 +1155,11 @@ class IssuesControllerTest < ActionController::TestCase :issue => {:priority_id => 7, :assigned_to_id => '', :custom_field_values => {'2' => ''}} - + assert_response 302 # check that the issues were updated assert_equal [7, 7], Issue.find_all_by_id([1, 2]).collect {|i| i.priority.id} - + issue = Issue.find(1) journal = issue.journals.find(:first, :order => 'created_at DESC') assert_equal '125', issue.custom_value_for(2).value @@ -1193,11 +1193,11 @@ class IssuesControllerTest < ActionController::TestCase :issue => {:priority_id => 7, :assigned_to_id => '', :custom_field_values => {'2' => ''}} - + assert_response 302 # check that the issues were updated assert_equal [7, 7, 7], Issue.find([1,2,6]).map(&:priority_id) - + issue = Issue.find(1) journal = issue.journals.find(:first, :order => 'created_at DESC') assert_equal '125', issue.custom_value_for(2).value @@ -1218,7 +1218,7 @@ class IssuesControllerTest < ActionController::TestCase assert_response 403 assert_not_equal "Bulk should fail", IssueJournal.last.notes end - + def test_bullk_update_should_send_a_notification @request.session[:user_id] = 2 ActionMailer::Base.deliveries.clear @@ -1244,18 +1244,18 @@ class IssuesControllerTest < ActionController::TestCase :issue => {:priority_id => '', :assigned_to_id => '', :status_id => '5'} - + assert_response 302 issue = Issue.find(1) assert issue.closed? end - + def test_bulk_update_parent_id @request.session[:user_id] = 2 post :bulk_update, :ids => [1, 3], :notes => 'Bulk editing parent', :issue => {:priority_id => '', :assigned_to_id => '', :status_id => '', :parent_issue_id => '2'} - + assert_response 302 parent = Issue.find(2) assert_equal parent.id, Issue.find(1).parent_id @@ -1270,9 +1270,9 @@ class IssuesControllerTest < ActionController::TestCase :issue => {:priority_id => '', :assigned_to_id => '', :custom_field_values => {'2' => '777'}} - + assert_response 302 - + issue = Issue.find(1) journal = issue.journals.last assert_equal '777', issue.custom_value_for(2).value @@ -1290,7 +1290,7 @@ class IssuesControllerTest < ActionController::TestCase # check that the issues were updated assert_nil Issue.find(2).assigned_to end - + def test_post_bulk_update_should_allow_fixed_version_to_be_set_to_a_subproject @request.session[:user_id] = 2 @@ -1319,7 +1319,7 @@ class IssuesControllerTest < ActionController::TestCase assert_response :redirect assert_redirected_to :controller => 'issues', :action => 'index', :project_id => Project.find(1).identifier end - + def test_destroy_issue_with_no_time_entries assert_nil TimeEntry.find_by_issue_id(2) @request.session[:user_id] = 2 @@ -1353,7 +1353,7 @@ class IssuesControllerTest < ActionController::TestCase assert_nil TimeEntry.find(1).issue_id assert_nil TimeEntry.find(2).issue_id end - + def test_destroy_issues_and_reassign_time_entries_to_another_issue @request.session[:user_id] = 2 post :destroy, :ids => [1, 3], :todo => 'reassign', :reassign_to_id => 2 @@ -1362,26 +1362,26 @@ class IssuesControllerTest < ActionController::TestCase assert_equal 2, TimeEntry.find(1).issue_id assert_equal 2, TimeEntry.find(2).issue_id end - + def test_destroy_issues_from_different_projects @request.session[:user_id] = 2 post :destroy, :ids => [1, 2, 6], :todo => 'destroy' assert_redirected_to :controller => 'issues', :action => 'index' assert !(Issue.find_by_id(1) || Issue.find_by_id(2) || Issue.find_by_id(6)) end - + def test_destroy_parent_and_child_issues parent = Issue.generate!(:project_id => 1, :tracker_id => 1) child = Issue.generate!(:project_id => 1, :tracker_id => 1, :parent_issue_id => parent.id) assert child.is_descendant_of?(parent.reload) - + @request.session[:user_id] = 2 assert_difference 'Issue.count', -2 do post :destroy, :ids => [parent.id, child.id], :todo => 'destroy' end assert_response 302 end - + def test_default_search_scope get :index assert_tag :div, :attributes => {:id => 'quick-search'}, diff --git a/test/functional/issues_controller_transaction_test.rb b/test/functional/issues_controller_transaction_test.rb index a966de1f..49eaca1c 100644 --- a/test/functional/issues_controller_transaction_test.rb +++ b/test/functional/issues_controller_transaction_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -41,14 +41,14 @@ class IssuesControllerTransactionTest < ActionController::TestCase :queries self.use_transactional_fixtures = false - + def setup @controller = IssuesController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil end - + def test_put_update_stale_issue issue = Issue.find(2) @request.session[:user_id] = 2 @@ -68,7 +68,7 @@ class IssuesControllerTransactionTest < ActionController::TestCase end end end - + assert_response :success assert_template 'edit' assert_tag :tag => 'div', :attributes => { :id => 'errorExplanation' }, diff --git a/test/functional/journals_controller_test.rb b/test/functional/journals_controller_test.rb index 07ded863..4d36db36 100644 --- a/test/functional/journals_controller_test.rb +++ b/test/functional/journals_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -26,7 +26,7 @@ class JournalsControllerTest < ActionController::TestCase @response = ActionController::TestResponse.new User.current = nil end - + def test_get_edit @request.session[:user_id] = 1 xhr :get, :edit, :id => 2 @@ -36,7 +36,7 @@ class JournalsControllerTest < ActionController::TestCase assert_select 'textarea' end end - + def test_post_edit @request.session[:user_id] = 1 xhr :post, :edit, :id => 2, :notes => 'Updated notes' @@ -44,7 +44,7 @@ class JournalsControllerTest < ActionController::TestCase assert_select_rjs :replace, 'journal-2-notes' assert_equal 'Updated notes', Journal.find(2).notes end - + def test_post_edit_with_empty_notes @request.session[:user_id] = 1 xhr :post, :edit, :id => 2, :notes => '' @@ -59,14 +59,14 @@ class JournalsControllerTest < ActionController::TestCase assert_not_nil assigns(:journals) assert_equal 'application/atom+xml', @response.content_type end - + def test_reply_to_issue @request.session[:user_id] = 2 get :new, :id => 6 assert_response :success assert_select_rjs :show, "update" end - + def test_reply_to_issue_without_permission @request.session[:user_id] = 7 get :new, :id => 6 diff --git a/test/functional/ldap_auth_sources_controller.rb b/test/functional/ldap_auth_sources_controller.rb index d52dd2d6..dd2a5437 100644 --- a/test/functional/ldap_auth_sources_controller.rb +++ b/test/functional/ldap_auth_sources_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/test/functional/mail_handler_controller_test.rb b/test/functional/mail_handler_controller_test.rb index 68d4b982..0916744d 100644 --- a/test/functional/mail_handler_controller_test.rb +++ b/test/functional/mail_handler_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,30 +18,30 @@ class MailHandlerController; def rescue_action(e) raise e end; end class MailHandlerControllerTest < ActionController::TestCase fixtures :users, :projects, :enabled_modules, :roles, :members, :member_roles, :issues, :issue_statuses, :trackers, :enumerations - + FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures/mail_handler' - + def setup @controller = MailHandlerController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil end - + def test_should_create_issue # Enable API and set a key Setting.mail_handler_api_enabled = 1 Setting.mail_handler_api_key = 'secret' - + post :index, :key => 'secret', :email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml')) assert_response 201 end - + def test_should_not_allow # Disable API Setting.mail_handler_api_enabled = 0 Setting.mail_handler_api_key = 'secret' - + post :index, :key => 'secret', :email => IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml')) assert_response 403 end diff --git a/test/functional/members_controller_test.rb b/test/functional/members_controller_test.rb index 93ebe33e..66863632 100644 --- a/test/functional/members_controller_test.rb +++ b/test/functional/members_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -19,7 +19,7 @@ class MembersController; def rescue_action(e) raise e end; end class MembersControllerTest < ActionController::TestCase fixtures :projects, :members, :member_roles, :roles, :users - + def setup @controller = MembersController.new @request = ActionController::TestRequest.new @@ -27,7 +27,7 @@ class MembersControllerTest < ActionController::TestCase User.current = nil @request.session[:user_id] = 2 end - + def test_create assert_difference 'Member.count' do post :new, :id => 1, :member => {:role_ids => [1], :user_id => 7} @@ -35,7 +35,7 @@ class MembersControllerTest < ActionController::TestCase assert_redirected_to '/projects/ecookbook/settings/members' assert User.find(7).member_of?(Project.find(1)) end - + def test_create_multiple assert_difference 'Member.count', 3 do post :new, :id => 1, :member => {:role_ids => [1], :user_ids => [7, 8, 9]} @@ -53,13 +53,13 @@ class MembersControllerTest < ActionController::TestCase assert User.find(8).member_of?(Project.find(1)) assert User.find(9).member_of?(Project.find(1)) end - + should "replace the tab with RJS" do post :new, :format => "js", :id => 1, :member => {:role_ids => [1], :user_ids => [7, 8, 9]} assert_select_rjs :replace_html, 'tab-content-members' end - + end context "with a failed save" do @@ -68,7 +68,7 @@ class MembersControllerTest < ActionController::TestCase assert_select '#tab-content-members', 0 end - + should "open an error message" do post :new, :format => "js", :id => 1, :member => {:role_ids => [], :user_ids => [7, 8, 9]} @@ -77,14 +77,14 @@ class MembersControllerTest < ActionController::TestCase end end - + def test_edit assert_no_difference 'Member.count' do post :edit, :id => 2, :member => {:role_ids => [1], :user_id => 3} end assert_redirected_to '/projects/ecookbook/settings/members' end - + def test_destroy assert_difference 'Member.count', -1 do post :destroy, :id => 2 @@ -92,12 +92,12 @@ class MembersControllerTest < ActionController::TestCase assert_redirected_to '/projects/ecookbook/settings/members' assert !User.find(3).member_of?(Project.find(1)) end - + def test_autocomplete_for_member get :autocomplete_for_member, :id => 1, :q => 'mis' assert_response :success assert_template 'autocomplete_for_member' - + assert_tag :label, :content => /User Misc/, :child => { :tag => 'input', :attributes => { :name => 'member[user_ids][]', :value => '8' } } end diff --git a/test/functional/messages_controller_test.rb b/test/functional/messages_controller_test.rb index fc6710f0..6db28d10 100644 --- a/test/functional/messages_controller_test.rb +++ b/test/functional/messages_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,14 +18,14 @@ class MessagesController; def rescue_action(e) raise e end; end class MessagesControllerTest < ActionController::TestCase fixtures :projects, :users, :members, :member_roles, :roles, :boards, :messages, :enabled_modules - + def setup @controller = MessagesController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil end - + def test_show get :show, :board_id => 1, :id => 1 assert_response :success @@ -34,11 +34,11 @@ class MessagesControllerTest < ActionController::TestCase assert_not_nil assigns(:project) assert_not_nil assigns(:topic) end - + def test_show_with_pagination message = Message.find(1) assert_difference 'Message.count', 30 do - 30.times do + 30.times do message.children << Message.new(:subject => 'Reply', :content => 'Reply body', :author_id => 2, :board_id => 1) end end @@ -50,7 +50,7 @@ class MessagesControllerTest < ActionController::TestCase assert !replies.include?(message.children.first(:order => 'id')) assert replies.include?(message.children.last(:order => 'id')) end - + def test_show_with_reply_permission @request.session[:user_id] = 2 get :show, :board_id => 1, :id => 1 @@ -59,24 +59,24 @@ class MessagesControllerTest < ActionController::TestCase assert_tag :div, :attributes => { :id => 'reply' }, :descendant => { :tag => 'textarea', :attributes => { :id => 'message_content' } } end - + def test_show_message_not_found get :show, :board_id => 1, :id => 99999 assert_response 404 end - + def test_get_new @request.session[:user_id] = 2 get :new, :board_id => 1 assert_response :success - assert_template 'new' + assert_template 'new' end - + def test_post_new @request.session[:user_id] = 2 ActionMailer::Base.deliveries.clear Setting.notified_events = ['message_posted'] - + post :new, :board_id => 1, :message => { :subject => 'Test created message', :content => 'Message body'} @@ -96,14 +96,14 @@ class MessagesControllerTest < ActionController::TestCase # project member assert mail.bcc.include?('dlopper@somenet.foo') end - + def test_get_edit @request.session[:user_id] = 2 get :edit, :board_id => 1, :id => 1 assert_response :success - assert_template 'edit' + assert_template 'edit' end - + def test_post_edit @request.session[:user_id] = 2 post :edit, :board_id => 1, :id => 1, @@ -114,7 +114,7 @@ class MessagesControllerTest < ActionController::TestCase assert_equal 'New subject', message.subject assert_equal 'New body', message.content end - + def test_reply @request.session[:user_id] = 2 post :reply, :board_id => 1, :id => 1, :reply => { :content => 'This is a test reply', :subject => 'Test reply' } @@ -122,14 +122,14 @@ class MessagesControllerTest < ActionController::TestCase assert_redirected_to "/boards/1/topics/1?r=#{reply.id}" assert Message.find_by_subject('Test reply') end - + def test_destroy_topic @request.session[:user_id] = 2 post :destroy, :board_id => 1, :id => 1 assert_redirected_to '/projects/ecookbook/boards/1' assert_nil Message.find_by_id(1) end - + def test_quote @request.session[:user_id] = 2 xhr :get, :quote, :board_id => 1, :id => 3 diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb index 4cb6dcda..ac240b86 100644 --- a/test/functional/my_controller_test.rb +++ b/test/functional/my_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,7 +18,7 @@ class MyController; def rescue_action(e) raise e end; end class MyControllerTest < ActionController::TestCase fixtures :users, :user_preferences, :roles, :projects, :issues, :issue_statuses, :trackers, :enumerations, :custom_fields - + def setup @controller = MyController.new @request = ActionController::TestRequest.new @@ -31,30 +31,30 @@ class MyControllerTest < ActionController::TestCase assert_response :success assert_template 'page' end - + def test_page get :page assert_response :success assert_template 'page' end - + def test_my_account_should_show_editable_custom_fields get :account assert_response :success assert_template 'account' assert_equal User.find(2), assigns(:user) - + assert_tag :input, :attributes => { :name => 'user[custom_field_values][4]'} end - + def test_my_account_should_not_show_non_editable_custom_fields UserCustomField.find(4).update_attribute :editable, false - + get :account assert_response :success assert_template 'account' assert_equal User.find(2), assigns(:user) - + assert_no_tag :input, :attributes => { :name => 'user[custom_field_values][4]'} end @@ -67,7 +67,7 @@ class MyControllerTest < ActionController::TestCase :group_ids => ['10'], :custom_field_values => {"4" => "0100562500"} } - + assert_redirected_to '/my/account' user = User.find(2) assert_equal user, assigns(:user) @@ -78,28 +78,28 @@ class MyControllerTest < ActionController::TestCase assert !user.admin? assert user.groups.empty? end - + def test_change_password get :password assert_response :success assert_template 'password' - + # non matching password confirmation - post :password, :password => 'jsmith', + post :password, :password => 'jsmith', :new_password => 'hello', :new_password_confirmation => 'hello2' assert_response :success assert_template 'password' assert_tag :tag => "div", :attributes => { :class => "errorExplanation" } - + # wrong password - post :password, :password => 'wrongpassword', + post :password, :password => 'wrongpassword', :new_password => 'hello', :new_password_confirmation => 'hello' assert_response :success assert_template 'password' assert_equal 'Wrong password', flash[:error] - + # good password post :password, :password => 'jsmith', :new_password => 'hello', @@ -107,13 +107,13 @@ class MyControllerTest < ActionController::TestCase assert_redirected_to '/my/account' assert User.try_to_login('jsmith', 'hello') end - + def test_page_layout get :page_layout assert_response :success assert_template 'page_layout' end - + def test_add_block xhr :post, :add_block, :block => 'issuesreportedbyme' assert_response :success @@ -150,7 +150,7 @@ class MyControllerTest < ActionController::TestCase should_set_the_flash_to /reset/ should_redirect_to('my account') {'/my/account' } end - + context "with no rss_token" do setup do assert_nil User.find(2).rss_token @@ -184,7 +184,7 @@ class MyControllerTest < ActionController::TestCase should_set_the_flash_to /reset/ should_redirect_to('my account') {'/my/account' } end - + context "with no api_token" do setup do assert_nil User.find(2).api_token diff --git a/test/functional/news_controller_test.rb b/test/functional/news_controller_test.rb index 8dc71758..222275aa 100644 --- a/test/functional/news_controller_test.rb +++ b/test/functional/news_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,14 +18,14 @@ class NewsController; def rescue_action(e) raise e end; end class NewsControllerTest < ActionController::TestCase fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :news, :comments - + def setup @controller = NewsController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil end - + def test_index get :index assert_response :success @@ -33,33 +33,33 @@ class NewsControllerTest < ActionController::TestCase assert_not_nil assigns(:newss) assert_nil assigns(:project) end - + def test_index_with_project get :index, :project_id => 1 assert_response :success assert_template 'index' assert_not_nil assigns(:newss) end - + def test_show get :show, :id => 1 assert_response :success assert_template 'show' assert_tag :tag => 'h2', :content => /eCookbook first release/ end - + def test_show_not_found get :show, :id => 999 assert_response 404 end - + def test_get_new @request.session[:user_id] = 2 get :new, :project_id => 1 assert_response :success assert_template 'new' end - + def test_post_create ActionMailer::Base.deliveries.clear Setting.notified_events = Setting.notified_events.dup << 'news_added' @@ -69,7 +69,7 @@ class NewsControllerTest < ActionController::TestCase :description => 'This is the description', :summary => '' } assert_redirected_to '/projects/ecookbook/news' - + news = News.find_by_title('NewsControllerTest') assert_not_nil news assert_equal 'This is the description', news.description @@ -77,14 +77,14 @@ class NewsControllerTest < ActionController::TestCase assert_equal Project.find(1), news.project assert_equal 1, ActionMailer::Base.deliveries.size end - + def test_get_edit @request.session[:user_id] = 2 get :edit, :id => 1 assert_response :success assert_template 'edit' end - + def test_put_update @request.session[:user_id] = 2 put :update, :id => 1, :news => { :description => 'Description changed by test_post_edit' } @@ -105,7 +105,7 @@ class NewsControllerTest < ActionController::TestCase assert_tag :tag => 'div', :attributes => { :id => 'errorExplanation' }, :content => /1 error/ end - + def test_destroy @request.session[:user_id] = 2 delete :destroy, :id => 1 diff --git a/test/functional/previews_controller_test.rb b/test/functional/previews_controller_test.rb index 09362243..dbfedde0 100644 --- a/test/functional/previews_controller_test.rb +++ b/test/functional/previews_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -22,7 +22,7 @@ class PreviewsControllerTest < ActionController::TestCase assert_template 'preview' assert_not_nil assigns(:description) end - + def test_preview_issue_notes @request.session[:user_id] = 2 post :issue, :project_id => '1', :id => 1, :issue => {:description => Issue.find(1).description}, :notes => 'Foo' @@ -30,7 +30,7 @@ class PreviewsControllerTest < ActionController::TestCase assert_template 'preview' assert_not_nil assigns(:notes) end - + def test_preview_journal_notes_for_update @request.session[:user_id] = 2 post :issue, :project_id => '1', :id => 1, :notes => 'Foo' diff --git a/test/functional/project_enumerations_controller_test.rb b/test/functional/project_enumerations_controller_test.rb index a013f2cd..5aacab83 100644 --- a/test/functional/project_enumerations_controller_test.rb +++ b/test/functional/project_enumerations_controller_test.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 @@ require File.expand_path('../../test_helper', __FILE__) class ProjectEnumerationsControllerTest < ActionController::TestCase fixtures :all - + def setup @request.session[:user_id] = nil Setting.default_language = 'en' @@ -89,7 +89,7 @@ class ProjectEnumerationsControllerTest < ActionController::TestCase }) assert project_activity_two.save - + put :update, :project_id => 1, :enumerations => { project_activity.id => {"custom_field_values"=>{"7" => "1"}, "active"=>"0"}, # De-activate project_activity_two.id => {"custom_field_values"=>{"7" => "1"}, "active"=>"0"} # De-activate @@ -115,7 +115,7 @@ class ProjectEnumerationsControllerTest < ActionController::TestCase def test_update_when_creating_new_activities_will_convert_existing_data assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(9, 1).size - + @request.session[:user_id] = 2 # manager put :update, :project_id => 1, :enumerations => { "9"=> {"parent_id"=>"9", "custom_field_values"=>{"7" => "1"}, "active"=>"0"} # Design, De-activate @@ -139,7 +139,7 @@ class ProjectEnumerationsControllerTest < ActionController::TestCase assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(9, 1).size assert_equal 1, TimeEntry.find_all_by_activity_id_and_project_id(10, 1).size - + @request.session[:user_id] = 2 # manager put :update, :project_id => 1, :enumerations => { "9"=> {"parent_id"=>"9", "custom_field_values"=>{"7" => "1"}, "active"=>"0"}, # Design @@ -177,7 +177,7 @@ class ProjectEnumerationsControllerTest < ActionController::TestCase assert_nil TimeEntryActivity.find_by_id(project_activity.id) assert_nil TimeEntryActivity.find_by_id(project_activity_two.id) end - + def test_destroy_should_reassign_time_entries_back_to_the_system_activity @request.session[:user_id] = 2 # manager project_activity = TimeEntryActivity.new({ @@ -189,7 +189,7 @@ class ProjectEnumerationsControllerTest < ActionController::TestCase assert project_activity.save assert TimeEntry.update_all("activity_id = '#{project_activity.id}'", ["project_id = ? AND activity_id = ?", 1, 9]) assert_equal 3, TimeEntry.find_all_by_activity_id_and_project_id(project_activity.id, 1).size - + delete :destroy, :project_id => 1 assert_response :redirect assert_redirected_to '/projects/ecookbook/settings/activities' diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index ff81fba5..feffb8c1 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -28,13 +28,13 @@ class ProjectsControllerTest < ActionController::TestCase @request.session[:user_id] = nil Setting.default_language = 'en' end - + def test_index get :index assert_response :success assert_template 'index' assert_not_nil assigns(:projects) - + assert_tag :ul, :child => {:tag => 'li', :descendant => {:tag => 'a', :content => 'eCookbook'}, :child => { :tag => 'ul', @@ -43,10 +43,10 @@ class ProjectsControllerTest < ActionController::TestCase } } } - + assert_no_tag :a, :content => /Private child of eCookbook/ end - + def test_index_atom get :index, :format => 'atom' assert_response :success @@ -54,7 +54,7 @@ class ProjectsControllerTest < ActionController::TestCase assert_select 'feed>title', :text => 'ChiliProject: Latest projects' assert_select 'feed>entry', :count => Project.count(:conditions => Project.visible_by(User.current)) end - + context "#index" do context "by non-admin user with view_time_entries permission" do setup do @@ -66,7 +66,7 @@ class ProjectsControllerTest < ActionController::TestCase assert_tag :a, :attributes => {:href => '/time_entries'} end end - + context "by non-admin user without view_time_entries permission" do setup do Role.find(2).remove_permission! :view_time_entries @@ -79,15 +79,15 @@ class ProjectsControllerTest < ActionController::TestCase assert_template 'index' assert_no_tag :a, :attributes => {:href => '/time_entries'} end - end + end end - + context "#new" do context "by admin user" do setup do @request.session[:user_id] = 1 end - + should "accept get" do get :new assert_response :success @@ -116,7 +116,7 @@ class ProjectsControllerTest < ActionController::TestCase Role.find(1).add_permission! :add_subprojects @request.session[:user_id] = 2 end - + should "accept get" do get :new, :parent_id => 'ecookbook' assert_response :success @@ -129,7 +129,7 @@ class ProjectsControllerTest < ActionController::TestCase :child => {:tag => 'option', :attributes => {:value => ''}} end end - + end context "POST :create" do @@ -137,11 +137,11 @@ class ProjectsControllerTest < ActionController::TestCase setup do @request.session[:user_id] = 1 end - + should "create a new project" do post :create, :project => { - :name => "blog", + :name => "blog", :description => "weblog", :homepage => 'http://weblog', :identifier => "blog", @@ -153,11 +153,11 @@ class ProjectsControllerTest < ActionController::TestCase :enabled_module_names => ['issue_tracking', 'news', 'repository'] } assert_redirected_to '/projects/blog/settings' - + project = Project.find_by_name('blog') assert_kind_of Project, project assert project.active? - assert_equal 'weblog', project.description + assert_equal 'weblog', project.description assert_equal 'http://weblog', project.homepage assert_equal true, project.is_public? assert_nil project.parent @@ -166,9 +166,9 @@ class ProjectsControllerTest < ActionController::TestCase assert_equal ['issue_tracking', 'news', 'repository'], project.enabled_module_names.sort assert project.issue_custom_fields.include?(IssueCustomField.find(9)) end - + should "create a new subproject" do - post :create, :project => { :name => "blog", + post :create, :project => { :name => "blog", :description => "weblog", :identifier => "blog", :is_public => 1, @@ -176,21 +176,21 @@ class ProjectsControllerTest < ActionController::TestCase :parent_id => 1 } assert_redirected_to '/projects/blog/settings' - + project = Project.find_by_name('blog') assert_kind_of Project, project assert_equal Project.find(1), project.parent end end - + context "by non-admin user with add_project permission" do setup do Role.non_member.add_permission! :add_project @request.session[:user_id] = 9 end - + should "accept create a Project" do - post :create, :project => { :name => "blog", + post :create, :project => { :name => "blog", :description => "weblog", :identifier => "blog", :is_public => 1, @@ -198,24 +198,24 @@ class ProjectsControllerTest < ActionController::TestCase :tracker_ids => ['1', '3'], :enabled_module_names => ['issue_tracking', 'news', 'repository'] } - + assert_redirected_to '/projects/blog/settings' - + project = Project.find_by_name('blog') assert_kind_of Project, project - assert_equal 'weblog', project.description + assert_equal 'weblog', project.description assert_equal true, project.is_public? assert_equal [1, 3], project.trackers.map(&:id).sort assert_equal ['issue_tracking', 'news', 'repository'], project.enabled_module_names.sort - + # User should be added as a project member assert User.find(9).member_of?(project) assert_equal 1, project.members.size end - + should "fail with parent_id" do assert_no_difference 'Project.count' do - post :create, :project => { :name => "blog", + post :create, :project => { :name => "blog", :description => "weblog", :identifier => "blog", :is_public => 1, @@ -229,16 +229,16 @@ class ProjectsControllerTest < ActionController::TestCase assert_not_nil project.errors.on(:parent_id) end end - + context "by non-admin user with add_subprojects permission" do setup do Role.find(1).remove_permission! :add_project Role.find(1).add_permission! :add_subprojects @request.session[:user_id] = 2 end - + should "create a project with a parent_id" do - post :create, :project => { :name => "blog", + post :create, :project => { :name => "blog", :description => "weblog", :identifier => "blog", :is_public => 1, @@ -248,10 +248,10 @@ class ProjectsControllerTest < ActionController::TestCase assert_redirected_to '/projects/blog/settings' project = Project.find_by_name('blog') end - + should "fail without parent_id" do assert_no_difference 'Project.count' do - post :create, :project => { :name => "blog", + post :create, :project => { :name => "blog", :description => "weblog", :identifier => "blog", :is_public => 1, @@ -263,11 +263,11 @@ class ProjectsControllerTest < ActionController::TestCase assert_kind_of Project, project assert_not_nil project.errors.on(:parent_id) end - + should "fail with unauthorized parent_id" do assert !User.find(2).member_of?(Project.find(6)) assert_no_difference 'Project.count' do - post :create, :project => { :name => "blog", + post :create, :project => { :name => "blog", :description => "weblog", :identifier => "blog", :is_public => 1, @@ -282,7 +282,7 @@ class ProjectsControllerTest < ActionController::TestCase end end end - + def test_create_should_preserve_modules_on_validation_failure with_settings :default_projects_modules => ['issue_tracking', 'repository'] do @request.session[:user_id] = 1 @@ -298,13 +298,13 @@ class ProjectsControllerTest < ActionController::TestCase assert_equal %w(issue_tracking news), project.enabled_module_names.sort end end - + def test_create_should_not_accept_get @request.session[:user_id] = 1 get :create assert_response :method_not_allowed end - + def test_show_by_id get :show, :id => 1 assert_response :success @@ -318,7 +318,7 @@ class ProjectsControllerTest < ActionController::TestCase assert_template 'show' assert_not_nil assigns(:project) assert_equal Project.find_by_identifier('ecookbook'), assigns(:project) - + assert_tag 'li', :content => /Development status/ end @@ -328,10 +328,10 @@ class ProjectsControllerTest < ActionController::TestCase assert_response :success assert_template 'show' assert_not_nil assigns(:project) - + assert_no_tag 'li', :content => /Development status/ end - + def test_show_should_not_fail_when_custom_values_are_nil project = Project.find_by_identifier('ecookbook') project.custom_values.first.update_attribute(:value, nil) @@ -341,17 +341,17 @@ class ProjectsControllerTest < ActionController::TestCase assert_not_nil assigns(:project) assert_equal Project.find_by_identifier('ecookbook'), assigns(:project) end - + def show_archived_project_should_be_denied project = Project.find_by_identifier('ecookbook') project.archive! - + get :show, :id => 'ecookbook' assert_response 403 assert_nil assigns(:project) assert_tag :tag => 'p', :content => /archived/ end - + def test_private_subprojects_hidden get :show, :id => 'ecookbook' assert_response :success @@ -366,14 +366,14 @@ class ProjectsControllerTest < ActionController::TestCase assert_template 'show' assert_tag :tag => 'a', :content => /Private child/ end - + def test_settings @request.session[:user_id] = 2 # manager get :settings, :id => 1 assert_response :success assert_template 'settings' end - + def test_update @request.session[:user_id] = 2 # manager post :update, :id => 1, :project => {:name => 'Test changed name', @@ -386,7 +386,7 @@ class ProjectsControllerTest < ActionController::TestCase def test_modules @request.session[:user_id] = 2 Project.find(1).enabled_module_names = ['issue_tracking', 'news'] - + post :modules, :id => 1, :enabled_module_names => ['issue_tracking', 'repository', 'documents'] assert_redirected_to '/projects/ecookbook/settings/modules' assert_equal ['documents', 'issue_tracking', 'repository'], Project.find(1).enabled_module_names.sort @@ -397,7 +397,7 @@ class ProjectsControllerTest < ActionController::TestCase get :modules, :id => 1 assert_response :method_not_allowed end - + def test_get_destroy @request.session[:user_id] = 1 # admin get :destroy, :id => 1 @@ -412,14 +412,14 @@ class ProjectsControllerTest < ActionController::TestCase assert_redirected_to '/admin/projects' assert_nil Project.find_by_id(1) end - + def test_archive @request.session[:user_id] = 1 # admin post :archive, :id => 1 assert_redirected_to '/admin/projects' assert !Project.find(1).active? end - + def test_unarchive @request.session[:user_id] = 1 # admin Project.find(1).archive @@ -427,7 +427,7 @@ class ProjectsControllerTest < ActionController::TestCase assert_redirected_to '/admin/projects' assert Project.find(1).active? end - + def test_project_breadcrumbs_should_be_limited_to_3_ancestors CustomField.delete_all parent = nil @@ -438,7 +438,7 @@ class ProjectsControllerTest < ActionController::TestCase assert_tag :h1, :parent => { :attributes => {:id => 'header'}}, :children => { :count => [i, 3].min, :only => { :tag => 'a' } } - + parent = p end end @@ -475,13 +475,13 @@ class ProjectsControllerTest < ActionController::TestCase get :show, :id => 1, :jump => 'issues' assert_redirected_to '/projects/ecookbook/issues' end - + def test_jump_should_not_redirect_to_inactive_tab get :show, :id => 3, :jump => 'documents' assert_response :success assert_template 'show' end - + def test_jump_should_not_redirect_to_unknown_tab get :show, :id => 3, :jump => 'foobar' assert_response :success @@ -497,13 +497,13 @@ class ProjectsControllerTest < ActionController::TestCase end # Don't use this hook now Redmine::Hook.clear_listeners - + def test_hook_response Redmine::Hook.add_listener(ProjectBasedTemplate) get :show, :id => 1 assert_tag :tag => 'link', :attributes => {:href => '/stylesheets/ecookbook.css'}, :parent => {:tag => 'head'} - + Redmine::Hook.clear_listeners end end diff --git a/test/functional/queries_controller_test.rb b/test/functional/queries_controller_test.rb index 24125b5e..f8fd8f9d 100644 --- a/test/functional/queries_controller_test.rb +++ b/test/functional/queries_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,14 +18,14 @@ class QueriesController; def rescue_action(e) raise e end; end class QueriesControllerTest < ActionController::TestCase fixtures :projects, :users, :members, :member_roles, :roles, :trackers, :issue_statuses, :issue_categories, :enumerations, :issues, :custom_fields, :custom_values, :queries - + def setup @controller = QueriesController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil end - + def test_get_new_project_query @request.session[:user_id] = 2 get :new, :project_id => 1 @@ -33,62 +33,62 @@ class QueriesControllerTest < ActionController::TestCase assert_template 'new' assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'query[is_public]', - :checked => nil } + :checked => nil } assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'query_is_for_all', :checked => nil, :disabled => nil } end - + def test_get_new_global_query @request.session[:user_id] = 2 get :new assert_response :success assert_template 'new' assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox', - :name => 'query[is_public]' } + :name => 'query[is_public]' } assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'query_is_for_all', :checked => 'checked', :disabled => nil } end - + def test_new_project_public_query @request.session[:user_id] = 2 post :new, - :project_id => 'ecookbook', + :project_id => 'ecookbook', :confirm => '1', :default_columns => '1', :f => ["status_id", "assigned_to_id"], :op => {"assigned_to_id" => "=", "status_id" => "o"}, :v => { "assigned_to_id" => ["1"], "status_id" => ["1"]}, :query => {"name" => "test_new_project_public_query", "is_public" => "1"} - + q = Query.find_by_name('test_new_project_public_query') assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q assert q.is_public? assert q.has_default_columns? assert q.valid? end - + def test_new_project_private_query @request.session[:user_id] = 3 post :new, - :project_id => 'ecookbook', + :project_id => 'ecookbook', :confirm => '1', :default_columns => '1', :fields => ["status_id", "assigned_to_id"], :operators => {"assigned_to_id" => "=", "status_id" => "o"}, :values => { "assigned_to_id" => ["1"], "status_id" => ["1"]}, :query => {"name" => "test_new_project_private_query", "is_public" => "1"} - + q = Query.find_by_name('test_new_project_private_query') assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :query_id => q assert !q.is_public? assert q.has_default_columns? assert q.valid? end - + def test_new_global_private_query_with_custom_columns @request.session[:user_id] = 3 post :new, @@ -98,7 +98,7 @@ class QueriesControllerTest < ActionController::TestCase :values => { "assigned_to_id" => ["me"], "status_id" => ["1"]}, :query => {"name" => "test_new_global_private_query", "is_public" => "1"}, :c => ["", "tracker", "subject", "priority", "category"] - + q = Query.find_by_name('test_new_global_private_query') assert_redirected_to :controller => 'issues', :action => 'index', :project_id => nil, :query_id => q assert !q.is_public? @@ -106,7 +106,7 @@ class QueriesControllerTest < ActionController::TestCase assert_equal [:tracker, :subject, :priority, :category], q.columns.collect {|c| c.name} assert q.valid? end - + def test_new_with_sort @request.session[:user_id] = 1 post :new, @@ -115,14 +115,14 @@ class QueriesControllerTest < ActionController::TestCase :operators => {"status_id" => "o"}, :values => {"status_id" => ["1"]}, :query => {:name => "test_new_with_sort", - :is_public => "1", + :is_public => "1", :sort_criteria => {"0" => ["due_date", "desc"], "1" => ["tracker", ""]}} - + query = Query.find_by_name("test_new_with_sort") assert_not_nil query assert_equal [['due_date', 'desc'], ['tracker', 'asc']], query.sort_criteria end - + def test_get_edit_global_public_query @request.session[:user_id] = 1 get :edit, :id => 4 @@ -130,7 +130,7 @@ class QueriesControllerTest < ActionController::TestCase assert_template 'edit' assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'query[is_public]', - :checked => 'checked' } + :checked => 'checked' } assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'query_is_for_all', :checked => 'checked', @@ -140,65 +140,65 @@ class QueriesControllerTest < ActionController::TestCase def test_edit_global_public_query @request.session[:user_id] = 1 post :edit, - :id => 4, + :id => 4, :confirm => '1', :default_columns => '1', :fields => ["status_id", "assigned_to_id"], :operators => {"assigned_to_id" => "=", "status_id" => "o"}, :values => { "assigned_to_id" => ["1"], "status_id" => ["1"]}, :query => {"name" => "test_edit_global_public_query", "is_public" => "1"} - + assert_redirected_to :controller => 'issues', :action => 'index', :query_id => 4 q = Query.find_by_name('test_edit_global_public_query') assert q.is_public? assert q.has_default_columns? assert q.valid? end - + def test_get_edit_global_private_query @request.session[:user_id] = 3 get :edit, :id => 3 assert_response :success assert_template 'edit' assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox', - :name => 'query[is_public]' } + :name => 'query[is_public]' } assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'query_is_for_all', :checked => 'checked', :disabled => 'disabled' } end - + def test_edit_global_private_query @request.session[:user_id] = 3 post :edit, - :id => 3, + :id => 3, :confirm => '1', :default_columns => '1', :fields => ["status_id", "assigned_to_id"], :operators => {"assigned_to_id" => "=", "status_id" => "o"}, :values => { "assigned_to_id" => ["me"], "status_id" => ["1"]}, :query => {"name" => "test_edit_global_private_query", "is_public" => "1"} - + assert_redirected_to :controller => 'issues', :action => 'index', :query_id => 3 q = Query.find_by_name('test_edit_global_private_query') assert !q.is_public? assert q.has_default_columns? assert q.valid? end - + def test_get_edit_project_private_query @request.session[:user_id] = 3 get :edit, :id => 2 assert_response :success assert_template 'edit' assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox', - :name => 'query[is_public]' } + :name => 'query[is_public]' } assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'query_is_for_all', :checked => nil, :disabled => nil } end - + def test_get_edit_project_public_query @request.session[:user_id] = 2 get :edit, :id => 1 @@ -207,13 +207,13 @@ class QueriesControllerTest < ActionController::TestCase assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'query[is_public]', :checked => 'checked' - } + } assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'query_is_for_all', :checked => nil, :disabled => 'disabled' } end - + def test_get_edit_sort_criteria @request.session[:user_id] = 1 get :edit, :id => 5 @@ -226,7 +226,7 @@ class QueriesControllerTest < ActionController::TestCase :child => { :tag => 'option', :attributes => { :value => 'desc', :selected => 'selected' } } end - + def test_destroy @request.session[:user_id] = 2 post :destroy, :id => 1 diff --git a/test/functional/reports_controller_test.rb b/test/functional/reports_controller_test.rb index 19e333b7..3acd4151 100644 --- a/test/functional/reports_controller_test.rb +++ b/test/functional/reports_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -19,14 +19,14 @@ class ReportsController; def rescue_action(e) raise e end; end class ReportsControllerTest < ActionController::TestCase fixtures :all - + def setup @controller = ReportsController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil end - + context "GET :issue_report without details" do setup do get :issue_report, :id => 1 @@ -68,7 +68,7 @@ class ReportsControllerTest < ActionController::TestCase should_respond_with :redirect should_redirect_to('the issue report') {{:controller => 'reports', :action => 'issue_report', :id => 'ecookbook'}} end - + end - + end diff --git a/test/functional/repositories_bazaar_controller_test.rb b/test/functional/repositories_bazaar_controller_test.rb index 1a01ead7..84160f98 100644 --- a/test/functional/repositories_bazaar_controller_test.rb +++ b/test/functional/repositories_bazaar_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -64,7 +64,7 @@ class RepositoriesBazaarControllerTest < ActionController::TestCase assert_equal 'file', entry.kind assert_equal 'directory/edit.png', entry.path end - + def test_browse_at_given_revision get :show, :id => 3, :path => [], :rev => 3 assert_response :success @@ -72,14 +72,14 @@ class RepositoriesBazaarControllerTest < ActionController::TestCase assert_not_nil assigns(:entries) assert_equal ['directory', 'doc-deleted.txt', 'doc-ls.txt', 'doc-mkdir.txt'], assigns(:entries).collect(&:name) end - + def test_changes get :changes, :id => 3, :path => ['doc-mkdir.txt'] assert_response :success assert_template 'changes' assert_tag :tag => 'h2', :content => 'doc-mkdir.txt' end - + def test_entry_show get :entry, :id => 3, :path => ['directory', 'doc-ls.txt'] assert_response :success @@ -90,14 +90,14 @@ class RepositoriesBazaarControllerTest < ActionController::TestCase :attributes => { :class => /line-num/ }, :sibling => { :tag => 'td', :content => /Show help message/ } end - + def test_entry_download get :entry, :id => 3, :path => ['directory', 'doc-ls.txt'], :format => 'raw' assert_response :success # File content assert @response.body.include?('Show help message') end - + def test_directory_entry get :entry, :id => 3, :path => ['directory'] assert_response :success @@ -114,11 +114,11 @@ class RepositoriesBazaarControllerTest < ActionController::TestCase # Line 11 removed assert_tag :tag => 'th', :content => /11/, - :sibling => { :tag => 'td', + :sibling => { :tag => 'td', :attributes => { :class => /diff_out/ }, :content => /Display more information/ } end - + def test_annotate get :annotate, :id => 3, :path => ['doc-mkdir.txt'] assert_response :success diff --git a/test/functional/repositories_controller_test.rb b/test/functional/repositories_controller_test.rb index fc7c57f7..17581642 100644 --- a/test/functional/repositories_controller_test.rb +++ b/test/functional/repositories_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -80,7 +80,7 @@ class RepositoriesControllerTest < ActionController::TestCase get :committers, :id => 1 assert_response :success assert_template 'committers' - + assert_tag :td, :content => 'dlopper', :sibling => { :tag => 'td', :child => { :tag => 'select', :attributes => { :name => %r{^committers\[\d+\]\[\]$} }, diff --git a/test/functional/repositories_cvs_controller_test.rb b/test/functional/repositories_cvs_controller_test.rb index 19148551..9025a609 100644 --- a/test/functional/repositories_cvs_controller_test.rb +++ b/test/functional/repositories_cvs_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) diff --git a/test/functional/repositories_darcs_controller_test.rb b/test/functional/repositories_darcs_controller_test.rb index 70529ae6..3568e575 100644 --- a/test/functional/repositories_darcs_controller_test.rb +++ b/test/functional/repositories_darcs_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -92,7 +92,7 @@ class RepositoriesDarcsControllerTest < ActionController::TestCase # Line 22 removed assert_tag :tag => 'th', :content => /22/, - :sibling => { :tag => 'td', + :sibling => { :tag => 'td', :attributes => { :class => /diff_out/ }, :content => /def remove/ } end diff --git a/test/functional/repositories_filesystem_controller_test.rb b/test/functional/repositories_filesystem_controller_test.rb index 4c8f9c4f..abbd6dcf 100644 --- a/test/functional/repositories_filesystem_controller_test.rb +++ b/test/functional/repositories_filesystem_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) diff --git a/test/functional/repositories_git_controller_test.rb b/test/functional/repositories_git_controller_test.rb index c4916b5a..b01165c4 100644 --- a/test/functional/repositories_git_controller_test.rb +++ b/test/functional/repositories_git_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -163,7 +163,7 @@ class RepositoriesGitControllerTest < ActionController::TestCase # Line 22 removed assert_tag :tag => 'th', :content => /22/, - :sibling => { :tag => 'td', + :sibling => { :tag => 'td', :attributes => { :class => /diff_out/ }, :content => /def remove/ } assert_tag :tag => 'h2', :content => /2f9c0091/ diff --git a/test/functional/repositories_mercurial_controller_test.rb b/test/functional/repositories_mercurial_controller_test.rb index d57e2e4e..22486357 100644 --- a/test/functional/repositories_mercurial_controller_test.rb +++ b/test/functional/repositories_mercurial_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -53,7 +53,7 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase if ruby19_non_utf8_pass puts "TODO: Mercurial functional test fails in Ruby 1.9 " + "and Encoding.default_external is not UTF-8. " + - "Current value is '#{Encoding.default_external.to_s}'" + "Current value is '#{Encoding.default_external.to_s}'" def test_fake; assert true end elsif File.directory?(REPOSITORY_PATH) def test_show_root @@ -182,7 +182,7 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase assert_template 'changes' assert_tag :tag => 'h2', :content => 'edit.png' end - + def test_entry_show get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'] assert_response :success @@ -206,7 +206,7 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase :content => /Mercurial is a distributed version control system/ } end end - + def test_entry_download get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'], :format => 'raw' assert_response :success @@ -240,7 +240,7 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase # Line 22 removed assert_tag :tag => 'th', :content => '22', - :sibling => { :tag => 'td', + :sibling => { :tag => 'td', :attributes => { :class => /diff_out/ }, :content => /def remove/ } assert_tag :tag => 'h2', :content => /4:def6d2f1254a/ @@ -272,7 +272,7 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase assert_template 'diff' assert_tag :tag => 'th', :content => '2', - :sibling => { :tag => 'td', + :sibling => { :tag => 'td', :attributes => { :class => /diff_in/ }, :content => /It is written in Python/ } end @@ -340,7 +340,7 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase :tag => 'td' , :content => 'jsmith' , :attributes => { :class => 'author' }, - + } assert_tag :tag => 'th', :content => '1', diff --git a/test/functional/repositories_subversion_controller_test.rb b/test/functional/repositories_subversion_controller_test.rb index e89e3d44..75467a06 100644 --- a/test/functional/repositories_subversion_controller_test.rb +++ b/test/functional/repositories_subversion_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -46,7 +46,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase assert_not_nil assigns(:entries) assert_not_nil assigns(:changesets) end - + def test_browse_root @repository.fetch_changesets @repository.reload @@ -57,7 +57,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase entry = assigns(:entries).detect {|e| e.name == 'subversion_test'} assert_equal 'dir', entry.kind end - + def test_browse_directory @repository.fetch_changesets @repository.reload @@ -81,18 +81,18 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase assert_not_nil assigns(:entries) assert_equal ['folder', '.project', 'helloworld.c', 'helloworld.rb', 'textfile.txt'], assigns(:entries).collect(&:name) end - + def test_file_changes @repository.fetch_changesets @repository.reload get :changes, :id => PRJ_ID, :path => ['subversion_test', 'folder', 'helloworld.rb' ] assert_response :success assert_template 'changes' - + changesets = assigns(:changesets) assert_not_nil changesets assert_equal %w(6 3 2), changesets.collect(&:revision) - + # svn properties displayed with svn >= 1.5 only if Redmine::Scm::Adapters::SubversionAdapter.client_version_above?([1, 5, 0]) assert_not_nil assigns(:properties) @@ -110,12 +110,12 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase get :changes, :id => PRJ_ID, :path => ['subversion_test', 'folder' ] assert_response :success assert_template 'changes' - + changesets = assigns(:changesets) assert_not_nil changesets assert_equal %w(10 9 7 6 5 2), changesets.collect(&:revision) end - + def test_entry @repository.fetch_changesets @repository.reload @@ -123,7 +123,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase assert_response :success assert_template 'entry' end - + def test_entry_should_send_if_too_big @repository.fetch_changesets @repository.reload @@ -135,7 +135,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition'] end end - + def test_entry_at_given_revision @repository.fetch_changesets @repository.reload @@ -146,7 +146,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase assert_tag :tag => 'td', :attributes => { :class => /line-code/}, :content => /Here's the code/ end - + def test_entry_not_found @repository.fetch_changesets @repository.reload @@ -154,7 +154,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ }, :content => /The entry or revision was not found in the repository/ end - + def test_entry_download @repository.fetch_changesets @repository.reload @@ -163,7 +163,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase assert_template '' assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition'] end - + def test_directory_entry @repository.fetch_changesets @repository.reload @@ -173,7 +173,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase assert_not_nil assigns(:entry) assert_equal 'folder', assigns(:entry).name end - + # TODO: this test needs fixtures. def test_revision @repository.fetch_changesets @@ -184,17 +184,17 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase assert_tag :tag => 'ul', :child => { :tag => 'li', # link to the entry at rev 2 - :child => { :tag => 'a', + :child => { :tag => 'a', :attributes => {:href => '/projects/ecookbook/repository/revisions/2/entry/test/some/path/in/the/repo'}, :content => 'repo', # link to partial diff - :sibling => { :tag => 'a', - :attributes => { :href => '/projects/ecookbook/repository/revisions/2/diff/test/some/path/in/the/repo' } + :sibling => { :tag => 'a', + :attributes => { :href => '/projects/ecookbook/repository/revisions/2/diff/test/some/path/in/the/repo' } } } } end - + def test_invalid_revision @repository.fetch_changesets @repository.reload @@ -224,24 +224,24 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase r = Project.find(1).repository # Changes repository url to a subdirectory r.update_attribute :url, (r.url + '/test/some') - + get :revision, :id => 1, :rev => 2 assert_response :success assert_template 'revision' assert_tag :tag => 'ul', :child => { :tag => 'li', # link to the entry at rev 2 - :child => { :tag => 'a', + :child => { :tag => 'a', :attributes => {:href => '/projects/ecookbook/repository/revisions/2/entry/path/in/the/repo'}, :content => 'repo', # link to partial diff - :sibling => { :tag => 'a', - :attributes => { :href => '/projects/ecookbook/repository/revisions/2/diff/path/in/the/repo' } + :sibling => { :tag => 'a', + :attributes => { :href => '/projects/ecookbook/repository/revisions/2/diff/path/in/the/repo' } } } } end - + def test_revision_diff @repository.fetch_changesets @repository.reload @@ -258,7 +258,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase get :diff, :id => PRJ_ID, :rev => 6, :rev_to => 2, :path => ['subversion_test', 'folder'] assert_response :success assert_template 'diff' - + diff = assigns(:diff) assert_not_nil diff # 2 files modified @@ -266,7 +266,7 @@ class RepositoriesSubversionControllerTest < ActionController::TestCase assert_tag :tag => 'h2', :content => /2:6/ end - + def test_annotate @repository.fetch_changesets @repository.reload diff --git a/test/functional/roles_controller_test.rb b/test/functional/roles_controller_test.rb index d0c7136e..1c8014ae 100644 --- a/test/functional/roles_controller_test.rb +++ b/test/functional/roles_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,7 +18,7 @@ class RolesController; def rescue_action(e) raise e end; end class RolesControllerTest < ActionController::TestCase fixtures :roles, :users, :members, :member_roles, :workflows, :trackers - + def setup @controller = RolesController.new @request = ActionController::TestRequest.new @@ -26,7 +26,7 @@ class RolesControllerTest < ActionController::TestCase User.current = nil @request.session[:user_id] = 1 # admin end - + def test_get_index get :index assert_response :success @@ -38,28 +38,28 @@ class RolesControllerTest < ActionController::TestCase assert_tag :tag => 'a', :attributes => { :href => '/roles/edit/1' }, :content => 'Manager' end - + def test_get_new get :new assert_response :success assert_template 'new' end - + def test_post_new_with_validaton_failure post :new, :role => {:name => '', :permissions => ['add_issues', 'edit_issues', 'log_time', ''], :assignable => '0'} - + assert_response :success assert_template 'new' assert_tag :tag => 'div', :attributes => { :id => 'errorExplanation' } end - + def test_post_new_without_workflow_copy post :new, :role => {:name => 'RoleWithoutWorkflowCopy', :permissions => ['add_issues', 'edit_issues', 'log_time', ''], :assignable => '0'} - + assert_redirected_to '/roles' role = Role.find_by_name('RoleWithoutWorkflowCopy') assert_not_nil role @@ -72,13 +72,13 @@ class RolesControllerTest < ActionController::TestCase :permissions => ['add_issues', 'edit_issues', 'log_time', ''], :assignable => '0'}, :copy_workflow_from => '1' - + assert_redirected_to '/roles' role = Role.find_by_name('RoleWithWorkflowCopy') assert_not_nil role assert_equal Role.find(1).workflows.size, role.workflows.size end - + def test_get_edit get :edit, :id => 1 assert_response :success @@ -91,62 +91,62 @@ class RolesControllerTest < ActionController::TestCase :role => {:name => 'Manager', :permissions => ['edit_project', ''], :assignable => '0'} - + assert_redirected_to '/roles' role = Role.find(1) assert_equal [:edit_project], role.permissions end - + def test_destroy r = Role.new(:name => 'ToBeDestroyed', :permissions => [:view_wiki_pages]) assert r.save - + post :destroy, :id => r assert_redirected_to '/roles' assert_nil Role.find_by_id(r.id) end - + def test_destroy_role_in_use post :destroy, :id => 1 assert_redirected_to '/roles' assert flash[:error] == 'This role is in use and cannot be deleted.' assert_not_nil Role.find_by_id(1) end - + def test_get_report get :report assert_response :success assert_template 'report' - + assert_not_nil assigns(:roles) assert_equal Role.find(:all, :order => 'builtin, position'), assigns(:roles) - + assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'permissions[3][]', :value => 'add_issues', :checked => 'checked' } - + assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'permissions[3][]', :value => 'delete_issues', :checked => nil } end - + def test_post_report post :report, :permissions => { '0' => '', '1' => ['edit_issues'], '3' => ['add_issues', 'delete_issues']} assert_redirected_to '/roles' - + assert_equal [:edit_issues], Role.find(1).permissions assert_equal [:add_issues, :delete_issues], Role.find(3).permissions assert Role.find(2).permissions.empty? end - + def test_clear_all_permissions post :report, :permissions => { '0' => '' } assert_redirected_to '/roles' assert Role.find(1).permissions.empty? end - + def test_move_highest post :edit, :id => 3, :role => {:move_to => 'highest'} assert_redirected_to '/roles' diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index f1e83bcc..c80b0319 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.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 SearchControllerTest < ActionController::TestCase :issues, :trackers, :issue_statuses, :custom_fields, :custom_values, :repositories, :changesets - + def setup @controller = SearchController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil end - + def test_search_for_projects get :index assert_response :success @@ -40,24 +40,24 @@ class SearchControllerTest < ActionController::TestCase assert_template 'index' assert assigns(:results).include?(Project.find(1)) end - + def test_search_all_projects get :index, :q => 'recipe subproject commit', :submit => 'Search' assert_response :success assert_template 'index' - + assert assigns(:results).include?(Issue.find(2)) assert assigns(:results).include?(Issue.find(5)) assert assigns(:results).include?(Changeset.find(101)) assert_select "dt.issue-edit" do assert_select "a", :text => /Add ingredients categories/ end - + assert assigns(:results_by_type).is_a?(Hash) assert_equal 5, assigns(:results_by_type)['changesets'] assert_tag :a, :content => 'Changesets (5)' end - + def test_search_issues get :index, :q => 'issue', :issues => 1 assert_response :success @@ -69,7 +69,7 @@ class SearchControllerTest < ActionController::TestCase assert_select "a", :text => /Closed/ end end - + def test_search_project_and_subprojects get :index, :id => 1, :q => 'recipe subproject', :scope => 'subprojects', :submit => 'Search' assert_response :success @@ -80,17 +80,17 @@ class SearchControllerTest < ActionController::TestCase def test_search_without_searchable_custom_fields CustomField.update_all "searchable = #{ActiveRecord::Base.connection.quoted_false}" - + get :index, :id => 1 assert_response :success assert_template 'index' assert_not_nil assigns(:project) - + get :index, :id => 1, :q => "can" assert_response :success assert_template 'index' end - + def test_search_with_searchable_custom_fields get :index, :id => 1, :q => "stringforcustomfield" assert_response :success @@ -99,7 +99,7 @@ class SearchControllerTest < ActionController::TestCase assert_equal 1, results.size assert results.include?(Issue.find(7)) end - + def test_search_all_words # 'all words' is on by default get :index, :id => 1, :q => 'recipe updating saving' @@ -108,7 +108,7 @@ class SearchControllerTest < ActionController::TestCase assert_equal 1, results.size assert results.include?(Issue.find(3)) end - + def test_search_one_of_the_words get :index, :id => 1, :q => 'recipe updating saving', :submit => 'Search' results = assigns(:results) @@ -130,7 +130,7 @@ class SearchControllerTest < ActionController::TestCase assert_not_nil results assert_equal 2, results.size end - + def test_search_with_invalid_project_id get :index, :id => 195, :q => 'recipe' assert_response 404 @@ -141,7 +141,7 @@ class SearchControllerTest < ActionController::TestCase # issue of a public project get :index, :q => "3" assert_redirected_to '/issues/3' - + # issue of a private project get :index, :q => "4" assert_response :success @@ -153,7 +153,7 @@ class SearchControllerTest < ActionController::TestCase assert_response :success assert_template 'index' end - + def test_tokens_with_quotes get :index, :id => 1, :q => '"good bye" hello "bye bye"' assert_equal ["good bye", "hello", "bye bye"], assigns(:tokens) diff --git a/test/functional/settings_controller_test.rb b/test/functional/settings_controller_test.rb index 2aa52423..3de761fd 100644 --- a/test/functional/settings_controller_test.rb +++ b/test/functional/settings_controller_test.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 SettingsController; def rescue_action(e) raise e end; end class SettingsControllerTest < ActionController::TestCase fixtures :users - + def setup @controller = SettingsController.new @request = ActionController::TestRequest.new @@ -27,19 +27,19 @@ class SettingsControllerTest < ActionController::TestCase User.current = nil @request.session[:user_id] = 1 # admin end - + def test_index get :index assert_response :success assert_template 'edit' end - + def test_get_edit get :edit assert_response :success assert_template 'edit' end - + def test_post_edit_notifications post :edit, :settings => {:mail_from => 'functional@test.foo', :bcc_recipients => '0', diff --git a/test/functional/sys_controller_test.rb b/test/functional/sys_controller_test.rb index dd5b9c1f..7c7badca 100644 --- a/test/functional/sys_controller_test.rb +++ b/test/functional/sys_controller_test.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 @@ class SysController; def rescue_action(e) raise e end; end class SysControllerTest < ActionController::TestCase fixtures :projects, :repositories, :enabled_modules - + def setup @controller = SysController.new @request = ActionController::TestRequest.new @@ -28,7 +28,7 @@ class SysControllerTest < ActionController::TestCase Setting.sys_api_enabled = '1' Setting.enabled_scm = %w(Subversion Git) end - + def test_projects_with_repository_enabled get :projects assert_response :success @@ -40,48 +40,48 @@ class SysControllerTest < ActionController::TestCase def test_create_project_repository assert_nil Project.find(4).repository - - post :create_project_repository, :id => 4, + + post :create_project_repository, :id => 4, :vendor => 'Subversion', :repository => { :url => 'file:///create/project/repository/subproject2'} assert_response :created - + r = Project.find(4).repository assert r.is_a?(Repository::Subversion) assert_equal 'file:///create/project/repository/subproject2', r.url end - + def test_fetch_changesets Repository::Subversion.any_instance.expects(:fetch_changesets).returns(true) get :fetch_changesets assert_response :success end - + def test_fetch_changesets_one_project Repository::Subversion.any_instance.expects(:fetch_changesets).returns(true) get :fetch_changesets, :id => 'ecookbook' assert_response :success end - + def test_fetch_changesets_unknown_project get :fetch_changesets, :id => 'unknown' assert_response 404 end - + def test_disabled_ws_should_respond_with_403_error with_settings :sys_api_enabled => '0' do get :projects assert_response 403 end end - + def test_api_key with_settings :sys_api_key => 'my_secret_key' do get :projects, :key => 'my_secret_key' assert_response :success end end - + def test_wrong_key_should_respond_with_403_error with_settings :sys_api_enabled => 'my_secret_key' do get :projects, :key => 'wrong_key' diff --git a/test/functional/time_entry_reports_controller_test.rb b/test/functional/time_entry_reports_controller_test.rb index 6f337b0c..c2fd568b 100644 --- a/test/functional/time_entry_reports_controller_test.rb +++ b/test/functional/time_entry_reports_controller_test.rb @@ -1,14 +1,14 @@ # -*- coding: utf-8 -*- #-- 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,7 +24,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase assert_tag :form, :attributes => {:action => "/projects/ecookbook/time_entries/report", :id => 'query_form'} end - + def test_report_all_projects get :report assert_response :success @@ -32,7 +32,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase assert_tag :form, :attributes => {:action => "/time_entries/report", :id => 'query_form'} end - + def test_report_all_projects_denied r = Role.anonymous r.permissions.delete(:view_time_entries) @@ -41,7 +41,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase get :report assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Ftime_entries%2Freport' end - + def test_report_all_projects_one_criteria get :report, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criterias => ['project'] assert_response :success @@ -66,7 +66,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase assert_equal "162.90", "%.2f" % assigns(:total_hours) assert_tag :tag => 'th', :content => '2007-03-12' end - + def test_report_one_criteria get :report, :project_id => 1, :columns => 'week', :from => "2007-04-01", :to => "2007-04-30", :criterias => ['project'] assert_response :success @@ -74,7 +74,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase assert_not_nil assigns(:total_hours) assert_equal "8.65", "%.2f" % assigns(:total_hours) end - + def test_report_two_criterias get :report, :project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criterias => ["member", "activity"] assert_response :success @@ -82,7 +82,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase assert_not_nil assigns(:total_hours) assert_equal "162.90", "%.2f" % assigns(:total_hours) end - + def test_report_one_day get :report, :project_id => 1, :columns => 'day', :from => "2007-03-23", :to => "2007-03-23", :criterias => ["member", "activity"] assert_response :success @@ -90,7 +90,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase assert_not_nil assigns(:total_hours) assert_equal "4.25", "%.2f" % assigns(:total_hours) end - + def test_report_at_issue_level get :report, :project_id => 1, :issue_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-12-31", :criterias => ["member", "activity"] assert_response :success @@ -100,7 +100,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase assert_tag :form, :attributes => {:action => "/projects/ecookbook/issues/1/time_entries/report", :id => 'query_form'} end - + def test_report_custom_field_criteria get :report, :project_id => 1, :criterias => ['project', 'cf_1', 'cf_7'] assert_response :success @@ -119,7 +119,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase # Second custom field column assert_tag :tag => 'th', :content => 'Billable' end - + def test_report_one_criteria_no_result get :report, :project_id => 1, :columns => 'week', :from => "1998-04-01", :to => "1998-04-30", :criterias => ['project'] assert_response :success @@ -127,7 +127,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase assert_not_nil assigns(:total_hours) assert_equal "0.00", "%.2f" % assigns(:total_hours) end - + def test_report_all_projects_csv_export get :report, :columns => 'month', :from => "2007-01-01", :to => "2007-06-30", :criterias => ["project", "member", "activity"], :format => "csv" assert_response :success @@ -138,7 +138,7 @@ class TimeEntryReportsControllerTest < ActionController::TestCase # Total row assert_equal 'Total,"","","","",154.25,8.65,"","",162.90', lines.last end - + def test_report_csv_export get :report, :project_id => 1, :columns => 'month', :from => "2007-01-01", :to => "2007-06-30", :criterias => ["project", "member", "activity"], :format => "csv" assert_response :success @@ -149,5 +149,5 @@ class TimeEntryReportsControllerTest < ActionController::TestCase # Total row assert_equal 'Total,"","","","",154.25,8.65,"","",162.90', lines.last end - + end diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb index 00a11c33..0465d480 100644 --- a/test/functional/timelog_controller_test.rb +++ b/test/functional/timelog_controller_test.rb @@ -1,14 +1,14 @@ # -*- coding: utf-8 -*- #-- 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. #++ @@ -26,7 +26,7 @@ class TimelogControllerTest < ActionController::TestCase @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new end - + def test_get_new @request.session[:user_id] = 3 get :new, :project_id => 1 @@ -36,14 +36,14 @@ class TimelogControllerTest < ActionController::TestCase assert_tag :tag => 'option', :attributes => { :selected => 'selected' }, :content => 'Development' end - + def test_get_new_should_only_show_active_time_entry_activities @request.session[:user_id] = 3 get :new, :project_id => 1 assert_response :success assert_template 'edit' assert_no_tag :tag => 'option', :content => 'Inactive Activity' - + end def test_get_edit_existing_time @@ -54,7 +54,7 @@ class TimelogControllerTest < ActionController::TestCase # Default activity selected assert_tag :tag => 'form', :attributes => { :action => '/projects/ecookbook/time_entries/2' } end - + def test_get_edit_with_an_existing_time_entry_with_inactive_activity te = TimeEntry.find(1) te.activity = TimeEntryActivity.find_by_name("Inactive Activity") @@ -67,7 +67,7 @@ class TimelogControllerTest < ActionController::TestCase # Blank option since nothing is pre-selected assert_tag :tag => 'option', :content => '--- Please select ---' end - + def test_post_create # TODO: should POST to issues’ time log instead of project. change form # and routing @@ -80,7 +80,7 @@ class TimelogControllerTest < ActionController::TestCase :issue_id => '1', :hours => '7.3'} assert_redirected_to :action => 'index', :project_id => 'ecookbook' - + i = Issue.find(1) t = TimeEntry.find_by_comments('Some work on TimelogControllerTest') assert_not_nil t @@ -103,31 +103,31 @@ class TimelogControllerTest < ActionController::TestCase :spent_on => '2008-03-14', :hours => '7.3'} assert_redirected_to :action => 'index', :project_id => 'ecookbook' - + t = TimeEntry.find_by_comments('Some work on TimelogControllerTest') assert_not_nil t assert_equal 11, t.activity_id assert_equal 7.3, t.hours assert_equal 3, t.user_id end - + def test_update entry = TimeEntry.find(1) assert_equal 1, entry.issue_id assert_equal 2, entry.user_id - + @request.session[:user_id] = 1 put :update, :id => 1, :time_entry => {:issue_id => '2', :hours => '8'} assert_redirected_to :action => 'index', :project_id => 'ecookbook' entry.reload - + assert_equal 8, entry.hours assert_equal 2, entry.issue_id assert_equal 2, entry.user_id end - + def test_destroy @request.session[:user_id] = 2 delete :destroy, :id => 1 @@ -135,7 +135,7 @@ class TimelogControllerTest < ActionController::TestCase assert_equal I18n.t(:notice_successful_delete), flash[:notice] assert_nil TimeEntry.find_by_id(1) end - + def test_destroy_should_fail # simulate that this fails (e.g. due to a plugin), see #5700 TimeEntry.class_eval do @@ -152,7 +152,7 @@ class TimelogControllerTest < ActionController::TestCase # remove the simulation TimeEntry.before_destroy.reject! {|callback| callback.method == :stop_callback_chain } end - + def test_index_all_projects get :index assert_response :success @@ -162,7 +162,7 @@ class TimelogControllerTest < ActionController::TestCase assert_tag :form, :attributes => {:action => "/time_entries", :id => 'query_form'} end - + def test_index_at_project_level get :index, :project_id => 'ecookbook' assert_response :success @@ -179,7 +179,7 @@ class TimelogControllerTest < ActionController::TestCase assert_tag :form, :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} end - + def test_index_at_project_level_with_date_range get :index, :project_id => 'ecookbook', :from => '2007-03-20', :to => '2007-04-30' assert_response :success @@ -215,7 +215,7 @@ class TimelogControllerTest < ActionController::TestCase assert_tag :form, :attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'} end - + def test_index_at_issue_level get :index, :issue_id => 1 assert_response :success @@ -232,7 +232,7 @@ class TimelogControllerTest < ActionController::TestCase assert_tag :form, :attributes => {:action => "/projects/ecookbook/issues/1/time_entries", :id => 'query_form'} end - + def test_index_atom_feed get :index, :project_id => 1, :format => 'atom' assert_response :success @@ -240,7 +240,7 @@ class TimelogControllerTest < ActionController::TestCase assert_not_nil assigns(:items) assert assigns(:items).first.is_a?(TimeEntry) end - + def test_index_all_projects_csv_export Setting.date_format = '%m/%d/%Y' get :index, :format => 'csv' @@ -249,7 +249,7 @@ class TimelogControllerTest < ActionController::TestCase assert @response.body.include?("Date,User,Activity,Project,Issue,Tracker,Subject,Hours,Comment\n") assert @response.body.include?("\n04/21/2007,redMine Admin,Design,eCookbook,3,Bug,Error 281 when updating a recipe,1.0,\"\"\n") end - + def test_index_csv_export Setting.date_format = '%m/%d/%Y' get :index, :project_id => 1, :format => 'csv' diff --git a/test/functional/trackers_controller_test.rb b/test/functional/trackers_controller_test.rb index 8aec6f2e..beaace72 100644 --- a/test/functional/trackers_controller_test.rb +++ b/test/functional/trackers_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,7 +18,7 @@ class TrackersController; def rescue_action(e) raise e end; end class TrackersControllerTest < ActionController::TestCase fixtures :trackers, :projects, :projects_trackers, :users, :issues, :custom_fields - + def setup @controller = TrackersController.new @request = ActionController::TestRequest.new @@ -26,13 +26,13 @@ class TrackersControllerTest < ActionController::TestCase User.current = nil @request.session[:user_id] = 1 # admin end - + def test_index get :index assert_response :success assert_template 'index' end - + def test_get_new get :new assert_response :success @@ -55,22 +55,22 @@ class TrackersControllerTest < ActionController::TestCase assert_equal 0, tracker.projects.count assert_equal Tracker.find(1).workflows.count, tracker.workflows.count end - + def test_get_edit Tracker.find(1).project_ids = [1, 3] - + get :edit, :id => 1 assert_response :success assert_template 'edit' - + assert_tag :input, :attributes => { :name => 'tracker[project_ids][]', :value => '1', :checked => 'checked' } - + assert_tag :input, :attributes => { :name => 'tracker[project_ids][]', :value => '2', :checked => nil } - + assert_tag :input, :attributes => { :name => 'tracker[project_ids][]', :value => '', :type => 'hidden'} @@ -89,13 +89,13 @@ class TrackersControllerTest < ActionController::TestCase assert_redirected_to :action => 'index' assert Tracker.find(1).project_ids.empty? end - + def test_move_lower tracker = Tracker.find_by_position(1) post :edit, :id => 1, :tracker => { :move_to => 'lower' } assert_equal 2, tracker.reload.position end - + def test_destroy tracker = Tracker.create!(:name => 'Destroyable') assert_difference 'Tracker.count', -1 do @@ -104,7 +104,7 @@ class TrackersControllerTest < ActionController::TestCase assert_redirected_to :action => 'index' assert_nil flash[:error] end - + def test_destroy_tracker_in_use assert_no_difference 'Tracker.count' do post :destroy, :id => 1 diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index 6e1c4a23..bff91192 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.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,9 +19,9 @@ class UsersController; def rescue_action(e) raise e end; end class UsersControllerTest < ActionController::TestCase include Redmine::I18n - + fixtures :users, :projects, :members, :member_roles, :roles, :auth_sources, :custom_fields, :custom_values, :groups_users - + def setup @controller = UsersController.new @request = ActionController::TestRequest.new @@ -29,7 +29,7 @@ class UsersControllerTest < ActionController::TestCase User.current = nil @request.session[:user_id] = 1 # admin end - + def test_index get :index assert_response :success @@ -44,7 +44,7 @@ class UsersControllerTest < ActionController::TestCase # active users only assert_nil assigns(:users).detect {|u| !u.active?} end - + def test_index_with_name_filter get :index, :name => 'john' assert_response :success @@ -54,7 +54,7 @@ class UsersControllerTest < ActionController::TestCase assert_equal 1, users.size assert_equal 'John', users.first.firstname end - + def test_index_with_group_filter get :index, :group_id => '10' assert_response :success @@ -63,17 +63,17 @@ class UsersControllerTest < ActionController::TestCase assert users.any? assert_equal([], (users - Group.find(10).users)) end - + def test_show @request.session[:user_id] = nil get :show, :id => 2 assert_response :success assert_template 'show' assert_not_nil assigns(:user) - + assert_tag 'li', :content => /Phone number/ end - + def test_show_should_not_display_hidden_custom_fields @request.session[:user_id] = nil UserCustomField.find_by_name('Phone number').update_attribute :visible, false @@ -81,7 +81,7 @@ class UsersControllerTest < ActionController::TestCase assert_response :success assert_template 'show' assert_not_nil assigns(:user) - + assert_no_tag 'li', :content => /Phone number/ end @@ -101,20 +101,20 @@ class UsersControllerTest < ActionController::TestCase get :show, :id => 5 assert_response 404 end - + def test_show_should_not_reveal_users_with_no_visible_activity_or_project @request.session[:user_id] = nil get :show, :id => 9 assert_response 404 end - + def test_show_inactive_by_admin @request.session[:user_id] = 1 get :show, :id => 5 assert_response 200 assert_not_nil assigns(:user) end - + def test_show_displays_memberships_based_on_project_visibility @request.session[:user_id] = 1 get :show, :id => 2 @@ -124,13 +124,13 @@ class UsersControllerTest < ActionController::TestCase project_ids = memberships.map(&:project_id) assert project_ids.include?(2) #private project admin can see end - + def test_show_current_should_require_authentication @request.session[:user_id] = nil get :show, :id => 'current' assert_response 302 end - + def test_show_current @request.session[:user_id] = 2 get :show, :id => 'current' @@ -138,18 +138,18 @@ class UsersControllerTest < ActionController::TestCase assert_template 'show' assert_equal User.find(2), assigns(:user) end - + def test_new get :new - + assert_response :success assert_template :new assert assigns(:user) end - + def test_create Setting.bcc_recipients = '1' - + assert_difference 'User.count' do assert_difference 'ActionMailer::Base.deliveries.size' do post :create, @@ -165,35 +165,35 @@ class UsersControllerTest < ActionController::TestCase :send_information => '1' end end - + user = User.first(:order => 'id DESC') assert_redirected_to :controller => 'users', :action => 'edit', :id => user.id - + assert_equal 'John', user.firstname assert_equal 'Doe', user.lastname assert_equal 'jdoe', user.login assert_equal 'jdoe@gmail.com', user.mail assert_equal 'none', user.mail_notification assert user.check_password?('secret') - + mail = ActionMailer::Base.deliveries.last assert_not_nil mail assert_equal [user.mail], mail.bcc assert mail.body.include?('secret') end - + def test_create_with_failure assert_no_difference 'User.count' do post :create, :user => {} end - + assert_response :success assert_template 'new' end def test_edit get :edit, :id => 2 - + assert_response :success assert_template 'edit' assert_equal User.find(2), assigns(:user) @@ -215,18 +215,18 @@ class UsersControllerTest < ActionController::TestCase assert_no_difference 'User.count' do put :update, :id => 2, :user => {:firstname => ''} end - + assert_response :success assert_template 'edit' end - + def test_update_with_group_ids_should_assign_groups put :update, :id => 2, :user => {:group_ids => ['10']} - + user = User.find(2) assert_equal [10], user.group_ids end - + def test_update_with_activation_should_send_a_notification u = User.new(:firstname => 'Foo', :lastname => 'Bar', :mail => 'foo.bar@somenet.foo', :language => 'fr') u.login = 'foo' @@ -234,7 +234,7 @@ class UsersControllerTest < ActionController::TestCase u.save! ActionMailer::Base.deliveries.clear Setting.bcc_recipients = '1' - + put :update, :id => u.id, :user => {:status => User::STATUS_ACTIVE} assert u.reload.active? mail = ActionMailer::Base.deliveries.last @@ -242,15 +242,15 @@ class UsersControllerTest < ActionController::TestCase assert_equal ['foo.bar@somenet.foo'], mail.bcc assert mail.body.include?(ll('fr', :notice_account_activated)) end - + def test_update_with_password_change_should_send_a_notification ActionMailer::Base.deliveries.clear Setting.bcc_recipients = '1' - + put :update, :id => 2, :user => {:password => 'newpass', :password_confirmation => 'newpass'}, :send_information => '1' u = User.find(2) assert u.check_password?('newpass') - + mail = ActionMailer::Base.deliveries.last assert_not_nil mail assert_equal [u.mail], mail.bcc @@ -268,14 +268,14 @@ class UsersControllerTest < ActionController::TestCase assert_equal nil, u.reload.auth_source assert u.check_password?('newpass') end - + def test_edit_membership post :edit_membership, :id => 2, :membership_id => 1, :membership => { :role_ids => [2]} assert_redirected_to :action => 'edit', :id => '2', :tab => 'memberships' assert_equal [2], Member.find(1).role_ids end - + def test_destroy_membership post :destroy_membership, :id => 2, :membership_id => 1 assert_redirected_to :action => 'edit', :id => '2', :tab => 'memberships' diff --git a/test/functional/versions_controller_test.rb b/test/functional/versions_controller_test.rb index 7df48f63..aced0cce 100644 --- a/test/functional/versions_controller_test.rb +++ b/test/functional/versions_controller_test.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,14 +19,14 @@ class VersionsController; def rescue_action(e) raise e end; end class VersionsControllerTest < ActionController::TestCase fixtures :projects, :versions, :issues, :users, :roles, :members, :member_roles, :enabled_modules, :issue_statuses - + def setup @controller = VersionsController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil end - + def test_index get :index, :project_id => 1 assert_response :success @@ -39,7 +39,7 @@ class VersionsControllerTest < ActionController::TestCase # Context menu on issues assert_select "script", :text => Regexp.new(Regexp.escape("new ContextMenu('/issues/context_menu')")) end - + def test_index_with_completed_versions get :index, :project_id => 1, :completed => 1 assert_response :success @@ -67,10 +67,10 @@ class VersionsControllerTest < ActionController::TestCase assert_response :success assert_template 'show' assert_not_nil assigns(:version) - + assert_tag :tag => 'h2', :content => /1.0/ end - + def test_create @request.session[:user_id] = 2 # manager assert_difference 'Version.count' do @@ -81,7 +81,7 @@ class VersionsControllerTest < ActionController::TestCase assert_not_nil version assert_equal 1, version.project_id end - + def test_create_from_issue_form @request.session[:user_id] = 2 # manager assert_difference 'Version.count' do @@ -93,14 +93,14 @@ class VersionsControllerTest < ActionController::TestCase assert_not_nil version assert_equal 1, version.project_id end - + def test_get_edit @request.session[:user_id] = 2 get :edit, :id => 2 assert_response :success assert_template 'edit' end - + def test_close_completed Version.update_all("status = 'open'") @request.session[:user_id] = 2 @@ -108,22 +108,22 @@ class VersionsControllerTest < ActionController::TestCase assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook' assert_not_nil Version.find_by_status('closed') end - + def test_post_update @request.session[:user_id] = 2 - put :update, :id => 2, - :version => { :name => 'New version name', + put :update, :id => 2, + :version => { :name => 'New version name', :effective_date => Date.today.strftime("%Y-%m-%d")} assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook' version = Version.find(2) assert_equal 'New version name', version.name assert_equal Date.today, version.effective_date end - + def test_post_update_with_validation_failure @request.session[:user_id] = 2 - put :update, :id => 2, - :version => { :name => '', + put :update, :id => 2, + :version => { :name => '', :effective_date => Date.today.strftime("%Y-%m-%d")} assert_response :success assert_template 'edit' @@ -135,13 +135,13 @@ class VersionsControllerTest < ActionController::TestCase assert_redirected_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => 'ecookbook' assert_nil Version.find_by_id(3) end - + def test_issue_status_by xhr :get, :status_by, :id => 2 assert_response :success assert_template '_issue_counts' end - + def test_issue_status_by_status xhr :get, :status_by, :id => 2, :status_by => 'status' assert_response :success diff --git a/test/functional/watchers_controller_test.rb b/test/functional/watchers_controller_test.rb index 5ce878c0..a22e0864 100644 --- a/test/functional/watchers_controller_test.rb +++ b/test/functional/watchers_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -19,20 +19,20 @@ class WatchersController; def rescue_action(e) raise e end; end class WatchersControllerTest < ActionController::TestCase fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :issues, :trackers, :projects_trackers, :issue_statuses, :enumerations, :watchers - + def setup @controller = WatchersController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil end - + def test_get_watch_should_be_invalid @request.session[:user_id] = 3 get :watch, :object_type => 'issue', :object_id => '1' assert_response 405 end - + def test_watch @request.session[:user_id] = 3 assert_difference('Watcher.count') do @@ -43,7 +43,7 @@ class WatchersControllerTest < ActionController::TestCase end assert Issue.find(1).watched_by?(User.find(3)) end - + def test_watch_should_be_denied_without_permission Role.find(2).remove_permission! :view_issues @request.session[:user_id] = 3 @@ -74,7 +74,7 @@ class WatchersControllerTest < ActionController::TestCase assert @response.body.include? "value.replace" end end - + def test_unwatch @request.session[:user_id] = 3 assert_difference('Watcher.count', -1) do @@ -119,7 +119,7 @@ class WatchersControllerTest < ActionController::TestCase end assert Issue.find(2).watched_by?(User.find(4)) end - + def test_remove_watcher @request.session[:user_id] = 2 assert_difference('Watcher.count', -1) do diff --git a/test/functional/welcome_controller_test.rb b/test/functional/welcome_controller_test.rb index 6d59ccdd..807a0fdf 100644 --- a/test/functional/welcome_controller_test.rb +++ b/test/functional/welcome_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,14 +18,14 @@ class WelcomeController; def rescue_action(e) raise e end; end class WelcomeControllerTest < ActionController::TestCase fixtures :projects, :news - + def setup @controller = WelcomeController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil end - + def test_index get :index assert_response :success @@ -34,53 +34,53 @@ class WelcomeControllerTest < ActionController::TestCase assert_not_nil assigns(:projects) assert !assigns(:projects).include?(Project.find(:first, :conditions => {:is_public => false})) end - + def test_browser_language Setting.default_language = 'en' @request.env['HTTP_ACCEPT_LANGUAGE'] = 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3' get :index assert_equal :fr, @controller.current_language end - + def test_browser_language_alternate Setting.default_language = 'en' @request.env['HTTP_ACCEPT_LANGUAGE'] = 'zh-TW' get :index assert_equal :"zh-TW", @controller.current_language end - + def test_browser_language_alternate_not_valid Setting.default_language = 'en' @request.env['HTTP_ACCEPT_LANGUAGE'] = 'fr-CA' get :index assert_equal :fr, @controller.current_language end - + def test_robots get :robots assert_response :success assert_equal 'text/plain', @response.content_type assert @response.body.match(%r{^Disallow: /projects/ecookbook/issues\r?$}) end - + def test_warn_on_leaving_unsaved_turn_on user = User.find(2) user.pref.warn_on_leaving_unsaved = '1' user.pref.save! @request.session[:user_id] = 2 - + get :index assert_tag 'script', :attributes => {:type => "text/javascript"}, :content => %r{new WarnLeavingUnsaved} end - + def test_warn_on_leaving_unsaved_turn_off user = User.find(2) user.pref.warn_on_leaving_unsaved = '0' user.pref.save! @request.session[:user_id] = 2 - + get :index assert_no_tag 'script', :attributes => {:type => "text/javascript"}, diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index a6a63fd3..04878acd 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -25,7 +25,7 @@ class WikiControllerTest < ActionController::TestCase @response = ActionController::TestResponse.new User.current = nil end - + def test_show_start_page get :show, :project_id => 'ecookbook' assert_response :success @@ -38,7 +38,7 @@ class WikiControllerTest < ActionController::TestCase :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Page_with_an_inline_image' }, :content => 'Page with an inline image' } } end - + def test_show_page_with_name get :show, :project_id => 1, :id => 'Another_page' assert_response :success @@ -49,30 +49,30 @@ class WikiControllerTest < ActionController::TestCase assert_tag :tag => 'img', :attributes => { :src => '/attachments/download/3', :alt => 'This is a logo' } end - + def test_show_with_sidebar page = Project.find(1).wiki.pages.new(:title => 'Sidebar') page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar') page.save! - + get :show, :project_id => 1, :id => 'Another_page' assert_response :success assert_tag :tag => 'div', :attributes => {:id => 'sidebar'}, :content => /Side bar content for test_show_with_sidebar/ end - + def test_show_unexistent_page_without_edit_right get :show, :project_id => 1, :id => 'Unexistent page' assert_response 404 end - + def test_show_unexistent_page_with_edit_right @request.session[:user_id] = 2 get :show, :project_id => 1, :id => 'Unexistent page' assert_response :success assert_template 'edit' end - + def test_create_page @request.session[:user_id] = 2 put :update, :project_id => 1, @@ -85,7 +85,7 @@ class WikiControllerTest < ActionController::TestCase assert_not_nil page.content assert_equal 'Created the page', page.content.last_journal.notes end - + def test_create_page_with_attachments @request.session[:user_id] = 2 assert_difference 'WikiPage.count' do @@ -119,7 +119,7 @@ class WikiControllerTest < ActionController::TestCase end end assert_redirected_to '/projects/ecookbook/wiki/Another_page' - + page = Wiki.find(1).pages.find_by_title('Another_page') assert_equal "edited", page.content.text assert_equal 2, page.content.version @@ -143,19 +143,19 @@ class WikiControllerTest < ActionController::TestCase end assert_response :success assert_template 'edit' - + assert_error_tag :descendant => {:content => /Comment is too long/} assert_tag :tag => 'textarea', :attributes => {:id => 'content_text'}, :content => 'edited' assert_tag :tag => 'input', :attributes => {:id => 'content_lock_version', :value => '1'} end - + def test_update_stale_page_should_not_raise_an_error @request.session[:user_id] = 2 c = Wiki.find(1).find_page('Another_page').content c.text = 'Previous text' c.save! assert_equal 2, c.version - + assert_no_difference 'WikiPage.count' do assert_no_difference 'WikiContent.count' do assert_no_difference 'WikiContentJournal.count' do @@ -174,17 +174,17 @@ class WikiControllerTest < ActionController::TestCase assert_tag :div, :attributes => { :class => /error/ }, :content => /Data has been updated by another user/ - assert_tag 'textarea', + assert_tag 'textarea', :attributes => { :name => 'content[text]' }, :content => /Text should not be lost/ - assert_tag 'input', + assert_tag 'input', :attributes => { :name => 'content[comments]', :value => 'My comments' } - + c.reload assert_equal 'Previous text', c.text assert_equal 2, c.version end - + def test_preview @request.session[:user_id] = 2 xhr :post, :preview, :project_id => 1, :id => 'CookBook_documentation', @@ -195,7 +195,7 @@ class WikiControllerTest < ActionController::TestCase assert_template 'common/_preview' assert_tag :tag => 'strong', :content => /previewed text/ end - + def test_preview_new_page @request.session[:user_id] = 2 xhr :post, :preview, :project_id => 1, :id => 'New page', @@ -206,7 +206,7 @@ class WikiControllerTest < ActionController::TestCase assert_template 'common/_preview' assert_tag :tag => 'h1', :content => /New page/ end - + def test_history get :history, :project_id => 1, :id => 'CookBook_documentation' assert_response :success @@ -224,7 +224,7 @@ class WikiControllerTest < ActionController::TestCase assert_equal 1, assigns(:versions).size assert_select "input[type=submit][name=commit]", false end - + def test_diff get :diff, :project_id => 1, :id => 'CookBook_documentation', :version => 2, :version_from => 1 assert_response :success @@ -232,7 +232,7 @@ class WikiControllerTest < ActionController::TestCase assert_tag :tag => 'span', :attributes => { :class => 'diff_in'}, :content => /updated/ end - + def test_annotate get :annotate, :project_id => 1, :id => 'CookBook_documentation', :version => 2 assert_response :success @@ -260,7 +260,7 @@ class WikiControllerTest < ActionController::TestCase :attributes => {:selected => 'selected'}, :parent => {:tag => 'select', :attributes => {:name => 'wiki_page[parent_id]'}} end - + def test_get_rename_child_page @request.session[:user_id] = 2 get :rename, :project_id => 1, :id => 'Child_1' @@ -278,7 +278,7 @@ class WikiControllerTest < ActionController::TestCase :attributes => {:name => 'wiki_page[parent_id]'} } end - + def test_rename_with_redirect @request.session[:user_id] = 2 post :rename, :project_id => 1, :id => 'Another_page', @@ -301,7 +301,7 @@ class WikiControllerTest < ActionController::TestCase # Check that there's no redirects assert_nil wiki.find_page('Another page') end - + def test_rename_with_parent_assignment @request.session[:user_id] = 2 post :rename, :project_id => 1, :id => 'Another_page', @@ -317,13 +317,13 @@ class WikiControllerTest < ActionController::TestCase assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Child_1' assert_nil WikiPage.find_by_title('Child_1').parent end - + def test_destroy_child @request.session[:user_id] = 2 delete :destroy, :project_id => 1, :id => 'Child_1' assert_redirected_to :action => 'index', :project_id => 'ecookbook' end - + def test_destroy_parent @request.session[:user_id] = 2 assert_no_difference('WikiPage.count') do @@ -332,7 +332,7 @@ class WikiControllerTest < ActionController::TestCase assert_response :success assert_template 'destroy' end - + def test_destroy_parent_with_nullify @request.session[:user_id] = 2 assert_difference('WikiPage.count', -1) do @@ -341,7 +341,7 @@ class WikiControllerTest < ActionController::TestCase assert_redirected_to :action => 'index', :project_id => 'ecookbook' assert_nil WikiPage.find_by_id(2) end - + def test_destroy_parent_with_cascade @request.session[:user_id] = 2 assert_difference('WikiPage.count', -3) do @@ -351,7 +351,7 @@ class WikiControllerTest < ActionController::TestCase assert_nil WikiPage.find_by_id(2) assert_nil WikiPage.find_by_id(5) end - + def test_destroy_parent_with_reassign @request.session[:user_id] = 2 assert_difference('WikiPage.count', -1) do @@ -361,7 +361,7 @@ class WikiControllerTest < ActionController::TestCase assert_nil WikiPage.find_by_id(2) assert_equal WikiPage.find(1), WikiPage.find_by_id(5).parent end - + def test_index get :index, :project_id => 'ecookbook' assert_response :success @@ -370,7 +370,7 @@ class WikiControllerTest < ActionController::TestCase assert_not_nil pages assert_equal Project.find(1).wiki.pages.size, pages.size assert_equal pages.first.content.updated_on, pages.first.updated_on - + assert_tag :ul, :attributes => { :class => 'pages-hierarchy' }, :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/CookBook_documentation' }, :content => 'CookBook documentation' }, @@ -381,7 +381,7 @@ class WikiControllerTest < ActionController::TestCase :child => { :tag => 'li', :child => { :tag => 'a', :attributes => { :href => '/projects/ecookbook/wiki/Another_page' }, :content => 'Another page' } } end - + def test_index_should_include_atom_link get :index, :project_id => 'ecookbook' assert_tag 'a', :attributes => { :href => '/projects/ecookbook/activity.atom?show_wiki_edits=1'} @@ -393,7 +393,7 @@ class WikiControllerTest < ActionController::TestCase @request.session[:user_id] = 2 get :export, :project_id => 'ecookbook' end - + should_respond_with :success should_assign_to :pages should_respond_with_content_type "text/html" @@ -402,7 +402,7 @@ class WikiControllerTest < ActionController::TestCase assert_select "a[name=?]", "Another_page" assert_select "a[name=?]", "Page_with_an_inline_image" end - + end context "with an unauthorized user" do @@ -424,17 +424,17 @@ class WikiControllerTest < ActionController::TestCase should_assign_to :pages should_assign_to :pages_by_date should_render_template 'wiki/date_index' - + should "include atom link" do assert_tag 'a', :attributes => { :href => '/projects/ecookbook/activity.atom?show_wiki_edits=1'} end end - + def test_not_found get :show, :project_id => 999 assert_response 404 end - + def test_protect_page page = WikiPage.find_by_wiki_id_and_title(1, 'Another_page') assert !page.protected? @@ -443,7 +443,7 @@ class WikiControllerTest < ActionController::TestCase assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'Another_page' assert page.reload.protected? end - + def test_unprotect_page page = WikiPage.find_by_wiki_id_and_title(1, 'CookBook_documentation') assert page.protected? @@ -452,7 +452,7 @@ class WikiControllerTest < ActionController::TestCase assert_redirected_to :action => 'show', :project_id => 'ecookbook', :id => 'CookBook_documentation' assert !page.reload.protected? end - + def test_show_page_with_edit_link @request.session[:user_id] = 2 get :show, :project_id => 1 @@ -460,15 +460,15 @@ class WikiControllerTest < ActionController::TestCase assert_template 'show' assert_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' } end - + def test_show_page_without_edit_link @request.session[:user_id] = 4 get :show, :project_id => 1 assert_response :success assert_template 'show' assert_no_tag :tag => 'a', :attributes => { :href => '/projects/1/wiki/CookBook_documentation/edit' } - end - + end + def test_edit_unprotected_page # Non members can edit unprotected wiki pages @request.session[:user_id] = 4 @@ -476,21 +476,21 @@ class WikiControllerTest < ActionController::TestCase assert_response :success assert_template 'edit' end - + def test_edit_protected_page_by_nonmember # Non members can't edit protected wiki pages @request.session[:user_id] = 4 get :edit, :project_id => 1, :id => 'CookBook_documentation' assert_response 403 end - + def test_edit_protected_page_by_member @request.session[:user_id] = 2 get :edit, :project_id => 1, :id => 'CookBook_documentation' assert_response :success - assert_template 'edit' + assert_template 'edit' end - + def test_history_of_non_existing_page_should_return_404 get :history, :project_id => 1, :id => 'Unknown_page' assert_response 404 diff --git a/test/functional/wikis_controller_test.rb b/test/functional/wikis_controller_test.rb index 06198b3e..55767e7b 100644 --- a/test/functional/wikis_controller_test.rb +++ b/test/functional/wikis_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,14 +18,14 @@ class WikisController; def rescue_action(e) raise e end; end class WikisControllerTest < ActionController::TestCase fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :wikis - + def setup @controller = WikisController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new User.current = nil end - + def test_create @request.session[:user_id] = 1 assert_nil Project.find(3).wiki @@ -35,17 +35,17 @@ class WikisControllerTest < ActionController::TestCase assert_not_nil wiki assert_equal 'Start page', wiki.start_page end - + def test_destroy @request.session[:user_id] = 1 post :destroy, :id => 1, :confirm => 1 assert_redirected_to :controller => 'projects', :action => 'settings', :id => 'ecookbook', :tab => 'wiki' assert_nil Project.find(1).wiki end - + def test_not_found @request.session[:user_id] = 1 post :destroy, :id => 999, :confirm => 1 assert_response 404 end -end +end diff --git a/test/functional/workflows_controller_test.rb b/test/functional/workflows_controller_test.rb index e7213c7b..6e1cc38b 100644 --- a/test/functional/workflows_controller_test.rb +++ b/test/functional/workflows_controller_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,7 +18,7 @@ class WorkflowsController; def rescue_action(e) raise e end; end class WorkflowsControllerTest < ActionController::TestCase fixtures :roles, :trackers, :workflows, :users, :issue_statuses - + def setup @controller = WorkflowsController.new @request = ActionController::TestRequest.new @@ -26,17 +26,17 @@ class WorkflowsControllerTest < ActionController::TestCase User.current = nil @request.session[:user_id] = 1 # admin end - + def test_index get :index assert_response :success assert_template 'index' - + count = Workflow.count(:all, :conditions => 'role_id = 1 AND tracker_id = 2') assert_tag :tag => 'a', :content => count.to_s, :attributes => { :href => '/workflows/edit?role_id=1&tracker_id=2' } end - + def test_get_edit get :edit assert_response :success @@ -44,20 +44,20 @@ class WorkflowsControllerTest < ActionController::TestCase assert_not_nil assigns(:roles) assert_not_nil assigns(:trackers) end - + def test_get_edit_with_role_and_tracker Workflow.delete_all Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 2, :new_status_id => 3) Workflow.create!(:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 5) - + get :edit, :role_id => 2, :tracker_id => 1 assert_response :success assert_template 'edit' - + # used status only assert_not_nil assigns(:statuses) assert_equal [2, 3, 5], assigns(:statuses).collect(&:id) - + # allowed transitions assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'issue_status[3][5][]', @@ -72,23 +72,23 @@ class WorkflowsControllerTest < ActionController::TestCase assert_no_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'issue_status[1][1][]' } end - + def test_get_edit_with_role_and_tracker_and_all_statuses Workflow.delete_all - + get :edit, :role_id => 2, :tracker_id => 1, :used_statuses_only => '0' assert_response :success assert_template 'edit' - + assert_not_nil assigns(:statuses) assert_equal IssueStatus.count, assigns(:statuses).size - + assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'issue_status[1][1][]', :value => 'always', :checked => nil } end - + def test_post_edit post :edit, :role_id => 2, :tracker_id => 1, :issue_status => { @@ -96,12 +96,12 @@ class WorkflowsControllerTest < ActionController::TestCase '3' => {'1' => ['always'], '2' => ['always']} } assert_redirected_to '/workflows/edit?role_id=2&tracker_id=1' - + assert_equal 3, Workflow.count(:conditions => {:tracker_id => 1, :role_id => 2}) assert_not_nil Workflow.find(:first, :conditions => {:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 2}) assert_nil Workflow.find(:first, :conditions => {:role_id => 2, :tracker_id => 1, :old_status_id => 5, :new_status_id => 4}) end - + def test_post_edit_with_additional_transitions post :edit, :role_id => 2, :tracker_id => 1, :issue_status => { @@ -109,9 +109,9 @@ class WorkflowsControllerTest < ActionController::TestCase '3' => {'1' => ['author'], '2' => ['assignee'], '4' => ['author', 'assignee']} } assert_redirected_to '/workflows/edit?role_id=2&tracker_id=1' - + assert_equal 4, Workflow.count(:conditions => {:tracker_id => 1, :role_id => 2}) - + w = Workflow.find(:first, :conditions => {:role_id => 2, :tracker_id => 1, :old_status_id => 4, :new_status_id => 5}) assert ! w.author assert ! w.assignee @@ -125,32 +125,32 @@ class WorkflowsControllerTest < ActionController::TestCase assert w.author assert w.assignee end - + def test_clear_workflow assert Workflow.count(:conditions => {:tracker_id => 1, :role_id => 2}) > 0 post :edit, :role_id => 2, :tracker_id => 1 assert_equal 0, Workflow.count(:conditions => {:tracker_id => 1, :role_id => 2}) end - + def test_get_copy get :copy assert_response :success assert_template 'copy' end - + def test_post_copy_one_to_one source_transitions = status_transitions(:tracker_id => 1, :role_id => 2) - + post :copy, :source_tracker_id => '1', :source_role_id => '2', :target_tracker_ids => ['3'], :target_role_ids => ['1'] assert_response 302 assert_equal source_transitions, status_transitions(:tracker_id => 3, :role_id => 1) end - + def test_post_copy_one_to_many source_transitions = status_transitions(:tracker_id => 1, :role_id => 2) - + post :copy, :source_tracker_id => '1', :source_role_id => '2', :target_tracker_ids => ['2', '3'], :target_role_ids => ['1', '3'] assert_response 302 @@ -159,11 +159,11 @@ class WorkflowsControllerTest < ActionController::TestCase assert_equal source_transitions, status_transitions(:tracker_id => 2, :role_id => 3) assert_equal source_transitions, status_transitions(:tracker_id => 3, :role_id => 3) end - + def test_post_copy_many_to_many source_t2 = status_transitions(:tracker_id => 2, :role_id => 2) source_t3 = status_transitions(:tracker_id => 3, :role_id => 2) - + post :copy, :source_tracker_id => 'any', :source_role_id => '2', :target_tracker_ids => ['2', '3'], :target_role_ids => ['1', '3'] assert_response 302 @@ -172,7 +172,7 @@ class WorkflowsControllerTest < ActionController::TestCase assert_equal source_t2, status_transitions(:tracker_id => 2, :role_id => 3) assert_equal source_t3, status_transitions(:tracker_id => 3, :role_id => 3) end - + # Returns an array of status transitions that can be compared def status_transitions(conditions) Workflow.find(:all, :conditions => conditions, diff --git a/test/helper_testcase.rb b/test/helper_testcase.rb index cba49b51..1572f2ef 100644 --- a/test/helper_testcase.rb +++ b/test/helper_testcase.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. #++ @@ -38,7 +38,7 @@ class HelperTestCase < ActiveSupport::TestCase # Fake url rewriter so we can test url_for @controller.url = ActionController::UrlRewriter.new @request, {} - + ActionView::Helpers::AssetTagHelper::reset_javascript_include_default end diff --git a/test/integration/account_test.rb b/test/integration/account_test.rb index 11b5bb3c..cc7565f0 100644 --- a/test/integration/account_test.rb +++ b/test/integration/account_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -26,17 +26,17 @@ class AccountTest < ActionController::IntegrationTest get "my/page" assert_redirected_to "/login?back_url=http%3A%2F%2Fwww.example.com%2Fmy%2Fpage" log_user('jsmith', 'jsmith') - + get "my/account" assert_response :success - assert_template "my/account" + assert_template "my/account" end - + def test_autologin user = User.find(1) Setting.autologin = "7" Token.delete_all - + # User logs in with 'autologin' checked post '/login', :username => user.login, :password => 'admin', :autologin => 1 assert_redirected_to '/my/page' @@ -46,14 +46,14 @@ class AccountTest < ActionController::IntegrationTest assert_equal 'autologin', token.action assert_equal user.id, session[:user_id] assert_equal token.value, cookies[Redmine::Configuration['autologin_cookie_name']] - + # Session is cleared reset! User.current = nil # Clears user's last login timestamp user.update_attribute :last_login_on, nil assert_nil user.reload.last_login_on - + # User comes back with his autologin cookie cookies[Redmine::Configuration['autologin_cookie_name']] = token.value get '/my/page' @@ -63,77 +63,77 @@ class AccountTest < ActionController::IntegrationTest assert_not_nil user.reload.last_login_on assert user.last_login_on.utc > 10.second.ago.utc end - + def test_lost_password Token.delete_all - + get "account/lost_password" assert_response :success assert_template "account/lost_password" - + post "account/lost_password", :mail => 'jSmith@somenet.foo' assert_redirected_to "/login?back_url=http%3A%2F%2Fwww.example.com%2F" - + token = Token.find(:first) assert_equal 'recovery', token.action assert_equal 'jsmith@somenet.foo', token.user.mail assert !token.expired? - + get "account/lost_password", :token => token.value assert_response :success assert_template "account/password_recovery" - + post "account/lost_password", :token => token.value, :new_password => 'newpass', :new_password_confirmation => 'newpass' assert_redirected_to "/login" assert_equal 'Password was successfully updated.', flash[:notice] - + log_user('jsmith', 'newpass') - assert_equal 0, Token.count + assert_equal 0, Token.count end - + def test_register_with_automatic_activation Setting.self_registration = '3' - + get 'account/register' assert_response :success assert_template 'account/register' - - post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"}, + + post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"}, :password => "newpass", :password_confirmation => "newpass" assert_redirected_to '/my/account' follow_redirect! assert_response :success assert_template 'my/account' - + user = User.find_by_login('newuser') assert_not_nil user assert user.active? assert_not_nil user.last_login_on end - + def test_register_with_manual_activation Setting.self_registration = '2' - - post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"}, + + post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"}, :password => "newpass", :password_confirmation => "newpass" assert_redirected_to '/login' assert !User.find_by_login('newuser').active? end - + def test_register_with_email_activation Setting.self_registration = '1' Token.delete_all - - post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"}, + + post 'account/register', :user => {:login => "newuser", :language => "en", :firstname => "New", :lastname => "User", :mail => "newuser@foo.bar"}, :password => "newpass", :password_confirmation => "newpass" assert_redirected_to '/login' assert !User.find_by_login('newuser').active? - + token = Token.find(:first) assert_equal 'register', token.action assert_equal 'newuser@foo.bar', token.user.mail assert !token.expired? - + get 'account/activate', :token => token.value assert_redirected_to '/login' log_user('newuser', 'newpass') @@ -149,7 +149,7 @@ class AccountTest < ActionController::IntegrationTest # Lost password form fill_in "mail", :with => "admin@somenet.foo" click_button "Submit" - + assert_response :success # back to login page assert_equal "/login", current_path @@ -159,31 +159,31 @@ class AccountTest < ActionController::IntegrationTest assert_response :success assert_equal "/", current_path - + end - - + + if Object.const_defined?(:Mocha) - + def test_onthefly_registration # disable registration Setting.self_registration = '0' AuthSource.expects(:authenticate).returns({:login => 'foo', :firstname => 'Foo', :lastname => 'Smith', :mail => 'foo@bar.com', :auth_source_id => 66}) - + post 'account/login', :username => 'foo', :password => 'bar' assert_redirected_to '/my/page' - + user = User.find_by_login('foo') assert user.is_a?(User) assert_equal 66, user.auth_source_id assert user.hashed_password.blank? end - + def test_onthefly_registration_with_invalid_attributes # disable registration Setting.self_registration = '0' AuthSource.expects(:authenticate).returns({:login => 'foo', :lastname => 'Smith', :auth_source_id => 66}) - + post 'account/login', :username => 'foo', :password => 'bar' assert_response :success assert_template 'account/register' @@ -191,34 +191,34 @@ class AccountTest < ActionController::IntegrationTest assert_tag :input, :attributes => { :name => 'user[lastname]', :value => 'Smith' } assert_no_tag :input, :attributes => { :name => 'user[login]' } assert_no_tag :input, :attributes => { :name => 'user[password]' } - + post 'account/register', :user => {:firstname => 'Foo', :lastname => 'Smith', :mail => 'foo@bar.com'} assert_redirected_to '/my/account' - + user = User.find_by_login('foo') assert user.is_a?(User) assert_equal 66, user.auth_source_id assert user.hashed_password.blank? end - + def test_login_and_logout_should_clear_session get '/login' sid = session[:session_id] - + post '/login', :username => 'admin', :password => 'admin' assert_redirected_to '/my/page' assert_not_equal sid, session[:session_id], "login should reset session" assert_equal 1, session[:user_id] sid = session[:session_id] - + get '/' assert_equal sid, session[:session_id] - + get '/logout' assert_not_equal sid, session[:session_id], "logout should reset session" assert_nil session[:user_id] end - + else puts 'Mocha is missing. Skipping tests.' end diff --git a/test/integration/admin_test.rb b/test/integration/admin_test.rb index eb89536e..7d24d161 100644 --- a/test/integration/admin_test.rb +++ b/test/integration/admin_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -21,15 +21,15 @@ class AdminTest < ActionController::IntegrationTest assert_response :success assert_template "users/new" post "/users/create", :user => { :login => "psmith", :firstname => "Paul", :lastname => "Smith", :mail => "psmith@somenet.foo", :language => "en", :password => "psmith09", :password_confirmation => "psmith09" } - + user = User.find_by_login("psmith") assert_kind_of User, user assert_redirected_to "/users/#{ user.id }/edit" - + logged_user = User.try_to_login("psmith", "psmith09") assert_kind_of User, logged_user assert_equal "Paul", logged_user.firstname - + put "users/#{user.id}", :id => user.id, :user => { :status => User::STATUS_LOCKED } assert_redirected_to "/users/#{ user.id }/edit" locked_user = User.try_to_login("psmith", "psmith09") diff --git a/test/integration/api_test/disabled_rest_api_test.rb b/test/integration/api_test/disabled_rest_api_test.rb index a75d5f4a..38b13543 100644 --- a/test/integration/api_test/disabled_rest_api_test.rb +++ b/test/integration/api_test/disabled_rest_api_test.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 ApiTest::DisabledRestApiTest < ActionController::IntegrationTest Setting.rest_api_enabled = '1' Setting.login_required = '0' end - + # Using the NewsController because it's a simple API. context "get /news with the API disabled" do @@ -36,7 +36,7 @@ class ApiTest::DisabledRestApiTest < ActionController::IntegrationTest @token = Token.generate!(:user => @user, :action => 'api') get "/news.xml?key=#{@token.value}" end - + should_respond_with :unauthorized should_respond_with_content_type :xml should "not login as the user" do @@ -50,7 +50,7 @@ class ApiTest::DisabledRestApiTest < ActionController::IntegrationTest @authorization = ActionController::HttpAuthentication::Basic.encode_credentials(@user.login, 'my_password') get "/news.xml", nil, :authorization => @authorization end - + should_respond_with :unauthorized should_respond_with_content_type :xml should "not login as the user" do @@ -65,7 +65,7 @@ class ApiTest::DisabledRestApiTest < ActionController::IntegrationTest @authorization = ActionController::HttpAuthentication::Basic.encode_credentials(@token.value, 'X') get "/news.xml", nil, :authorization => @authorization end - + should_respond_with :unauthorized should_respond_with_content_type :xml should "not login as the user" do @@ -81,7 +81,7 @@ class ApiTest::DisabledRestApiTest < ActionController::IntegrationTest @token = Token.generate!(:user => @user, :action => 'api') get "/news.json?key=#{@token.value}" end - + should_respond_with :unauthorized should_respond_with_content_type :json should "not login as the user" do @@ -95,7 +95,7 @@ class ApiTest::DisabledRestApiTest < ActionController::IntegrationTest @authorization = ActionController::HttpAuthentication::Basic.encode_credentials(@user.login, 'my_password') get "/news.json", nil, :authorization => @authorization end - + should_respond_with :unauthorized should_respond_with_content_type :json should "not login as the user" do @@ -117,7 +117,7 @@ class ApiTest::DisabledRestApiTest < ActionController::IntegrationTest assert_equal User.anonymous, User.current end end - - end + + end end end diff --git a/test/integration/api_test/http_basic_login_test.rb b/test/integration/api_test/http_basic_login_test.rb index 4f591d7a..a4088867 100644 --- a/test/integration/api_test/http_basic_login_test.rb +++ b/test/integration/api_test/http_basic_login_test.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 ApiTest::HttpBasicLoginTest < ActionController::IntegrationTest Setting.rest_api_enabled = '0' Setting.login_required = '0' end - + # Using the NewsController because it's a simple API. context "get /news" do setup do diff --git a/test/integration/api_test/http_basic_login_with_api_token_test.rb b/test/integration/api_test/http_basic_login_with_api_token_test.rb index f78ff859..27ef6865 100644 --- a/test/integration/api_test/http_basic_login_with_api_token_test.rb +++ b/test/integration/api_test/http_basic_login_with_api_token_test.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 ApiTest::HttpBasicLoginWithApiTokenTest < ActionController::IntegrationTes Setting.rest_api_enabled = '0' Setting.login_required = '0' end - + # Using the NewsController because it's a simple API. context "get /news" do diff --git a/test/integration/api_test/issues_test.rb b/test/integration/api_test/issues_test.rb index 393d63a0..099e2bf2 100644 --- a/test/integration/api_test/issues_test.rb +++ b/test/integration/api_test/issues_test.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. #++ require File.expand_path('../../../test_helper', __FILE__) @@ -44,10 +44,10 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest # Use a private project to make sure auth is really working and not just # only showing public issues. should_allow_api_authentication(:get, "/projects/private-child/issues.xml") - + should "contain metadata" do get '/issues.xml' - + assert_tag :tag => 'issues', :attributes => { :type => 'array', @@ -56,11 +56,11 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest :offset => 0 } end - + context "with offset and limit" do should "use the params" do get '/issues.xml?offset=2&limit=3' - + assert_equal 3, assigns(:limit) assert_equal 2, assigns(:offset) assert_tag :tag => 'issues', :children => {:count => 3, :only => {:tag => 'issue'}} @@ -70,7 +70,7 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest context "with nometa param" do should "not contain metadata" do get '/issues.xml?nometa=1' - + assert_tag :tag => 'issues', :attributes => { :type => 'array', @@ -84,7 +84,7 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest context "with nometa header" do should "not contain metadata" do get '/issues.xml', {}, {'X-ChiliProject-Nometa' => '1'} - + assert_tag :tag => 'issues', :attributes => { :type => 'array', @@ -106,7 +106,7 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest should "show only issues with the status_id" do get '/issues.xml?status_id=5' assert_tag :tag => 'issues', - :children => { :count => Issue.visible.count(:conditions => {:status_id => 5}), + :children => { :count => Issue.visible.count(:conditions => {:status_id => 5}), :only => { :tag => 'issue' } } end end @@ -133,13 +133,13 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest context "/issues/6.json" do should_allow_api_authentication(:get, "/issues/6.json") end - + context "GET /issues/:id" do context "with journals" do context ".xml" do should "display journals" do get '/issues/1.xml?include=journals' - + assert_tag :tag => 'issue', :child => { :tag => 'journals', @@ -168,13 +168,13 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest end end end - + context "with custom fields" do context ".xml" do should "display custom fields" do get '/issues/3.xml' - - assert_tag :tag => 'issue', + + assert_tag :tag => 'issue', :child => { :tag => 'custom_fields', :attributes => { :type => 'array' }, @@ -187,26 +187,26 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest } } } - + assert_nothing_raised do Hash.from_xml(response.body).to_xml end end end end - + context "with subtasks" do setup do @c1 = Issue.generate!(:status_id => 1, :subject => "child c1", :tracker_id => 1, :project_id => 1, :parent_issue_id => 1) @c2 = Issue.generate!(:status_id => 1, :subject => "child c2", :tracker_id => 1, :project_id => 1, :parent_issue_id => 1) @c3 = Issue.generate!(:status_id => 1, :subject => "child c3", :tracker_id => 1, :project_id => 1, :parent_issue_id => @c1.id) end - + context ".xml" do should "display children" do get '/issues/1.xml?include=children' - - assert_tag :tag => 'issue', + + assert_tag :tag => 'issue', :child => { :tag => 'children', :children => {:count => 2}, @@ -228,11 +228,11 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest } } end - + context ".json" do should "display children" do get '/issues/1.json?include=children' - + json = ActiveSupport::JSON.decode(response.body) assert_equal([ { @@ -258,19 +258,19 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest assert_difference('Issue.count') do post '/issues.xml', {:issue => {:project_id => 1, :subject => 'API test', :tracker_id => 2, :status_id => 3}}, :authorization => credentials('jsmith') end - + issue = Issue.first(:order => 'id DESC') assert_equal 1, issue.project_id assert_equal 2, issue.tracker_id assert_equal 3, issue.status_id assert_equal 'API test', issue.subject - + assert_response :created assert_equal 'application/xml', @response.content_type assert_tag 'issue', :child => {:tag => 'id', :content => issue.id.to_s} end end - + context "POST /issues.xml with failure" do should_allow_api_authentication(:post, '/issues.xml', @@ -296,16 +296,16 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest assert_difference('Issue.count') do post '/issues.json', {:issue => {:project_id => 1, :subject => 'API test', :tracker_id => 2, :status_id => 3}}, :authorization => credentials('jsmith') end - + issue = Issue.first(:order => 'id DESC') assert_equal 1, issue.project_id assert_equal 2, issue.tracker_id assert_equal 3, issue.status_id assert_equal 'API test', issue.subject end - + end - + context "POST /issues.json with failure" do should_allow_api_authentication(:post, '/issues.json', @@ -328,7 +328,7 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest @parameters = {:issue => {:subject => 'API update', :notes => 'A new note'}} @headers = { :authorization => credentials('jsmith') } end - + should_allow_api_authentication(:put, '/issues/6.xml', {:issue => {:subject => 'API update', :notes => 'A new note'}}, @@ -348,37 +348,37 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest should "add the note to the journal" do put '/issues/6.xml', @parameters, @headers - + journal = Journal.last assert_equal "A new note", journal.notes end should "update the issue" do put '/issues/6.xml', @parameters, @headers - + issue = Issue.find(6) assert_equal "API update", issue.subject end - + end - + context "PUT /issues/3.xml with custom fields" do setup do @parameters = {:issue => {:custom_fields => [{'id' => '1', 'value' => 'PostgreSQL' }, {'id' => '2', 'value' => '150'}]}} @headers = { :authorization => credentials('jsmith') } end - + should "update custom fields" do assert_no_difference('Issue.count') do put '/issues/3.xml', @parameters, @headers end - + issue = Issue.find(3) assert_equal '150', issue.custom_value_for(2).value assert_equal 'PostgreSQL', issue.custom_value_for(1).value end end - + context "PUT /issues/6.xml with failed update" do setup do @parameters = {:issue => {:subject => ''}} @@ -414,7 +414,7 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest @parameters = {:issue => {:subject => 'API update', :notes => 'A new note'}} @headers = { :authorization => credentials('jsmith') } end - + should_allow_api_authentication(:put, '/issues/6.json', {:issue => {:subject => 'API update', :notes => 'A new note'}}, @@ -434,20 +434,20 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest should "add the note to the journal" do put '/issues/6.json', @parameters, @headers - + journal = Journal.last assert_equal "A new note", journal.notes end should "update the issue" do put '/issues/6.json', @parameters, @headers - + issue = Issue.find(6) assert_equal "API update", issue.subject end - + end - + context "PUT /issues/6.json with failed update" do setup do @parameters = {:issue => {:subject => ''}} @@ -489,7 +489,7 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest assert_difference('Issue.count',-1) do delete '/issues/6.xml', {}, :authorization => credentials('jsmith') end - + assert_nil Issue.find_by_id(6) end end @@ -504,7 +504,7 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest assert_difference('Issue.count',-1) do delete '/issues/6.json', {}, :authorization => credentials('jsmith') end - + assert_nil Issue.find_by_id(6) end end diff --git a/test/integration/api_test/news_test.rb b/test/integration/api_test/news_test.rb index 29eae33b..747bab46 100644 --- a/test/integration/api_test/news_test.rb +++ b/test/integration/api_test/news_test.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. #++ require File.expand_path('../../../test_helper', __FILE__) @@ -23,7 +23,7 @@ class ApiTest::NewsTest < ActionController::IntegrationTest context ".xml" do should "return news" do get '/news.xml' - + assert_tag :tag => 'news', :attributes => {:type => 'array'}, :child => { @@ -35,11 +35,11 @@ class ApiTest::NewsTest < ActionController::IntegrationTest } end end - + context ".json" do should "return news" do get '/news.json' - + json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json assert_kind_of Array, json['news'] @@ -52,10 +52,10 @@ class ApiTest::NewsTest < ActionController::IntegrationTest context "GET /projects/:project_id/news" do context ".xml" do should_allow_api_authentication(:get, "/projects/onlinestore/news.xml") - + should "return news" do get '/projects/ecookbook/news.xml' - + assert_tag :tag => 'news', :attributes => {:type => 'array'}, :child => { @@ -67,13 +67,13 @@ class ApiTest::NewsTest < ActionController::IntegrationTest } end end - + context ".json" do should_allow_api_authentication(:get, "/projects/onlinestore/news.json") - + should "return news" do get '/projects/ecookbook/news.json' - + json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json assert_kind_of Array, json['news'] @@ -82,7 +82,7 @@ class ApiTest::NewsTest < ActionController::IntegrationTest end end end - + def credentials(user, password=nil) ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user) end diff --git a/test/integration/api_test/projects_test.rb b/test/integration/api_test/projects_test.rb index 1afd410c..aebcb40c 100644 --- a/test/integration/api_test/projects_test.rb +++ b/test/integration/api_test/projects_test.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. #++ require File.expand_path('../../../test_helper', __FILE__) @@ -20,14 +20,14 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest def setup Setting.rest_api_enabled = '1' end - + context "GET /projects" do context ".xml" do should "return projects" do get '/projects.xml' assert_response :success assert_equal 'application/xml', @response.content_type - + assert_tag :tag => 'projects', :child => {:tag => 'project', :child => {:tag => 'id', :content => '1'}} end @@ -38,7 +38,7 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest get '/projects.json' assert_response :success assert_equal 'application/json', @response.content_type - + json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json assert_kind_of Array, json['projects'] @@ -47,34 +47,34 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest end end end - + context "GET /projects/:id" do context ".xml" do # TODO: A private project is needed because should_allow_api_authentication # actually tests that authentication is *required*, not just allowed should_allow_api_authentication(:get, "/projects/2.xml") - + should "return requested project" do get '/projects/1.xml' assert_response :success assert_equal 'application/xml', @response.content_type - + assert_tag :tag => 'project', :child => {:tag => 'id', :content => '1'} assert_tag :tag => 'custom_field', :attributes => {:name => 'Development status'}, :content => 'Stable' end - + context "with hidden custom fields" do setup do ProjectCustomField.find_by_name('Development status').update_attribute :visible, false end - + should "not display hidden custom fields" do get '/projects/1.xml' assert_response :success assert_equal 'application/xml', @response.content_type - + assert_no_tag 'custom_field', :attributes => {:name => 'Development status'} end @@ -83,10 +83,10 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest context ".json" do should_allow_api_authentication(:get, "/projects/2.json") - + should "return requested project" do get '/projects/1.json' - + json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json assert_kind_of Hash, json['project'] @@ -94,61 +94,61 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest end end end - + context "POST /projects" do context "with valid parameters" do setup do Setting.default_projects_modules = ['issue_tracking', 'repository'] @parameters = {:project => {:name => 'API test', :identifier => 'api-test'}} end - + context ".xml" do should_allow_api_authentication(:post, '/projects.xml', {:project => {:name => 'API test', :identifier => 'api-test'}}, {:success_code => :created}) - - + + should "create a project with the attributes" do assert_difference('Project.count') do post '/projects.xml', @parameters, :authorization => credentials('admin') end - + project = Project.first(:order => 'id DESC') assert_equal 'API test', project.name assert_equal 'api-test', project.identifier assert_equal ['issue_tracking', 'repository'], project.enabled_module_names.sort assert_equal Tracker.all.size, project.trackers.size - + assert_response :created assert_equal 'application/xml', @response.content_type assert_tag 'project', :child => {:tag => 'id', :content => project.id.to_s} end - + should "accept enabled_module_names attribute" do @parameters[:project].merge!({:enabled_module_names => ['issue_tracking', 'news', 'time_tracking']}) - + assert_difference('Project.count') do post '/projects.xml', @parameters, :authorization => credentials('admin') end - + project = Project.first(:order => 'id DESC') assert_equal ['issue_tracking', 'news', 'time_tracking'], project.enabled_module_names.sort end - + should "accept tracker_ids attribute" do @parameters[:project].merge!({:tracker_ids => [1, 3]}) - + assert_difference('Project.count') do post '/projects.xml', @parameters, :authorization => credentials('admin') end - + project = Project.first(:order => 'id DESC') assert_equal [1, 3], project.trackers.map(&:id).sort end end end - + context "with invalid parameters" do setup do @parameters = {:project => {:name => 'API test'}} @@ -159,7 +159,7 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest assert_no_difference('Project.count') do post '/projects.xml', @parameters, :authorization => credentials('admin') end - + assert_response :unprocessable_entity assert_equal 'application/xml', @response.content_type assert_tag 'errors', :child => {:tag => 'error', :content => "Identifier can't be blank"} @@ -167,19 +167,19 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest end end end - + context "PUT /projects/:id" do context "with valid parameters" do setup do @parameters = {:project => {:name => 'API update'}} end - + context ".xml" do should_allow_api_authentication(:put, '/projects/2.xml', {:project => {:name => 'API update'}}, {:success_code => :ok}) - + should "update the project" do assert_no_difference 'Project.count' do put '/projects/2.xml', @parameters, :authorization => credentials('jsmith') @@ -189,10 +189,10 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest project = Project.find(2) assert_equal 'API update', project.name end - + should "accept enabled_module_names attribute" do @parameters[:project].merge!({:enabled_module_names => ['issue_tracking', 'news', 'time_tracking']}) - + assert_no_difference 'Project.count' do put '/projects/2.xml', @parameters, :authorization => credentials('admin') end @@ -200,10 +200,10 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest project = Project.find(2) assert_equal ['issue_tracking', 'news', 'time_tracking'], project.enabled_module_names.sort end - + should "accept tracker_ids attribute" do @parameters[:project].merge!({:tracker_ids => [1, 3]}) - + assert_no_difference 'Project.count' do put '/projects/2.xml', @parameters, :authorization => credentials('admin') end @@ -213,18 +213,18 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest end end end - + context "with invalid parameters" do setup do @parameters = {:project => {:name => ''}} end - + context ".xml" do should "return errors" do assert_no_difference('Project.count') do put '/projects/2.xml', @parameters, :authorization => credentials('admin') end - + assert_response :unprocessable_entity assert_equal 'application/xml', @response.content_type assert_tag 'errors', :child => {:tag => 'error', :content => "Name can't be blank"} @@ -232,14 +232,14 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest end end end - + context "DELETE /projects/:id" do context ".xml" do should_allow_api_authentication(:delete, '/projects/2.xml', {}, {:success_code => :ok}) - + should "delete the project" do assert_difference('Project.count',-1) do delete '/projects/2.xml', {}, :authorization => credentials('admin') @@ -249,7 +249,7 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest end end end - + def credentials(user, password=nil) ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user) end diff --git a/test/integration/api_test/time_entries_test.rb b/test/integration/api_test/time_entries_test.rb index 516b8dd3..762c7644 100644 --- a/test/integration/api_test/time_entries_test.rb +++ b/test/integration/api_test/time_entries_test.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. #++ require File.expand_path('../../../test_helper', __FILE__) class ApiTest::TimeEntriesTest < ActionController::IntegrationTest fixtures :all - + def setup Setting.rest_api_enabled = '1' end - + context "GET /time_entries.xml" do should "return time entries" do get '/time_entries.xml', {}, :authorization => credentials('jsmith') @@ -28,7 +28,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest :child => {:tag => 'time_entry', :child => {:tag => 'id', :content => '2'}} end end - + context "GET /time_entries/2.xml" do should "return requested time entry" do get '/time_entries/2.xml', {}, :authorization => credentials('jsmith') @@ -38,7 +38,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest :child => {:tag => 'id', :content => '2'} end end - + context "POST /time_entries.xml" do context "with issue_id" do should "return create time entry" do @@ -47,7 +47,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest end assert_response :created assert_equal 'application/xml', @response.content_type - + entry = TimeEntry.first(:order => 'id DESC') assert_equal 'jsmith', entry.user.login assert_equal Issue.find(1), entry.issue @@ -57,7 +57,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest assert_equal TimeEntryActivity.find(11), entry.activity end end - + context "with project_id" do should "return create time entry" do assert_difference 'TimeEntry.count' do @@ -65,7 +65,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest end assert_response :created assert_equal 'application/xml', @response.content_type - + entry = TimeEntry.first(:order => 'id DESC') assert_equal 'jsmith', entry.user.login assert_nil entry.issue @@ -75,7 +75,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest assert_equal TimeEntryActivity.find(11), entry.activity end end - + context "with invalid parameters" do should "return errors" do assert_no_difference 'TimeEntry.count' do @@ -88,7 +88,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest end end end - + context "PUT /time_entries/2.xml" do context "with valid parameters" do should "update time entry" do @@ -112,7 +112,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest end end end - + context "DELETE /time_entries/2.xml" do should "destroy time entry" do assert_difference 'TimeEntry.count', -1 do @@ -122,7 +122,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest assert_nil TimeEntry.find_by_id(2) end end - + def credentials(user, password=nil) ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user) end diff --git a/test/integration/api_test/token_authentication_test.rb b/test/integration/api_test/token_authentication_test.rb index 22f15fb1..4effc72c 100644 --- a/test/integration/api_test/token_authentication_test.rb +++ b/test/integration/api_test/token_authentication_test.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 ApiTest::TokenAuthenticationTest < ActionController::IntegrationTest Setting.rest_api_enabled = '0' Setting.login_required = '0' end - + # Using the NewsController because it's a simple API. context "get /news" do context "in :xml format" do diff --git a/test/integration/api_test/users_test.rb b/test/integration/api_test/users_test.rb index 003977e8..6196d2ce 100644 --- a/test/integration/api_test/users_test.rb +++ b/test/integration/api_test/users_test.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. #++ require File.expand_path('../../../test_helper', __FILE__) @@ -28,7 +28,7 @@ class ApiTest::UsersTest < ActionController::IntegrationTest context ".xml" do should "return requested user" do get '/users/2.xml' - + assert_tag :tag => 'user', :child => {:tag => 'id', :content => '2'} end @@ -37,7 +37,7 @@ class ApiTest::UsersTest < ActionController::IntegrationTest context ".json" do should "return requested user" do get '/users/2.json' - + json = ActiveSupport::JSON.decode(response.body) assert_kind_of Hash, json assert_kind_of Hash, json['user'] @@ -45,18 +45,18 @@ class ApiTest::UsersTest < ActionController::IntegrationTest end end end - + context "GET /users/current" do context ".xml" do should "require authentication" do get '/users/current.xml' - + assert_response 401 end - + should "return current user" do get '/users/current.xml', {}, :authorization => credentials('jsmith') - + assert_tag :tag => 'user', :child => {:tag => 'id', :content => '2'} end @@ -68,18 +68,18 @@ class ApiTest::UsersTest < ActionController::IntegrationTest setup do @parameters = {:user => {:login => 'foo', :firstname => 'Firstname', :lastname => 'Lastname', :mail => 'foo@example.net', :password => 'secret', :mail_notification => 'only_assigned'}} end - + context ".xml" do should_allow_api_authentication(:post, '/users.xml', {:user => {:login => 'foo', :firstname => 'Firstname', :lastname => 'Lastname', :mail => 'foo@example.net', :password => 'secret'}}, {:success_code => :created}) - + should "create a user with the attributes" do assert_difference('User.count') do post '/users.xml', @parameters, :authorization => credentials('admin') end - + user = User.first(:order => 'id DESC') assert_equal 'foo', user.login assert_equal 'Firstname', user.firstname @@ -88,31 +88,31 @@ class ApiTest::UsersTest < ActionController::IntegrationTest assert_equal 'only_assigned', user.mail_notification assert !user.admin? assert user.check_password?('secret') - + assert_response :created assert_equal 'application/xml', @response.content_type assert_tag 'user', :child => {:tag => 'id', :content => user.id.to_s} end end - + context ".json" do should_allow_api_authentication(:post, '/users.json', {:user => {:login => 'foo', :firstname => 'Firstname', :lastname => 'Lastname', :mail => 'foo@example.net'}}, {:success_code => :created}) - + should "create a user with the attributes" do assert_difference('User.count') do post '/users.json', @parameters, :authorization => credentials('admin') end - + user = User.first(:order => 'id DESC') assert_equal 'foo', user.login assert_equal 'Firstname', user.firstname assert_equal 'Lastname', user.lastname assert_equal 'foo@example.net', user.mail assert !user.admin? - + assert_response :created assert_equal 'application/json', @response.content_type json = ActiveSupport::JSON.decode(response.body) @@ -122,30 +122,30 @@ class ApiTest::UsersTest < ActionController::IntegrationTest end end end - + context "with invalid parameters" do setup do @parameters = {:user => {:login => 'foo', :lastname => 'Lastname', :mail => 'foo'}} end - + context ".xml" do should "return errors" do assert_no_difference('User.count') do post '/users.xml', @parameters, :authorization => credentials('admin') end - + assert_response :unprocessable_entity assert_equal 'application/xml', @response.content_type assert_tag 'errors', :child => {:tag => 'error', :content => "First name can't be blank"} end end - + context ".json" do should "return errors" do assert_no_difference('User.count') do post '/users.json', @parameters, :authorization => credentials('admin') end - + assert_response :unprocessable_entity assert_equal 'application/json', @response.content_type json = ActiveSupport::JSON.decode(response.body) @@ -162,75 +162,75 @@ class ApiTest::UsersTest < ActionController::IntegrationTest setup do @parameters = {:user => {:login => 'jsmith', :firstname => 'John', :lastname => 'Renamed', :mail => 'jsmith@somenet.foo'}} end - + context ".xml" do should_allow_api_authentication(:put, '/users/2.xml', {:user => {:login => 'jsmith', :firstname => 'John', :lastname => 'Renamed', :mail => 'jsmith@somenet.foo'}}, {:success_code => :ok}) - + should "update user with the attributes" do assert_no_difference('User.count') do put '/users/2.xml', @parameters, :authorization => credentials('admin') end - + user = User.find(2) assert_equal 'jsmith', user.login assert_equal 'John', user.firstname assert_equal 'Renamed', user.lastname assert_equal 'jsmith@somenet.foo', user.mail assert !user.admin? - + assert_response :ok end end - + context ".json" do should_allow_api_authentication(:put, '/users/2.json', {:user => {:login => 'jsmith', :firstname => 'John', :lastname => 'Renamed', :mail => 'jsmith@somenet.foo'}}, {:success_code => :ok}) - + should "update user with the attributes" do assert_no_difference('User.count') do put '/users/2.json', @parameters, :authorization => credentials('admin') end - + user = User.find(2) assert_equal 'jsmith', user.login assert_equal 'John', user.firstname assert_equal 'Renamed', user.lastname assert_equal 'jsmith@somenet.foo', user.mail assert !user.admin? - + assert_response :ok end end end - + context "with invalid parameters" do setup do @parameters = {:user => {:login => 'jsmith', :firstname => '', :lastname => 'Lastname', :mail => 'foo'}} end - + context ".xml" do should "return errors" do assert_no_difference('User.count') do put '/users/2.xml', @parameters, :authorization => credentials('admin') end - + assert_response :unprocessable_entity assert_equal 'application/xml', @response.content_type assert_tag 'errors', :child => {:tag => 'error', :content => "First name can't be blank"} end end - + context ".json" do should "return errors" do assert_no_difference('User.count') do put '/users/2.json', @parameters, :authorization => credentials('admin') end - + assert_response :unprocessable_entity assert_equal 'application/json', @response.content_type json = ActiveSupport::JSON.decode(response.body) @@ -240,30 +240,30 @@ class ApiTest::UsersTest < ActionController::IntegrationTest end end end - + context "DELETE /users/2" do context ".xml" do should "not be allowed" do assert_no_difference('User.count') do delete '/users/2.xml' end - + assert_response :method_not_allowed end end - + context ".json" do should "not be allowed" do assert_no_difference('User.count') do delete '/users/2.json' end - + assert_response :method_not_allowed end end end end - + def credentials(user, password=nil) ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user) end diff --git a/test/integration/application_test.rb b/test/integration/application_test.rb index 5b226f56..d3d0150e 100644 --- a/test/integration/application_test.rb +++ b/test/integration/application_test.rb @@ -1,48 +1,48 @@ #-- 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. #++ require File.expand_path('../../test_helper', __FILE__) class ApplicationTest < ActionController::IntegrationTest include Redmine::I18n - + fixtures :all - + def test_set_localization Setting.default_language = 'en' - + # a french user get 'projects', { }, 'Accept-Language' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3' assert_response :success assert_tag :tag => 'h2', :content => 'Projets' assert_equal :fr, current_language - + # then an italien user get 'projects', { }, 'Accept-Language' => 'it;q=0.8,en-us;q=0.5,en;q=0.3' assert_response :success assert_tag :tag => 'h2', :content => 'Progetti' assert_equal :it, current_language - + # not a supported language: default language should be used get 'projects', { }, 'Accept-Language' => 'zz' assert_response :success assert_tag :tag => 'h2', :content => 'Projects' end - + def test_token_based_access_should_not_start_session # issue of a private project get 'issues/4.atom' assert_response 302 - + rss_key = User.find(2).rss_key get "issues/4.atom?key=#{rss_key}" assert_response 200 diff --git a/test/integration/issues_test.rb b/test/integration/issues_test.rb index e7cb6b18..5b7775dc 100644 --- a/test/integration/issues_test.rb +++ b/test/integration/issues_test.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. #++ require File.expand_path('../../test_helper', __FILE__) class IssuesTest < ActionController::IntegrationTest - fixtures :projects, + fixtures :projects, :users, :roles, :members, @@ -33,13 +33,13 @@ class IssuesTest < ActionController::IntegrationTest get 'projects/1/issues/new', :tracker_id => '1' assert_response :success assert_template 'issues/new' - + post 'projects/1/issues', :tracker_id => "1", - :issue => { :start_date => "2006-12-26", - :priority_id => "4", - :subject => "new test issue", - :category_id => "", - :description => "new issue", + :issue => { :start_date => "2006-12-26", + :priority_id => "4", + :subject => "new test issue", + :category_id => "", + :description => "new issue", :done_ratio => "0", :due_date => "", :assigned_to_id => "" }, @@ -53,7 +53,7 @@ class IssuesTest < ActionController::IntegrationTest follow_redirect! assert_equal issue, assigns(:issue) - # check issue attributes + # check issue attributes assert_equal 'jsmith', issue.author.login assert_equal 1, issue.project.id assert_equal 1, issue.status.id @@ -68,7 +68,7 @@ class IssuesTest < ActionController::IntegrationTest :notes => 'Some notes', :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'This is an attachment'}} assert_redirected_to "/issues/1" - + # make sure attachment was saved attachment = Issue.find(1).attachments.find_by_filename("testfile.txt") assert_kind_of Attachment, attachment @@ -78,56 +78,56 @@ class IssuesTest < ActionController::IntegrationTest #assert_equal file_data_1.length, attachment.filesize # verify that the attachment was written to disk assert File.exist?(attachment.diskfile) - + # remove the attachments Issue.find(1).attachments.each(&:destroy) assert_equal 0, Issue.find(1).attachments.length end - + def test_other_formats_links_on_get_index get '/projects/ecookbook/issues' - + %w(Atom PDF CSV).each do |format| assert_tag :a, :content => format, :attributes => { :href => "/projects/ecookbook/issues.#{format.downcase}", :rel => 'nofollow' } end end - + def test_other_formats_links_on_post_index_without_project_id_in_url post '/issues', :project_id => 'ecookbook' - + %w(Atom PDF CSV).each do |format| assert_tag :a, :content => format, :attributes => { :href => "/projects/ecookbook/issues.#{format.downcase}", :rel => 'nofollow' } end end - + def test_pagination_links_on_get_index Setting.per_page_options = '2' get '/projects/ecookbook/issues' - + assert_tag :a, :content => '2', :attributes => { :href => '/projects/ecookbook/issues?page=2' } - + end - + def test_pagination_links_on_post_index_without_project_id_in_url Setting.per_page_options = '2' post '/issues', :project_id => 'ecookbook' - + assert_tag :a, :content => '2', :attributes => { :href => '/projects/ecookbook/issues?page=2' } - + end - + def test_issue_with_user_custom_field @field = IssueCustomField.create!(:name => 'Tester', :field_format => 'user', :is_for_all => true, :trackers => Tracker.all) Role.anonymous.add_permission! :add_issues, :edit_issues users = Project.find(1).users tester = users.first - + # Issue form get '/projects/ecookbook/issues/new' assert_response :success @@ -139,10 +139,10 @@ class IssuesTest < ActionController::IntegrationTest :attributes => {:value => tester.id.to_s}, :content => tester.name } - + # Create issue assert_difference 'Issue.count' do - post '/projects/ecookbook/issues', + post '/projects/ecookbook/issues', :issue => { :tracker_id => '1', :priority_id => '4', @@ -152,7 +152,7 @@ class IssuesTest < ActionController::IntegrationTest end issue = Issue.first(:order => 'id DESC') assert_response 302 - + # Issue view follow_redirect! assert_tag :th, @@ -169,7 +169,7 @@ class IssuesTest < ActionController::IntegrationTest :attributes => {:value => tester.id.to_s, :selected => 'selected'}, :content => tester.name } - + # Update issue new_tester = users[1] assert_difference 'Journal.count' do @@ -180,7 +180,7 @@ class IssuesTest < ActionController::IntegrationTest } end assert_response 302 - + # Issue view follow_redirect! assert_tag :content => 'Tester', diff --git a/test/integration/layout_test.rb b/test/integration/layout_test.rb index 5be3034d..ce0b1d54 100644 --- a/test/integration/layout_test.rb +++ b/test/integration/layout_test.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. #++ @@ -27,7 +27,7 @@ class LayoutTest < ActionController::IntegrationTest test "browsing to an unauthorized page should render the base layout" do change_user_password('miscuser9', 'test') - + log_user('miscuser9','test') get "/admin" @@ -50,10 +50,10 @@ class LayoutTest < ActionController::IntegrationTest assert_select "#quick-search" end end - + def test_wiki_formatter_header_tags Role.anonymous.add_permission! :add_issues - + get '/projects/ecookbook/issues/new' assert_tag :script, :attributes => {:src => %r{^/javascripts/jstoolbar/textile.js}}, diff --git a/test/integration/lib/redmine/menu_manager_test.rb b/test/integration/lib/redmine/menu_manager_test.rb index bd9a61ff..2b035401 100644 --- a/test/integration/lib/redmine/menu_manager_test.rb +++ b/test/integration/lib/redmine/menu_manager_test.rb @@ -1,25 +1,25 @@ #-- 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. #++ require File.expand_path('../../../../test_helper', __FILE__) class MenuManagerTest < ActionController::IntegrationTest include Redmine::I18n - + fixtures :all - + def test_project_menu_with_specific_locale get 'projects/ecookbook/issues', { }, 'Accept-Language' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3' - + assert_tag :div, :attributes => { :id => 'main-menu' }, :descendant => { :tag => 'li', :child => { :tag => 'a', :content => ll('fr', :label_activity), :attributes => { :href => '/projects/ecookbook/activity', @@ -29,7 +29,7 @@ class MenuManagerTest < ActionController::IntegrationTest :attributes => { :href => '/projects/ecookbook/issues', :class => 'issues selected' } } } end - + def test_project_menu_with_additional_menu_items Setting.default_language = 'en' assert_no_difference 'Redmine::MenuManager.items(:project_menu).size' do @@ -38,12 +38,12 @@ class MenuManagerTest < ActionController::IntegrationTest menu.push :bar, { :controller => 'projects', :action => 'show' }, :before => :activity menu.push :hello, { :controller => 'projects', :action => 'show' }, :caption => Proc.new {|p| p.name.upcase }, :after => :bar end - + get 'projects/ecookbook' assert_tag :div, :attributes => { :id => 'main-menu' }, :descendant => { :tag => 'li', :child => { :tag => 'a', :content => 'Foo', :attributes => { :class => 'foo' } } } - + assert_tag :div, :attributes => { :id => 'main-menu' }, :descendant => { :tag => 'li', :child => { :tag => 'a', :content => 'Bar', :attributes => { :class => 'bar' } }, @@ -53,7 +53,7 @@ class MenuManagerTest < ActionController::IntegrationTest :descendant => { :tag => 'li', :child => { :tag => 'a', :content => 'ECOOKBOOK', :attributes => { :class => 'hello' } }, :before => { :tag => 'li', :child => { :tag => 'a', :content => 'Activity' } } } - + # Remove the menu items Redmine::MenuManager.map :project_menu do |menu| menu.delete :foo diff --git a/test/integration/lib/redmine/themes_test.rb b/test/integration/lib/redmine/themes_test.rb index 204224d7..1026abc0 100644 --- a/test/integration/lib/redmine/themes_test.rb +++ b/test/integration/lib/redmine/themes_test.rb @@ -1,69 +1,69 @@ #-- 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. #++ require File.expand_path('../../../../test_helper', __FILE__) class ThemesTest < ActionController::IntegrationTest fixtures :all - + def setup @theme = Redmine::Themes.themes.last Setting.ui_theme = @theme.id end - + def teardown Setting.ui_theme = '' end - + def test_application_css get '/' - + assert_response :success assert_tag :tag => 'link', :attributes => {:href => %r{^/themes/#{@theme.dir}/stylesheets/application.css}} end - + def test_without_theme_js get '/' - + assert_response :success assert_no_tag :tag => 'script', :attributes => {:src => %r{^/themes/#{@theme.dir}/javascripts/theme.js}} end - + def test_with_theme_js # Simulates a theme.js @theme.javascripts << 'theme' get '/' - + assert_response :success assert_tag :tag => 'script', :attributes => {:src => %r{^/themes/#{@theme.dir}/javascripts/theme.js}} - + ensure @theme.javascripts.delete 'theme' end - + def test_with_sub_uri Redmine::Utils.relative_url_root = '/foo' @theme.javascripts << 'theme' get '/' - + assert_response :success assert_tag :tag => 'link', :attributes => {:href => %r{^/foo/themes/#{@theme.dir}/stylesheets/application.css}} assert_tag :tag => 'script', :attributes => {:src => %r{^/foo/themes/#{@theme.dir}/javascripts/theme.js}} - + ensure Redmine::Utils.relative_url_root = '' end diff --git a/test/integration/projects_test.rb b/test/integration/projects_test.rb index e318dc7b..efa50e8d 100644 --- a/test/integration/projects_test.rb +++ b/test/integration/projects_test.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. #++ require File.expand_path('../../test_helper', __FILE__) class ProjectsTest < ActionController::IntegrationTest fixtures :projects, :users, :members - + def test_archive_project subproject = Project.find(1).children.first log_user("admin", "admin") @@ -24,16 +24,16 @@ class ProjectsTest < ActionController::IntegrationTest post "projects/archive", :id => 1 assert_redirected_to "/admin/projects" assert !Project.find(1).active? - + get 'projects/1' assert_response 403 get "projects/#{subproject.id}" assert_response 403 - + post "projects/unarchive", :id => 1 assert_redirected_to "/admin/projects" assert Project.find(1).active? get "projects/1" assert_response :success - end + end end diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index 596ac2dc..f8930eb9 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -24,7 +24,7 @@ class RoutingTest < ActionController::IntegrationTest should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1' should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext' end - + context "boards" do should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination' should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' @@ -35,7 +35,7 @@ class RoutingTest < ActionController::IntegrationTest should_route :post, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination' should_route :post, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44' should_route :post, "/projects/world_domination/boards/44/destroy", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44' - + end context "documents" do @@ -48,7 +48,7 @@ class RoutingTest < ActionController::IntegrationTest should_route :post, "/documents/567/edit", :controller => 'documents', :action => 'edit', :id => '567' should_route :post, "/documents/567/destroy", :controller => 'documents', :action => 'destroy', :id => '567' end - + context "issues" do # REST actions should_route :get, "/issues", :controller => 'issues', :action => 'index' @@ -67,7 +67,7 @@ class RoutingTest < ActionController::IntegrationTest should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23' should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23' should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml' - + should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' # TODO: Should use PUT should_route :post, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64' @@ -76,13 +76,13 @@ class RoutingTest < ActionController::IntegrationTest # TODO: Should use DELETE should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64' should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml' - + # Extra actions should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64' should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new' should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create' - + should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1' should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show' @@ -118,7 +118,7 @@ class RoutingTest < ActionController::IntegrationTest should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'new', :issue_id => '1' should_route :post, "/issues/1/relations/23/destroy", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23' end - + context "issue reports" do should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567' should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to' @@ -153,7 +153,7 @@ class RoutingTest < ActionController::IntegrationTest should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234' should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567' should_route :get, "/news/preview", :controller => 'previews', :action => 'news' - + should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567' should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567' @@ -177,7 +177,7 @@ class RoutingTest < ActionController::IntegrationTest should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33' should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33' should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom' - + should_route :post, "/projects", :controller => 'projects', :action => 'create' should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml' should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33' @@ -211,8 +211,8 @@ class RoutingTest < ActionController::IntegrationTest should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c] should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c] should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine' - - + + should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine' end @@ -324,7 +324,7 @@ class RoutingTest < ActionController::IntegrationTest should_route :get, "/projects/567/wiki/index", :controller => 'wiki', :action => 'index', :project_id => '567' should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :project_id => '567' should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :project_id => '567' - + should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :project_id => '567', :id => 'CookBook_documentation' should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida' should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :id => 'ladida' diff --git a/test/mocks/open_id_authentication_mock.rb b/test/mocks/open_id_authentication_mock.rb index 69f24d54..eb19eb7b 100644 --- a/test/mocks/open_id_authentication_mock.rb +++ b/test/mocks/open_id_authentication_mock.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. #++ # Mocks out OpenID # # http://www.northpub.com/articles/2007/04/02/testing-openid-support -module OpenIdAuthentication +module OpenIdAuthentication EXTENSION_FIELDS = {'email' => 'user@somedomain.com', 'nickname' => 'cool_user', @@ -23,7 +23,7 @@ module OpenIdAuthentication 'fullname' => 'Cool User', 'dob' => '1970-04-01', 'language' => 'en', - 'timezone' => 'America/New_York'} + 'timezone' => 'America/New_York'} protected @@ -44,7 +44,7 @@ module OpenIdAuthentication yield Result[:successful], identity_url , extension_response_fields else - logger.info "OpenID authentication failed: #{identity_url}" + logger.info "OpenID authentication failed: #{identity_url}" yield Result[:failed], identity_url, nil end end diff --git a/test/object_daddy_helpers.rb b/test/object_daddy_helpers.rb index 7180c8bc..c21af61a 100644 --- a/test/object_daddy_helpers.rb +++ b/test/object_daddy_helpers.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/test/test_helper.rb b/test/test_helper.rb index 187832ca..b675a671 100644 --- a/test/test_helper.rb +++ b/test/test_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. #++ @@ -47,7 +47,7 @@ class ActiveSupport::TestCase super Setting.clear_cache end - + def log_user(login, password) User.anonymous get "/login" @@ -57,7 +57,7 @@ class ActiveSupport::TestCase post "/login", :username => login, :password => password assert_equal login, User.find(session[:user_id]).login end - + def uploaded_test_file(name, mime) ActionController::TestUploadedFile.new(ActiveSupport::TestCase.fixture_path + "/files/#{name}", mime, true) end @@ -82,7 +82,7 @@ class ActiveSupport::TestCase Dir.mkdir "#{RAILS_ROOT}/tmp/test/attachments" unless File.directory?("#{RAILS_ROOT}/tmp/test/attachments") Attachment.storage_path = "#{RAILS_ROOT}/tmp/test/attachments" end - + def with_settings(options, &block) saved_settings = options.keys.inject({}) {|h, k| h[k] = Setting[k].dup; h} options.each {|k, v| Setting[k] = v} @@ -104,24 +104,24 @@ class ActiveSupport::TestCase # LDAP is not listening return nil end - + # Returns the path to the test +vendor+ repository def self.repository_path(vendor) File.join(RAILS_ROOT.gsub(%r{config\/\.\.}, ''), "/tmp/test/#{vendor.downcase}_repository") end - + # Returns the url of the subversion test repository def self.subversion_repository_url path = repository_path('subversion') path = '/' + path unless path.starts_with?('/') "file://#{path}" end - + # Returns true if the +vendor+ test repository is configured def self.repository_configured?(vendor) File.directory?(repository_path(vendor)) end - + def assert_error_tag(options={}) assert_tag({:attributes => { :id => 'errorExplanation' }}.merge(options)) end @@ -219,7 +219,7 @@ class ActiveSupport::TestCase def self.should_allow_http_basic_auth_with_username_and_password(http_method, url, parameters={}, options={}) success_code = options[:success_code] || :success failure_code = options[:failure_code] || :unauthorized - + context "should allow http basic auth using a username and password for #{http_method} #{url}" do context "with a valid HTTP authentication" do setup do @@ -227,7 +227,7 @@ class ActiveSupport::TestCase @authorization = ActionController::HttpAuthentication::Basic.encode_credentials(@user.login, 'my_password') send(http_method, url, parameters, {:authorization => @authorization}) end - + should_respond_with success_code should_respond_with_content_type_based_on_url(url) should "login as the user" do @@ -241,14 +241,14 @@ class ActiveSupport::TestCase @authorization = ActionController::HttpAuthentication::Basic.encode_credentials(@user.login, 'wrong_password') send(http_method, url, parameters, {:authorization => @authorization}) end - + should_respond_with failure_code should_respond_with_content_type_based_on_url(url) should "not login as the user" do assert_equal User.anonymous, User.current end end - + context "without credentials" do setup do send(http_method, url, parameters, {:authorization => ''}) @@ -284,7 +284,7 @@ class ActiveSupport::TestCase @authorization = ActionController::HttpAuthentication::Basic.encode_credentials(@token.value, 'X') send(http_method, url, parameters, {:authorization => @authorization}) end - + should_respond_with success_code should_respond_with_content_type_based_on_url(url) should_be_a_valid_response_string_based_on_url(url) @@ -309,7 +309,7 @@ class ActiveSupport::TestCase end end end - + # Test that a request allows full key authentication # # @param [Symbol] http_method the HTTP method for request (:get, :post, :put, :delete) @@ -335,7 +335,7 @@ class ActiveSupport::TestCase end send(http_method, request_url, parameters) end - + should_respond_with success_code should_respond_with_content_type_based_on_url(url) should_be_a_valid_response_string_based_on_url(url) @@ -356,7 +356,7 @@ class ActiveSupport::TestCase end send(http_method, request_url, parameters) end - + should_respond_with failure_code should_respond_with_content_type_based_on_url(url) should "not login as the user" do @@ -364,14 +364,14 @@ class ActiveSupport::TestCase end end end - + context "should allow key based auth using X-ChiliProject-API-Key header for #{http_method} #{url}" do setup do @user = User.generate_with_protected!(:admin => true) @token = Token.generate!(:user => @user, :action => 'api') send(http_method, url, parameters, {'X-ChiliProject-API-Key' => @token.value.to_s}) end - + should_respond_with success_code should_respond_with_content_type_based_on_url(url) should_be_a_valid_response_string_based_on_url(url) @@ -396,7 +396,7 @@ class ActiveSupport::TestCase else raise "Unknown content type for should_respond_with_content_type_based_on_url: #{url}" end - + end # Uses the url to assert which format the response should be in @@ -414,9 +414,9 @@ class ActiveSupport::TestCase else raise "Unknown content type for should_be_a_valid_response_based_on_url: #{url}" end - + end - + # Checks that the response is a valid JSON string def self.should_be_a_valid_json_string should "be a valid JSON string (or empty)" do @@ -430,7 +430,7 @@ class ActiveSupport::TestCase assert REXML::Document.new(response.body) end end - + end # Simple module to "namespace" all of the API tests diff --git a/test/unit/activity_test.rb b/test/unit/activity_test.rb index df48185e..9cc67ea7 100644 --- a/test/unit/activity_test.rb +++ b/test/unit/activity_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -24,11 +24,11 @@ class ActivityTest < ActiveSupport::TestCase i.save! end end - + def test_activity_without_subprojects events = find_events(User.anonymous, :project => @project) assert_not_nil events - + assert events.include?(Issue.find(1)) assert !events.include?(Issue.find(4)) # subproject issue @@ -38,54 +38,54 @@ class ActivityTest < ActiveSupport::TestCase def test_activity_with_subprojects events = find_events(User.anonymous, :project => @project, :with_subprojects => 1) assert_not_nil events - + assert events.include?(Issue.find(1)) # subproject issue assert events.include?(Issue.find(5)) end - + def test_global_activity_anonymous events = find_events(User.anonymous) assert_not_nil events - + assert events.include?(Issue.find(1)) assert events.include?(Message.find(5)) # Issue of a private project assert !events.include?(Issue.find(6)) end - + def test_global_activity_logged_user events = find_events(User.find(2)) # manager assert_not_nil events - + assert events.include?(Issue.find(1)) # Issue of a private project the user belongs to assert events.include?(Issue.find(6)) end - + def test_user_activity user = User.find(2) events = Redmine::Activity::Fetcher.new(User.anonymous, :author => user).events(nil, nil, :limit => 10) - + assert(events.size > 0) assert(events.size <= 10) assert_nil(events.detect {|e| e.event_author != user}) end - + def test_files_activity f = Redmine::Activity::Fetcher.new(User.anonymous, :project => Project.find(1)) f.scope = ['files'] events = f.events - + assert_kind_of Array, events assert events.include?(Attachment.find_by_container_type_and_container_id('Project', 1).last_journal) assert events.include?(Attachment.find_by_container_type_and_container_id('Version', 1).last_journal) assert_equal [Attachment], events.collect(&:journaled).collect(&:class).uniq assert_equal %w(Project Version), events.collect(&:journaled).collect(&:container_type).uniq.sort end - + private - + def find_events(user, options={}) events = Redmine::Activity::Fetcher.new(user, options).events(Date.today - 30, Date.today + 1) # Because events are provided by the journals, but we want to test for diff --git a/test/unit/attachment_test.rb b/test/unit/attachment_test.rb index 9160d206..f31f9473 100644 --- a/test/unit/attachment_test.rb +++ b/test/unit/attachment_test.rb @@ -1,21 +1,21 @@ # -*- coding: utf-8 -*- #-- 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. #++ require File.expand_path('../../test_helper', __FILE__) class AttachmentTest < ActiveSupport::TestCase fixtures :issues, :users - + def setup end @@ -31,7 +31,7 @@ class AttachmentTest < ActiveSupport::TestCase assert_equal '1478adae0d4eb06d35897518540e25d6', a.digest assert File.exist?(a.diskfile) end - + def test_create_should_auto_assign_content_type a = Attachment.new(:container => Issue.find(1), :file => uploaded_test_file("testfile.txt", ""), @@ -39,7 +39,7 @@ class AttachmentTest < ActiveSupport::TestCase assert a.save assert_equal 'text/plain', a.content_type end - + def test_identical_attachments_at_the_same_time_should_not_overwrite a1 = Attachment.create!(:container => Issue.find(1), :file => uploaded_test_file("testfile.txt", ""), @@ -49,7 +49,7 @@ class AttachmentTest < ActiveSupport::TestCase :author => User.find(1)) assert a1.disk_filename != a2.disk_filename end - + def test_diskfilename assert Attachment.disk_filename("test_file.txt") =~ /^\d{12}_test_file.txt$/ assert_equal 'test_file.txt', Attachment.disk_filename("test_file.txt")[13..-1] diff --git a/test/unit/auth_source_ldap_test.rb b/test/unit/auth_source_ldap_test.rb index 769e6312..3b5f3cc7 100644 --- a/test/unit/auth_source_ldap_test.rb +++ b/test/unit/auth_source_ldap_test.rb @@ -1,28 +1,28 @@ #-- 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. #++ require File.expand_path('../../test_helper', __FILE__) class AuthSourceLdapTest < ActiveSupport::TestCase fixtures :auth_sources - + def setup end - + def test_create a = AuthSourceLdap.new(:name => 'My LDAP', :host => 'ldap.example.net', :port => 389, :base_dn => 'dc=example,dc=net', :attr_login => 'sAMAccountName') assert a.save end - + def test_should_strip_ldap_attributes a = AuthSourceLdap.new(:name => 'My LDAP', :host => 'ldap.example.net', :port => 389, :base_dn => 'dc=example,dc=net', :attr_login => 'sAMAccountName', :attr_firstname => 'givenName ') @@ -67,7 +67,7 @@ class AuthSourceLdapTest < ActiveSupport::TestCase assert_equal nil, @auth.authenticate('edavis','') end end - + end else puts '(Test LDAP server not configured)' diff --git a/test/unit/board_test.rb b/test/unit/board_test.rb index 99850198..3f1d3f61 100644 --- a/test/unit/board_test.rb +++ b/test/unit/board_test.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 BoardTest < ActiveSupport::TestCase def setup @project = Project.find(1) end - + def test_create board = Board.new(:project => @project, :name => 'Test board', :description => 'Test board description') assert board.save @@ -33,7 +33,7 @@ class BoardTest < ActiveSupport::TestCase # last position assert_equal @project.boards.size, board.position end - + def test_destroy board = Board.find(1) assert_difference 'Message.count', -6 do diff --git a/test/unit/changeset_test.rb b/test/unit/changeset_test.rb index 95abd850..34520b26 100644 --- a/test/unit/changeset_test.rb +++ b/test/unit/changeset_test.rb @@ -1,14 +1,14 @@ # -*- coding: utf-8 -*- #-- 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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,50 +18,50 @@ class ChangesetTest < ActiveSupport::TestCase def setup end - + def test_ref_keywords_any ActionMailer::Base.deliveries.clear Setting.commit_fix_status_id = IssueStatus.find(:first, :conditions => ["is_closed = ?", true]).id Setting.commit_fix_done_ratio = '90' Setting.commit_ref_keywords = '*' Setting.commit_fix_keywords = 'fixes , closes' - + c = Changeset.new(:repository => Project.find(1).repository, :committed_on => Time.now, :comments => 'New commit (#2). Fixes #1') c.scan_comment_for_issue_ids - + assert_equal [1, 2], c.issue_ids.sort fixed = Issue.find(1) assert fixed.closed? assert_equal 90, fixed.done_ratio assert_equal 1, ActionMailer::Base.deliveries.size end - + def test_ref_keywords Setting.commit_ref_keywords = 'refs' Setting.commit_fix_keywords = '' - + c = Changeset.new(:repository => Project.find(1).repository, :committed_on => Time.now, :comments => 'Ignores #2. Refs #1') c.scan_comment_for_issue_ids - + assert_equal [1], c.issue_ids.sort end - + def test_ref_keywords_any_only Setting.commit_ref_keywords = '*' Setting.commit_fix_keywords = '' - + c = Changeset.new(:repository => Project.find(1).repository, :committed_on => Time.now, :comments => 'Ignores #2. Refs #1') c.scan_comment_for_issue_ids - + assert_equal [1, 2], c.issue_ids.sort end - + def test_ref_keywords_any_with_timelog Setting.commit_ref_keywords = '*' Setting.commit_logtime_enabled = '1' @@ -90,7 +90,7 @@ class ChangesetTest < ActiveSupport::TestCase c.scan_comment_for_issue_ids end assert_equal [1], c.issue_ids.sort - + time = TimeEntry.first(:order => 'id desc') assert_equal 1, time.issue_id assert_equal 1, time.project_id @@ -101,13 +101,13 @@ class ChangesetTest < ActiveSupport::TestCase assert time.comments.include?('r520'), "r520 was expected in time_entry comments: #{time.comments}" end end - + def test_ref_keywords_closing_with_timelog Setting.commit_fix_status_id = IssueStatus.find(:first, :conditions => ["is_closed = ?", true]).id Setting.commit_ref_keywords = '*' Setting.commit_fix_keywords = 'fixes , closes' Setting.commit_logtime_enabled = '1' - + c = Changeset.new(:repository => Project.find(1).repository, :committed_on => Time.now, :comments => 'This is a comment. Fixes #1 @4.5, #2 @1', @@ -115,7 +115,7 @@ class ChangesetTest < ActiveSupport::TestCase assert_difference 'TimeEntry.count', 2 do c.scan_comment_for_issue_ids end - + assert_equal [1, 2], c.issue_ids.sort assert Issue.find(1).closed? assert Issue.find(2).closed? @@ -123,7 +123,7 @@ class ChangesetTest < ActiveSupport::TestCase times = TimeEntry.all(:order => 'id desc', :limit => 2) assert_equal [1, 2], times.collect(&:issue_id).sort end - + def test_ref_keywords_any_line_start Setting.commit_ref_keywords = '*' @@ -156,13 +156,13 @@ class ChangesetTest < ActiveSupport::TestCase assert_equal [1,2,3], c.issue_ids.sort end - + def test_commit_referencing_a_subproject_issue c = Changeset.new(:repository => Project.find(1).repository, :committed_on => Time.now, :comments => 'refs #5, a subproject issue') c.scan_comment_for_issue_ids - + assert_equal [5], c.issue_ids.sort assert c.issues.first.project != c.project end diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb index 9532d6fd..772f3696 100644 --- a/test/unit/comment_test.rb +++ b/test/unit/comment_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -19,18 +19,18 @@ class CommentTest < ActiveSupport::TestCase @jsmith = User.find(2) @news = News.find(1) end - + def test_create comment = Comment.new(:commented => @news, :author => @jsmith, :comments => "my comment") assert comment.save @news.reload assert_equal 2, @news.comments_count end - + def test_create_should_send_notification Setting.notified_events = Setting.notified_events.dup << 'news_comment_added' Watcher.create!(:watchable => @news, :user => @jsmith) - + assert_difference 'ActionMailer::Base.deliveries.size' do Comment.create!(:commented => @news, :author => @jsmith, :comments => "my comment") end @@ -41,7 +41,7 @@ class CommentTest < ActiveSupport::TestCase assert !comment.save assert_equal 2, comment.errors.length end - + def test_destroy comment = Comment.find(1) assert comment.destroy diff --git a/test/unit/custom_field_test.rb b/test/unit/custom_field_test.rb index 8369716b..17095ec0 100644 --- a/test/unit/custom_field_test.rb +++ b/test/unit/custom_field_test.rb @@ -1,43 +1,43 @@ #-- 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. #++ require File.expand_path('../../test_helper', __FILE__) class CustomFieldTest < ActiveSupport::TestCase fixtures :custom_fields - + def test_create field = UserCustomField.new(:name => 'Money money money', :field_format => 'float') assert field.save end - + def test_possible_values_should_accept_an_array field = CustomField.new field.possible_values = ["One value", ""] assert_equal ["One value"], field.possible_values end - + def test_possible_values_should_accept_a_string field = CustomField.new field.possible_values = "One value" assert_equal ["One value"], field.possible_values end - + def test_possible_values_should_accept_a_multiline_string field = CustomField.new field.possible_values = "One value\nAnd another one \r\n \n" assert_equal ["One value", "And another one"], field.possible_values end - + def test_destroy field = CustomField.find(1) assert field.destroy diff --git a/test/unit/custom_field_user_format_test.rb b/test/unit/custom_field_user_format_test.rb index e18c3d04..79470a4e 100644 --- a/test/unit/custom_field_user_format_test.rb +++ b/test/unit/custom_field_user_format_test.rb @@ -1,64 +1,64 @@ #-- 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. #++ require File.expand_path('../../test_helper', __FILE__) class CustomFieldUserFormatTest < ActiveSupport::TestCase fixtures :custom_fields, :projects, :members, :users, :member_roles, :trackers, :issues - + def setup @field = IssueCustomField.create!(:name => 'Tester', :field_format => 'user') end - + def test_possible_values_with_no_arguments assert_equal [], @field.possible_values assert_equal [], @field.possible_values(nil) end - + def test_possible_values_with_project_resource project = Project.find(1) possible_values = @field.possible_values(project.issues.first) assert possible_values.any? assert_equal project.users.sort.collect(&:id).map(&:to_s), possible_values end - + def test_possible_values_with_nil_project_resource project = Project.find(1) assert_equal [], @field.possible_values(Issue.new) end - + def test_possible_values_options_with_no_arguments assert_equal [], @field.possible_values_options assert_equal [], @field.possible_values_options(nil) end - + def test_possible_values_options_with_project_resource project = Project.find(1) possible_values_options = @field.possible_values_options(project.issues.first) assert possible_values_options.any? assert_equal project.users.sort.map {|u| [u.name, u.id.to_s]}, possible_values_options end - + def test_cast_blank_value assert_equal nil, @field.cast_value(nil) assert_equal nil, @field.cast_value("") end - + def test_cast_valid_value user = @field.cast_value("2") assert_kind_of User, user assert_equal User.find(2), user end - + def test_cast_invalid_value assert_equal nil, @field.cast_value("187") end diff --git a/test/unit/custom_value_test.rb b/test/unit/custom_value_test.rb index 96fd4ead..c9770200 100644 --- a/test/unit/custom_value_test.rb +++ b/test/unit/custom_value_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,7 +18,7 @@ class CustomValueTest < ActiveSupport::TestCase def test_string_field_validation_with_blank_value f = CustomField.new(:field_format => 'string') v = CustomValue.new(:custom_field => f) - + v.value = nil assert v.valid? v.value = '' @@ -30,7 +30,7 @@ class CustomValueTest < ActiveSupport::TestCase v.value = '' assert !v.valid? end - + def test_string_field_validation_with_min_and_max_lengths f = CustomField.new(:field_format => 'string', :min_length => 2, :max_length => 5) v = CustomValue.new(:custom_field => f, :value => '') @@ -42,7 +42,7 @@ class CustomValueTest < ActiveSupport::TestCase v.value = 'a' * 6 assert !v.valid? end - + def test_string_field_validation_with_regexp f = CustomField.new(:field_format => 'string', :regexp => '^[A-Z0-9]*$') v = CustomValue.new(:custom_field => f, :value => '') @@ -86,7 +86,7 @@ class CustomValueTest < ActiveSupport::TestCase v.value = '-123' assert v.valid? end - + def test_float_field_validation v = CustomValue.new(:customized => User.find(:first), :custom_field => UserCustomField.find_by_name('Money')) v.value = '11.2' @@ -98,18 +98,18 @@ class CustomValueTest < ActiveSupport::TestCase v.value = '6a' assert !v.save end - + def test_default_value field = CustomField.find_by_default_value('Default string') assert_not_nil field - + v = CustomValue.new(:custom_field => field) assert_equal 'Default string', v.value v = CustomValue.new(:custom_field => field, :value => 'Not empty') assert_equal 'Not empty', v.value end - + def test_sti_polymorphic_association # Rails uses top level sti class for polymorphic association. See #3978. assert !User.find(4).custom_values.empty? diff --git a/test/unit/default_data_test.rb b/test/unit/default_data_test.rb index d0c46beb..086829f3 100644 --- a/test/unit/default_data_test.rb +++ b/test/unit/default_data_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -15,7 +15,7 @@ require File.expand_path('../../test_helper', __FILE__) class DefaultDataTest < ActiveSupport::TestCase include Redmine::I18n fixtures :roles - + def test_no_data assert !Redmine::DefaultData::Loader::no_data? Role.delete_all("builtin = 0") @@ -24,7 +24,7 @@ class DefaultDataTest < ActiveSupport::TestCase Enumeration.delete_all assert Redmine::DefaultData::Loader::no_data? end - + def test_load valid_languages.each do |lang| begin diff --git a/test/unit/document_category_test.rb b/test/unit/document_category_test.rb index 4638721f..a8aa2d7b 100644 --- a/test/unit/document_category_test.rb +++ b/test/unit/document_category_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,7 +18,7 @@ class DocumentCategoryTest < ActiveSupport::TestCase def test_should_be_an_enumeration assert DocumentCategory.ancestors.include?(Enumeration) end - + def test_objects_count assert_equal 2, DocumentCategory.find_by_name("Uncategorized").objects_count assert_equal 0, DocumentCategory.find_by_name("User documentation").objects_count diff --git a/test/unit/document_test.rb b/test/unit/document_test.rb index cf9abd01..9daef2fd 100644 --- a/test/unit/document_test.rb +++ b/test/unit/document_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -19,7 +19,7 @@ class DocumentTest < ActiveSupport::TestCase doc = Document.new(:project => Project.find(1), :title => 'New document', :category => Enumeration.find_by_name('User documentation')) assert doc.save end - + def test_create_should_send_email_notification ActionMailer::Base.deliveries.clear Setting.notified_events = Setting.notified_events.dup << 'document_added' @@ -33,18 +33,18 @@ class DocumentTest < ActiveSupport::TestCase # Sets a default category e = Enumeration.find_by_name('Technical documentation') e.update_attributes(:is_default => true) - + doc = Document.new(:project => Project.find(1), :title => 'New document') assert_equal e, doc.category assert doc.save end - + def test_updated_on_with_attachments d = Document.find(1) assert d.attachments.any? assert_equal d.attachments.map(&:created_on).max, d.updated_on end - + def test_updated_on_without_attachments d = Document.find(2) assert d.attachments.empty? diff --git a/test/unit/enabled_module_test.rb b/test/unit/enabled_module_test.rb index 174fa2ca..82ea731f 100644 --- a/test/unit/enabled_module_test.rb +++ b/test/unit/enabled_module_test.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. #++ require File.expand_path('../../test_helper', __FILE__) class EnabledModuleTest < ActiveSupport::TestCase fixtures :projects, :wikis - + def test_enabling_wiki_should_create_a_wiki CustomField.delete_all project = Project.create!(:name => 'Project with wiki', :identifier => 'wikiproject') @@ -24,7 +24,7 @@ class EnabledModuleTest < ActiveSupport::TestCase assert_not_nil project.wiki assert_equal 'Wiki', project.wiki.start_page end - + def test_reenabling_wiki_should_not_create_another_wiki project = Project.find(1) assert_not_nil project.wiki diff --git a/test/unit/enumeration_test.rb b/test/unit/enumeration_test.rb index 69207770..41abd6bf 100644 --- a/test/unit/enumeration_test.rb +++ b/test/unit/enumeration_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -17,60 +17,60 @@ class EnumerationTest < ActiveSupport::TestCase def setup end - + def test_objects_count # low priority assert_equal 6, Enumeration.find(4).objects_count # urgent assert_equal 0, Enumeration.find(7).objects_count end - + def test_in_use # low priority assert Enumeration.find(4).in_use? # urgent assert !Enumeration.find(7).in_use? end - + def test_default e = Enumeration.default assert e.is_a?(Enumeration) assert e.is_default? assert_equal 'Default Enumeration', e.name end - + def test_create e = Enumeration.new(:name => 'Not default', :is_default => false) e.type = 'Enumeration' assert e.save assert_equal 'Default Enumeration', Enumeration.default.name end - + def test_create_as_default e = Enumeration.new(:name => 'Very urgent', :is_default => true) e.type = 'Enumeration' assert e.save assert_equal e, Enumeration.default end - + def test_update_default e = Enumeration.default e.update_attributes(:name => 'Changed', :is_default => true) assert_equal e, Enumeration.default end - + def test_update_default_to_non_default e = Enumeration.default e.update_attributes(:name => 'Changed', :is_default => false) assert_nil Enumeration.default end - + def test_change_default e = Enumeration.find_by_name('Default Enumeration') e.update_attributes(:name => 'Changed Enumeration', :is_default => true) assert_equal e, Enumeration.default end - + def test_destroy_with_reassign Enumeration.find(4).destroy(Enumeration.find(6)) assert_nil Issue.find(:first, :conditions => {:priority_id => 4}) diff --git a/test/unit/group_test.rb b/test/unit/group_test.rb index ddebf361..fd6a1107 100644 --- a/test/unit/group_test.rb +++ b/test/unit/group_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -19,27 +19,27 @@ class GroupTest < ActiveSupport::TestCase g = Group.new(:lastname => 'New group') assert g.save end - + def test_roles_given_to_new_user group = Group.find(11) user = User.find(9) project = Project.first - + Member.create!(:principal => group, :project => project, :role_ids => [1, 2]) group.users << user assert user.member_of?(project) end - + def test_roles_given_to_existing_user group = Group.find(11) user = User.find(9) project = Project.first - + group.users << user m = Member.create!(:principal => group, :project => project, :role_ids => [1, 2]) assert user.member_of?(project) end - + def test_roles_updated group = Group.find(11) user = User.find(9) @@ -47,13 +47,13 @@ class GroupTest < ActiveSupport::TestCase group.users << user m = Member.create!(:principal => group, :project => project, :role_ids => [1]) assert_equal [1], user.reload.roles_for_project(project).collect(&:id).sort - + m.role_ids = [1, 2] assert_equal [1, 2], user.reload.roles_for_project(project).collect(&:id).sort - + m.role_ids = [2] assert_equal [2], user.reload.roles_for_project(project).collect(&:id).sort - + m.role_ids = [1] assert_equal [1], user.reload.roles_for_project(project).collect(&:id).sort end diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 2fb91a1e..10ba5126 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.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. #++ require File.expand_path('../../../test_helper', __FILE__) class ApplicationHelperTest < ActionView::TestCase - + fixtures :projects, :roles, :enabled_modules, :users, - :repositories, :changesets, + :repositories, :changesets, :trackers, :issue_statuses, :issues, :versions, :documents, :wikis, :wiki_pages, :wiki_contents, :boards, :messages, @@ -30,11 +30,11 @@ class ApplicationHelperTest < ActionView::TestCase context "authorized user" do should "be tested" end - + context "unauthorized user" do should "be tested" end - + should "allow using the :controller and :action for the target link" do User.current = User.find_by_login('admin') @@ -43,9 +43,9 @@ class ApplicationHelperTest < ActionView::TestCase {:controller => 'issues', :action => 'edit', :id => Issue.first.id}) assert_match /href/, response end - + end - + def test_auto_links to_test = { 'http://foo.bar' => 'http://foo.bar', @@ -79,12 +79,12 @@ class ApplicationHelperTest < ActionView::TestCase } to_test.each { |text, result| assert_equal "

              #{result}

              ", textilizable(text) } end - + def test_auto_mailto - assert_equal '

              ', + assert_equal '

              ', textilizable('test@foo.bar') end - + def test_inline_images to_test = { '!http://foo.bar/image.jpg!' => '', @@ -97,7 +97,7 @@ class ApplicationHelperTest < ActionView::TestCase } to_test.each { |text, result| assert_equal "

              #{result}

              ", textilizable(text) } end - + def test_inline_images_inside_tags raw = <<-RAW h1. !foo.png! Heading @@ -110,7 +110,7 @@ RAW assert textilizable(raw).include?('') assert textilizable(raw).include?('') end - + def test_attached_images to_test = { 'Inline image: !logo.gif!' => 'Inline image: This is a logo', @@ -123,7 +123,7 @@ RAW attachments = Attachment.find(:all) to_test.each { |text, result| assert_equal "

              #{result}

              ", textilizable(text, :attachments => attachments) } end - + def test_textile_external_links to_test = { 'This is a "link":http://foo.bar' => 'This is a link', @@ -144,27 +144,27 @@ RAW end def test_redmine_links - issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3}, + issue_link = link_to('#3', {:controller => 'issues', :action => 'show', :id => 3}, :class => 'issue status-1 priority-1 overdue', :title => 'Error 281 when updating a recipe (New)') - + changeset_link = link_to('r1', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 1}, :class => 'changeset', :title => 'My very first commit') changeset_link2 = link_to('r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 2}, :class => 'changeset', :title => 'This commit fixes #1, #2 and references #1 & #3') - + document_link = link_to('Test document', {:controller => 'documents', :action => 'show', :id => 1}, :class => 'document') - + version_link = link_to('1.0', {:controller => 'versions', :action => 'show', :id => 2}, :class => 'version') message_url = {:controller => 'messages', :action => 'show', :board_id => 1, :id => 4} - + project_url = {:controller => 'projects', :action => 'show', :id => 'subproject1'} - + source_url = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']} source_url_with_ext = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file.ext']} - + to_test = { # tickets '#3, [#3], (#3) and #3.' => "#{issue_link}, [#{issue_link}], (#{issue_link}) and #{issue_link}.", @@ -219,14 +219,14 @@ RAW @project = Project.find(1) to_test.each { |text, result| assert_equal "

              #{result}

              ", textilizable(text), "#{text} failed" } end - + def test_cross_project_redmine_links source_link = link_to('ecookbook:source:/some/file', {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']}, :class => 'source') - + changeset_link = link_to('ecookbook:r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 2}, :class => 'changeset', :title => 'This commit fixes #1, #2 and references #1 & #3') - + to_test = { # documents 'document:"Test document"' => 'document:"Test document"', @@ -340,7 +340,7 @@ RAW } to_test.each { |text, result| assert_equal "

              #{result}

              ", textilizable(text, :attachments => Issue.find(3).attachments), "#{text} failed" } end - + def test_wiki_links to_test = { '[[CookBook documentation]]' => 'CookBook documentation', @@ -369,7 +369,7 @@ RAW @project = Project.find(1) to_test.each { |text, result| assert_equal "

              #{result}

              ", textilizable(text) } end - + def test_html_tags to_test = { "
              content
              " => "

              <div>content</div>

              ", @@ -393,7 +393,7 @@ RAW } to_test.each { |text, result| assert_equal result, textilizable(text) } end - + def test_allowed_html_tags to_test = { "
              preformatted text
              " => "
              preformatted text
              ", @@ -402,7 +402,7 @@ RAW } to_test.each { |text, result| assert_equal result, textilizable(text) } end - + def test_pre_tags raw = <<-RAW Before @@ -421,19 +421,19 @@ RAW

              After

              EXPECTED - + assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '') end - + def test_pre_content_should_not_parse_wiki_and_redmine_links raw = <<-RAW [[CookBook documentation]] - + #1
               [[CookBook documentation]]
              -  
              +
               #1
               
              RAW @@ -447,11 +447,11 @@ RAW #1 EXPECTED - + @project = Project.find(1) assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '') end - + def test_non_closing_pre_blocks_should_be_closed raw = <<-RAW
              
              @@ -461,11 +461,11 @@ RAW
               
              
               
              EXPECTED - + @project = Project.find(1) assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '') end - + def test_syntax_highlight raw = <<-RAW
              
              @@ -480,7 +480,7 @@ EXPECTED
               
                   assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
                 end
              -  
              +
                 def test_wiki_links_in_tables
                   to_test = {"|[[Page|Link title]]|[[Other Page|Other title]]|\n|Cell 21|[[Last page]]|" =>
                                '
              ' + @@ -490,7 +490,7 @@ EXPECTED @project = Project.find(1) to_test.each { |text, result| assert_equal "#{result}
              ", textilizable(text).gsub(/[\t\n]/, '') } end - + def test_text_formatting to_test = {'*_+bold, italic and underline+_*' => 'bold, italic and underline', '(_text within parentheses_)' => '(text within parentheses)', @@ -500,12 +500,12 @@ EXPECTED } to_test.each { |text, result| assert_equal "

              #{result}

              ", textilizable(text) } end - + def test_wiki_horizontal_rule assert_equal '
              ', textilizable('---') assert_equal '

              Dashes: ---

              ', textilizable('Dashes: ---') end - + def test_footnotes raw = <<-RAW This is some text[1]. @@ -520,14 +520,14 @@ EXPECTED assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '') end - + def test_headings raw = 'h1. Some heading' expected = %|\n

              Some heading

              | - + assert_equal expected, textilizable(raw) end - + def test_table_of_content raw = <<-RAW {{toc}} @@ -561,8 +561,8 @@ RAW expected = '
                ' + '
              • Title' + '
                  ' + - '
                • Subtitle with a Wiki link
                • ' + - '
                • Subtitle with another Wiki link
                • ' + + '
                • Subtitle with a Wiki link
                • ' + + '
                • Subtitle with another Wiki link
                • ' + '
                • Subtitle with red text' + '
                    ' + '
                  • Subtitle with some modifiers
                  • ' + @@ -585,7 +585,7 @@ RAW @project = Project.find(1) assert textilizable(raw).gsub("\n", "").include?(expected), textilizable(raw) end - + def test_table_of_content_should_contain_included_page_headings raw = <<-RAW {{toc}} @@ -597,20 +597,20 @@ RAW expected = '' @project = Project.find(1) assert textilizable(raw).gsub("\n", "").include?(expected) end - + def test_default_formatter Setting.text_formatting = 'unknown' text = 'a *link*: http://www.example.net/' assert_equal '

                    a *link*: http://www.example.net/

                    ', textilizable(text) Setting.text_formatting = 'textile' end - + def test_due_date_distance_in_words to_test = { Date.today => 'Due in 0 days', Date.today + 1 => 'Due in 1 day', @@ -625,7 +625,7 @@ RAW assert_equal expected, due_date_distance_in_words(date) end end - + def test_avatar # turn on avatars Setting.gravatar_enabled = '1' @@ -633,25 +633,25 @@ RAW assert avatar('jsmith ').include?(Digest::MD5.hexdigest('jsmith@somenet.foo')) assert_nil avatar('jsmith') assert_nil avatar(nil) - + # turn off avatars Setting.gravatar_enabled = '0' assert_equal '', avatar(User.find_by_mail('jsmith@somenet.foo')) end - + def test_link_to_user user = User.find(2) t = link_to_user(user) assert_equal "#{ user.name }", t end - + def test_link_to_user_should_not_link_to_locked_user user = User.find(5) assert user.locked? t = link_to_user(user) assert_equal user.name, t end - + def test_link_to_user_should_not_link_to_anonymous user = User.anonymous assert user.anonymous? diff --git a/test/unit/helpers/custom_fields_helper_test.rb b/test/unit/helpers/custom_fields_helper_test.rb index 8777c14e..a9a3f9ce 100644 --- a/test/unit/helpers/custom_fields_helper_test.rb +++ b/test/unit/helpers/custom_fields_helper_test.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. #++ require File.expand_path('../../../test_helper', __FILE__) @@ -15,26 +15,26 @@ require File.expand_path('../../../test_helper', __FILE__) class CustomFieldsHelperTest < HelperTestCase include CustomFieldsHelper include Redmine::I18n - + def test_format_boolean_value I18n.locale = 'en' assert_equal 'Yes', format_value('1', 'bool') assert_equal 'No', format_value('0', 'bool') end - + def test_unknow_field_format_should_be_edited_as_string field = CustomField.new(:field_format => 'foo') value = CustomValue.new(:value => 'bar', :custom_field => field) field.id = 52 - + assert_equal '', custom_field_tag('object', value) end - + def test_unknow_field_format_should_be_bulk_edited_as_string field = CustomField.new(:field_format => 'foo') field.id = 52 - + assert_equal '', custom_field_tag_for_bulk_edit('object', field) end diff --git a/test/unit/helpers/issue_moves_helper_test.rb b/test/unit/helpers/issue_moves_helper_test.rb index befa418c..c4e420d2 100644 --- a/test/unit/helpers/issue_moves_helper_test.rb +++ b/test/unit/helpers/issue_moves_helper_test.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/test/unit/helpers/issues_helper_test.rb b/test/unit/helpers/issues_helper_test.rb index 5190e04f..41ae870a 100644 --- a/test/unit/helpers/issues_helper_test.rb +++ b/test/unit/helpers/issues_helper_test.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. #++ require File.expand_path('../../../test_helper', __FILE__) @@ -38,7 +38,7 @@ class IssuesHelperTest < HelperTestCase def request @request ||= ActionController::TestRequest.new end - + # This is probably needed in this test only anymore def show_detail(journal, detail, html = true) journal.render_detail(detail, html) diff --git a/test/unit/helpers/projects_helper_test.rb b/test/unit/helpers/projects_helper_test.rb index fb08b999..23e7903d 100644 --- a/test/unit/helpers/projects_helper_test.rb +++ b/test/unit/helpers/projects_helper_test.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. #++ require File.expand_path('../../../test_helper', __FILE__) @@ -15,7 +15,7 @@ require File.expand_path('../../../test_helper', __FILE__) class ProjectsHelperTest < HelperTestCase include ApplicationHelper include ProjectsHelper - + fixtures :all def setup @@ -42,12 +42,12 @@ class ProjectsHelperTest < HelperTestCase def test_link_to_version_invalid_version assert_equal '', link_to_version(Object) end - + def test_format_version_name_within_project @project = Project.find(1) assert_equal "0.1", format_version_name(Version.find(1)) end - + def test_format_version_name assert_equal "eCookbook - 0.1", format_version_name(Version.find(1)) end @@ -55,7 +55,7 @@ class ProjectsHelperTest < HelperTestCase def test_format_version_name_for_system_version assert_equal "OnlineStore - Systemwide visible version", format_version_name(Version.find(7)) end - + def test_version_options_for_select_with_no_versions assert_equal '', version_options_for_select([]) assert_equal '', version_options_for_select([], Version.find(1)) diff --git a/test/unit/helpers/repository_helper_test.rb b/test/unit/helpers/repository_helper_test.rb index ce5cd239..a913520c 100644 --- a/test/unit/helpers/repository_helper_test.rb +++ b/test/unit/helpers/repository_helper_test.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. #++ require File.expand_path('../../../test_helper', __FILE__) diff --git a/test/unit/helpers/search_helper_test.rb b/test/unit/helpers/search_helper_test.rb index d2dd6ce1..0d46bbe5 100644 --- a/test/unit/helpers/search_helper_test.rb +++ b/test/unit/helpers/search_helper_test.rb @@ -1,38 +1,38 @@ # -*- coding: utf-8 -*- #-- 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. #++ require File.expand_path('../../../test_helper', __FILE__) class SearchHelperTest < HelperTestCase include SearchHelper - + def test_highlight_single_token assert_equal 'This is a token.', highlight_tokens('This is a token.', %w(token)) end - + def test_highlight_multiple_tokens assert_equal 'This is a token and another token.', highlight_tokens('This is a token and another token.', %w(token another)) end - + def test_highlight_should_not_exceed_maximum_length s = (('1234567890' * 100) + ' token ') * 100 r = highlight_tokens(s, %w(token)) assert r.include?('token') assert r.length <= 1300 end - + def test_highlight_multibyte s = ('й' * 200) + ' token ' + ('й' * 200) r = highlight_tokens(s, %w(token)) diff --git a/test/unit/helpers/sort_helper_test.rb b/test/unit/helpers/sort_helper_test.rb index 77c4f72f..f280d28e 100644 --- a/test/unit/helpers/sort_helper_test.rb +++ b/test/unit/helpers/sort_helper_test.rb @@ -1,78 +1,78 @@ #-- 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. #++ require File.expand_path('../../../test_helper', __FILE__) class SortHelperTest < HelperTestCase include SortHelper - + def setup @session = nil @sort_param = nil end - + def test_default_sort_clause_with_array sort_init 'attr1', 'desc' sort_update(['attr1', 'attr2']) assert_equal 'attr1 DESC', sort_clause end - + def test_default_sort_clause_with_hash sort_init 'attr1', 'desc' sort_update({'attr1' => 'table1.attr1', 'attr2' => 'table2.attr2'}) assert_equal 'table1.attr1 DESC', sort_clause end - + def test_default_sort_clause_with_multiple_columns sort_init 'attr1', 'desc' sort_update({'attr1' => ['table1.attr1', 'table1.attr2'], 'attr2' => 'table2.attr2'}) assert_equal 'table1.attr1 DESC, table1.attr2 DESC', sort_clause end - + def test_params_sort @sort_param = 'attr1,attr2:desc' - + sort_init 'attr1', 'desc' sort_update({'attr1' => 'table1.attr1', 'attr2' => 'table2.attr2'}) assert_equal 'table1.attr1, table2.attr2 DESC', sort_clause assert_equal 'attr1,attr2:desc', @session['foo_bar_sort'] end - + def test_invalid_params_sort @sort_param = 'invalid_key' - + sort_init 'attr1', 'desc' sort_update({'attr1' => 'table1.attr1', 'attr2' => 'table2.attr2'}) assert_equal 'table1.attr1 DESC', sort_clause assert_equal 'attr1:desc', @session['foo_bar_sort'] end - + def test_invalid_order_params_sort @sort_param = 'attr1:foo:bar,attr2' - + sort_init 'attr1', 'desc' sort_update({'attr1' => 'table1.attr1', 'attr2' => 'table2.attr2'}) assert_equal 'table1.attr1, table2.attr2', sort_clause assert_equal 'attr1,attr2', @session['foo_bar_sort'] end - + private - + def controller_name; 'foo'; end def action_name; 'bar'; end def params; {:sort => @sort_param}; end diff --git a/test/unit/helpers/timelog_helper_test.rb b/test/unit/helpers/timelog_helper_test.rb index 05bf7438..39f765ca 100644 --- a/test/unit/helpers/timelog_helper_test.rb +++ b/test/unit/helpers/timelog_helper_test.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. #++ require File.expand_path('../../../test_helper', __FILE__) @@ -16,15 +16,15 @@ class TimelogHelperTest < HelperTestCase include TimelogHelper include ActionView::Helpers::TextHelper include ActionView::Helpers::DateHelper - + fixtures :projects, :roles, :enabled_modules, :users, - :repositories, :changesets, + :repositories, :changesets, :trackers, :issue_statuses, :issues, :versions, :documents, :wikis, :wiki_pages, :wiki_contents, :boards, :messages, :attachments, :enumerations - + def setup super end @@ -34,7 +34,7 @@ class TimelogHelperTest < HelperTestCase assert activities.include?(["Design", 9]) assert activities.include?(["Development", 10]) end - + def test_activities_collection_for_select_options_should_not_include_inactive_activities activities = activity_collection_for_select_options assert !activities.include?(["Inactive Activity", 14]) diff --git a/test/unit/helpers/watchers_helpers_test.rb b/test/unit/helpers/watchers_helpers_test.rb index 591b4743..3a6e86db 100644 --- a/test/unit/helpers/watchers_helpers_test.rb +++ b/test/unit/helpers/watchers_helpers_test.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/test/unit/issue_category_test.rb b/test/unit/issue_category_test.rb index 8b78eca7..b8da34c6 100644 --- a/test/unit/issue_category_test.rb +++ b/test/unit/issue_category_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,14 +18,14 @@ class IssueCategoryTest < ActiveSupport::TestCase def setup @category = IssueCategory.find(1) end - + def test_destroy issue = @category.issues.first @category.destroy # Make sure the category was nullified on the issue assert_nil issue.reload.category end - + def test_destroy_with_reassign issue = @category.issues.first reassign_to = IssueCategory.find(2) diff --git a/test/unit/issue_nested_set_test.rb b/test/unit/issue_nested_set_test.rb index 713300cb..f78c8b7c 100644 --- a/test/unit/issue_nested_set_test.rb +++ b/test/unit/issue_nested_set_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -16,166 +16,166 @@ class IssueNestedSetTest < ActiveSupport::TestCase fixtures :projects, :users, :members, :member_roles, :roles, :trackers, :projects_trackers, :versions, - :issue_statuses, :issue_categories, :issue_relations, :workflows, + :issue_statuses, :issue_categories, :issue_relations, :workflows, :enumerations, :issues, :custom_fields, :custom_fields_projects, :custom_fields_trackers, :custom_values, :time_entries self.use_transactional_fixtures = false - + def test_create_root_issue issue1 = create_issue! issue2 = create_issue! issue1.reload issue2.reload - + assert_equal [issue1.id, nil, 1, 2], [issue1.root_id, issue1.parent_id, issue1.lft, issue1.rgt] assert_equal [issue2.id, nil, 1, 2], [issue2.root_id, issue2.parent_id, issue2.lft, issue2.rgt] end - + def test_create_child_issue parent = create_issue! child = create_issue!(:parent_issue_id => parent.id) parent.reload child.reload - + assert_equal [parent.id, nil, 1, 4], [parent.root_id, parent.parent_id, parent.lft, parent.rgt] assert_equal [parent.id, parent.id, 2, 3], [child.root_id, child.parent_id, child.lft, child.rgt] end - + def test_creating_a_child_in_different_project_should_not_validate issue = create_issue! child = Issue.new(:project_id => 2, :tracker_id => 1, :author_id => 1, :subject => 'child', :parent_issue_id => issue.id) assert !child.save assert_not_nil child.errors.on(:parent_issue_id) end - + def test_move_a_root_to_child parent1 = create_issue! parent2 = create_issue! child = create_issue!(:parent_issue_id => parent1.id) - + parent2.parent_issue_id = parent1.id parent2.save! child.reload parent1.reload parent2.reload - + assert_equal [parent1.id, 1, 6], [parent1.root_id, parent1.lft, parent1.rgt] assert_equal [parent1.id, 4, 5], [parent2.root_id, parent2.lft, parent2.rgt] assert_equal [parent1.id, 2, 3], [child.root_id, child.lft, child.rgt] end - + def test_move_a_child_to_root parent1 = create_issue! parent2 = create_issue! child = create_issue!(:parent_issue_id => parent1.id) - + child.parent_issue_id = nil child.save! child.reload parent1.reload parent2.reload - + assert_equal [parent1.id, 1, 2], [parent1.root_id, parent1.lft, parent1.rgt] assert_equal [parent2.id, 1, 2], [parent2.root_id, parent2.lft, parent2.rgt] assert_equal [child.id, 1, 2], [child.root_id, child.lft, child.rgt] end - + def test_move_a_child_to_another_issue parent1 = create_issue! parent2 = create_issue! child = create_issue!(:parent_issue_id => parent1.id) - + child.parent_issue_id = parent2.id child.save! child.reload parent1.reload parent2.reload - + assert_equal [parent1.id, 1, 2], [parent1.root_id, parent1.lft, parent1.rgt] assert_equal [parent2.id, 1, 4], [parent2.root_id, parent2.lft, parent2.rgt] assert_equal [parent2.id, 2, 3], [child.root_id, child.lft, child.rgt] end - + def test_move_a_child_with_descendants_to_another_issue parent1 = create_issue! parent2 = create_issue! child = create_issue!(:parent_issue_id => parent1.id) grandchild = create_issue!(:parent_issue_id => child.id) - + parent1.reload parent2.reload child.reload grandchild.reload - + assert_equal [parent1.id, 1, 6], [parent1.root_id, parent1.lft, parent1.rgt] assert_equal [parent2.id, 1, 2], [parent2.root_id, parent2.lft, parent2.rgt] assert_equal [parent1.id, 2, 5], [child.root_id, child.lft, child.rgt] assert_equal [parent1.id, 3, 4], [grandchild.root_id, grandchild.lft, grandchild.rgt] - + child.reload.parent_issue_id = parent2.id child.save! child.reload grandchild.reload parent1.reload parent2.reload - + assert_equal [parent1.id, 1, 2], [parent1.root_id, parent1.lft, parent1.rgt] assert_equal [parent2.id, 1, 6], [parent2.root_id, parent2.lft, parent2.rgt] assert_equal [parent2.id, 2, 5], [child.root_id, child.lft, child.rgt] assert_equal [parent2.id, 3, 4], [grandchild.root_id, grandchild.lft, grandchild.rgt] end - + def test_move_a_child_with_descendants_to_another_project parent1 = create_issue! child = create_issue!(:parent_issue_id => parent1.id) grandchild = create_issue!(:parent_issue_id => child.id) - + assert child.reload.move_to_project(Project.find(2)) child.reload grandchild.reload parent1.reload - + assert_equal [1, parent1.id, 1, 2], [parent1.project_id, parent1.root_id, parent1.lft, parent1.rgt] assert_equal [2, child.id, 1, 4], [child.project_id, child.root_id, child.lft, child.rgt] assert_equal [2, child.id, 2, 3], [grandchild.project_id, grandchild.root_id, grandchild.lft, grandchild.rgt] end - + def test_invalid_move_to_another_project parent1 = create_issue! child = create_issue!(:parent_issue_id => parent1.id) grandchild = create_issue!(:parent_issue_id => child.id, :tracker_id => 2) Project.find(2).tracker_ids = [1] - + parent1.reload assert_equal [1, parent1.id, 1, 6], [parent1.project_id, parent1.root_id, parent1.lft, parent1.rgt] - + # child can not be moved to Project 2 because its child is on a disabled tracker assert_equal false, Issue.find(child.id).move_to_project(Project.find(2)) child.reload grandchild.reload parent1.reload - + # no change assert_equal [1, parent1.id, 1, 6], [parent1.project_id, parent1.root_id, parent1.lft, parent1.rgt] assert_equal [1, parent1.id, 2, 5], [child.project_id, child.root_id, child.lft, child.rgt] assert_equal [1, parent1.id, 3, 4], [grandchild.project_id, grandchild.root_id, grandchild.lft, grandchild.rgt] end - + def test_moving_an_issue_to_a_descendant_should_not_validate parent1 = create_issue! parent2 = create_issue! child = create_issue!(:parent_issue_id => parent1.id) grandchild = create_issue!(:parent_issue_id => child.id) - + child.reload child.parent_issue_id = grandchild.id assert !child.save assert_not_nil child.errors.on(:parent_issue_id) end - + def test_moving_an_issue_should_keep_valid_relations_only issue1 = create_issue! issue2 = create_issue! @@ -191,23 +191,23 @@ class IssueNestedSetTest < ActiveSupport::TestCase assert !IssueRelation.exists?(r2.id) assert IssueRelation.exists?(r3.id) end - + def test_destroy_should_destroy_children issue1 = create_issue! issue2 = create_issue! issue3 = create_issue!(:parent_issue_id => issue2.id) issue4 = create_issue!(:parent_issue_id => issue1.id) - + issue3.init_journal(User.find(2)) issue3.subject = 'child with journal' issue3.save! - + assert_difference 'Issue.count', -2 do assert_difference 'IssueJournal.count', -3 do Issue.find(issue2.id).destroy end end - + issue1.reload issue4.reload assert !Issue.exists?(issue2.id) @@ -215,17 +215,17 @@ class IssueNestedSetTest < ActiveSupport::TestCase assert_equal [issue1.id, 1, 4], [issue1.root_id, issue1.lft, issue1.rgt] assert_equal [issue1.id, 2, 3], [issue4.root_id, issue4.lft, issue4.rgt] end - + def test_destroy_parent_issue_updated_during_children_destroy parent = create_issue! create_issue!(:start_date => Date.today, :parent_issue_id => parent.id) create_issue!(:start_date => 2.days.from_now, :parent_issue_id => parent.id) - + assert_difference 'Issue.count', -3 do Issue.find(parent.id).destroy end end - + def test_destroy_child_issue_with_children root = Issue.create!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'root').reload child = Issue.create!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'child', :parent_issue_id => root.id).reload @@ -240,11 +240,11 @@ class IssueNestedSetTest < ActiveSupport::TestCase Issue.find(child.id).destroy end end - + root = Issue.find(root.id) assert root.leaf?, "Root issue is not a leaf (lft: #{root.lft}, rgt: #{root.rgt})" end - + def test_parent_priority_should_be_the_highest_child_priority parent = create_issue!(:priority => IssuePriority.find_by_name('Normal')) # Create children @@ -263,7 +263,7 @@ class IssueNestedSetTest < ActiveSupport::TestCase child3.save! assert_equal 'Normal', parent.reload.priority.name end - + def test_parent_dates_should_be_lowest_start_and_highest_due_dates parent = create_issue! create_issue!(:start_date => '2010-01-25', :due_date => '2010-02-15', :parent_issue_id => parent.id) @@ -273,22 +273,22 @@ class IssueNestedSetTest < ActiveSupport::TestCase assert_equal Date.parse('2010-01-25'), parent.start_date assert_equal Date.parse('2010-02-22'), parent.due_date end - + def test_parent_done_ratio_should_be_average_done_ratio_of_leaves parent = create_issue! create_issue!(:done_ratio => 20, :parent_issue_id => parent.id) assert_equal 20, parent.reload.done_ratio create_issue!(:done_ratio => 70, :parent_issue_id => parent.id) assert_equal 45, parent.reload.done_ratio - + child = create_issue!(:done_ratio => 0, :parent_issue_id => parent.id) assert_equal 30, parent.reload.done_ratio - + create_issue!(:done_ratio => 30, :parent_issue_id => child.id) assert_equal 30, child.reload.done_ratio assert_equal 40, parent.reload.done_ratio end - + def test_parent_done_ratio_should_be_weighted_by_estimated_times_if_any parent = create_issue! create_issue!(:estimated_hours => 10, :done_ratio => 20, :parent_issue_id => parent.id) @@ -296,7 +296,7 @@ class IssueNestedSetTest < ActiveSupport::TestCase create_issue!(:estimated_hours => 20, :done_ratio => 50, :parent_issue_id => parent.id) assert_equal (50 * 20 + 20 * 10) / 30, parent.reload.done_ratio end - + def test_parent_estimate_should_be_sum_of_leaves parent = create_issue! create_issue!(:estimated_hours => nil, :parent_issue_id => parent.id) @@ -330,7 +330,7 @@ class IssueNestedSetTest < ActiveSupport::TestCase parent.reload assert_equal [Date.parse('2010-06-02'), Date.parse('2010-06-10')], [parent.start_date, parent.due_date] end - + def test_project_copy_should_copy_issue_tree p = Project.create!(:name => 'Tree copy', :identifier => 'tree-copy', :tracker_ids => [1, 2]) i1 = create_issue!(:project_id => p.id, :subject => 'i1') @@ -341,7 +341,7 @@ class IssueNestedSetTest < ActiveSupport::TestCase c = Project.new(:name => 'Copy', :identifier => 'copy', :tracker_ids => [1, 2]) c.copy(p, :only => 'issues') c.reload - + assert_equal 5, c.issues.count ic1, ic2, ic3, ic4, ic5 = c.issues.find(:all, :order => 'subject') assert ic1.root? @@ -350,7 +350,7 @@ class IssueNestedSetTest < ActiveSupport::TestCase assert_equal ic2, ic4.parent assert ic5.root? end - + # Helper that creates an issue with default attributes def create_issue!(attributes={}) Issue.create!({:project_id => 1, :tracker_id => 1, :author_id => 1, :subject => 'test'}.merge(attributes)) diff --git a/test/unit/issue_priority_test.rb b/test/unit/issue_priority_test.rb index f6c99eeb..2f66cba9 100644 --- a/test/unit/issue_priority_test.rb +++ b/test/unit/issue_priority_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,7 +18,7 @@ class IssuePriorityTest < ActiveSupport::TestCase def test_should_be_an_enumeration assert IssuePriority.ancestors.include?(Enumeration) end - + def test_objects_count # low priority assert_equal 6, IssuePriority.find(4).objects_count diff --git a/test/unit/issue_relation_test.rb b/test/unit/issue_relation_test.rb index a1291116..67e8d50a 100644 --- a/test/unit/issue_relation_test.rb +++ b/test/unit/issue_relation_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,7 +18,7 @@ class IssueRelationTest < ActiveSupport::TestCase def test_create from = Issue.find(1) to = Issue.find(2) - + relation = IssueRelation.new :issue_from => from, :issue_to => to, :relation_type => IssueRelation::TYPE_PRECEDES assert relation.save relation.reload @@ -26,11 +26,11 @@ class IssueRelationTest < ActiveSupport::TestCase assert_equal from, relation.issue_from assert_equal to, relation.issue_to end - + def test_follows_relation_should_be_reversed from = Issue.find(1) to = Issue.find(2) - + relation = IssueRelation.new :issue_from => from, :issue_to => to, :relation_type => IssueRelation::TYPE_FOLLOWS assert relation.save relation.reload @@ -38,37 +38,37 @@ class IssueRelationTest < ActiveSupport::TestCase assert_equal to, relation.issue_from assert_equal from, relation.issue_to end - + def test_follows_relation_should_not_be_reversed_if_validation_fails from = Issue.find(1) to = Issue.find(2) - + relation = IssueRelation.new :issue_from => from, :issue_to => to, :relation_type => IssueRelation::TYPE_FOLLOWS, :delay => 'xx' assert !relation.save assert_equal IssueRelation::TYPE_FOLLOWS, relation.relation_type assert_equal from, relation.issue_from assert_equal to, relation.issue_to end - + def test_relation_type_for from = Issue.find(1) to = Issue.find(2) - + relation = IssueRelation.new :issue_from => from, :issue_to => to, :relation_type => IssueRelation::TYPE_PRECEDES assert_equal IssueRelation::TYPE_PRECEDES, relation.relation_type_for(from) assert_equal IssueRelation::TYPE_FOLLOWS, relation.relation_type_for(to) end - + def test_set_issue_to_dates_without_issue_to r = IssueRelation.new(:issue_from => Issue.new(:start_date => Date.today), :relation_type => IssueRelation::TYPE_PRECEDES, :delay => 1) assert_nil r.set_issue_to_dates end - + def test_set_issue_to_dates_without_issues r = IssueRelation.new(:relation_type => IssueRelation::TYPE_PRECEDES, :delay => 1) assert_nil r.set_issue_to_dates end - + def test_validates_circular_dependency IssueRelation.delete_all assert IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => Issue.find(2), :relation_type => IssueRelation::TYPE_PRECEDES) diff --git a/test/unit/issue_status_test.rb b/test/unit/issue_status_test.rb index d1adb86d..166a7646 100644 --- a/test/unit/issue_status_test.rb +++ b/test/unit/issue_status_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -20,12 +20,12 @@ class IssueStatusTest < ActiveSupport::TestCase assert !status.save # status name uniqueness assert_equal 1, status.errors.count - + status.name = "Test Status" assert status.save assert !status.is_default end - + def test_destroy status = IssueStatus.find(3) assert_difference 'IssueStatus.count', -1 do @@ -45,28 +45,28 @@ class IssueStatusTest < ActiveSupport::TestCase status = IssueStatus.default assert_kind_of IssueStatus, status end - + def test_change_default status = IssueStatus.find(2) assert !status.is_default status.is_default = true assert status.save status.reload - + assert_equal status, IssueStatus.default assert !IssueStatus.find(1).is_default end - + def test_reorder_should_not_clear_default_status status = IssueStatus.default status.move_to_bottom status.reload assert status.is_default? end - + def test_new_statuses_allowed_to Workflow.delete_all - + Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 2, :author => false, :assignee => false) Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 3, :author => true, :assignee => false) Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 4, :author => false, :assignee => true) @@ -77,13 +77,13 @@ class IssueStatusTest < ActiveSupport::TestCase assert_equal [2], status.new_statuses_allowed_to([role], tracker, false, false).map(&:id) assert_equal [2], status.find_new_statuses_allowed_to([role], tracker, false, false).map(&:id) - + assert_equal [2, 3], status.new_statuses_allowed_to([role], tracker, true, false).map(&:id) assert_equal [2, 3], status.find_new_statuses_allowed_to([role], tracker, true, false).map(&:id) - + assert_equal [2, 4], status.new_statuses_allowed_to([role], tracker, false, true).map(&:id) assert_equal [2, 4], status.find_new_statuses_allowed_to([role], tracker, false, true).map(&:id) - + assert_equal [2, 3, 4, 5], status.new_statuses_allowed_to([role], tracker, true, true).map(&:id) assert_equal [2, 3, 4, 5], status.find_new_statuses_allowed_to([role], tracker, true, true).map(&:id) end @@ -94,12 +94,12 @@ class IssueStatusTest < ActiveSupport::TestCase @issue_status = IssueStatus.find(1) @issue_status.update_attribute(:default_done_ratio, 50) end - + context "with Setting.issue_done_ratio using the issue_field" do setup do Setting.issue_done_ratio = 'issue_field' end - + should "change nothing" do IssueStatus.update_issue_done_ratios @@ -111,10 +111,10 @@ class IssueStatusTest < ActiveSupport::TestCase setup do Setting.issue_done_ratio = 'issue_status' end - + should "update all of the issue's done_ratios to match their Issue Status" do IssueStatus.update_issue_done_ratios - + issues = Issue.find([1,3,4,5,6,7,9,10]) issues.each do |issue| assert_equal @issue_status, issue.status diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 930f2c3e..5f26b2c1 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -17,7 +17,7 @@ class IssueTest < ActiveSupport::TestCase :trackers, :projects_trackers, :enabled_modules, :versions, - :issue_statuses, :issue_categories, :issue_relations, :workflows, + :issue_statuses, :issue_categories, :issue_relations, :workflows, :enumerations, :issues, :custom_fields, :custom_fields_projects, :custom_fields_trackers, :custom_values, @@ -29,17 +29,17 @@ class IssueTest < ActiveSupport::TestCase issue.reload assert_equal 1.5, issue.estimated_hours end - + def test_create_minimal issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, :status_id => 1, :priority => IssuePriority.all.first, :subject => 'test_create') assert issue.save assert issue.description.nil? end - + def test_create_with_required_custom_field field = IssueCustomField.find_by_name('Database') field.update_attribute(:is_required, true) - + issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :subject => 'test_create', :description => 'IssueTest#test_create_with_required_custom_field') assert issue.available_custom_fields.include?(field) # No value for the custom field @@ -59,7 +59,7 @@ class IssueTest < ActiveSupport::TestCase issue.reload assert_equal 'PostgreSQL', issue.custom_value_for(field).value end - + def test_visible_scope_for_anonymous # Anonymous user should see issues of public projects only issues = Issue.visible(User.anonymous).all @@ -70,7 +70,7 @@ class IssueTest < ActiveSupport::TestCase issues = Issue.visible(User.anonymous).all assert issues.empty? end - + def test_visible_scope_for_user user = User.find(9) assert user.projects.empty? @@ -90,7 +90,7 @@ class IssueTest < ActiveSupport::TestCase assert issues.any? assert_nil issues.detect {|issue| issue.project_id != 2} end - + def test_visible_scope_for_admin user = User.find(1) user.members.each(&:destroy) @@ -100,24 +100,24 @@ class IssueTest < ActiveSupport::TestCase # Admin should see issues on private projects that he does not belong to assert issues.detect {|issue| !issue.project.is_public?} end - + def test_errors_full_messages_should_include_custom_fields_errors field = IssueCustomField.find_by_name('Database') - + issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :subject => 'test_create', :description => 'IssueTest#test_create_with_required_custom_field') assert issue.available_custom_fields.include?(field) # Invalid value issue.custom_field_values = { field.id => 'SQLServer' } - + assert !issue.valid? assert_equal 1, issue.errors.full_messages.size assert_equal "Database #{I18n.translate('activerecord.errors.messages.inclusion')}", issue.errors.full_messages.first end - + def test_update_issue_with_required_custom_field field = IssueCustomField.find_by_name('Database') field.update_attribute(:is_required, true) - + issue = Issue.find(1) assert_nil issue.custom_value_for(field) assert issue.available_custom_fields.include?(field) @@ -132,23 +132,23 @@ class IssueTest < ActiveSupport::TestCase issue.reload assert_equal 'PostgreSQL', issue.custom_value_for(field).value end - + def test_should_not_update_attributes_if_custom_fields_validation_fails issue = Issue.find(1) field = IssueCustomField.find_by_name('Database') assert issue.available_custom_fields.include?(field) - + issue.custom_field_values = { field.id => 'Invalid' } issue.subject = 'Should be not be saved' assert !issue.save - + issue.reload assert_equal "Can't print recipes", issue.subject end - + def test_should_not_recreate_custom_values_objects_on_update field = IssueCustomField.find_by_name('Database') - + issue = Issue.find(1) issue.custom_field_values = { field.id => 'PostgreSQL' } assert issue.save @@ -159,14 +159,14 @@ class IssueTest < ActiveSupport::TestCase issue.reload assert_equal custom_value.id, issue.custom_value_for(field).id end - + def test_assigning_tracker_id_should_reload_custom_fields_values issue = Issue.new(:project => Project.find(1)) assert issue.custom_field_values.empty? issue.tracker_id = 1 assert issue.custom_field_values.any? end - + def test_assigning_attributes_should_assign_tracker_id_first attributes = ActiveSupport::OrderedHash.new attributes['custom_field_values'] = { '1' => 'MySQL' } @@ -176,40 +176,40 @@ class IssueTest < ActiveSupport::TestCase assert_not_nil issue.custom_value_for(1) assert_equal 'MySQL', issue.custom_value_for(1).value end - + def test_should_update_issue_with_disabled_tracker p = Project.find(1) issue = Issue.find(1) - + p.trackers.delete(issue.tracker) assert !p.trackers.include?(issue.tracker) - + issue.reload issue.subject = 'New subject' assert issue.save end - + def test_should_not_set_a_disabled_tracker p = Project.find(1) p.trackers.delete(Tracker.find(2)) - + issue = Issue.find(1) issue.tracker_id = 2 issue.subject = 'New subject' assert !issue.save assert_not_nil issue.errors.on(:tracker_id) end - + def test_category_based_assignment issue = Issue.create(:project_id => 1, :tracker_id => 1, :author_id => 3, :status_id => 1, :priority => IssuePriority.all.first, :subject => 'Assignment test', :description => 'Assignment test', :category_id => 1) assert_equal IssueCategory.find(1).assigned_to, issue.assigned_to end - - - + + + def test_new_statuses_allowed_to Workflow.delete_all - + Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 2, :author => false, :assignee => false) Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 3, :author => true, :assignee => false) Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1, :new_status_id => 4, :author => false, :assignee => true) @@ -218,20 +218,20 @@ class IssueTest < ActiveSupport::TestCase role = Role.find(1) tracker = Tracker.find(1) user = User.find(2) - + issue = Issue.generate!(:tracker => tracker, :status => status, :project_id => 1) assert_equal [1, 2], issue.new_statuses_allowed_to(user).map(&:id) - + issue = Issue.generate!(:tracker => tracker, :status => status, :project_id => 1, :author => user) assert_equal [1, 2, 3], issue.new_statuses_allowed_to(user).map(&:id) - + issue = Issue.generate!(:tracker => tracker, :status => status, :project_id => 1, :assigned_to => user) assert_equal [1, 2, 4], issue.new_statuses_allowed_to(user).map(&:id) - + issue = Issue.generate!(:tracker => tracker, :status => status, :project_id => 1, :author => user, :assigned_to => user) assert_equal [1, 2, 3, 4, 5], issue.new_statuses_allowed_to(user).map(&:id) end - + def test_copy issue = Issue.new.copy_from(1) assert issue.save @@ -245,13 +245,13 @@ class IssueTest < ActiveSupport::TestCase def test_copy_should_copy_status orig = Issue.find(8) assert orig.status != IssueStatus.default - + issue = Issue.new.copy_from(orig) assert issue.save issue.reload assert_equal orig.status, issue.status end - + def test_should_close_duplicates # Create 3 issues issue1 = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :priority => IssuePriority.all.first, :subject => 'Duplicates test', :description => 'Duplicates test') @@ -260,37 +260,37 @@ class IssueTest < ActiveSupport::TestCase assert issue2.save issue3 = issue1.clone assert issue3.save - + # 2 is a dupe of 1 IssueRelation.create(:issue_from => issue2, :issue_to => issue1, :relation_type => IssueRelation::TYPE_DUPLICATES) # And 3 is a dupe of 2 IssueRelation.create(:issue_from => issue3, :issue_to => issue2, :relation_type => IssueRelation::TYPE_DUPLICATES) # And 3 is a dupe of 1 (circular duplicates) IssueRelation.create(:issue_from => issue3, :issue_to => issue1, :relation_type => IssueRelation::TYPE_DUPLICATES) - + assert issue1.reload.duplicates.include?(issue2) - + # Closing issue 1 issue1.init_journal(User.find(:first), "Closing issue1") issue1.status = IssueStatus.find :first, :conditions => {:is_closed => true} assert issue1.save # 2 and 3 should be also closed assert issue2.reload.closed? - assert issue3.reload.closed? + assert issue3.reload.closed? end - + def test_should_not_close_duplicated_issue # Create 3 issues issue1 = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :priority => IssuePriority.all.first, :subject => 'Duplicates test', :description => 'Duplicates test') assert issue1.save issue2 = issue1.clone assert issue2.save - + # 2 is a dupe of 1 IssueRelation.create(:issue_from => issue2, :issue_to => issue1, :relation_type => IssueRelation::TYPE_DUPLICATES) # 2 is a dup of 1 but 1 is not a duplicate of 2 assert !issue2.reload.duplicates.include?(issue1) - + # Closing issue 2 issue2.init_journal(User.find(:first), "Closing issue2") issue2.status = IssueStatus.find :first, :conditions => {:is_closed => true} @@ -298,57 +298,57 @@ class IssueTest < ActiveSupport::TestCase # 1 should not be also closed assert !issue1.reload.closed? end - + def test_assignable_versions issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :fixed_version_id => 1, :subject => 'New issue') assert_equal ['open'], issue.assignable_versions.collect(&:status).uniq end - + def test_should_not_be_able_to_assign_a_new_issue_to_a_closed_version issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :fixed_version_id => 1, :subject => 'New issue') assert !issue.save assert_not_nil issue.errors.on(:fixed_version_id) end - + def test_should_not_be_able_to_assign_a_new_issue_to_a_locked_version issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :fixed_version_id => 2, :subject => 'New issue') assert !issue.save assert_not_nil issue.errors.on(:fixed_version_id) end - + def test_should_be_able_to_assign_a_new_issue_to_an_open_version issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :fixed_version_id => 3, :subject => 'New issue') assert issue.save end - + def test_should_be_able_to_update_an_issue_assigned_to_a_closed_version issue = Issue.find(11) assert_equal 'closed', issue.fixed_version.status issue.subject = 'Subject changed' assert issue.save end - + def test_should_not_be_able_to_reopen_an_issue_assigned_to_a_closed_version issue = Issue.find(11) issue.status_id = 1 assert !issue.save assert_not_nil issue.errors.on_base end - + def test_should_be_able_to_reopen_and_reassign_an_issue_assigned_to_a_closed_version issue = Issue.find(11) issue.status_id = 1 issue.fixed_version_id = 3 assert issue.save end - + def test_should_be_able_to_reopen_an_issue_assigned_to_a_locked_version issue = Issue.find(12) assert_equal 'locked', issue.fixed_version.status issue.status_id = 1 assert issue.save end - + def test_move_to_another_project_with_same_category issue = Issue.find(1) assert issue.move_to_project(Project.find(2)) @@ -359,7 +359,7 @@ class IssueTest < ActiveSupport::TestCase # Make sure time entries were move to the target project assert_equal 2, issue.time_entries.first.project_id end - + def test_move_to_another_project_without_same_category issue = Issue.find(2) assert issue.move_to_project(Project.find(2)) @@ -368,7 +368,7 @@ class IssueTest < ActiveSupport::TestCase # Category cleared assert_nil issue.category_id end - + def test_move_to_another_project_should_clear_fixed_version_when_not_shared issue = Issue.find(1) issue.update_attribute(:fixed_version_id, 1) @@ -378,7 +378,7 @@ class IssueTest < ActiveSupport::TestCase # Cleared fixed_version assert_equal nil, issue.fixed_version end - + def test_move_to_another_project_should_keep_fixed_version_when_shared_with_the_target_project issue = Issue.find(1) issue.update_attribute(:fixed_version_id, 4) @@ -388,7 +388,7 @@ class IssueTest < ActiveSupport::TestCase # Keep fixed_version assert_equal 4, issue.fixed_version_id end - + def test_move_to_another_project_should_clear_fixed_version_when_not_shared_with_the_target_project issue = Issue.find(1) issue.update_attribute(:fixed_version_id, 1) @@ -398,7 +398,7 @@ class IssueTest < ActiveSupport::TestCase # Cleared fixed_version assert_equal nil, issue.fixed_version end - + def test_move_to_another_project_should_keep_fixed_version_when_shared_systemwide issue = Issue.find(1) issue.update_attribute(:fixed_version_id, 7) @@ -408,7 +408,7 @@ class IssueTest < ActiveSupport::TestCase # Keep fixed_version assert_equal 7, issue.fixed_version_id end - + def test_move_to_another_project_with_disabled_tracker issue = Issue.find(1) target = Project.find(2) @@ -418,7 +418,7 @@ class IssueTest < ActiveSupport::TestCase issue.reload assert_equal 1, issue.project_id end - + def test_copy_to_the_same_project issue = Issue.find(1) copy = nil @@ -429,7 +429,7 @@ class IssueTest < ActiveSupport::TestCase assert_equal issue.project, copy.project assert_equal "125", copy.custom_value_for(2).value end - + def test_copy_to_another_project_and_tracker issue = Issue.find(1) copy = nil @@ -475,7 +475,7 @@ class IssueTest < ActiveSupport::TestCase end end end - + def test_recipients_should_not_include_users_that_cannot_view_the_issue issue = Issue.find(12) assert issue.recipients.include?(issue.author.mail) @@ -492,50 +492,50 @@ class IssueTest < ActiveSupport::TestCase assert issue.watched_by?(user) assert !issue.watcher_recipients.include?(user.mail) end - + def test_issue_destroy Issue.find(1).destroy assert_nil Issue.find_by_id(1) assert_nil TimeEntry.find_by_issue_id(1) end - + def test_blocked blocked_issue = Issue.find(9) blocking_issue = Issue.find(10) - + assert blocked_issue.blocked? assert !blocking_issue.blocked? end - + def test_blocked_issues_dont_allow_closed_statuses blocked_issue = Issue.find(9) - + allowed_statuses = blocked_issue.new_statuses_allowed_to(users(:users_002)) assert !allowed_statuses.empty? closed_statuses = allowed_statuses.select {|st| st.is_closed?} assert closed_statuses.empty? end - + def test_unblocked_issues_allow_closed_statuses blocking_issue = Issue.find(10) - + allowed_statuses = blocking_issue.new_statuses_allowed_to(users(:users_002)) assert !allowed_statuses.empty? closed_statuses = allowed_statuses.select {|st| st.is_closed?} assert !closed_statuses.empty? end - + def test_rescheduling_an_issue_should_reschedule_following_issue issue1 = Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :subject => '-', :start_date => Date.today, :due_date => Date.today + 2) issue2 = Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :subject => '-', :start_date => Date.today, :due_date => Date.today + 2) IssueRelation.create!(:issue_from => issue1, :issue_to => issue2, :relation_type => IssueRelation::TYPE_PRECEDES) assert_equal issue1.due_date + 1, issue2.reload.start_date - + issue1.due_date = Date.today + 5 issue1.save! assert_equal issue1.due_date + 1, issue2.reload.start_date end - + def test_overdue assert Issue.new(:due_date => 1.day.ago.to_date).overdue? assert !Issue.new(:due_date => Date.today).overdue? @@ -582,13 +582,13 @@ class IssueTest < ActiveSupport::TestCase should "not show the issue author twice" do assignable_user_ids = Issue.find(1).assignable_users.collect(&:id) assert_equal 2, assignable_user_ids.length - + assignable_user_ids.each do |user_id| assert_equal 1, assignable_user_ids.select {|i| i == user_id}.length, "User #{user_id} appears more or less than once" end end end - + def test_create_should_send_email_notification ActionMailer::Base.deliveries.clear issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, :status_id => 1, :priority => IssuePriority.all.first, :subject => 'test_create', :estimated_hours => '1:30') @@ -601,13 +601,13 @@ class IssueTest < ActiveSupport::TestCase ActionMailer::Base.deliveries.clear issue = Issue.find(1) stale = Issue.find(1) - + issue.init_journal(User.find(1)) issue.subject = 'Subjet update' assert issue.save assert_equal 1, ActionMailer::Base.deliveries.size ActionMailer::Base.deliveries.clear - + stale.init_journal(User.find(1)) stale.subject = 'Another subjet update' assert_raise ActiveRecord::StaleObjectError do @@ -615,33 +615,33 @@ class IssueTest < ActiveSupport::TestCase end assert ActionMailer::Base.deliveries.empty? end - + def test_journalized_description IssueCustomField.delete_all - + i = Issue.first old_description = i.description new_description = "This is the new description" - + i.init_journal(User.find(2)) i.description = new_description assert_difference 'IssueJournal.count', 1 do i.save! end - + journal = IssueJournal.first(:order => 'id DESC') assert_equal i, journal.journaled assert journal.changes.has_key? "description" assert_equal old_description, journal.old_value("description") assert_equal new_description, journal.value("description") end - + def test_all_dependent_issues IssueRelation.delete_all assert IssueRelation.create!(:issue_from => Issue.find(1), :issue_to => Issue.find(2), :relation_type => IssueRelation::TYPE_PRECEDES) assert IssueRelation.create!(:issue_from => Issue.find(2), :issue_to => Issue.find(3), :relation_type => IssueRelation::TYPE_PRECEDES) assert IssueRelation.create!(:issue_from => Issue.find(3), :issue_to => Issue.find(8), :relation_type => IssueRelation::TYPE_PRECEDES) - + assert_equal [2, 3, 8], Issue.find(1).all_dependent_issues.collect(&:id).sort end @@ -651,7 +651,7 @@ class IssueTest < ActiveSupport::TestCase assert IssueRelation.create!(:issue_from => Issue.find(2), :issue_to => Issue.find(3), :relation_type => IssueRelation::TYPE_PRECEDES) # Validation skipping assert IssueRelation.new(:issue_from => Issue.find(3), :issue_to => Issue.find(1), :relation_type => IssueRelation::TYPE_PRECEDES).save(false) - + assert_equal [2, 3], Issue.find(1).all_dependent_issues.collect(&:id).sort end @@ -663,10 +663,10 @@ class IssueTest < ActiveSupport::TestCase # Validation skipping assert IssueRelation.new(:issue_from => Issue.find(8), :issue_to => Issue.find(2), :relation_type => IssueRelation::TYPE_RELATES).save(false) assert IssueRelation.new(:issue_from => Issue.find(3), :issue_to => Issue.find(1), :relation_type => IssueRelation::TYPE_RELATES).save(false) - + assert_equal [2, 3, 8], Issue.find(1).all_dependent_issues.collect(&:id).sort end - + context "#done_ratio" do setup do @issue = Issue.find(1) @@ -676,12 +676,12 @@ class IssueTest < ActiveSupport::TestCase @issue_status2 = IssueStatus.find(2) @issue_status2.update_attribute(:default_done_ratio, 0) end - + context "with Setting.issue_done_ratio using the issue_field" do setup do Setting.issue_done_ratio = 'issue_field' end - + should "read the issue's field" do assert_equal 0, @issue.done_ratio assert_equal 30, @issue2.done_ratio @@ -692,7 +692,7 @@ class IssueTest < ActiveSupport::TestCase setup do Setting.issue_done_ratio = 'issue_status' end - + should "read the Issue Status's default done ratio" do assert_equal 50, @issue.done_ratio assert_equal 0, @issue2.done_ratio @@ -709,12 +709,12 @@ class IssueTest < ActiveSupport::TestCase @issue_status2 = IssueStatus.find(2) @issue_status2.update_attribute(:default_done_ratio, 0) end - + context "with Setting.issue_done_ratio using the issue_field" do setup do Setting.issue_done_ratio = 'issue_field' end - + should "not change the issue" do @issue.update_done_ratio_from_issue_status @issue2.update_done_ratio_from_issue_status @@ -728,7 +728,7 @@ class IssueTest < ActiveSupport::TestCase setup do Setting.issue_done_ratio = 'issue_status' end - + should "change the issue's done ratio" do @issue.update_done_ratio_from_issue_status @issue2.update_done_ratio_from_issue_status @@ -780,19 +780,19 @@ class IssueTest < ActiveSupport::TestCase assert_equal 2, groups.size assert_equal 5, groups.inject(0) {|sum, group| sum + group['total'].to_i} end - - + + context ".allowed_target_projects_on_move" do should "return all active projects for admin users" do User.current = User.find(1) assert_equal Project.active.count, Issue.allowed_target_projects_on_move.size end - + should "return allowed projects for non admin users" do User.current = User.find(2) Role.non_member.remove_permission! :move_issues assert_equal 3, Issue.allowed_target_projects_on_move.size - + Role.non_member.add_permission! :move_issues assert_equal Project.active.count, Issue.allowed_target_projects_on_move.size end @@ -806,7 +806,7 @@ class IssueTest < ActiveSupport::TestCase def test_on_active_projects_scope assert Project.find(2).archive - + before = Issue.on_active_project.length # test inclusion to results issue = Issue.generate_for_project!(Project.find(1), :tracker => Project.find(2).trackers.first) @@ -825,7 +825,7 @@ class IssueTest < ActiveSupport::TestCase @assignee = User.generate_with_protected! @issue = Issue.generate_for_project!(@project, :assigned_to => @assignee, :author => @author) end - + should "include project recipients" do assert @project.recipients.present? @project.recipients.each do |project_recipient| @@ -837,7 +837,7 @@ class IssueTest < ActiveSupport::TestCase assert @issue.author, "No author set for Issue" assert @issue.recipients.include?(@issue.author.mail) end - + should "include the assigned to user if the assigned to user is active" do assert @issue.assigned_to, "No assigned_to set for Issue" assert @issue.recipients.include?(@issue.assigned_to.mail) @@ -862,7 +862,7 @@ class IssueTest < ActiveSupport::TestCase end end - + def test_create_should_not_send_email_notification_if_told_not_to ActionMailer::Base.deliveries.clear issue = Issue.new(:project_id => 1, :tracker_id => 1, :author_id => 3, :status_id => 1, :priority => IssuePriority.first, :subject => 'test_create', :estimated_hours => '1:30') diff --git a/test/unit/journal_observer_test.rb b/test/unit/journal_observer_test.rb index 79b4b250..cbc96ad0 100644 --- a/test/unit/journal_observer_test.rb +++ b/test/unit/journal_observer_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -61,7 +61,7 @@ class JournalObserverTest < ActiveSupport::TestCase issue = Issue.find(:first) user = User.find(:first) issue.init_journal(user, 'This update has a note') - + assert issue.save assert_equal 0, ActionMailer::Base.deliveries.size end @@ -84,7 +84,7 @@ class JournalObserverTest < ActiveSupport::TestCase user = User.find(:first) issue.init_journal(user) issue.status = IssueStatus.last - + assert issue.save assert_equal 0, ActionMailer::Base.deliveries.size end @@ -107,7 +107,7 @@ class JournalObserverTest < ActiveSupport::TestCase user = User.find(:first) issue.init_journal(user) issue.priority = IssuePriority.last - + assert issue.save assert_equal 0, ActionMailer::Base.deliveries.size end diff --git a/test/unit/journal_test.rb b/test/unit/journal_test.rb index ac141721..6c3de0da 100644 --- a/test/unit/journal_test.rb +++ b/test/unit/journal_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -29,9 +29,9 @@ class JournalTest < ActiveSupport::TestCase status = @journal.new_status assert_not_nil status assert_kind_of IssueStatus, status - assert_equal 2, status.id + assert_equal 2, status.id end - + def test_create_should_send_email_notification ActionMailer::Base.deliveries.clear issue = Issue.find(:first) @@ -45,7 +45,7 @@ class JournalTest < ActiveSupport::TestCase issue.update_attribute(:subject, "New subject to trigger automatic journal entry") assert_equal 1, ActionMailer::Base.deliveries.size end - + def test_create_should_not_send_email_notification_if_told_not_to ActionMailer::Base.deliveries.clear issue = Issue.find(:first) diff --git a/test/unit/lib/chili_project/database_test.rb b/test/unit/lib/chili_project/database_test.rb index e2e3010d..38229f8c 100644 --- a/test/unit/lib/chili_project/database_test.rb +++ b/test/unit/lib/chili_project/database_test.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. #++ require File.expand_path('../../../../test_helper', __FILE__) diff --git a/test/unit/lib/redmine/access_control_test.rb b/test/unit/lib/redmine/access_control_test.rb index 020b182a..6e58abfb 100644 --- a/test/unit/lib/redmine/access_control_test.rb +++ b/test/unit/lib/redmine/access_control_test.rb @@ -1,29 +1,29 @@ #-- 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. #++ require File.expand_path('../../../../test_helper', __FILE__) class Redmine::AccessControlTest < ActiveSupport::TestCase - + def setup @access_module = Redmine::AccessControl end - + def test_permissions perms = @access_module.permissions assert perms.is_a?(Array) assert perms.first.is_a?(Redmine::AccessControl::Permission) end - + def test_module_permission perm = @access_module.permission(:view_issues) assert perm.is_a?(Redmine::AccessControl::Permission) @@ -32,7 +32,7 @@ class Redmine::AccessControlTest < ActiveSupport::TestCase assert perm.actions.is_a?(Array) assert perm.actions.include?('issues/index') end - + def test_no_module_permission perm = @access_module.permission(:edit_project) assert perm.is_a?(Redmine::AccessControl::Permission) diff --git a/test/unit/lib/redmine/ciphering_test.rb b/test/unit/lib/redmine/ciphering_test.rb index 4c3237ef..01894463 100644 --- a/test/unit/lib/redmine/ciphering_test.rb +++ b/test/unit/lib/redmine/ciphering_test.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. #++ require File.expand_path('../../../../test_helper', __FILE__) class Redmine::CipheringTest < ActiveSupport::TestCase - + def test_password_should_be_encrypted Redmine::Configuration.with 'database_cipher_key' => 'secret' do r = Repository::Subversion.generate!(:password => 'foo') @@ -21,7 +21,7 @@ class Redmine::CipheringTest < ActiveSupport::TestCase assert r.read_attribute(:password).match(/\Aaes-256-cbc:.+\Z/) end end - + def test_password_should_be_clear_with_blank_key Redmine::Configuration.with 'database_cipher_key' => '' do r = Repository::Subversion.generate!(:password => 'foo') @@ -29,7 +29,7 @@ class Redmine::CipheringTest < ActiveSupport::TestCase assert_equal 'foo', r.read_attribute(:password) end end - + def test_password_should_be_clear_with_nil_key Redmine::Configuration.with 'database_cipher_key' => nil do r = Repository::Subversion.generate!(:password => 'foo') @@ -37,25 +37,25 @@ class Redmine::CipheringTest < ActiveSupport::TestCase assert_equal 'foo', r.read_attribute(:password) end end - + def test_unciphered_password_should_be_readable Redmine::Configuration.with 'database_cipher_key' => nil do r = Repository::Subversion.generate!(:password => 'clear') end - + Redmine::Configuration.with 'database_cipher_key' => 'secret' do r = Repository.first(:order => 'id DESC') assert_equal 'clear', r.password end end - + def test_encrypt_all Repository.delete_all Redmine::Configuration.with 'database_cipher_key' => nil do Repository::Subversion.generate!(:password => 'foo') Repository::Subversion.generate!(:password => 'bar') end - + Redmine::Configuration.with 'database_cipher_key' => 'secret' do assert Repository.encrypt_all(:password) r = Repository.first(:order => 'id DESC') @@ -63,13 +63,13 @@ class Redmine::CipheringTest < ActiveSupport::TestCase assert r.read_attribute(:password).match(/\Aaes-256-cbc:.+\Z/) end end - + def test_decrypt_all Repository.delete_all Redmine::Configuration.with 'database_cipher_key' => 'secret' do Repository::Subversion.generate!(:password => 'foo') Repository::Subversion.generate!(:password => 'bar') - + assert Repository.decrypt_all(:password) r = Repository.first(:order => 'id DESC') assert_equal 'bar', r.password diff --git a/test/unit/lib/redmine/configuration_test.rb b/test/unit/lib/redmine/configuration_test.rb index e732f983..5309353a 100644 --- a/test/unit/lib/redmine/configuration_test.rb +++ b/test/unit/lib/redmine/configuration_test.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. #++ require File.expand_path('../../../../test_helper', __FILE__) @@ -20,22 +20,22 @@ class Redmine::ConfigurationTest < ActiveSupport::TestCase def test_empty assert_kind_of Hash, load_conf('empty.yml', 'test') end - + def test_default assert_kind_of Hash, load_conf('default.yml', 'test') assert_equal 'foo', @conf['somesetting'] end - + def test_no_default assert_kind_of Hash, load_conf('no_default.yml', 'test') assert_equal 'foo', @conf['somesetting'] end - + def test_overrides assert_kind_of Hash, load_conf('overrides.yml', 'test') assert_equal 'bar', @conf['somesetting'] end - + def test_with load_conf('default.yml', 'test') assert_equal 'foo', @conf['somesetting'] @@ -44,9 +44,9 @@ class Redmine::ConfigurationTest < ActiveSupport::TestCase end assert_equal 'foo', @conf['somesetting'] end - + private - + def load_conf(file, env) @conf.load( :file => File.join(Rails.root, 'test', 'fixtures', 'configuration', file), diff --git a/test/unit/lib/redmine/helpers/calendar_test.rb b/test/unit/lib/redmine/helpers/calendar_test.rb index c9b2af3f..2d7f93a1 100644 --- a/test/unit/lib/redmine/helpers/calendar_test.rb +++ b/test/unit/lib/redmine/helpers/calendar_test.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. #++ require File.expand_path('../../../../../test_helper', __FILE__) class CalendarTest < ActiveSupport::TestCase - + def test_monthly c = Redmine::Helpers::Calendar.new(Date.today, :fr, :month) assert_equal [1, 7], [c.startdt.cwday, c.enddt.cwday] - + c = Redmine::Helpers::Calendar.new('2007-07-14'.to_date, :fr, :month) - assert_equal ['2007-06-25'.to_date, '2007-08-05'.to_date], [c.startdt, c.enddt] - + assert_equal ['2007-06-25'.to_date, '2007-08-05'.to_date], [c.startdt, c.enddt] + c = Redmine::Helpers::Calendar.new(Date.today, :en, :month) assert_equal [7, 6], [c.startdt.cwday, c.enddt.cwday] end @@ -28,14 +28,14 @@ class CalendarTest < ActiveSupport::TestCase def test_weekly c = Redmine::Helpers::Calendar.new(Date.today, :fr, :week) assert_equal [1, 7], [c.startdt.cwday, c.enddt.cwday] - + c = Redmine::Helpers::Calendar.new('2007-07-14'.to_date, :fr, :week) assert_equal ['2007-07-09'.to_date, '2007-07-15'.to_date], [c.startdt, c.enddt] c = Redmine::Helpers::Calendar.new(Date.today, :en, :week) assert_equal [7, 6], [c.startdt.cwday, c.enddt.cwday] end - + def test_monthly_start_day [1, 6, 7].each do |day| with_settings :start_of_week => day do @@ -45,7 +45,7 @@ class CalendarTest < ActiveSupport::TestCase end end end - + def test_weekly_start_day [1, 6, 7].each do |day| with_settings :start_of_week => day do diff --git a/test/unit/lib/redmine/helpers/gantt_test.rb b/test/unit/lib/redmine/helpers/gantt_test.rb index 5da61b33..879fc53d 100644 --- a/test/unit/lib/redmine/helpers/gantt_test.rb +++ b/test/unit/lib/redmine/helpers/gantt_test.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. #++ require File.expand_path('../../../../../test_helper', __FILE__) @@ -21,7 +21,7 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase include ApplicationHelper include ProjectsHelper include IssuesHelper - + def self.default_url_options {:only_path => true } end @@ -73,7 +73,7 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase 5.times do Issue.generate_for_project!(p) end - + create_gantt(p) @gantt.render assert_equal 6, @gantt.number_of_rows @@ -104,7 +104,7 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase version = Version.generate! @project.versions << version @project.issues << Issue.generate_for_project!(@project, :fixed_version => version) - + assert_equal 3, @gantt.number_of_rows_on_project(@project) end end @@ -126,56 +126,56 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase :done_ratio => 30, :start_date => Date.yesterday, :due_date => 1.week.from_now.to_date) - @project.issues << @issue + @project.issues << @issue end - + context "project" do should "be rendered" do @response.body = @gantt.subjects assert_select "div.project-name a", /#{@project.name}/ end - + should "have an indent of 4" do @response.body = @gantt.subjects assert_select "div.project-name[style*=left:4px]" end end - + context "version" do should "be rendered" do @response.body = @gantt.subjects assert_select "div.version-name a", /#{@version.name}/ end - + should "be indented 24 (one level)" do @response.body = @gantt.subjects assert_select "div.version-name[style*=left:24px]" end - + context "without assigned issues" do setup do @version = Version.generate!(:effective_date => 2.week.from_now.to_date, :sharing => 'none', :name => 'empty_version') @project.versions << @version end - + should "not be rendered" do @response.body = @gantt.subjects assert_select "div.version-name a", :text => /#{@version.name}/, :count => 0 end end end - + context "issue" do should "be rendered" do @response.body = @gantt.subjects assert_select "div.issue-subject", /#{@issue.subject}/ end - + should "be indented 44 (two levels)" do @response.body = @gantt.subjects assert_select "div.issue-subject[style*=left:44px]" end - + context "assigned to a shared version of another project" do setup do p = Project.generate! @@ -184,7 +184,7 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase @shared_version = Version.generate!(:sharing => 'system') p.versions << @shared_version # Reassign the issue to a shared version of another project - + @issue = Issue.generate!(:fixed_version => @shared_version, :subject => "gantt#assigned_to_shared_version", :tracker => @tracker, @@ -194,13 +194,13 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase :due_date => 1.week.from_now.to_date) @project.issues << @issue end - + should "be rendered" do @response.body = @gantt.subjects assert_select "div.issue-subject", /#{@issue.subject}/ end end - + context "with subtasks" do setup do attrs = {:project => @project, :tracker => @tracker, :fixed_version => @version} @@ -208,7 +208,7 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase @child2 = Issue.generate!(attrs.merge(:subject => 'child2', :parent_issue_id => @issue.id, :start_date => Date.today, :due_date => 1.week.from_now.to_date)) @grandchild = Issue.generate!(attrs.merge(:subject => 'grandchild', :parent_issue_id => @child1.id, :start_date => Date.yesterday, :due_date => 2.day.from_now.to_date)) end - + should "indent subtasks" do @response.body = @gantt.subjects # parent task 44px @@ -286,7 +286,7 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase setup do create_gantt end - + context ":html format" do should "add an absolute positioned div" do @response.body = @gantt.subject_for_project(@project, {:format => :html}) @@ -411,7 +411,7 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase assert_select "div.project.ending[style*=left:88px]", true, @response.body end end - + context "status content" do should "appear at the far left, even if it's far in the past" do @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) @@ -578,7 +578,7 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase assert_select "div.version.ending[style*=left:88px]", true, @response.body end end - + context "status content" do should "appear at the far left, even if it's far in the past" do @gantt.instance_variable_set('@date_to', 2.weeks.ago.to_date) @@ -710,12 +710,12 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase should "not be the total done width if the chart starts after issue start date" do create_gantt(@project, :date_from => 5.days.ago.to_date) - + @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) assert_select "div.task_done[style*=left:0px]", true, @response.body assert_select "div.task_done[style*=width:8px]", true, @response.body end - + context "for completed issue" do setup do @issue.done_ratio = 100 @@ -725,7 +725,7 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) assert_select "div.task_done[style*=width:58px]", true, @response.body end - + should "be the total width of the issue with due_date=start_date" do @issue.due_date = @issue.start_date @response.body = @gantt.line_for_issue(@issue, {:format => :html, :zoom => 4}) @@ -770,5 +770,5 @@ class Redmine::Helpers::GanttTest < ActiveSupport::TestCase context "#to_pdf" do should "be tested" end - + end diff --git a/test/unit/lib/redmine/hook_test.rb b/test/unit/lib/redmine/hook_test.rb index 0a54073f..f1948b9b 100644 --- a/test/unit/lib/redmine/hook_test.rb +++ b/test/unit/lib/redmine/hook_test.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. #++ require File.expand_path('../../../../test_helper', __FILE__) @@ -15,10 +15,10 @@ require File.expand_path('../../../../test_helper', __FILE__) class Redmine::Hook::ManagerTest < ActiveSupport::TestCase fixtures :issues - + # Some hooks that are manually registered in these tests class TestHook < Redmine::Hook::ViewListener; end - + class TestHook1 < TestHook def view_layouts_base_html_head(context) 'Test hook 1 listener.' @@ -30,13 +30,13 @@ class Redmine::Hook::ManagerTest < ActiveSupport::TestCase 'Test hook 2 listener.' end end - + class TestHook3 < TestHook def view_layouts_base_html_head(context) "Context keys: #{context.keys.collect(&:to_s).sort.join(', ')}." end end - + class TestLinkToHook < TestHook def view_layouts_base_html_head(context) link_to('Issues', :controller => 'issues') @@ -46,54 +46,54 @@ class Redmine::Hook::ManagerTest < ActiveSupport::TestCase class TestHookHelperController < ActionController::Base include Redmine::Hook::Helper end - + class TestHookHelperView < ActionView::Base include Redmine::Hook::Helper end - + Redmine::Hook.clear_listeners - + def setup @hook_module = Redmine::Hook end - + def teardown @hook_module.clear_listeners end - + def test_clear_listeners assert_equal 0, @hook_module.hook_listeners(:view_layouts_base_html_head).size @hook_module.add_listener(TestHook1) @hook_module.add_listener(TestHook2) assert_equal 2, @hook_module.hook_listeners(:view_layouts_base_html_head).size - + @hook_module.clear_listeners assert_equal 0, @hook_module.hook_listeners(:view_layouts_base_html_head).size end - + def test_add_listener assert_equal 0, @hook_module.hook_listeners(:view_layouts_base_html_head).size @hook_module.add_listener(TestHook1) assert_equal 1, @hook_module.hook_listeners(:view_layouts_base_html_head).size end - + def test_call_hook @hook_module.add_listener(TestHook1) assert_equal ['Test hook 1 listener.'], hook_helper.call_hook(:view_layouts_base_html_head) end - + def test_call_hook_with_context @hook_module.add_listener(TestHook3) assert_equal ['Context keys: bar, controller, foo, project, request.'], hook_helper.call_hook(:view_layouts_base_html_head, :foo => 1, :bar => 'a') end - + def test_call_hook_with_multiple_listeners @hook_module.add_listener(TestHook1) @hook_module.add_listener(TestHook2) assert_equal ['Test hook 1 listener.', 'Test hook 2 listener.'], hook_helper.call_hook(:view_layouts_base_html_head) end - + # Context: Redmine::Hook::Helper.call_hook default_url def test_call_hook_default_url_options @hook_module.add_listener(TestLinkToHook) @@ -106,27 +106,27 @@ class Redmine::Hook::ManagerTest < ActiveSupport::TestCase @hook_module.add_listener(TestHook3) assert_match /project/i, hook_helper.call_hook(:view_layouts_base_html_head)[0] end - + def test_call_hook_from_controller_with_controller_added_to_context @hook_module.add_listener(TestHook3) assert_match /controller/i, hook_helper.call_hook(:view_layouts_base_html_head)[0] end - + def test_call_hook_from_controller_with_request_added_to_context @hook_module.add_listener(TestHook3) assert_match /request/i, hook_helper.call_hook(:view_layouts_base_html_head)[0] end - + def test_call_hook_from_view_with_project_added_to_context @hook_module.add_listener(TestHook3) assert_match /project/i, view_hook_helper.call_hook(:view_layouts_base_html_head) end - + def test_call_hook_from_view_with_controller_added_to_context @hook_module.add_listener(TestHook3) assert_match /controller/i, view_hook_helper.call_hook(:view_layouts_base_html_head) end - + def test_call_hook_from_view_with_request_added_to_context @hook_module.add_listener(TestHook3) assert_match /request/i, view_hook_helper.call_hook(:view_layouts_base_html_head) @@ -141,21 +141,21 @@ class Redmine::Hook::ManagerTest < ActiveSupport::TestCase def test_call_hook_should_not_change_the_default_url_for_email_notifications issue = Issue.find(1) - + ActionMailer::Base.deliveries.clear Mailer.deliver_issue_add(issue) mail = ActionMailer::Base.deliveries.last - + @hook_module.add_listener(TestLinkToHook) hook_helper.call_hook(:view_layouts_base_html_head) - + ActionMailer::Base.deliveries.clear Mailer.deliver_issue_add(issue) mail2 = ActionMailer::Base.deliveries.last - + assert_equal mail.body, mail2.body end - + def hook_helper @hook_helper ||= TestHookHelperController.new end diff --git a/test/unit/lib/redmine/i18n_test.rb b/test/unit/lib/redmine/i18n_test.rb index d78835c3..2d9b40de 100644 --- a/test/unit/lib/redmine/i18n_test.rb +++ b/test/unit/lib/redmine/i18n_test.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. #++ require File.expand_path('../../../../test_helper', __FILE__) @@ -15,25 +15,25 @@ require File.expand_path('../../../../test_helper', __FILE__) class Redmine::I18nTest < ActiveSupport::TestCase include Redmine::I18n include ActionView::Helpers::NumberHelper - + def setup @hook_module = Redmine::Hook end - + def test_date_format_default set_language_if_valid 'en' today = Date.today - Setting.date_format = '' + Setting.date_format = '' assert_equal I18n.l(today), format_date(today) end - + def test_date_format set_language_if_valid 'en' today = Date.today Setting.date_format = '%d %m %Y' assert_equal today.strftime('%d %m %Y'), format_date(today) end - + def test_date_and_time_for_each_language Setting.date_format = '' valid_languages.each do |lang| @@ -47,12 +47,12 @@ class Redmine::I18nTest < ActiveSupport::TestCase end assert l('date.day_names').is_a?(Array) assert_equal 7, l('date.day_names').size - + assert l('date.month_names').is_a?(Array) assert_equal 13, l('date.month_names').size end end - + def test_time_format set_language_if_valid 'en' now = Time.parse('2011-02-20 15:45:22') @@ -61,14 +61,14 @@ class Redmine::I18nTest < ActiveSupport::TestCase assert_equal '02/20/2011 15:45', format_time(now) assert_equal '15:45', format_time(now, false) end - + with_settings :date_format => '%Y-%m-%d' do assert_equal '2011-02-20 15:45', format_time(now) assert_equal '15:45', format_time(now, false) end end end - + def test_time_format_default set_language_if_valid 'en' now = Time.parse('2011-02-20 15:45:22') @@ -77,14 +77,14 @@ class Redmine::I18nTest < ActiveSupport::TestCase assert_equal '02/20/2011 03:45 pm', format_time(now) assert_equal '03:45 pm', format_time(now, false) end - + with_settings :date_format => '%Y-%m-%d' do assert_equal '2011-02-20 03:45 pm', format_time(now) assert_equal '03:45 pm', format_time(now, false) end end end - + def test_time_format set_language_if_valid 'en' now = Time.now @@ -93,7 +93,7 @@ class Redmine::I18nTest < ActiveSupport::TestCase assert_equal now.strftime('%d %m %Y %H %M'), format_time(now) assert_equal now.strftime('%H %M'), format_time(now, false) end - + def test_utc_time_format set_language_if_valid 'en' now = Time.now.utc @@ -102,7 +102,7 @@ class Redmine::I18nTest < ActiveSupport::TestCase assert_equal Time.now.strftime('%d %m %Y %H %M'), format_time(now) assert_equal Time.now.strftime('%H %M'), format_time(now, false) end - + def test_number_to_human_size_for_each_language valid_languages.each do |lang| set_language_if_valid lang @@ -111,12 +111,12 @@ class Redmine::I18nTest < ActiveSupport::TestCase end end end - + def test_valid_languages assert valid_languages.is_a?(Array) assert valid_languages.first.is_a?(Symbol) end - + def test_valid_language to_test = {'fr' => :fr, 'Fr' => :fr, @@ -124,17 +124,17 @@ class Redmine::I18nTest < ActiveSupport::TestCase 'zh-tw' => :"zh-TW", 'zh-TW' => :"zh-TW", 'zh-ZZ' => nil } - + to_test.each {|lang, expected| assert_equal expected, find_language(lang)} end - + def test_fallback ::I18n.backend.store_translations(:en, {:untranslated => "Untranslated string"}) ::I18n.locale = 'en' assert_equal "Untranslated string", l(:untranslated) ::I18n.locale = 'fr' assert_equal "Untranslated string", l(:untranslated) - + ::I18n.backend.store_translations(:fr, {:untranslated => "Pas de traduction"}) ::I18n.locale = 'en' assert_equal "Untranslated string", l(:untranslated) diff --git a/test/unit/lib/redmine/menu_manager/mapper_test.rb b/test/unit/lib/redmine/menu_manager/mapper_test.rb index 93d5d71f..2f717f43 100644 --- a/test/unit/lib/redmine/menu_manager/mapper_test.rb +++ b/test/unit/lib/redmine/menu_manager/mapper_test.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. #++ require File.expand_path('../../../../../test_helper', __FILE__) @@ -59,9 +59,9 @@ class Redmine::MenuManager::MapperTest < ActiveSupport::TestCase assert_not_nil root.children[position] assert_equal name, root.children[position].name end - + end - + def test_push_before menu_mapper = Redmine::MenuManager::Mapper.new(:test_menu, {}) menu_mapper.push :test_first, { :controller => 'projects', :action => 'show'}, {} @@ -76,7 +76,7 @@ class Redmine::MenuManager::MapperTest < ActiveSupport::TestCase assert_not_nil root.children[position] assert_equal name, root.children[position].name end - + end def test_push_after @@ -87,14 +87,14 @@ class Redmine::MenuManager::MapperTest < ActiveSupport::TestCase menu_mapper.push :test_fifth, { :controller => 'projects', :action => 'show'}, {} menu_mapper.push :test_fourth, { :controller => 'projects', :action => 'show'}, {:after => :test_third} - + root = menu_mapper.find(:root) assert_equal 5, root.children.size {0 => :test_first, 1 => :test_second, 2 => :test_third, 3 => :test_fourth, 4 => :test_fifth}.each do |position, name| assert_not_nil root.children[position] assert_equal name, root.children[position].name end - + end def test_push_last @@ -111,9 +111,9 @@ class Redmine::MenuManager::MapperTest < ActiveSupport::TestCase assert_not_nil root.children[position] assert_equal name, root.children[position].name end - + end - + def test_exists_for_child_node menu_mapper = Redmine::MenuManager::Mapper.new(:test_menu, {}) menu_mapper.push :test_overview, { :controller => 'projects', :action => 'show'}, {} diff --git a/test/unit/lib/redmine/menu_manager/menu_helper_test.rb b/test/unit/lib/redmine/menu_manager/menu_helper_test.rb index 5b386779..ce5c3d03 100644 --- a/test/unit/lib/redmine/menu_manager/menu_helper_test.rb +++ b/test/unit/lib/redmine/menu_manager/menu_helper_test.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. #++ require File.expand_path('../../../../../test_helper', __FILE__) @@ -23,7 +23,7 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase def html_document HTML::Document.new(@response.body) end - + def setup super @response = ActionController::TestResponse.new @@ -32,7 +32,7 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase :index end end - + context "MenuManager#current_menu_item" do should "be tested" @@ -69,7 +69,7 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase assert_select("a.single-node", "Single node") end end - + def test_render_menu_node_with_nested_items parent_node = Redmine::MenuManager::MenuItem.new(:parent_node, '/test', { }) parent_node << Redmine::MenuManager::MenuItem.new(:child_one_node, '/test', { }) @@ -93,12 +93,12 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase end end end - + end def test_render_menu_node_with_children User.current = User.find(2) - + parent_node = Redmine::MenuManager::MenuItem.new(:parent_node, '/test', { @@ -183,7 +183,7 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase @response.body = render_menu_node(parent_node, Project.find(1)) end end - + def test_render_menu_node_with_incorrect_children parent_node = Redmine::MenuManager::MenuItem.new(:parent_node, '/test', @@ -209,7 +209,7 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase menu_items_for(menu_name) do |item| items_yielded << item end - + assert_equal 3, items_yielded.size end @@ -234,11 +234,11 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase end User.current = User.find(2) - + items = menu_items_for(menu_name, Project.find(1)) assert_equal 2, items.size end - + def test_menu_items_for_should_skip_items_that_fail_the_conditions menu_name = :test_menu_items_for_should_skip_items_that_fail_the_conditions Redmine::MenuManager.map menu_name do |menu| @@ -249,7 +249,7 @@ class Redmine::MenuManager::MenuHelperTest < HelperTestCase end User.current = User.find(2) - + items = menu_items_for(menu_name, Project.find(1)) assert_equal 1, items.size end diff --git a/test/unit/lib/redmine/menu_manager/menu_item_test.rb b/test/unit/lib/redmine/menu_manager/menu_item_test.rb index c529bf95..90fa32dd 100644 --- a/test/unit/lib/redmine/menu_manager/menu_item_test.rb +++ b/test/unit/lib/redmine/menu_manager/menu_item_test.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. #++ require File.expand_path('../../../../../test_helper', __FILE__) @@ -27,7 +27,7 @@ class Redmine::MenuManager::MenuItemTest < ActiveSupport::TestCase menu.push(:child_menu, '/test', { :parent => :parent}) menu.push(:child2_menu, '/test', { :parent => :parent}) end - + context "MenuItem#caption" do should "be tested" end diff --git a/test/unit/lib/redmine/menu_manager_test.rb b/test/unit/lib/redmine/menu_manager_test.rb index d4ab903a..920b4e7b 100644 --- a/test/unit/lib/redmine/menu_manager_test.rb +++ b/test/unit/lib/redmine/menu_manager_test.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. #++ require File.expand_path('../../../../test_helper', __FILE__) diff --git a/test/unit/lib/redmine/mime_type_test.rb b/test/unit/lib/redmine/mime_type_test.rb index 9f07fc9c..0b44dc0b 100644 --- a/test/unit/lib/redmine/mime_type_test.rb +++ b/test/unit/lib/redmine/mime_type_test.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. #++ require File.expand_path('../../../../test_helper', __FILE__) class Redmine::MimeTypeTest < ActiveSupport::TestCase - + def test_of to_test = {'test.unk' => nil, 'test.txt' => 'text/plain', @@ -23,7 +23,7 @@ class Redmine::MimeTypeTest < ActiveSupport::TestCase assert_equal expected, Redmine::MimeType.of(name) end end - + def test_css_class_of to_test = {'test.unk' => nil, 'test.txt' => 'text-plain', @@ -33,7 +33,7 @@ class Redmine::MimeTypeTest < ActiveSupport::TestCase assert_equal expected, Redmine::MimeType.css_class_of(name) end end - + def test_main_mimetype_of to_test = {'test.unk' => nil, 'test.txt' => 'text', @@ -43,7 +43,7 @@ class Redmine::MimeTypeTest < ActiveSupport::TestCase assert_equal expected, Redmine::MimeType.main_mimetype_of(name) end end - + def test_is_type to_test = {['text', 'test.unk'] => false, ['text', 'test.txt'] => true, diff --git a/test/unit/lib/redmine/notifiable_test.rb b/test/unit/lib/redmine/notifiable_test.rb index ae35f543..a6196375 100644 --- a/test/unit/lib/redmine/notifiable_test.rb +++ b/test/unit/lib/redmine/notifiable_test.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. #++ require File.expand_path('../../../../test_helper', __FILE__) diff --git a/test/unit/lib/redmine/plugin_test.rb b/test/unit/lib/redmine/plugin_test.rb index 6121e1e2..4fdd45f9 100644 --- a/test/unit/lib/redmine/plugin_test.rb +++ b/test/unit/lib/redmine/plugin_test.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. #++ require File.expand_path('../../../../test_helper', __FILE__) @@ -19,11 +19,11 @@ class Redmine::PluginTest < ActiveSupport::TestCase # In case some real plugins are installed @klass.clear end - + def teardown @klass.clear end - + def test_register @klass.register :foo do name 'Foo plugin' @@ -34,9 +34,9 @@ class Redmine::PluginTest < ActiveSupport::TestCase version '0.0.1' settings :default => {'sample_setting' => 'value', 'foo'=>'bar'}, :partial => 'foo/settings' end - + assert_equal 1, @klass.all.size - + plugin = @klass.find('foo') assert plugin.is_a?(Redmine::Plugin) assert_equal :foo, plugin.id @@ -47,11 +47,11 @@ class Redmine::PluginTest < ActiveSupport::TestCase assert_equal 'This is a test plugin', plugin.description assert_equal '0.0.1', plugin.version end - + def test_requires_redmine test = self version = Redmine::VERSION.to_a.slice(0,3).join('.') - + @klass.register :foo do test.assert requires_redmine(:version_or_higher => '0.1.0') test.assert requires_redmine(:version_or_higher => version) @@ -59,7 +59,7 @@ class Redmine::PluginTest < ActiveSupport::TestCase test.assert_raise Redmine::PluginRequirementError do requires_redmine(:version_or_higher => '99.0.0') end - + test.assert requires_redmine(:version => version) test.assert requires_redmine(:version => [version, '99.0.0']) test.assert_raise Redmine::PluginRequirementError do @@ -74,12 +74,12 @@ class Redmine::PluginTest < ActiveSupport::TestCase def test_requires_redmine_plugin test = self other_version = '0.5.0' - + @klass.register :other do name 'Other' version other_version end - + @klass.register :foo do test.assert requires_redmine_plugin(:other, :version_or_higher => '0.1.0') test.assert requires_redmine_plugin(:other, :version_or_higher => other_version) @@ -87,7 +87,7 @@ class Redmine::PluginTest < ActiveSupport::TestCase test.assert_raise Redmine::PluginRequirementError do requires_redmine_plugin(:other, :version_or_higher => '99.0.0') end - + test.assert requires_redmine_plugin(:other, :version => other_version) test.assert requires_redmine_plugin(:other, :version => [other_version, '99.0.0']) test.assert_raise Redmine::PluginRequirementError do @@ -106,7 +106,7 @@ class Redmine::PluginTest < ActiveSupport::TestCase test.assert_raise Redmine::PluginNotFound do requires_redmine_plugin(:missing, :version => '0.1.0') end - + end end end diff --git a/test/unit/lib/redmine/safe_attributes_test.rb b/test/unit/lib/redmine/safe_attributes_test.rb index 49750343..5194b5b0 100644 --- a/test/unit/lib/redmine/safe_attributes_test.rb +++ b/test/unit/lib/redmine/safe_attributes_test.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. #++ require File.expand_path('../../../../test_helper', __FILE__) class Redmine::SafeAttributesTest < ActiveSupport::TestCase - + class Base def attributes=(attrs) attrs.each do |key, value| @@ -21,20 +21,20 @@ class Redmine::SafeAttributesTest < ActiveSupport::TestCase end end end - + class Person < Base attr_accessor :firstname, :lastname, :login include Redmine::SafeAttributes safe_attributes :firstname, :lastname safe_attributes :login, :if => lambda {|person, user| user.admin?} end - + class Book < Base attr_accessor :title, :isbn include Redmine::SafeAttributes safe_attributes :title end - + class PublishedBook < Book safe_attributes :isbn @@ -45,7 +45,7 @@ class Redmine::SafeAttributesTest < ActiveSupport::TestCase assert_equal ['firstname', 'lastname'], p.safe_attribute_names(User.anonymous) assert_equal ['firstname', 'lastname', 'login'], p.safe_attribute_names(User.find(1)) end - + def test_safe_attribute_names_without_user p = Person.new User.current = nil @@ -53,7 +53,7 @@ class Redmine::SafeAttributesTest < ActiveSupport::TestCase User.current = User.find(1) assert_equal ['firstname', 'lastname', 'login'], p.safe_attribute_names end - + def test_set_safe_attributes p = Person.new p.send('safe_attributes=', {'firstname' => 'John', 'lastname' => 'Smith', 'login' => 'jsmith'}, User.anonymous) @@ -68,7 +68,7 @@ class Redmine::SafeAttributesTest < ActiveSupport::TestCase assert_equal 'Smith', p.lastname assert_equal 'jsmith', p.login end - + def test_set_safe_attributes_without_user p = Person.new User.current = nil diff --git a/test/unit/lib/redmine/scm/adapters/bazaar_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/bazaar_adapter_test.rb index a0e43526..3af130b2 100644 --- a/test/unit/lib/redmine/scm/adapters/bazaar_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/bazaar_adapter_test.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 @@ begin REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/bazaar_repository' REPOSITORY_PATH.gsub!(/\/+/, '/') - if File.directory?(REPOSITORY_PATH) + if File.directory?(REPOSITORY_PATH) def setup @adapter = Redmine::Scm::Adapters::BazaarAdapter.new(REPOSITORY_PATH) end @@ -38,7 +38,7 @@ begin cat = @adapter.cat('directory/document.txt') assert cat =~ /Write the contents of a file as of a given revision to standard output/ end - + def test_annotate annotate = @adapter.annotate('doc-mkdir.txt') assert_equal 17, annotate.lines.size diff --git a/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb index c520d49e..7c3fd939 100644 --- a/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb @@ -1,27 +1,27 @@ #-- 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. #++ require File.expand_path('../../../../../../test_helper', __FILE__) begin require 'mocha' - + class CvsAdapterTest < ActiveSupport::TestCase - + REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/cvs_repository' REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin? MODULE_NAME = 'test' - if File.directory?(REPOSITORY_PATH) + if File.directory?(REPOSITORY_PATH) def setup @adapter = Redmine::Scm::Adapters::CvsAdapter.new(MODULE_NAME, REPOSITORY_PATH) end diff --git a/test/unit/lib/redmine/scm/adapters/darcs_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/darcs_adapter_test.rb index 2063f27f..efe48157 100644 --- a/test/unit/lib/redmine/scm/adapters/darcs_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/darcs_adapter_test.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. #++ require File.expand_path('../../../../../../test_helper', __FILE__) begin require 'mocha' - + class DarcsAdapterTest < ActiveSupport::TestCase - + REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/darcs_repository' if File.directory?(REPOSITORY_PATH) diff --git a/test/unit/lib/redmine/scm/adapters/filesystem_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/filesystem_adapter_test.rb index 5a9c6e1e..9340fe73 100644 --- a/test/unit/lib/redmine/scm/adapters/filesystem_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/filesystem_adapter_test.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. #++ @@ -16,9 +16,9 @@ require File.expand_path('../../../../../../test_helper', __FILE__) class FilesystemAdapterTest < ActiveSupport::TestCase - REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/filesystem_repository' + REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/filesystem_repository' - if File.directory?(REPOSITORY_PATH) + if File.directory?(REPOSITORY_PATH) def setup @adapter = Redmine::Scm::Adapters::FilesystemAdapter.new(REPOSITORY_PATH) end diff --git a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb index db0953eb..b4f52fdf 100644 --- a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb @@ -1,14 +1,14 @@ # -*- coding: utf-8 -*- #-- 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. #++ @@ -166,8 +166,8 @@ begin assert_equal 1, @adapter.annotate(p2, r1).lines.length ['64f1f3e89ad1cb57976ff0ad99a107012ba3481d', '64f1f3e89ad1cb5797'].each do |r2| assert @adapter.diff(p2, r1, r2) - end - end + end + end end end diff --git a/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb index 6a8725da..5d2e2dc7 100644 --- a/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.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. #++ @@ -254,7 +254,7 @@ begin end def test_tagmap - tm = { + tm = { @tag_char_1 => 'adf805632193', 'tag_test.00' => '6987191f453a', 'tag-init-revision' => '0885933ad4f6', diff --git a/test/unit/lib/redmine/scm/adapters/subversion_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/subversion_adapter_test.rb index b0e631cf..68e6df66 100644 --- a/test/unit/lib/redmine/scm/adapters/subversion_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/subversion_adapter_test.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,7 +17,7 @@ begin require 'mocha' class SubversionAdapterTest < ActiveSupport::TestCase - + if repository_configured?('subversion') def setup @adapter = Redmine::Scm::Adapters::SubversionAdapter.new(self.class.subversion_repository_url) diff --git a/test/unit/lib/redmine/themes_test.rb b/test/unit/lib/redmine/themes_test.rb index 2358c942..c51ec203 100644 --- a/test/unit/lib/redmine/themes_test.rb +++ b/test/unit/lib/redmine/themes_test.rb @@ -1,54 +1,54 @@ #-- 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. #++ require File.expand_path('../../../../test_helper', __FILE__) class Redmine::ThemesTest < ActiveSupport::TestCase - + def test_themes themes = Redmine::Themes.themes assert_kind_of Array, themes assert_kind_of Redmine::Themes::Theme, themes.first end - + def test_rescan Redmine::Themes.themes.pop - + assert_difference 'Redmine::Themes.themes.size' do Redmine::Themes.rescan end end - + def test_theme_loaded theme = Redmine::Themes.themes.last - + assert_equal theme, Redmine::Themes.theme(theme.id) end - + def test_theme_loaded_without_rescan theme = Redmine::Themes.themes.last - + assert_equal theme, Redmine::Themes.theme(theme.id, :rescan => false) end - + def test_theme_not_loaded theme = Redmine::Themes.themes.pop - + assert_equal theme, Redmine::Themes.theme(theme.id) end - + def test_theme_not_loaded_without_rescan theme = Redmine::Themes.themes.pop - + assert_nil Redmine::Themes.theme(theme.id, :rescan => false) end end diff --git a/test/unit/lib/redmine/unified_diff_test.rb b/test/unit/lib/redmine/unified_diff_test.rb index 859f013b..e8a47eec 100644 --- a/test/unit/lib/redmine/unified_diff_test.rb +++ b/test/unit/lib/redmine/unified_diff_test.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. #++ require File.expand_path('../../../../test_helper', __FILE__) class Redmine::UnifiedDiffTest < ActiveSupport::TestCase - + def setup end @@ -24,58 +24,58 @@ class Redmine::UnifiedDiffTest < ActiveSupport::TestCase assert_equal 4, diff.size assert diff.detect {|file| file.file_name =~ %r{^config/settings.yml}} end - + def test_truncate_diff diff = Redmine::UnifiedDiff.new(read_diff_fixture('subversion.diff'), :max_lines => 20) assert_equal 2, diff.size end - + def test_inline_partials diff = Redmine::UnifiedDiff.new(read_diff_fixture('partials.diff')) assert_equal 1, diff.size diff = diff.first assert_equal 43, diff.size - + assert_equal [51, -1], diff[0].offsets assert_equal [51, -1], diff[1].offsets assert_equal 'Lorem ipsum dolor sit amet, consectetur adipiscing elit', diff[0].html_line assert_equal 'Lorem ipsum dolor sit amet, consectetur adipiscing xx', diff[1].html_line - + assert_nil diff[2].offsets assert_equal 'Praesent et sagittis dui. Vivamus ac diam diam', diff[2].html_line - + assert_equal [0, -14], diff[3].offsets assert_equal [0, -14], diff[4].offsets assert_equal 'Ut sed auctor justo', diff[3].html_line assert_equal 'xxx auctor justo', diff[4].html_line - + assert_equal [13, -19], diff[6].offsets assert_equal [13, -19], diff[7].offsets - + assert_equal [24, -8], diff[9].offsets assert_equal [24, -8], diff[10].offsets - + assert_equal [37, -1], diff[12].offsets assert_equal [37, -1], diff[13].offsets - + assert_equal [0, -38], diff[15].offsets assert_equal [0, -38], diff[16].offsets end - + def test_side_by_side_partials diff = Redmine::UnifiedDiff.new(read_diff_fixture('partials.diff'), :type => 'sbs') assert_equal 1, diff.size diff = diff.first assert_equal 32, diff.size - + assert_equal [51, -1], diff[0].offsets assert_equal 'Lorem ipsum dolor sit amet, consectetur adipiscing elit', diff[0].html_line_left assert_equal 'Lorem ipsum dolor sit amet, consectetur adipiscing xx', diff[0].html_line_right - + assert_nil diff[1].offsets assert_equal 'Praesent et sagittis dui. Vivamus ac diam diam', diff[1].html_line_left assert_equal 'Praesent et sagittis dui. Vivamus ac diam diam', diff[1].html_line_right - + assert_equal [0, -14], diff[2].offsets assert_equal 'Ut sed auctor justo', diff[2].html_line_left assert_equal 'xxx auctor justo', diff[2].html_line_right @@ -84,9 +84,9 @@ class Redmine::UnifiedDiffTest < ActiveSupport::TestCase assert_equal [24, -8], diff[6].offsets assert_equal [37, -1], diff[8].offsets assert_equal [0, -38], diff[10].offsets - + end - + def test_line_starting_with_dashes diff = Redmine::UnifiedDiff.new(<<-DIFF --- old.txt Wed Nov 11 14:24:58 2009 @@ -98,13 +98,13 @@ class Redmine::UnifiedDiffTest < ActiveSupport::TestCase --- file.c ------------------------- +A line that starts with dashes: - + and removed. - + @@ -23,4 +19,4 @@ - - - + + + -Another chunk of change +Another chunk of changes diff --git a/test/unit/lib/redmine/views/builders/json_test.rb b/test/unit/lib/redmine/views/builders/json_test.rb index b3ab2475..f8bd07b1 100644 --- a/test/unit/lib/redmine/views/builders/json_test.rb +++ b/test/unit/lib/redmine/views/builders/json_test.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. #++ require File.expand_path('../../../../../../test_helper', __FILE__) class Redmine::Views::Builders::JsonTest < HelperTestCase - + def test_hash assert_json_output({'person' => {'name' => 'Ryan', 'age' => 32}}) do |b| b.person do @@ -23,7 +23,7 @@ class Redmine::Views::Builders::JsonTest < HelperTestCase end end end - + def test_hash_hash assert_json_output({'person' => {'name' => 'Ryan', 'birth' => {'city' => 'London', 'country' => 'UK'}}}) do |b| b.person do @@ -31,7 +31,7 @@ class Redmine::Views::Builders::JsonTest < HelperTestCase b.birth :city => 'London', :country => 'UK' end end - + assert_json_output({'person' => {'id' => 1, 'name' => 'Ryan', 'birth' => {'city' => 'London', 'country' => 'UK'}}}) do |b| b.person :id => 1 do b.name 'Ryan' @@ -39,7 +39,7 @@ class Redmine::Views::Builders::JsonTest < HelperTestCase end end end - + def test_array assert_json_output({'books' => [{'title' => 'Book 1', 'author' => 'B. Smith'}, {'title' => 'Book 2', 'author' => 'G. Cooper'}]}) do |b| b.array :books do |b| @@ -59,7 +59,7 @@ class Redmine::Views::Builders::JsonTest < HelperTestCase end end end - + def test_array_with_content_tags assert_json_output({'books' => [{'value' => 'Book 1', 'author' => 'B. Smith'}, {'value' => 'Book 2', 'author' => 'G. Cooper'}]}) do |b| b.array :books do |b| @@ -68,7 +68,7 @@ class Redmine::Views::Builders::JsonTest < HelperTestCase end end end - + def assert_json_output(expected, &block) builder = Redmine::Views::Builders::Json.new block.call(builder) diff --git a/test/unit/lib/redmine/views/builders/xml_test.rb b/test/unit/lib/redmine/views/builders/xml_test.rb index b216faca..1ea5a729 100644 --- a/test/unit/lib/redmine/views/builders/xml_test.rb +++ b/test/unit/lib/redmine/views/builders/xml_test.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. #++ require File.expand_path('../../../../../../test_helper', __FILE__) class Redmine::Views::Builders::XmlTest < HelperTestCase - + def test_hash assert_xml_output('Ryan32') do |b| b.person do @@ -23,7 +23,7 @@ class Redmine::Views::Builders::XmlTest < HelperTestCase end end end - + def test_array assert_xml_output('') do |b| b.array :books do |b| @@ -32,7 +32,7 @@ class Redmine::Views::Builders::XmlTest < HelperTestCase end end end - + def test_array_with_content_tags assert_xml_output('Book 1Book 2') do |b| b.array :books do |b| @@ -41,7 +41,7 @@ class Redmine::Views::Builders::XmlTest < HelperTestCase end end end - + def assert_xml_output(expected, &block) builder = Redmine::Views::Builders::Xml.new block.call(builder) diff --git a/test/unit/lib/redmine/wiki_formatting.rb b/test/unit/lib/redmine/wiki_formatting.rb index 0a20fe77..8f27161c 100644 --- a/test/unit/lib/redmine/wiki_formatting.rb +++ b/test/unit/lib/redmine/wiki_formatting.rb @@ -1,29 +1,29 @@ #-- 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. #++ require File.expand_path('../../../../test_helper', __FILE__) class Redmine::WikiFormattingTest < ActiveSupport::TestCase - + def test_textile_formatter assert_equal Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting.formatter_for('textile') assert_equal Redmine::WikiFormatting::Textile::Helper, Redmine::WikiFormatting.helper_for('textile') end - + def test_null_formatter assert_equal Redmine::WikiFormatting::NullFormatter::Formatter, Redmine::WikiFormatting.formatter_for('') assert_equal Redmine::WikiFormatting::NullFormatter::Helper, Redmine::WikiFormatting.helper_for('') end - + def test_should_link_urls_and_email_addresses raw = <<-DIFF This is a sample *text* with a link: http://www.redmine.org diff --git a/test/unit/lib/redmine/wiki_formatting/macros_test.rb b/test/unit/lib/redmine/wiki_formatting/macros_test.rb index 286a5d29..0e2e9d8e 100644 --- a/test/unit/lib/redmine/wiki_formatting/macros_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/macros_test.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,9 +18,9 @@ class Redmine::WikiFormatting::MacrosTest < HelperTestCase include ActionView::Helpers::TextHelper include ActionView::Helpers::SanitizeHelper extend ActionView::Helpers::SanitizeHelper::ClassMethods - + fixtures :projects, :roles, :enabled_modules, :users, - :repositories, :changesets, + :repositories, :changesets, :trackers, :issue_statuses, :issues, :versions, :documents, :wikis, :wiki_pages, :wiki_contents, @@ -31,10 +31,10 @@ class Redmine::WikiFormatting::MacrosTest < HelperTestCase super @project = nil end - + def teardown end - + def test_macro_hello_world text = "{{hello_world}}" assert textilizable(text).match(/Hello world!/) @@ -42,13 +42,13 @@ class Redmine::WikiFormatting::MacrosTest < HelperTestCase text = "!{{hello_world}}" assert_equal '

                    {{hello_world}}

                    ', textilizable(text) end - + def test_macro_include @project = Project.find(1) # include a page of the current project wiki text = "{{include(Another page)}}" assert textilizable(text).match(/This is a link to a ticket/) - + @project = nil # include a page of a specific project wiki text = "{{include(ecookbook:Another page)}}" @@ -60,23 +60,23 @@ class Redmine::WikiFormatting::MacrosTest < HelperTestCase text = "{{include(unknowidentifier:somepage)}}" assert textilizable(text).match(/Page not found/) end - + def test_macro_child_pages expected = "

                    \n

                    " - + @project = Project.find(1) # child pages of the current wiki page assert_equal expected, textilizable("{{child_pages}}", :object => WikiPage.find(2).content) # child pages of another page assert_equal expected, textilizable("{{child_pages(Another_page)}}", :object => WikiPage.find(1).content) - + @project = Project.find(2) assert_equal expected, textilizable("{{child_pages(ecookbook:Another_page)}}", :object => WikiPage.find(1).content) end - + def test_macro_child_pages_with_option expected = "

                      \n" + "
                    • Another page\n" + @@ -84,13 +84,13 @@ class Redmine::WikiFormatting::MacrosTest < HelperTestCase "
                    • Child 1
                    • \n" + "
                    • Child 2
                    • \n" + "
                    \n\n
                  \n

                  " - + @project = Project.find(1) # child pages of the current wiki page assert_equal expected, textilizable("{{child_pages(parent=1)}}", :object => WikiPage.find(2).content) # child pages of another page assert_equal expected, textilizable("{{child_pages(Another_page, parent=1)}}", :object => WikiPage.find(1).content) - + @project = Project.find(2) assert_equal expected, textilizable("{{child_pages(ecookbook:Another_page, parent=1)}}", :object => WikiPage.find(1).content) end diff --git a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb index 2446701e..9b45b1be 100644 --- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.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 Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase def setup @formatter = Redmine::WikiFormatting::Textile::Formatter end - + MODIFIERS = { "*" => 'strong', # bold "_" => 'em', # italic @@ -27,7 +27,7 @@ class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase "^" => 'sup', # superscript "~" => 'sub' # subscript } - + def test_modifiers assert_html_output( '*bold*' => 'bold', @@ -42,7 +42,7 @@ class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase '*(foo)two words*' => 'two words' ) end - + def test_modifiers_combination MODIFIERS.each do |m1, tag1| MODIFIERS.each do |m2, tag2| @@ -53,7 +53,7 @@ class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase end end end - + def test_inline_code assert_html_output( 'this is @some code@' => 'this is some code', @@ -72,14 +72,14 @@ class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase 'h1. 2009\02\09' => '

                  2009\02\09

                  ' }, false) end - + def test_double_dashes_should_not_strikethrough assert_html_output( 'double -- dashes -- test' => 'double -- dashes -- test', 'double -- *dashes* -- test' => 'double -- dashes -- test' ) end - + def test_acronyms assert_html_output( 'this is an acronym: GPL(General Public License)' => 'this is an acronym: GPL', @@ -87,7 +87,7 @@ class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase 'GPL(This is a double-quoted "title")' => 'GPL' ) end - + def test_blockquote # orig raw text raw = <<-RAW @@ -104,7 +104,7 @@ John said: He's right. RAW - + # expected html expected = <<-EXPECTED

                  John said:

                  @@ -124,10 +124,10 @@ Nullam commodo metus accumsan nulla. Curabitur lobortis dui id dolor.

                  He's right.

                  EXPECTED - + assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '') end - + def test_table raw = <<-RAW This is a table with empty cells: @@ -149,7 +149,7 @@ EXPECTED assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '') end - + def test_table_with_line_breaks raw = <<-RAW This is a table with line breaks: @@ -188,19 +188,19 @@ EXPECTED assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '') end - + def test_textile_should_not_mangle_brackets assert_equal '

                  [msg1][msg2]

                  ', to_html('[msg1][msg2]') end - + private - + def assert_html_output(to_test, expect_paragraph = true) to_test.each do |text, expected| assert_equal(( expect_paragraph ? "

                  #{expected}

                  " : expected ), @formatter.new(text).to_html, "Formatting the following text failed:\n===\n#{text}\n===\n") end end - + def to_html(text) @formatter.new(text).to_html end diff --git a/test/unit/lib/redmine_test.rb b/test/unit/lib/redmine_test.rb index 6a5c28b7..997af6d7 100644 --- a/test/unit/lib/redmine_test.rb +++ b/test/unit/lib/redmine_test.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. #++ require File.expand_path('../../../test_helper', __FILE__) diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb index 43a26107..6f56567f 100644 --- a/test/unit/mail_handler_test.rb +++ b/test/unit/mail_handler_test.rb @@ -1,20 +1,20 @@ # -*- coding: utf-8 -*- #-- 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. #++ require File.expand_path('../../test_helper', __FILE__) class MailHandlerTest < ActiveSupport::TestCase - fixtures :users, :projects, + fixtures :users, :projects, :enabled_modules, :roles, :members, @@ -33,14 +33,14 @@ class MailHandlerTest < ActiveSupport::TestCase :custom_fields_projects, :boards, :messages - + FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures/mail_handler' - + def setup ActionMailer::Base.deliveries.clear Setting.notified_events = Redmine::Notifiable.all.collect(&:name) end - + def test_add_issue ActionMailer::Base.deliveries.clear # This email contains: 'Project: onlinestore' @@ -70,7 +70,7 @@ class MailHandlerTest < ActiveSupport::TestCase assert_not_nil mail assert mail.subject.include?('New ticket on a given project') end - + def test_add_issue_with_default_tracker # This email contains: 'Project: onlinestore' issue = submit_email('ticket_on_given_project.eml', :issue => {:tracker => 'Support request'}) @@ -89,7 +89,7 @@ class MailHandlerTest < ActiveSupport::TestCase assert_equal Project.find(2), issue.project assert_equal IssueStatus.find_by_name("Resolved"), issue.status end - + def test_add_issue_with_attributes_override issue = submit_email('ticket_with_attributes.eml', :allow_override => 'tracker,category,priority') assert issue.is_a?(Issue) @@ -103,7 +103,7 @@ class MailHandlerTest < ActiveSupport::TestCase assert_equal 'Urgent', issue.priority.to_s assert issue.description.include?('Lorem ipsum dolor sit amet, consectetuer adipiscing elit.') end - + def test_add_issue_with_partial_attributes_override issue = submit_email('ticket_with_attributes.eml', :issue => {:priority => 'High'}, :allow_override => ['tracker']) assert issue.is_a?(Issue) @@ -117,7 +117,7 @@ class MailHandlerTest < ActiveSupport::TestCase assert_equal 'High', issue.priority.to_s assert issue.description.include?('Lorem ipsum dolor sit amet, consectetuer adipiscing elit.') end - + def test_add_issue_with_spaces_between_attribute_and_separator issue = submit_email('ticket_with_spaces_between_attribute_and_separator.eml', :allow_override => 'tracker,category,priority') assert issue.is_a?(Issue) @@ -132,7 +132,7 @@ class MailHandlerTest < ActiveSupport::TestCase assert issue.description.include?('Lorem ipsum dolor sit amet, consectetuer adipiscing elit.') end - + def test_add_issue_with_attachment_to_specific_project issue = submit_email('ticket_with_attachment.eml', :issue => {:project => 'onlinestore'}) assert issue.is_a?(Issue) @@ -148,7 +148,7 @@ class MailHandlerTest < ActiveSupport::TestCase assert_equal 'image/jpeg', issue.attachments.first.content_type assert_equal 10790, issue.attachments.first.filesize end - + def test_add_issue_with_custom_fields issue = submit_email('ticket_with_custom_fields.eml', :issue => {:project => 'onlinestore'}) assert issue.is_a?(Issue) @@ -158,7 +158,7 @@ class MailHandlerTest < ActiveSupport::TestCase assert_equal 'Value for a custom field', issue.custom_value_for(CustomField.find_by_name('Searchable field')).value assert !issue.description.match(/^searchable field:/i) end - + def test_add_issue_with_cc issue = submit_email('ticket_with_cc.eml', :issue => {:project => 'ecookbook'}) assert issue.is_a?(Issue) @@ -167,13 +167,13 @@ class MailHandlerTest < ActiveSupport::TestCase assert issue.watched_by?(User.find_by_mail('dlopper@somenet.foo')) assert_equal 1, issue.watcher_user_ids.size end - + def test_add_issue_by_unknown_user assert_no_difference 'User.count' do assert_equal false, submit_email('ticket_by_unknown_user.eml', :issue => {:project => 'ecookbook'}) end end - + def test_add_issue_by_anonymous_user Role.anonymous.add_permission!(:add_issues) assert_no_difference 'User.count' do @@ -191,7 +191,7 @@ class MailHandlerTest < ActiveSupport::TestCase assert issue.author.anonymous? end end - + def test_add_issue_by_anonymous_user_on_private_project Role.anonymous.add_permission!(:add_issues) assert_no_difference 'User.count' do @@ -200,7 +200,7 @@ class MailHandlerTest < ActiveSupport::TestCase end end end - + def test_add_issue_by_anonymous_user_on_private_project_without_permission_check assert_no_difference 'User.count' do assert_difference 'Issue.count' do @@ -212,7 +212,7 @@ class MailHandlerTest < ActiveSupport::TestCase end end end - + def test_add_issue_by_created_user Setting.default_language = 'en' assert_difference 'User.count' do @@ -222,7 +222,7 @@ class MailHandlerTest < ActiveSupport::TestCase assert_equal 'john.doe@somenet.foo', issue.author.mail assert_equal 'John', issue.author.firstname assert_equal 'Doe', issue.author.lastname - + # account information email = ActionMailer::Base.deliveries.first assert_not_nil email @@ -232,7 +232,7 @@ class MailHandlerTest < ActiveSupport::TestCase assert_equal issue.author, User.try_to_login(login, password) end end - + def test_add_issue_without_from_header Role.anonymous.add_permission!(:add_issues) assert_equal false, submit_email('ticket_without_from_header.eml') @@ -265,7 +265,7 @@ class MailHandlerTest < ActiveSupport::TestCase assert_equal 'Urgent', issue.priority.to_s assert issue.description.include?('Lorem ipsum dolor sit amet, consectetuer adipiscing elit.') end - + def test_add_issue_with_japanese_keywords tracker = Tracker.create!(:name => '開発') Project.find(1).trackers << tracker @@ -289,7 +289,7 @@ class MailHandlerTest < ActiveSupport::TestCase assert issue.is_a?(Issue) assert_equal 1, ActionMailer::Base.deliveries.size end - + def test_add_issue_note journal = submit_email('ticket_reply.eml') assert journal.is_a?(Journal) @@ -324,7 +324,7 @@ class MailHandlerTest < ActiveSupport::TestCase assert journal.is_a?(Journal) assert_equal 1, ActionMailer::Base.deliveries.size end - + def test_add_issue_note_should_not_set_defaults journal = submit_email('ticket_reply.eml', :issue => {:tracker => 'Support request', :priority => 'High'}) assert journal.is_a?(Journal) @@ -332,7 +332,7 @@ class MailHandlerTest < ActiveSupport::TestCase assert_equal 'Feature request', journal.issue.tracker.name assert_equal 'Normal', journal.issue.priority.name end - + def test_reply_to_a_message m = submit_email('message_reply.eml') assert m.is_a?(Message) @@ -342,7 +342,7 @@ class MailHandlerTest < ActiveSupport::TestCase # The email replies to message #2 which is part of the thread of message #1 assert_equal Message.find(1), m.parent end - + def test_reply_to_a_message_by_subject m = submit_email('message_reply_by_subject.eml') assert m.is_a?(Message) @@ -351,7 +351,7 @@ class MailHandlerTest < ActiveSupport::TestCase assert_equal 'Reply to the first post', m.subject assert_equal Message.find(1), m.parent end - + def test_should_strip_tags_of_html_only_emails issue = submit_email('ticket_html_only.eml', :issue => {:project => 'ecookbook'}) assert issue.is_a?(Issue) @@ -405,7 +405,7 @@ class MailHandlerTest < ActiveSupport::TestCase end end - + context "with multiple quoted replies (e.g. reply to a reply of a Redmine email notification)" do setup do Setting.mail_handler_body_delimiters = '--- Reply above. Do not remove this line. ---' @@ -438,7 +438,7 @@ class MailHandlerTest < ActiveSupport::TestCase end end end - + def test_email_with_long_subject_line issue = submit_email('ticket_with_long_subject.eml') assert issue.is_a?(Issue) @@ -446,7 +446,7 @@ class MailHandlerTest < ActiveSupport::TestCase end private - + def submit_email(filename, options={}) raw = IO.read(File.join(FIXTURES_PATH, filename)) MailHandler.receive(raw, options) diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb index fd974178..596a1c5f 100644 --- a/test/unit/mailer_test.rb +++ b/test/unit/mailer_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -16,24 +16,24 @@ class MailerTest < ActiveSupport::TestCase include Redmine::I18n include ActionController::Assertions::SelectorAssertions fixtures :all - + def setup ActionMailer::Base.deliveries.clear Setting.host_name = 'mydomain.foo' Setting.protocol = 'http' Setting.plain_text_mail = '0' end - + def test_generated_links_in_emails Setting.host_name = 'mydomain.foo' Setting.protocol = 'https' - + journal = Journal.find(2) assert Mailer.deliver_issue_edit(journal) - + mail = ActionMailer::Base.deliveries.last assert_kind_of TMail::Mail, mail - + assert_select_email do # link to the main ticket assert_select "a[href=?]", "https://mydomain.foo/issues/1", :text => "Bug #1: Can't print recipes" @@ -43,16 +43,16 @@ class MailerTest < ActiveSupport::TestCase assert_select "a[href=?][title=?]", "https://mydomain.foo/projects/ecookbook/repository/revisions/2", "This commit fixes #1, #2 and references #1 & #3", :text => "r2" end end - + def test_generated_links_with_prefix relative_url_root = Redmine::Utils.relative_url_root Setting.host_name = 'mydomain.foo/rdm' Setting.protocol = 'http' Redmine::Utils.relative_url_root = '/rdm' - + journal = Journal.find(2) assert Mailer.deliver_issue_edit(journal) - + mail = ActionMailer::Base.deliveries.last assert_kind_of TMail::Mail, mail @@ -68,16 +68,16 @@ class MailerTest < ActiveSupport::TestCase # restore it Redmine::Utils.relative_url_root = relative_url_root end - + def test_generated_links_with_prefix_and_no_relative_url_root relative_url_root = Redmine::Utils.relative_url_root Setting.host_name = 'mydomain.foo/rdm' Setting.protocol = 'http' Redmine::Utils.relative_url_root = nil - + journal = Journal.find(2) assert Mailer.deliver_issue_edit(journal) - + mail = ActionMailer::Base.deliveries.last assert_kind_of TMail::Mail, mail @@ -93,7 +93,7 @@ class MailerTest < ActiveSupport::TestCase # restore it Redmine::Utils.relative_url_root = relative_url_root end - + def test_email_headers issue = Issue.find(1) Mailer.deliver_issue_add(issue) @@ -121,7 +121,7 @@ class MailerTest < ActiveSupport::TestCase assert_equal 2, mail.parts.size assert mail.encoded.include?('href') end - + def test_mail_from_with_phrase with_settings :mail_from => 'Redmine app ' do Mailer.deliver_test(User.find(1)) @@ -130,13 +130,13 @@ class MailerTest < ActiveSupport::TestCase assert_not_nil mail assert_equal 'Redmine app', mail.from_addrs.first.name end - + def test_should_not_send_email_without_recipient news = News.find(:first) user = news.author # Remove members except news author news.project.memberships.each {|m| m.destroy unless m.user == user} - + user.pref[:no_self_notified] = false user.pref.save User.current = user @@ -160,7 +160,7 @@ class MailerTest < ActiveSupport::TestCase assert_equal Mailer.message_id_for(issue), mail.message_id assert_nil mail.references end - + def test_issue_edit_message_id journal = Journal.find(1) Mailer.deliver_issue_edit(journal) @@ -169,7 +169,7 @@ class MailerTest < ActiveSupport::TestCase assert_equal Mailer.message_id_for(journal), mail.message_id assert_equal Mailer.message_id_for(journal.journaled), mail.references.first.to_s end - + def test_message_posted_message_id message = Message.find(1) Mailer.deliver_message_posted(message) @@ -182,7 +182,7 @@ class MailerTest < ActiveSupport::TestCase assert_select "a[href=?]", "http://mydomain.foo/boards/#{message.board.id}/topics/#{message.id}", :text => message.subject end end - + def test_reply_posted_message_id message = Message.find(3) Mailer.deliver_message_posted(message) @@ -195,25 +195,25 @@ class MailerTest < ActiveSupport::TestCase assert_select "a[href=?]", "http://mydomain.foo/boards/#{message.board.id}/topics/#{message.root.id}?r=#{message.id}#message-#{message.id}", :text => message.subject end end - + context("#issue_add") do setup do ActionMailer::Base.deliveries.clear Setting.bcc_recipients = '1' - @issue = Issue.find(1) + @issue = Issue.find(1) end - + should "notify project members" do assert Mailer.deliver_issue_add(@issue) assert last_email.bcc.include?('dlopper@somenet.foo') end - + should "not notify project members that are not allow to view the issue" do Role.find(2).remove_permission!(:view_issues) assert Mailer.deliver_issue_add(@issue) assert !last_email.bcc.include?('dlopper@somenet.foo') end - + should "notify issue watchers" do user = User.find(9) # minimal email notification options @@ -221,12 +221,12 @@ class MailerTest < ActiveSupport::TestCase user.pref.save user.mail_notification = false user.save - + Watcher.create!(:watchable => @issue, :user => user) assert Mailer.deliver_issue_add(@issue) assert last_email.bcc.include?(user.mail) end - + should "not notify watchers not allowed to view the issue" do user = User.find(9) Watcher.create!(:watchable => @issue, :user => user) @@ -235,7 +235,7 @@ class MailerTest < ActiveSupport::TestCase assert !last_email.bcc.include?(user.mail) end end - + # test mailer methods for each language def test_issue_add issue = Issue.find(1) @@ -252,7 +252,7 @@ class MailerTest < ActiveSupport::TestCase assert Mailer.deliver_issue_edit(journal) end end - + def test_document_added document = Document.find(1) valid_languages.each do |lang| @@ -260,7 +260,7 @@ class MailerTest < ActiveSupport::TestCase assert Mailer.deliver_document_added(document) end end - + def test_attachments_added attachements = [ Attachment.find_by_container_type('Document') ] valid_languages.each do |lang| @@ -268,7 +268,7 @@ class MailerTest < ActiveSupport::TestCase assert Mailer.deliver_attachments_added(attachements) end end - + def test_version_file_added attachements = [ Attachment.find_by_container_type('Version') ] assert Mailer.deliver_attachments_added(attachements) @@ -278,7 +278,7 @@ class MailerTest < ActiveSupport::TestCase assert_select "a[href=?]", "http://mydomain.foo/projects/ecookbook/files" end end - + def test_project_file_added attachements = [ Attachment.find_by_container_type('Project') ] assert Mailer.deliver_attachments_added(attachements) @@ -288,7 +288,7 @@ class MailerTest < ActiveSupport::TestCase assert_select "a[href=?]", "http://mydomain.foo/projects/ecookbook/files" end end - + def test_news_added news = News.find(:first) valid_languages.each do |lang| @@ -296,7 +296,7 @@ class MailerTest < ActiveSupport::TestCase assert Mailer.deliver_news_added(news) end end - + def test_news_comment_added comment = Comment.find(2) valid_languages.each do |lang| @@ -304,7 +304,7 @@ class MailerTest < ActiveSupport::TestCase assert Mailer.deliver_news_comment_added(comment) end end - + def test_message_posted message = Message.find(:first) recipients = ([message.root] + message.root.children).collect {|m| m.author.mail if m.author} @@ -314,7 +314,7 @@ class MailerTest < ActiveSupport::TestCase assert Mailer.deliver_message_posted(message) end end - + def test_wiki_content_added content = WikiContent.find(:first) valid_languages.each do |lang| @@ -324,7 +324,7 @@ class MailerTest < ActiveSupport::TestCase end end end - + def test_wiki_content_updated content = WikiContent.find(:first) valid_languages.each do |lang| @@ -334,7 +334,7 @@ class MailerTest < ActiveSupport::TestCase end end end - + def test_account_information user = User.find(2) valid_languages.each do |lang| @@ -357,7 +357,7 @@ class MailerTest < ActiveSupport::TestCase token = Token.find(1) Setting.host_name = 'redmine.foo' Setting.protocol = 'https' - + valid_languages.each do |lang| token.user.update_attribute :language, lang.to_s token.reload @@ -367,7 +367,7 @@ class MailerTest < ActiveSupport::TestCase assert mail.body.include?("https://redmine.foo/account/activate?token=#{token.value}") end end - + def test_test user = User.find(1) valid_languages.each do |lang| @@ -375,7 +375,7 @@ class MailerTest < ActiveSupport::TestCase assert Mailer.deliver_test(user) end end - + def test_reminders Mailer.reminders(:days => 42) assert_equal 1, ActionMailer::Base.deliveries.size @@ -384,7 +384,7 @@ class MailerTest < ActiveSupport::TestCase assert mail.body.include?('Bug #3: Error 281 when updating a recipe') assert_equal '1 issue(s) due in the next 42 days', mail.subject end - + def test_reminders_for_users Mailer.reminders(:days => 42, :users => ['5']) assert_equal 0, ActionMailer::Base.deliveries.size # No mail for dlopper @@ -394,13 +394,13 @@ class MailerTest < ActiveSupport::TestCase assert mail.bcc.include?('dlopper@somenet.foo') assert mail.body.include?('Bug #3: Error 281 when updating a recipe') end - + def last_email mail = ActionMailer::Base.deliveries.last assert_not_nil mail mail end - + def test_mailer_should_not_change_locale Setting.default_language = 'en' # Set current language to italian @@ -411,10 +411,10 @@ class MailerTest < ActiveSupport::TestCase Mailer.deliver_account_activated(user) mail = ActionMailer::Base.deliveries.last assert mail.body.include?('Votre compte') - + assert_equal :it, current_language end - + def test_with_deliveries_off Mailer.with_deliveries false do Mailer.deliver_test(User.find(1)) @@ -435,9 +435,9 @@ class MailerTest < ActiveSupport::TestCase end end end - + end - + end - + end diff --git a/test/unit/member_test.rb b/test/unit/member_test.rb index 877ff558..d182f32b 100644 --- a/test/unit/member_test.rb +++ b/test/unit/member_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,21 +18,21 @@ class MemberTest < ActiveSupport::TestCase def setup @jsmith = Member.find(1) end - + def test_create member = Member.new(:project_id => 1, :user_id => 4, :role_ids => [1, 2]) assert member.save member.reload - + assert_equal 2, member.roles.size assert_equal Role.find(1), member.roles.sort.first end - def test_update + def test_update assert_equal "eCookbook", @jsmith.project.name assert_equal "Manager", @jsmith.roles.first.name assert_equal "jsmith", @jsmith.user.login - + @jsmith.mail_notification = !@jsmith.mail_notification assert @jsmith.save end @@ -43,27 +43,27 @@ class MemberTest < ActiveSupport::TestCase assert @jsmith.save assert_equal 2, @jsmith.reload.roles.size end - + def test_validate member = Member.new(:project_id => 1, :user_id => 2, :role_ids => [2]) # same use can't have more than one membership for a project assert !member.save - + member = Member.new(:project_id => 1, :user_id => 2, :role_ids => []) # must have one role at least assert !member.save end - + def test_destroy assert_difference 'Member.count', -1 do assert_difference 'MemberRole.count', -1 do @jsmith.destroy end end - + assert_raise(ActiveRecord::RecordNotFound) { Member.find(@jsmith.id) } end - + context "removing permissions" do setup do Watcher.delete_all("user_id = 9") @@ -76,12 +76,12 @@ class MemberTest < ActiveSupport::TestCase Watcher.create!(:watchable => Wiki.find(2), :user => user) Watcher.create!(:watchable => WikiPage.find(3), :user => user) end - + context "of user" do setup do @member = Member.create!(:project => Project.find(2), :principal => User.find(9), :role_ids => [1, 2]) end - + context "by deleting membership" do should "prune watchers" do assert_difference 'Watcher.count', -4 do @@ -89,7 +89,7 @@ class MemberTest < ActiveSupport::TestCase end end end - + context "by updating roles" do should "prune watchers" do Role.find(2).remove_permission! :view_wiki_pages @@ -102,7 +102,7 @@ class MemberTest < ActiveSupport::TestCase end end end - + context "of group" do setup do group = Group.find(10) @@ -116,7 +116,7 @@ class MemberTest < ActiveSupport::TestCase @member.destroy end end - end + end context "by updating roles" do should "prune watchers" do diff --git a/test/unit/message_test.rb b/test/unit/message_test.rb index 87bbf121..9f143825 100644 --- a/test/unit/message_test.rb +++ b/test/unit/message_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -19,11 +19,11 @@ class MessageTest < ActiveSupport::TestCase @board = Board.find(1) @user = User.find(1) end - + def test_create topics_count = @board.topics_count messages_count = @board.messages_count - + message = Message.new(:board => @board, :subject => 'Test message', :content => 'Test message content', :author => @user) assert message.save @board.reload @@ -35,13 +35,13 @@ class MessageTest < ActiveSupport::TestCase # author should be watching the message assert message.watched_by?(@user) end - + def test_reply topics_count = @board.topics_count messages_count = @board.messages_count @message = Message.find(1) replies_count = @message.replies_count - + reply_author = User.find(2) reply = Message.new(:board => @board, :subject => 'Test reply', :content => 'Test reply content', :parent => @message, :author => reply_author) assert reply.save @@ -58,7 +58,7 @@ class MessageTest < ActiveSupport::TestCase # author should be watching the message assert @message.watched_by?(reply_author) end - + def test_moving_message_should_update_counters @message = Message.find(1) assert_no_difference 'Message.count' do @@ -75,17 +75,17 @@ class MessageTest < ActiveSupport::TestCase end end end - + def test_destroy_topic message = Message.find(1) board = message.board - topics_count, messages_count = board.topics_count, board.messages_count - + topics_count, messages_count = board.topics_count, board.messages_count + assert_difference('Watcher.count', -1) do assert message.destroy end board.reload - + # Replies deleted assert Message.find_all_by_parent_id(1).empty? # Checks counters @@ -93,11 +93,11 @@ class MessageTest < ActiveSupport::TestCase assert_equal messages_count - 3, board.messages_count # Watchers removed end - + def test_destroy_reply message = Message.find(5) board = message.board - topics_count, messages_count = board.topics_count, board.messages_count + topics_count, messages_count = board.topics_count, board.messages_count assert message.destroy board.reload @@ -105,25 +105,25 @@ class MessageTest < ActiveSupport::TestCase assert_equal topics_count, board.topics_count assert_equal messages_count - 1, board.messages_count end - + def test_editable_by message = Message.find(6) author = message.author assert message.editable_by?(author) - + author.roles_for_project(message.project).first.remove_permission!(:edit_own_messages) assert !message.reload.editable_by?(author.reload) end - + def test_destroyable_by message = Message.find(6) author = message.author assert message.destroyable_by?(author) - + author.roles_for_project(message.project).first.remove_permission!(:delete_own_messages) assert !message.reload.destroyable_by?(author.reload) end - + def test_set_sticky message = Message.new assert_equal 0, message.sticky diff --git a/test/unit/news_test.rb b/test/unit/news_test.rb index 82421bb0..45279bd5 100644 --- a/test/unit/news_test.rb +++ b/test/unit/news_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -19,10 +19,10 @@ class NewsTest < ActiveSupport::TestCase { :title => 'Test news', :description => 'Lorem ipsum etc', :author => User.find(:first) } end - + def setup end - + def test_create_should_send_email_notification ActionMailer::Base.deliveries.clear Setting.notified_events = Setting.notified_events.dup << 'news_added' @@ -31,7 +31,7 @@ class NewsTest < ActiveSupport::TestCase assert news.save assert_equal 1, ActionMailer::Base.deliveries.size end - + def test_should_include_news_for_projects_with_news_enabled project = projects(:projects_001) assert project.enabled_modules.any?{ |em| em.name == 'news' } @@ -39,7 +39,7 @@ class NewsTest < ActiveSupport::TestCase # News.latest should return news from projects_001 assert News.latest.any? { |news| news.project == project } end - + def test_should_not_include_news_for_projects_with_news_disabled EnabledModule.delete_all(["project_id = ? AND name = ?", 2, 'news']) project = Project.find(2) @@ -50,11 +50,11 @@ class NewsTest < ActiveSupport::TestCase # News.latest should not return that new piece of news assert News.latest.include?(news) == false end - + def test_should_only_include_news_from_projects_visibly_to_the_user - assert News.latest(User.anonymous).all? { |news| news.project.is_public? } + assert News.latest(User.anonymous).all? { |news| news.project.is_public? } end - + def test_should_limit_the_amount_of_returned_news # Make sure we have a bunch of news stories 10.times { projects(:projects_001).news.create(valid_news) } diff --git a/test/unit/principal_test.rb b/test/unit/principal_test.rb index e4217a01..62d2702b 100644 --- a/test/unit/principal_test.rb +++ b/test/unit/principal_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -28,7 +28,7 @@ class PrincipalTest < ActiveSupport::TestCase Principal.generate!(:mail => 'mail@example.com') Principal.generate!(:mail => 'mail2@example.com') end - + should "search login" do results = Principal.like('login') @@ -57,5 +57,5 @@ class PrincipalTest < ActiveSupport::TestCase assert results.all? {|u| u.mail.match(/mail/) } end end - + end diff --git a/test/unit/project_nested_set_test.rb b/test/unit/project_nested_set_test.rb index b9cb6d21..6e67f3b7 100644 --- a/test/unit/project_nested_set_test.rb +++ b/test/unit/project_nested_set_test.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. #++ require File.expand_path('../../test_helper', __FILE__) class ProjectNestedSetTest < ActiveSupport::TestCase - + context "nested set" do setup do Project.delete_all @@ -23,7 +23,7 @@ class ProjectNestedSetTest < ActiveSupport::TestCase @a1.set_parent!(@a) @a2 = Project.create!(:name => 'Project A2', :identifier => 'projecta2') @a2.set_parent!(@a) - + @b = Project.create!(:name => 'Project B', :identifier => 'projectb') @b1 = Project.create!(:name => 'Project B1', :identifier => 'projectb1') @b1.set_parent!(@b) @@ -31,14 +31,14 @@ class ProjectNestedSetTest < ActiveSupport::TestCase @b11.set_parent!(@b1) @b2 = Project.create!(:name => 'Project B2', :identifier => 'projectb2') @b2.set_parent!(@b) - + @c = Project.create!(:name => 'Project C', :identifier => 'projectc') @c1 = Project.create!(:name => 'Project C1', :identifier => 'projectc1') @c1.set_parent!(@c) - + [@a, @a1, @a2, @b, @b1, @b11, @b2, @c, @c1].each(&:reload) end - + context "#create" do should "build valid tree" do assert_nested_set_values({ @@ -54,7 +54,7 @@ class ProjectNestedSetTest < ActiveSupport::TestCase }) end end - + context "#set_parent!" do should "keep valid tree" do assert_no_difference 'Project.count' do @@ -70,7 +70,7 @@ class ProjectNestedSetTest < ActiveSupport::TestCase }) end end - + context "#destroy" do context "a root with children" do should "not mess up the tree" do @@ -86,7 +86,7 @@ class ProjectNestedSetTest < ActiveSupport::TestCase }) end end - + context "a child with children" do should "not mess up the tree" do assert_difference 'Project.count', -2 do @@ -102,7 +102,7 @@ class ProjectNestedSetTest < ActiveSupport::TestCase end end end - + def assert_nested_set_values(h) assert Project.valid? h.each do |project, expected| diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb index fde5e2e3..7d872cd8 100644 --- a/test/unit/project_test.rb +++ b/test/unit/project_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -20,7 +20,7 @@ class ProjectTest < ActiveSupport::TestCase @ecookbook_sub1 = Project.find(3) User.current = nil end - + should_validate_presence_of :name should_validate_presence_of :identifier @@ -54,7 +54,7 @@ class ProjectTest < ActiveSupport::TestCase assert_kind_of Project, @ecookbook assert_equal "eCookbook", @ecookbook.name end - + def test_default_attributes with_settings :default_projects_public => '1' do assert_equal true, Project.new.is_public @@ -79,11 +79,11 @@ class ProjectTest < ActiveSupport::TestCase with_settings :default_projects_modules => ['issue_tracking', 'repository'] do assert_equal ['issue_tracking', 'repository'], Project.new.enabled_module_names end - + assert_equal Tracker.all, Project.new.trackers assert_equal Tracker.find(1, 3), Project.new(:tracker_ids => [1, 3]).trackers end - + def test_update assert_equal "eCookbook", @ecookbook.name @ecookbook.name = "eCook" @@ -91,7 +91,7 @@ class ProjectTest < ActiveSupport::TestCase @ecookbook.reload assert_equal "eCook", @ecookbook.name end - + def test_validate_identifier to_test = {"abc" => true, "ab12" => true, @@ -99,7 +99,7 @@ class ProjectTest < ActiveSupport::TestCase "ab_12" => true, "12" => false, "new" => false} - + to_test.each do |identifier, valid| p = Project.new p.identifier = identifier @@ -113,18 +113,18 @@ class ProjectTest < ActiveSupport::TestCase assert_nil project.members.detect {|m| !(m.user.is_a?(User) && m.user.active?) } end end - + def test_users_should_be_active_users Project.all.each do |project| assert_nil project.users.detect {|u| !(u.is_a?(User) && u.active?) } end end - + def test_archive user = @ecookbook.members.first.user @ecookbook.archive @ecookbook.reload - + assert !@ecookbook.active? assert @ecookbook.archived? assert !user.projects.include?(@ecookbook) @@ -132,24 +132,24 @@ class ProjectTest < ActiveSupport::TestCase assert !@ecookbook.children.empty? assert @ecookbook.descendants.active.empty? end - + def test_archive_should_fail_if_versions_are_used_by_non_descendant_projects # Assign an issue of a project to a version of a child project Issue.find(4).update_attribute :fixed_version_id, 4 - + assert_no_difference "Project.count(:all, :conditions => 'status = #{Project::STATUS_ARCHIVED}')" do assert_equal false, @ecookbook.archive end @ecookbook.reload assert @ecookbook.active? end - + def test_unarchive user = @ecookbook.members.first.user @ecookbook.archive # A subproject of an archived project can not be unarchived assert !@ecookbook_sub1.unarchive - + # Unarchive project assert @ecookbook.unarchive @ecookbook.reload @@ -160,7 +160,7 @@ class ProjectTest < ActiveSupport::TestCase @ecookbook_sub1.reload assert @ecookbook_sub1.unarchive end - + def test_destroy # 2 active members assert_equal 2, @ecookbook.members.size @@ -168,7 +168,7 @@ class ProjectTest < ActiveSupport::TestCase assert_equal 3, Member.find(:all, :conditions => ['project_id = ?', @ecookbook.id]).size # some boards assert @ecookbook.boards.any? - + @ecookbook.destroy # make sure that the project non longer exists assert_raise(ActiveRecord::RecordNotFound) { Project.find(@ecookbook.id) } @@ -177,12 +177,12 @@ class ProjectTest < ActiveSupport::TestCase assert_nil Board.first(:conditions => {:project_id => @ecookbook.id}) assert_nil Issue.first(:conditions => {:project_id => @ecookbook.id}) end - + def test_destroying_root_projects_should_clear_data Project.roots.each do |root| root.destroy end - + assert_equal 0, Project.count, "Projects were not deleted: #{Project.all.inspect}" assert_equal 0, Member.count, "Members were not deleted: #{Member.all.inspect}" assert_equal 0, MemberRole.count @@ -211,7 +211,7 @@ class ProjectTest < ActiveSupport::TestCase assert_equal 0, Project.connection.select_all("SELECT * FROM custom_fields_projects").size assert_equal 0, CustomValue.count(:conditions => {:customized_type => ['Project', 'Issue', 'TimeEntry', 'Version']}) end - + def test_move_an_orphan_project_to_a_root_project sub = Project.find(2) sub.set_parent! @ecookbook @@ -219,22 +219,22 @@ class ProjectTest < ActiveSupport::TestCase @ecookbook.reload assert_equal 4, @ecookbook.children.size end - + def test_move_an_orphan_project_to_a_subproject sub = Project.find(2) assert sub.set_parent!(@ecookbook_sub1) end - + def test_move_a_root_project_to_a_project sub = @ecookbook assert sub.set_parent!(Project.find(2)) end - + def test_should_not_move_a_project_to_its_children sub = @ecookbook assert !(sub.set_parent!(Project.find(3))) end - + def test_set_parent_should_add_roots_in_alphabetical_order ProjectCustomField.delete_all Project.delete_all @@ -242,11 +242,11 @@ class ProjectTest < ActiveSupport::TestCase Project.create!(:name => 'Project B', :identifier => 'project-b').set_parent!(nil) Project.create!(:name => 'Project D', :identifier => 'project-d').set_parent!(nil) Project.create!(:name => 'Project A', :identifier => 'project-a').set_parent!(nil) - + assert_equal 4, Project.count assert_equal Project.all.sort_by(&:name), Project.all.sort_by(&:lft) end - + def test_set_parent_should_add_children_in_alphabetical_order ProjectCustomField.delete_all parent = Project.create!(:name => 'Parent', :identifier => 'parent') @@ -254,12 +254,12 @@ class ProjectTest < ActiveSupport::TestCase Project.create!(:name => 'Project B', :identifier => 'project-b').set_parent!(parent) Project.create!(:name => 'Project D', :identifier => 'project-d').set_parent!(parent) Project.create!(:name => 'Project A', :identifier => 'project-a').set_parent!(parent) - + parent.reload assert_equal 4, parent.children.size assert_equal parent.children.sort_by(&:name), parent.children end - + def test_rebuild_should_sort_children_alphabetically ProjectCustomField.delete_all parent = Project.create!(:name => 'Parent', :identifier => 'parent') @@ -267,10 +267,10 @@ class ProjectTest < ActiveSupport::TestCase Project.create!(:name => 'Project B', :identifier => 'project-b').move_to_child_of(parent) Project.create!(:name => 'Project D', :identifier => 'project-d').move_to_child_of(parent) Project.create!(:name => 'Project A', :identifier => 'project-a').move_to_child_of(parent) - + Project.update_all("lft = NULL, rgt = NULL") Project.rebuild! - + parent.reload assert_equal 4, parent.children.size assert_equal parent.children.sort_by(&:name), parent.children @@ -295,49 +295,49 @@ class ProjectTest < ActiveSupport::TestCase issue_with_hierarchy_fixed_version.update_attribute(:fixed_version_id, 6) issue_with_hierarchy_fixed_version.reload assert_equal 6, issue_with_hierarchy_fixed_version.fixed_version_id - + # Move project out of the issue's hierarchy moved_project = Project.find(3) moved_project.set_parent!(Project.find(2)) parent_issue.reload issue_with_local_fixed_version.reload issue_with_hierarchy_fixed_version.reload - + assert_equal 4, issue_with_local_fixed_version.fixed_version_id, "Fixed version was not keep on an issue local to the moved project" assert_equal nil, issue_with_hierarchy_fixed_version.fixed_version_id, "Fixed version is still set after moving the Project out of the hierarchy where the version is defined in" assert_equal nil, parent_issue.fixed_version_id, "Fixed version is still set after moving the Version out of the hierarchy for the issue." end - + def test_parent p = Project.find(6).parent assert p.is_a?(Project) assert_equal 5, p.id end - + def test_ancestors a = Project.find(6).ancestors assert a.first.is_a?(Project) assert_equal [1, 5], a.collect(&:id) end - + def test_root r = Project.find(6).root assert r.is_a?(Project) assert_equal 1, r.id end - + def test_children c = Project.find(1).children assert c.first.is_a?(Project) assert_equal [5, 3, 4], c.collect(&:id) end - + def test_descendants d = Project.find(1).descendants assert d.first.is_a?(Project) assert_equal [5, 6, 3, 4], d.collect(&:id) end - + def test_allowed_parents_should_be_empty_for_non_member_user Role.non_member.add_permission!(:add_project) user = User.find(9) @@ -345,7 +345,7 @@ class ProjectTest < ActiveSupport::TestCase User.current = user assert Project.new.allowed_parents.compact.empty? end - + def test_allowed_parents_with_add_subprojects_permission Role.find(1).remove_permission!(:add_project) Role.find(1).add_permission!(:add_subprojects) @@ -387,7 +387,7 @@ class ProjectTest < ActiveSupport::TestCase assert Project.find(3).allowed_parents.include?(Project.find(1)) assert Project.find(3).allowed_parents.include?(nil) end - + def test_users_by_role users_by_role = Project.find(1).users_by_role assert_kind_of Hash, users_by_role @@ -395,29 +395,29 @@ class ProjectTest < ActiveSupport::TestCase assert_kind_of Array, users_by_role[role] assert users_by_role[role].include?(User.find(2)) end - + def test_rolled_up_trackers parent = Project.find(1) parent.trackers = Tracker.find([1,2]) child = parent.children.find(3) - + assert_equal [1, 2], parent.tracker_ids assert_equal [2, 3], child.trackers.collect(&:id) - + assert_kind_of Tracker, parent.rolled_up_trackers.first assert_equal Tracker.find(1), parent.rolled_up_trackers.first - + assert_equal [1, 2, 3], parent.rolled_up_trackers.collect(&:id) assert_equal [2, 3], child.rolled_up_trackers.collect(&:id) end - + def test_rolled_up_trackers_should_ignore_archived_subprojects parent = Project.find(1) parent.trackers = Tracker.find([1,2]) child = parent.children.find(3) child.trackers = Tracker.find([1,3]) parent.children.each(&:archive) - + assert_equal [1,2], parent.rolled_up_trackers.collect(&:id) end @@ -427,11 +427,11 @@ class ProjectTest < ActiveSupport::TestCase @parent_version_1 = Version.generate!(:project => @project) @parent_version_2 = Version.generate!(:project => @project) end - + should "include the versions for the current project" do assert_same_elements [@parent_version_1, @parent_version_2], @project.rolled_up_versions end - + should "include versions for a subproject" do @subproject = Project.generate! @subproject.set_parent!(@project) @@ -443,7 +443,7 @@ class ProjectTest < ActiveSupport::TestCase @subproject_version ], @project.rolled_up_versions end - + should "include versions for a sub-subproject" do @subproject = Project.generate! @subproject.set_parent!(@project) @@ -460,7 +460,7 @@ class ProjectTest < ActiveSupport::TestCase ], @project.rolled_up_versions end - + should "only check active projects" do @subproject = Project.generate! @subproject.set_parent!(@project) @@ -473,7 +473,7 @@ class ProjectTest < ActiveSupport::TestCase assert_same_elements [@parent_version_1, @parent_version_2], @project.rolled_up_versions end end - + def test_shared_versions_none_sharing p = Project.find(5) v = Version.create!(:name => 'none_sharing', :project => p, :sharing => 'none') @@ -493,7 +493,7 @@ class ProjectTest < ActiveSupport::TestCase assert !p.siblings.first.shared_versions.include?(v) assert !p.root.siblings.first.shared_versions.include?(v) end - + def test_shared_versions_hierarchy_sharing p = Project.find(5) v = Version.create!(:name => 'hierarchy_sharing', :project => p, :sharing => 'hierarchy') @@ -528,7 +528,7 @@ class ProjectTest < ActiveSupport::TestCase parent = Project.find(1) child = parent.children.find(3) private_child = parent.children.find(5) - + assert_equal [1,2,3], parent.version_ids.sort assert_equal [4], child.version_ids assert_equal [6], private_child.version_ids @@ -547,7 +547,7 @@ class ProjectTest < ActiveSupport::TestCase child = parent.children.find(3) child.archive parent.reload - + assert_equal [1,2,3], parent.version_ids.sort assert_equal [4], child.version_ids assert !parent.shared_versions.collect(&:id).include?(4) @@ -557,12 +557,12 @@ class ProjectTest < ActiveSupport::TestCase user = User.find(3) parent = Project.find(1) child = parent.children.find(5) - + assert_equal [1,2,3], parent.version_ids.sort assert_equal [6], child.version_ids versions = parent.shared_versions.visible(user) - + assert_equal 4, versions.size versions.each do |version| assert_kind_of Version, version @@ -571,7 +571,7 @@ class ProjectTest < ActiveSupport::TestCase assert !versions.collect(&:id).include?(6) end - + def test_next_identifier ProjectCustomField.delete_all Project.create!(:name => 'last', :identifier => 'p2008040') @@ -582,11 +582,11 @@ class ProjectTest < ActiveSupport::TestCase Project.delete_all assert_nil Project.next_identifier end - + def test_enabled_module_names with_settings :default_projects_modules => ['issue_tracking', 'repository'] do project = Project.new - + project.enabled_module_names = %w(issue_tracking news) assert_equal %w(issue_tracking news), project.enabled_module_names.sort end @@ -614,7 +614,7 @@ class ProjectTest < ActiveSupport::TestCase assert copied_project.id.blank? assert copied_project.name.blank? assert copied_project.identifier.blank? - + # Duplicated attributes assert_equal source_project.description, copied_project.description assert_equal source_project.enabled_modules, copied_project.enabled_modules @@ -692,11 +692,11 @@ class ProjectTest < ActiveSupport::TestCase assert system_activity.active? overridden_activity = TimeEntryActivity.generate!(:project => project, :parent => system_activity, :active => false) assert overridden_activity.save! - + assert !project.activities.include?(overridden_activity), "Inactive Project specific Activity not found" assert !project.activities.include?(system_activity), "System activity found when the project has an inactive override" end - + def test_close_completed_versions Version.update_all("status = 'open'") project = Project.find(1) @@ -734,7 +734,7 @@ class ProjectTest < ActiveSupport::TestCase assert ! issue.assigned_to.blank? assert_equal @project, issue.project end - + copied_issue = @project.issues.first(:conditions => {:subject => "copy issue status"}) assert copied_issue assert copied_issue.status @@ -751,7 +751,7 @@ class ProjectTest < ActiveSupport::TestCase :subject => "change the new issues to use the copied version", :tracker_id => 1, :project_id => @source_project.id) - + assert @project.copy(@source_project) @project.reload copied_issue = @project.issues.first(:conditions => {:subject => "change the new issues to use the copied version"}) @@ -808,10 +808,10 @@ class ProjectTest < ActiveSupport::TestCase assert_equal @project, membership.project end end - + should "copy memberships with groups and additional roles" do group = Group.create!(:lastname => "Copy group") - user = User.find(7) + user = User.find(7) group.users << user # group role Member.create!(:project_id => @source_project.id, :principal => group, :role_ids => [2]) @@ -865,7 +865,7 @@ class ProjectTest < ActiveSupport::TestCase assert_difference 'WikiPage.count', @source_project.wiki.pages.size do assert @project.copy(@source_project) end - + assert @project.wiki assert_equal @source_project.wiki.pages.size, @project.wiki.pages.size @@ -873,7 +873,7 @@ class ProjectTest < ActiveSupport::TestCase assert wiki_page.content assert !@source_project.wiki.pages.include?(wiki_page) end - + parent = @project.wiki.find_page('Parent_page') child1 = @project.wiki.find_page('Child_page_1') child2 = @project.wiki.find_page('Child_page_2') @@ -911,19 +911,19 @@ class ProjectTest < ActiveSupport::TestCase assert_not_equal IssueCategory.find(3), issue.category # Different record end end - + should "limit copy with :only option" do assert @project.members.empty? assert @project.issue_categories.empty? assert @source_project.issues.any? - + assert @project.copy(@source_project, :only => ['members', 'issue_categories']) assert @project.members.any? assert @project.issue_categories.any? assert @project.issues.empty? end - + end context "#start_date" do @@ -932,11 +932,11 @@ class ProjectTest < ActiveSupport::TestCase @project = Project.generate!(:identifier => 'test0') @project.trackers << Tracker.generate! end - + should "be nil if there are no issues on the project" do assert_nil @project.start_date end - + should "be tested when issues have no start date" should "be the earliest start date of it's issues" do @@ -955,11 +955,11 @@ class ProjectTest < ActiveSupport::TestCase @project = Project.generate!(:identifier => 'test0') @project.trackers << Tracker.generate! end - + should "be nil if there are no issues on the project" do assert_nil @project.due_date end - + should "be tested when issues have no due date" should "be the latest due date of it's issues" do @@ -974,7 +974,7 @@ class ProjectTest < ActiveSupport::TestCase future = 7.days.from_now.to_date @project.versions << Version.generate!(:effective_date => future) @project.versions << Version.generate!(:effective_date => Date.today) - + assert_equal future, @project.due_date @@ -985,7 +985,7 @@ class ProjectTest < ActiveSupport::TestCase far_future = 14.days.from_now.to_date Issue.generate_for_project!(@project, :due_date => far_future) @project.versions << Version.generate!(:effective_date => future) - + assert_equal far_future, @project.due_date end @@ -1037,7 +1037,7 @@ class ProjectTest < ActiveSupport::TestCase setup do @project = Project.generate! @role = Role.generate! - + @user_with_membership_notification = User.generate!(:mail_notification => 'selected') Member.generate!(:project => @project, :roles => [@role], :principal => @user_with_membership_notification, :mail_notification => true) @@ -1056,30 +1056,30 @@ class ProjectTest < ActiveSupport::TestCase @only_owned_user = User.generate!(:mail_notification => 'only_owner') Member.generate!(:project => @project, :roles => [@role], :principal => @only_owned_user) end - + should "include members with a mail notification" do assert @project.notified_users.include?(@user_with_membership_notification) end - + should "include users with the 'all' notification option" do assert @project.notified_users.include?(@all_events_user) end - + should "not include users with the 'none' notification option" do assert !@project.notified_users.include?(@no_events_user) end - + should "not include users with the 'only_my_events' notification option" do assert !@project.notified_users.include?(@only_my_events_user) end - + should "not include users with the 'only_assigned' notification option" do assert !@project.notified_users.include?(@only_assigned_user) end - + should "not include users with the 'only_owner' notification option" do assert !@project.notified_users.include?(@only_owned_user) end end - + end diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index 3d80b474..0acd4754 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -20,14 +20,14 @@ class QueryTest < ActiveSupport::TestCase assert query.available_filters.has_key?('cf_1') assert !query.available_filters.has_key?('cf_3') end - + def test_system_shared_versions_should_be_available_in_global_queries Version.find(2).update_attribute :sharing, 'system' query = Query.new(:project => nil, :name => '_') assert query.available_filters.has_key?('fixed_version_id') assert query.available_filters['fixed_version_id'][:values].detect {|v| v.last == '2'} end - + def test_project_filter_in_global_queries query = Query.new(:project => nil, :name => '_') project_filter = query.available_filters["project_id"] @@ -36,10 +36,10 @@ class QueryTest < ActiveSupport::TestCase assert project_ids.include?("1") #public project assert !project_ids.include?("2") #private project user cannot see end - + def find_issues_with_query(query) Issue.find :all, - :include => [ :assigned_to, :status, :tracker, :project, :priority ], + :include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => query.statement end @@ -60,7 +60,7 @@ class QueryTest < ActiveSupport::TestCase assert query.statement.include?("#{Issue.table_name}.fixed_version_id IN ('4')") end - + def test_query_with_multiple_custom_fields query = Query.find(1) assert query.valid? @@ -69,7 +69,7 @@ class QueryTest < ActiveSupport::TestCase assert_equal 1, issues.length assert_equal Issue.find(3), issues.first end - + def test_operator_none query = Query.new(:project => Project.find(1), :name => '_') query.add_filter('fixed_version_id', '!*', ['']) @@ -78,7 +78,7 @@ class QueryTest < ActiveSupport::TestCase assert query.statement.include?("#{CustomValue.table_name}.value IS NULL OR #{CustomValue.table_name}.value = ''") find_issues_with_query(query) end - + def test_operator_none_for_integer query = Query.new(:project => Project.find(1), :name => '_') query.add_filter('estimated_hours', '!*', ['']) @@ -95,7 +95,7 @@ class QueryTest < ActiveSupport::TestCase assert query.statement.include?("#{CustomValue.table_name}.value IS NOT NULL AND #{CustomValue.table_name}.value <> ''") find_issues_with_query(query) end - + def test_operator_greater_than query = Query.new(:project => Project.find(1), :name => '_') query.add_filter('done_ratio', '>=', ['40']) @@ -119,7 +119,7 @@ class QueryTest < ActiveSupport::TestCase assert !issues.empty? issues.each {|issue| assert(issue.due_date >= Date.today && issue.due_date <= (Date.today + 15))} end - + def test_operator_less_than_ago Issue.find(7).update_attribute(:due_date, (Date.today - 3)) query = Query.new(:project => Project.find(1), :name => '_') @@ -128,7 +128,7 @@ class QueryTest < ActiveSupport::TestCase assert !issues.empty? issues.each {|issue| assert(issue.due_date >= (Date.today - 3) && issue.due_date <= Date.today)} end - + def test_operator_more_than_ago Issue.find(7).update_attribute(:due_date, (Date.today - 10)) query = Query.new(:project => Project.find(1), :name => '_') @@ -185,14 +185,14 @@ class QueryTest < ActiveSupport::TestCase assert result.empty? result.each {|issue| assert issue.subject.downcase.include?('unable') } end - + def test_operator_does_not_contains query = Query.new(:project => Project.find(1), :name => '_') query.add_filter('subject', '!~', ['uNable']) assert query.statement.include?("LOWER(#{Issue.table_name}.subject) NOT LIKE '%unable%'") find_issues_with_query(query) end - + def test_filter_watched_issues User.current = User.find(1) query = Query.new(:name => '_', :filters => { 'watcher_id' => {:operator => '=', :values => ['me']}}) @@ -202,7 +202,7 @@ class QueryTest < ActiveSupport::TestCase assert_equal Issue.visible.watched_by(User.current).sort_by(&:id), result.sort_by(&:id) User.current = nil end - + def test_filter_unwatched_issues User.current = User.find(1) query = Query.new(:name => '_', :filters => { 'watcher_id' => {:operator => '!', :values => ['me']}}) @@ -212,12 +212,12 @@ class QueryTest < ActiveSupport::TestCase assert_equal((Issue.visible - Issue.watched_by(User.current)).sort_by(&:id).size, result.sort_by(&:id).size) User.current = nil end - + def test_default_columns q = Query.new - assert !q.columns.empty? + assert !q.columns.empty? end - + def test_set_column_names q = Query.new q.column_names = ['tracker', :subject, '', 'unknonw_column'] @@ -225,7 +225,7 @@ class QueryTest < ActiveSupport::TestCase c = q.columns.first assert q.has_column?(c) end - + def test_groupable_columns_should_include_custom_fields q = Query.new assert q.groupable_columns.detect {|c| c.is_a? QueryCustomFieldColumn} @@ -239,31 +239,31 @@ class QueryTest < ActiveSupport::TestCase assert_not_nil q.group_by_statement assert_equal 'status', q.group_by_statement end - + def test_grouped_with_invalid_column q = Query.new(:group_by => 'foo') assert !q.grouped? assert_nil q.group_by_column assert_nil q.group_by_statement end - + def test_default_sort q = Query.new assert_equal [], q.sort_criteria end - + def test_set_sort_criteria_with_hash q = Query.new q.sort_criteria = {'0' => ['priority', 'desc'], '2' => ['tracker']} assert_equal [['priority', 'desc'], ['tracker', 'asc']], q.sort_criteria end - + def test_set_sort_criteria_with_array q = Query.new q.sort_criteria = [['priority', 'desc'], 'tracker'] assert_equal [['priority', 'desc'], ['tracker', 'asc']], q.sort_criteria end - + def test_create_query_with_sort q = Query.new(:name => 'Sorted') q.sort_criteria = [['priority', 'desc'], 'tracker'] @@ -271,56 +271,56 @@ class QueryTest < ActiveSupport::TestCase q.reload assert_equal [['priority', 'desc'], ['tracker', 'asc']], q.sort_criteria end - + def test_sort_by_string_custom_field_asc q = Query.new c = q.available_columns.find {|col| col.is_a?(QueryCustomFieldColumn) && col.custom_field.field_format == 'string' } assert c assert c.sortable issues = Issue.find :all, - :include => [ :assigned_to, :status, :tracker, :project, :priority ], + :include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => q.statement, :order => "#{c.sortable} ASC" values = issues.collect {|i| i.custom_value_for(c.custom_field).to_s} assert !values.empty? assert_equal values.sort, values end - + def test_sort_by_string_custom_field_desc q = Query.new c = q.available_columns.find {|col| col.is_a?(QueryCustomFieldColumn) && col.custom_field.field_format == 'string' } assert c assert c.sortable issues = Issue.find :all, - :include => [ :assigned_to, :status, :tracker, :project, :priority ], + :include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => q.statement, :order => "#{c.sortable} DESC" values = issues.collect {|i| i.custom_value_for(c.custom_field).to_s} assert !values.empty? assert_equal values.sort.reverse, values end - + def test_sort_by_float_custom_field_asc q = Query.new c = q.available_columns.find {|col| col.is_a?(QueryCustomFieldColumn) && col.custom_field.field_format == 'float' } assert c assert c.sortable issues = Issue.find :all, - :include => [ :assigned_to, :status, :tracker, :project, :priority ], + :include => [ :assigned_to, :status, :tracker, :project, :priority ], :conditions => q.statement, :order => "#{c.sortable} ASC" values = issues.collect {|i| begin; Kernel.Float(i.custom_value_for(c.custom_field).to_s); rescue; nil; end}.compact assert !values.empty? assert_equal values.sort, values end - + def test_invalid_query_should_raise_query_statement_invalid_error q = Query.new assert_raise Query::StatementInvalid do q.issues(:conditions => "foo = 1") end end - + def test_issue_count_by_association_group q = Query.new(:name => '_', :group_by => 'assigned_to') count_by_group = q.issue_count_by_group @@ -338,7 +338,7 @@ class QueryTest < ActiveSupport::TestCase assert_equal %w(Fixnum), count_by_group.values.collect {|k| k.class.name}.uniq assert count_by_group.has_key?('MySQL') end - + def test_issue_count_by_date_custom_field_group q = Query.new(:name => '_', :group_by => 'cf_8') count_by_group = q.issue_count_by_group @@ -346,17 +346,17 @@ class QueryTest < ActiveSupport::TestCase assert_equal %w(Date NilClass), count_by_group.keys.collect {|k| k.class.name}.uniq.sort assert_equal %w(Fixnum), count_by_group.values.collect {|k| k.class.name}.uniq end - + def test_label_for q = Query.new assert_equal 'assigned_to', q.label_for('assigned_to_id') end - + def test_editable_by admin = User.find(1) manager = User.find(2) developer = User.find(3) - + # Public query on project 1 q = Query.find(1) assert q.editable_by?(admin) @@ -386,7 +386,7 @@ class QueryTest < ActiveSupport::TestCase setup do @query = Query.new(:name => "_") end - + should "include users of visible projects in cross-project view" do users = @query.available_filters["assigned_to_id"] assert_not_nil users @@ -403,11 +403,11 @@ class QueryTest < ActiveSupport::TestCase should "be present" do assert @query.available_filters.keys.include?("member_of_group") end - + should "be an optional list" do assert_equal :list_optional, @query.available_filters["member_of_group"][:type] end - + should "have a list of the groups as values" do Group.destroy_all # No fixtures group1 = Group.generate!.reload @@ -426,11 +426,11 @@ class QueryTest < ActiveSupport::TestCase should "be present" do assert @query.available_filters.keys.include?("assigned_to_role") end - + should "be an optional list" do assert_equal :list_optional, @query.available_filters["assigned_to_role"][:type] end - + should "have a list of the Roles as values" do assert @query.available_filters["assigned_to_role"][:values].include?(['Manager','1']) assert @query.available_filters["assigned_to_role"][:values].include?(['Developer','2']) @@ -454,17 +454,17 @@ class QueryTest < ActiveSupport::TestCase @second_user_in_group = User.generate! @user_in_group2 = User.generate! @user_not_in_group = User.generate! - + @group = Group.generate!.reload @group.users << @user_in_group @group.users << @second_user_in_group - + @group2 = Group.generate!.reload @group2.users << @user_in_group2 - + @empty_group = Group.generate!.reload end - + should "search assigned to for users in the group" do @query = Query.new(:name => '_') @query.add_filter('member_of_group', '=', [@group.id.to_s]) @@ -490,19 +490,19 @@ class QueryTest < ActiveSupport::TestCase assert_query_statement_includes @query, "#{Issue.table_name}.assigned_to_id IN ('#{@user_in_group.id}','#{@second_user_in_group.id}','#{@user_in_group2.id}')" assert_find_issues_with_query_is_successful @query end - + should "return no results on empty set" do @query = Query.new(:name => '_') @query.add_filter('member_of_group', '=', [@empty_group.id.to_s]) - + assert_query_statement_includes @query, "(0=1)" assert find_issues_with_query(@query).empty? end - + should "return results on disallowed empty set" do @query = Query.new(:name => '_') @query.add_filter('member_of_group', '!', [@empty_group.id.to_s]) - + assert_query_statement_includes @query, "(1=1)" assert_find_issues_with_query_is_successful @query end @@ -514,7 +514,7 @@ class QueryTest < ActiveSupport::TestCase MemberRole.delete_all Member.delete_all Role.delete_all - + @manager_role = Role.generate!(:name => 'Manager') @developer_role = Role.generate!(:name => 'Developer') @empty_role = Role.generate!(:name => 'Empty') @@ -527,7 +527,7 @@ class QueryTest < ActiveSupport::TestCase User.add_to_project(@developer, @project, @developer_role) User.add_to_project(@boss, @project, [@manager_role, @developer_role]) end - + should "search assigned to for users with the Role" do @query = Query.new(:name => '_') @query.add_filter('assigned_to_role', '=', [@manager_role.id.to_s]) @@ -555,19 +555,19 @@ class QueryTest < ActiveSupport::TestCase should "return no results on empty set" do @query = Query.new(:name => '_') @query.add_filter('assigned_to_role', '=', [@empty_role.id.to_s]) - + assert_query_statement_includes @query, "(0=1)" assert find_issues_with_query(@query).empty? end - + should "return results on disallowed empty set" do @query = Query.new(:name => '_') @query.add_filter('assigned_to_role', '!', [@empty_role.id.to_s]) - + assert_query_statement_includes @query, "(1=1)" assert_find_issues_with_query_is_successful @query end end end - + end diff --git a/test/unit/repository_bazaar_test.rb b/test/unit/repository_bazaar_test.rb index ef44ec66..2e13c70e 100644 --- a/test/unit/repository_bazaar_test.rb +++ b/test/unit/repository_bazaar_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -27,11 +27,11 @@ class RepositoryBazaarTest < ActiveSupport::TestCase assert @repository end - if File.directory?(REPOSITORY_PATH) + if File.directory?(REPOSITORY_PATH) def test_fetch_changesets_from_scratch @repository.fetch_changesets @repository.reload - + assert_equal 4, @repository.changesets.count assert_equal 9, @repository.changes.count assert_equal 'Initial import', @repository.changesets.find_by_revision('1').comments @@ -43,7 +43,7 @@ class RepositoryBazaarTest < ActiveSupport::TestCase @repository.changesets.find(:all).each {|c| c.destroy if c.revision.to_i > 2} @repository.reload assert_equal 2, @repository.changesets.count - + @repository.fetch_changesets assert_equal 4, @repository.changesets.count end @@ -51,14 +51,14 @@ class RepositoryBazaarTest < ActiveSupport::TestCase def test_entries entries = @repository.entries assert_equal 2, entries.size - + assert_equal 'dir', entries[0].kind assert_equal 'directory', entries[0].name - + assert_equal 'file', entries[1].kind assert_equal 'doc-mkdir.txt', entries[1].name end - + def test_entries_in_subdirectory entries = @repository.entries('directory') assert_equal 3, entries.size diff --git a/test/unit/repository_cvs_test.rb b/test/unit/repository_cvs_test.rb index 3a597d4a..d7d39d02 100644 --- a/test/unit/repository_cvs_test.rb +++ b/test/unit/repository_cvs_test.rb @@ -1,41 +1,41 @@ #-- 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. #++ require File.expand_path('../../test_helper', __FILE__) require 'pp' class RepositoryCvsTest < ActiveSupport::TestCase fixtures :projects - + # No '..' in the repository path REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/cvs_repository' REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin? # CVS module MODULE_NAME = 'test' - + def setup @project = Project.find(3) - @repository = Repository::Cvs.create(:project => @project, + @repository = Repository::Cvs.create(:project => @project, :root_url => REPOSITORY_PATH, :url => MODULE_NAME, :log_encoding => 'UTF-8') assert @repository end - - if File.directory?(REPOSITORY_PATH) + + if File.directory?(REPOSITORY_PATH) def test_fetch_changesets_from_scratch assert_equal 0, @repository.changesets.count @repository.fetch_changesets @repository.reload - + assert_equal 5, @repository.changesets.count assert_equal 14, @repository.changes.count assert_not_nil @repository.changesets.find_by_comments('Two files changed') @@ -43,7 +43,7 @@ class RepositoryCvsTest < ActiveSupport::TestCase r2 = @repository.changesets.find_by_revision('2') assert_equal 'v1-20071213-162510', r2.scmid end - + def test_fetch_changesets_incremental assert_equal 0, @repository.changesets.count @repository.fetch_changesets @@ -73,7 +73,7 @@ class RepositoryCvsTest < ActiveSupport::TestCase rev5_committed_on = Time.gm(2007, 12, 13, 16, 30, 1) assert_equal rev5_committed_on, rev5_commit.committed_on end - + def test_deleted_files_should_not_be_listed assert_equal 0, @repository.changesets.count @repository.fetch_changesets diff --git a/test/unit/repository_darcs_test.rb b/test/unit/repository_darcs_test.rb index 34640688..043da477 100644 --- a/test/unit/repository_darcs_test.rb +++ b/test/unit/repository_darcs_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -26,7 +26,7 @@ class RepositoryDarcsTest < ActiveSupport::TestCase assert @repository end - if File.directory?(REPOSITORY_PATH) + if File.directory?(REPOSITORY_PATH) def test_fetch_changesets_from_scratch @repository.fetch_changesets @repository.reload @@ -42,7 +42,7 @@ class RepositoryDarcsTest < ActiveSupport::TestCase @repository.changesets.find(:all).each {|c| c.destroy if c.revision.to_i > 3} @repository.reload assert_equal 3, @repository.changesets.count - + @repository.fetch_changesets assert_equal 6, @repository.changesets.count end diff --git a/test/unit/repository_filesystem_test.rb b/test/unit/repository_filesystem_test.rb index 92891212..39615c18 100644 --- a/test/unit/repository_filesystem_test.rb +++ b/test/unit/repository_filesystem_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -25,7 +25,7 @@ class RepositoryFilesystemTest < ActiveSupport::TestCase :project => @project, :url => REPOSITORY_PATH) end - if File.directory?(REPOSITORY_PATH) + if File.directory?(REPOSITORY_PATH) def test_fetch_changesets @repository.fetch_changesets @repository.reload diff --git a/test/unit/repository_git_test.rb b/test/unit/repository_git_test.rb index b499876c..cd094388 100644 --- a/test/unit/repository_git_test.rb +++ b/test/unit/repository_git_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -64,7 +64,7 @@ class RepositoryGitTest < ActiveSupport::TestCase assert_equal "README", change.path assert_equal "A", change.action end - + def test_fetch_changesets_incremental @repository.fetch_changesets # Remove the 3 latest changesets diff --git a/test/unit/repository_mercurial_test.rb b/test/unit/repository_mercurial_test.rb index 926130e6..2520b945 100644 --- a/test/unit/repository_mercurial_test.rb +++ b/test/unit/repository_mercurial_test.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. #++ require File.expand_path('../../test_helper', __FILE__) class RepositoryMercurialTest < ActiveSupport::TestCase fixtures :projects - + # No '..' in the repository path REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/mercurial_repository' @@ -40,7 +40,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase end end - if File.directory?(REPOSITORY_PATH) + if File.directory?(REPOSITORY_PATH) def test_fetch_changesets_from_scratch @repository.fetch_changesets @repository.reload @@ -56,7 +56,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase @repository.changesets.find(:all).each {|c| c.destroy if c.revision.to_i > 2} @repository.reload assert_equal 3, @repository.changesets.count - + @repository.fetch_changesets assert_equal 29, @repository.changesets.count end @@ -141,7 +141,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase changesets = @repository.latest_changesets('sources', 'tag_test.00') assert_equal %w|4 3 2 1 0|, changesets.collect(&:revision) - + changesets = @repository.latest_changesets('sources', 'tag_test.00', 2) assert_equal %w|4 3|, changesets.collect(&:revision) diff --git a/test/unit/repository_subversion_test.rb b/test/unit/repository_subversion_test.rb index 90a764cb..a8074445 100644 --- a/test/unit/repository_subversion_test.rb +++ b/test/unit/repository_subversion_test.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. #++ require File.expand_path('../../test_helper', __FILE__) class RepositorySubversionTest < ActiveSupport::TestCase - fixtures :projects, :repositories, :enabled_modules, :users, :roles + fixtures :projects, :repositories, :enabled_modules, :users, :roles def setup @project = Project.find(3) @@ -26,7 +26,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase def test_fetch_changesets_from_scratch @repository.fetch_changesets @repository.reload - + assert_equal 11, @repository.changesets.count assert_equal 20, @repository.changes.count assert_equal 'Initial import.', @repository.changesets.find_by_revision('1').comments @@ -38,23 +38,23 @@ class RepositorySubversionTest < ActiveSupport::TestCase @repository.changesets.find(:all).each {|c| c.destroy if c.revision.to_i > 5} @repository.reload assert_equal 5, @repository.changesets.count - + @repository.fetch_changesets assert_equal 11, @repository.changesets.count end def test_latest_changesets @repository.fetch_changesets - + # with limit changesets = @repository.latest_changesets('', nil, 2) assert_equal 2, changesets.size assert_equal @repository.latest_changesets('', nil).slice(0,2), changesets - + # with path changesets = @repository.latest_changesets('subversion_test/folder', nil) assert_equal ["10", "9", "7", "6", "5", "2"], changesets.collect(&:revision) - + # with path and revision changesets = @repository.latest_changesets('subversion_test/folder', 8) assert_equal ["7", "6", "5", "2"], changesets.collect(&:revision) @@ -63,7 +63,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase def test_directory_listing_with_square_brackets_in_path @repository.fetch_changesets @repository.reload - + entries = @repository.entries('subversion_test/[folder_with_brackets]') assert_not_nil entries, 'Expect to find entries in folder_with_brackets' assert_equal 1, entries.size, 'Expect one entry in folder_with_brackets' diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb index d7c83486..f3f4a3e5 100644 --- a/test/unit/repository_test.rb +++ b/test/unit/repository_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -28,23 +28,23 @@ class RepositoryTest < ActiveSupport::TestCase :member_roles, :roles, :enumerations - + def setup @repository = Project.find(1).repository end - + def test_create repository = Repository::Subversion.new(:project => Project.find(3)) assert !repository.save - + repository.url = "svn://localhost" assert repository.save repository.reload - + project = Project.find(3) assert_equal repository, project.repository end - + def test_destroy changesets = Changeset.count(:all, :conditions => "repository_id = 10") changes = Change.count(:all, :conditions => "repository_id = 10", :include => :changeset) @@ -54,7 +54,7 @@ class RepositoryTest < ActiveSupport::TestCase end end end - + def test_should_not_create_with_disabled_scm # disable Subversion Setting.enabled_scm = ['Darcs', 'Git'] @@ -64,11 +64,11 @@ class RepositoryTest < ActiveSupport::TestCase # re-enable Subversion for following tests Setting.delete_all end - + def test_scan_changesets_for_issue_ids Setting.default_language = 'en' Setting.notified_events = ['issue_added','issue_updated'] - + # choosing a status to apply to fix issues Setting.commit_fix_status_id = IssueStatus.find(:first, :conditions => ["is_closed = ?", true]).id Setting.commit_fix_done_ratio = "90" @@ -76,43 +76,43 @@ class RepositoryTest < ActiveSupport::TestCase Setting.commit_fix_keywords = 'fixes , closes' Setting.default_language = 'en' ActionMailer::Base.deliveries.clear - + # make sure issue 1 is not already closed fixed_issue = Issue.find(1) assert !fixed_issue.status.is_closed? old_status = fixed_issue.status - + Repository.scan_changesets_for_issue_ids assert_equal [101, 102], Issue.find(3).changeset_ids - + # fixed issues fixed_issue.reload assert fixed_issue.status.is_closed? assert_equal 90, fixed_issue.done_ratio assert_equal [101], fixed_issue.changeset_ids - + # issue change journal = fixed_issue.journals.last assert_equal User.find_by_login('dlopper'), journal.user assert_equal 'Applied in changeset r2.', journal.notes - + # 2 email notifications assert_equal 2, ActionMailer::Base.deliveries.size mail = ActionMailer::Base.deliveries.first assert_kind_of TMail::Mail, mail assert mail.subject.starts_with?("[#{fixed_issue.project.name} - #{fixed_issue.tracker.name} ##{fixed_issue.id}]") assert mail.body.include?("Status changed from #{old_status} to #{fixed_issue.status}") - + # ignoring commits referencing an issue of another project assert_equal [], Issue.find(4).changesets end - + def test_for_changeset_comments_strip repository = Repository::Mercurial.create( :project => Project.find( 4 ), :url => '/foo/bar/baz' ) comment = <<-COMMENT - This is a loooooooooooooooooooooooooooong comment - - + This is a loooooooooooooooooooooooooooong comment + + COMMENT changeset = Changeset.new( :comments => comment, :commit_date => Time.now, :revision => 0, :scmid => 'f39b7922fb3c', @@ -145,12 +145,12 @@ class RepositoryTest < ActiveSupport::TestCase assert_equal User.find(2), c.user end end - + def test_auto_user_mapping_by_username c = Changeset.create!(:repository => @repository, :committer => 'jsmith', :committed_on => Time.now, :revision => 100, :comments => 'Committed by john.') assert_equal User.find(2), c.user end - + def test_auto_user_mapping_by_email c = Changeset.create!(:repository => @repository, :committer => 'john ', :committed_on => Time.now, :revision => 100, :comments => 'Committed by john.') assert_equal User.find(2), c.user diff --git a/test/unit/role_test.rb b/test/unit/role_test.rb index 31afd823..ae7028f8 100644 --- a/test/unit/role_test.rb +++ b/test/unit/role_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,7 +18,7 @@ class RoleTest < ActiveSupport::TestCase def test_copy_workflows source = Role.find(1) assert_equal 90, source.workflows.size - + target = Role.new(:name => 'Target') assert target.save target.workflows.copy(source) diff --git a/test/unit/search_test.rb b/test/unit/search_test.rb index 410143e8..17dacd5e 100644 --- a/test/unit/search_test.rb +++ b/test/unit/search_test.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. #++ require File.expand_path('../../test_helper', __FILE__) class SearchTest < ActiveSupport::TestCase fixtures :users, - :members, + :members, :member_roles, :projects, :roles, @@ -32,23 +32,23 @@ class SearchTest < ActiveSupport::TestCase @changeset_keyword = '%very first commit%' @changeset = Changeset.find(100) end - + def test_search_by_anonymous User.current = nil - + r = Issue.search(@issue_keyword).first assert r.include?(@issue) r = Changeset.search(@changeset_keyword).first assert r.include?(@changeset) - + # Removes the :view_changesets permission from Anonymous role remove_permission Role.anonymous, :view_changesets - + r = Issue.search(@issue_keyword).first assert r.include?(@issue) r = Changeset.search(@changeset_keyword).first assert !r.include?(@changeset) - + # Make the project private @project.update_attribute :is_public, false r = Issue.search(@issue_keyword).first @@ -56,24 +56,24 @@ class SearchTest < ActiveSupport::TestCase r = Changeset.search(@changeset_keyword).first assert !r.include?(@changeset) end - + def test_search_by_user User.current = User.find_by_login('rhill') assert User.current.memberships.empty? - + r = Issue.search(@issue_keyword).first assert r.include?(@issue) r = Changeset.search(@changeset_keyword).first assert r.include?(@changeset) - + # Removes the :view_changesets permission from Non member role remove_permission Role.non_member, :view_changesets - + r = Issue.search(@issue_keyword).first assert r.include?(@issue) r = Changeset.search(@changeset_keyword).first assert !r.include?(@changeset) - + # Make the project private @project.update_attribute :is_public, false r = Issue.search(@issue_keyword).first @@ -81,11 +81,11 @@ class SearchTest < ActiveSupport::TestCase r = Changeset.search(@changeset_keyword).first assert !r.include?(@changeset) end - + def test_search_by_allowed_member User.current = User.find_by_login('jsmith') assert User.current.projects.include?(@project) - + r = Issue.search(@issue_keyword).first assert r.include?(@issue) r = Changeset.search(@changeset_keyword).first @@ -103,10 +103,10 @@ class SearchTest < ActiveSupport::TestCase # Removes the :view_changesets permission from user's and non member role remove_permission Role.find(1), :view_changesets remove_permission Role.non_member, :view_changesets - + User.current = User.find_by_login('jsmith') assert User.current.projects.include?(@project) - + r = Issue.search(@issue_keyword).first assert r.include?(@issue) r = Changeset.search(@changeset_keyword).first @@ -119,18 +119,18 @@ class SearchTest < ActiveSupport::TestCase r = Changeset.search(@changeset_keyword).first assert !r.include?(@changeset) end - + def test_search_issue_with_multiple_hits_in_journals i = Issue.find(1) assert_equal 2, i.journals.count(:all, :conditions => "notes LIKE '%notes%'") - + r = Issue.search('%notes%').first assert_equal 1, r.size assert_equal i, r.first end - + private - + def remove_permission(role, permission) role.permissions = role.permissions - [ permission ] role.save diff --git a/test/unit/setting_test.rb b/test/unit/setting_test.rb index 1f0afc10..aa429d2c 100644 --- a/test/unit/setting_test.rb +++ b/test/unit/setting_test.rb @@ -1,39 +1,39 @@ #-- 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. #++ require File.expand_path('../../test_helper', __FILE__) class SettingTest < ActiveSupport::TestCase - + def test_read_default assert_equal "ChiliProject", Setting.app_title assert Setting.self_registration? assert !Setting.login_required? end - + def test_update Setting.app_title = "My title" assert_equal "My title", Setting.app_title # make sure db has been updated (INSERT) assert_equal "My title", Setting.find_by_name('app_title').value - + Setting.app_title = "My other title" assert_equal "My other title", Setting.app_title # make sure db has been updated (UPDATE) assert_equal "My other title", Setting.find_by_name('app_title').value end - + def test_serialized_setting - Setting.notified_events = ['issue_added', 'issue_updated', 'news_added'] + Setting.notified_events = ['issue_added', 'issue_updated', 'news_added'] assert_equal ['issue_added', 'issue_updated', 'news_added'], Setting.notified_events assert_equal ['issue_added', 'issue_updated', 'news_added'], Setting.find_by_name('notified_events').value end diff --git a/test/unit/testing_test.rb b/test/unit/testing_test.rb index dd00ae25..1222c5c6 100644 --- a/test/unit/testing_test.rb +++ b/test/unit/testing_test.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. #++ require File.expand_path('../../test_helper', __FILE__) diff --git a/test/unit/time_entry_activity_test.rb b/test/unit/time_entry_activity_test.rb index 78e0b179..ced7606b 100644 --- a/test/unit/time_entry_activity_test.rb +++ b/test/unit/time_entry_activity_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,7 +18,7 @@ class TimeEntryActivityTest < ActiveSupport::TestCase def test_should_be_an_enumeration assert TimeEntryActivity.ancestors.include?(Enumeration) end - + def test_objects_count assert_equal 3, TimeEntryActivity.find_by_name("Design").objects_count assert_equal 1, TimeEntryActivity.find_by_name("Development").objects_count @@ -68,7 +68,7 @@ class TimeEntryActivityTest < ActiveSupport::TestCase e.custom_field_values = {field.id => ""} assert !e.save assert e.errors.on(:custom_values) - + # Update custom field to valid value, save should succeed e.custom_field_values = {field.id => "0"} assert e.save diff --git a/test/unit/time_entry_test.rb b/test/unit/time_entry_test.rb index dab9b5e4..0cc112b0 100644 --- a/test/unit/time_entry_test.rb +++ b/test/unit/time_entry_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -33,47 +33,47 @@ class TimeEntryTest < ActiveSupport::TestCase "3 hours" => 3.0, "12min" => 0.2, } - + assertions.each do |k, v| t = TimeEntry.new(:hours => k) assert_equal v, t.hours, "Converting #{k} failed:" end end - + def test_hours_should_default_to_nil assert_nil TimeEntry.new.hours end - + def test_spent_on_with_blank c = TimeEntry.new c.spent_on = '' assert_nil c.spent_on end - + def test_spent_on_with_nil c = TimeEntry.new c.spent_on = nil assert_nil c.spent_on end - + def test_spent_on_with_string c = TimeEntry.new c.spent_on = "2011-01-14" assert_equal Date.parse("2011-01-14"), c.spent_on end - + def test_spent_on_with_invalid_string c = TimeEntry.new c.spent_on = "foo" assert_nil c.spent_on end - + def test_spent_on_with_date c = TimeEntry.new c.spent_on = Date.today assert_equal Date.today, c.spent_on end - + def test_spent_on_with_time c = TimeEntry.new c.spent_on = Time.now @@ -89,7 +89,7 @@ class TimeEntryTest < ActiveSupport::TestCase :issue => @issue, :project => @public_project) end - + context "without a project" do should "return the lowest spent_on value that is visible to the current user" do assert_equal "2007-03-12", TimeEntry.earilest_date_for_project.to_s @@ -101,7 +101,7 @@ class TimeEntryTest < ActiveSupport::TestCase assert_equal "2010-01-01", TimeEntry.earilest_date_for_project(@public_project).to_s end end - + end context "#latest_date_for_project" do @@ -126,5 +126,5 @@ class TimeEntryTest < ActiveSupport::TestCase assert_equal "2007-04-22", TimeEntry.latest_date_for_project(project).to_s end end - end + end end diff --git a/test/unit/token_test.rb b/test/unit/token_test.rb index 6802634b..1625e8a9 100644 --- a/test/unit/token_test.rb +++ b/test/unit/token_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -21,7 +21,7 @@ class TokenTest < ActiveSupport::TestCase assert_equal 40, token.value.length assert !token.expired? end - + def test_create_should_remove_existing_tokens user = User.find(1) t1 = Token.create(:user => user, :action => 'autologin') diff --git a/test/unit/tracker_test.rb b/test/unit/tracker_test.rb index ee8c832d..de81487d 100644 --- a/test/unit/tracker_test.rb +++ b/test/unit/tracker_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -18,25 +18,25 @@ class TrackerTest < ActiveSupport::TestCase def test_copy_workflows source = Tracker.find(1) assert_equal 89, source.workflows.size - + target = Tracker.new(:name => 'Target') assert target.save target.workflows.copy(source) target.reload assert_equal 89, target.workflows.size end - + def test_issue_statuses tracker = Tracker.find(1) Workflow.delete_all Workflow.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 2, :new_status_id => 3) Workflow.create!(:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 5) - + assert_kind_of Array, tracker.issue_statuses assert_kind_of IssueStatus, tracker.issue_statuses.first assert_equal [2, 3, 5], Tracker.find(1).issue_statuses.collect(&:id) end - + def test_issue_statuses_empty Workflow.delete_all("tracker_id = 1") assert_equal [], Tracker.find(1).issue_statuses diff --git a/test/unit/user_preference_test.rb b/test/unit/user_preference_test.rb index bfd301bb..e89c49e6 100644 --- a/test/unit/user_preference_test.rb +++ b/test/unit/user_preference_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -20,18 +20,18 @@ class UserPreferenceTest < ActiveSupport::TestCase user.login = "newuser" user.password, user.password_confirmation = "password", "password" assert user.save - + assert_kind_of UserPreference, user.pref assert_kind_of Hash, user.pref.others assert user.pref.save end - + def test_update user = User.find(1) assert_equal true, user.pref.hide_mail user.pref['preftest'] = 'value' assert user.pref.save - + user.reload assert_equal 'value', user.pref['preftest'] end diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 233efbfc..2ff63a67 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -26,11 +26,11 @@ class UserTest < ActiveSupport::TestCase User.generate_with_protected!(:firstname => 'Testing connection') assert_equal 2, User.count(:all, :conditions => {:firstname => 'Testing connection'}) end - + def test_truth assert_kind_of User, @jsmith end - + def test_mail_should_be_stripped u = User.new u.mail = " foo@bar.com " @@ -39,13 +39,13 @@ class UserTest < ActiveSupport::TestCase def test_create user = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo") - + user.login = "jsmith" user.password, user.password_confirmation = "password", "password" # login uniqueness assert !user.save assert_equal 1, user.errors.count - + user.login = "newuser" user.password, user.password_confirmation = "passwd", "password" # password confirmation @@ -67,14 +67,14 @@ class UserTest < ActiveSupport::TestCase end end end - + context "User.login" do should "be case-insensitive." do u = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo") u.login = 'newuser' u.password, u.password_confirmation = "password", "password" assert u.save - + u = User.new(:firstname => "Similar", :lastname => "User", :mail => "similaruser@somenet.foo") u.login = 'NewUser' u.password, u.password_confirmation = "password", "password" @@ -88,7 +88,7 @@ class UserTest < ActiveSupport::TestCase u.login = 'newuser1' u.password, u.password_confirmation = "password", "password" assert u.save - + u = User.new(:firstname => "new", :lastname => "user", :mail => "newUser@Somenet.foo") u.login = 'newuser2' u.password, u.password_confirmation = "password", "password" @@ -103,26 +103,26 @@ class UserTest < ActiveSupport::TestCase @admin.reload assert_equal "john", @admin.login end - + def test_destroy User.find(2).destroy assert_nil User.find_by_id(2) assert Member.find_all_by_user_id(2).empty? end - + def test_validate_login_presence @admin.login = "" assert !@admin.save assert_equal 1, @admin.errors.count end - + def test_validate_mail_notification_inclusion u = User.new u.mail_notification = 'foo' u.save assert_not_nil u.errors.on(:mail_notification) end - + context "User#try_to_login" do should "fall-back to case-insensitive if user login is not found as-typed." do user = User.try_to_login("AdMin", "admin") @@ -148,12 +148,12 @@ class UserTest < ActiveSupport::TestCase assert_equal "admin", user.login user.password = "hello" assert user.save - + user = User.try_to_login("admin", "hello") assert_kind_of User, user assert_equal "admin", user.login end - + def test_name_format assert_equal 'Smith, John', @jsmith.name(:lastname_coma_firstname) Setting.user_format = :firstname_lastname @@ -161,18 +161,18 @@ class UserTest < ActiveSupport::TestCase Setting.user_format = :username assert_equal 'jsmith', @jsmith.reload.name end - + def test_lock user = User.try_to_login("jsmith", "jsmith") assert_equal @jsmith, user - + @jsmith.status = User::STATUS_LOCKED assert @jsmith.save - + user = User.try_to_login("jsmith", "jsmith") - assert_equal nil, user + assert_equal nil, user end - + context ".try_to_login" do context "with good credentials" do should "return the user" do @@ -181,21 +181,21 @@ class UserTest < ActiveSupport::TestCase assert_equal "admin", user.login end end - + context "with wrong credentials" do should "return nil" do assert_nil User.try_to_login("admin", "foo") end end end - + if ldap_configured? context "#try_to_login using LDAP" do context "with failed connection to the LDAP server" do should "return nil" do @auth_source = AuthSourceLdap.find(1) AuthSource.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError, 'Cannot connect') - + assert_equal nil, User.try_to_login('edavis', 'wrong') end end @@ -205,7 +205,7 @@ class UserTest < ActiveSupport::TestCase assert_equal nil, User.try_to_login('edavis', 'wrong') end end - + context "on the fly registration" do setup do @auth_source = AuthSourceLdap.find(1) @@ -218,12 +218,12 @@ class UserTest < ActiveSupport::TestCase assert !user.admin? end end - + should "retrieve existing user" do user = User.try_to_login('edavis', '123456') user.admin = true user.save! - + assert_no_difference('User.count') do user = User.try_to_login('edavis', '123456') assert user.admin? @@ -236,7 +236,7 @@ class UserTest < ActiveSupport::TestCase else puts "Skipping LDAP tests." end - + def test_create_anonymous AnonymousUser.delete_all anon = User.anonymous @@ -250,12 +250,12 @@ class UserTest < ActiveSupport::TestCase assert_nil @jsmith.rss_token key = @jsmith.rss_key assert_equal 40, key.length - + @jsmith.reload assert_equal key, @jsmith.rss_key end - + should_have_one :api_token context "User#api_key" do @@ -274,7 +274,7 @@ class UserTest < ActiveSupport::TestCase token = Token.generate!(:action => 'api') user.api_token = token assert user.save - + assert_equal token.value, user.api_key end end @@ -298,7 +298,7 @@ class UserTest < ActiveSupport::TestCase token = Token.generate!(:action => 'api') user.api_token = token user.save - + assert_equal user, User.find_by_api_key(token.value) end end @@ -308,11 +308,11 @@ class UserTest < ActiveSupport::TestCase roles = @jsmith.roles_for_project(Project.find(1)) assert_kind_of Role, roles.first assert_equal "Manager", roles.first.name - + # user with no role assert_nil @dlopper.roles_for_project(Project.find(2)).detect {|role| role.member?} end - + def test_projects_by_role_for_user_with_role user = User.find(2) assert_kind_of Hash, user.projects_by_role @@ -320,12 +320,12 @@ class UserTest < ActiveSupport::TestCase assert_equal [1,5], user.projects_by_role[Role.find(1)].collect(&:id).sort assert_equal [2], user.projects_by_role[Role.find(2)].collect(&:id).sort end - + def test_projects_by_role_for_user_with_no_role user = User.generate! assert_equal({}, user.projects_by_role) end - + def test_projects_by_role_for_anonymous assert_equal({}, User.anonymous.projects_by_role) end @@ -336,13 +336,13 @@ class UserTest < ActiveSupport::TestCase # with memberships assert_equal 6, User.find(2).valid_notification_options.size end - + def test_valid_notification_options_class_method assert_equal 5, User.valid_notification_options.size assert_equal 5, User.valid_notification_options(User.find(7)).size assert_equal 6, User.valid_notification_options(User.find(2)).size end - + def test_mail_notification_all @jsmith.mail_notification = 'all' @jsmith.notified_project_ids = [] @@ -350,7 +350,7 @@ class UserTest < ActiveSupport::TestCase @jsmith.reload assert @jsmith.projects.first.recipients.include?(@jsmith.mail) end - + def test_mail_notification_selected @jsmith.mail_notification = 'selected' @jsmith.notified_project_ids = [1] @@ -358,7 +358,7 @@ class UserTest < ActiveSupport::TestCase @jsmith.reload assert Project.find(1).recipients.include?(@jsmith.mail) end - + def test_mail_notification_only_my_events @jsmith.mail_notification = 'only_my_events' @jsmith.notified_project_ids = [] @@ -366,7 +366,7 @@ class UserTest < ActiveSupport::TestCase @jsmith.reload assert !@jsmith.projects.first.recipients.include?(@jsmith.mail) end - + def test_comments_sorting_preference assert !@jsmith.wants_comments_in_reverse_order? @jsmith.pref.comments_sorting = 'asc' @@ -374,13 +374,13 @@ class UserTest < ActiveSupport::TestCase @jsmith.pref.comments_sorting = 'desc' assert @jsmith.wants_comments_in_reverse_order? end - + def test_find_by_mail_should_be_case_insensitive u = User.find_by_mail('JSmith@somenet.foo') assert_not_nil u assert_equal 'jsmith@somenet.foo', u.mail end - + def test_random_password u = User.new u.random_password @@ -396,7 +396,7 @@ class UserTest < ActiveSupport::TestCase should "delegate to the auth source" do user = User.generate_with_protected! - + allowed_auth_source = AuthSource.generate! def allowed_auth_source.allow_password_changes?; true; end @@ -413,7 +413,7 @@ class UserTest < ActiveSupport::TestCase end end - + context "#allowed_to?" do context "with a unique project" do should "return false if project is archived" do @@ -421,14 +421,14 @@ class UserTest < ActiveSupport::TestCase Project.any_instance.stubs(:status).returns(Project::STATUS_ARCHIVED) assert ! @admin.allowed_to?(:view_issues, Project.find(1)) end - + should "return false if related module is disabled" do project = Project.find(1) project.enabled_module_names = ["issue_tracking"] assert @admin.allowed_to?(:add_issues, project) assert ! @admin.allowed_to?(:view_wiki_pages, project) end - + should "authorize nearly everything for admin users" do project = Project.find(1) assert ! @admin.member_of?(project) @@ -436,7 +436,7 @@ class UserTest < ActiveSupport::TestCase assert @admin.allowed_to?(p.to_sym, project) end end - + should "authorize normal users depending on their roles" do project = Project.find(1) assert @jsmith.allowed_to?(:delete_messages, project) #Manager @@ -448,19 +448,19 @@ class UserTest < ActiveSupport::TestCase should "return false if array is empty" do assert ! @admin.allowed_to?(:view_project, []) end - + should "return true only if user has permission on all these projects" do assert @admin.allowed_to?(:view_project, Project.all) assert ! @dlopper.allowed_to?(:view_project, Project.all) #cannot see Project(2) assert @jsmith.allowed_to?(:edit_issues, @jsmith.projects) #Manager or Developer everywhere assert ! @jsmith.allowed_to?(:delete_issue_watchers, @jsmith.projects) #Dev cannot delete_issue_watchers end - + should "behave correctly with arrays of 1 project" do assert ! User.anonymous.allowed_to?(:delete_issues, [Project.first]) end end - + context "with options[:global]" do should "authorize if user has at least one role that has this permission" do @dlopper2 = User.find(5) #only Developper on a project, not Manager anywhere @@ -473,7 +473,7 @@ class UserTest < ActiveSupport::TestCase end end end - + context "User#notify_about?" do context "Issues" do setup do @@ -487,58 +487,58 @@ class UserTest < ActiveSupport::TestCase @author.update_attribute(:mail_notification, 'all') assert @author.notify_about?(@issue) end - + should "be false for a user with :none" do @author.update_attribute(:mail_notification, 'none') assert ! @author.notify_about?(@issue) end - + should "be false for a user with :only_my_events and isn't an author, creator, or assignee" do @user = User.generate_with_protected!(:mail_notification => 'only_my_events') Member.create!(:user => @user, :project => @project, :role_ids => [1]) assert ! @user.notify_about?(@issue) end - + should "be true for a user with :only_my_events and is the author" do @author.update_attribute(:mail_notification, 'only_my_events') assert @author.notify_about?(@issue) end - + should "be true for a user with :only_my_events and is the assignee" do @assignee.update_attribute(:mail_notification, 'only_my_events') assert @assignee.notify_about?(@issue) end - + should "be true for a user with :only_assigned and is the assignee" do @assignee.update_attribute(:mail_notification, 'only_assigned') assert @assignee.notify_about?(@issue) end - + should "be false for a user with :only_assigned and is not the assignee" do @author.update_attribute(:mail_notification, 'only_assigned') assert ! @author.notify_about?(@issue) end - + should "be true for a user with :only_owner and is the author" do @author.update_attribute(:mail_notification, 'only_owner') assert @author.notify_about?(@issue) end - + should "be false for a user with :only_owner and is not the author" do @assignee.update_attribute(:mail_notification, 'only_owner') assert ! @assignee.notify_about?(@issue) end - + should "be true for a user with :selected and is the author" do @author.update_attribute(:mail_notification, 'selected') assert @author.notify_about?(@issue) end - + should "be true for a user with :selected and is the assignee" do @assignee.update_attribute(:mail_notification, 'selected') assert @assignee.notify_about?(@issue) end - + should "be false for a user with :selected and is not the author or assignee" do @user = User.generate_with_protected!(:mail_notification => 'selected') Member.create!(:user => @user, :project => @project, :role_ids => [1]) @@ -557,9 +557,9 @@ class UserTest < ActiveSupport::TestCase user.salt = nil user.hashed_password = User.hash_password("unsalted") user.save! - + User.salt_unsalted_passwords! - + user.reload # Salt added assert !user.salt.blank? @@ -567,9 +567,9 @@ class UserTest < ActiveSupport::TestCase assert user.check_password?("unsalted") assert_equal user, User.try_to_login(user.login, "unsalted") end - + if Object.const_defined?(:OpenID) - + def test_setting_identity_url normalized_open_id_url = 'http://example.com/' u = User.new( :identity_url => 'http://example.com/' ) @@ -587,18 +587,18 @@ class UserTest < ActiveSupport::TestCase u = User.new( :identity_url => 'example.com' ) assert_equal normalized_open_id_url, u.identity_url end - + def test_setting_blank_identity_url u = User.new( :identity_url => 'example.com' ) u.identity_url = '' assert u.identity_url.blank? end - + def test_setting_invalid_identity_url u = User.new( :identity_url => 'this is not an openid url' ) assert u.identity_url.blank? end - + else puts "Skipping openid tests." end diff --git a/test/unit/version_test.rb b/test/unit/version_test.rb index 88f47cb1..cbbdad84 100644 --- a/test/unit/version_test.rb +++ b/test/unit/version_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -17,13 +17,13 @@ class VersionTest < ActiveSupport::TestCase def setup end - + def test_create v = Version.new(:project => Project.find(1), :name => '1.1', :effective_date => '2011-03-25') assert v.save assert_equal 'open', v.status end - + def test_invalid_effective_date_validation v = Version.new(:project => Project.find(1), :name => '1.1', :effective_date => '99999-01-01') assert !v.save @@ -51,17 +51,17 @@ class VersionTest < ActiveSupport::TestCase assert_equal '2010-01-05', v.start_date.to_s end end - + end - - + + def test_progress_should_be_0_with_no_assigned_issues project = Project.find(1) v = Version.create!(:project => project, :name => 'Progress') assert_equal 0, v.completed_pourcent assert_equal 0, v.closed_pourcent end - + def test_progress_should_be_0_with_unbegun_assigned_issues project = Project.find(1) v = Version.create!(:project => project, :name => 'Progress') @@ -70,7 +70,7 @@ class VersionTest < ActiveSupport::TestCase assert_progress_equal 0, v.completed_pourcent assert_progress_equal 0, v.closed_pourcent end - + def test_progress_should_be_100_with_closed_assigned_issues project = Project.find(1) status = IssueStatus.find(:first, :conditions => {:is_closed => true}) @@ -82,7 +82,7 @@ class VersionTest < ActiveSupport::TestCase assert_progress_equal 100.0, v.completed_pourcent assert_progress_equal 100.0, v.closed_pourcent end - + def test_progress_should_consider_done_ratio_of_open_assigned_issues project = Project.find(1) v = Version.create!(:project => project, :name => 'Progress') @@ -92,7 +92,7 @@ class VersionTest < ActiveSupport::TestCase assert_progress_equal (0.0 + 20.0 + 70.0)/3, v.completed_pourcent assert_progress_equal 0, v.closed_pourcent end - + def test_progress_should_consider_closed_issues_as_completed project = Project.find(1) v = Version.create!(:project => project, :name => 'Progress') @@ -102,7 +102,7 @@ class VersionTest < ActiveSupport::TestCase assert_progress_equal (0.0 + 20.0 + 100.0)/3, v.completed_pourcent assert_progress_equal (100.0)/3, v.closed_pourcent end - + def test_progress_should_consider_estimated_hours_to_weigth_issues project = Project.find(1) v = Version.create!(:project => project, :name => 'Progress') @@ -113,7 +113,7 @@ class VersionTest < ActiveSupport::TestCase assert_progress_equal (10.0*0 + 20.0*0.3 + 40*0.1 + 25.0*1)/95.0*100, v.completed_pourcent assert_progress_equal 25.0/95.0*100, v.closed_pourcent end - + def test_progress_should_consider_average_estimated_hours_to_weigth_unestimated_issues project = Project.find(1) v = Version.create!(:project => project, :name => 'Progress') @@ -133,7 +133,7 @@ class VersionTest < ActiveSupport::TestCase @version = Version.generate!(:project => @project, :effective_date => nil) end - + should "be false if there are no issues assigned" do @version.update_attribute(:effective_date, Date.yesterday) assert_equal false, @version.behind_schedule? @@ -179,22 +179,22 @@ class VersionTest < ActiveSupport::TestCase setup do @version = Version.create!(:project_id => 1, :name => '#estimated_hours') end - + should "return 0 with no assigned issues" do assert_equal 0, @version.estimated_hours end - + should "return 0 with no estimated hours" do add_issue(@version) assert_equal 0, @version.estimated_hours end - + should "return the sum of estimated hours" do add_issue(@version, :estimated_hours => 2.5) add_issue(@version, :estimated_hours => 5) assert_equal 7.5, @version.estimated_hours end - + should "return the sum of leaves estimated hours" do parent = add_issue(@version) add_issue(@version, :estimated_hours => 2.5, :parent_issue_id => parent.id) @@ -205,17 +205,17 @@ class VersionTest < ActiveSupport::TestCase test "should update all issue's fixed_version associations in case the hierarchy changed XXX" do User.current = User.find(1) # Need the admin's permissions - + @version = Version.find(7) # Separate hierarchy project_1_issue = Issue.find(1) project_1_issue.fixed_version = @version assert project_1_issue.save, project_1_issue.errors.full_messages.to_s - + project_5_issue = Issue.find(6) project_5_issue.fixed_version = @version assert project_5_issue.save - + # Project project_2_issue = Issue.find(4) project_2_issue.fixed_version = @version @@ -228,7 +228,7 @@ class VersionTest < ActiveSupport::TestCase # Project 1 now out of the shared scope project_1_issue.reload assert_equal nil, project_1_issue.fixed_version, "Fixed version is still set after changing the Version's sharing" - + # Project 5 now out of the shared scope project_5_issue.reload assert_equal nil, project_5_issue.fixed_version, "Fixed version is still set after changing the Version's sharing" @@ -237,9 +237,9 @@ class VersionTest < ActiveSupport::TestCase project_2_issue.reload assert_equal @version, project_2_issue.fixed_version end - + private - + def add_issue(version, attributes={}) Issue.create!({:project => version.project, :fixed_version => version, @@ -247,7 +247,7 @@ class VersionTest < ActiveSupport::TestCase :author => User.find(:first), :tracker => version.project.trackers.find(:first)}.merge(attributes)) end - + def assert_progress_equal(expected_float, actual_float, message="") assert_in_delta(expected_float, actual_float, 0.000001, message="") end diff --git a/test/unit/watcher_test.rb b/test/unit/watcher_test.rb index 835dc3b3..4fc74072 100644 --- a/test/unit/watcher_test.rb +++ b/test/unit/watcher_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -23,35 +23,35 @@ class WatcherTest < ActiveSupport::TestCase @user = User.find(1) @issue = Issue.find(1) end - + def test_watch assert @issue.add_watcher(@user) @issue.reload assert @issue.watchers.detect { |w| w.user == @user } end - + def test_cant_watch_twice assert @issue.add_watcher(@user) assert !@issue.add_watcher(@user) end - + def test_watched_by assert @issue.add_watcher(@user) @issue.reload assert @issue.watched_by?(@user) assert Issue.watched_by(@user).include?(@issue) end - + def test_watcher_user_ids issue = Issue.new issue.watcher_user_ids = ['1', '3'] assert issue.watched_by?(User.find(1)) end - + def test_recipients @issue.watchers.delete_all @issue.reload - + assert @issue.watcher_recipients.empty? assert @issue.add_watcher(@user) @@ -65,41 +65,41 @@ class WatcherTest < ActiveSupport::TestCase @issue.reload assert !@issue.watcher_recipients.include?(@user.mail) end - + def test_unwatch assert @issue.add_watcher(@user) @issue.reload - assert_equal 1, @issue.remove_watcher(@user) + assert_equal 1, @issue.remove_watcher(@user) end - + def test_prune Watcher.delete_all("user_id = 9") user = User.find(9) - + # public Watcher.create!(:watchable => Issue.find(1), :user => user) Watcher.create!(:watchable => Issue.find(2), :user => user) Watcher.create!(:watchable => Message.find(1), :user => user) Watcher.create!(:watchable => Wiki.find(1), :user => user) Watcher.create!(:watchable => WikiPage.find(2), :user => user) - + # private project (id: 2) Member.create!(:project => Project.find(2), :principal => user, :role_ids => [1]) Watcher.create!(:watchable => Issue.find(4), :user => user) Watcher.create!(:watchable => Message.find(7), :user => user) Watcher.create!(:watchable => Wiki.find(2), :user => user) Watcher.create!(:watchable => WikiPage.find(3), :user => user) - + assert_no_difference 'Watcher.count' do Watcher.prune(:user => User.find(9)) end - + Member.delete_all - + assert_difference 'Watcher.count', -4 do Watcher.prune(:user => User.find(9)) end - + assert Issue.find(1).watched_by?(user) assert !Issue.find(4).watched_by?(user) end diff --git a/test/unit/wiki_content_test.rb b/test/unit/wiki_content_test.rb index e0f06fdf..39c48747 100644 --- a/test/unit/wiki_content_test.rb +++ b/test/unit/wiki_content_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -19,13 +19,13 @@ class WikiContentTest < ActiveSupport::TestCase @wiki = Wiki.find(1) @page = @wiki.pages.first end - + def test_create - page = WikiPage.new(:wiki => @wiki, :title => "Page") + page = WikiPage.new(:wiki => @wiki, :title => "Page") page.content = WikiContent.new(:text => "Content text", :author => User.find(1), :comments => "My comment") assert page.save page.reload - + content = page.content assert_kind_of WikiContent, content assert_equal 1, content.version @@ -35,14 +35,14 @@ class WikiContentTest < ActiveSupport::TestCase assert_equal User.find(1), content.author assert_equal content.text, content.versions.last.text end - + def test_create_should_send_email_notification Setting.notified_events = ['wiki_content_added'] ActionMailer::Base.deliveries.clear - page = WikiPage.new(:wiki => @wiki, :title => "A new page") + page = WikiPage.new(:wiki => @wiki, :title => "A new page") page.content = WikiContent.new(:text => "Content text", :author => User.find(1), :comments => "My comment") assert page.save - + assert_equal 1, ActionMailer::Base.deliveries.size end @@ -55,26 +55,26 @@ class WikiContentTest < ActiveSupport::TestCase assert_equal version_count+1, content.version assert_equal version_count+1, content.versions.length end - + def test_update_should_send_email_notification Setting.notified_events = ['wiki_content_updated'] ActionMailer::Base.deliveries.clear content = @page.content content.text = "My new content" assert content.save - + assert_equal 1, ActionMailer::Base.deliveries.size end - + def test_fetch_history assert !@page.content.journals.empty? @page.content.journals.each do |journal| assert_kind_of String, journal.text end end - + def test_large_text_should_not_be_truncated_to_64k - page = WikiPage.new(:wiki => @wiki, :title => "Big page") + page = WikiPage.new(:wiki => @wiki, :title => "Big page") page.content = WikiContent.new(:text => "a" * 500.kilobyte, :author => User.find(1)) assert page.save page.reload diff --git a/test/unit/wiki_page_test.rb b/test/unit/wiki_page_test.rb index b84bf1ce..77b32073 100644 --- a/test/unit/wiki_page_test.rb +++ b/test/unit/wiki_page_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -19,45 +19,45 @@ class WikiPageTest < ActiveSupport::TestCase @wiki = Wiki.find(1) @page = @wiki.pages.first end - + def test_create page = WikiPage.new(:wiki => @wiki) assert !page.save assert_equal 1, page.errors.count - + page.title = "Page" assert page.save page.reload assert !page.protected? - + @wiki.reload assert @wiki.pages.include?(page) end - + def test_sidebar_should_be_protected_by_default page = @wiki.find_or_new_page('sidebar') assert page.new_record? assert page.protected? end - + def test_find_or_new_page page = @wiki.find_or_new_page("CookBook documentation") assert_kind_of WikiPage, page assert !page.new_record? - + page = @wiki.find_or_new_page("Non existing page") assert_kind_of WikiPage, page assert page.new_record? end - + def test_parent_title page = WikiPage.find_by_title('Another_page') assert_nil page.parent_title - + page = WikiPage.find_by_title('Page_with_an_inline_image') assert_equal 'CookBook documentation', page.parent_title end - + def test_assign_parent page = WikiPage.find_by_title('Another_page') page.parent_title = 'CookBook documentation' @@ -65,7 +65,7 @@ class WikiPageTest < ActiveSupport::TestCase page.reload assert_equal WikiPage.find_by_title('CookBook_documentation'), page.parent end - + def test_unassign_parent page = WikiPage.find_by_title('Page_with_an_inline_image') page.parent_title = '' @@ -73,10 +73,10 @@ class WikiPageTest < ActiveSupport::TestCase page.reload assert_nil page.parent end - + def test_parent_validation page = WikiPage.find_by_title('CookBook_documentation') - + # A page that doesn't exist page.parent_title = 'Unknown title' assert !page.save @@ -93,7 +93,7 @@ class WikiPageTest < ActiveSupport::TestCase page.parent_title = 'Another_page' assert page.save end - + def test_destroy page = WikiPage.find(1) content_ids = WikiContent.find_all_by_page_id(1).collect(&:id) @@ -105,21 +105,21 @@ class WikiPageTest < ActiveSupport::TestCase assert WikiContent.journal_class.find_all_by_journaled_id(wiki_content_id).empty? end end - + def test_destroy_should_not_nullify_children page = WikiPage.find(2) child_ids = page.child_ids assert child_ids.any? page.destroy assert_nil WikiPage.find_by_id(2) - + children = WikiPage.find_all_by_id(child_ids) assert_equal child_ids.size, children.size children.each do |child| assert_nil child.parent_id end end - + def test_updated_on_eager_load page = WikiPage.with_updated_on.first assert page.is_a?(WikiPage) diff --git a/test/unit/wiki_redirect_test.rb b/test/unit/wiki_redirect_test.rb index 7aae7a3f..e62dac70 100644 --- a/test/unit/wiki_redirect_test.rb +++ b/test/unit/wiki_redirect_test.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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -19,28 +19,28 @@ class WikiRedirectTest < ActiveSupport::TestCase @wiki = Wiki.find(1) @original = WikiPage.create(:wiki => @wiki, :title => 'Original title') end - + def test_create_redirect @original.title = 'New title' assert @original.save @original.reload - + assert_equal 'New_title', @original.title assert @wiki.redirects.find_by_title('Original_title') assert @wiki.find_page('Original title') assert @wiki.find_page('ORIGINAL title') end - + def test_update_redirect # create a redirect that point to this page assert WikiRedirect.create(:wiki => @wiki, :title => 'An_old_page', :redirects_to => 'Original_title') - + @original.title = 'New title' @original.save # make sure the old page now points to the new page assert_equal 'New_title', @wiki.find_page('An old page').title end - + def test_reverse_rename # create a redirect that point to this page assert WikiRedirect.create(:wiki => @wiki, :title => 'An_old_page', :redirects_to => 'Original_title') @@ -50,7 +50,7 @@ class WikiRedirectTest < ActiveSupport::TestCase assert !@wiki.redirects.find_by_title_and_redirects_to('An_old_page', 'An_old_page') assert @wiki.redirects.find_by_title_and_redirects_to('Original_title', 'An_old_page') end - + def test_rename_to_already_redirected assert WikiRedirect.create(:wiki => @wiki, :title => 'An_old_page', :redirects_to => 'Other_page') @@ -59,10 +59,10 @@ class WikiRedirectTest < ActiveSupport::TestCase # this redirect have to be removed since 'An old page' page now exists assert !@wiki.redirects.find_by_title_and_redirects_to('An_old_page', 'Other_page') end - + def test_redirects_removed_when_deleting_page assert WikiRedirect.create(:wiki => @wiki, :title => 'An_old_page', :redirects_to => 'Original_title') - + @original.destroy assert !@wiki.redirects.find(:first) end diff --git a/test/unit/wiki_test.rb b/test/unit/wiki_test.rb index d2420fd1..419c7542 100644 --- a/test/unit/wiki_test.rb +++ b/test/unit/wiki_test.rb @@ -1,14 +1,14 @@ # -*- coding: utf-8 -*- #-- 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. #++ require File.expand_path('../../test_helper', __FILE__) @@ -20,7 +20,7 @@ class WikiTest < ActiveSupport::TestCase wiki = Wiki.new(:project => Project.find(2)) assert !wiki.save assert_equal 1, wiki.errors.count - + wiki.start_page = "Start page" assert wiki.save end @@ -32,41 +32,41 @@ class WikiTest < ActiveSupport::TestCase @wiki.reload assert_equal "Another start page", @wiki.start_page end - + def test_find_page wiki = Wiki.find(1) page = WikiPage.find(2) - + assert_equal page, wiki.find_page('Another_page') assert_equal page, wiki.find_page('Another page') assert_equal page, wiki.find_page('ANOTHER page') - + page = WikiPage.find(10) assert_equal page, wiki.find_page('Этика_менеджмента') - + page = WikiPage.generate!(:wiki => wiki, :title => '2009\\02\\09') assert_equal page, wiki.find_page('2009\\02\\09') end - + def test_titleize assert_equal 'Page_title_with_CAPITALES', Wiki.titleize('page title with CAPITALES') assert_equal 'テスト', Wiki.titleize('テスト') end - + context "#sidebar" do setup do @wiki = Wiki.find(1) end - + should "return nil if undefined" do assert_nil @wiki.sidebar end - + should "return a WikiPage if defined" do page = @wiki.pages.new(:title => 'Sidebar') page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar') page.save! - + assert_kind_of WikiPage, @wiki.sidebar assert_equal 'Sidebar', @wiki.sidebar.title end