Skip to content

Commit

Permalink
Merge branch 'release-v1.2.0' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
edavis10 committed Mar 27, 2011
2 parents deaf11e + 25b0180 commit 78cee48
Show file tree
Hide file tree
Showing 90 changed files with 1,098 additions and 388 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,3 +1,5 @@
/.project
/.loadpath
/config/additional_environment.rb
/config/configuration.yml
/config/database.yml
Expand Down
2 changes: 2 additions & 0 deletions .hgignore
@@ -1,5 +1,7 @@
syntax: glob

.project
.loadpath
config/additional_environment.rb
config/configuration.yml
config/database.yml
Expand Down
9 changes: 4 additions & 5 deletions app/controllers/account_controller.rb
Expand Up @@ -129,7 +129,7 @@ def activate

def logout_user
if User.current.logged?
cookies.delete :autologin
cookies.delete Redmine::Configuration['autologin_cookie_name']
Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin'])
self.logged_user = nil
end
Expand Down Expand Up @@ -211,15 +211,14 @@ def successful_authentication(user)

def set_autologin_cookie(user)
token = Token.create(:user => user, :action => 'autologin')
cookie_name = Redmine::Configuration['autologin_cookie_name'] || 'autologin'
cookie_options = {
:value => token.value,
:expires => 1.year.from_now,
:path => (Redmine::Configuration['autologin_cookie_path'] || '/'),
:secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false),
:path => Redmine::Configuration['autologin_cookie_path'],
:secure => Redmine::Configuration['autologin_cookie_secure'],
:httponly => true
}
cookies[cookie_name] = cookie_options
cookies[Redmine::Configuration['autologin_cookie_name']] = cookie_options
end

# Onthefly creation failed, display the registration form to fill/fix attributes
Expand Down
7 changes: 5 additions & 2 deletions app/controllers/application_controller.rb
Expand Up @@ -19,6 +19,9 @@
require 'cgi'

class ApplicationController < ActionController::Base

protected

include Redmine::I18n

layout 'base'
Expand Down Expand Up @@ -63,9 +66,9 @@ def find_current_user
if session[:user_id]
# existing session
(User.active.find(session[:user_id]) rescue nil)
elsif cookies[:autologin] && Setting.autologin?
elsif cookies[Redmine::Configuration['autologin_cookie_name']] && Setting.autologin?
# auto-login feature starts a new session
user = User.try_to_autologin(cookies[:autologin])
user = User.try_to_autologin(cookies[Redmine::Configuration['autologin_cookie_name']])
session[:user_id] = user.id if user
user
elsif params[:format] == 'atom' && params[:key] && accept_key_auth_actions.include?(params[:action])
Expand Down
5 changes: 4 additions & 1 deletion app/controllers/auto_completes_controller.rb
Expand Up @@ -9,7 +9,10 @@ def issues
@issues << query.visible.find_by_id(q.to_i)
end
unless q.blank?
@issues += query.visible.find(:all, :conditions => ["LOWER(#{Issue.table_name}.subject) LIKE ?", "%#{q.downcase}%"], :limit => 10)
@issues += query.visible.find(:all,
:limit => 10,
:order => "#{Issue.table_name}.id ASC",
:conditions => ["LOWER(#{Issue.table_name}.subject) LIKE :q OR CAST(#{Issue.table_name}.id AS CHAR(13)) LIKE :q", {:q => "%#{q.downcase}%" }])
end
@issues.compact!
render :layout => false
Expand Down
1 change: 1 addition & 0 deletions app/controllers/journals_controller.rb
Expand Up @@ -27,6 +27,7 @@ class JournalsController < ApplicationController
include QueriesHelper
helper :sort
include SortHelper
helper :custom_fields

def index
retrieve_query
Expand Down
37 changes: 19 additions & 18 deletions app/controllers/repositories_controller.rb
Expand Up @@ -67,13 +67,13 @@ def committers
redirect_to :action => 'committers', :id => @project
end
end

def destroy
@repository.destroy
redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'repository'
end
def show

def show
@repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty?

@entries = @repository.entries(@path, @rev)
Expand All @@ -88,31 +88,31 @@ def show
end

alias_method :browse, :show

def changes
@entry = @repository.entry(@path, @rev)
(show_error_not_found; return) unless @entry
@changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i)
@properties = @repository.properties(@path, @rev)
@changeset = @repository.find_changeset_by_name(@rev)
end

