replaced deprecated controller instance variables: @params, @session, @request

git-svn-id: http://redmine.rubyforge.org/svn/trunk@127 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2006-12-26 21:33:44 +00:00
parent b3a3d3e2fa
commit 95cc65f14e
12 changed files with 32 additions and 32 deletions

View File

@ -31,7 +31,7 @@ class AdminController < ApplicationController
@project_count = Project.count
@project_pages = Paginator.new self, @project_count,
15,
@params['page']
params['page']
@projects = Project.find :all, :order => sort_clause,
:limit => @project_pages.items_per_page,
:offset => @project_pages.current.offset

View File

@ -71,7 +71,7 @@ class ApplicationController < ActionController::Base
end
# authorizes the user for the requested action.
def authorize(ctrl = @params[:controller], action = @params[:action])
def authorize(ctrl = params[:controller], action = params[:action])
# check if action is allowed on public projects
if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ ctrl, action ]
return true
@ -92,7 +92,7 @@ class ApplicationController < ActionController::Base
# store current uri in session.
# return to this location by calling redirect_back_or_default
def store_location
session[:return_to] = @request.request_uri
session[:return_to] = request.request_uri
end
# move to the last store_location call or to the passed default one

View File

@ -23,11 +23,11 @@ class HelpController < ApplicationController
# displays help page for the requested controller/action
def index
# select help page to display
if @params[:ctrl] and @help_config['pages'][@params[:ctrl]]
if @params[:page] and @help_config['pages'][@params[:ctrl]][@params[:page]]
template = @help_config['pages'][@params[:ctrl]][@params[:page]]
if params[:ctrl] and @help_config['pages'][params[:ctrl]]
if params[:page] and @help_config['pages'][params[:ctrl]][params[:page]]
template = @help_config['pages'][params[:ctrl]][params[:page]]
else
template = @help_config['pages'][@params[:ctrl]]['index']
template = @help_config['pages'][params[:ctrl]]['index']
end
end
# choose language according to available help translations

View File

@ -72,7 +72,7 @@ class IssuesController < ApplicationController
#@history.status = @issue.status
if @issue.save
flash[:notice] = l(:notice_successful_update)
Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled?
Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
redirect_to :action => 'show', :id => @issue
return
end
@ -97,7 +97,7 @@ class IssuesController < ApplicationController
@issue.status = @new_status
if @issue.update_attributes(params[:issue])
flash[:notice] = l(:notice_successful_update)
Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled?
Mailer.deliver_issue_edit(journal) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
redirect_to :action => 'show', :id => @issue
end
rescue ActiveRecord::StaleObjectError

View File

@ -58,7 +58,7 @@ class MyController < ApplicationController
def change_password
@user = self.logged_in_user
flash[:notice] = l(:notice_can_t_change_password) and redirect_to :action => 'account' and return if @user.auth_source_id
if @user.check_password?(@params[:password])
if @user.check_password?(params[:password])
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
if @user.save
flash[:notice] = l(:notice_account_password_updated)

View File

@ -42,7 +42,7 @@ class ProjectsController < ApplicationController
@project_count = Project.count(["is_public=?", true])
@project_pages = Paginator.new self, @project_count,
15,
@params['page']
params['page']
@projects = Project.find :all, :order => sort_clause,
:conditions => ["is_public=?", true],
:limit => @project_pages.items_per_page,
@ -59,7 +59,7 @@ class ProjectsController < ApplicationController
if request.get?
@custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project) }
else
@project.custom_fields = CustomField.find(@params[:custom_field_ids]) if @params[:custom_field_ids]
@project.custom_fields = CustomField.find(params[:custom_field_ids]) if params[:custom_field_ids]
@custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }
@project.custom_values = @custom_values
if params[:repository_enabled] && params[:repository_enabled] == "1"
@ -95,7 +95,7 @@ class ProjectsController < ApplicationController
# Edit @project
def edit
if request.post?
@project.custom_fields = IssueCustomField.find(@params[:custom_field_ids]) if @params[:custom_field_ids]
@project.custom_fields = IssueCustomField.find(params[:custom_field_ids]) if params[:custom_field_ids]
if params[:custom_fields]
@custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }
@project.custom_values = @custom_values
@ -213,7 +213,7 @@ class ProjectsController < ApplicationController
if @issue.save
@attachments.each(&:save)
flash[:notice] = l(:notice_successful_create)
Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled?
Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
redirect_to :action => 'list_issues', :id => @project
end
end
@ -236,7 +236,7 @@ class ProjectsController < ApplicationController
if @query.valid?
@issue_count = Issue.count(:include => [:status, :project], :conditions => @query.statement)
@issue_pages = Paginator.new self, @issue_count, @results_per_page, @params['page']
@issue_pages = Paginator.new self, @issue_count, @results_per_page, params['page']
@issues = Issue.find :all, :order => sort_clause,
:include => [ :author, :status, :tracker, :project ],
:conditions => @query.statement,

View File

