Compare commits
245 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
924cf77a61 | ||
|
|
0512a30368 | ||
|
|
bc945d78a6 | ||
|
|
8cd0626075 | ||
|
|
035bd65a5a | ||
|
|
955d2b134d | ||
|
|
743b55a3f9 | ||
|
|
881595f7f0 | ||
|
|
7f51bab0fc | ||
|
|
84d5092508 | ||
|
|
352d177f7e | ||
|
|
821ea2a757 | ||
|
|
7cd7b1bd8b | ||
|
|
cf139e25a7 | ||
|
|
8b09f5d27d | ||
|
|
d138df5241 | ||
|
|
034539c988 | ||
|
|
48c28f717d | ||
|
|
23a06ec022 | ||
|
|
4f0aa2432c | ||
|
|
426b1d6fcd | ||
|
|
478a549356 | ||
|
|
69e55fb1ef | ||
|
|
46400e355e | ||
|
|
dc7569ecae | ||
|
|
7c97832002 | ||
|
|
46e48ad3f7 | ||
|
|
a59257dfb6 | ||
|
|
9382d856b4 | ||
|
|
30d2bed1fe | ||
|
|
a99c61b471 | ||
|
|
1d677ac968 | ||
|
|
1ccc975f3f | ||
|
|
dca52d6729 | ||
|
|
1831861eac | ||
|
|
5bd90548b0 | ||
|
|
0bb937152b | ||
|
|
804864beca | ||
|
|
2ed78d95f6 | ||
|
|
678469cf09 | ||
|
|
11746c44f8 | ||
|
|
411f0874ab | ||
|
|
0ba0a7bcc9 | ||
|
|
ddfb2315aa | ||
|
|
1ad003dcc7 | ||
|
|
7b6d11ed6a | ||
|
|
04fe0412e1 | ||
|
|
03e9c51776 | ||
|
|
3710bbfda1 | ||
|
|
df7ddf5c0e | ||
|
|
31d2d1284a | ||
|
|
f6882cd69e | ||
|
|
18852b765a | ||
|
|
ee8dcab9db | ||
|
|
02f704bb01 | ||
|
|
f08b648cce | ||
|
|
19e56045dd | ||
|
|
6fc909a402 | ||
|
|
7af8d7caf0 | ||
|
|
e876d1bfc0 | ||
|
|
ba5a052c8c | ||
|
|
6e7eadf9fb | ||
|
|
5ce2987ea9 | ||
|
|
a3c25c18d7 | ||
|
|
61a1fa1b6e | ||
|
|
1ab261dda6 | ||
|
|
255a84878d | ||
|
|
6bcbdd44fc | ||
|
|
66d62504ef | ||
|
|
17d19febc6 | ||
|
|
b0414ec1fb | ||
|
|
569e1b37cc | ||
|
|
bef28f7dab | ||
|
|
49fc255b48 | ||
|
|
6c6467879a | ||
|
|
9f396a6dfb | ||
|
|
ad8193dcde | ||
|
|
b4350ca91a | ||
|
|
2c28d6b5d1 | ||
|
|
36ee2b24bd | ||
|
|
d2278b63a1 | ||
|
|
d658ab22d6 | ||
|
|
1446c9b7f0 | ||
|
|
9be6dfbe10 | ||
|
|
38011c0fb1 | ||
|
|
d1372107e5 | ||
|
|
c085367bb6 | ||
|
|
bebe429472 | ||
|
|
0491488554 | ||
|
|
785825900a | ||
|
|
017d974dd8 | ||
|
|
5b680625c1 | ||
|
|
6fca028905 | ||
|
|
b097a1753e | ||
|
|
f54ecfc55f | ||
|
|
45093230a9 | ||
|
|
f4b9d2a7ee | ||
|
|
e1920cc9e4 | ||
|
|
f10fed295a | ||
|
|
0fcc82482e | ||
|
|
ee4928d17c | ||
|
|
8a67fe30af | ||
|
|
db9a2c1c58 | ||
|
|
767a057333 | ||
|
|
30ceec20a6 | ||
|
|
910cb8ff06 | ||
|
|
6a1a4e006d | ||
|
|
d2378ea641 | ||
|
|
8d17242b82 | ||
|
|
1e491c0bfd | ||
|
|
fb8ca0d2f8 | ||
|
|
d8c70d7a11 | ||
|
|
253b02bd22 | ||
|
|
99cfca6f83 | ||
|
|
6143d119fe | ||
|
|
0162222bb2 | ||
|
|
ab92280a7f | ||
|
|
c0891e8a78 | ||
|
|
f624d01fd8 | ||
|
|
4b2fc90431 | ||
|
|
49b28fca68 | ||
|
|
1e3e23d756 | ||
|
|
68d5af3dd8 | ||
|
|
bceaf8be94 | ||
|
|
52986e8cd1 | ||
|
|
10c0634413 | ||
|
|
e4a9ce6db0 | ||
|
|
584fbc8f8b | ||
|
|
5985713335 | ||
|
|
68f8470d4a | ||
|
|
da43f785be | ||
|
|
03335d014c | ||
|
|
f12942ff40 | ||
|
|
c7d78ef094 | ||
|
|
5909b00a46 | ||
|
|
ee0d4a12a3 | ||
|
|
705b6b16a5 | ||
|
|
301e0386f5 | ||
|
|
a97e2593af | ||
|
|
f2ec23d80c | ||
|
|
d940797aa7 | ||
|
|
d2f779d6e8 | ||
|
|
8047a8cd28 | ||
|
|
dd23e07111 | ||
|
|
d7e14cb7b7 | ||
|
|
882d46661e | ||
|
|
6fcea5ef9d | ||
|
|
d19a7dee42 | ||
|
|
6f8d7d6e76 | ||
|
|
bf4d779ea2 | ||
|
|
d0d01d4e70 | ||
|
|
71649ba2f1 | ||
|
|
79091382cc | ||
|
|
cb16661d36 | ||
|
|
8d73ddf73f | ||
|
|
26868d8b14 | ||
|
|
abdcd7d705 | ||
|
|
6d41de61a5 | ||
|
|
d15ab86459 | ||
|
|
5e57a1a9d9 | ||
|
|
34e20c4373 | ||
|
|
70d98acf9a | ||
|
|
215f4adcd7 | ||
|
|
ccf37f59a9 | ||
|
|
0fad78f53f | ||
|
|
2e3bf71e9a | ||
|
|
95f9246a46 | ||
|
|
b960470d78 | ||
|
|
4a3f038595 | ||
|
|
1c31e32df7 | ||
|
|
4598c64ebd | ||
|
|
9305c84093 | ||
|
|
72ab3e22b1 | ||
|
|
e95ab31983 | ||
|
|
fcbeee78c1 | ||
|
|
306af1d017 | ||
|
|
5a35c5b2e2 | ||
|
|
b3bddcd31f | ||
|
|
b0f35a3cde | ||
|
|
62eb536e32 | ||
|
|
67f90df175 | ||
|
|
c88fbfbdad | ||
|
|
424a70978e | ||
|
|
24e6dbc709 | ||
|
|
d856e62ccf | ||
|
|
143c29d8e1 | ||
|
|
f79961f1c5 | ||
|
|
327a74b406 | ||
|
|
864054c005 | ||
|
|
6f71a508eb | ||
|
|
7366fb23bb | ||
|
|
0a4a49992e | ||
|
|
2cc294aa27 | ||
|
|
ee559c6820 | ||
|
|
2581d00c69 | ||
|
|
41b986db06 | ||
|
|
b949d49ed3 | ||
|
|
f529cdddb3 | ||
|
|
147f717c86 | ||
|
|
0cb633c688 | ||
|
|
c7149f4184 | ||
|
|
24c361eb0a | ||
|
|
9817e1d744 | ||
|
|
28f0c4f131 | ||
|
|
638583012a | ||
|
|
55ea557fe8 | ||
|
|
552ed9693e | ||
|
|
231282ddcb | ||
|
|
09375960d6 | ||
|
|
354e09811b | ||
|
|
43c677b489 | ||
|
|
4edc30d157 | ||
|
|
dd8d8e0560 | ||
|
|
de0689d4f4 | ||
|
|
1511b1435a | ||
|
|
12b71ebc8e | ||
|
|
04e7b18869 | ||
|
|
d88ffd11e2 | ||
|
|
e4ba838c6b | ||
|
|
269e9057dd | ||
|
|
ea307619be | ||
|
|
6d62ab64e6 | ||
|
|
78dd564a82 | ||
|
|
d2cb9d5289 | ||
|
|
d427d8e567 | ||
|
|
e436285b6f | ||
|
|
1334cbf78c | ||
|
|
fde9c7315a | ||
|
|
cfb06a2607 | ||
|
|
5e4bb16a7f | ||
|
|
2e240103f3 | ||
|
|
18270ee587 | ||
|
|
eabbab6e2b | ||
|
|
d25defe276 | ||
|
|
ab28a55b4e | ||
|
|
dd1163b58a | ||
|
|
051794dffc | ||
|
|
54bb145c76 | ||
|
|
a7bacf70fb | ||
|
|
07d20cc5f7 | ||
|
|
dee17f4677 | ||
|
|
2658730302 | ||
|
|
e06b60d1b9 | ||
|
|
7d458e0b27 | ||
|
|
725ff27c37 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,6 +5,7 @@
|
||||
/config/database.yml
|
||||
/config/email.yml
|
||||
/config/initializers/session_store.rb
|
||||
/config/initializers/secret_token.rb
|
||||
/coverage
|
||||
/db/*.db
|
||||
/db/*.sqlite3
|
||||
@@ -18,7 +19,6 @@
|
||||
/public/plugin_assets
|
||||
/tmp/*
|
||||
/tmp/cache/*
|
||||
/tmp/pdf/*
|
||||
/tmp/sessions/*
|
||||
/tmp/sockets/*
|
||||
/tmp/test/*
|
||||
|
||||
@@ -7,6 +7,7 @@ config/configuration.yml
|
||||
config/database.yml
|
||||
config/email.yml
|
||||
config/initializers/session_store.rb
|
||||
config/initializers/secret_token.rb
|
||||
coverage
|
||||
db/*.db
|
||||
db/*.sqlite3
|
||||
@@ -20,7 +21,6 @@ public/dispatch.*
|
||||
public/plugin_assets
|
||||
tmp/*
|
||||
tmp/cache/*
|
||||
tmp/pdf/*
|
||||
tmp/sessions/*
|
||||
tmp/sockets/*
|
||||
tmp/test/*
|
||||
|
||||
24
Gemfile
24
Gemfile
@@ -1,10 +1,11 @@
|
||||
source :rubygems
|
||||
source 'http://rubygems.org'
|
||||
|
||||
gem "rails", "2.3.15"
|
||||
gem "i18n", "~> 0.4.2"
|
||||
gem 'rails', '3.2.3'
|
||||
gem 'prototype-rails', '3.2.1'
|
||||
gem "i18n", "~> 0.6.0"
|
||||
gem "coderay", "~> 1.0.6"
|
||||
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
|
||||
gem "tzinfo", "~> 0.3.31"
|
||||
gem "builder"
|
||||
|
||||
# Optional gem for LDAP authentication
|
||||
group :ldap do
|
||||
@@ -14,6 +15,7 @@ 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
|
||||
@@ -39,13 +41,13 @@ end
|
||||
|
||||
platforms :mri_18, :mingw_18 do
|
||||
group :mysql do
|
||||
gem "mysql", "~> 2.8.1"
|
||||
gem "mysql"
|
||||
end
|
||||
end
|
||||
|
||||
platforms :mri_19, :mingw_19 do
|
||||
group :mysql do
|
||||
gem "mysql2", "~> 0.2.7"
|
||||
gem "mysql2", "~> 0.3.11"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -67,14 +69,12 @@ end
|
||||
|
||||
group :development do
|
||||
gem "rdoc", ">= 2.4.2"
|
||||
gem "yard"
|
||||
end
|
||||
|
||||
group :test do
|
||||
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"
|
||||
gem "shoulda", "~> 2.11"
|
||||
gem "mocha"
|
||||
end
|
||||
|
||||
local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
|
||||
@@ -84,7 +84,7 @@ if File.exists?(local_gemfile)
|
||||
end
|
||||
|
||||
# Load plugins' Gemfiles
|
||||
Dir.glob File.expand_path("../vendor/plugins/*/Gemfile", __FILE__) do |file|
|
||||
Dir.glob File.expand_path("../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,15 +1,7 @@
|
||||
#!/usr/bin/env rake
|
||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/switchtower.rake, and they will automatically be available to Rake.
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
|
||||
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
||||
require File.expand_path('../config/application', __FILE__)
|
||||
|
||||
require 'rake'
|
||||
require 'rake/testtask'
|
||||
|
||||
begin
|
||||
require 'rdoc/task'
|
||||
rescue LoadError
|
||||
# RDoc is not available
|
||||
end
|
||||
|
||||
require 'tasks/rails'
|
||||
RedmineApp::Application.load_tasks
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -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.deliver_lost_password(token)
|
||||
Mailer.lost_password(token).deliver
|
||||
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) do |result, identity_url, registration|
|
||||
authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email], :return_to => signin_url, :method => :post) 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.deliver_register(token)
|
||||
Mailer.register(token).deliver
|
||||
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.deliver_account_activation_request(user)
|
||||
Mailer.account_activation_request(user).deliver
|
||||
account_pending
|
||||
else
|
||||
yield if block_given?
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -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_date)
|
||||
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
|
||||
render :layout => false if request.xhr?
|
||||
}
|
||||
format.atom {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -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.deliver_test_email(User.current)
|
||||
@test = Mailer.test_email(User.current).deliver
|
||||
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-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -22,9 +22,12 @@ 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
|
||||
@@ -32,32 +35,7 @@ class ApplicationController < ActionController::Base
|
||||
cookies.delete(:autologin)
|
||||
end
|
||||
|
||||
# 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
|
||||
before_filter :user_setup, :check_if_login_required, :set_localization
|
||||
|
||||
rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token
|
||||
rescue_from ::Unauthorized, :with => :deny_access
|
||||
@@ -66,42 +44,6 @@ 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
|
||||
@@ -115,7 +57,10 @@ class ApplicationController < ActionController::Base
|
||||
if session[:user_id]
|
||||
# existing session
|
||||
(User.active.find(session[:user_id]) rescue nil)
|
||||
elsif user = try_to_autologin
|
||||
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
|
||||
user
|
||||
elsif params[:format] == 'atom' && params[:key] && request.get? && accept_rss_auth?
|
||||
# RSS key authentication does not start a session
|
||||
@@ -133,24 +78,12 @@ 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
|
||||
start_user_session(user)
|
||||
session[:user_id] = user.id
|
||||
else
|
||||
User.current = User.anonymous
|
||||
end
|
||||
@@ -272,7 +205,7 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def find_model_object
|
||||
model = self.class.read_inheritable_attribute('model_object')
|
||||
model = self.class.model_object
|
||||
if model
|
||||
@object = model.find(params[:id])
|
||||
self.instance_variable_set('@' + controller_name.singularize, @object) if @object
|
||||
@@ -282,7 +215,7 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def self.model_object(model)
|
||||
write_inheritable_attribute('model_object', model)
|
||||
self.model_object = model
|
||||
end
|
||||
|
||||
# Filter for bulk issue operations
|
||||
@@ -337,6 +270,19 @@ 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))
|
||||
@@ -405,9 +351,9 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
def self.accept_rss_auth(*actions)
|
||||
if actions.any?
|
||||
write_inheritable_attribute('accept_rss_auth_actions', actions)
|
||||
self.accept_rss_auth_actions = actions
|
||||
else
|
||||
read_inheritable_attribute('accept_rss_auth_actions') || []
|
||||
self.accept_rss_auth_actions || []
|
||||
end
|
||||
end
|
||||
|
||||
@@ -417,9 +363,9 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
def self.accept_api_auth(*actions)
|
||||
if actions.any?
|
||||
write_inheritable_attribute('accept_api_auth_actions', actions)
|
||||
self.accept_api_auth_actions = actions
|
||||
else
|
||||
read_inheritable_attribute('accept_api_auth_actions') || []
|
||||
self.accept_api_auth_actions || []
|
||||
end
|
||||
end
|
||||
|
||||
@@ -499,9 +445,9 @@ class ApplicationController < ActionController::Base
|
||||
# Returns the API key present in the request
|
||||
def api_key_from_request
|
||||
if params[:key].present?
|
||||
params[:key].to_s
|
||||
params[:key]
|
||||
elsif request.headers["X-Redmine-API-Key"].present?
|
||||
request.headers["X-Redmine-API-Key"].to_s
|
||||
request.headers["X-Redmine-API-Key"]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -540,26 +486,12 @@ class ApplicationController < ActionController::Base
|
||||
else
|
||||
@error_messages = objects.errors.full_messages
|
||||
end
|
||||
render :template => 'common/error_messages.api', :status => :unprocessable_entity, :layout => false
|
||||
render :template => 'common/error_messages.api', :status => :unprocessable_entity, :layout => nil
|
||||
end
|
||||
|
||||
# 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
|
||||
# Overrides #_include_layout? so that #render with no arguments
|
||||
# doesn't use the layout for api requests
|
||||
def pick_layout(*args)
|
||||
api_request? ? nil : super
|
||||
def _include_layout?(*args)
|
||||
api_request? ? false : super
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -88,9 +88,7 @@ class AttachmentsController < ApplicationController
|
||||
end
|
||||
# Make sure association callbacks are called
|
||||
@attachment.container.attachments.delete(@attachment)
|
||||
redirect_to :back
|
||||
rescue ::ActionController::RedirectBackError
|
||||
redirect_to :controller => 'projects', :action => 'show', :id => @project
|
||||
redirect_to_referer_or project_path(@project)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
# 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-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
# 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-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -86,7 +86,9 @@ class DocumentsController < ApplicationController
|
||||
attachments = Attachment.attach_files(@document, params[:attachments])
|
||||
render_attachment_warning_if_needed(@document)
|
||||
|
||||
Mailer.deliver_attachments_added(attachments[:files]) if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added')
|
||||
if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added')
|
||||
Mailer.attachments_added(attachments[:files]).deliver
|
||||
end
|
||||
redirect_to :action => 'show', :id => @document
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
# 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
|
||||
|
||||
@@ -29,7 +46,7 @@ class FilesController < ApplicationController
|
||||
render_attachment_warning_if_needed(container)
|
||||
|
||||
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
||||
Mailer.deliver_attachments_added(attachments[:files])
|
||||
Mailer.attachments_added(attachments[:files]).deliver
|
||||
end
|
||||
redirect_to project_files_path(@project)
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -95,10 +95,11 @@ 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 => @message }
|
||||
{ :action => 'show', :id => @message.parent, :r => r }
|
||||
end
|
||||
|
||||
def quote
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
# 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-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
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
|
||||
@@ -45,7 +46,11 @@ class RepositoriesController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
@repository = Repository.factory(params[:repository_scm], params[:repository])
|
||||
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.project = @project
|
||||
if request.post? && @repository.save
|
||||
redirect_to settings_project_path(@project, :tab => 'repositories')
|
||||
@@ -58,7 +63,11 @@ class RepositoriesController < ApplicationController
|
||||
end
|
||||
|
||||
def update
|
||||
@repository.attributes = params[:repository]
|
||||
attrs = pickup_extra_info
|
||||
@repository.attributes = attrs[:attrs]
|
||||
if attrs[:attrs_extra].keys.any?
|
||||
@repository.merge_extra_info(attrs[:attrs_extra])
|
||||
end
|
||||
@repository.project = @project
|
||||
if request.put? && @repository.save
|
||||
redirect_to settings_project_path(@project, :tab => 'repositories')
|
||||
@@ -67,6 +76,20 @@ 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
|
||||
@@ -129,7 +152,15 @@ 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
|
||||
|
||||
@@ -138,7 +169,7 @@ class RepositoriesController < ApplicationController
|
||||
|
||||
@content = @repository.cat(@path, @rev)
|
||||
(show_error_not_found; return) unless @content
|
||||
if 'raw' == params[:format] ||
|
||||
if is_raw ||
|
||||
(@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) ||
|
||||
! is_entry_text_data?(@content, @path)
|
||||
# Force the download
|
||||
@@ -154,6 +185,7 @@ 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".
|
||||
@@ -307,8 +339,7 @@ class RepositoriesController < ApplicationController
|
||||
@repository = @project.repository
|
||||
end
|
||||
(render_404; return false) unless @repository
|
||||
@path = params[:path].join('/') unless params[:path].nil?
|
||||
@path ||= ''
|
||||
@path = params[:path].is_a?(Array) ? params[:path].join('/') : params[:path].to_s
|
||||
@rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip
|
||||
@rev_to = params[:rev_to]
|
||||
|
||||
@@ -343,17 +374,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 = repository.changesets.count(
|
||||
commits_by_day = Changeset.count(
|
||||
:all, :group => :commit_date,
|
||||
:conditions => ["commit_date BETWEEN ? AND ?", @date_from, @date_to])
|
||||
:conditions => ["repository_id = ? AND commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
|
||||
commits_by_month = [0] * 12
|
||||
commits_by_day.each {|c| commits_by_month[c.first.to_date.months_ago] += c.last }
|
||||
commits_by_day.each {|c| commits_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last }
|
||||
|
||||
changes_by_day = repository.changes.count(
|
||||
:all, :group => :commit_date,
|
||||
:conditions => ["commit_date BETWEEN ? AND ?", @date_from, @date_to])
|
||||
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_month = [0] * 12
|
||||
changes_by_day.each {|c| changes_by_month[c.first.to_date.months_ago] += c.last }
|
||||
changes_by_day.each {|c| changes_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last }
|
||||
|
||||
fields = []
|
||||
12.times {|m| fields << month_name(((Date.today.month - 1 - m) % 12) + 1)}
|
||||
@@ -384,10 +415,10 @@ class RepositoriesController < ApplicationController
|
||||
end
|
||||
|
||||
def graph_commits_per_author(repository)
|
||||
commits_by_author = repository.changesets.count(:all, :group => :committer)
|
||||
commits_by_author = Changeset.count(:all, :group => :committer, :conditions => ["repository_id = ?", repository.id])
|
||||
commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}
|
||||
|
||||
changes_by_author = repository.changes.count(:all, :group => :committer)
|
||||
changes_by_author = Change.count(:all, :group => :committer, :include => :changeset, :conditions => ["#{Changeset.table_name}.repository_id = ?", repository.id])
|
||||
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-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -18,13 +18,12 @@
|
||||
class TimelogController < ApplicationController
|
||||
menu_item :issues
|
||||
|
||||
before_filter :find_project_for_new_time_entry, :only => [:create]
|
||||
before_filter :find_project, :only => [:create]
|
||||
before_filter :find_time_entry, :only => [:show, :edit, :update]
|
||||
before_filter :find_time_entries, :only => [:bulk_edit, :bulk_update, :destroy]
|
||||
before_filter :authorize, :except => [:new, :index, :report]
|
||||
|
||||
before_filter :find_optional_project, :only => [:index, :report]
|
||||
before_filter :find_optional_project_for_new_time_entry, :only => [:new]
|
||||
before_filter :find_optional_project, :only => [:new, :index, :report]
|
||||
before_filter :authorize_global, :only => [:new, :index, :report]
|
||||
|
||||
accept_rss_auth :index
|
||||
@@ -39,7 +38,7 @@ class TimelogController < ApplicationController
|
||||
|
||||
def index
|
||||
sort_init 'spent_on', 'desc'
|
||||
sort_update 'spent_on' => ['spent_on', "#{TimeEntry.table_name}.created_on"],
|
||||
sort_update 'spent_on' => 'spent_on',
|
||||
'user' => 'user_id',
|
||||
'activity' => 'activity_id',
|
||||
'project' => "#{Project.table_name}.name",
|
||||
@@ -134,13 +133,9 @@ class TimelogController < ApplicationController
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
if params[:continue]
|
||||
if params[:project_id]
|
||||
redirect_to :action => 'new', :project_id => @time_entry.project, :issue_id => @time_entry.issue,
|
||||
:time_entry => {:issue_id => @time_entry.issue_id, :activity_id => @time_entry.activity_id},
|
||||
:back_url => params[:back_url]
|
||||
redirect_to :action => 'new', :project_id => @time_entry.project, :issue_id => @time_entry.issue, :back_url => params[:back_url]
|
||||
else
|
||||
redirect_to :action => 'new',
|
||||
:time_entry => {:project_id => @time_entry.project_id, :issue_id => @time_entry.issue_id, :activity_id => @time_entry.activity_id},
|
||||
:back_url => params[:back_url]
|
||||
redirect_to :action => 'new', :back_url => params[:back_url]
|
||||
end
|
||||
else
|
||||
redirect_back_or_default :action => 'index', :project_id => @time_entry.project
|
||||
@@ -263,7 +258,7 @@ private
|
||||
end
|
||||
end
|
||||
|
||||
def find_optional_project_for_new_time_entry
|
||||
def find_project
|
||||
if (project_id = (params[:project_id] || params[:time_entry] && params[:time_entry][:project_id])).present?
|
||||
@project = Project.find(project_id)
|
||||
end
|
||||
@@ -271,15 +266,12 @@ private
|
||||
@issue = Issue.find(issue_id)
|
||||
@project ||= @issue.project
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def find_project_for_new_time_entry
|
||||
find_optional_project_for_new_time_entry
|
||||
if @project.nil?
|
||||
render_404
|
||||
return false
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def find_optional_project
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -99,7 +99,7 @@ class UsersController < ApplicationController
|
||||
@user.pref.save
|
||||
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
|
||||
|
||||
Mailer.deliver_account_information(@user, params[:user][:password]) if params[:send_information]
|
||||
Mailer.account_information(@user, params[:user][:password]).deliver 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.deliver_account_activated(@user)
|
||||
Mailer.account_activated(@user).deliver
|
||||
elsif @user.active? && params[:send_information] && !params[:user][:password].blank? && @user.auth_source_id.nil?
|
||||
Mailer.deliver_account_information(@user, params[:user][:password])
|
||||
Mailer.account_information(@user, params[:user][:password]).deliver
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :back
|
||||
redirect_to_referer_or edit_user_path(@user)
|
||||
}
|
||||
format.api { head :ok }
|
||||
end
|
||||
@@ -169,18 +169,14 @@ 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 :back }
|
||||
format.html { redirect_to_referer_or(users_url) }
|
||||
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-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -52,7 +52,7 @@ class WatchersController < ApplicationController
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}}
|
||||
format.js do
|
||||
render :update do |page|
|
||||
page.replace_html 'ajax-modal', :partial => 'watchers/new', :locals => {:watched => @watched}
|
||||
@@ -60,8 +60,6 @@ class WatchersController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
rescue ::ActionController::RedirectBackError
|
||||
render :text => 'Watcher added.', :layout => true
|
||||
end
|
||||
|
||||
def append
|
||||
@@ -72,9 +70,7 @@ class WatchersController < ApplicationController
|
||||
format.js do
|
||||
render :update do |page|
|
||||
users.each do |user|
|
||||
page.select("#issue_watcher_user_ids_#{user.id}").each do |item|
|
||||
page.remove item
|
||||
end
|
||||
page << %|$$("#issue_watcher_user_ids_#{user.id}").each(function(el){el.remove();});|
|
||||
end
|
||||
page.insert_html :bottom, 'watchers_inputs', :text => watchers_checkboxes(nil, users, true)
|
||||
end
|
||||
@@ -111,7 +107,7 @@ private
|
||||
@watched = klass.find(params[:object_id])
|
||||
@project = @watched.project
|
||||
elsif params[:project_id]
|
||||
@project = Project.visible.find(params[:project_id])
|
||||
@project = Project.visible.find_by_param(params[:project_id])
|
||||
end
|
||||
rescue
|
||||
render_404
|
||||
@@ -120,17 +116,13 @@ private
|
||||
def set_watcher(user, watching)
|
||||
@watched.set_watcher(user, watching)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :back }
|
||||
format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
format.js do
|
||||
render(:update) do |page|
|
||||
c = watcher_css(@watched)
|
||||
page.select(".#{c}").each do |item|
|
||||
page.replace_html item, watcher_link(@watched, user)
|
||||
end
|
||||
page << %|$$(".#{c}").each(function(el){el.innerHTML="#{escape_javascript watcher_link(@watched, user)}"});|
|
||||
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-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -163,6 +163,8 @@ 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-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -178,7 +178,7 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def format_activity_day(date)
|
||||
date == Date.today ? l(:label_today).titleize : format_date(date)
|
||||
date == User.current.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}"))
|
||||
s << content_tag('div', v.html_safe, :class => "flash #{k}", :id => "flash_#{k}")
|
||||
end
|
||||
s.html_safe
|
||||
end
|
||||
@@ -319,7 +319,7 @@ module ApplicationHelper
|
||||
unless groups.empty?
|
||||
s << %(<optgroup label="#{h(l(:label_group_plural))}">#{groups}</optgroup>)
|
||||
end
|
||||
s
|
||||
s.html_safe
|
||||
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 => time.to_date}, :title => format_time(time))
|
||||
link_to(text, {:controller => 'activities', :action => 'index', :id => @project, :from => User.current.time_to_date(time)}, :title => format_time(time))
|
||||
else
|
||||
content_tag('acronym', text, :title => format_time(time))
|
||||
end
|
||||
@@ -369,7 +369,8 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def to_path_param(path)
|
||||
path.to_s.split(%r{[/\\]}).select {|p| !p.blank?}
|
||||
str = path.to_s.split(%r{[/\\]}).select{|p| !p.blank?}.join("/")
|
||||
str.blank? ? nil : str
|
||||
end
|
||||
|
||||
def pagination_links_full(paginator, count=nil, options={})
|
||||
@@ -398,7 +399,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)
|
||||
if per_page_links != false && links = per_page_links(paginator.items_per_page, count)
|
||||
html << " | #{links}"
|
||||
end
|
||||
end
|
||||
@@ -406,11 +407,23 @@ module ApplicationHelper
|
||||
html.html_safe
|
||||
end
|
||||
|
||||
def per_page_links(selected=nil)
|
||||
links = Setting.per_page_options_array.collect do |n|
|
||||
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|
|
||||
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
|
||||
l(:label_display_per_page, links.join(', '))
|
||||
end
|
||||
|
||||
def reorder_links(name, url, method = :post)
|
||||
@@ -799,7 +812,7 @@ module ApplicationHelper
|
||||
end
|
||||
end
|
||||
|
||||
HEADING_RE = /(<h(\d)( [^>]+)?>(.+?)<\/h(\d)>)/i unless const_defined?(:HEADING_RE)
|
||||
HEADING_RE = /(<h(1|2|3|4)( [^>]+)?>(.+?)<\/h(1|2|3|4)>)/i unless const_defined?(:HEADING_RE)
|
||||
|
||||
def parse_sections(text, project, obj, attr, only_path, options)
|
||||
return unless options[:edit_section_links]
|
||||
@@ -870,8 +883,6 @@ module ApplicationHelper
|
||||
# Renders the TOC with given headings
|
||||
def replace_toc(text, headings)
|
||||
text.gsub!(TOC_RE) do
|
||||
# Keep only the 4 first levels
|
||||
headings = headings.select{|level, anchor, item| level <= 4}
|
||||
if headings.empty?
|
||||
''
|
||||
else
|
||||
@@ -932,6 +943,9 @@ 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
|
||||
@@ -946,8 +960,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_form_for(*args, &proc)
|
||||
options.merge!({:builder => Redmine::Views::LabelledFormBuilder, :remote => true})
|
||||
form_for(*args, &proc)
|
||||
end
|
||||
|
||||
def error_messages_for(*objects)
|
||||
@@ -1044,6 +1058,59 @@ 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
|
||||
@@ -1054,6 +1121,14 @@ 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
|
||||
@@ -1062,7 +1137,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 => (defined?(request) && request.ssl?), :default => Setting.gravatar_default})
|
||||
options.merge!({:ssl => (request && request.ssl?), :default => Setting.gravatar_default})
|
||||
email = nil
|
||||
if user.respond_to?(:mail)
|
||||
email = user.mail
|
||||
@@ -1081,7 +1156,7 @@ module ApplicationHelper
|
||||
|
||||
# Returns the javascript tags that are included in the html layout head
|
||||
def javascript_heads
|
||||
tags = javascript_include_tag(:defaults)
|
||||
tags = javascript_include_tag('prototype', 'effects', 'dragdrop', 'controls', 'rails', 'application')
|
||||
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-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -39,34 +39,36 @@ 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, :id => field_id, :size => 10) +
|
||||
text_field_tag(field_name, custom_value.value, tag_options.merge(:size => 10)) +
|
||||
calendar_for(field_id)
|
||||
when "text"
|
||||
text_area_tag(field_name, custom_value.value, :id => field_id, :rows => 3, :style => 'width:90%')
|
||||
text_area_tag(field_name, custom_value.value, tag_options.merge(:rows => 3))
|
||||
when "bool"
|
||||
hidden_field_tag(field_name, '0') + check_box_tag(field_name, '1', custom_value.true?, :id => field_id)
|
||||
hidden_field_tag(field_name, '0') + check_box_tag(field_name, '1', custom_value.true?, tag_options)
|
||||
when "list"
|
||||
blank_option = ''
|
||||
blank_option = ''.html_safe
|
||||
unless custom_field.multiple?
|
||||
if custom_field.is_required?
|
||||
unless custom_field.default_value.present?
|
||||
blank_option = "<option value=\"\">--- #{l(:actionview_instancetag_blank_option)} ---</option>"
|
||||
blank_option = content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---", :value => '')
|
||||
end
|
||||
else
|
||||
blank_option = '<option></option>'
|
||||
blank_option = content_tag('option')
|
||||
end
|
||||
end
|
||||
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?)
|
||||
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?))
|
||||
if custom_field.multiple?
|
||||
s << hidden_field_tag(field_name, '')
|
||||
end
|
||||
s
|
||||
else
|
||||
text_field_tag(field_name, custom_value.value, :id => field_id)
|
||||
text_field_tag(field_name, custom_value.value, tag_options)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -86,26 +88,28 @@ 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, '', :id => field_id, :size => 10) +
|
||||
text_field_tag(field_name, '', tag_options.merge(:size => 10)) +
|
||||
calendar_for(field_id)
|
||||
when "text"
|
||||
text_area_tag(field_name, '', :id => field_id, :rows => 3, :style => 'width:90%')
|
||||
text_area_tag(field_name, '', tag_options.merge(:rows => 3))
|
||||
when "bool"
|
||||
select_tag(field_name, options_for_select([[l(:label_no_change_option), ''],
|
||||
[l(:general_text_yes), '1'],
|
||||
[l(:general_text_no), '0']]), :id => field_id)
|
||||
[l(:general_text_no), '0']]), tag_options)
|
||||
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),
|
||||
:id => field_id, :multiple => custom_field.multiple?)
|
||||
select_tag(field_name, options_for_select(options), tag_options.merge(:multiple => custom_field.multiple?))
|
||||
else
|
||||
text_field_tag(field_name, '', :id => field_id)
|
||||
text_field_tag(field_name, '', tag_options)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -45,30 +45,36 @@ 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 = avatar(user, :size => "16").to_s + link_to_user(user, :class => 'user').to_s
|
||||
s = ''.html_safe
|
||||
s << avatar(user, :size => "16").to_s
|
||||
s << link_to_user(user, :class => 'user')
|
||||
if remove_allowed
|
||||
url = {:controller => 'watchers',
|
||||
:action => 'destroy',
|
||||
:object_type => object.class.to_s.underscore,
|
||||
:object_id => object.id,
|
||||
:user_id => user}
|
||||
s += ' ' + link_to_remote(image_tag('delete.png'),
|
||||
s << ' '
|
||||
s << link_to_remote(image_tag('delete.png'),
|
||||
{:url => url},
|
||||
:href => url_for(url),
|
||||
:style => "vertical-align: middle",
|
||||
:class => "delete")
|
||||
end
|
||||
content_tag :li, s.html_safe
|
||||
content << content_tag('li', s)
|
||||
end
|
||||
(lis.empty? ? "" : "<ul>#{ lis.join("\n") }</ul>").html_safe
|
||||
content.present? ? content_tag('ul', content) : content
|
||||
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)}", :id => "issue_watcher_user_ids_#{user.id}", :class => "floating"
|
||||
end.join
|
||||
content_tag 'label', "#{tag} #{h(user)}".html_safe,
|
||||
:id => "issue_watcher_user_ids_#{user.id}",
|
||||
:class => "floating"
|
||||
end.join.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -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 = ''
|
||||
s = ''.html_safe
|
||||
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 + '» ') : nil
|
||||
indent = (level > 0) ? (' ' * level * 2 + '» ') : ''
|
||||
|
||||
s << "<option #{attrs}>#{indent}#{h page.pretty_title}</option>\n" +
|
||||
s << content_tag('option', (indent + h(page.pretty_title)).html_safe, :value => page.id.to_s, :selected => selected == page) +
|
||||
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-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -24,7 +24,6 @@ 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, :allow_blank => true
|
||||
validate :validate_max_file_size
|
||||
|
||||
acts_as_event :title => :filename,
|
||||
@@ -45,20 +44,11 @@ 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'] || "#{Rails.root}/files"
|
||||
@@storage_path = Redmine::Configuration['attachments_storage_path'] || File.join(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
|
||||
@@ -140,7 +130,7 @@ class Attachment < ActiveRecord::Base
|
||||
|
||||
# Returns file's location on disk
|
||||
def diskfile
|
||||
"#{@@storage_path}/#{self.disk_filename}"
|
||||
File.join(self.class.storage_path, disk_filename.to_s)
|
||||
end
|
||||
|
||||
def increment_download
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -28,7 +28,7 @@ class Board < ActiveRecord::Base
|
||||
validates_length_of :name, :maximum => 30
|
||||
validates_length_of :description, :maximum => 255
|
||||
|
||||
named_scope :visible, lambda {|*args| { :include => :project,
|
||||
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-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -49,7 +49,8 @@ class Changeset < ActiveRecord::Base
|
||||
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},
|
||||
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-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -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.deliver_news_comment_added(comment)
|
||||
Mailer.news_comment_added(comment).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -80,7 +80,7 @@ class CustomField < ActiveRecord::Base
|
||||
when 'bool'
|
||||
[[l(:general_text_Yes), '1'], [l(:general_text_No), '0']]
|
||||
else
|
||||
read_possible_values_utf8_encoded || []
|
||||
possible_values || []
|
||||
end
|
||||
end
|
||||
|
||||
@@ -91,14 +91,20 @@ class CustomField < ActiveRecord::Base
|
||||
when 'bool'
|
||||
['1', '0']
|
||||
else
|
||||
read_possible_values_utf8_encoded
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
# Makes possible_values accept a multiline string
|
||||
def possible_values=(arg)
|
||||
if arg.is_a?(Array)
|
||||
write_attribute(:possible_values, arg.compact.collect(&:strip).select {|v| !v.blank?})
|
||||
super(arg.compact.collect(&:strip).select {|v| !v.blank?})
|
||||
else
|
||||
self.possible_values = arg.to_s.split(/[\n\r]+/)
|
||||
end
|
||||
@@ -218,14 +224,4 @@ 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-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -30,7 +30,7 @@ class Document < ActiveRecord::Base
|
||||
validates_presence_of :project, :title, :category
|
||||
validates_length_of :title, :maximum => 60
|
||||
|
||||
named_scope :visible, lambda {|*args| { :include => :project,
|
||||
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,9 +42,7 @@ class Document < ActiveRecord::Base
|
||||
def initialize(attributes=nil, *args)
|
||||
super
|
||||
if new_record?
|
||||
# Rails3 use this instead
|
||||
# self.category ||= DocumentCategory.default
|
||||
self.category_id = DocumentCategory.default.id if self.category_id == 0
|
||||
self.category ||= DocumentCategory.default
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -31,12 +31,4 @@ 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-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
@@ -17,6 +17,6 @@
|
||||
|
||||
class DocumentObserver < ActiveRecord::Observer
|
||||
def after_create(document)
|
||||
Mailer.deliver_document_added(document) if Setting.notified_events.include?('document_added')
|
||||
Mailer.document_added(document).deliver if Setting.notified_events.include?('document_added')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
# 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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user