def revisions
@changeset_count = @repository.changesets.count
@changeset_pages = Paginator.new self, @changeset_count,
per_page_option,
params['page']
per_page_option,
params['page']
@changesets = @repository.changesets.find(:all,
:limit => @changeset_pages.items_per_page,
:offset => @changeset_pages.current.offset,
:include => [:user, :repository])
:limit => @changeset_pages.items_per_page,
:offset => @changeset_pages.current.offset,
:include => [:user, :repository])

respond_to do |format|
format.html { render :layout => false if request.xhr? }
format.atom { render_feed(@changesets, :title => "#{@project.name}: #{l(:label_revision_plural)}") }
end
end

def entry
@entry = @repository.entry(@path, @rev)
(show_error_not_found; return) unless @entry
Expand All @@ -122,9 +122,10 @@ def entry

@content = @repository.cat(@path, @rev)
(show_error_not_found; return) unless @content
if 'raw' == params[:format] || @content.is_binary_data? || (@entry.size && @entry.size > Setting.file_max_size_displayed.to_i.kilobyte)
if 'raw' == params[:format] || @content.is_binary_data? ||
(@entry.size && @entry.size > Setting.file_max_size_displayed.to_i.kilobyte)
# Force the download
send_data @content, :filename => @path.split('/').last
send_data @content, :filename => filename_for_content_disposition(@path.split('/').last)
else
# Prevent empty lines when displaying a file with Windows style eol
@content.gsub!("\r\n", "\n")
Expand All @@ -135,7 +136,7 @@ def entry
def annotate
@entry = @repository.entry(@path, @rev)
(show_error_not_found; return) unless @entry

@annotate = @repository.scm.annotate(@path, @rev)
(render_error l(:error_scm_annotate); return) if @annotate.nil? || @annotate.empty?
@changeset = @repository.find_changeset_by_name(@rev)
Expand All @@ -153,7 +154,7 @@ def revision
rescue ChangesetNotFound
show_error_not_found
end

def diff
if params[:format] == 'diff'
@diff = @repository.diff(@path, @rev, @rev_to)
Expand Down Expand Up @@ -185,11 +186,11 @@ def diff
end
end

def stats
def stats
end

def graph
data = nil
data = nil
case params[:graph]
when "commits_per_month"
data = graph_commits_per_month(@repository)
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/users_controller.rb
Expand Up @@ -92,7 +92,7 @@ def create
@user.safe_attributes = params[:user]
@user.admin = params[:user][:admin] || false
@user.login = params[:user][:login]
@user.password, @user.password_confirmation = params[:user][:password], params[:user][:password_confirmation] unless @user.auth_source_id
@user.password, @user.password_confirmation = params[:user][:password], params[:user][:password_confirmation] if @user.change_password_allowed?

# TODO: Similar to My#account
@user.pref.attributes = params[:pref]
Expand Down Expand Up @@ -135,10 +135,10 @@ def edit
def update
@user.admin = params[:user][:admin] if params[:user][:admin]
@user.login = params[:user][:login] if params[:user][:login]
if params[:user][:password].present? && (@user.auth_source_id.nil? || params[:user][:auth_source_id].blank?)
@user.safe_attributes = params[:user]
if params[:user][:password].present? && @user.change_password_allowed?
@user.password, @user.password_confirmation = params[:user][:password], params[:user][:password_confirmation]
end
@user.safe_attributes = params[:user]
# Was the account actived ? (do it before User#save clears the change)
was_activated = (@user.status_change == [User::STATUS_REGISTERED, User::STATUS_ACTIVE])
# TODO: Similar to My#account
Expand All @@ -151,7 +151,7 @@ def update

if was_activated
Mailer.deliver_account_activated(@user)
elsif @user.active? && params[:send_information] && !params[:user][:password].blank? && @user.auth_source_id.nil?
elsif @user.active? && params[:send_information] && !params[:user][:password].blank? && @user.change_password_allowed?
Mailer.deliver_account_information(@user, params[:user][:password])
end

Expand Down
14 changes: 7 additions & 7 deletions app/helpers/repositories_helper.rb
Expand Up @@ -172,27 +172,27 @@ def subversion_field_tags(form, repository)
end

def darcs_field_tags(form, repository)
content_tag('p', form.text_field(:url, :label => 'Root directory', :size => 60, :required => true, :disabled => (repository && !repository.new_record?)))
content_tag('p', form.text_field(:url, :label => :label_darcs_path, :size => 60, :required => true, :disabled => (repository && !repository.new_record?)))
end

