Compare commits
144 Commits
2.0-stable
...
1.4.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54eecf54ff | ||
|
|
628e63eefe | ||
|
|
83b356484a | ||
|
|
5210b58226 | ||
|
|
a0932173a5 | ||
|
|
e889fe9c8a | ||
|
|
16b1fcb079 | ||
|
|
3b7793561a | ||
|
|
2c3c1d2a02 | ||
|
|
49cb3aaca6 | ||
|
|
8a8df72937 | ||
|
|
ad238abd0c | ||
|
|
d69cae859f | ||
|
|
59d4d210a7 | ||
|
|
633b86236c | ||
|
|
91514dd682 | ||
|
|
917127f179 | ||
|
|
49295481de | ||
|
|
8cc56cce66 | ||
|
|
8d5fadc773 | ||
|
|
eb3e79b70d | ||
|
|
5d3bdb66cd | ||
|
|
1974123562 | ||
|
|
bcef197b41 | ||
|
|
231145160f | ||
|
|
0e1ae572c7 | ||
|
|
b3a86771ce | ||
|
|
2516d4f408 | ||
|
|
03d6c4668e | ||
|
|
a97d6baddd | ||
|
|
f3a8494cfb | ||
|
|
14dcefaa97 | ||
|
|
f4a7d6ca8c | ||
|
|
aedd5c5e35 | ||
|
|
554d6bcba2 | ||
|
|
4fcec69a40 | ||
|
|
7e6cc2f583 | ||
|
|
16383ed386 | ||
|
|
27127e1a3b | ||
|
|
a92ef237d3 | ||
|
|
a82a16378f | ||
|
|
886daba641 | ||
|
|
ab8dd5aa6e | ||
|
|
dbc02e66dc | ||
|
|
75e350f4e6 | ||
|
|
81553d396e | ||
|
|
77e03b508b | ||
|
|
1b0e717902 | ||
|
|
53b8de5e39 | ||
|
|
34df573ec2 | ||
|
|
e2f00792a8 | ||
|
|
9ed998af9b | ||
|
|
1881706df4 | ||
|
|
a3bf12ab9f | ||
|
|
668981b8cd | ||
|
|
b303dddbe3 | ||
|
|
933e96116e | ||
|
|
10711fda6d | ||
|
|
b3b829c025 | ||
|
|
8cd0baf773 | ||
|
|
033aa68427 | ||
|
|
1eb20d42bd | ||
|
|
a9dbecd5a5 | ||
|
|
a13218e9f4 | ||
|
|
57b0faf128 | ||
|
|
ba3828b49f | ||
|
|
fe1a152e02 | ||
|
|
69709a2513 | ||
|
|
7b7bca0b59 | ||
|
|
64b0cb336d | ||
|
|
79b7b32980 | ||
|
|
1e1517e6ab | ||
|
|
70b0d5722b | ||
|
|
3883d5e2db | ||
|
|
bca6c447cb | ||
|
|
b230429a61 | ||
|
|
a06462548c | ||
|
|
e62a40a719 | ||
|
|
5a1be1d8df | ||
|
|
81c207b193 | ||
|
|
60cdcd5522 | ||
|
|
da293fdfd8 | ||
|
|
9cfb7e1c87 | ||
|
|
78c185abde | ||
|
|
3266265cad | ||
|
|
d9304e062a | ||
|
|
40af0a2cbf | ||
|
|
eb53d600c9 | ||
|
|
fa4fdf91a4 | ||
|
|
e9ac98b249 | ||
|
|
9db20cd02c | ||
|
|
b0951bff54 | ||
|
|
0a09984954 | ||
|
|
9b7105465e | ||
|
|
45683d9c2a | ||
|
|
dcba6f0400 | ||
|
|
f11e9eb2d6 | ||
|
|
095d99cf9e | ||
|
|
163ac957ba | ||
|
|
04a8a72491 | ||
|
|
a1a6dcffca | ||
|
|
d31402734b | ||
|
|
5180ca0cdd | ||
|
|
e5802895ce | ||
|
|
da1a3449ce | ||
|
|
2b2f721ef4 | ||
|
|
62114336cf | ||
|
|
4f48d1b4dd | ||
|
|
d6d064f875 | ||
|
|
6d8649b9d3 | ||
|
|
39deb03855 | ||
|
|
70036a7ad0 | ||
|
|
68d421b978 | ||
|
|
268a9db47e | ||
|
|
a35b81b9fa | ||
|
|
fd450fd2da | ||
|
|
2c0ba78f70 | ||
|
|
f0f01d370e | ||
|
|
4c330a1241 | ||
|
|
baa4ebd05f | ||
|
|
59f14478ed | ||
|
|
8fefb7c05b | ||
|
|
1feb373c89 | ||
|
|
32fd503cbb | ||
|
|
cf31aeaf81 | ||
|
|
83ea66fd2c | ||
|
|
ef2c5cab2d | ||
|
|
dee6f6b138 | ||
|
|
a4c0c18e3d | ||
|
|
4c82fbb6f8 | ||
|
|
68ded50edc | ||
|
|
72ecb80dc7 | ||
|
|
86ee285eb4 | ||
|
|
c229ea6386 | ||
|
|
687fca170e | ||
|
|
26564b06f7 | ||
|
|
34016c38bd | ||
|
|
15ff361894 | ||
|
|
b45b5f4322 | ||
|
|
8addbc537a | ||
|
|
87eeacba80 | ||
|
|
a7250c41e2 | ||
|
|
7c45396d92 | ||
|
|
c1f98c835c |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,7 +5,6 @@
|
||||
/config/database.yml
|
||||
/config/email.yml
|
||||
/config/initializers/session_store.rb
|
||||
/config/initializers/secret_token.rb
|
||||
/coverage
|
||||
/db/*.db
|
||||
/db/*.sqlite3
|
||||
@@ -19,6 +18,7 @@
|
||||
/public/plugin_assets
|
||||
/tmp/*
|
||||
/tmp/cache/*
|
||||
/tmp/pdf/*
|
||||
/tmp/sessions/*
|
||||
/tmp/sockets/*
|
||||
/tmp/test/*
|
||||
|
||||
@@ -7,7 +7,6 @@ config/configuration.yml
|
||||
config/database.yml
|
||||
config/email.yml
|
||||
config/initializers/session_store.rb
|
||||
config/initializers/secret_token.rb
|
||||
coverage
|
||||
db/*.db
|
||||
db/*.sqlite3
|
||||
@@ -21,6 +20,7 @@ public/dispatch.*
|
||||
public/plugin_assets
|
||||
tmp/*
|
||||
tmp/cache/*
|
||||
tmp/pdf/*
|
||||
tmp/sessions/*
|
||||
tmp/sockets/*
|
||||
tmp/test/*
|
||||
|
||||
18
Gemfile
18
Gemfile
@@ -1,11 +1,10 @@
|
||||
source 'http://rubygems.org'
|
||||
source :rubygems
|
||||
|
||||
gem 'rails', '3.2.6'
|
||||
gem 'prototype-rails', '3.2.1'
|
||||
gem "i18n", "~> 0.6.0"
|
||||
gem "rails", "2.3.14"
|
||||
gem "i18n", "~> 0.4.2"
|
||||
gem "coderay", "~> 1.0.6"
|
||||
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
|
||||
gem "builder", "3.0.0"
|
||||
gem "tzinfo", "~> 0.3.31"
|
||||
|
||||
# Optional gem for LDAP authentication
|
||||
group :ldap do
|
||||
@@ -15,7 +14,6 @@ end
|
||||
# Optional gem for OpenID authentication
|
||||
group :openid do
|
||||
gem "ruby-openid", "~> 2.1.4", :require => "openid"
|
||||
gem "rack-openid"
|
||||
end
|
||||
|
||||
# Optional gem for exporting the gantt to a PNG file, not supported with jruby
|
||||
@@ -47,7 +45,7 @@ end
|
||||
|
||||
platforms :mri_19, :mingw_19 do
|
||||
group :mysql do
|
||||
gem "mysql2", "~> 0.3.11"
|
||||
gem "mysql2", "~> 0.2.7"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -69,13 +67,13 @@ end
|
||||
|
||||
group :development do
|
||||
gem "rdoc", ">= 2.4.2"
|
||||
gem "yard"
|
||||
end
|
||||
|
||||
group :test do
|
||||
gem "shoulda", "~> 2.11"
|
||||
gem "shoulda", "~> 2.10.3"
|
||||
# Shoulda does not work nice on Ruby 1.9.3 and seems to need test-unit explicitely.
|
||||
gem "test-unit", :platforms => [:mri_19]
|
||||
gem "edavis10-object_daddy", :require => "object_daddy"
|
||||
gem "mocha", "0.12.3"
|
||||
end
|
||||
|
||||
@@ -86,7 +84,7 @@ if File.exists?(local_gemfile)
|
||||
end
|
||||
|
||||
# Load plugins' Gemfiles
|
||||
Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file|
|
||||
Dir.glob File.expand_path("../vendor/plugins/*/Gemfile", __FILE__) do |file|
|
||||
puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
|
||||
instance_eval File.read(file)
|
||||
end
|
||||
|
||||
16
Rakefile
16
Rakefile
@@ -1,7 +1,15 @@
|
||||
#!/usr/bin/env rake
|
||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
# for example lib/tasks/switchtower.rake, and they will automatically be available to Rake.
|
||||
|
||||
require File.expand_path('../config/application', __FILE__)
|
||||
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
||||
|
||||
RedmineApp::Application.load_tasks
|
||||
require 'rake'
|
||||
require 'rake/testtask'
|
||||
|
||||
begin
|
||||
require 'rdoc/task'
|
||||
rescue LoadError
|
||||
# RDoc is not available
|
||||
end
|
||||
|
||||
require 'tasks/rails'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -68,7 +68,7 @@ class AccountController < ApplicationController
|
||||
# create a new token for password recovery
|
||||
token = Token.new(:user => user, :action => "recovery")
|
||||
if token.save
|
||||
Mailer.lost_password(token).deliver
|
||||
Mailer.deliver_lost_password(token)
|
||||
flash[:notice] = l(:notice_account_lost_email_sent)
|
||||
redirect_to :action => 'login'
|
||||
return
|
||||
@@ -153,7 +153,7 @@ class AccountController < ApplicationController
|
||||
end
|
||||
|
||||
def open_id_authenticate(openid_url)
|
||||
authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email], :return_to => signin_url, :method => :post) do |result, identity_url, registration|
|
||||
authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email], :return_to => signin_url) do |result, identity_url, registration|
|
||||
if result.successful?
|
||||
user = User.find_or_initialize_by_identity_url(identity_url)
|
||||
if user.new_record?
|
||||
@@ -235,7 +235,7 @@ class AccountController < ApplicationController
|
||||
def register_by_email_activation(user, &block)
|
||||
token = Token.new(:user => user, :action => "register")
|
||||
if user.save and token.save
|
||||
Mailer.register(token).deliver
|
||||
Mailer.deliver_register(token)
|
||||
flash[:notice] = l(:notice_account_register_done)
|
||||
redirect_to :action => 'login'
|
||||
else
|
||||
@@ -265,7 +265,7 @@ class AccountController < ApplicationController
|
||||
def register_manually_by_administrator(user, &block)
|
||||
if user.save
|
||||
# Sends an email to the administrators
|
||||
Mailer.account_activation_request(user).deliver
|
||||
Mailer.deliver_account_activation_request(user)
|
||||
account_pending
|
||||
else
|
||||
yield if block_given?
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -43,7 +43,7 @@ class ActivitiesController < ApplicationController
|
||||
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 {
|
||||
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
|
||||
@events_by_day = events.group_by(&:event_date)
|
||||
render :layout => false if request.xhr?
|
||||
}
|
||||
format.atom {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -63,7 +63,7 @@ class AdminController < ApplicationController
|
||||
# Force ActionMailer to raise delivery errors so we can catch it
|
||||
ActionMailer::Base.raise_delivery_errors = true
|
||||
begin
|
||||
@test = Mailer.test_email(User.current).deliver
|
||||
@test = Mailer.deliver_test_email(User.current)
|
||||
flash[:notice] = l(:notice_email_sent, User.current.mail)
|
||||
rescue Exception => e
|
||||
flash[:error] = l(:notice_email_error, e.message)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -22,12 +22,9 @@ class Unauthorized < Exception; end
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
include Redmine::I18n
|
||||
|
||||
class_attribute :accept_api_auth_actions
|
||||
class_attribute :accept_rss_auth_actions
|
||||
class_attribute :model_object
|
||||
|
||||
layout 'base'
|
||||
exempt_from_layout 'builder', 'rsb'
|
||||
|
||||
protect_from_forgery
|
||||
def handle_unverified_request
|
||||
@@ -35,7 +32,32 @@ class ApplicationController < ActionController::Base
|
||||
cookies.delete(:autologin)
|
||||
end
|
||||
|
||||
before_filter :user_setup, :check_if_login_required, :set_localization
|
||||
# FIXME: Remove this when all of Rack and Rails have learned how to
|
||||
# properly use encodings
|
||||
before_filter :params_filter
|
||||
|
||||
def params_filter
|
||||
if RUBY_VERSION >= '1.9' && defined?(Rails) && Rails::VERSION::MAJOR < 3
|
||||
self.utf8nize!(params)
|
||||
end
|
||||
end
|
||||
|
||||
def utf8nize!(obj)
|
||||
if obj.frozen?
|
||||
obj
|
||||
elsif obj.is_a? String
|
||||
obj.respond_to?(:force_encoding) ? obj.force_encoding("UTF-8") : obj
|
||||
elsif obj.is_a? Hash
|
||||
obj.each {|k, v| obj[k] = self.utf8nize!(v)}
|
||||
elsif obj.is_a? Array
|
||||
obj.each {|v| self.utf8nize!(v)}
|
||||
else
|
||||
obj
|
||||
end
|
||||
end
|
||||
|
||||
before_filter :session_expiration, :user_setup, :check_if_login_required, :set_localization
|
||||
filter_parameter_logging :password
|
||||
|
||||
rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token
|
||||
rescue_from ::Unauthorized, :with => :deny_access
|
||||
@@ -44,6 +66,42 @@ class ApplicationController < ActionController::Base
|
||||
include Redmine::MenuManager::MenuController
|
||||
helper Redmine::MenuManager::MenuHelper
|
||||
|
||||
Redmine::Scm::Base.all.each do |scm|
|
||||
require_dependency "repository/#{scm.underscore}"
|
||||
end
|
||||
|
||||
def session_expiration
|
||||
if session[:user_id]
|
||||
if session_expired? && !try_to_autologin
|
||||
reset_session
|
||||
flash[:error] = l(:error_session_expired)
|
||||
redirect_to signin_url
|
||||
else
|
||||
session[:atime] = Time.now.utc.to_i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def session_expired?
|
||||
if Setting.session_lifetime?
|
||||
unless session[:ctime] && (Time.now.utc.to_i - session[:ctime].to_i <= Setting.session_lifetime.to_i * 60)
|
||||
return true
|
||||
end
|
||||
end
|
||||
if Setting.session_timeout?
|
||||
unless session[:atime] && (Time.now.utc.to_i - session[:atime].to_i <= Setting.session_timeout.to_i * 60)
|
||||
return true
|
||||
end
|
||||
end
|
||||
false
|
||||
end
|
||||
|
||||
def start_user_session(user)
|
||||
session[:user_id] = user.id
|
||||
session[:ctime] = Time.now.utc.to_i
|
||||
session[:atime] = Time.now.utc.to_i
|
||||
end
|
||||
|
||||
def user_setup
|
||||
# Check the settings cache for each request
|
||||
Setting.check_cache
|
||||
@@ -57,10 +115,7 @@ class ApplicationController < ActionController::Base
|
||||
if session[:user_id]
|
||||
# existing session
|
||||
(User.active.find(session[:user_id]) rescue nil)
|
||||
elsif cookies[:autologin] && Setting.autologin?
|
||||
# auto-login feature starts a new session
|
||||
user = User.try_to_autologin(cookies[:autologin])
|
||||
session[:user_id] = user.id if user
|
||||
elsif user = try_to_autologin
|
||||
user
|
||||
elsif params[:format] == 'atom' && params[:key] && request.get? && accept_rss_auth?
|
||||
# RSS key authentication does not start a session
|
||||
@@ -78,12 +133,24 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
end
|
||||
|
||||
def try_to_autologin
|
||||
if cookies[:autologin] && Setting.autologin?
|
||||
# auto-login feature starts a new session
|
||||
user = User.try_to_autologin(cookies[:autologin])
|
||||
if user
|
||||
reset_session
|
||||
start_user_session(user)
|
||||
end
|
||||
user
|
||||
end
|
||||
end
|
||||
|
||||
# Sets the logged in user
|
||||
def logged_user=(user)
|
||||
reset_session
|
||||
if user && user.is_a?(User)
|
||||
User.current = user
|
||||
session[:user_id] = user.id
|
||||
start_user_session(user)
|
||||
else
|
||||
User.current = User.anonymous
|
||||
end
|
||||
@@ -205,7 +272,7 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def find_model_object
|
||||
model = self.class.model_object
|
||||
model = self.class.read_inheritable_attribute('model_object')
|
||||
if model
|
||||
@object = model.find(params[:id])
|
||||
self.instance_variable_set('@' + controller_name.singularize, @object) if @object
|
||||
@@ -215,7 +282,7 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def self.model_object(model)
|
||||
self.model_object = model
|
||||
write_inheritable_attribute('model_object', model)
|
||||
end
|
||||
|
||||
# Filter for bulk issue operations
|
||||
@@ -270,19 +337,6 @@ class ApplicationController < ActionController::Base
|
||||
false
|
||||
end
|
||||
|
||||
# Redirects to the request referer if present, redirects to args or call block otherwise.
|
||||
def redirect_to_referer_or(*args, &block)
|
||||
redirect_to :back
|
||||
rescue ::ActionController::RedirectBackError
|
||||
if args.any?
|
||||
redirect_to *args
|
||||
elsif block_given?
|
||||
block.call
|
||||
else
|
||||
raise "#redirect_to_referer_or takes arguments or a block"
|
||||
end
|
||||
end
|
||||
|
||||
def render_403(options={})
|
||||
@project = nil
|
||||
render_error({:message => :notice_not_authorized, :status => 403}.merge(options))
|
||||
@@ -351,9 +405,9 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
def self.accept_rss_auth(*actions)
|
||||
if actions.any?
|
||||
self.accept_rss_auth_actions = actions
|
||||
write_inheritable_attribute('accept_rss_auth_actions', actions)
|
||||
else
|
||||
self.accept_rss_auth_actions || []
|
||||
read_inheritable_attribute('accept_rss_auth_actions') || []
|
||||
end
|
||||
end
|
||||
|
||||
@@ -363,9 +417,9 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
def self.accept_api_auth(*actions)
|
||||
if actions.any?
|
||||
self.accept_api_auth_actions = actions
|
||||
write_inheritable_attribute('accept_api_auth_actions', actions)
|
||||
else
|
||||
self.accept_api_auth_actions || []
|
||||
read_inheritable_attribute('accept_api_auth_actions') || []
|
||||
end
|
||||
end
|
||||
|
||||
@@ -486,12 +540,26 @@ class ApplicationController < ActionController::Base
|
||||
else
|
||||
@error_messages = objects.errors.full_messages
|
||||
end
|
||||
render :template => 'common/error_messages.api', :status => :unprocessable_entity, :layout => nil
|
||||
render :template => 'common/error_messages.api', :status => :unprocessable_entity, :layout => false
|
||||
end
|
||||
|
||||
# Overrides #_include_layout? so that #render with no arguments
|
||||
# Overrides #default_template so that the api template
|
||||
# is used automatically if it exists
|
||||
def default_template(action_name = self.action_name)
|
||||
if api_request?
|
||||
begin
|
||||
return self.view_paths.find_template(default_template_name(action_name), 'api')
|
||||
rescue ::ActionView::MissingTemplate
|
||||
# the api template was not found
|
||||
# fallback to the default behaviour
|
||||
end
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
# Overrides #pick_layout so that #render with no arguments
|
||||
# doesn't use the layout for api requests
|
||||
def _include_layout?(*args)
|
||||
api_request? ? false : super
|
||||
def pick_layout(*args)
|
||||
api_request? ? nil : super
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -88,7 +88,9 @@ class AttachmentsController < ApplicationController
|
||||
end
|
||||
# Make sure association callbacks are called
|
||||
@attachment.container.attachments.delete(@attachment)
|
||||
redirect_to_referer_or project_path(@project)
|
||||
redirect_to :back
|
||||
rescue ::ActionController::RedirectBackError
|
||||
redirect_to :controller => 'projects', :action => 'show', :id => @project
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,20 +1,3 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class AutoCompletesController < ApplicationController
|
||||
before_filter :find_project
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -43,10 +43,10 @@ class BoardsController < ApplicationController
|
||||
|
||||
@topic_count = @board.topics.count
|
||||
@topic_pages = Paginator.new self, @topic_count, per_page_option, params['page']
|
||||
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC").order(sort_clause).all(
|
||||
@topics = @board.topics.find :all, :order => ["#{Message.table_name}.sticky DESC", sort_clause].compact.join(', '),
|
||||
:include => [:author, {:last_reply => :author}],
|
||||
:limit => @topic_pages.items_per_page,
|
||||
:offset => @topic_pages.current.offset)
|
||||
:offset => @topic_pages.current.offset
|
||||
@message = Message.new(:board => @board)
|
||||
render :action => 'show', :layout => !request.xhr?
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,20 +1,3 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class ContextMenusController < ApplicationController
|
||||
helper :watchers
|
||||
helper :issues
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -86,9 +86,7 @@ class DocumentsController < ApplicationController
|
||||
attachments = Attachment.attach_files(@document, params[:attachments])
|
||||
render_attachment_warning_if_needed(@document)
|
||||
|
||||
if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added')
|
||||
Mailer.attachments_added(attachments[:files]).deliver
|
||||
end
|
||||
Mailer.deliver_attachments_added(attachments[:files]) if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added')
|
||||
redirect_to :action => 'show', :id => @document
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,20 +1,3 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class FilesController < ApplicationController
|
||||
menu_item :files
|
||||
|
||||
@@ -46,7 +29,7 @@ class FilesController < ApplicationController
|
||||
render_attachment_warning_if_needed(container)
|
||||
|
||||
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
||||
Mailer.attachments_added(attachments[:files]).deliver
|
||||
Mailer.deliver_attachments_added(attachments[:files])
|
||||
end
|
||||
redirect_to project_files_path(@project)
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -95,11 +95,10 @@ class MessagesController < ApplicationController
|
||||
# Delete a messages
|
||||
def destroy
|
||||
(render_403; return false) unless @message.destroyable_by?(User.current)
|
||||
r = @message.to_param
|
||||
@message.destroy
|
||||
redirect_to @message.parent.nil? ?
|
||||
{ :controller => 'boards', :action => 'show', :project_id => @project, :id => @board } :
|
||||
{ :action => 'show', :id => @message.parent, :r => r }
|
||||
{ :action => 'show', :id => @message.parent, :r => @message }
|
||||
end
|
||||
|
||||
def quote
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,20 +1,3 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class ProjectEnumerationsController < ApplicationController
|
||||
before_filter :find_project_by_project_id
|
||||
before_filter :authorize
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
require 'SVG/Graph/Bar'
|
||||
require 'SVG/Graph/BarHorizontal'
|
||||
require 'digest/sha1'
|
||||
require 'redmine/scm/adapters/abstract_adapter'
|
||||
|
||||
class ChangesetNotFound < Exception; end
|
||||
class InvalidRevisionParam < Exception; end
|
||||
@@ -46,11 +45,7 @@ class RepositoriesController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
attrs = pickup_extra_info
|
||||
@repository = Repository.factory(params[:repository_scm], attrs[:attrs])
|
||||
if attrs[:attrs_extra].keys.any?
|
||||
@repository.merge_extra_info(attrs[:attrs_extra])
|
||||
end
|
||||
@repository = Repository.factory(params[:repository_scm], params[:repository])
|
||||
@repository.project = @project
|
||||
if request.post? && @repository.save
|
||||
redirect_to settings_project_path(@project, :tab => 'repositories')
|
||||
@@ -63,11 +58,7 @@ class RepositoriesController < ApplicationController
|
||||
end
|
||||
|
||||
def update
|
||||
attrs = pickup_extra_info
|
||||
@repository.attributes = attrs[:attrs]
|
||||
if attrs[:attrs_extra].keys.any?
|
||||
@repository.merge_extra_info(attrs[:attrs_extra])
|
||||
end
|
||||
@repository.attributes = params[:repository]
|
||||
@repository.project = @project
|
||||
if request.put? && @repository.save
|
||||
redirect_to settings_project_path(@project, :tab => 'repositories')
|
||||
@@ -76,20 +67,6 @@ class RepositoriesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def pickup_extra_info
|
||||
p = {}
|
||||
p_extra = {}
|
||||
params[:repository].each do |k, v|
|
||||
if k =~ /^extra_/
|
||||
p_extra[k] = v
|
||||
else
|
||||
p[k] = v
|
||||
end
|
||||
end
|
||||
{:attrs => p, :attrs_extra => p_extra}
|
||||
end
|
||||
private :pickup_extra_info
|
||||
|
||||
def committers
|
||||
@committers = @repository.committers
|
||||
@users = @project.users
|
||||
@@ -152,15 +129,7 @@ class RepositoriesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def raw
|
||||
entry_and_raw(true)
|
||||
end
|
||||
|
||||
def entry
|
||||
entry_and_raw(false)
|
||||
end
|
||||
|
||||
def entry_and_raw(is_raw)
|
||||
@entry = @repository.entry(@path, @rev)
|
||||
(show_error_not_found; return) unless @entry
|
||||
|
||||
@@ -169,7 +138,7 @@ class RepositoriesController < ApplicationController
|
||||
|
||||
@content = @repository.cat(@path, @rev)
|
||||
(show_error_not_found; return) unless @content
|
||||
if is_raw ||
|
||||
if 'raw' == params[:format] ||
|
||||
(@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) ||
|
||||
! is_entry_text_data?(@content, @path)
|
||||
# Force the download
|
||||
@@ -185,7 +154,6 @@ class RepositoriesController < ApplicationController
|
||||
@changeset = @repository.find_changeset_by_name(@rev)
|
||||
end
|
||||
end
|
||||
private :entry_and_raw
|
||||
|
||||
def is_entry_text_data?(ent, path)
|
||||
# UTF-16 contains "\x00".
|
||||
@@ -339,7 +307,8 @@ class RepositoriesController < ApplicationController
|
||||
@repository = @project.repository
|
||||
end
|
||||
(render_404; return false) unless @repository
|
||||
@path = params[:path].is_a?(Array) ? params[:path].join('/') : params[:path].to_s
|
||||
@path = params[:path].join('/') unless params[:path].nil?
|
||||
@path ||= ''
|
||||
@rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip
|
||||
@rev_to = params[:rev_to]
|
||||
|
||||
@@ -374,17 +343,17 @@ class RepositoriesController < ApplicationController
|
||||
@date_to = Date.today
|
||||
@date_from = @date_to << 11
|
||||
@date_from = Date.civil(@date_from.year, @date_from.month, 1)
|
||||
commits_by_day = Changeset.count(
|
||||
commits_by_day = repository.changesets.count(
|
||||
:all, :group => :commit_date,
|
||||
:conditions => ["repository_id = ? AND commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
|
||||
:conditions => ["commit_date BETWEEN ? AND ?", @date_from, @date_to])
|
||||
commits_by_month = [0] * 12
|
||||
commits_by_day.each {|c| commits_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last }
|
||||
commits_by_day.each {|c| commits_by_month[c.first.to_date.months_ago] += c.last }
|
||||
|
||||
changes_by_day = Change.count(
|
||||
:all, :group => :commit_date, :include => :changeset,
|
||||
:conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
|
||||
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[(@date_to.month - c.first.to_date.month) % 12] += c.last }
|
||||
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)}
|
||||
@@ -415,10 +384,10 @@ class RepositoriesController < ApplicationController
|
||||
end
|
||||
|
||||
def graph_commits_per_author(repository)
|
||||
commits_by_author = Changeset.count(:all, :group => :committer, :conditions => ["repository_id = ?", repository.id])
|
||||
commits_by_author = repository.changesets.count(:all, :group => :committer)
|
||||
commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}
|
||||
|
||||
changes_by_author = Change.count(:all, :group => :committer, :include => :changeset, :conditions => ["#{Changeset.table_name}.repository_id = ?", repository.id])
|
||||
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}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -99,7 +99,7 @@ class UsersController < ApplicationController
|
||||
@user.pref.save
|
||||
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
|
||||
|
||||
Mailer.account_information(@user, params[:user][:password]).deliver if params[:send_information]
|
||||
Mailer.deliver_account_information(@user, params[:user][:password]) if params[:send_information]
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@@ -146,15 +146,15 @@ class UsersController < ApplicationController
|
||||
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
|
||||
|
||||
if was_activated
|
||||
Mailer.account_activated(@user).deliver
|
||||
Mailer.deliver_account_activated(@user)
|
||||
elsif @user.active? && params[:send_information] && !params[:user][:password].blank? && @user.auth_source_id.nil?
|
||||
Mailer.account_information(@user, params[:user][:password]).deliver
|
||||
Mailer.deliver_account_information(@user, params[:user][:password])
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to_referer_or edit_user_path(@user)
|
||||
redirect_to :back
|
||||
}
|
||||
format.api { head :ok }
|
||||
end
|
||||
@@ -169,14 +169,18 @@ class UsersController < ApplicationController
|
||||
format.api { render_validation_errors(@user) }
|
||||
end
|
||||
end
|
||||
rescue ::ActionController::RedirectBackError
|
||||
redirect_to :controller => 'users', :action => 'edit', :id => @user
|
||||
end
|
||||
|
||||
def destroy
|
||||
@user.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or(users_url) }
|
||||
format.html { redirect_to :back }
|
||||
format.api { head :ok }
|
||||
end
|
||||
rescue ::ActionController::RedirectBackError
|
||||
redirect_to(users_url)
|
||||
end
|
||||
|
||||
def edit_membership
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -52,7 +52,7 @@ class WatchersController < ApplicationController
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
|
||||
format.html { redirect_to :back }
|
||||
format.js do
|
||||
render :update do |page|
|
||||
page.replace_html 'ajax-modal', :partial => 'watchers/new', :locals => {:watched => @watched}
|
||||
@@ -60,6 +60,8 @@ class WatchersController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
rescue ::ActionController::RedirectBackError
|
||||
render :text => 'Watcher added.', :layout => true
|
||||
end
|
||||
|
||||
def append
|
||||
@@ -70,7 +72,9 @@ class WatchersController < ApplicationController
|
||||
format.js do
|
||||
render :update do |page|
|
||||
users.each do |user|
|
||||
page << %|$$("#issue_watcher_user_ids_#{user.id}").each(function(el){el.remove();});|
|
||||
page.select("#issue_watcher_user_ids_#{user.id}").each do |item|
|
||||
page.remove item
|
||||
end
|
||||
end
|
||||
page.insert_html :bottom, 'watchers_inputs', :text => watchers_checkboxes(nil, users, true)
|
||||
end
|
||||
@@ -107,7 +111,7 @@ private
|
||||
@watched = klass.find(params[:object_id])
|
||||
@project = @watched.project
|
||||
elsif params[:project_id]
|
||||
@project = Project.visible.find_by_param(params[:project_id])
|
||||
@project = Project.visible.find(params[:project_id])
|
||||
end
|
||||
rescue
|
||||
render_404
|
||||
@@ -116,13 +120,17 @@ private
|
||||
def set_watcher(user, watching)
|
||||
@watched.set_watcher(user, watching)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
format.html { redirect_to :back }
|
||||
format.js do
|
||||
render(:update) do |page|
|
||||
c = watcher_css(@watched)
|
||||
page << %|$$(".#{c}").each(function(el){el.innerHTML="#{escape_javascript watcher_link(@watched, user)}"});|
|
||||
page.select(".#{c}").each do |item|
|
||||
page.replace_html item, watcher_link(@watched, user)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
rescue ::ActionController::RedirectBackError
|
||||
render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -163,8 +163,6 @@ class WikiController < ApplicationController
|
||||
# Optimistic locking exception
|
||||
flash.now[:error] = l(:notice_locking_conflict)
|
||||
render :action => 'edit'
|
||||
rescue ActiveRecord::RecordNotSaved
|
||||
render :action => 'edit'
|
||||
end
|
||||
|
||||
# rename a page
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -178,7 +178,7 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def format_activity_day(date)
|
||||
date == User.current.today ? l(:label_today).titleize : format_date(date)
|
||||
date == Date.today ? l(:label_today).titleize : format_date(date)
|
||||
end
|
||||
|
||||
def format_activity_description(text)
|
||||
@@ -220,7 +220,7 @@ module ApplicationHelper
|
||||
def render_flash_messages
|
||||
s = ''
|
||||
flash.each do |k,v|
|
||||
s << content_tag('div', v.html_safe, :class => "flash #{k}", :id => "flash_#{k}")
|
||||
s << (content_tag('div', v.html_safe, :class => "flash #{k}"))
|
||||
end
|
||||
s.html_safe
|
||||
end
|
||||
@@ -253,7 +253,7 @@ module ApplicationHelper
|
||||
def project_tree_options_for_select(projects, options = {})
|
||||
s = ''
|
||||
project_tree(projects) do |project, level|
|
||||
name_prefix = (level > 0 ? (' ' * 2 * level + '» ') : '').html_safe
|
||||
name_prefix = (level > 0 ? (' ' * 2 * level + '» ').html_safe : '')
|
||||
tag_options = {:value => project.id}
|
||||
if project == options[:selected] || (options[:selected].respond_to?(:include?) && options[:selected].include?(project))
|
||||
tag_options[:selected] = 'selected'
|
||||
@@ -319,7 +319,7 @@ module ApplicationHelper
|
||||
unless groups.empty?
|
||||
s << %(<optgroup label="#{h(l(:label_group_plural))}">#{groups}</optgroup>)
|
||||
end
|
||||
s.html_safe
|
||||
s
|
||||
end
|
||||
|
||||
# Truncates and returns the string as a single line
|
||||
@@ -352,7 +352,7 @@ module ApplicationHelper
|
||||
def time_tag(time)
|
||||
text = distance_of_time_in_words(Time.now, time)
|
||||
if @project
|
||||
link_to(text, {:controller => 'activities', :action => 'index', :id => @project, :from => User.current.time_to_date(time)}, :title => format_time(time))
|
||||
link_to(text, {:controller => 'activities', :action => 'index', :id => @project, :from => time.to_date}, :title => format_time(time))
|
||||
else
|
||||
content_tag('acronym', text, :title => format_time(time))
|
||||
end
|
||||
@@ -369,8 +369,7 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def to_path_param(path)
|
||||
str = path.to_s.split(%r{[/\\]}).select{|p| !p.blank?}.join("/")
|
||||
str.blank? ? nil : str
|
||||
path.to_s.split(%r{[/\\]}).select {|p| !p.blank?}
|
||||
end
|
||||
|
||||
def pagination_links_full(paginator, count=nil, options={})
|
||||
@@ -399,7 +398,7 @@ module ApplicationHelper
|
||||
|
||||
unless count.nil?
|
||||
html << " (#{paginator.current.first_item}-#{paginator.current.last_item}/#{count})"
|
||||
if per_page_links != false && links = per_page_links(paginator.items_per_page, count)
|
||||
if per_page_links != false && links = per_page_links(paginator.items_per_page)
|
||||
html << " | #{links}"
|
||||
end
|
||||
end
|
||||
@@ -407,23 +406,11 @@ module ApplicationHelper
|
||||
html.html_safe
|
||||
end
|
||||
|
||||
def per_page_links(selected=nil, item_count=nil)
|
||||
values = Setting.per_page_options_array
|
||||
if item_count && values.any?
|
||||
if item_count > values.first
|
||||
max = values.detect {|value| value >= item_count} || item_count
|
||||
else
|
||||
max = item_count
|
||||
end
|
||||
values = values.select {|value| value <= max || value == selected}
|
||||
end
|
||||
if values.empty? || (values.size == 1 && values.first == selected)
|
||||
return nil
|
||||
end
|
||||
links = values.collect do |n|
|
||||
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
|
||||
l(:label_display_per_page, links.join(', '))
|
||||
links.size > 1 ? l(:label_display_per_page, links.join(', ')) : nil
|
||||
end
|
||||
|
||||
def reorder_links(name, url, method = :post)
|
||||
@@ -945,9 +932,6 @@ module ApplicationHelper
|
||||
def labelled_form_for(*args, &proc)
|
||||
args << {} unless args.last.is_a?(Hash)
|
||||
options = args.last
|
||||
if args.first.is_a?(Symbol)
|
||||
options.merge!(:as => args.shift)
|
||||
end
|
||||
options.merge!({:builder => Redmine::Views::LabelledFormBuilder})
|
||||
form_for(*args, &proc)
|
||||
end
|
||||
@@ -962,8 +946,8 @@ module ApplicationHelper
|
||||
def labelled_remote_form_for(*args, &proc)
|
||||
args << {} unless args.last.is_a?(Hash)
|
||||
options = args.last
|
||||
options.merge!({:builder => Redmine::Views::LabelledFormBuilder, :remote => true})
|
||||
form_for(*args, &proc)
|
||||
options.merge!({:builder => Redmine::Views::LabelledFormBuilder})
|
||||
remote_form_for(*args, &proc)
|
||||
end
|
||||
|
||||
def error_messages_for(*objects)
|
||||
@@ -1060,59 +1044,6 @@ module ApplicationHelper
|
||||
end
|
||||
end
|
||||
|
||||
# Overrides Rails' stylesheet_link_tag with themes and plugins support.
|
||||
# Examples:
|
||||
# stylesheet_link_tag('styles') # => picks styles.css from the current theme or defaults
|
||||
# stylesheet_link_tag('styles', :plugin => 'foo) # => picks styles.css from plugin's assets
|
||||
#
|
||||
def stylesheet_link_tag(*sources)
|
||||
options = sources.last.is_a?(Hash) ? sources.pop : {}
|
||||
plugin = options.delete(:plugin)
|
||||
sources = sources.map do |source|
|
||||
if plugin
|
||||
"/plugin_assets/#{plugin}/stylesheets/#{source}"
|
||||
elsif current_theme && current_theme.stylesheets.include?(source)
|
||||
current_theme.stylesheet_path(source)
|
||||
else
|
||||
source
|
||||
end
|
||||
end
|
||||
super sources, options
|
||||
end
|
||||
|
||||
# Overrides Rails' image_tag with themes and plugins support.
|
||||
# Examples:
|
||||
# image_tag('image.png') # => picks image.png from the current theme or defaults
|
||||
# image_tag('image.png', :plugin => 'foo) # => picks image.png from plugin's assets
|
||||
#
|
||||
def image_tag(source, options={})
|
||||
if plugin = options.delete(:plugin)
|
||||
source = "/plugin_assets/#{plugin}/images/#{source}"
|
||||
elsif current_theme && current_theme.images.include?(source)
|
||||
source = current_theme.image_path(source)
|
||||
end
|
||||
super source, options
|
||||
end
|
||||
|
||||
# Overrides Rails' javascript_include_tag with plugins support
|
||||
# Examples:
|
||||
# javascript_include_tag('scripts') # => picks scripts.js from defaults
|
||||
# javascript_include_tag('scripts', :plugin => 'foo) # => picks scripts.js from plugin's assets
|
||||
#
|
||||
def javascript_include_tag(*sources)
|
||||
options = sources.last.is_a?(Hash) ? sources.pop : {}
|
||||
if plugin = options.delete(:plugin)
|
||||
sources = sources.map do |source|
|
||||
if plugin
|
||||
"/plugin_assets/#{plugin}/javascripts/#{source}"
|
||||
else
|
||||
source
|
||||
end
|
||||
end
|
||||
end
|
||||
super sources, options
|
||||
end
|
||||
|
||||
def content_for(name, content = nil, &block)
|
||||
@has_content ||= {}
|
||||
@has_content[name] = true
|
||||
@@ -1123,14 +1054,6 @@ module ApplicationHelper
|
||||
(@has_content && @has_content[name]) || false
|
||||
end
|
||||
|
||||
def sidebar_content?
|
||||
has_content?(:sidebar) || view_layouts_base_sidebar_hook_response.present?
|
||||
end
|
||||
|
||||
def view_layouts_base_sidebar_hook_response
|
||||
@view_layouts_base_sidebar_hook_response ||= call_hook(:view_layouts_base_sidebar)
|
||||
end
|
||||
|
||||
def email_delivery_enabled?
|
||||
!!ActionMailer::Base.perform_deliveries
|
||||
end
|
||||
@@ -1139,7 +1062,7 @@ module ApplicationHelper
|
||||
# +user+ can be a User or a string that will be scanned for an email address (eg. 'joe <joe@foo.bar>')
|
||||
def avatar(user, options = { })
|
||||
if Setting.gravatar_enabled?
|
||||
options.merge!({:ssl => (request && request.ssl?), :default => Setting.gravatar_default})
|
||||
options.merge!({:ssl => (defined?(request) && request.ssl?), :default => Setting.gravatar_default})
|
||||
email = nil
|
||||
if user.respond_to?(:mail)
|
||||
email = user.mail
|
||||
@@ -1158,7 +1081,7 @@ module ApplicationHelper
|
||||
|
||||
# Returns the javascript tags that are included in the html layout head
|
||||
def javascript_heads
|
||||
tags = javascript_include_tag('prototype', 'effects', 'dragdrop', 'controls', 'rails', 'application')
|
||||
tags = javascript_include_tag(:defaults)
|
||||
unless User.current.pref.warn_on_leaving_unsaved == '0'
|
||||
tags << "\n".html_safe + javascript_tag("Event.observe(window, 'load', function(){ new WarnLeavingUnsaved('#{escape_javascript( l(:text_warn_on_leaving_unsaved) )}'); });")
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -39,36 +39,34 @@ module CustomFieldsHelper
|
||||
field_name << "[]" if custom_field.multiple?
|
||||
field_id = "#{name}_custom_field_values_#{custom_field.id}"
|
||||
|
||||
tag_options = {:id => field_id, :class => "#{custom_field.field_format}_cf"}
|
||||
|
||||
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, tag_options.merge(: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, tag_options.merge(:rows => 3))
|
||||
text_area_tag(field_name, custom_value.value, :id => field_id, :rows => 3, :style => 'width:90%')
|
||||
when "bool"
|
||||
hidden_field_tag(field_name, '0') + check_box_tag(field_name, '1', custom_value.true?, tag_options)
|
||||
hidden_field_tag(field_name, '0') + check_box_tag(field_name, '1', custom_value.true?, :id => field_id)
|
||||
when "list"
|
||||
blank_option = ''.html_safe
|
||||
blank_option = ''
|
||||
unless custom_field.multiple?
|
||||
if custom_field.is_required?
|
||||
unless custom_field.default_value.present?
|
||||
blank_option = content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---", :value => '')
|
||||
blank_option = "<option value=\"\">--- #{l(:actionview_instancetag_blank_option)} ---</option>"
|
||||
end
|
||||
else
|
||||
blank_option = content_tag('option')
|
||||
blank_option = '<option></option>'
|
||||
end
|
||||
end
|
||||
s = select_tag(field_name, blank_option + options_for_select(custom_field.possible_values_options(custom_value.customized), custom_value.value),
|
||||
tag_options.merge(:multiple => custom_field.multiple?))
|
||||
s = select_tag(field_name, blank_option.html_safe + options_for_select(custom_field.possible_values_options(custom_value.customized), custom_value.value),
|
||||
:id => field_id, :multiple => custom_field.multiple?)
|
||||
if custom_field.multiple?
|
||||
s << hidden_field_tag(field_name, '')
|
||||
end
|
||||
s
|
||||
else
|
||||
text_field_tag(field_name, custom_value.value, tag_options)
|
||||
text_field_tag(field_name, custom_value.value, :id => field_id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -88,28 +86,26 @@ module CustomFieldsHelper
|
||||
field_name = "#{name}[custom_field_values][#{custom_field.id}]"
|
||||
field_name << "[]" if custom_field.multiple?
|
||||
field_id = "#{name}_custom_field_values_#{custom_field.id}"
|
||||
|
||||
tag_options = {:id => field_id, :class => "#{custom_field.field_format}_cf"}
|
||||
|
||||
field_format = Redmine::CustomFieldFormat.find_by_name(custom_field.field_format)
|
||||
case field_format.try(:edit_as)
|
||||
when "date"
|
||||
text_field_tag(field_name, '', tag_options.merge(:size => 10)) +
|
||||
text_field_tag(field_name, '', :id => field_id, :size => 10) +
|
||||
calendar_for(field_id)
|
||||
when "text"
|
||||
text_area_tag(field_name, '', tag_options.merge(:rows => 3))
|
||||
text_area_tag(field_name, '', :id => field_id, :rows => 3, :style => 'width:90%')
|
||||
when "bool"
|
||||
select_tag(field_name, options_for_select([[l(:label_no_change_option), ''],
|
||||
[l(:general_text_yes), '1'],
|
||||
[l(:general_text_no), '0']]), tag_options)
|
||||
[l(:general_text_no), '0']]), :id => field_id)
|
||||
when "list"
|
||||
options = []
|
||||
options << [l(:label_no_change_option), ''] unless custom_field.multiple?
|
||||
options << [l(:label_none), '__none__'] unless custom_field.is_required?
|
||||
options += custom_field.possible_values_options(projects)
|
||||
select_tag(field_name, options_for_select(options), tag_options.merge(:multiple => custom_field.multiple?))
|
||||
select_tag(field_name, options_for_select(options),
|
||||
:id => field_id, :multiple => custom_field.multiple?)
|
||||
else
|
||||
text_field_tag(field_name, '', tag_options)
|
||||
text_field_tag(field_name, '', :id => field_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -46,17 +46,17 @@ module RepositoriesHelper
|
||||
end
|
||||
|
||||
def render_changeset_changes
|
||||
changes = @changeset.filechanges.find(:all, :limit => 1000, :order => 'path').collect do |change|
|
||||
changes = @changeset.changes.find(:all, :limit => 1000, :order => 'path').collect do |change|
|
||||
case change.action
|
||||
when 'A'
|
||||
# Detects moved/copied files
|
||||
if !change.from_path.blank?
|
||||
change.action =
|
||||
@changeset.filechanges.detect {|c| c.action == 'D' && c.path == change.from_path} ? 'R' : 'C'
|
||||
@changeset.changes.detect {|c| c.action == 'D' && c.path == change.from_path} ? 'R' : 'C'
|
||||
end
|
||||
change
|
||||
when 'D'
|
||||
@changeset.filechanges.detect {|c| c.from_path == change.path} ? nil : change
|
||||
@changeset.changes.detect {|c| c.from_path == change.path} ? nil : change
|
||||
else
|
||||
change
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -45,36 +45,30 @@ module WatchersHelper
|
||||
# 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)
|
||||
content = ''.html_safe
|
||||
lis = object.watcher_users.collect do |user|
|
||||
s = ''.html_safe
|
||||
s << avatar(user, :size => "16").to_s
|
||||
s << link_to_user(user, :class => 'user')
|
||||
s = avatar(user, :size => "16").to_s + link_to_user(user, :class => 'user').to_s
|
||||
if remove_allowed
|
||||
url = {:controller => 'watchers',
|
||||
:action => 'destroy',
|
||||
:object_type => object.class.to_s.underscore,
|
||||
:object_id => object.id,
|
||||
:user_id => user}
|
||||
s << ' '
|
||||
s << link_to_remote(image_tag('delete.png'),
|
||||
s += ' ' + link_to_remote(image_tag('delete.png'),
|
||||
{:url => url},
|
||||
:href => url_for(url),
|
||||
:style => "vertical-align: middle",
|
||||
:class => "delete")
|
||||
end
|
||||
content << content_tag('li', s)
|
||||
content_tag :li, s.html_safe
|
||||
end
|
||||
content.present? ? content_tag('ul', content) : content
|
||||
(lis.empty? ? "" : "<ul>#{ lis.join("\n") }</ul>").html_safe
|
||||
end
|
||||
|
||||
def watchers_checkboxes(object, users, checked=nil)
|
||||
users.map do |user|
|
||||
c = checked.nil? ? object.watched_by?(user) : checked
|
||||
tag = check_box_tag 'issue[watcher_user_ids][]', user.id, c, :id => nil
|
||||
content_tag 'label', "#{tag} #{h(user)}".html_safe,
|
||||
:id => "issue_watcher_user_ids_#{user.id}",
|
||||
:class => "floating"
|
||||
end.join.html_safe
|
||||
content_tag 'label', "#{tag} #{h(user)}", :id => "issue_watcher_user_ids_#{user.id}", :class => "floating"
|
||||
end.join
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -21,14 +21,14 @@ 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 = ''.html_safe
|
||||
s = ''
|
||||
if pages.has_key?(parent)
|
||||
pages[parent].each do |page|
|
||||
attrs = "value='#{page.id}'"
|
||||
attrs << " selected='selected'" if selected == page
|
||||
indent = (level > 0) ? (' ' * level * 2 + '» ') : ''
|
||||
indent = (level > 0) ? (' ' * level * 2 + '» ') : nil
|
||||
|
||||
s << content_tag('option', (indent + h(page.pretty_title)).html_safe, :value => page.id.to_s, :selected => selected == page) +
|
||||
s << "<option #{attrs}>#{indent}#{h page.pretty_title}</option>\n" +
|
||||
wiki_page_options_for_select(pages, selected, page, level + 1)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -24,7 +24,7 @@ class Attachment < ActiveRecord::Base
|
||||
validates_presence_of :filename, :author
|
||||
validates_length_of :filename, :maximum => 255
|
||||
validates_length_of :disk_filename, :maximum => 255
|
||||
validates_length_of :description, :maximum => 255
|
||||
validates_length_of :description, :maximum => 255, :allow_blank => true
|
||||
validate :validate_max_file_size
|
||||
|
||||
acts_as_event :title => :filename,
|
||||
@@ -45,11 +45,20 @@ class Attachment < ActiveRecord::Base
|
||||
"LEFT JOIN #{Project.table_name} ON #{Document.table_name}.project_id = #{Project.table_name}.id"}
|
||||
|
||||
cattr_accessor :storage_path
|
||||
@@storage_path = Redmine::Configuration['attachments_storage_path'] || File.join(Rails.root, "files")
|
||||
@@storage_path = Redmine::Configuration['attachments_storage_path'] || "#{Rails.root}/files"
|
||||
|
||||
before_save :files_to_final_location
|
||||
after_destroy :delete_from_disk
|
||||
|
||||
def container_with_blank_type_check
|
||||
if container_type.blank?
|
||||
nil
|
||||
else
|
||||
container_without_blank_type_check
|
||||
end
|
||||
end
|
||||
alias_method_chain :container, :blank_type_check unless method_defined?(:container_without_blank_type_check)
|
||||
|
||||
# Returns an unsaved copy of the attachment
|
||||
def copy(attributes=nil)
|
||||
copy = self.class.new
|
||||
@@ -131,7 +140,7 @@ class Attachment < ActiveRecord::Base
|
||||
|
||||
# Returns file's location on disk
|
||||
def diskfile
|
||||
File.join(self.class.storage_path, disk_filename.to_s)
|
||||
"#{@@storage_path}/#{self.disk_filename}"
|
||||
end
|
||||
|
||||
def increment_download
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -28,7 +28,7 @@ class Board < ActiveRecord::Base
|
||||
validates_length_of :name, :maximum => 30
|
||||
validates_length_of :description, :maximum => 255
|
||||
|
||||
scope :visible, lambda {|*args| { :include => :project,
|
||||
named_scope :visible, lambda {|*args| { :include => :project,
|
||||
:conditions => Project.allowed_to_condition(args.shift || User.current, :view_messages, *args) } }
|
||||
|
||||
safe_attributes 'name', 'description', 'move_to'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -20,7 +20,7 @@ require 'iconv'
|
||||
class Changeset < ActiveRecord::Base
|
||||
belongs_to :repository
|
||||
belongs_to :user
|
||||
has_many :filechanges, :class_name => 'Change', :dependent => :delete_all
|
||||
has_many :changes, :dependent => :delete_all
|
||||
has_and_belongs_to_many :issues
|
||||
has_and_belongs_to_many :parents,
|
||||
:class_name => "Changeset",
|
||||
@@ -49,8 +49,7 @@ class Changeset < ActiveRecord::Base
|
||||
validates_uniqueness_of :revision, :scope => :repository_id
|
||||
validates_uniqueness_of :scmid, :scope => :repository_id, :allow_nil => true
|
||||
|
||||
scope :visible,
|
||||
lambda {|*args| { :include => {:repository => :project},
|
||||
named_scope :visible, lambda {|*args| { :include => {:repository => :project},
|
||||
:conditions => Project.allowed_to_condition(args.shift || User.current, :view_changesets, *args) } }
|
||||
|
||||
after_create :scan_for_issues
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -18,7 +18,7 @@
|
||||
class CommentObserver < ActiveRecord::Observer
|
||||
def after_create(comment)
|
||||
if comment.commented.is_a?(News) && Setting.notified_events.include?('news_comment_added')
|
||||
Mailer.news_comment_added(comment).deliver
|
||||
Mailer.deliver_news_comment_added(comment)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -80,7 +80,7 @@ class CustomField < ActiveRecord::Base
|
||||
when 'bool'
|
||||
[[l(:general_text_Yes), '1'], [l(:general_text_No), '0']]
|
||||
else
|
||||
possible_values || []
|
||||
read_possible_values_utf8_encoded || []
|
||||
end
|
||||
end
|
||||
|
||||
@@ -91,20 +91,14 @@ class CustomField < ActiveRecord::Base
|
||||
when 'bool'
|
||||
['1', '0']
|
||||
else
|
||||
values = super()
|
||||
if values.is_a?(Array)
|
||||
values.each do |value|
|
||||
value.force_encoding('UTF-8') if value.respond_to?(:force_encoding)
|
||||
end
|
||||
end
|
||||
values
|
||||
read_possible_values_utf8_encoded
|
||||
end
|
||||
end
|
||||
|
||||
# Makes possible_values accept a multiline string
|
||||
def possible_values=(arg)
|
||||
if arg.is_a?(Array)
|
||||
super(arg.compact.collect(&:strip).select {|v| !v.blank?})
|
||||
write_attribute(:possible_values, arg.compact.collect(&:strip).select {|v| !v.blank?})
|
||||
else
|
||||
self.possible_values = arg.to_s.split(/[\n\r]+/)
|
||||
end
|
||||
@@ -224,4 +218,14 @@ class CustomField < ActiveRecord::Base
|
||||
end
|
||||
errs
|
||||
end
|
||||
|
||||
def read_possible_values_utf8_encoded
|
||||
values = read_attribute(:possible_values)
|
||||
if values.is_a?(Array)
|
||||
values.each do |value|
|
||||
value.force_encoding('UTF-8') if value.respond_to?(:force_encoding)
|
||||
end
|
||||
end
|
||||
values
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# RedMine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -30,7 +30,7 @@ class Document < ActiveRecord::Base
|
||||
validates_presence_of :project, :title, :category
|
||||
validates_length_of :title, :maximum => 60
|
||||
|
||||
scope :visible, lambda {|*args| { :include => :project,
|
||||
named_scope :visible, lambda {|*args| { :include => :project,
|
||||
:conditions => Project.allowed_to_condition(args.shift || User.current, :view_documents, *args) } }
|
||||
|
||||
safe_attributes 'category_id', 'title', 'description'
|
||||
@@ -42,7 +42,9 @@ class Document < ActiveRecord::Base
|
||||
def initialize(attributes=nil, *args)
|
||||
super
|
||||
if new_record?
|
||||
self.category ||= DocumentCategory.default
|
||||
# Rails3 use this instead
|
||||
# self.category ||= DocumentCategory.default
|
||||
self.category_id = DocumentCategory.default.id if self.category_id == 0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -31,4 +31,12 @@ class DocumentCategory < Enumeration
|
||||
def transfer_relations(to)
|
||||
documents.update_all("category_id = #{to.id}")
|
||||
end
|
||||
|
||||
def self.default
|
||||
d = super
|
||||
if d.nil?
|
||||
d = find(:first)
|
||||
end
|
||||
d
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@@ -17,6 +17,6 @@
|
||||
|
||||
class DocumentObserver < ActiveRecord::Observer
|
||||
def after_create(document)
|
||||
Mailer.document_added(document).deliver if Setting.notified_events.include?('document_added')
|
||||
Mailer.deliver_document_added(document) if Setting.notified_events.include?('document_added')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user