@ -32,7 +32,7 @@ class RolesController < ApplicationController
def new
@role = Role.new(params[:role])
if request.post?
@role.permissions = Permission.find(@params[:permission_ids]) if @params[:permission_ids]
@role.permissions = Permission.find(params[:permission_ids]) if params[:permission_ids]
if @role.save
flash[:notice] = l(:notice_successful_create)
redirect_to :action => 'list'
@ -44,7 +44,7 @@ class RolesController < ApplicationController
def edit
@role = Role.find(params[:id])
if request.post? and @role.update_attributes(params[:role])
@role.permissions = Permission.find(@params[:permission_ids] || [])
@role.permissions = Permission.find(params[:permission_ids] || [])
Permission.allowed_to_role_expired
flash[:notice] = l(:notice_successful_update)
redirect_to :action => 'list'

View File

@ -35,7 +35,7 @@ class UsersController < ApplicationController
@user_count = User.count
@user_pages = Paginator.new self, @user_count,
15,
@params['page']
params['page']
@users = User.find :all,:order => sort_clause,
:limit => @user_pages.items_per_page,
:offset => @user_pages.current.offset

View File

@ -70,17 +70,17 @@ module ApplicationHelper
html = ''
html << link_to_remote(('&#171; ' + l(:label_previous)),
{:update => "content", :url => { :page => paginator.current.previous }},
{:href => url_for(:action => 'list', :params => @params.merge({:page => paginator.current.previous}))}) + ' ' if paginator.current.previous
{:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.previous}))}) + ' ' if paginator.current.previous
html << (pagination_links_each(paginator, options) do |n|
link_to_remote(n.to_s,
{:url => {:action => 'list', :params => @params.merge({:page => n})}, :update => 'content'},
{:href => url_for(:action => 'list', :params => @params.merge({:page => n}))})
{:url => {:action => 'list', :params => params.merge({:page => n})}, :update => 'content'},
{:href => url_for(:action => 'list', :params => params.merge({:page => n}))})
end || '')
html << ' ' + link_to_remote((l(:label_next) + ' &#187;'),
{:update => "content", :url => { :page => paginator.current.next }},
{:href => url_for(:action => 'list', :params => @params.merge({:page => paginator.current.next}))}) if paginator.current.next
{:href => url_for(:action => 'list', :params => params.merge({:page => paginator.current.next}))}) if paginator.current.next
html
end

View File

@ -61,7 +61,7 @@ module SortHelper
# defaults to '<controller_name>_sort'.
#
def sort_init(default_key, default_order='asc', name=nil)
@sort_name = name || @params[:controller] + @params[:action] + '_sort'
@sort_name = name || params[:controller] + params[:action] + '_sort'
@sort_default = {:key => default_key, :order => default_order}
end
@ -69,21 +69,21 @@ module SortHelper
# sort_clause.
#
def sort_update()
if @params[:sort_key]
sort = {:key => @params[:sort_key], :order => @params[:sort_order]}
elsif @session[@sort_name]
sort = @session[@sort_name] # Previous sort.
if params[:sort_key]
sort = {:key => params[:sort_key], :order => params[:sort_order]}
elsif session[@sort_name]
sort = session[@sort_name] # Previous sort.
else
sort = @sort_default
end
@session[@sort_name] = sort
session[@sort_name] = sort
end
# Returns an SQL sort clause corresponding to the current sort state.
# Use this to sort the controller's table items collection.
#
def sort_clause()
@session[@sort_name][:key] + ' ' + @session[@sort_name][:order]
session[@sort_name][:key] + ' ' + session[@sort_name][:order]
end
# Returns a link which sorts by the named column.
@ -93,7 +93,7 @@ module SortHelper
# - A sort icon image is positioned to the right of the sort link.
#
def sort_link(column, caption=nil)
key, order = @session[@sort_name][:key], @session[@sort_name][:order]
key, order = session[@sort_name][:key], session[@sort_name][:order]
if key == column
if order.downcase == 'asc'
icon = 'sort_asc'

View File

@ -2,7 +2,7 @@
<% Enumeration::OPTIONS.each do |option, name| %>
<% if @params[:opt]==option %>
<% if params[:opt]==option %>
<p><%= image_tag 'dir_open' %> <b><%= l(name) %></b></p>
<ul>

View File

@ -49,7 +49,7 @@
<li class="submenu"><%= link_to l(:label_administration), { :controller => 'admin' }, :class => "picAdmin", :onmouseover => "buttonMouseover(event, 'menuAdmin');" %></li>
<% end %>
<li class="right"><%= link_to l(:label_help), { :controller => 'help', :ctrl => @params[:controller], :page => @params[:action] }, :target => "new", :class => "picHelp" %></li>
<li class="right"><%= link_to l(:label_help), { :controller => 'help', :ctrl => params[:controller], :page => params[:action] }, :target => "new", :class => "picHelp" %></li>
<% if loggedin? %>
<li class="right"><%= link_to l(:label_logout), { :controller => 'account', :action => 'logout' }, :class => "picUser" %></li>