def mercurial_field_tags(form, repository)
content_tag('p', form.text_field(:url, :label => 'Root directory', :size => 60, :required => true, :disabled => (repository && !repository.root_url.blank?)))
content_tag('p', form.text_field(:url, :label => :label_mercurial_path, :size => 60, :required => true, :disabled => (repository && !repository.root_url.blank?)))
end

def git_field_tags(form, repository)
content_tag('p', form.text_field(:url, :label => 'Path to .git directory', :size => 60, :required => true, :disabled => (repository && !repository.root_url.blank?)))
content_tag('p', form.text_field(:url, :label => :label_git_path, :size => 60, :required => true, :disabled => (repository && !repository.root_url.blank?)))
end

def cvs_field_tags(form, repository)
content_tag('p', form.text_field(:root_url, :label => 'CVSROOT', :size => 60, :required => true, :disabled => !repository.new_record?)) +
content_tag('p', form.text_field(:url, :label => 'Module', :size => 30, :required => true, :disabled => !repository.new_record?))
content_tag('p', form.text_field(:root_url, :label => :label_cvs_path, :size => 60, :required => true, :disabled => !repository.new_record?)) +
content_tag('p', form.text_field(:url, :label => :label_cvs_module, :size => 30, :required => true, :disabled => !repository.new_record?))
end

def bazaar_field_tags(form, repository)
content_tag('p', form.text_field(:url, :label => 'Root directory', :size => 60, :required => true, :disabled => (repository && !repository.new_record?)))
content_tag('p', form.text_field(:url, :label => :label_bazaar_path, :size => 60, :required => true, :disabled => (repository && !repository.new_record?)))
end

def filesystem_field_tags(form, repository)
content_tag('p', form.text_field(:url, :label => 'Root directory', :size => 60, :required => true, :disabled => (repository && !repository.root_url.blank?)))
content_tag('p', form.text_field(:url, :label => :label_filesystem_path, :size => 60, :required => true, :disabled => (repository && !repository.root_url.blank?)))
end
end
14 changes: 12 additions & 2 deletions app/models/query.rb
Expand Up @@ -566,9 +566,19 @@ def sql_for_field(field, operator, value, db_table, db_field, is_custom_filter=f
sql = ''
case operator
when "="
sql = "#{db_table}.#{db_field} IN (" + value.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + ")"
if value.present?
sql = "#{db_table}.#{db_field} IN (" + value.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + ")"
else
# empty set of allowed values produces no result
sql = "0=1"
end
when "!"
sql = "(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (" + value.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + "))"
if value.present?
sql = "(#{db_table}.#{db_field} IS NULL OR #{db_table}.#{db_field} NOT IN (" + value.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + "))"
else
# empty set of forbidden values allows all results
sql = "1=1"
end
when "!*"
sql = "#{db_table}.#{db_field} IS NULL"
sql << " OR #{db_table}.#{db_field} = ''" if is_custom_filter
Expand Down
2 changes: 1 addition & 1 deletion app/views/issues/show.rhtml
@@ -1,6 +1,6 @@
<%= render :partial => 'action_menu' %>

<h2><%= @issue.tracker.name %> #<%= @issue.id %></h2>
<h2><%= @issue.tracker.name %> #<%= @issue.id %><%= call_hook(:view_issues_show_identifier, :issue => @issue) %></h2>

<div class="<%= @issue.css_classes %> details">
<%= avatar(@issue.author, :size => "50") %>
Expand Down
2 changes: 2 additions & 0 deletions app/views/layouts/mailer.text.html.erb
Expand Up @@ -26,7 +26,9 @@ hr {
</head>
<body>
<span class="header"><%= Redmine::WikiFormatting.to_html(Setting.text_formatting, Setting.emails_header) %></span>
<%= call_hook(:view_layouts_mailer_html_before_content, self.assigns) %>
<%= yield %>
<%= call_hook(:view_layouts_mailer_html_after_content, self.assigns) %>
<hr />
<span class="footer"><%= Redmine::WikiFormatting.to_html(Setting.text_formatting, Setting.emails_footer) %></span>
</body>
Expand Down
2 changes: 2 additions & 0 deletions app/views/layouts/mailer.text.plain.erb
@@ -1,4 +1,6 @@
<%= Setting.emails_header %>
<%= call_hook(:view_layouts_mailer_plain_before_content, self.assigns) %>
<%= yield %>
<%= call_hook(:view_layouts_mailer_plain_after_content, self.assigns) %>
--
<%= Setting.emails_footer %>
9 changes: 7 additions & 2 deletions app/views/projects/show.rhtml
Expand Up @@ -67,8 +67,13 @@
<% if @total_hours && User.current.allowed_to?(:view_time_entries, @project) %>
<h3><%= l(:label_spent_time) %></h3>
<p><span class="icon icon-time"><%= l_hours(@total_hours) %></span></p>
<p><%= link_to(l(:label_details), {:controller => 'timelog', :action => 'index', :project_id => @project}) %> |
<%= link_to(l(:label_report), {:controller => 'time_entry_reports', :action => 'report', :project_id => @project}) %></p>
<p>
<%= link_to(l(:label_details), {:controller => 'timelog', :action => 'index', :project_id => @project}) %> |
<%= link_to(l(:label_report), {:controller => 'time_entry_reports', :action => 'report', :project_id => @project}) %>
<% if authorize_for('timelog', 'new') %>
| <%= link_to l(:button_log_time), {:controller => 'timelog', :action => 'new', :project_id => @project} %>
<% end %>
</p>
<% end %>
<%= call_hook(:view_projects_show_sidebar_bottom, :project => @project) %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/settings/_display.rhtml
Expand Up @@ -15,7 +15,7 @@

<p><%= setting_check_box :gravatar_enabled %></p>

<p><%= setting_select :gravatar_default, [["Wavatars", 'wavatar'], ["Identicons", 'identicon'], ["Monster ids", 'monsterid']], :blank => :label_none %></p>
<p><%= setting_select :gravatar_default, [["Wavatars", 'wavatar'], ["Identicons", 'identicon'], ["Monster ids", 'monsterid'], ["Retro", "retro"]], :blank => :label_none %></p>
</div>

<%= submit_tag l(:button_save) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/versions/show.rhtml
Expand Up @@ -37,7 +37,7 @@
<fieldset class="related-issues"><legend><%= l(:label_related_issues) %></legend>
<ul>
<% @issues.each do |issue| -%>
<li><%= link_to_issue(issue) %></li>
<li><%= link_to_issue(issue, :project => issue.project != @version.project) %></li>
<% end -%>
</ul>
</fieldset>
Expand Down
3 changes: 3 additions & 0 deletions config/boot.rb
Expand Up @@ -158,5 +158,8 @@ def requirement
end
end

# working around deprecation in RubyGems 1.6
require 'thread'

# All that for this:
Rails.boot!
14 changes: 13 additions & 1 deletion config/configuration.yml.example
Expand Up @@ -98,7 +98,19 @@ default:
# attachments_storage_path: /var/chiliproject/files
# attachments_storage_path: D:/chiliproject/files
attachments_storage_path:


# Path to the directories where themes are stored.
# Can be an absolute path or one relative to your ChiliProject instance.
# You can configure multiple paths.
# The default is the 'public/themes' directory in your ChiliProject instance.
# Examples:
# themes_storage_paths: public/themes
# themes_storage_paths:
# - public/themes
# - /opt/themes
# - D:/chiliproject/themes
themes_storage_path:

# Configuration of the autologin cookie.
# autologin_cookie_name: the name of the cookie (default: autologin)
# autologin_cookie_path: the cookie path (default: /)
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/10-patches.rb
Expand Up @@ -86,7 +86,7 @@ module Backend
module Base
def warn_syntax_deprecation!(*args)
return if @skip_syntax_deprecation
warn "The {{key}} interpolation syntax in I18n messages is deprecated and will be removed in Redmine 1.2. Please use %{key} instead, see http://www.redmine.org/issues/7013 for more information."
ActiveSupport::Deprecation.warn "The {{key}} interpolation syntax in I18n messages is deprecated and will be removed in ChiliProject 2.0. Please use %{key} instead. See the notice at https://www.chiliproject.org/boards/2/topics/243 for more information."
@skip_syntax_deprecation = true
end
end
Expand Down
7 changes: 7 additions & 0 deletions config/locales/bg.yml
Expand Up @@ -939,3 +939,10 @@ bg:
enumeration_system_activity: Системна активност

text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_darcs_path: Root directory
label_bazaar_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_mercurial_path: Root directory
7 changes: 7 additions & 0 deletions config/locales/bs.yml
Expand Up @@ -953,3 +953,10 @@ bs:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_darcs_path: Root directory
label_bazaar_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_mercurial_path: Root directory

0 comments on commit 78cee48

Please sign in to comment.