Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f01d4ae46 | ||
|
|
e5e8318c70 | ||
|
|
d9135ce1e7 | ||
|
|
aa17905081 | ||
|
|
fbafa95791 | ||
|
|
dc26a9cd39 | ||
|
|
5f185b6c05 | ||
|
|
893a433165 | ||
|
|
552d99d664 | ||
|
|
54aeec7b5f | ||
|
|
d2b89f5f9b | ||
|
|
6b08e1b315 | ||
|
|
18ee1fef41 | ||
|
|
2a96f56956 | ||
|
|
3903eddded | ||
|
|
b862c447f1 | ||
|
|
5b47d7bfcc | ||
|
|
310a0f924a | ||
|
|
7e57db1edb | ||
|
|
71c3ad642c | ||
|
|
bc51f529e9 | ||
|
|
a573da3b98 |
@@ -17,11 +17,14 @@
|
||||
|
||||
class AccountController < ApplicationController
|
||||
layout 'base'
|
||||
helper :custom_fields
|
||||
include CustomFieldsHelper
|
||||
|
||||
# prevents login action to be filtered by check_if_login_required application scope filter
|
||||
skip_before_filter :check_if_login_required, :only => :login
|
||||
before_filter :require_login, :except => [:show, :login]
|
||||
skip_before_filter :check_if_login_required, :only => [:login, :lost_password, :register]
|
||||
before_filter :require_login, :except => [:show, :login, :lost_password, :register]
|
||||
|
||||
# Show user's account
|
||||
def show
|
||||
@user = User.find(params[:id])
|
||||
end
|
||||
@@ -29,49 +32,134 @@ class AccountController < ApplicationController
|
||||
# Login request and validation
|
||||
def login
|
||||
if request.get?
|
||||
session[:user] = nil
|
||||
# Logout user
|
||||
self.logged_in_user = nil
|
||||
else
|
||||
logged_in_user = User.try_to_login(params[:login], params[:password])
|
||||
if logged_in_user
|
||||
session[:user] = logged_in_user
|
||||
# Authenticate user
|
||||
user = User.try_to_login(params[:login], params[:password])
|
||||
if user
|
||||
self.logged_in_user = user
|
||||
redirect_back_or_default :controller => 'account', :action => 'my_page'
|
||||
else
|
||||
flash[:notice] = _('Invalid user/password')
|
||||
flash.now[:notice] = l(:notice_account_invalid_creditentials)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Log out current user and redirect to welcome page
|
||||
def logout
|
||||
session[:user] = nil
|
||||
redirect_to(:controller => '')
|
||||
end
|
||||
|
||||
def my_page
|
||||
@user = session[:user]
|
||||
@reported_issues = Issue.find(:all, :conditions => ["author_id=?", @user.id], :limit => 10, :include => [ :status, :project, :tracker ], :order => 'issues.updated_on DESC')
|
||||
@assigned_issues = Issue.find(:all, :conditions => ["assigned_to_id=?", @user.id], :limit => 10, :include => [ :status, :project, :tracker ], :order => 'issues.updated_on DESC')
|
||||
end
|
||||
|
||||
# Edit current user's account
|
||||
def my_account
|
||||
@user = User.find(session[:user].id)
|
||||
if request.post? and @user.update_attributes(@params[:user])
|
||||
flash[:notice] = 'Account was successfully updated.'
|
||||
session[:user] = @user
|
||||
# Log out current user and redirect to welcome page
|
||||
def logout
|
||||
self.logged_in_user = nil
|
||||
redirect_to :controller => ''
|
||||
end
|
||||
|
||||
# Show logged in user's page
|
||||
def my_page
|
||||
@user = self.logged_in_user
|
||||
@reported_issues = Issue.find(:all, :conditions => ["author_id=?", @user.id], :limit => 10, :include => [ :status, :project, :tracker ], :order => 'issues.updated_on DESC')
|
||||
@assigned_issues = Issue.find(:all, :conditions => ["assigned_to_id=?", @user.id], :limit => 10, :include => [ :status, :project, :tracker ], :order => 'issues.updated_on DESC')
|
||||
end
|
||||
|
||||
# Edit logged in user's account
|
||||
def my_account
|
||||
@user = self.logged_in_user
|
||||
if request.post? and @user.update_attributes(@params[:user])
|
||||
set_localization
|
||||
end
|
||||
end
|
||||
flash.now[:notice] = l(:notice_account_updated)
|
||||
self.logged_in_user.reload
|
||||
end
|
||||
end
|
||||
|
||||
# Change current user's password
|
||||
# Change logged in user's password
|
||||
def change_password
|
||||
@user = User.find(session[:user].id)
|
||||
@user = self.logged_in_user
|
||||
flash[:notice] = l(:notice_can_t_change_password) and redirect_to :action => 'my_account' and return if @user.auth_source_id
|
||||
if @user.check_password?(@params[:password])
|
||||
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
||||
flash[:notice] = 'Password was successfully updated.' if @user.save
|
||||
if @user.save
|
||||
flash[:notice] = l(:notice_account_password_updated)
|
||||
else
|
||||
render :action => 'my_account'
|
||||
return
|
||||
end
|
||||
else
|
||||
flash[:notice] = 'Wrong password'
|
||||
flash[:notice] = l(:notice_account_wrong_password)
|
||||
end
|
||||
render :action => 'my_account'
|
||||
end
|
||||
redirect_to :action => 'my_account'
|
||||
end
|
||||
|
||||
# Enable user to choose a new password
|
||||
def lost_password
|
||||
if params[:token]
|
||||
@token = Token.find_by_action_and_value("recovery", params[:token])
|
||||
redirect_to :controller => '' and return unless @token and !@token.expired?
|
||||
@user = @token.user
|
||||
if request.post?
|
||||
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
||||
if @user.save
|
||||
@token.destroy
|
||||
flash[:notice] = l(:notice_account_password_updated)
|
||||
redirect_to :action => 'login'
|
||||
return
|
||||
end
|
||||
end
|
||||
render :template => "account/password_recovery"
|
||||
return
|
||||
else
|
||||
if request.post?
|
||||
user = User.find_by_mail(params[:mail])
|
||||
# user not found in db
|
||||
flash.now[:notice] = l(:notice_account_unknown_email) and return unless user
|
||||
# user uses an external authentification
|
||||
flash.now[:notice] = l(:notice_can_t_change_password) and return if user.auth_source_id
|
||||
# create a new token for password recovery
|
||||
token = Token.new(:user => user, :action => "recovery")
|
||||
if token.save
|
||||
# send token to user via email
|
||||
Mailer.set_language_if_valid(user.language)
|
||||
Mailer.deliver_lost_password(token)
|
||||
flash[:notice] = l(:notice_account_lost_email_sent)
|
||||
redirect_to :action => 'login'
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# User self-registration
|
||||
def register
|
||||
redirect_to :controller => '' and return if $RDM_SELF_REGISTRATION == false
|
||||
if params[:token]
|
||||
token = Token.find_by_action_and_value("register", params[:token])
|
||||
redirect_to :controller => '' and return unless token and !token.expired?
|
||||
user = token.user
|
||||
redirect_to :controller => '' and return unless user.status == User::STATUS_REGISTERED
|
||||
user.status = User::STATUS_ACTIVE
|
||||
if user.save
|
||||
token.destroy
|
||||
flash[:notice] = l(:notice_account_activated)
|
||||
redirect_to :action => 'login'
|
||||
return
|
||||
end
|
||||
else
|
||||
if request.get?
|
||||
@user = User.new(:language => $RDM_DEFAULT_LANG)
|
||||
@custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user) }
|
||||
else
|
||||
@user = User.new(params[:user])
|
||||
@user.admin = false
|
||||
@user.login = params[:user][:login]
|
||||
@user.status = User::STATUS_REGISTERED
|
||||
@user.password, @user.password_confirmation = params[:password], params[:password_confirmation]
|
||||
@custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) }
|
||||
@user.custom_values = @custom_values
|
||||
token = Token.new(:user => @user, :action => "register")
|
||||
if @user.save and token.save
|
||||
Mailer.set_language_if_valid(@user.language)
|
||||
Mailer.deliver_register(token)
|
||||
flash[:notice] = l(:notice_account_register_done)
|
||||
redirect_to :controller => ''
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -44,7 +44,7 @@ class AdminController < ApplicationController
|
||||
a.mail_enabled = (params[:action_ids] || []).include? a.id.to_s
|
||||
a.save
|
||||
}
|
||||
flash[:notice] = "Mail options were successfully updated."
|
||||
flash.now[:notice] = l(:notice_successful_update)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -18,43 +18,56 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
before_filter :check_if_login_required, :set_localization
|
||||
|
||||
def logged_in_user=(user)
|
||||
@logged_in_user = user
|
||||
session[:user_id] = (user ? user.id : nil)
|
||||
end
|
||||
|
||||
def logged_in_user
|
||||
if session[:user_id]
|
||||
@logged_in_user ||= User.find(session[:user_id], :include => :memberships)
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
# check if login is globally required to access the application
|
||||
def check_if_login_required
|
||||
require_login if RDM_LOGIN_REQUIRED
|
||||
require_login if $RDM_LOGIN_REQUIRED
|
||||
end
|
||||
|
||||
def set_localization
|
||||
Localization.lang = begin
|
||||
if session[:user]
|
||||
session[:user].language
|
||||
lang = begin
|
||||
if self.logged_in_user and self.logged_in_user.language and !self.logged_in_user.language.empty? and GLoc.valid_languages.include? self.logged_in_user.language.to_sym
|
||||
self.logged_in_user.language
|
||||
elsif request.env['HTTP_ACCEPT_LANGUAGE']
|
||||
accept_lang = HTTPUtils.parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first.split('-').first
|
||||
if Localization.langs.collect{ |l| l[1] }.include? accept_lang
|
||||
if accept_lang and !accept_lang.empty? and GLoc.valid_languages.include? accept_lang.to_sym
|
||||
accept_lang
|
||||
end
|
||||
end
|
||||
rescue
|
||||
nil
|
||||
end || RDM_DEFAULT_LANG
|
||||
end || $RDM_DEFAULT_LANG
|
||||
set_language_if_valid(lang)
|
||||
end
|
||||
|
||||
def require_login
|
||||
unless session[:user]
|
||||
unless self.logged_in_user
|
||||
store_location
|
||||
redirect_to(:controller => "account", :action => "login")
|
||||
redirect_to :controller => "account", :action => "login"
|
||||
return false
|
||||
end
|
||||
true
|
||||
end
|
||||
|
||||
def require_admin
|
||||
if session[:user].nil?
|
||||
store_location
|
||||
redirect_to(:controller => "account", :action => "login")
|
||||
else
|
||||
unless session[:user].admin?
|
||||
flash[:notice] = "Acces not allowed"
|
||||
redirect_to(:controller => "projects", :action => "list")
|
||||
end
|
||||
return unless require_login
|
||||
unless self.logged_in_user.admin?
|
||||
render :nothing => true, :status => 403
|
||||
return false
|
||||
end
|
||||
true
|
||||
end
|
||||
|
||||
# authorizes the user for the requested action.
|
||||
@@ -62,19 +75,17 @@ class ApplicationController < ActionController::Base
|
||||
# check if action is allowed on public projects
|
||||
if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ @params[:controller], @params[:action] ]
|
||||
return true
|
||||
end
|
||||
# if user not logged in, redirect to login form
|
||||
unless session[:user]
|
||||
store_location
|
||||
redirect_to(:controller => "account", :action => "login")
|
||||
return false
|
||||
end
|
||||
# if logged in, check if authorized
|
||||
if session[:user].admin? or Permission.allowed_to_role( "%s/%s" % [ @params[:controller], @params[:action] ], session[:user].role_for_project(@project.id) )
|
||||
end
|
||||
# if action is not public, force login
|
||||
return unless require_login
|
||||
# admin is always authorized
|
||||
return true if self.logged_in_user.admin?
|
||||
# if not admin, check membership permission
|
||||
@user_membership ||= Member.find(:first, :conditions => ["user_id=? and project_id=?", self.logged_in_user.id, @project.id])
|
||||
if @user_membership and Permission.allowed_to_role( "%s/%s" % [ @params[:controller], @params[:action] ], @user_membership.role_id )
|
||||
return true
|
||||
end
|
||||
flash[:notice] = "Acces denied"
|
||||
redirect_to(:controller => "")
|
||||
render :nothing => true, :status => 403
|
||||
false
|
||||
end
|
||||
|
||||
|
||||
82
redmine/app/controllers/auth_sources_controller.rb
Normal file
82
redmine/app/controllers/auth_sources_controller.rb
Normal file
@@ -0,0 +1,82 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006 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 AuthSourcesController < ApplicationController
|
||||
layout 'base'
|
||||
before_filter :require_admin
|
||||
|
||||
def index
|
||||
list
|
||||
render :action => 'list'
|
||||
end
|
||||
|
||||
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
|
||||
verify :method => :post, :only => [ :destroy, :create, :update ],
|
||||
:redirect_to => { :action => :list }
|
||||
|
||||
def list
|
||||
@auth_source_pages, @auth_sources = paginate :auth_sources, :per_page => 10
|
||||
end
|
||||
|
||||
def new
|
||||
@auth_source = AuthSourceLdap.new
|
||||
end
|
||||
|
||||
def create
|
||||
@auth_source = AuthSourceLdap.new(params[:auth_source])
|
||||
if @auth_source.save
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :action => 'list'
|
||||
else
|
||||
render :action => 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@auth_source = AuthSource.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@auth_source = AuthSource.find(params[:id])
|
||||
if @auth_source.update_attributes(params[:auth_source])
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'list'
|
||||
else
|
||||
render :action => 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
def test_connection
|
||||
@auth_method = AuthSource.find(params[:id])
|
||||
begin
|
||||
@auth_method.test_connection
|
||||
rescue => text
|
||||
flash[:notice] = text
|
||||
end
|
||||
flash[:notice] ||= l(:notice_successful_connection)
|
||||
redirect_to :action => 'list'
|
||||
end
|
||||
|
||||
def destroy
|
||||
@auth_source = AuthSource.find(params[:id])
|
||||
unless @auth_source.users.find(:first)
|
||||
@auth_source.destroy
|
||||
flash[:notice] = l(:notice_successful_delete)
|
||||
end
|
||||
redirect_to :action => 'list'
|
||||
end
|
||||
end
|
||||
@@ -16,37 +16,49 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class CustomFieldsController < ApplicationController
|
||||
layout 'base'
|
||||
before_filter :require_admin
|
||||
|
||||
layout 'base'
|
||||
before_filter :require_admin
|
||||
|
||||
def index
|
||||
list
|
||||
render :action => 'list'
|
||||
end
|
||||
|
||||
def list
|
||||
@custom_field_pages, @custom_fields = paginate :custom_fields, :per_page => 10
|
||||
@custom_field_pages, @custom_fields = paginate :custom_fields, :per_page => 15
|
||||
end
|
||||
|
||||
|
||||
def new
|
||||
if request.get?
|
||||
@custom_field = CustomField.new
|
||||
else
|
||||
@custom_field = CustomField.new(params[:custom_field])
|
||||
if @custom_field.save
|
||||
flash[:notice] = 'CustomField was successfully created.'
|
||||
redirect_to :action => 'list'
|
||||
case params[:type]
|
||||
when "IssueCustomField"
|
||||
@custom_field = IssueCustomField.new(params[:custom_field])
|
||||
@custom_field.trackers = Tracker.find(params[:tracker_ids]) if params[:tracker_ids]
|
||||
when "UserCustomField"
|
||||
@custom_field = UserCustomField.new(params[:custom_field])
|
||||
when "ProjectCustomField"
|
||||
@custom_field = ProjectCustomField.new(params[:custom_field])
|
||||
else
|
||||
redirect_to :action => 'list'
|
||||
return
|
||||
end
|
||||
if request.post? and @custom_field.save
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :action => 'list'
|
||||
end
|
||||
@trackers = Tracker.find(:all)
|
||||
end
|
||||
|
||||
def edit
|
||||
@custom_field = CustomField.find(params[:id])
|
||||
if request.post? and @custom_field.update_attributes(params[:custom_field])
|
||||
if @custom_field.is_a? IssueCustomField
|
||||
@custom_field.trackers = params[:tracker_ids] ? Tracker.find(params[:tracker_ids]) : []
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@custom_field = CustomField.find(params[:id])
|
||||
if request.post? and @custom_field.update_attributes(params[:custom_field])
|
||||
flash[:notice] = 'CustomField was successfully updated.'
|
||||
redirect_to :action => 'list'
|
||||
end
|
||||
end
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'list'
|
||||
end
|
||||
@trackers = Tracker.find(:all)
|
||||
end
|
||||
|
||||
def destroy
|
||||
CustomField.find(params[:id]).destroy
|
||||
@@ -54,5 +66,5 @@ class CustomFieldsController < ApplicationController
|
||||
rescue
|
||||
flash[:notice] = "Unable to delete custom field"
|
||||
redirect_to :action => 'list'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,16 +16,17 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class DocumentsController < ApplicationController
|
||||
layout 'base'
|
||||
before_filter :find_project, :authorize
|
||||
|
||||
def show
|
||||
layout 'base'
|
||||
before_filter :find_project, :authorize
|
||||
|
||||
def show
|
||||
@attachments = @document.attachments.find(:all, :order => "created_on DESC")
|
||||
end
|
||||
|
||||
def edit
|
||||
@categories = Enumeration::get_values('DCAT')
|
||||
if request.post? and @document.update_attributes(params[:document])
|
||||
flash[:notice] = 'Document was successfully updated.'
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'show', :id => @document
|
||||
end
|
||||
end
|
||||
@@ -45,21 +46,20 @@ class DocumentsController < ApplicationController
|
||||
# Save the attachment
|
||||
if params[:attachment][:file].size > 0
|
||||
@attachment = @document.attachments.build(params[:attachment])
|
||||
@attachment.author_id = session[:user].id unless session[:user].nil?
|
||||
@attachment.author_id = self.logged_in_user.id if self.logged_in_user
|
||||
@attachment.save
|
||||
end
|
||||
render :action => 'show'
|
||||
redirect_to :action => 'show', :id => @document
|
||||
end
|
||||
|
||||
def destroy_attachment
|
||||
@document.attachments.find(params[:attachment_id]).destroy
|
||||
render :action => 'show'
|
||||
redirect_to :action => 'show', :id => @document
|
||||
end
|
||||
|
||||
private
|
||||
def find_project
|
||||
def find_project
|
||||
@document = Document.find(params[:id])
|
||||
@project = @document.project
|
||||
end
|
||||
|
||||
@project = @document.project
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,7 +38,7 @@ class EnumerationsController < ApplicationController
|
||||
def create
|
||||
@enumeration = Enumeration.new(params[:enumeration])
|
||||
if @enumeration.save
|
||||
flash[:notice] = 'Enumeration was successfully created.'
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :action => 'list', :opt => @enumeration.opt
|
||||
else
|
||||
render :action => 'new'
|
||||
@@ -52,7 +52,7 @@ class EnumerationsController < ApplicationController
|
||||
def update
|
||||
@enumeration = Enumeration.find(params[:id])
|
||||
if @enumeration.update_attributes(params[:enumeration])
|
||||
flash[:notice] = 'Enumeration was successfully updated.'
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'list', :opt => @enumeration.opt
|
||||
else
|
||||
render :action => 'edit'
|
||||
@@ -60,7 +60,8 @@ class EnumerationsController < ApplicationController
|
||||
end
|
||||
|
||||
def destroy
|
||||
Enumeration.find(params[:id]).destroy
|
||||
Enumeration.find(params[:id]).destroy
|
||||
flash[:notice] = l(:notice_successful_delete)
|
||||
redirect_to :action => 'list'
|
||||
rescue
|
||||
flash[:notice] = "Unable to delete enumeration"
|
||||
|
||||
@@ -31,7 +31,7 @@ class HelpController < ApplicationController
|
||||
end
|
||||
end
|
||||
# choose language according to available help translations
|
||||
lang = (@help_config['langs'].include? Localization.lang) ? Localization.lang : @help_config['langs'].first
|
||||
lang = (@help_config['langs'].include? current_language) ? current_language : @help_config['langs'].first
|
||||
|
||||
if template
|
||||
redirect_to "/manual/#{lang}/#{template}"
|
||||
|
||||
@@ -21,7 +21,7 @@ class IssueCategoriesController < ApplicationController
|
||||
|
||||
def edit
|
||||
if request.post? and @category.update_attributes(params[:category])
|
||||
flash[:notice] = 'Issue category was successfully updated.'
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :controller => 'projects', :action => 'settings', :id => @project
|
||||
end
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ class IssueStatusesController < ApplicationController
|
||||
def create
|
||||
@issue_status = IssueStatus.new(params[:issue_status])
|
||||
if @issue_status.save
|
||||
flash[:notice] = 'IssueStatus was successfully created.'
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :action => 'list'
|
||||
else
|
||||
render :action => 'new'
|
||||
@@ -49,7 +49,7 @@ class IssueStatusesController < ApplicationController
|
||||
def update
|
||||
@issue_status = IssueStatus.find(params[:id])
|
||||
if @issue_status.update_attributes(params[:issue_status])
|
||||
flash[:notice] = 'IssueStatus was successfully updated.'
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'list'
|
||||
else
|
||||
render :action => 'edit'
|
||||
|
||||
@@ -16,67 +16,71 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class IssuesController < ApplicationController
|
||||
layout 'base'
|
||||
before_filter :find_project, :authorize
|
||||
layout 'base'
|
||||
before_filter :find_project, :authorize
|
||||
|
||||
helper :custom_fields
|
||||
include CustomFieldsHelper
|
||||
|
||||
def show
|
||||
@status_options = @issue.status.workflows.find(:all, :conditions => ["role_id=? and tracker_id=?", session[:user].role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if session[:user]
|
||||
end
|
||||
helper :custom_fields
|
||||
include CustomFieldsHelper
|
||||
|
||||
def edit
|
||||
@trackers = Tracker.find(:all)
|
||||
@priorities = Enumeration::get_values('IPRI')
|
||||
|
||||
if request.get?
|
||||
@custom_values = @project.custom_fields_for_issues.collect { |x| @issue.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) }
|
||||
else
|
||||
# Retrieve custom fields and values
|
||||
@custom_values = @project.custom_fields_for_issues.collect { |x| CustomValue.new(:custom_field => x, :value => params["custom_fields"][x.id.to_s]) }
|
||||
def show
|
||||
@status_options = @issue.status.workflows.find(:all, :include => :new_status, :conditions => ["role_id=? and tracker_id=?", self.logged_in_user.role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if self.logged_in_user
|
||||
@custom_values = @issue.custom_values.find(:all, :include => :custom_field)
|
||||
end
|
||||
|
||||
def edit
|
||||
@priorities = Enumeration::get_values('IPRI')
|
||||
if request.get?
|
||||
@custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| @issue.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x, :customized => @issue) }
|
||||
else
|
||||
begin
|
||||
# Retrieve custom fields and values
|
||||
@custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) }
|
||||
@issue.custom_values = @custom_values
|
||||
@issue.attributes = params[:issue]
|
||||
if @issue.save
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'show', :id => @issue
|
||||
end
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
# Optimistic locking exception
|
||||
flash[:notice] = l(:notice_locking_conflict)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@issue.custom_values = @custom_values
|
||||
if @issue.update_attributes(params[:issue])
|
||||
flash[:notice] = 'Issue was successfully updated.'
|
||||
redirect_to :action => 'show', :id => @issue
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def change_status
|
||||
@history = @issue.histories.build(params[:history])
|
||||
@status_options = @issue.status.workflows.find(:all, :conditions => ["role_id=? and tracker_id=?", session[:user].role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if session[:user]
|
||||
|
||||
if params[:confirm]
|
||||
unless session[:user].nil?
|
||||
@history.author = session[:user]
|
||||
end
|
||||
if @history.save
|
||||
@issue.status = @history.status
|
||||
@issue.fixed_version_id = (params[:issue][:fixed_version_id])
|
||||
@issue.assigned_to_id = (params[:issue][:assigned_to_id])
|
||||
if @issue.save
|
||||
flash[:notice] = 'Issue was successfully updated.'
|
||||
Mailer.deliver_issue_change_status(@issue) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled?
|
||||
redirect_to :action => 'show', :id => @issue
|
||||
end
|
||||
end
|
||||
end
|
||||
def change_status
|
||||
@history = @issue.histories.build(params[:history])
|
||||
@status_options = @issue.status.workflows.find(:all, :conditions => ["role_id=? and tracker_id=?", self.logged_in_user.role_for_project(@project.id), @issue.tracker.id]).collect{ |w| w.new_status } if self.logged_in_user
|
||||
if params[:confirm]
|
||||
begin
|
||||
@history.author_id = self.logged_in_user.id if self.logged_in_user
|
||||
@issue.status = @history.status
|
||||
@issue.fixed_version_id = (params[:issue][:fixed_version_id])
|
||||
@issue.assigned_to_id = (params[:issue][:assigned_to_id])
|
||||
@issue.lock_version = (params[:issue][:lock_version])
|
||||
if @issue.save
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
Mailer.deliver_issue_change_status(@issue) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled?
|
||||
redirect_to :action => 'show', :id => @issue
|
||||
end
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
# Optimistic locking exception
|
||||
flash[:notice] = l(:notice_locking_conflict)
|
||||
end
|
||||
end
|
||||
@assignable_to = @project.members.find(:all, :include => :user).collect{ |m| m.user }
|
||||
|
||||
end
|
||||
|
||||
def destroy
|
||||
@issue.destroy
|
||||
redirect_to :controller => 'projects', :action => 'list_issues', :id => @project
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def destroy
|
||||
@issue.destroy
|
||||
redirect_to :controller => 'projects', :action => 'list_issues', :id => @project
|
||||
end
|
||||
|
||||
def add_attachment
|
||||
# Save the attachment
|
||||
if params[:attachment][:file].size > 0
|
||||
@attachment = @issue.attachments.build(params[:attachment])
|
||||
@attachment.author_id = session[:user].id unless session[:user].nil?
|
||||
@attachment.author_id = self.logged_in_user.id if self.logged_in_user
|
||||
@attachment.save
|
||||
end
|
||||
redirect_to :action => 'show', :id => @issue
|
||||
@@ -86,17 +90,16 @@ class IssuesController < ApplicationController
|
||||
@issue.attachments.find(params[:attachment_id]).destroy
|
||||
redirect_to :action => 'show', :id => @issue
|
||||
end
|
||||
|
||||
# Send the file in stream mode
|
||||
def download
|
||||
@attachment = @issue.attachments.find(params[:attachment_id])
|
||||
send_file @attachment.diskfile, :filename => @attachment.filename
|
||||
end
|
||||
|
||||
|
||||
# Send the file in stream mode
|
||||
def download
|
||||
@attachment = @issue.attachments.find(params[:attachment_id])
|
||||
send_file @attachment.diskfile, :filename => @attachment.filename
|
||||
end
|
||||
|
||||
private
|
||||
def find_project
|
||||
@issue = Issue.find(params[:id])
|
||||
@project = @issue.project
|
||||
end
|
||||
|
||||
def find_project
|
||||
@issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category])
|
||||
@project = @issue.project
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,14 +21,14 @@ class MembersController < ApplicationController
|
||||
|
||||
def edit
|
||||
if request.post? and @member.update_attributes(params[:member])
|
||||
flash[:notice] = 'Member was successfully updated.'
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :controller => 'projects', :action => 'settings', :id => @project
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@member.destroy
|
||||
flash[:notice] = 'Member was successfully removed.'
|
||||
flash[:notice] = l(:notice_successful_delete)
|
||||
redirect_to :controller => 'projects', :action => 'settings', :id => @project
|
||||
end
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class NewsController < ApplicationController
|
||||
|
||||
def edit
|
||||
if request.post? and @news.update_attributes(params[:news])
|
||||
flash[:notice] = 'News was successfully updated.'
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'show', :id => @news
|
||||
end
|
||||
end
|
||||
|
||||
@@ -48,40 +48,51 @@ class ProjectsController < ApplicationController
|
||||
|
||||
# Add a new project
|
||||
def add
|
||||
@custom_fields = CustomField::find_all
|
||||
@root_projects = Project::find(:all, :conditions => "parent_id is null")
|
||||
@custom_fields = IssueCustomField.find(:all)
|
||||
@root_projects = Project.find(:all, :conditions => "parent_id is null")
|
||||
@project = Project.new(params[:project])
|
||||
if request.post?
|
||||
@project.custom_fields = CustomField.find(@params[:custom_field_ids]) if @params[:custom_field_ids]
|
||||
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]
|
||||
@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 @project.save
|
||||
flash[:notice] = 'Project was successfully created.'
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :controller => 'admin', :action => 'projects'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Show @project
|
||||
# Show @project
|
||||
def show
|
||||
@custom_values = @project.custom_values.find(:all, :include => :custom_field)
|
||||
@members = @project.members.find(:all, :include => [:user, :role])
|
||||
@subprojects = @project.children if @project.children_count > 0
|
||||
@news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
|
||||
@news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
|
||||
@trackers = Tracker.find(:all)
|
||||
end
|
||||
|
||||
def settings
|
||||
@root_projects = Project::find(:all, :conditions => ["parent_id is null and id <> ?", @project.id])
|
||||
@custom_fields = CustomField::find_all
|
||||
@custom_fields = IssueCustomField::find_all
|
||||
@issue_category ||= IssueCategory.new
|
||||
@member ||= @project.members.new
|
||||
@roles = Role.find_all
|
||||
@users = User.find_all - @project.members.find(:all, :include => :user).collect{|m| m.user }
|
||||
@custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) }
|
||||
end
|
||||
|
||||
# Edit @project
|
||||
def edit
|
||||
if request.post?
|
||||
@project.custom_fields = CustomField.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
|
||||
end
|
||||
if @project.update_attributes(params[:project])
|
||||
flash[:notice] = 'Project was successfully updated.'
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'settings', :id => @project
|
||||
else
|
||||
settings
|
||||
@@ -89,102 +100,104 @@ class ProjectsController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Delete @project
|
||||
def destroy
|
||||
|
||||
# Delete @project
|
||||
def destroy
|
||||
if request.post? and params[:confirm]
|
||||
@project.destroy
|
||||
redirect_to :controller => 'admin', :action => 'projects'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Add a new issue category to @project
|
||||
def add_issue_category
|
||||
if request.post?
|
||||
@issue_category = @project.issue_categories.build(params[:issue_category])
|
||||
if @issue_category.save
|
||||
redirect_to :action => 'settings', :id => @project
|
||||
else
|
||||
settings
|
||||
render :action => 'settings'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Add a new version to @project
|
||||
def add_version
|
||||
@version = @project.versions.build(params[:version])
|
||||
if request.post? and @version.save
|
||||
redirect_to :action => 'settings', :id => @project
|
||||
end
|
||||
end
|
||||
|
||||
# Add a new member to @project
|
||||
def add_member
|
||||
@member = @project.members.build(params[:member])
|
||||
if request.post?
|
||||
if @member.save
|
||||
flash[:notice] = 'Member was successfully added.'
|
||||
redirect_to :action => 'settings', :id => @project
|
||||
else
|
||||
# Add a new issue category to @project
|
||||
def add_issue_category
|
||||
if request.post?
|
||||
@issue_category = @project.issue_categories.build(params[:issue_category])
|
||||
if @issue_category.save
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :action => 'settings', :id => @project
|
||||
else
|
||||
settings
|
||||
render :action => 'settings'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Show members list of @project
|
||||
def list_members
|
||||
@members = @project.members
|
||||
end
|
||||
|
||||
# Add a new document to @project
|
||||
def add_document
|
||||
@categories = Enumeration::get_values('DCAT')
|
||||
@document = @project.documents.build(params[:document])
|
||||
if request.post?
|
||||
# Save the attachment
|
||||
if params[:attachment][:file].size > 0
|
||||
@attachment = @document.attachments.build(params[:attachment])
|
||||
@attachment.author_id = session[:user].id unless session[:user].nil?
|
||||
end
|
||||
if @document.save
|
||||
redirect_to :action => 'list_documents', :id => @project
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Show documents list of @project
|
||||
def list_documents
|
||||
@documents = @project.documents
|
||||
end
|
||||
|
||||
# Add a new issue to @project
|
||||
def add_issue
|
||||
@trackers = Tracker.find(:all)
|
||||
@priorities = Enumeration::get_values('IPRI')
|
||||
if request.get?
|
||||
@issue = @project.issues.build
|
||||
@custom_values = @project.custom_fields_for_issues.collect { |x| CustomValue.new(:custom_field => x) }
|
||||
else
|
||||
# Create the issue and set the author
|
||||
@issue = @project.issues.build(params[:issue])
|
||||
@issue.author = session[:user] unless session[:user].nil?
|
||||
# Create the document if a file was sent
|
||||
if params[:attachment][:file].size > 0
|
||||
@attachment = @issue.attachments.build(params[:attachment])
|
||||
@attachment.author_id = session[:user].id unless session[:user].nil?
|
||||
end
|
||||
@custom_values = @project.custom_fields_for_issues.collect { |x| CustomValue.new(:custom_field => x, :value => params["custom_fields"][x.id.to_s]) }
|
||||
@issue.custom_values = @custom_values
|
||||
if @issue.save
|
||||
flash[:notice] = "Issue was successfully added."
|
||||
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
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Add a new version to @project
|
||||
def add_version
|
||||
@version = @project.versions.build(params[:version])
|
||||
if request.post? and @version.save
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :action => 'settings', :id => @project
|
||||
end
|
||||
end
|
||||
|
||||
# Add a new member to @project
|
||||
def add_member
|
||||
@member = @project.members.build(params[:member])
|
||||
if request.post?
|
||||
if @member.save
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :action => 'settings', :id => @project
|
||||
else
|
||||
settings
|
||||
render :action => 'settings'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Show members list of @project
|
||||
def list_members
|
||||
@members = @project.members
|
||||
end
|
||||
|
||||
# Add a new document to @project
|
||||
def add_document
|
||||
@categories = Enumeration::get_values('DCAT')
|
||||
@document = @project.documents.build(params[:document])
|
||||
if request.post?
|
||||
# Save the attachment
|
||||
if params[:attachment][:file].size > 0
|
||||
@attachment = @document.attachments.build(params[:attachment])
|
||||
@attachment.author_id = self.logged_in_user.id if self.logged_in_user
|
||||
end
|
||||
if @document.save
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :action => 'list_documents', :id => @project
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Show documents list of @project
|
||||
def list_documents
|
||||
@documents = @project.documents
|
||||
end
|
||||
|
||||
# Add a new issue to @project
|
||||
def add_issue
|
||||
@tracker = Tracker.find(params[:tracker_id])
|
||||
@priorities = Enumeration::get_values('IPRI')
|
||||
@issue = Issue.new(:project => @project, :tracker => @tracker)
|
||||
if request.get?
|
||||
@custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) }
|
||||
else
|
||||
@issue.attributes = params[:issue]
|
||||
@issue.author_id = self.logged_in_user.id if self.logged_in_user
|
||||
# Create the document if a file was sent
|
||||
if params[:attachment][:file].size > 0
|
||||
@attachment = @issue.attachments.build(params[:attachment])
|
||||
@attachment.author_id = self.logged_in_user.id if self.logged_in_user
|
||||
end
|
||||
@custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) }
|
||||
@issue.custom_values = @custom_values
|
||||
if @issue.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?
|
||||
redirect_to :action => 'list_issues', :id => @project
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Show filtered/sorted issues list of @project
|
||||
def list_issues
|
||||
sort_init 'issues.id', 'desc'
|
||||
@@ -195,11 +208,11 @@ class ProjectsController < ApplicationController
|
||||
|
||||
@issue_count = Issue.count(:include => [:status, :project], :conditions => search_filter_clause)
|
||||
@issue_pages = Paginator.new self, @issue_count, 15, @params['page']
|
||||
@issues = Issue.find :all, :order => sort_clause,
|
||||
@issues = Issue.find :all, :order => sort_clause,
|
||||
:include => [ :author, :status, :tracker, :project ],
|
||||
:conditions => search_filter_clause,
|
||||
:limit => @issue_pages.items_per_page,
|
||||
:offset => @issue_pages.current.offset
|
||||
:offset => @issue_pages.current.offset
|
||||
end
|
||||
|
||||
# Export filtered/sorted issues list to CSV
|
||||
@@ -217,7 +230,7 @@ class ProjectsController < ApplicationController
|
||||
CSV::Writer.generate(export, ',') do |csv|
|
||||
csv << %w(Id Status Tracker Subject Author Created Updated)
|
||||
@issues.each do |issue|
|
||||
csv << [issue.id, issue.status.name, issue.tracker.name, issue.subject, issue.author.display_name, _('(time)', issue.created_on), _('(time)', issue.updated_on)]
|
||||
csv << [issue.id, issue.status.name, issue.tracker.name, issue.subject, issue.author.display_name, l_datetime(issue.created_on), l_datetime(issue.updated_on)]
|
||||
end
|
||||
end
|
||||
export.rewind
|
||||
@@ -225,30 +238,33 @@ class ProjectsController < ApplicationController
|
||||
:type => 'text/csv; charset=utf-8; header=present',
|
||||
:filename => 'export.csv')
|
||||
end
|
||||
|
||||
# Add a news to @project
|
||||
def add_news
|
||||
@news = @project.news.build(params[:news])
|
||||
if request.post?
|
||||
@news.author = session[:user] unless session[:user].nil?
|
||||
if @news.save
|
||||
redirect_to :action => 'list_news', :id => @project
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Show news list of @project
|
||||
# Add a news to @project
|
||||
def add_news
|
||||
@news = News.new(:project => @project)
|
||||
if request.post?
|
||||
@news.attributes = params[:news]
|
||||
@news.author_id = self.logged_in_user.id if self.logged_in_user
|
||||
if @news.save
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :action => 'list_news', :id => @project
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Show news list of @project
|
||||
def list_news
|
||||
@news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "news.created_on DESC"
|
||||
end
|
||||
|
||||
|
||||
def add_file
|
||||
if request.post?
|
||||
# Save the attachment
|
||||
if params[:attachment][:file].size > 0
|
||||
@attachment = @project.versions.find(params[:version_id]).attachments.build(params[:attachment])
|
||||
@attachment.author_id = session[:user].id unless session[:user].nil?
|
||||
@attachment.author_id = self.logged_in_user.id if self.logged_in_user
|
||||
if @attachment.save
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :controller => 'projects', :action => 'list_files', :id => @project
|
||||
end
|
||||
end
|
||||
@@ -260,23 +276,30 @@ class ProjectsController < ApplicationController
|
||||
@versions = @project.versions
|
||||
end
|
||||
|
||||
# Show changelog of @project
|
||||
# Show changelog for @project
|
||||
def changelog
|
||||
@trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true])
|
||||
if request.get?
|
||||
@selected_tracker_ids = @trackers.collect {|t| t.id.to_s }
|
||||
else
|
||||
@selected_tracker_ids = params[:tracker_ids].collect { |id| id.to_i.to_s } if params[:tracker_ids] and params[:tracker_ids].is_a? Array
|
||||
end
|
||||
@selected_tracker_ids ||= []
|
||||
@fixed_issues = @project.issues.find(:all,
|
||||
:include => [ :fixed_version, :status, :tracker ],
|
||||
:conditions => [ "issue_statuses.is_closed=? and trackers.is_in_chlog=? and issues.fixed_version_id is not null", true, true]
|
||||
)
|
||||
:include => [ :fixed_version, :status, :tracker ],
|
||||
:conditions => [ "issue_statuses.is_closed=? and issues.tracker_id in (#{@selected_tracker_ids.join(',')}) and issues.fixed_version_id is not null", true],
|
||||
:order => "versions.effective_date DESC, issues.id DESC"
|
||||
) unless @selected_tracker_ids.empty?
|
||||
@fixed_issues ||= []
|
||||
end
|
||||
|
||||
private
|
||||
# Find project of id params[:id]
|
||||
# if not found, redirect to project list
|
||||
# used as a before_filter
|
||||
def find_project
|
||||
@project = Project.find(params[:id])
|
||||
rescue
|
||||
flash[:notice] = 'Project not found.'
|
||||
redirect_to :action => 'list'
|
||||
end
|
||||
|
||||
# Find project of id params[:id]
|
||||
# if not found, redirect to project list
|
||||
# Used as a before_filter
|
||||
def find_project
|
||||
@project = Project.find(params[:id])
|
||||
rescue
|
||||
redirect_to :action => 'list'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,11 +33,11 @@ class RolesController < ApplicationController
|
||||
if request.post?
|
||||
@role.permissions = Permission.find(@params[:permission_ids]) if @params[:permission_ids]
|
||||
if @role.save
|
||||
flash[:notice] = 'Role was successfully created.'
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :action => 'list'
|
||||
end
|
||||
end
|
||||
@permissions = Permission.find(:all, :order => 'sort ASC')
|
||||
@permissions = Permission.find(:all, :conditions => ["is_public=?", false], :order => 'sort ASC')
|
||||
end
|
||||
|
||||
def edit
|
||||
@@ -45,10 +45,10 @@ class RolesController < ApplicationController
|
||||
if request.post? and @role.update_attributes(params[:role])
|
||||
@role.permissions = Permission.find(@params[:permission_ids] || [])
|
||||
Permission.allowed_to_role_expired
|
||||
flash[:notice] = 'Role was successfully updated.'
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'list'
|
||||
end
|
||||
@permissions = Permission.find(:all, :order => 'sort ASC')
|
||||
@permissions = Permission.find(:all, :conditions => ["is_public=?", false], :order => 'sort ASC')
|
||||
end
|
||||
|
||||
def destroy
|
||||
@@ -61,8 +61,7 @@ class RolesController < ApplicationController
|
||||
redirect_to :action => 'list'
|
||||
end
|
||||
|
||||
def workflow
|
||||
|
||||
def workflow
|
||||
@role = Role.find_by_id(params[:role_id])
|
||||
@tracker = Tracker.find_by_id(params[:tracker_id])
|
||||
|
||||
@@ -74,7 +73,7 @@ class RolesController < ApplicationController
|
||||
}
|
||||
}
|
||||
if @role.save
|
||||
flash[:notice] = 'Workflow was successfully updated.'
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
end
|
||||
end
|
||||
@roles = Role.find_all
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class TrackersController < ApplicationController
|
||||
layout 'base'
|
||||
before_filter :require_admin
|
||||
layout 'base'
|
||||
before_filter :require_admin
|
||||
|
||||
def index
|
||||
list
|
||||
@@ -34,7 +34,7 @@ class TrackersController < ApplicationController
|
||||
def new
|
||||
@tracker = Tracker.new(params[:tracker])
|
||||
if request.post? and @tracker.save
|
||||
flash[:notice] = 'Tracker was successfully created.'
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :action => 'list'
|
||||
end
|
||||
end
|
||||
@@ -42,7 +42,7 @@ class TrackersController < ApplicationController
|
||||
def edit
|
||||
@tracker = Tracker.find(params[:id])
|
||||
if request.post? and @tracker.update_attributes(params[:tracker])
|
||||
flash[:notice] = 'Tracker was successfully updated.'
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'list'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,6 +21,8 @@ class UsersController < ApplicationController
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
helper :custom_fields
|
||||
include CustomFieldsHelper
|
||||
|
||||
def index
|
||||
list
|
||||
@@ -41,14 +43,17 @@ class UsersController < ApplicationController
|
||||
|
||||
def add
|
||||
if request.get?
|
||||
@user = User.new
|
||||
@user = User.new(:language => $RDM_DEFAULT_LANG)
|
||||
@custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user) }
|
||||
else
|
||||
@user = User.new(params[:user])
|
||||
@user.admin = params[:user][:admin] || false
|
||||
@user.login = params[:user][:login]
|
||||
@user.password, @user.password_confirmation = params[:password], params[:password_confirmation]
|
||||
@custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) }
|
||||
@user.custom_values = @custom_values
|
||||
if @user.save
|
||||
flash[:notice] = 'User was successfully created.'
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to :action => 'list'
|
||||
end
|
||||
end
|
||||
@@ -56,12 +61,18 @@ class UsersController < ApplicationController
|
||||
|
||||
def edit
|
||||
@user = User.find(params[:id])
|
||||
if request.post?
|
||||
if request.get?
|
||||
@custom_values = UserCustomField.find(:all).collect { |x| @user.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) }
|
||||
else
|
||||
@user.admin = params[:user][:admin] if params[:user][:admin]
|
||||
@user.login = params[:user][:login] if params[:user][:login]
|
||||
@user.password, @user.password_confirmation = params[:password], params[:password_confirmation] unless params[:password].nil? or params[:password].empty?
|
||||
if params[:custom_fields]
|
||||
@custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) }
|
||||
@user.custom_values = @custom_values
|
||||
end
|
||||
if @user.update_attributes(params[:user])
|
||||
flash[:notice] = 'User was successfully updated.'
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :action => 'list'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,41 +16,42 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class VersionsController < ApplicationController
|
||||
layout 'base'
|
||||
before_filter :find_project, :authorize
|
||||
|
||||
def edit
|
||||
if request.post? and @version.update_attributes(params[:version])
|
||||
flash[:notice] = 'Version was successfully updated.'
|
||||
layout 'base'
|
||||
before_filter :find_project, :authorize
|
||||
|
||||
def edit
|
||||
if request.post? and @version.update_attributes(params[:version])
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to :controller => 'projects', :action => 'settings', :id => @project
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@version.destroy
|
||||
redirect_to :controller => 'projects', :action => 'settings', :id => @project
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@version.destroy
|
||||
redirect_to :controller => 'projects', :action => 'settings', :id => @project
|
||||
rescue
|
||||
flash[:notice] = "Unable to delete version"
|
||||
redirect_to :controller => 'projects', :action => 'settings', :id => @project
|
||||
end
|
||||
|
||||
redirect_to :controller => 'projects', :action => 'settings', :id => @project
|
||||
end
|
||||
|
||||
def download
|
||||
@attachment = @version.attachments.find(params[:attachment_id])
|
||||
@attachment.increment_download
|
||||
send_file @attachment.diskfile, :filename => @attachment.filename
|
||||
rescue
|
||||
flash[:notice]="Requested file doesn't exist or has been deleted."
|
||||
flash[:notice] = l(:notice_file_not_found)
|
||||
redirect_to :controller => 'projects', :action => 'list_files', :id => @project
|
||||
end
|
||||
|
||||
def destroy_file
|
||||
@version.attachments.find(params[:attachment_id]).destroy
|
||||
flash[:notice] = l(:notice_successful_delete)
|
||||
redirect_to :controller => 'projects', :action => 'list_files', :id => @project
|
||||
end
|
||||
|
||||
private
|
||||
def find_project
|
||||
def find_project
|
||||
@version = Version.find(params[:id])
|
||||
@project = @version.project
|
||||
end
|
||||
@project = @version.project
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,11 +16,10 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class WelcomeController < ApplicationController
|
||||
layout 'base'
|
||||
|
||||
def index
|
||||
layout 'base'
|
||||
|
||||
def index
|
||||
@news = News.latest
|
||||
@projects = Project.latest
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,49 +17,140 @@
|
||||
|
||||
module ApplicationHelper
|
||||
|
||||
def loggedin?
|
||||
session[:user]
|
||||
end
|
||||
# Return current logged in user or nil
|
||||
def loggedin?
|
||||
@logged_in_user
|
||||
end
|
||||
|
||||
# Return true if user is logged in and is admin, otherwise false
|
||||
def admin_loggedin?
|
||||
@logged_in_user and @logged_in_user.admin?
|
||||
end
|
||||
|
||||
def admin_loggedin?
|
||||
session[:user] && session[:user].admin
|
||||
end
|
||||
|
||||
def authorize_for(controller, action)
|
||||
# Return true if user is authorized for controller/action, otherwise false
|
||||
def authorize_for(controller, action)
|
||||
# check if action is allowed on public projects
|
||||
if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ controller, action ]
|
||||
return true
|
||||
end
|
||||
end
|
||||
# check if user is authorized
|
||||
if session[:user] and (session[:user].admin? or Permission.allowed_to_role( "%s/%s" % [ controller, action ], session[:user].role_for_project(@project.id) ) )
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference)
|
||||
link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller], options[:action])
|
||||
end
|
||||
|
||||
# Display a link to user's account page
|
||||
def link_to_user(user)
|
||||
link_to user.display_name, :controller => 'account', :action => 'show', :id => user
|
||||
end
|
||||
|
||||
if @logged_in_user and (@logged_in_user.admin? or Permission.allowed_to_role( "%s/%s" % [ controller, action ], @logged_in_user.role_for_project(@project.id) ) )
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
# Display a link if user is authorized
|
||||
def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference)
|
||||
link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller], options[:action])
|
||||
end
|
||||
|
||||
# Display a link to user's account page
|
||||
def link_to_user(user)
|
||||
link_to user.display_name, :controller => 'account', :action => 'show', :id => user
|
||||
end
|
||||
|
||||
def format_date(date)
|
||||
_('(date)', date) if date
|
||||
l_date(date) if date
|
||||
end
|
||||
|
||||
def format_time(time)
|
||||
_('(time)', time) if time
|
||||
l_datetime(time) if time
|
||||
end
|
||||
|
||||
def pagination_links_full(paginator, options={}, html_options={})
|
||||
html =''
|
||||
html << link_to(('« ' + _('Previous') ), { :page => paginator.current.previous }) + ' ' if paginator.current.previous
|
||||
html << link_to(('« ' + l(:label_previous) ), { :page => paginator.current.previous }) + ' ' if paginator.current.previous
|
||||
html << (pagination_links(paginator, options, html_options) || '')
|
||||
html << ' ' + link_to((_('Next') + ' »'), { :page => paginator.current.next }) if paginator.current.next
|
||||
html << ' ' + link_to((l(:label_next) + ' »'), { :page => paginator.current.next }) if paginator.current.next
|
||||
html
|
||||
end
|
||||
|
||||
|
||||
def error_messages_for(object_name, options = {})
|
||||
options = options.symbolize_keys
|
||||
object = instance_variable_get("@#{object_name}")
|
||||
if object && !object.errors.empty?
|
||||
# build full_messages here with controller current language
|
||||
full_messages = []
|
||||
object.errors.each do |attr, msg|
|
||||
next if msg.nil?
|
||||
if attr == "base"
|
||||
full_messages << l(msg)
|
||||
else
|
||||
full_messages << "« " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " » " + l(msg) unless attr == "custom_values"
|
||||
end
|
||||
end
|
||||
# retrieve custom values error messages
|
||||
if object.errors[:custom_values]
|
||||
object.custom_values.each do |v|
|
||||
v.errors.each do |attr, msg|
|
||||
next if msg.nil?
|
||||
full_messages << "« " + v.custom_field.name + " » " + l(msg)
|
||||
end
|
||||
end
|
||||
end
|
||||
content_tag("div",
|
||||
content_tag(
|
||||
options[:header_tag] || "h2", lwr(:gui_validation_error, full_messages.length) + " :"
|
||||
) +
|
||||
content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }),
|
||||
"id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation"
|
||||
)
|
||||
else
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
def lang_options_for_select
|
||||
(GLoc.valid_languages.sort {|x,y| x.to_s <=> y.to_s }).collect {|lang| [ l_lang_name(lang.to_s, lang), lang.to_s]}
|
||||
end
|
||||
|
||||
def label_tag_for(name, option_tags = nil, options = {})
|
||||
label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")
|
||||
content_tag("label", label_text)
|
||||
end
|
||||
|
||||
def labelled_tabular_form_for(name, object, options, &proc)
|
||||
options[:html] ||= {}
|
||||
options[:html].store :class, "tabular"
|
||||
form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc)
|
||||
end
|
||||
|
||||
def check_all_links(form_name)
|
||||
link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") +
|
||||
" | " +
|
||||
link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)")
|
||||
end
|
||||
end
|
||||
|
||||
class TabularFormBuilder < ActionView::Helpers::FormBuilder
|
||||
include GLoc
|
||||
|
||||
def initialize(object_name, object, template, options, proc)
|
||||
set_language_if_valid options.delete(:lang)
|
||||
@object_name, @object, @template, @options, @proc = object_name, object, template, options, proc
|
||||
end
|
||||
|
||||
(field_helpers - %w(radio_button) + %w(date_select)).each do |selector|
|
||||
src = <<-END_SRC
|
||||
def #{selector}(field, options = {})
|
||||
label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")
|
||||
label = @template.content_tag("label", label_text,
|
||||
:class => (@object.errors[field] ? "error" : nil),
|
||||
:for => (@object_name.to_s + "_" + field.to_s))
|
||||
label + super
|
||||
end
|
||||
END_SRC
|
||||
class_eval src, __FILE__, __LINE__
|
||||
end
|
||||
|
||||
def select(field, choices, options = {})
|
||||
label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "")
|
||||
label = @template.content_tag("label", label_text,
|
||||
:class => (@object.errors[field] ? "error" : nil),
|
||||
:for => (@object_name.to_s + "_" + field.to_s))
|
||||
label + super
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
19
redmine/app/helpers/auth_sources_helper.rb
Normal file
19
redmine/app/helpers/auth_sources_helper.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006 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.
|
||||
|
||||
module AuthSourcesHelper
|
||||
end
|
||||
@@ -16,21 +16,50 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
module CustomFieldsHelper
|
||||
def custom_field_tag(custom_value)
|
||||
|
||||
custom_field = custom_value.custom_field
|
||||
|
||||
field_name = "custom_fields[#{custom_field.id}]"
|
||||
|
||||
case custom_field.typ
|
||||
when 0 .. 2
|
||||
text_field_tag field_name, custom_value.value
|
||||
when 3
|
||||
check_box field_name
|
||||
when 4
|
||||
select_tag field_name,
|
||||
options_for_select(custom_field.possible_values.split('|'),
|
||||
custom_value.value)
|
||||
end
|
||||
end
|
||||
|
||||
# Return custom field html tag corresponding to its format
|
||||
def custom_field_tag(custom_value)
|
||||
custom_field = custom_value.custom_field
|
||||
field_name = "custom_fields[#{custom_field.id}]"
|
||||
field_id = "custom_fields_#{custom_field.id}"
|
||||
|
||||
case custom_field.field_format
|
||||
when "string", "int", "date"
|
||||
text_field 'custom_value', 'value', :name => field_name, :id => field_id
|
||||
when "text"
|
||||
text_area 'custom_value', 'value', :name => field_name, :id => field_id, :cols => 60, :rows => 3
|
||||
when "bool"
|
||||
check_box 'custom_value', 'value', :name => field_name, :id => field_id
|
||||
when "list"
|
||||
select 'custom_value', 'value', custom_field.possible_values.split('|'), { :include_blank => true }, :name => field_name, :id => field_id
|
||||
end
|
||||
end
|
||||
|
||||
# Return custom field label tag
|
||||
def custom_field_label_tag(custom_value)
|
||||
content_tag "label", custom_value.custom_field.name +
|
||||
(custom_value.custom_field.is_required? ? " <span class=\"required\">*</span>" : ""),
|
||||
:for => "custom_fields_#{custom_value.custom_field.id}",
|
||||
:class => (custom_value.errors.empty? ? nil : "error" )
|
||||
end
|
||||
|
||||
# Return custom field tag with its label tag
|
||||
def custom_field_tag_with_label(custom_value)
|
||||
custom_field_label_tag(custom_value) + custom_field_tag(custom_value)
|
||||
end
|
||||
|
||||
# Return a string used to display a custom value
|
||||
def show_value(custom_value)
|
||||
case custom_value.custom_field.field_format
|
||||
when "bool"
|
||||
l_YesNo(custom_value.value == "1")
|
||||
else
|
||||
custom_value.value
|
||||
end
|
||||
end
|
||||
|
||||
# Return an array of custom field formats which can be used in select_tag
|
||||
def custom_field_formats_for_select
|
||||
CustomField::FIELD_FORMATS.keys.collect { |k| [ l(CustomField::FIELD_FORMATS[k]), k ] }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,10 +29,12 @@ module SearchFilterHelper
|
||||
end
|
||||
|
||||
def search_filter_update
|
||||
session[:search_filter] ||= {}
|
||||
@search_filter.each_key {|field| session[:search_filter][field] = params[field] }
|
||||
end
|
||||
|
||||
def search_filter_clause
|
||||
session[:search_filter] ||= {}
|
||||
clause = ["1=1"]
|
||||
@search_filter.each { |k, v|
|
||||
filter_value = session[:search_filter][k] || v[:options][0][1]
|
||||
@@ -45,7 +47,9 @@ module SearchFilterHelper
|
||||
end
|
||||
|
||||
def search_filter_tag(criteria, options = {})
|
||||
session[:search_filter] ||= {}
|
||||
options[:name] = criteria
|
||||
options[:class] += " active-filter" if session[:search_filter][criteria] and session[:search_filter][criteria] != @search_filter[criteria][:options][0][1]
|
||||
content_tag("select",
|
||||
options_for_select(@search_filter[criteria][:options], session[:search_filter][criteria]),
|
||||
options
|
||||
@@ -54,36 +58,43 @@ module SearchFilterHelper
|
||||
|
||||
def search_filter_init_list_issues
|
||||
search_filter_criteria('status_id') {
|
||||
[ [_('[Open]'), "O", ["issue_statuses.is_closed=?", false]],
|
||||
[_('[All]'), "A", nil]
|
||||
[ [('['+l(:label_open_issues_plural)+']'), "O", ["issue_statuses.is_closed=?", false]],
|
||||
[('['+l(:label_closed_issues_plural)+']'), "C", ["issue_statuses.is_closed=?", true]],
|
||||
[('['+l(:label_all)+']'), "A", nil]
|
||||
] + IssueStatus.find(:all).collect {|s| [s.name, s.id, ["issues.status_id=?", s.id]] }
|
||||
}
|
||||
|
||||
search_filter_criteria('tracker_id') {
|
||||
[ [_('[All]'), "A", nil]
|
||||
[ [('['+l(:label_all)+']'), "A", nil]
|
||||
] + Tracker.find(:all).collect {|s| [s.name, s.id, ["issues.tracker_id=?", s.id]] }
|
||||
}
|
||||
|
||||
search_filter_criteria('priority_id') {
|
||||
[ [_('[All]'), "A", nil]
|
||||
[ [('['+l(:label_all)+']'), "A", nil]
|
||||
] + Enumeration.find(:all, :conditions => ['opt=?','IPRI']).collect {|s| [s.name, s.id, ["issues.priority_id=?", s.id]] }
|
||||
}
|
||||
|
||||
search_filter_criteria('category_id') {
|
||||
[ [_('[All]'), "A", nil],
|
||||
[_('[None]'), "N", ["issues.category_id is null"]]
|
||||
[ [('['+l(:label_all)+']'), "A", nil],
|
||||
[('['+l(:label_none)+']'), "N", ["issues.category_id is null"]]
|
||||
] + @project.issue_categories.find(:all).collect {|s| [s.name, s.id, ["issues.category_id=?", s.id]] }
|
||||
}
|
||||
|
||||
search_filter_criteria('assigned_to_id') {
|
||||
[ [_('[All]'), "A", nil],
|
||||
[_('[None]'), "N", ["issues.assigned_to_id is null"]]
|
||||
] + @project.users.collect {|s| [s.display_name, s.id, ["issues.assigned_to_id=?", s.id]] }
|
||||
search_filter_criteria('fixed_version_id') {
|
||||
[ [('['+l(:label_all)+']'), "A", nil],
|
||||
[('['+l(:label_none)+']'), "N", ["issues.fixed_version_id is null"]]
|
||||
] + @project.versions.collect {|s| [s.name, s.id, ["issues.fixed_version_id=?", s.id]] }
|
||||
}
|
||||
|
||||
search_filter_criteria('assigned_to_id') {
|
||||
[ [('['+l(:label_all)+']'), "A", nil],
|
||||
[('['+l(:label_none)+']'), "N", ["issues.assigned_to_id is null"]]
|
||||
] + @project.users.collect {|s| [s.display_name, s.id, ["issues.assigned_to_id=?", s.id]] }
|
||||
}
|
||||
|
||||
search_filter_criteria('subproject_id') {
|
||||
[ [_('[None]'), "N", ["issues.project_id=?", @project.id]],
|
||||
[_('[All]'), "A", ["(issues.project_id=? or projects.parent_id=?)", @project.id, @project.id]]
|
||||
[ [('['+l(:label_none)+']'), "N", ["issues.project_id=?", @project.id]],
|
||||
[('['+l(:label_all)+']'), "A", ["(issues.project_id=? or projects.parent_id=?)", @project.id, @project.id]]
|
||||
]
|
||||
}
|
||||
end
|
||||
|
||||
@@ -55,7 +55,7 @@ class Attachment < ActiveRecord::Base
|
||||
|
||||
# Returns file's location on disk
|
||||
def diskfile
|
||||
"#{RDM_STORAGE_PATH}/#{self.disk_filename}"
|
||||
"#{$RDM_STORAGE_PATH}/#{self.disk_filename}"
|
||||
end
|
||||
|
||||
def increment_download
|
||||
|
||||
47
redmine/app/models/auth_source.rb
Normal file
47
redmine/app/models/auth_source.rb
Normal file
@@ -0,0 +1,47 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006 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 AuthSource < ActiveRecord::Base
|
||||
has_many :users
|
||||
|
||||
validates_presence_of :name
|
||||
validates_uniqueness_of :name
|
||||
|
||||
def authenticate(login, password)
|
||||
end
|
||||
|
||||
def test_connection
|
||||
end
|
||||
|
||||
def auth_method_name
|
||||
"Abstract"
|
||||
end
|
||||
|
||||
# Try to authenticate a user not yet registered against available sources
|
||||
def self.authenticate(login, password)
|
||||
AuthSource.find(:all, :conditions => ["onthefly_register=?", true]).each do |source|
|
||||
begin
|
||||
logger.debug "Authenticating '#{login}' against '#{source.name}'" if logger && logger.debug?
|
||||
attrs = source.authenticate(login, password)
|
||||
rescue
|
||||
attrs = nil
|
||||
end
|
||||
return attrs if attrs
|
||||
end
|
||||
return nil
|
||||
end
|
||||
end
|
||||
79
redmine/app/models/auth_source_ldap.rb
Normal file
79
redmine/app/models/auth_source_ldap.rb
Normal file
@@ -0,0 +1,79 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006 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.
|
||||
|
||||
require 'net/ldap'
|
||||
require 'iconv'
|
||||
|
||||
class AuthSourceLdap < AuthSource
|
||||
validates_presence_of :host, :port, :attr_login
|
||||
|
||||
def after_initialize
|
||||
self.port = 389 if self.port == 0
|
||||
end
|
||||
|
||||
def authenticate(login, password)
|
||||
attrs = []
|
||||
# get user's DN
|
||||
ldap_con = initialize_ldap_con(self.account, self.account_password)
|
||||
login_filter = Net::LDAP::Filter.eq( self.attr_login, login )
|
||||
object_filter = Net::LDAP::Filter.eq( "objectClass", "*" )
|
||||
dn = String.new
|
||||
ldap_con.search( :base => self.base_dn,
|
||||
:filter => object_filter & login_filter,
|
||||
:attributes=> ['dn', self.attr_firstname, self.attr_lastname, self.attr_mail]) do |entry|
|
||||
dn = entry.dn
|
||||
attrs = [:firstname => AuthSourceLdap.get_attr(entry, self.attr_firstname),
|
||||
:lastname => AuthSourceLdap.get_attr(entry, self.attr_lastname),
|
||||
:mail => AuthSourceLdap.get_attr(entry, self.attr_mail),
|
||||
:auth_source_id => self.id ]
|
||||
end
|
||||
return nil if dn.empty?
|
||||
logger.debug "DN found for #{login}: #{dn}" if logger && logger.debug?
|
||||
# authenticate user
|
||||
ldap_con = initialize_ldap_con(dn, password)
|
||||
return nil unless ldap_con.bind
|
||||
# return user's attributes
|
||||
logger.debug "Authentication successful for '#{login}'" if logger && logger.debug?
|
||||
attrs
|
||||
rescue Net::LDAP::LdapError => text
|
||||
raise "LdapError: " + text
|
||||
end
|
||||
|
||||
# test the connection to the LDAP
|
||||
def test_connection
|
||||
ldap_con = initialize_ldap_con(self.account, self.account_password)
|
||||
ldap_con.open { }
|
||||
rescue Net::LDAP::LdapError => text
|
||||
raise "LdapError: " + text
|
||||
end
|
||||
|
||||
def auth_method_name
|
||||
"LDAP"
|
||||
end
|
||||
|
||||
private
|
||||
def initialize_ldap_con(ldap_user, ldap_password)
|
||||
Net::LDAP.new( {:host => self.host,
|
||||
:port => self.port,
|
||||
:auth => { :method => :simple, :username => Iconv.new('iso-8859-15', 'utf-8').iconv(ldap_user), :password => Iconv.new('iso-8859-15', 'utf-8').iconv(ldap_password) }}
|
||||
)
|
||||
end
|
||||
|
||||
def self.get_attr(entry, attr_name)
|
||||
entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name]
|
||||
end
|
||||
end
|
||||
@@ -16,23 +16,27 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class CustomField < ActiveRecord::Base
|
||||
has_many :custom_values, :dependent => true
|
||||
|
||||
has_and_belongs_to_many :projects
|
||||
has_many :custom_values, :dependent => true
|
||||
has_many :issues, :through => :issue_custom_values
|
||||
FIELD_FORMATS = { "list" => :label_list,
|
||||
"date" => :label_date,
|
||||
"bool" => :label_boolean,
|
||||
"int" => :label_integer,
|
||||
"string" => :label_string,
|
||||
"text" => :label_text
|
||||
}.freeze
|
||||
|
||||
validates_presence_of :name, :typ
|
||||
validates_uniqueness_of :name
|
||||
validates_presence_of :name, :field_format
|
||||
validates_uniqueness_of :name
|
||||
validates_inclusion_of :field_format, :in => FIELD_FORMATS.keys
|
||||
validates_presence_of :possible_values, :if => Proc.new { |field| field.field_format == "list" }
|
||||
|
||||
TYPES = [
|
||||
[ "Integer", 0 ],
|
||||
[ "String", 1 ],
|
||||
[ "Date", 2 ],
|
||||
[ "Boolean", 3 ],
|
||||
[ "List", 4 ]
|
||||
].freeze
|
||||
|
||||
def self.for_all
|
||||
find(:all, :conditions => ["is_for_all=?", true])
|
||||
end
|
||||
end
|
||||
# to move in project_custom_field
|
||||
def self.for_all
|
||||
find(:all, :conditions => ["is_for_all=?", true])
|
||||
end
|
||||
|
||||
def type_name
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,26 +16,23 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class CustomValue < ActiveRecord::Base
|
||||
belongs_to :issue
|
||||
belongs_to :custom_field
|
||||
|
||||
belongs_to :custom_field
|
||||
belongs_to :customized, :polymorphic => true
|
||||
|
||||
protected
|
||||
def validate
|
||||
errors.add(custom_field.name, "can't be blank") if custom_field.is_required? and value.empty?
|
||||
errors.add(custom_field.name, "is not valid") unless custom_field.regexp.empty? or value =~ Regexp.new(custom_field.regexp)
|
||||
|
||||
case custom_field.typ
|
||||
when 0
|
||||
errors.add(custom_field.name, "must be an integer") unless value =~ /^[0-9]*$/
|
||||
when 1
|
||||
errors.add(custom_field.name, "is too short") if custom_field.min_length > 0 and value.length < custom_field.min_length and value.length > 0
|
||||
errors.add(custom_field.name, "is too long") if custom_field.max_length > 0 and value.length > custom_field.max_length
|
||||
when 2
|
||||
errors.add(custom_field.name, "must be a valid date") unless value =~ /^(\d+)\/(\d+)\/(\d+)$/ or value.empty?
|
||||
when 3
|
||||
|
||||
when 4
|
||||
errors.add(custom_field.name, "is not a valid value") unless custom_field.possible_values.split('|').include? value or value.empty?
|
||||
end
|
||||
errors.add(:value, :activerecord_error_blank) and return if custom_field.is_required? and value.empty?
|
||||
errors.add(:value, :activerecord_error_invalid) unless custom_field.regexp.empty? or value =~ Regexp.new(custom_field.regexp)
|
||||
errors.add(:value, :activerecord_error_too_short) if custom_field.min_length > 0 and value.length < custom_field.min_length and value.length > 0
|
||||
errors.add(:value, :activerecord_error_too_long) if custom_field.max_length > 0 and value.length > custom_field.max_length
|
||||
case custom_field.field_format
|
||||
when "int"
|
||||
errors.add(:value, :activerecord_error_not_a_number) unless value =~ /^[0-9]*$/
|
||||
when "date"
|
||||
errors.add(:value, :activerecord_error_invalid) unless value =~ /^(\d+)\/(\d+)\/(\d+)$/ or value.empty?
|
||||
when "list"
|
||||
errors.add(:value, :activerecord_error_inclusion) unless custom_field.possible_values.split('|').include? value or value.empty?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -20,5 +20,5 @@ class Document < ActiveRecord::Base
|
||||
belongs_to :category, :class_name => "Enumeration", :foreign_key => "category_id"
|
||||
has_many :attachments, :as => :container, :dependent => true
|
||||
|
||||
validates_presence_of :title
|
||||
validates_presence_of :project, :title, :category
|
||||
end
|
||||
|
||||
@@ -21,18 +21,14 @@ class Enumeration < ActiveRecord::Base
|
||||
validates_presence_of :opt, :name
|
||||
validates_uniqueness_of :name, :scope => [:opt]
|
||||
|
||||
OPTIONS = [
|
||||
["Issue priorities", "IPRI"],
|
||||
["Document categories", "DCAT"]
|
||||
].freeze
|
||||
OPTIONS = {
|
||||
"IPRI" => :enumeration_issue_priorities,
|
||||
"DCAT" => :enumeration_doc_categories
|
||||
}.freeze
|
||||
|
||||
def self.get_values(option)
|
||||
find(:all, :conditions => ['opt=?', option])
|
||||
end
|
||||
|
||||
def name
|
||||
_ self.attributes['name']
|
||||
end
|
||||
|
||||
private
|
||||
def check_integrity
|
||||
|
||||
@@ -29,15 +29,19 @@ class Issue < ActiveRecord::Base
|
||||
has_many :histories, :class_name => 'IssueHistory', :dependent => true, :order => "issue_histories.created_on DESC", :include => :status
|
||||
has_many :attachments, :as => :container, :dependent => true
|
||||
|
||||
has_many :custom_values, :dependent => true
|
||||
has_many :custom_values, :dependent => true, :as => :customized
|
||||
has_many :custom_fields, :through => :custom_values
|
||||
|
||||
validates_presence_of :subject, :descr, :priority, :tracker, :author
|
||||
validates_presence_of :subject, :description, :priority, :tracker, :author
|
||||
validates_associated :custom_values, :on => :update
|
||||
|
||||
# set default status for new issues
|
||||
def before_validation
|
||||
self.status = IssueStatus.default if new_record?
|
||||
end
|
||||
|
||||
def before_create
|
||||
self.status = IssueStatus.default
|
||||
build_history
|
||||
build_history
|
||||
end
|
||||
|
||||
def long_id
|
||||
|
||||
27
redmine/app/models/issue_custom_field.rb
Normal file
27
redmine/app/models/issue_custom_field.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006 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 IssueCustomField < CustomField
|
||||
has_and_belongs_to_many :projects, :join_table => "custom_fields_projects", :foreign_key => "custom_field_id"
|
||||
has_and_belongs_to_many :trackers, :join_table => "custom_fields_trackers", :foreign_key => "custom_field_id"
|
||||
has_many :issues, :through => :issue_custom_values
|
||||
|
||||
def type_name
|
||||
:label_issue_plural
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,10 +38,6 @@ class IssueStatus < ActiveRecord::Base
|
||||
statuses
|
||||
end
|
||||
|
||||
def name
|
||||
_ self.attributes['name']
|
||||
end
|
||||
|
||||
private
|
||||
def check_integrity
|
||||
raise "Can't delete status" if Issue.find(:first, :conditions => ["status_id=?", self.id]) or IssueHistory.find(:first, :conditions => ["status_id=?", self.id])
|
||||
|
||||
@@ -17,20 +17,33 @@
|
||||
|
||||
class Mailer < ActionMailer::Base
|
||||
|
||||
def issue_change_status(issue)
|
||||
# Sends to all project members
|
||||
@recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification }
|
||||
@from = 'redmine@somenet.foo'
|
||||
@subject = "Issue ##{issue.id} has been updated"
|
||||
@body['issue'] = issue
|
||||
end
|
||||
|
||||
def issue_add(issue)
|
||||
# Sends to all project members
|
||||
@recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification }
|
||||
@from = 'redmine@somenet.foo'
|
||||
@subject = "Issue ##{issue.id} has been reported"
|
||||
@body['issue'] = issue
|
||||
end
|
||||
|
||||
def issue_change_status(issue)
|
||||
# Sends to all project members
|
||||
@recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification }
|
||||
@from = 'redmine@somenet.foo'
|
||||
@subject = "Issue ##{issue.id} has been updated"
|
||||
@body['issue'] = issue
|
||||
end
|
||||
|
||||
def issue_add(issue)
|
||||
# Sends to all project members
|
||||
@recipients = issue.project.members.collect { |m| m.user.mail if m.user.mail_notification }
|
||||
@from = 'redmine@somenet.foo'
|
||||
@subject = "Issue ##{issue.id} has been reported"
|
||||
@body['issue'] = issue
|
||||
end
|
||||
|
||||
def lost_password(token)
|
||||
@recipients = token.user.mail
|
||||
@from = 'redmine@somenet.foo'
|
||||
@subject = "redMine password"
|
||||
@body['token'] = token
|
||||
end
|
||||
|
||||
def register(token)
|
||||
@recipients = token.user.mail
|
||||
@from = 'redmine@somenet.foo'
|
||||
@subject = "redMine account activation"
|
||||
@body['token'] = token
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class Member < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
belongs_to :role
|
||||
belongs_to :project
|
||||
|
||||
validates_presence_of :role, :user, :project
|
||||
belongs_to :user
|
||||
belongs_to :role
|
||||
belongs_to :project
|
||||
|
||||
validates_presence_of :role, :user, :project
|
||||
validates_uniqueness_of :user_id, :scope => :project_id
|
||||
|
||||
def name
|
||||
self.user.display_name
|
||||
end
|
||||
|
||||
def name
|
||||
self.user.display_name
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class News < ActiveRecord::Base
|
||||
belongs_to :project
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
|
||||
validates_presence_of :title, :shortdescr, :descr
|
||||
|
||||
# returns last created news
|
||||
def self.latest
|
||||
find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
|
||||
end
|
||||
belongs_to :project
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
|
||||
validates_presence_of :title, :description
|
||||
|
||||
# returns last created news
|
||||
def self.latest
|
||||
find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,27 +16,27 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class Permission < ActiveRecord::Base
|
||||
has_and_belongs_to_many :roles
|
||||
|
||||
validates_presence_of :controller, :action, :descr
|
||||
|
||||
has_and_belongs_to_many :roles
|
||||
|
||||
validates_presence_of :controller, :action, :description
|
||||
|
||||
GROUPS = {
|
||||
100 => "Project",
|
||||
200 => "Membres",
|
||||
300 => "Versions",
|
||||
400 => "Issue categories",
|
||||
1000 => "Issues",
|
||||
1100 => "News",
|
||||
1200 => "Documents",
|
||||
1300 => "Files",
|
||||
}.freeze
|
||||
100 => :label_project,
|
||||
200 => :label_member_plural,
|
||||
300 => :label_version_plural,
|
||||
400 => :label_issue_category_plural,
|
||||
1000 => :label_issue_plural,
|
||||
1100 => :label_news_plural,
|
||||
1200 => :label_document_plural,
|
||||
1300 => :label_attachment_plural,
|
||||
}.freeze
|
||||
|
||||
@@cached_perms_for_public = nil
|
||||
@@cached_perms_for_roles = nil
|
||||
|
||||
def name
|
||||
self.controller + "/" + self.action
|
||||
end
|
||||
def name
|
||||
self.controller + "/" + self.action
|
||||
end
|
||||
|
||||
def group_id
|
||||
(self.sort / 100)*100
|
||||
|
||||
@@ -16,30 +16,34 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class Project < ActiveRecord::Base
|
||||
has_many :versions, :dependent => true, :order => "versions.effective_date DESC"
|
||||
has_many :members, :dependent => true
|
||||
has_many :users, :through => :members
|
||||
has_many :issues, :dependent => true, :order => "issues.created_on DESC", :include => :status
|
||||
has_many :documents, :dependent => true
|
||||
has_many :news, :dependent => true, :include => :author
|
||||
has_many :issue_categories, :dependent => true
|
||||
has_and_belongs_to_many :custom_fields
|
||||
acts_as_tree :order => "name", :counter_cache => true
|
||||
|
||||
validates_presence_of :name, :descr
|
||||
validates_uniqueness_of :name
|
||||
|
||||
# returns 5 last created projects
|
||||
def self.latest
|
||||
find(:all, :limit => 5, :order => "created_on DESC")
|
||||
end
|
||||
|
||||
# Returns an array of all custom fields enabled for project issues
|
||||
# (explictly associated custom fields and custom fields enabled for all projects)
|
||||
def custom_fields_for_issues
|
||||
(CustomField.for_all + custom_fields).uniq
|
||||
end
|
||||
|
||||
has_many :versions, :dependent => true, :order => "versions.effective_date DESC, versions.name DESC"
|
||||
has_many :members, :dependent => true
|
||||
has_many :users, :through => :members
|
||||
has_many :custom_values, :dependent => true, :as => :customized
|
||||
has_many :issues, :dependent => true, :order => "issues.created_on DESC", :include => :status
|
||||
has_many :documents, :dependent => true
|
||||
has_many :news, :dependent => true, :include => :author
|
||||
has_many :issue_categories, :dependent => true, :order => "issue_categories.name"
|
||||
has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => 'custom_fields_projects', :association_foreign_key => 'custom_field_id'
|
||||
acts_as_tree :order => "name", :counter_cache => true
|
||||
|
||||
validates_presence_of :name, :description
|
||||
validates_uniqueness_of :name
|
||||
validates_associated :custom_values, :on => :update
|
||||
|
||||
# returns 5 last created projects
|
||||
def self.latest
|
||||
find(:all, :limit => 5, :order => "created_on DESC")
|
||||
end
|
||||
|
||||
# Returns an array of all custom fields enabled for project issues
|
||||
# (explictly associated custom fields and custom fields enabled for all projects)
|
||||
def custom_fields_for_issues(tracker)
|
||||
tracker.custom_fields.find(:all, :include => :projects,
|
||||
:conditions => ["is_for_all=? or project_id=?", true, self.id])
|
||||
#(CustomField.for_all + custom_fields).uniq
|
||||
end
|
||||
|
||||
protected
|
||||
def validate
|
||||
errors.add(parent_id, " must be a root project") if parent and parent.parent
|
||||
|
||||
22
redmine/app/models/project_custom_field.rb
Normal file
22
redmine/app/models/project_custom_field.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006 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 ProjectCustomField < CustomField
|
||||
def type_name
|
||||
:label_project_plural
|
||||
end
|
||||
end
|
||||
@@ -17,13 +17,13 @@
|
||||
|
||||
class Role < ActiveRecord::Base
|
||||
before_destroy :check_integrity
|
||||
has_and_belongs_to_many :permissions
|
||||
has_and_belongs_to_many :permissions
|
||||
has_many :workflows, :dependent => true
|
||||
has_many :members
|
||||
|
||||
validates_presence_of :name
|
||||
validates_uniqueness_of :name
|
||||
|
||||
|
||||
validates_presence_of :name
|
||||
validates_uniqueness_of :name
|
||||
|
||||
private
|
||||
def check_integrity
|
||||
raise "Can't delete role" if Member.find(:first, :conditions =>["role_id=?", self.id])
|
||||
|
||||
44
redmine/app/models/token.rb
Normal file
44
redmine/app/models/token.rb
Normal file
@@ -0,0 +1,44 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006 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 Token < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
|
||||
@@validity_time = 1.day
|
||||
|
||||
def before_create
|
||||
self.value = Token.generate_token_value
|
||||
end
|
||||
|
||||
# Return true if token has expired
|
||||
def expired?
|
||||
return Time.now > self.created_on + @@validity_time
|
||||
end
|
||||
|
||||
# Delete all expired tokens
|
||||
def self.destroy_expired
|
||||
Token.delete_all ["created_on < ?", Time.now - @@validity_time]
|
||||
end
|
||||
|
||||
private
|
||||
def self.generate_token_value
|
||||
chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
|
||||
token_value = ''
|
||||
40.times { |i| token_value << chars[rand(chars.size-1)] }
|
||||
token_value
|
||||
end
|
||||
end
|
||||
@@ -19,14 +19,11 @@ class Tracker < ActiveRecord::Base
|
||||
before_destroy :check_integrity
|
||||
has_many :issues
|
||||
has_many :workflows, :dependent => true
|
||||
|
||||
has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => 'custom_fields_trackers', :association_foreign_key => 'custom_field_id'
|
||||
|
||||
validates_presence_of :name
|
||||
validates_uniqueness_of :name
|
||||
|
||||
def name
|
||||
_ self.attributes['name']
|
||||
end
|
||||
|
||||
private
|
||||
def check_integrity
|
||||
raise "Can't delete tracker" if Issue.find(:first, :conditions => ["tracker_id=?", self.id])
|
||||
|
||||
@@ -19,7 +19,9 @@ require "digest/sha1"
|
||||
|
||||
class User < ActiveRecord::Base
|
||||
has_many :memberships, :class_name => 'Member', :include => [ :project, :role ], :dependent => true
|
||||
|
||||
has_many :custom_values, :dependent => true, :as => :customized
|
||||
belongs_to :auth_source
|
||||
|
||||
attr_accessor :password, :password_confirmation
|
||||
attr_accessor :last_before_login_on
|
||||
# Prevents unauthorized assignments
|
||||
@@ -33,6 +35,12 @@ class User < ActiveRecord::Base
|
||||
# Password length between 4 and 12
|
||||
validates_length_of :password, :in => 4..12, :allow_nil => true
|
||||
validates_confirmation_of :password, :allow_nil => true
|
||||
validates_associated :custom_values, :on => :update
|
||||
|
||||
# Account statuses
|
||||
STATUS_ACTIVE = 1
|
||||
STATUS_REGISTERED = 2
|
||||
STATUS_LOCKED = 3
|
||||
|
||||
def before_save
|
||||
# update hashed_password if password was set
|
||||
@@ -41,23 +49,53 @@ class User < ActiveRecord::Base
|
||||
|
||||
# Returns the user that matches provided login and password, or nil
|
||||
def self.try_to_login(login, password)
|
||||
user = find(:first, :conditions => ["login=? and hashed_password=? and locked=?", login, User.hash_password(password), false])
|
||||
user = find(:first, :conditions => ["login=?", login])
|
||||
if user
|
||||
user.last_before_login_on = user.last_login_on
|
||||
user.update_attribute(:last_login_on, Time.now)
|
||||
end
|
||||
# user is already in local database
|
||||
return nil if !user.active?
|
||||
if user.auth_source
|
||||
# user has an external authentication method
|
||||
return nil unless user.auth_source.authenticate(login, password)
|
||||
else
|
||||
# authentication with local password
|
||||
return nil unless User.hash_password(password) == user.hashed_password
|
||||
end
|
||||
else
|
||||
# user is not yet registered, try to authenticate with available sources
|
||||
attrs = AuthSource.authenticate(login, password)
|
||||
if attrs
|
||||
onthefly = new(*attrs)
|
||||
onthefly.login = login
|
||||
onthefly.language = $RDM_DEFAULT_LANG
|
||||
if onthefly.save
|
||||
user = find(:first, :conditions => ["login=?", login])
|
||||
logger.info("User '#{user.login}' created on the fly.") if logger
|
||||
end
|
||||
end
|
||||
end
|
||||
user.update_attribute(:last_login_on, Time.now) if user
|
||||
user
|
||||
|
||||
rescue => text
|
||||
raise text
|
||||
end
|
||||
|
||||
# Return user's full name for display
|
||||
def display_name
|
||||
firstname + " " + lastname
|
||||
end
|
||||
|
||||
def active?
|
||||
self.status == STATUS_ACTIVE
|
||||
end
|
||||
|
||||
def locked?
|
||||
self.status == STATUS_LOCKED
|
||||
end
|
||||
|
||||
def check_password?(clear_password)
|
||||
User.hash_password(clear_password) == self.hashed_password
|
||||
end
|
||||
|
||||
|
||||
def role_for_project(project_id)
|
||||
@role_for_projects ||=
|
||||
|
||||
23
redmine/app/models/user_custom_field.rb
Normal file
23
redmine/app/models/user_custom_field.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006 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 UserCustomField < CustomField
|
||||
def type_name
|
||||
:label_user_plural
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
<div class="box">
|
||||
<h2><%=_('Please login') %></h2>
|
||||
<center>
|
||||
<div class="box login">
|
||||
<h2><%= image_tag 'login' %> <%=l(:label_please_login)%></h2>
|
||||
|
||||
<%= start_form_tag :action=> "login" %>
|
||||
<p><label for="login"><%=_ 'Login' %>:</label><br/>
|
||||
<%= text_field_tag 'login', nil, :size => 25 %></p>
|
||||
|
||||
<p><label for="user_password"><%=_ 'Password' %>:</label><br/>
|
||||
<%= password_field_tag 'password', nil, :size => 25 %></p>
|
||||
|
||||
<p><input type="submit" name="login" value="<%=_ 'Log in' %> »" class="primary" /></p>
|
||||
<%= end_form_tag %>
|
||||
</div>
|
||||
<%= start_form_tag({:action=> "login"}, :class => "tabular") %>
|
||||
<p><label for="login"><%=l(:field_login)%>:</label>
|
||||
<%= text_field_tag 'login', nil, :size => 25 %></p>
|
||||
|
||||
<p><label for="password"><%=l(:field_password)%>:</label>
|
||||
<%= password_field_tag 'password', nil, :size => 25 %></p>
|
||||
|
||||
<p><center><input type="submit" name="login" value="<%=l(:button_login)%> »" class="primary" /></center>
|
||||
<%= end_form_tag %>
|
||||
|
||||
<br><% unless $RDM_SELF_REGISTRATION == false %><%= link_to l(:label_register), :action => 'register' %> |<% end %>
|
||||
<%= link_to l(:label_password_lost), :action => 'lost_password' %></p>
|
||||
</div>
|
||||
</center>
|
||||
14
redmine/app/views/account/lost_password.rhtml
Normal file
14
redmine/app/views/account/lost_password.rhtml
Normal file
@@ -0,0 +1,14 @@
|
||||
<center>
|
||||
<div class="box login">
|
||||
<h2><%=l(:label_password_lost)%></h2>
|
||||
|
||||
<%= start_form_tag({:action=> "lost_password"}, :class => "tabular") %>
|
||||
|
||||
<p><label for="mail"><%=l(:field_mail)%> <span class="required">*</span></label>
|
||||
<%= text_field_tag 'mail', nil, :size => 40 %></p>
|
||||
|
||||
<p><center><%= submit_tag l(:button_submit) %></center></p>
|
||||
|
||||
<%= end_form_tag %>
|
||||
</div>
|
||||
</center>
|
||||
@@ -1,55 +1,54 @@
|
||||
<h2><%=_('My account')%></h2>
|
||||
<h2><%=l(:label_my_account)%></h2>
|
||||
|
||||
<p><%=_('Login')%>: <strong><%= @user.login %></strong><br />
|
||||
<%=_('Created on')%>: <%= format_time(@user.created_on) %>,
|
||||
<%=_('Last update')%>: <%= format_time(@user.updated_on) %></p>
|
||||
<p><%=l(:field_login)%>: <strong><%= @user.login %></strong><br />
|
||||
<%=l(:field_created_on)%>: <%= format_time(@user.created_on) %>,
|
||||
<%=l(:field_updated_on)%>: <%= format_time(@user.updated_on) %></p>
|
||||
|
||||
<%= error_messages_for 'user' %>
|
||||
|
||||
<div class="splitcontentleft">
|
||||
<div class="box">
|
||||
<h3><%=_('Information')%></h3>
|
||||
|
||||
<%= start_form_tag :action => 'my_account' %>
|
||||
<h3><%=l(:label_information_plural)%></h3>
|
||||
|
||||
<%= start_form_tag({:action => 'my_account'}, :class => "tabular") %>
|
||||
|
||||
<!--[form:user]-->
|
||||
<p><label for="user_firstname"><%=_('Firstname')%> <span class="required">*</span></label><br/>
|
||||
<p><label for="user_firstname"><%=l(:field_firstname)%> <span class="required">*</span></label>
|
||||
<%= text_field 'user', 'firstname' %></p>
|
||||
|
||||
<p><label for="user_lastname"><%=_('Lastname')%> <span class="required">*</span></label><br/>
|
||||
<p><label for="user_lastname"><%=l(:field_lastname)%> <span class="required">*</span></label>
|
||||
<%= text_field 'user', 'lastname' %></p>
|
||||
|
||||
<p><label for="user_mail"><%=_('Mail')%> <span class="required">*</span></label><br/>
|
||||
<%= text_field 'user', 'mail' %></p>
|
||||
<p><label for="user_mail"><%=l(:field_mail)%> <span class="required">*</span></label>
|
||||
<%= text_field 'user', 'mail', :size => 40 %></p>
|
||||
|
||||
<p><label for="user_language"><%=_('Language')%></label><br/>
|
||||
<%= select("user", "language", Localization.langs) %></p>
|
||||
<p><label for="user_language"><%=l(:field_language)%></label>
|
||||
<%= select("user", "language", lang_options_for_select) %></p>
|
||||
<!--[eoform:user]-->
|
||||
|
||||
<p><%= check_box 'user', 'mail_notification' %> <label for="user_mail_notification"><%=_('Mail notifications')%></label></p>
|
||||
<p><label for="user_mail_notification"><%=l(:field_mail_notification)%></label>
|
||||
<%= check_box 'user', 'mail_notification' %></p>
|
||||
|
||||
<center><%= submit_tag _('Save') %></center>
|
||||
<center><%= submit_tag l(:button_save) %></center>
|
||||
<%= end_form_tag %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="splitcontentright">
|
||||
|
||||
<% unless @user.auth_source_id %>
|
||||
<div class="box">
|
||||
<h3><%=_('Password')%></h3>
|
||||
|
||||
<%= start_form_tag :action => 'change_password' %>
|
||||
<h3><%=l(:field_password)%></h3>
|
||||
|
||||
<%= start_form_tag({:action => 'change_password'}, :class => "tabular") %>
|
||||
|
||||
<p><label for="password"><%=_('Password')%> <span class="required">*</span></label><br/>
|
||||
<p><label for="password"><%=l(:field_password)%> <span class="required">*</span></label>
|
||||
<%= password_field_tag 'password', nil, :size => 25 %></p>
|
||||
|
||||
<p><label for="new_password"><%=_('New password')%> <span class="required">*</span></label><br/>
|
||||
<p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
|
||||
<%= password_field_tag 'new_password', nil, :size => 25 %></p>
|
||||
|
||||
<p><label for="new_password_confirmation"><%=_('Confirmation')%> <span class="required">*</span></label><br/>
|
||||
<p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
|
||||
<%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
|
||||
|
||||
<center><%= submit_tag _('Save') %></center>
|
||||
<center><%= submit_tag l(:button_save) %></center>
|
||||
<%= end_form_tag %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
<h2><%=_('My page') %></h2>
|
||||
<h2><%=l(:label_my_page)%></h2>
|
||||
|
||||
<p>
|
||||
<%=_('Welcome')%> <b><%= @user.firstname %></b><br />
|
||||
<% unless @user.last_before_login_on.nil? %>
|
||||
<%=_('Last login')%>: <%= format_time(@user.last_before_login_on) %>
|
||||
<%=l(:label_last_login)%>: <%= format_time(@user.last_before_login_on) %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<div class="splitcontentleft">
|
||||
<h3><%=_('Reported issues')%></h3>
|
||||
<h3><%=l(:label_reported_issues)%></h3>
|
||||
<%= render :partial => 'issues/list_simple', :locals => { :issues => @reported_issues } %>
|
||||
<%= "<p>(Last #{@reported_issues.length} updated)</p>" if @reported_issues.length > 0 %>
|
||||
<% if @reported_issues.length > 0 %>
|
||||
<p><%=lwr(:label_last_updates, @reported_issues.length)%></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="splitcontentright">
|
||||
<h3><%=_('Assigned to me')%></h3>
|
||||
<h3><%=l(:label_assigned_to_me_issues)%></h3>
|
||||
<%= render :partial => 'issues/list_simple', :locals => { :issues => @assigned_issues } %>
|
||||
<%= "<p>(Last #{@assigned_issues.length} updated)</p>" if @assigned_issues.length > 0 %>
|
||||
<% if @assigned_issues.length > 0 %>
|
||||
<p><%=lwr(:label_last_updates, @assigned_issues.length)%></p>
|
||||
<% end %>
|
||||
</div>
|
||||
21
redmine/app/views/account/password_recovery.rhtml
Normal file
21
redmine/app/views/account/password_recovery.rhtml
Normal file
@@ -0,0 +1,21 @@
|
||||
<center>
|
||||
<div class="box login">
|
||||
<h2><%=l(:label_password_lost)%></h2>
|
||||
|
||||
<p><%=l(:field_login)%>: <strong><%= @user.login %></strong><br />
|
||||
|
||||
<%= error_messages_for 'user' %>
|
||||
|
||||
<%= start_form_tag({:token => @token.value}, :class => "tabular") %>
|
||||
|
||||
<p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
|
||||
<%= password_field_tag 'new_password', nil, :size => 25 %></p>
|
||||
|
||||
<p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
|
||||
<%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
|
||||
|
||||
<p><center><%= submit_tag l(:button_save) %></center></p>
|
||||
<%= end_form_tag %>
|
||||
|
||||
</div>
|
||||
</center>
|
||||
39
redmine/app/views/account/register.rhtml
Normal file
39
redmine/app/views/account/register.rhtml
Normal file
@@ -0,0 +1,39 @@
|
||||
<h2><%=l(:label_register)%></h2>
|
||||
|
||||
<%= start_form_tag({:action => 'register'}, :class => "tabular") %>
|
||||
<%= error_messages_for 'user' %>
|
||||
|
||||
<div class="box">
|
||||
<!--[form:user]-->
|
||||
<p><label for="user_login"><%=l(:field_login)%> <span class="required">*</span></label>
|
||||
<%= text_field 'user', 'login', :size => 25 %></p>
|
||||
|
||||
<p><label for="password"><%=l(:field_password)%> <span class="required">*</span></label>
|
||||
<%= password_field_tag 'password', nil, :size => 25 %></p>
|
||||
|
||||
<p><label for="password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
|
||||
<%= password_field_tag 'password_confirmation', nil, :size => 25 %></p>
|
||||
|
||||
<p><label for="user_firstname"><%=l(:field_firstname)%> <span class="required">*</span></label>
|
||||
<%= text_field 'user', 'firstname' %></p>
|
||||
|
||||
<p><label for="user_lastname"><%=l(:field_lastname)%> <span class="required">*</span></label>
|
||||
<%= text_field 'user', 'lastname' %></p>
|
||||
|
||||
<p><label for="user_mail"><%=l(:field_mail)%> <span class="required">*</span></label>
|
||||
<%= text_field 'user', 'mail' %></p>
|
||||
|
||||
<p><label for="user_language"><%=l(:field_language)%></label>
|
||||
<%= select("user", "language", lang_options_for_select) %></p>
|
||||
|
||||
<% for @custom_value in @custom_values %>
|
||||
<p><%= custom_field_tag_with_label @custom_value %></p>
|
||||
<% end %>
|
||||
|
||||
<p><label for="user_mail_notification"><%=l(:field_mail_notification)%></label>
|
||||
<%= check_box 'user', 'mail_notification' %></p>
|
||||
<!--[eoform:user]-->
|
||||
</div>
|
||||
|
||||
<%= submit_tag l(:button_submit) %>
|
||||
<%= end_form_tag %>
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
<p>
|
||||
<%= mail_to @user.mail %><br />
|
||||
<%=_('Registered on')%>: <%= format_date(@user.created_on) %>
|
||||
<%=l(:label_registered_on)%>: <%= format_date(@user.created_on) %>
|
||||
</p>
|
||||
|
||||
<h3><%=_('Projects')%></h3>
|
||||
<h3><%=l(:label_project_plural)%></h3>
|
||||
<p>
|
||||
<% for membership in @user.memberships %>
|
||||
<%= membership.project.name %> (<%= membership.role.name %>, <%= format_date(membership.created_on) %>)
|
||||
@@ -13,7 +13,7 @@
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<h3><%=_('Activity')%></h3>
|
||||
<h3><%=l(:label_activity)%></h3>
|
||||
<p>
|
||||
<%=_('Reported issues')%>: <%= Issue.count( [ "author_id=?", @user.id]) %>
|
||||
<%=l(:label_reported_issues)%>: <%= Issue.count(["author_id=?", @user.id]) %>
|
||||
</p>
|
||||
@@ -1,45 +1,50 @@
|
||||
<h2><%=_('Administration')%></h2>
|
||||
<h2><%=l(:label_administration)%></h2>
|
||||
|
||||
<p>
|
||||
<%= image_tag "projects" %>
|
||||
<%= link_to _('Projects'), :controller => 'admin', :action => 'projects' %> |
|
||||
<%= link_to _('New'), :controller => 'projects', :action => 'add' %>
|
||||
<%= link_to l(:label_project_plural), :controller => 'admin', :action => 'projects' %> |
|
||||
<%= link_to l(:label_new), :controller => 'projects', :action => 'add' %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= image_tag "users" %>
|
||||
<%= link_to _('Users'), :controller => 'users' %> |
|
||||
<%= link_to _('New'), :controller => 'users', :action => 'add' %>
|
||||
<%= link_to l(:label_user_plural), :controller => 'users' %> |
|
||||
<%= link_to l(:label_new), :controller => 'users', :action => 'add' %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= image_tag "role" %>
|
||||
<%= link_to _('Roles and permissions'), :controller => 'roles' %>
|
||||
<%= link_to l(:label_role_and_permissions), :controller => 'roles' %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= image_tag "tracker" %>
|
||||
<%= link_to _('Trackers'), :controller => 'trackers' %> |
|
||||
<%= link_to _('Custom fields'), :controller => 'custom_fields' %>
|
||||
<%= link_to l(:label_tracker_plural), :controller => 'trackers' %> |
|
||||
<%= link_to l(:label_custom_field_plural), :controller => 'custom_fields' %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= image_tag "workflow" %>
|
||||
<%= link_to _('Issue Statuses'), :controller => 'issue_statuses' %> |
|
||||
<%= link_to _('Workflow'), :controller => 'roles', :action => 'workflow' %>
|
||||
<%= link_to l(:label_issue_status_plural), :controller => 'issue_statuses' %> |
|
||||
<%= link_to l(:label_workflow), :controller => 'roles', :action => 'workflow' %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= image_tag "options" %>
|
||||
<%= link_to _('Enumerations'), :controller => 'enumerations' %>
|
||||
<%= link_to l(:label_enumerations), :controller => 'enumerations' %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= image_tag "mailer" %>
|
||||
<%= link_to _('Mail notifications'), :controller => 'admin', :action => 'mail_options' %>
|
||||
<%= link_to l(:field_mail_notification), :controller => 'admin', :action => 'mail_options' %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= image_tag "login" %>
|
||||
<%= link_to l(:label_authentication), :controller => 'auth_sources' %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= image_tag "help" %>
|
||||
<%= link_to _('Information'), :controller => 'admin', :action => 'info' %>
|
||||
<%= link_to l(:label_information_plural), :controller => 'admin', :action => 'info' %>
|
||||
</p>
|
||||
@@ -1,8 +1,8 @@
|
||||
<h2><%=_('Information')%></h2>
|
||||
<h2><%=l(:label_information_plural)%></h2>
|
||||
|
||||
<p><%=_('Version')%>: <strong><%= RDM_APP_NAME %> <%= RDM_APP_VERSION %></strong></p>
|
||||
<p><%=l(:field_version)%>: <strong><%= RDM_APP_NAME %> <%= RDM_APP_VERSION %></strong></p>
|
||||
|
||||
Environment:
|
||||
<%=l(:label_environment)%>:
|
||||
<ul>
|
||||
<% Rails::Info.properties.each do |name, value| %>
|
||||
<li><%= name %>: <%= value %></li>
|
||||
|
||||
@@ -1,16 +1,24 @@
|
||||
<h2><%=_('Mail notifications')%></h2>
|
||||
|
||||
<p><%=_('Select actions for which mail notification should be enabled.')%></p>
|
||||
<h2><%=l(:field_mail_notification)%></h2>
|
||||
|
||||
<%= start_form_tag ({}, :id => 'mail_options_form')%>
|
||||
<% for action in @actions %>
|
||||
<%= check_box_tag "action_ids[]", action.id, action.mail_enabled? %>
|
||||
<%= action.descr %><br />
|
||||
|
||||
<div class="box">
|
||||
<p><%=l(:text_select_mail_notifications)%></p>
|
||||
|
||||
<% actions = @actions.group_by {|p| p.group_id } %>
|
||||
<% actions.keys.sort.each do |group_id| %>
|
||||
<fieldset style="margin-top: 6px;"><legend><strong><%= l(Permission::GROUPS[group_id]) %></strong></legend>
|
||||
<% actions[group_id].each do |p| %>
|
||||
<div style="width:170px;float:left;"><%= check_box_tag "action_ids[]", p.id, p.mail_enabled? %>
|
||||
<%= l(p.description.to_sym) %>
|
||||
</div>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<br />
|
||||
<p>
|
||||
<a href="javascript:checkAll('mail_options_form', true)"><%=_('Check all')%></a> |
|
||||
<a href="javascript:checkAll('mail_options_form', false)"><%=_('Uncheck all')%></a>
|
||||
</p>
|
||||
<%= submit_tag _('Save') %>
|
||||
<%= end_form_tag %>
|
||||
<p><%= check_all_links 'mail_options_form' %></p>
|
||||
</div>
|
||||
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%= end_form_tag %>
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
<h2><%=_('Projects')%></h2>
|
||||
<h2><%=l(:label_project_plural)%></h2>
|
||||
|
||||
<table width="100%" cellspacing="1" cellpadding="2" class="listTableContent">
|
||||
<table class="listTableContent">
|
||||
<tr class="ListHead">
|
||||
<%= sort_header_tag('name', :caption => _('Project')) %>
|
||||
<th><%=_('Description')%></th>
|
||||
<th><%=_('Public')%></th>
|
||||
<th><%=_('Subprojects')%></th>
|
||||
<%= sort_header_tag('created_on', :caption => _('Created on')) %>
|
||||
<%= sort_header_tag('name', :caption => l(:label_project)) %>
|
||||
<th><%=l(:field_description)%></th>
|
||||
<th><%=l(:field_is_public)%></th>
|
||||
<th><%=l(:label_subproject_plural)%></th>
|
||||
<%= sort_header_tag('created_on', :caption => l(:field_created_on)) %>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% for project in @projects %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td><%= link_to project.name, :controller => 'projects', :action => 'settings', :id => project %>
|
||||
<td><%= project.descr %>
|
||||
<td><%= project.description %>
|
||||
<td align="center"><%= image_tag 'true' if project.is_public? %>
|
||||
<td align="center"><%= project.projects_count %>
|
||||
<td align="center"><%= format_date(project.created_on) %>
|
||||
<td align="center">
|
||||
<%= start_form_tag({:controller => 'projects', :action => 'destroy', :id => project}) %>
|
||||
<%= submit_tag _('Delete'), :class => "button-small" %>
|
||||
<%= end_form_tag %>
|
||||
<td align="center">
|
||||
<%= button_to l(:button_delete), { :controller => 'projects', :action => 'destroy', :id => project }, :class => "button-small" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
@@ -29,4 +27,4 @@
|
||||
<p><%= pagination_links_full @project_pages %>
|
||||
[ <%= @project_pages.current.first_item %> - <%= @project_pages.current.last_item %> / <%= @project_count %> ]</p>
|
||||
|
||||
<p><%= link_to ('» ' + _('New project')), :controller => 'projects', :action => 'add' %></p>
|
||||
<p><%= link_to ('» ' + l(:label_project_new)), :controller => 'projects', :action => 'add' %></p>
|
||||
45
redmine/app/views/auth_sources/_form.rhtml
Normal file
45
redmine/app/views/auth_sources/_form.rhtml
Normal file
@@ -0,0 +1,45 @@
|
||||
<%= error_messages_for 'auth_source' %>
|
||||
|
||||
<div class="box">
|
||||
<!--[form:auth_source]-->
|
||||
<p><label for="auth_source_name"><%=l(:field_name)%> <span class="required">*</span></label>
|
||||
<%= text_field 'auth_source', 'name' %></p>
|
||||
|
||||
<p><label for="auth_source_host"><%=l(:field_host)%> <span class="required">*</span></label>
|
||||
<%= text_field 'auth_source', 'host' %></p>
|
||||
|
||||
<p><label for="auth_source_port"><%=l(:field_port)%> <span class="required">*</span></label>
|
||||
<%= text_field 'auth_source', 'port', :size => 6 %></p>
|
||||
|
||||
<p><label for="auth_source_account"><%=l(:field_account)%></label>
|
||||
<%= text_field 'auth_source', 'account' %></p>
|
||||
|
||||
<p><label for="auth_source_account_password"><%=l(:field_password)%></label>
|
||||
<%= password_field 'auth_source', 'account_password' %></p>
|
||||
|
||||
<p><label for="auth_source_base_dn"><%=l(:field_base_dn)%> <span class="required">*</span></label>
|
||||
<%= text_field 'auth_source', 'base_dn', :size => 60 %></p>
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<p><label for="auth_source_onthefly_register"><%=l(:field_onthefly)%></label>
|
||||
<%= check_box 'auth_source', 'onthefly_register' %></p>
|
||||
|
||||
<p>
|
||||
<fieldset><legend><%=l(:label_attribute_plural)%></legend>
|
||||
<p><label for="auth_source_attr_login"><%=l(:field_login)%> <span class="required">*</span></label>
|
||||
<%= text_field 'auth_source', 'attr_login', :size => 20 %></p>
|
||||
|
||||
<p><label for="auth_source_attr_firstname"><%=l(:field_firstname)%></label>
|
||||
<%= text_field 'auth_source', 'attr_firstname', :size => 20 %></p>
|
||||
|
||||
<p><label for="auth_source_attr_lastname"><%=l(:field_lastname)%></label>
|
||||
<%= text_field 'auth_source', 'attr_lastname', :size => 20 %></p>
|
||||
|
||||
<p><label for="auth_source_attr_mail"><%=l(:field_mail)%></label>
|
||||
<%= text_field 'auth_source', 'attr_mail', :size => 20 %></p>
|
||||
</fieldset>
|
||||
</p>
|
||||
</div>
|
||||
<!--[eoform:auth_source]-->
|
||||
|
||||
7
redmine/app/views/auth_sources/edit.rhtml
Normal file
7
redmine/app/views/auth_sources/edit.rhtml
Normal file
@@ -0,0 +1,7 @@
|
||||
<h2><%=l(:label_auth_source)%> (<%= @auth_source.auth_method_name %>)</h2>
|
||||
|
||||
<%= start_form_tag({:action => 'update', :id => @auth_source}, :class => "tabular") %>
|
||||
<%= render :partial => 'form' %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%= end_form_tag %>
|
||||
|
||||
30
redmine/app/views/auth_sources/list.rhtml
Normal file
30
redmine/app/views/auth_sources/list.rhtml
Normal file
@@ -0,0 +1,30 @@
|
||||
<h2><%=l(:label_auth_source_plural)%></h2>
|
||||
|
||||
<table class="listTableContent">
|
||||
<tr class="ListHead">
|
||||
<td><%=l(:field_name)%></td>
|
||||
<td><%=l(:field_type)%></td>
|
||||
<td><%=l(:field_host)%></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<% for source in @auth_sources %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td><%= link_to source.name, :action => 'edit', :id => source%></td>
|
||||
<td align="center"><%= source.auth_method_name %></td>
|
||||
<td align="center"><%= source.host %></td>
|
||||
<td align="center">
|
||||
<%= link_to l(:button_test), :action => 'test_connection', :id => source %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= button_to l(:button_delete), { :action => 'destroy', :id => source }, :confirm => l(:text_are_you_sure), :class => "button-small" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<%= pagination_links_full @auth_source_pages %>
|
||||
<br />
|
||||
<%= link_to '» ' + l(:label_auth_source_new), :action => 'new' %>
|
||||
|
||||
6
redmine/app/views/auth_sources/new.rhtml
Normal file
6
redmine/app/views/auth_sources/new.rhtml
Normal file
@@ -0,0 +1,6 @@
|
||||
<h2><%=l(:label_auth_source_new)%> (<%= @auth_source.auth_method_name %>)</h2>
|
||||
|
||||
<%= start_form_tag({:action => 'create'}, :class => "tabular") %>
|
||||
<%= render :partial => 'form' %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= end_form_tag %>
|
||||
@@ -1,26 +1,52 @@
|
||||
<%= error_messages_for 'custom_field' %>
|
||||
|
||||
<!--[form:custom_field]-->
|
||||
<p><label for="custom_field_name"><%=_('Name')%></label><br/>
|
||||
<%= text_field 'custom_field', 'name' %></p>
|
||||
<div class="box">
|
||||
<p><label for="custom_field_name"><%=l(:field_name)%><span class="required"> *</span></label>
|
||||
<%= text_field 'custom_field', 'name' %></p>
|
||||
|
||||
<p><label for="custom_field_typ"><%=_('Type')%></label><br/>
|
||||
<%= select("custom_field", "typ", CustomField::TYPES) %></p>
|
||||
<p><label for="custom_field_field_format"><%=l(:field_field_format)%></label>
|
||||
<%= select("custom_field", "field_format", custom_field_formats_for_select) %></p>
|
||||
|
||||
<p><%= check_box 'custom_field', 'is_required' %>
|
||||
<label for="custom_field_is_required"><%=_('Required')%></label></p>
|
||||
|
||||
<p><%= check_box 'custom_field', 'is_for_all' %>
|
||||
<label for="custom_field_is_for_all"><%=_('For all projects')%></label></p>
|
||||
|
||||
<p><label for="custom_field_min_length"><%=_('Min - max length')%></label> (<%=_('0 means no restriction')%>)<br/>
|
||||
<p><label for="custom_field_min_length"><%=l(:label_min_max_length)%></label>
|
||||
<%= text_field 'custom_field', 'min_length', :size => 5 %> -
|
||||
<%= text_field 'custom_field', 'max_length', :size => 5 %></p>
|
||||
<%= text_field 'custom_field', 'max_length', :size => 5 %><br>(<%=l(:text_min_max_length_info)%>)</p>
|
||||
|
||||
<p><label for="custom_field_regexp"><%=_('Regular expression pattern')%></label> (eg. ^[A-Z0-9]+$)<br/>
|
||||
<%= text_field 'custom_field', 'regexp', :size => 50 %></p>
|
||||
<p><label for="custom_field_regexp"><%=l(:field_regexp)%></label>
|
||||
<%= text_field 'custom_field', 'regexp', :size => 50 %><br>(<%=l(:text_regexp_info)%>)</p>
|
||||
|
||||
<p><label for="custom_field_possible_values"><%=_('Possible values')%></label> (separator: |)<br/>
|
||||
<%= text_area 'custom_field', 'possible_values', :rows => 5, :cols => 60 %></p>
|
||||
<p><label for="custom_field_possible_values"><%=l(:field_possible_values)%></label>
|
||||
<%= text_area 'custom_field', 'possible_values', :rows => 5, :cols => 60 %><br>(<%=l(:text_possible_values_info)%>)</p>
|
||||
</div>
|
||||
<!--[eoform:custom_field]-->
|
||||
|
||||
<div class="box">
|
||||
<% case type.to_s
|
||||
when "IssueCustomField" %>
|
||||
|
||||
<fieldset><legend><%=l(:label_tracker_plural)%></legend>
|
||||
<% for tracker in @trackers %>
|
||||
<input type="checkbox"
|
||||
name="tracker_ids[]"
|
||||
value="<%= tracker.id %>"
|
||||
<%if @custom_field.trackers.include? tracker%>checked="checked"<%end%>
|
||||
> <%= tracker.name %>
|
||||
<% end %></fieldset>
|
||||
|
||||
|
||||
<p><label for="custom_field_is_required"><%=l(:field_is_required)%></label>
|
||||
<%= check_box 'custom_field', 'is_required' %></p>
|
||||
|
||||
<p><label for="custom_field_is_for_all"><%=l(:field_is_for_all)%></label>
|
||||
<%= check_box 'custom_field', 'is_for_all' %></p>
|
||||
|
||||
<% when "UserCustomField" %>
|
||||
<p><label for="custom_field_is_required"><%=l(:field_is_required)%></label>
|
||||
<%= check_box 'custom_field', 'is_required' %></p>
|
||||
|
||||
<% when "ProjectCustomField" %>
|
||||
<p><label for="custom_field_is_required"><%=l(:field_is_required)%></label>
|
||||
<%= check_box 'custom_field', 'is_required' %></p>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<h2><%=_('Custom field')%></h2>
|
||||
<h2><%=l(:label_custom_field)%> (<%=l(@custom_field.type_name)%>)</h2>
|
||||
|
||||
<%= start_form_tag :action => 'edit', :id => @custom_field %>
|
||||
<%= render :partial => 'form' %>
|
||||
<%= submit_tag _('Save') %>
|
||||
<%= start_form_tag({:action => 'edit', :id => @custom_field}, :class => "tabular") %>
|
||||
<%= render :partial => 'form', :locals => { :type => @custom_field.type } %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%= end_form_tag %>
|
||||
|
||||
@@ -1,32 +1,36 @@
|
||||
<h2><%=_('Custom fields')%></h2>
|
||||
<h2><%=l(:label_custom_field_plural)%></h2>
|
||||
|
||||
<table border="0" cellspacing="1" cellpadding="2" class="listTableContent">
|
||||
<table class="listTableContent">
|
||||
<tr class="ListHead">
|
||||
<th><%=_('Name')%></th>
|
||||
<th><%=_('Type')%></th>
|
||||
<th><%=_('Required')%></th>
|
||||
<th><%=_('For all projects')%></th>
|
||||
<th><%=_('Used by')%></th>
|
||||
<th><%=l(:field_name)%></th>
|
||||
<th><%=l(:field_type)%></th>
|
||||
<th><%=l(:field_field_format)%></th>
|
||||
<th><%=l(:field_is_required)%></th>
|
||||
<th><%=l(:field_is_for_all)%></th>
|
||||
<th><%=l(:label_used_by)%></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<% for custom_field in @custom_fields %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td><%= link_to custom_field.name, :action => 'edit', :id => custom_field %></td>
|
||||
<td align="center"><%= CustomField::TYPES[custom_field.typ][0] %></td>
|
||||
<td align="center"><%= l(custom_field.type_name) %></td>
|
||||
<td align="center"><%= l(CustomField::FIELD_FORMATS[custom_field.field_format]) %></td>
|
||||
<td align="center"><%= image_tag 'true' if custom_field.is_required? %></td>
|
||||
<td align="center"><%= image_tag 'true' if custom_field.is_for_all? %></td>
|
||||
<td align="center"><%= custom_field.projects.count.to_s + ' ' + _('Project') + '(s)' unless custom_field.is_for_all? %></td>
|
||||
<td align="center"><%= custom_field.projects.count.to_s + ' ' + lwr(:label_project, custom_field.projects.count) if custom_field.is_a? IssueCustomField and !custom_field.is_for_all? %></td>
|
||||
<td align="center">
|
||||
<%= start_form_tag :action => 'destroy', :id => custom_field %>
|
||||
<%= submit_tag _('Delete'), :class => "button-small" %>
|
||||
<%= end_form_tag %> </td>
|
||||
<%= button_to l(:button_delete), { :action => 'destroy', :id => custom_field }, :confirm => l(:text_are_you_sure), :class => "button-small" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<%= link_to ('« ' + _('Previous')), { :page => @custom_field_pages.current.previous } if @custom_field_pages.current.previous %>
|
||||
<%= link_to (_('Next') + ' »'), { :page => @custom_field_pages.current.next } if @custom_field_pages.current.next %>
|
||||
<%= pagination_links_full @custom_field_pages %>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to ('» ' + _('New custom field')), :action => 'new' %>
|
||||
<%=l(:label_custom_field_new)%>:
|
||||
<ul>
|
||||
<li><%= link_to l(:label_issue_plural), :action => 'new', :type => 'IssueCustomField' %></li>
|
||||
<li><%= link_to l(:label_project_plural), :action => 'new', :type => 'ProjectCustomField' %></li>
|
||||
<li><%= link_to l(:label_user_plural), :action => 'new', :type => 'UserCustomField' %></li>
|
||||
</ul>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<h2><%=_('New custom field')%></h2>
|
||||
<h2><%=l(:label_custom_field_new)%> (<%=l(@custom_field.type_name)%>)</h2>
|
||||
|
||||
<%= start_form_tag :action => 'new' %>
|
||||
<%= render :partial => 'form' %>
|
||||
<%= submit_tag _('Create') %>
|
||||
<%= start_form_tag({:action => 'new'}, :class => "tabular") %>
|
||||
<%= render :partial => 'form', :locals => { :type => @custom_field.type } %>
|
||||
<%= hidden_field_tag 'type', @custom_field.type %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%= end_form_tag %>
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<%= error_messages_for 'document' %>
|
||||
|
||||
<div class="box">
|
||||
<!--[form:document]-->
|
||||
<p><label for="document_category_id"><%=_('Category')%></label><br />
|
||||
<p><label for="document_category_id"><%=l(:field_category)%></label>
|
||||
<select name="document[category_id]">
|
||||
<%= options_from_collection_for_select @categories, "id", "name",@document.category_id %>
|
||||
<%= options_from_collection_for_select @categories, "id", "name", @document.category_id %>
|
||||
</select></p>
|
||||
|
||||
<p><label for="document_title"><%=_('Title')%> <span class="required">*</span></label><br />
|
||||
<p><label for="document_title"><%=l(:field_title)%> <span class="required">*</span></label>
|
||||
<%= text_field 'document', 'title', :size => 60 %></p>
|
||||
|
||||
<p><label for="document_descr"><%=_('Description')%> <span class="required">*</span></label><br />
|
||||
<%= text_area 'document', 'descr', :cols => 60, :rows => 5 %></p>
|
||||
<p><label for="document_description"><%=l(:field_description)%></label>
|
||||
<%= text_area 'document', 'description', :cols => 60, :rows => 5 %></p>
|
||||
<!--[eoform:document]-->
|
||||
|
||||
</div>
|
||||
@@ -1,8 +1,8 @@
|
||||
<h2><%=_('Document')%></h2>
|
||||
<h2><%=l(:label_document)%></h2>
|
||||
|
||||
<%= start_form_tag :action => 'edit', :id => @document %>
|
||||
<%= start_form_tag({:action => 'edit', :id => @document}, :class => "tabular") %>
|
||||
<%= render :partial => 'form' %>
|
||||
<%= submit_tag _('Save') %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%= end_form_tag %>
|
||||
|
||||
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
<h2><%= @document.title %></h2>
|
||||
|
||||
<strong><%=_('Description')%>:</strong> <%= @document.descr %><br />
|
||||
<strong><%=_('Category')%>:</strong> <%= @document.category.name %><br />
|
||||
<strong><%=l(:field_description)%>:</strong> <%= @document.description %><br />
|
||||
<strong><%=l(:field_category)%>:</strong> <%= @document.category.name %><br />
|
||||
<br />
|
||||
|
||||
<% if authorize_for('documents', 'edit') %>
|
||||
<%= start_form_tag ({ :controller => 'documents', :action => 'edit', :id => @document }, :method => 'get' ) %>
|
||||
<%= submit_tag _('Edit') %>
|
||||
<%= start_form_tag({ :controller => 'documents', :action => 'edit', :id => @document }, :method => 'get' ) %>
|
||||
<%= submit_tag l(:button_edit) %>
|
||||
<%= end_form_tag %>
|
||||
<% end %>
|
||||
|
||||
<% if authorize_for('documents', 'destroy') %>
|
||||
<%= start_form_tag ({ :controller => 'documents', :action => 'destroy', :id => @document } ) %>
|
||||
<%= submit_tag _('Delete') %>
|
||||
<%= start_form_tag({ :controller => 'documents', :action => 'destroy', :id => @document } ) %>
|
||||
<%= submit_tag l(:button_delete) %>
|
||||
<%= end_form_tag %>
|
||||
<% end %>
|
||||
|
||||
<br /><br />
|
||||
|
||||
<table border="0" cellspacing="1" cellpadding="2" width="100%">
|
||||
<% for attachment in @document.attachments %>
|
||||
<tr style="background-color:#CEE1ED">
|
||||
<table class="listTableContent">
|
||||
<% for attachment in @attachments %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td><%= format_date(attachment.created_on) %></td>
|
||||
<td><%= link_to attachment.filename, :action => 'download', :id => @document, :attachment_id => attachment %></td>
|
||||
<td align="center"><%= format_date(attachment.created_on) %></td>
|
||||
<td align="center"><%= attachment.author.display_name %></td>
|
||||
<td><%= human_size(attachment.filesize) %><br /><%= attachment.downloads %> <%=_('download')%>(s)</td>
|
||||
<td><%= human_size(attachment.filesize) %><br /><%= lwr(:label_download, attachment.downloads) %></td>
|
||||
|
||||
<% if authorize_for('documents', 'destroy_attachment') %>
|
||||
<td align="center">
|
||||
<%= start_form_tag :action => 'destroy_attachment', :id => @document, :attachment_id => attachment %>
|
||||
<%= submit_tag _('Delete'), :class => "button-small" %>
|
||||
<%= submit_tag l(:button_delete), :class => "button-small" %>
|
||||
<%= end_form_tag %>
|
||||
</tr>
|
||||
<% end %>
|
||||
@@ -40,8 +40,8 @@
|
||||
|
||||
<% if authorize_for('documents', 'add_attachment') %>
|
||||
<%= start_form_tag ({ :controller => 'documents', :action => 'add_attachment', :id => @document }, :multipart => true) %>
|
||||
<%=_('Add file')%><br /><%= file_field 'attachment', 'file' %>
|
||||
<%= submit_tag _('Add') %>
|
||||
<%=l(:label_attachment_new)%><br /><%= file_field 'attachment', 'file' %>
|
||||
<%= submit_tag l(:button_add) %>
|
||||
<%= end_form_tag %>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<%= error_messages_for 'enumeration' %>
|
||||
|
||||
<div class="box">
|
||||
<!--[form:optvalue]-->
|
||||
<%= hidden_field 'enumeration', 'opt' %>
|
||||
|
||||
<p><label for="enumeration_name"><%=_('Name')%></label><br/>
|
||||
<p><label for="enumeration_name"><%=l(:field_name)%></label>
|
||||
<%= text_field 'enumeration', 'name' %></p>
|
||||
<!--[eoform:optvalue]-->
|
||||
|
||||
</div>
|
||||
@@ -1,10 +1,10 @@
|
||||
<h2><%=_('Enumerations')%></h2>
|
||||
<h2><%=l(:label_enumerations)%></h2>
|
||||
|
||||
<%= start_form_tag :action => 'update', :id => @enumeration %>
|
||||
<%= start_form_tag({:action => 'update', :id => @enumeration}, :class => "tabular") %>
|
||||
<%= render :partial => 'form' %>
|
||||
<%= submit_tag _('Save') %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%= end_form_tag %>
|
||||
|
||||
<%= start_form_tag :action => 'destroy', :id => @enumeration %>
|
||||
<%= submit_tag _('Delete') %>
|
||||
<%= submit_tag l(:button_delete) %>
|
||||
<%= end_form_tag %>
|
||||
@@ -1,22 +1,21 @@
|
||||
<h2><%=_('Enumerations')%></h2>
|
||||
<h2><%=l(:label_enumerations)%></h2>
|
||||
|
||||
<% for option in Enumeration::OPTIONS %>
|
||||
<% Enumeration::OPTIONS.each do |option, name| %>
|
||||
|
||||
<% if @params[:opt]==option[1] %>
|
||||
<% if @params[:opt]==option %>
|
||||
|
||||
<p><%= image_tag 'dir_open' %> <b><%=_ option[0] %></b></p>
|
||||
<p><%= image_tag 'dir_open' %> <b><%= l(name) %></b></p>
|
||||
<ul>
|
||||
<% for value in Enumeration::find(:all, :conditions => [ "opt = ?", option[1]]) %>
|
||||
<% for value in Enumeration.find(:all, :conditions => ["opt = ?", option]) %>
|
||||
<li><%= link_to value.name, :action => 'edit', :id => value %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><%= link_to ('» ' + _('New')), :action => 'new', :opt => option[1] %></li>
|
||||
<li><%= link_to ('» ' + l(:label_new)), :action => 'new', :opt => option %></li>
|
||||
</ul>
|
||||
|
||||
<% else %>
|
||||
<p><%= image_tag 'dir' %> <%= link_to _(option[0]), :opt => option[1] %></p>
|
||||
<p><%= image_tag 'dir' %> <%= link_to l(name), :opt => option %></p>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
@@ -1,6 +1,6 @@
|
||||
<h2><%=_('New enumeration')%></h2>
|
||||
<h2><%=l(:label_enumeration_new)%></h2>
|
||||
|
||||
<%= start_form_tag :action => 'create' %>
|
||||
<%= start_form_tag({:action => 'create'}, :class => "tabular") %>
|
||||
<%= render :partial => 'form' %>
|
||||
<%= submit_tag _('Create') %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= end_form_tag %>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<%= error_messages_for 'issue_category' %>
|
||||
|
||||
<!--[form:issue_category]-->
|
||||
<p><label for="issue_category_name"><%=_('Name')%></label><br/>
|
||||
<p><label for="issue_category_name"><%l(:field_name)%></label>
|
||||
<%= text_field 'issue_category', 'name' %></p>
|
||||
<!--[eoform:issue_category]-->
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<h2>Editing issue category</h2>
|
||||
<h2><%=l(:label_issue_category)%></h2>
|
||||
|
||||
<%= start_form_tag :action => 'edit', :id => @category %>
|
||||
<%= start_form_tag({:action => 'edit', :id => @category}, :class => "tabular") %>
|
||||
<%= render :partial => 'form' %>
|
||||
<%= submit_tag _('Save') %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%= end_form_tag %>
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
<%= error_messages_for 'issue_status' %>
|
||||
|
||||
<div class="box">
|
||||
<!--[form:issue_status]-->
|
||||
<p><label for="issue_status_name"><%=_('Name')%></label> <span class="required">*</span><br/>
|
||||
<p><label for="issue_status_name"><%=l(:field_name)%><span class="required"> *</span></label>
|
||||
<%= text_field 'issue_status', 'name' %></p>
|
||||
|
||||
<p><%= check_box 'issue_status', 'is_closed' %>
|
||||
<label for="issue_status_is_closed"><%=_('Issue closed')%></label></p>
|
||||
<p><label for="issue_status_is_closed"><%=l(:field_is_closed)%></label>
|
||||
<%= check_box 'issue_status', 'is_closed' %></p>
|
||||
|
||||
<p><%= check_box 'issue_status', 'is_default' %>
|
||||
<label for="issue_status_is_default"><%=_('Default status')%></label></p>
|
||||
<p><label for="issue_status_is_default"><%=l(:field_is_default)%></label>
|
||||
<%= check_box 'issue_status', 'is_default' %></p>
|
||||
|
||||
<p><label for="issue_status_html_color"><%=_('Color')%></label>
|
||||
#<%= text_field 'issue_status', 'html_color', :maxlength => 6 %> <span class="required">*</span></p>
|
||||
<p><label for="issue_status_html_color"><%=l(:field_html_color)%><span class="required"> *</span></label>
|
||||
#<%= text_field 'issue_status', 'html_color', :maxlength => 6 %></p>
|
||||
|
||||
<!--[eoform:issue_status]-->
|
||||
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
<h2><%=_('Issue status')%></h2>
|
||||
<h2><%=l(:label_issue_status)%></h2>
|
||||
|
||||
<%= start_form_tag :action => 'update', :id => @issue_status %>
|
||||
<%= start_form_tag({:action => 'update', :id => @issue_status}, :class => "tabular") %>
|
||||
<%= render :partial => 'form' %>
|
||||
<%= submit_tag _('Save') %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%= end_form_tag %>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<h2><%=_('Issue statuses')%></h2>
|
||||
<h2><%=l(:label_issue_status_plural)%></h2>
|
||||
|
||||
<table border="0" cellspacing="1" cellpadding="2" class="listTableContent">
|
||||
<table class="listTableContent">
|
||||
<tr class="ListHead">
|
||||
<th><%=_('Status')%></th>
|
||||
<th><%=_('Default status')%></th>
|
||||
<th><%=_('Issue closed')%></th>
|
||||
<th><%=_('Color')%></th>
|
||||
<th><%=l(:field_status)%></th>
|
||||
<th><%=l(:field_is_default)%></th>
|
||||
<th><%=l(:field_is_closed)%></th>
|
||||
<th><%=l(:field_html_color)%></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@@ -14,11 +14,9 @@
|
||||
<td><%= link_to status.name, :action => 'edit', :id => status %></td>
|
||||
<td align="center"><%= image_tag 'true' if status.is_default? %></td>
|
||||
<td align="center"><%= image_tag 'true' if status.is_closed? %></td>
|
||||
<td bgcolor="#<%= status.html_color %>"> </td>
|
||||
<td align="center">
|
||||
<%= start_form_tag :action => 'destroy', :id => status %>
|
||||
<%= submit_tag _('Delete'), :class => "button-small" %>
|
||||
<%= end_form_tag %>
|
||||
<td><div style="background-color:#<%= status.html_color %>"> </div></td>
|
||||
<td align="center">
|
||||
<%= button_to l(:button_delete), { :action => 'destroy', :id => status }, :confirm => l(:text_are_you_sure), :class => "button-small" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
@@ -27,4 +25,4 @@
|
||||
<%= pagination_links_full @issue_status_pages %>
|
||||
<br />
|
||||
|
||||
<%= link_to '» ' + _('New issue status'), :action => 'new' %>
|
||||
<%= link_to '» ' + l(:label_issue_status_new), :action => 'new' %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<h2><%=_('New issue status')%></h2>
|
||||
<h2><%=l(:label_issue_status_new)%></h2>
|
||||
|
||||
<%= start_form_tag :action => 'create' %>
|
||||
<%= start_form_tag({:action => 'create'}, :class => "tabular") %>
|
||||
<%= render :partial => 'form' %>
|
||||
<%= submit_tag _('Create') %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= end_form_tag %>
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
<% if issues.length > 0 %>
|
||||
<table cellspacing="0" cellpadding="1" width="100%" border="0" class="listTable">
|
||||
<tr><td>
|
||||
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="listTableContent">
|
||||
<tr class="ListHead">
|
||||
<th>#</th>
|
||||
<th><%=_('Tracker')%></th>
|
||||
<th><%=_('Subject')%></th>
|
||||
</tr>
|
||||
<% for issue in issues %>
|
||||
<tr bgcolor="#<%= issue.status.html_color %>">
|
||||
<td align="center">
|
||||
<%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %><br />
|
||||
</td>
|
||||
<td><p class="small"><%= issue.project.name %> - <%= issue.tracker.name %><br />
|
||||
<%= issue.status.name %> - <%= format_time(issue.updated_on) %></p></td>
|
||||
<td>
|
||||
<p class="small"><%= link_to issue.subject, :controller => 'issues', :action => 'show', :id => issue %></p>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</td>
|
||||
<table cellspacing="0" cellpadding="1" width="100%" border="0" class="listTable">
|
||||
<tr><td>
|
||||
<table class="listTableContent">
|
||||
<tr class="ListHead">
|
||||
<th>#</th>
|
||||
<th><%=l(:field_tracker)%></th>
|
||||
<th><%=l(:field_subject)%></th>
|
||||
</tr>
|
||||
</table>
|
||||
<% for issue in issues %>
|
||||
<tr bgcolor="#<%= issue.status.html_color %>">
|
||||
<td align="center">
|
||||
<%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %><br />
|
||||
</td>
|
||||
<td><p class="small"><%= issue.project.name %> - <%= issue.tracker.name %><br />
|
||||
<%= issue.status.name %> - <%= format_time(issue.updated_on) %></p></td>
|
||||
<td>
|
||||
<p class="small"><%= link_to issue.subject, :controller => 'issues', :action => 'show', :id => issue %></p>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% else %>
|
||||
<%=_('No issue')%>
|
||||
<i><%=l(:label_no_data)%></i>
|
||||
<% end %>
|
||||
@@ -1,29 +1,30 @@
|
||||
<h2><%=_('Issue')%> #<%= @issue.id %>: <%= @issue.subject %></h2>
|
||||
<h2><%=l(:label_issue)%> #<%= @issue.id %>: <%= @issue.subject %></h2>
|
||||
|
||||
<%= error_messages_for 'history' %>
|
||||
<%= start_form_tag :action => 'change_status', :id => @issue %>
|
||||
<%= start_form_tag({:action => 'change_status', :id => @issue}, :class => "tabular") %>
|
||||
|
||||
<%= hidden_field_tag 'confirm', 1 %>
|
||||
<%= hidden_field 'history', 'status_id' %>
|
||||
|
||||
<div class="box">
|
||||
<p><label><%=l(:label_issue_status_new)%></label> <%= @history.status.name %></p>
|
||||
|
||||
<p><%=_('New status')%>: <b><%= @history.status.name %></b></p>
|
||||
|
||||
<div>
|
||||
<p><label for="issue_assigned_to_id"><%=_('Assigned to')%></label><br/>
|
||||
<p><label for="issue_assigned_to_id"><%=l(:field_assigned_to)%></label>
|
||||
<select name="issue[assigned_to_id]">
|
||||
<option value=""></option>
|
||||
<%= options_from_collection_for_select @assignable_to, "id", "display_name", @issue.assigned_to_id %></p>
|
||||
</select></p>
|
||||
</div>
|
||||
|
||||
<p><label for="issue_fixed_version"><%=_('Fixed in version')%></label><br/>
|
||||
<p><label for="issue_fixed_version"><%=l(:field_fixed_version)%></label>
|
||||
<select name="issue[fixed_version_id]">
|
||||
<option value="">--none--</option>
|
||||
<%= options_from_collection_for_select @issue.project.versions, "id", "name", @issue.fixed_version_id %>
|
||||
</select></p>
|
||||
|
||||
<p><label for="history_notes"><%=_('Notes')%></label><br />
|
||||
<p><label for="history_notes"><%=l(:field_notes)%></label>
|
||||
<%= text_area 'history', 'notes', :cols => 60, :rows => 10 %></p>
|
||||
|
||||
<%= submit_tag _('Save') %>
|
||||
</div>
|
||||
|
||||
<%= hidden_field 'issue', 'lock_version' %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%= end_form_tag %>
|
||||
|
||||
@@ -1,62 +1,26 @@
|
||||
<h2><%=_('Issue')%> #<%= @issue.id %></h2>
|
||||
<h2><%= @issue.tracker.name %> #<%= @issue.id %> - <%= @issue.subject %></h2>
|
||||
|
||||
<%= error_messages_for 'issue' %>
|
||||
<%= start_form_tag :action => 'edit', :id => @issue %>
|
||||
<% labelled_tabular_form_for :issue, @issue, :url => {:action => 'edit'} do |f| %>
|
||||
<%= error_messages_for 'issue' %>
|
||||
<div class="box">
|
||||
<!--[form:issue]-->
|
||||
<p><label><%=l(:field_status)%></label> <%= @issue.status.name %></p>
|
||||
|
||||
<!--[form:issue]-->
|
||||
<p><%=_('Status')%>: <b><%= @issue.status.name %></b></p>
|
||||
<p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %></p>
|
||||
<p><%= f.select :assigned_to_id, (@issue.project.members.collect {|m| [m.name, m.user_id]}), :include_blank => true %></p>
|
||||
<p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}) %></p>
|
||||
<p><%= f.text_field :subject, :size => 80, :required => true %></p>
|
||||
<p><%= f.text_area :description, :cols => 60, :rows => 10, :required => true %></p>
|
||||
<p><%= f.date_select :due_date, :start_year => Date.today.year, :include_blank => true %></p>
|
||||
|
||||
<div style="float:left;margin-right:10px;">
|
||||
<p><label for="issue_tracker_id"><%=_('Tracker')%> <span class="required">*</span></label><br/>
|
||||
<select name="issue[tracker_id]">
|
||||
<%= options_from_collection_for_select @trackers, "id", "name", @issue.tracker_id %></p>
|
||||
</select></p>
|
||||
</div>
|
||||
|
||||
<div style="float:left;margin-right:10px;">
|
||||
<p><label for="issue_priority_id"><%=_('Priority')%> <span class="required">*</span></label><br/>
|
||||
<select name="issue[priority_id]">
|
||||
<%= options_from_collection_for_select @priorities, "id", "name", @issue.priority_id %></p>
|
||||
</select></p>
|
||||
</div>
|
||||
|
||||
<div style="float:left;margin-right:10px;">
|
||||
<p><label for="issue_assigned_to_id"><%=_('Assigned to')%></label><br/>
|
||||
<select name="issue[assigned_to_id]">
|
||||
<option value=""></option>
|
||||
<%= options_from_collection_for_select @issue.project.members, "user_id", "name", @issue.assigned_to_id %></p>
|
||||
</select></p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p><label for="issue_category_id"><%=_('Category')%></label><br/>
|
||||
<select name="issue[category_id]">
|
||||
<option value=""></option>
|
||||
<%= options_from_collection_for_select @project.issue_categories, "id", "name", @issue.category_id %></p>
|
||||
</select></p>
|
||||
</div>
|
||||
|
||||
<p><label for="issue_subject"><%=_('Subject')%></label><span class="required">*</span><br/>
|
||||
<%= text_field 'issue', 'subject', :size => 60 %></p>
|
||||
<% for @custom_value in @custom_values %>
|
||||
<p><%= custom_field_tag_with_label @custom_value %></p>
|
||||
<% end %>
|
||||
|
||||
<p><label for="issue_descr"><%=_('Description')%></label><span class="required">*</span><br/>
|
||||
<%= text_area 'issue', 'descr', :cols => 60, :rows => 10 %></p>
|
||||
|
||||
|
||||
<% for custom_value in @custom_values %>
|
||||
<p><%= content_tag "label", custom_value.custom_field.name %>
|
||||
<% if custom_value.custom_field.is_required? %><span class="required">*</span><% end %>
|
||||
<br />
|
||||
<%= custom_field_tag custom_value %></p>
|
||||
<% end %>
|
||||
|
||||
|
||||
<p><label for="issue_fixed_version"><%=_('Fixed in version')%></label><br/>
|
||||
<select name="issue[fixed_version_id]">
|
||||
<option value="">--none--</option>
|
||||
<%= options_from_collection_for_select @project.versions, "id", "name", @issue.fixed_version_id %>
|
||||
<p><%= f.select :fixed_version_id, (@project.versions.collect {|v| [v.name, v.id]}), { :include_blank => true } %>
|
||||
</select></p>
|
||||
<!--[eoform:issue]-->
|
||||
|
||||
<center><%= submit_tag _('Save') %></center>
|
||||
<%= end_form_tag %>
|
||||
<!--[eoform:issue]-->
|
||||
</div>
|
||||
<%= f.hidden_field :lock_version %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<% end %>
|
||||
@@ -1,39 +1,43 @@
|
||||
|
||||
<h2><%=_('Issue')%> #<%= @issue.id %> - <%= @issue.subject %></h2>
|
||||
<h2><%= @issue.tracker.name %> #<%= @issue.id %> - <%= @issue.subject %></h2>
|
||||
|
||||
<div class="box">
|
||||
<p><b><%=_('Tracker')%>:</b> <%= @issue.tracker.name %></p>
|
||||
<p><b><%=_('Priority')%>:</b> <%= @issue.priority.name %></p>
|
||||
<p><b><%=_('Category')%>:</b> <%= @issue.category.name unless @issue.category_id.nil? %></p>
|
||||
<p><b><%=_('Status')%>:</b> <%= @issue.status.name %></p>
|
||||
<p><b><%=_('Author')%>:</b> <%= @issue.author.display_name %></p>
|
||||
<p><b><%=_('Assigned to')%>:</b> <%= @issue.assigned_to.display_name unless @issue.assigned_to.nil? %></p>
|
||||
<p>
|
||||
<b><%=l(:field_status)%> :</b> <%= @issue.status.name %>    
|
||||
<b><%=l(:field_priority)%> :</b> <%= @issue.priority.name %>    
|
||||
<b><%=l(:field_assigned_to)%> :</b> <%= @issue.assigned_to ? @issue.assigned_to.display_name : "-" %>    
|
||||
<b><%=l(:field_category)%> :</b> <%= @issue.category ? @issue.category.name : "-" %>
|
||||
</p>
|
||||
<p><b><%=l(:field_author)%> :</b> <%= @issue.author.display_name %></p>
|
||||
<p><b><%=l(:field_subject)%> :</b> <%= @issue.subject %></p>
|
||||
<p><b><%=l(:field_description)%> :</b> <%= simple_format auto_link @issue.description %></p>
|
||||
<p><b><%=l(:field_due_date)%> :</b> <%= format_date(@issue.due_date) %></p>
|
||||
<p><b><%=l(:field_created_on)%> :</b> <%= format_date(@issue.created_on) %></p>
|
||||
|
||||
<p><b><%=_('Subject')%>:</b> <%= @issue.subject %></p>
|
||||
<p><b><%=_('Description')%>:</b> <%= simple_format auto_link @issue.descr %></p>
|
||||
<p><b><%=_('Created on')%>:</b> <%= format_date(@issue.created_on) %></p>
|
||||
<% for custom_value in @custom_values %>
|
||||
<p><b><%= custom_value.custom_field.name %></b> : <%= show_value custom_value %></p>
|
||||
<% end %>
|
||||
|
||||
<% if authorize_for('issues', 'edit') %>
|
||||
<%= start_form_tag ({:controller => 'issues', :action => 'edit', :id => @issue}, :method => "get" ) %>
|
||||
<%= submit_tag _('Edit') %>
|
||||
<%= submit_tag l(:button_edit) %>
|
||||
<%= end_form_tag %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<% if authorize_for('issues', 'change_status') and @status_options and !@status_options.empty? %>
|
||||
<%= start_form_tag ({:controller => 'issues', :action => 'change_status', :id => @issue}) %>
|
||||
<label for="history_status_id"><%=_('Change status')%>:</label>
|
||||
<label for="history_status_id"><%=l(:label_change_status)%> :</label>
|
||||
<select name="history[status_id]">
|
||||
<%= options_from_collection_for_select @status_options, "id", "name" %>
|
||||
</select>
|
||||
<%= submit_tag _ "Update..." %>
|
||||
<%= submit_tag l(:button_change) %>
|
||||
<%= end_form_tag %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<% if authorize_for('issues', 'destroy') %>
|
||||
<%= start_form_tag ({:controller => 'issues', :action => 'destroy', :id => @issue} ) %>
|
||||
<%= submit_tag _ "Delete" %>
|
||||
<%= submit_tag l(:button_delete) %>
|
||||
<%= end_form_tag %>
|
||||
|
||||
<% end %>
|
||||
@@ -43,9 +47,9 @@
|
||||
|
||||
<div class="splitcontentleft">
|
||||
<div class="box">
|
||||
<h3><%=_('History')%></h3>
|
||||
<h3><%=l(:label_history)%></h3>
|
||||
<table width="100%">
|
||||
<% for history in @issue.histories.find(:all, :include => :author) %>
|
||||
<% for history in @issue.histories.find(:all, :include => [:author, :status]) %>
|
||||
<tr>
|
||||
<td><%= format_date(history.created_on) %></td>
|
||||
<td><%= history.author.display_name %></td>
|
||||
@@ -61,7 +65,7 @@
|
||||
|
||||
<div class="splitcontentright">
|
||||
<div class="box">
|
||||
<h3><%=_('Attachments')%></h3>
|
||||
<h3><%=l(:label_attachment_plural)%></h3>
|
||||
<table width="100%">
|
||||
<% for attachment in @issue.attachments %>
|
||||
<tr>
|
||||
@@ -71,7 +75,7 @@
|
||||
<% if authorize_for('issues', 'destroy_attachment') %>
|
||||
<td>
|
||||
<%= start_form_tag :action => 'destroy_attachment', :id => @issue, :attachment_id => attachment %>
|
||||
<%= submit_tag _('Delete'), :class => "button-small" %>
|
||||
<%= submit_tag l(:button_delete), :class => "button-small" %>
|
||||
<%= end_form_tag %>
|
||||
</td>
|
||||
<% end %>
|
||||
@@ -81,8 +85,8 @@
|
||||
<br />
|
||||
<% if authorize_for('issues', 'add_attachment') %>
|
||||
<%= start_form_tag ({ :controller => 'issues', :action => 'add_attachment', :id => @issue }, :multipart => true) %>
|
||||
<%=_('Add file')%>: <%= file_field 'attachment', 'file' %>
|
||||
<%= submit_tag _('Add') %>
|
||||
<%=l(:label_attachment_new)%>: <%= file_field 'attachment', 'file' %>
|
||||
<%= submit_tag l(:button_add) %>
|
||||
<%= end_form_tag %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -1,13 +1,51 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<title>redMine</title>
|
||||
<title><%= $RDM_HEADER_TITLE %></title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<meta name="description" content="redMine" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= stylesheet_link_tag "application" %>
|
||||
<%= stylesheet_link_tag "menu" %>
|
||||
<%= stylesheet_link_tag "rails" %>
|
||||
<%= javascript_include_tag :defaults %>
|
||||
<%= javascript_include_tag 'menu' %>
|
||||
|
||||
<script type='text/javascript'>
|
||||
var menu_contenu=' \
|
||||
<div id="menuAdmin" class="menu" onmouseover="menuMouseover(event)"> \
|
||||
<a class="menuItem" href="\/admin\/projects" onmouseover="menuItemMouseover(event,\'menuProjects\');"><span class="menuItemText"><%=l(:label_project_plural)%><\/span><span class="menuItemArrow">▶<\/span><\/a> \
|
||||
<a class="menuItem" href="\/users" onmouseover="menuItemMouseover(event,\'menuUsers\');"><span class="menuItemText"><%=l(:label_user_plural)%><\/span><span class="menuItemArrow">▶<\/span><\/a> \
|
||||
<a class="menuItem" href="\/roles"><%=l(:label_role_and_permissions)%><\/a> \
|
||||
<a class="menuItem" href="\/trackers" onmouseover="menuItemMouseover(event,\'menuTrackers\');"><span class="menuItemText"><%=l(:label_tracker_plural)%><\/span><span class="menuItemArrow">▶<\/span><\/a> \
|
||||
<a class="menuItem" href="\/custom_fields"><%=l(:label_custom_field_plural)%><\/a> \
|
||||
<a class="menuItem" href="\/enumerations"><%=l(:label_enumerations)%><\/a> \
|
||||
<a class="menuItem" href="\/admin\/mail_options"><%=l(:field_mail_notification)%><\/a> \
|
||||
<a class="menuItem" href="\/auth_sources"><%=l(:label_authentication)%><\/a> \
|
||||
<a class="menuItem" href="\/admin\/info"><%=l(:label_information_plural)%><\/a> \
|
||||
<\/div> \
|
||||
<div id="menuTrackers" class="menu"> \
|
||||
<a class="menuItem" href="\/issue_statuses"><%=l(:label_issue_status_plural)%><\/a> \
|
||||
<a class="menuItem" href="\/roles\/workflow"><%=l(:label_workflow)%><\/a> \
|
||||
<\/div> \
|
||||
<div id="menuProjects" class="menu"><a class="menuItem" href="\/projects\/add"><%=l(:label_new)%><\/a><\/div> \
|
||||
<div id="menuUsers" class="menu"><a class="menuItem" href="\/users\/add"><%=l(:label_new)%><\/a><\/div> \
|
||||
\
|
||||
<% unless @project.nil? || @project.id.nil? %> \
|
||||
<div id="menuProject" class="menu" onmouseover="menuMouseover(event)"> \
|
||||
<%= link_to l(:label_issue_plural), {:controller => 'projects', :action => 'list_issues', :id => @project }, :class => "menuItem" %> \
|
||||
<%= link_to l(:label_report_plural), {:controller => 'reports', :action => 'issue_report', :id => @project }, :class => "menuItem" %> \
|
||||
<%= link_to l(:label_news_plural), {:controller => 'projects', :action => 'list_news', :id => @project }, :class => "menuItem" %> \
|
||||
<%= link_to l(:label_change_log), {:controller => 'projects', :action => 'changelog', :id => @project }, :class => "menuItem" %> \
|
||||
<%= link_to l(:label_document_plural), {:controller => 'projects', :action => 'list_documents', :id => @project }, :class => "menuItem" %> \
|
||||
<%= link_to l(:label_member_plural), {:controller => 'projects', :action => 'list_members', :id => @project }, :class => "menuItem" %> \
|
||||
<%= link_to l(:label_attachment_plural), {:controller => 'projects', :action => 'list_files', :id => @project }, :class => "menuItem" %> \
|
||||
<%= link_to_if_authorized l(:label_settings), {:controller => 'projects', :action => 'settings', :id => @project }, :class => "menuItem" %> \
|
||||
<\/div> \
|
||||
<% end %> \
|
||||
';
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -15,64 +53,68 @@
|
||||
|
||||
<div id="header">
|
||||
<div style="float: left;">
|
||||
<h1><%= RDM_APP_NAME %></h1>
|
||||
<h2>Project management</h2>
|
||||
<h1><%= $RDM_HEADER_TITLE %></h1>
|
||||
<h2><%= $RDM_HEADER_SUBTITLE %></h2>
|
||||
</div>
|
||||
<div style="float: right; padding-right: 1em; padding-top: 0.2em;">
|
||||
<% unless session[:user].nil? %><small><%=_('Logged as')%> <b><%= session[:user].login %></b></small><% end %>
|
||||
<% if loggedin? %><small><%=l(:label_logged_as)%> <b><%= @logged_in_user.login %></b></small><% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="navigation">
|
||||
<ul>
|
||||
<li class="selected"><%= link_to _('Home'), { :controller => '' }, :class => "picHome" %></li>
|
||||
<li><%= link_to _('My page'), { :controller => 'account', :action => 'my_page'}, :class => "picUserPage" %></li>
|
||||
<li><%= link_to _('Projects'), { :controller => 'projects' }, :class => "picProject" %></li>
|
||||
<li class="selected"><%= link_to l(:label_home), { :controller => '' }, :class => "picHome" %></li>
|
||||
<li><%= link_to l(:label_my_page), { :controller => 'account', :action => 'my_page'}, :class => "picUserPage" %></li>
|
||||
<li><%= link_to l(:label_project_plural), { :controller => 'projects' }, :class => "picProject" %></li>
|
||||
|
||||
<% unless session[:user].nil? %>
|
||||
<li><%= link_to _('My account'), { :controller => 'account', :action => 'my_account' }, :class => "picUser" %></li>
|
||||
<% end %>
|
||||
<% unless @project.nil? || @project.id.nil? %>
|
||||
<li><%= link_to @project.name, { :controller => 'projects', :action => 'show', :id => @project }, :class => "picProject", :onmouseover => "buttonMouseover(event, 'menuProject');" %></li>
|
||||
<% end %>
|
||||
|
||||
<% if admin_loggedin? %>
|
||||
<li><%= link_to _('Administration'), { :controller => 'admin' }, :class => "picAdmin" %></li>
|
||||
<% end %>
|
||||
<% if loggedin? %>
|
||||
<li><%= link_to l(:label_my_account), { :controller => 'account', :action => 'my_account' }, :class => "picUser" %></li>
|
||||
<% end %>
|
||||
|
||||
<li class="right"><%= link_to _('Help'), { :controller => 'help', :ctrl => @params[:controller], :page => @params[:action] }, :target => "new", :class => "picHelp" %></li>
|
||||
<% if session[:user].nil? %>
|
||||
<li class="right"><%= link_to _('Log in'), { :controller => 'account', :action => 'login' }, :class => "picUser" %></li>
|
||||
<% else %>
|
||||
<li class="right"><%= link_to _('Logout'), { :controller => 'account', :action => 'logout' }, :class => "picUser" %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<% if admin_loggedin? %>
|
||||
<li><%= 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>
|
||||
|
||||
<% if loggedin? %>
|
||||
<li class="right"><%= link_to l(:label_logout), { :controller => 'account', :action => 'logout' }, :class => "picUser" %></li>
|
||||
<% else %>
|
||||
<li class="right"><%= link_to l(:label_login), { :controller => 'account', :action => 'login' }, :class => "picUser" %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<script type='text/javascript'>if(document.getElementById) {document.write(menu_contenu);}</script>
|
||||
|
||||
<div id="subcontent">
|
||||
|
||||
<% unless @project.nil? || @project.id.nil? %>
|
||||
<h2><%= @project.name %></h2>
|
||||
<ul class="menublock">
|
||||
<li><%= link_to _('Overview'), :controller => 'projects', :action => 'show', :id => @project %></li>
|
||||
<li><%= link_to _('Issues'), :controller => 'projects', :action => 'list_issues', :id => @project %></li>
|
||||
<li><%= link_to _('Reports'), :controller => 'reports', :action => 'issue_report', :id => @project %></li>
|
||||
<li><%= link_to _('News'), :controller => 'projects', :action => 'list_news', :id => @project %></li>
|
||||
<li><%= link_to _('Change log'), :controller => 'projects', :action => 'changelog', :id => @project %></li>
|
||||
<li><%= link_to _('Documents'), :controller => 'projects', :action => 'list_documents', :id => @project %></li>
|
||||
<li><%= link_to _('Members'), :controller => 'projects', :action => 'list_members', :id => @project %></li>
|
||||
<li><%= link_to _('Files'), :controller => 'projects', :action => 'list_files', :id => @project %></li>
|
||||
<li><%= link_to_if_authorized _('Settings'), :controller => 'projects', :action => 'settings', :id => @project %></li>
|
||||
<li><%= link_to l(:label_overview), :controller => 'projects', :action => 'show', :id => @project %></li>
|
||||
<li><%= link_to l(:label_issue_plural), :controller => 'projects', :action => 'list_issues', :id => @project %></li>
|
||||
<li><%= link_to l(:label_report_plural), :controller => 'reports', :action => 'issue_report', :id => @project %></li>
|
||||
<li><%= link_to l(:label_news_plural), :controller => 'projects', :action => 'list_news', :id => @project %></li>
|
||||
<li><%= link_to l(:label_change_log), :controller => 'projects', :action => 'changelog', :id => @project %></li>
|
||||
<li><%= link_to l(:label_document_plural), :controller => 'projects', :action => 'list_documents', :id => @project %></li>
|
||||
<li><%= link_to l(:label_member_plural), :controller => 'projects', :action => 'list_members', :id => @project %></li>
|
||||
<li><%= link_to l(:label_attachment_plural), :controller => 'projects', :action => 'list_files', :id => @project %></li>
|
||||
<li><%= link_to_if_authorized l(:label_settings), :controller => 'projects', :action => 'settings', :id => @project %></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<% unless session[:user].nil? %>
|
||||
<h2><%=_('My projects') %></h2>
|
||||
<% if loggedin? and @logged_in_user.memberships.length > 0 %>
|
||||
<h2><%=l(:label_my_projects) %></h2>
|
||||
<ul class="menublock">
|
||||
<% for membership in session[:user].memberships %>
|
||||
<% for membership in @logged_in_user.memberships %>
|
||||
<li><%= link_to membership.project.name, :controller => 'projects', :action => 'show', :id => membership.project %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
@@ -81,7 +123,10 @@
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
<p><a href="http://redmine.org/" target="_new"><%= RDM_APP_NAME %></a> <%= RDM_APP_VERSION %></p>
|
||||
<p>
|
||||
<%= auto_link $RDM_FOOTER_SIG %> |
|
||||
<a href="http://redmine.org/" target="_new"><%= RDM_APP_NAME %></a> <%= RDM_APP_VERSION %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<%=_('Issue')%> #<%= issue.id %> - <%= issue.subject %>
|
||||
<%=_('Author')%>: <%= issue.author.display_name %>
|
||||
<%=l(:label_issue)%> #<%= issue.id %> - <%= issue.subject %>
|
||||
<%=l(:field_author)%>: <%= issue.author.display_name %>
|
||||
|
||||
<%= issue.descr %>
|
||||
<%= issue.description %>
|
||||
|
||||
http://<%= RDM_HOST_NAME %>/issues/show/<%= issue.id %>
|
||||
http://<%= $RDM_HOST_NAME %>/issues/show/<%= issue.id %>
|
||||
3
redmine/app/views/mailer/issue_add_fr.rhtml
Normal file
3
redmine/app/views/mailer/issue_add_fr.rhtml
Normal file
@@ -0,0 +1,3 @@
|
||||
Une nouvelle demande (#<%= @issue.id %>) a été soumise.
|
||||
----------------------------------------
|
||||
<%= render :file => "_issue", :use_full_path => true, :locals => { :issue => @issue } %>
|
||||
3
redmine/app/views/mailer/issue_change_status_fr.rhtml
Normal file
3
redmine/app/views/mailer/issue_change_status_fr.rhtml
Normal file
@@ -0,0 +1,3 @@
|
||||
La demande #<%= @issue.id %> a été mise à jour au statut "<%= @issue.status.name %>".
|
||||
----------------------------------------
|
||||
<%= render :file => "_issue", :use_full_path => true, :locals => { :issue => @issue } %>
|
||||
3
redmine/app/views/mailer/lost_password_en.rhtml
Normal file
3
redmine/app/views/mailer/lost_password_en.rhtml
Normal file
@@ -0,0 +1,3 @@
|
||||
To change your password, use the following link:
|
||||
|
||||
http://<%= $RDM_HOST_NAME %>/account/lost_password?token=<%= @token.value %>
|
||||
3
redmine/app/views/mailer/lost_password_fr.rhtml
Normal file
3
redmine/app/views/mailer/lost_password_fr.rhtml
Normal file
@@ -0,0 +1,3 @@
|
||||
Pour changer votre mot de passe, utilisez le lien suivant:
|
||||
|
||||
http://<%= $RDM_HOST_NAME %>/account/lost_password?token=<%= @token.value %>
|
||||
3
redmine/app/views/mailer/register_en.rhtml
Normal file
3
redmine/app/views/mailer/register_en.rhtml
Normal file
@@ -0,0 +1,3 @@
|
||||
To activate your redMine account, use the following link:
|
||||
|
||||
http://<%= $RDM_HOST_NAME %>/account/register?token=<%= @token.value %>
|
||||
3
redmine/app/views/mailer/register_fr.rhtml
Normal file
3
redmine/app/views/mailer/register_fr.rhtml
Normal file
@@ -0,0 +1,3 @@
|
||||
Pour activer votre compte sur redMine, utilisez le lien suivant:
|
||||
|
||||
http://<%= $RDM_HOST_NAME %>/account/register?token=<%= @token.value %>
|
||||
@@ -1,13 +1,6 @@
|
||||
<%= error_messages_for 'news' %>
|
||||
|
||||
<!--[form:news]-->
|
||||
<p><label for="news_title"><%=_('Title')%></label> <span class="required">*</span><br/>
|
||||
<%= text_field 'news', 'title', :size => 60 %></p>
|
||||
|
||||
<p><label for="news_shortdescr"><%=_('Summary')%> <span class="required">*</span></label><br/>
|
||||
<%= text_area 'news', 'shortdescr', :cols => 60, :rows => 2 %></p>
|
||||
|
||||
<p><label for="news_descr"><%=_('Description')%> <span class="required">*</span></label><br/>
|
||||
<%= text_area 'news', 'descr', :cols => 60, :rows => 10 %></p>
|
||||
<!--[eoform:news]-->
|
||||
|
||||
<div class="box">
|
||||
<p><%= f.text_field :title, :required => true, :size => 60 %></p>
|
||||
<p><%= f.text_area :summary, :cols => 60, :rows => 2 %></p>
|
||||
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 10 %></p>
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
<h2><%=_('News')%></h2>
|
||||
<h2><%=l(:label_news)%></h2>
|
||||
|
||||
<%= start_form_tag :action => 'edit', :id => @news %>
|
||||
<%= render :partial => 'form' %>
|
||||
<%= submit_tag _('Save') %>
|
||||
<%= end_form_tag %>
|
||||
<% labelled_tabular_form_for :news, @news, :url => { :action => "edit" } do |f| %>
|
||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<% end %>
|
||||
@@ -1,10 +1,21 @@
|
||||
<h2><%= @news.title %></h2>
|
||||
|
||||
<p>
|
||||
<b><%=_('Summary')%></b>: <%= @news.shortdescr %><br />
|
||||
<b><%=_('By')%></b>: <%= @news.author.display_name %><br />
|
||||
<b><%=_('Date')%></b>: <%= format_time(@news.created_on) %>
|
||||
<b><%=l(:field_summary)%></b>: <%= @news.summary %><br />
|
||||
<b><%=l(:field_author)%></b>: <%= @news.author.display_name %><br />
|
||||
<b><%=l(:field_created_on)%></b>: <%= format_time(@news.created_on) %>
|
||||
</p>
|
||||
|
||||
<%= simple_format auto_link @news.descr %>
|
||||
|
||||
<%= simple_format auto_link @news.description %>
|
||||
|
||||
<% if authorize_for('news', 'edit') %>
|
||||
<%= start_form_tag ({:controller => 'news', :action => 'edit', :id => @news}, :method => 'get' ) %>
|
||||
<%= submit_tag l(:button_edit) %>
|
||||
<%= end_form_tag %>
|
||||
<% end %>
|
||||
|
||||
<% if authorize_for('news', 'destroy') %>
|
||||
<%= start_form_tag ({:controller => 'news', :action => 'destroy', :id => @news}) %>
|
||||
<%= submit_tag l(:button_delete) %>
|
||||
<%= end_form_tag %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,36 +1,24 @@
|
||||
<%= error_messages_for 'project' %>
|
||||
|
||||
<div class="box">
|
||||
<!--[form:project]-->
|
||||
<p><label for="project_name"><%=_('Name')%> <span class="required">*</span></label><br/>
|
||||
<%= text_field 'project', 'name' %></p>
|
||||
<p><%= f.text_field :name, :required => true %></p>
|
||||
|
||||
<% if session[:user].admin %>
|
||||
<p><label for="project_parent_id"><%=_('Subproject of')%></label><br/>
|
||||
<select name="project[parent_id]">
|
||||
<option value=""></option>
|
||||
<%= options_from_collection_for_select @root_projects, "id", "name", @project.parent_id %>
|
||||
</select></p>
|
||||
<% if admin_loggedin? %>
|
||||
<p><%= f.select :parent_id, (@root_projects.collect {|p| [p.name, p.id]}), { :include_blank => true } %></p>
|
||||
<% end %>
|
||||
|
||||
<p><label for="project_descr"><%=_('Description')%> <span class="required">*</span></label><br/>
|
||||
<%= text_area 'project', 'descr', :cols => 60, :rows => 3 %></p>
|
||||
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 3 %></p>
|
||||
<p><%= f.text_field :homepage, :size => 40 %></p>
|
||||
<p><%= f.check_box :is_public %></p>
|
||||
|
||||
<p><label for="project_homepage"><%=_('Homepage')%></label><br/>
|
||||
<%= text_field 'project', 'homepage', :size => 40 %></p>
|
||||
|
||||
<p><%= check_box 'project', 'is_public' %>
|
||||
<label for="project_is_public"><%=_('Public')%></label></p>
|
||||
|
||||
<fieldset><legend><%=_('Custom fields')%></legend>
|
||||
<% for custom_field in @custom_fields %>
|
||||
<input type="checkbox"
|
||||
|
||||
name="custom_field_ids[]"
|
||||
value="<%= custom_field.id %>"
|
||||
<%if @project.custom_fields.include? custom_field%>checked="checked"<%end%>
|
||||
> <%= custom_field.name %>
|
||||
|
||||
<% end %></fieldset>
|
||||
<br />
|
||||
|
||||
<!--[eoform:project]-->
|
||||
<% for @custom_value in @custom_values %>
|
||||
<p><%= custom_field_tag_with_label @custom_value %></p>
|
||||
<% end %>
|
||||
|
||||
<p><label><%=l(:label_custom_field_plural)%></label>
|
||||
<% for custom_field in @custom_fields %>
|
||||
<%= check_box_tag "custom_field_ids[]", custom_field.id, (@project.custom_fields.include? custom_field) %>
|
||||
<%= custom_field.name %>
|
||||
<% end %></p>
|
||||
<!--[eoform:project]-->
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<h2><%=_('New project')%></h2>
|
||||
|
||||
<%= start_form_tag :action => 'add' %>
|
||||
<%= render :partial => 'form' %>
|
||||
<%= submit_tag _('Create') %>
|
||||
<%= end_form_tag %>
|
||||
<h2><%=l(:label_project_new)%></h2>
|
||||
|
||||
<% labelled_tabular_form_for :project, @project, :url => { :action => "add" } do |f| %>
|
||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<% end %>
|
||||
@@ -1,26 +1,14 @@
|
||||
<h2><%=_('New document')%></h2>
|
||||
<h2><%=l(:label_document_new)%></h2>
|
||||
|
||||
<%= error_messages_for 'document' %>
|
||||
<%= start_form_tag( { :action => 'add_document', :id => @project }, :multipart => true) %>
|
||||
<%= start_form_tag( { :action => 'add_document', :id => @project }, :class => "tabular", :multipart => true) %>
|
||||
<%= render :partial => 'documents/form' %>
|
||||
|
||||
<!--[form:document]-->
|
||||
<p><label for="document_category_id"><%=_('Category')%></label><br />
|
||||
<select name="document[category_id]">
|
||||
<%= options_from_collection_for_select @categories, "id", "name",@document.category_id %>
|
||||
</select></p>
|
||||
<div class="box">
|
||||
<p><label for="attachment_file"><%=l(:label_attachment)%></label>
|
||||
<%= file_field 'attachment', 'file' %></p>
|
||||
</div>
|
||||
|
||||
<p><label for="document_title"><%=_('Title')%> <span class="required">*</span></label><br />
|
||||
<%= text_field 'document', 'title', :size => 60 %></p>
|
||||
|
||||
<p><label for="document_descr"><%=_('Description')%> <span class="required">*</span></label><br />
|
||||
<%= text_area 'document', 'descr', :cols => 60, :rows => 5 %></p>
|
||||
|
||||
<p><label for="attachment_file"><%=_('File')%></label><br/>
|
||||
<%= file_field 'attachment', 'file' %></p>
|
||||
|
||||
<!--[eoform:document]-->
|
||||
|
||||
<%= submit_tag _('Create') %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= end_form_tag %>
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<h2><%=_('New file')%></h2>
|
||||
<h2><%=l(:label_attachment_new)%></h2>
|
||||
|
||||
<%= error_messages_for 'attachment' %>
|
||||
<%= start_form_tag ({ :action => 'add_file', :project => @project }, :multipart => true) %>
|
||||
|
||||
<p><label for="version_id"><%=_('Version')%></label><br />
|
||||
<p><label for="version_id"><%=l(:field_version)%></label><br />
|
||||
<select name="version_id">
|
||||
<%= options_from_collection_for_select @versions, "id", "name" %>
|
||||
</select></p>
|
||||
|
||||
<p><b><%=_('File')%><b><br /><%= file_field 'attachment', 'file' %></p>
|
||||
<p><b><%=l(:label_attachment)%><b><br /><%= file_field 'attachment', 'file' %></p>
|
||||
<br/>
|
||||
<%= submit_tag _('Add') %>
|
||||
<%= submit_tag l(:button_add) %>
|
||||
<%= end_form_tag %>
|
||||
@@ -1,62 +1,26 @@
|
||||
<h2><%=_('New issue')%></h2>
|
||||
<h2><%=l(:label_issue_new)%>: <%= @tracker.name %></h2>
|
||||
|
||||
<%= start_form_tag( { :action => 'add_issue', :id => @project }, :multipart => true) %>
|
||||
<% labelled_tabular_form_for :issue, @issue, :url => {:action => 'add_issue'}, :html => {:multipart => true} do |f| %>
|
||||
<%= error_messages_for 'issue' %>
|
||||
|
||||
<!--[form:issue]-->
|
||||
<div class="box">
|
||||
<!--[form:issue]-->
|
||||
<%= hidden_field_tag 'tracker_id', @tracker.id %>
|
||||
|
||||
<div style="float:left;margin-right:10px;">
|
||||
<p><label for="issue_tracker_id"><%=_('Tracker')%> <span class="required">*</span></label><br/>
|
||||
<select name="issue[tracker_id]">
|
||||
<%= options_from_collection_for_select @trackers, "id", "name", @issue.tracker_id %></p>
|
||||
</select></p>
|
||||
</div>
|
||||
<p><%= f.select :priority_id, (@priorities.collect {|p| [p.name, p.id]}), :required => true %></p>
|
||||
<p><%= f.select :assigned_to_id, (@issue.project.members.collect {|m| [m.name, m.user_id]}), :include_blank => true %></p>
|
||||
<p><%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}) %></p>
|
||||
<p><%= f.text_field :subject, :size => 80, :required => true %></p>
|
||||
<p><%= f.text_area :description, :cols => 60, :rows => 10, :required => true %></p>
|
||||
<p><%= f.date_select :due_date, :start_year => Date.today.year, :include_blank => true %></p>
|
||||
|
||||
<div style="float:left;margin-right:10px;">
|
||||
<p><label for="issue_priority_id"><%=_('Priority')%> <span class="required">*</span></label><br/>
|
||||
<select name="issue[priority_id]">
|
||||
<%= options_from_collection_for_select @priorities, "id", "name", @issue.priority_id %></p>
|
||||
</select></p>
|
||||
</div>
|
||||
|
||||
<div style="float:left;margin-right:10px;">
|
||||
<p><label for="issue_assigned_to_id"><%=_('Assigned to')%></label><br/>
|
||||
<select name="issue[assigned_to_id]">
|
||||
<option value=""></option>
|
||||
<%= options_from_collection_for_select @issue.project.members, "user_id", "name", @issue.assigned_to_id %></p>
|
||||
</select></p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p><label for="issue_category_id"><%=_('Category')%></label><br/>
|
||||
<select name="issue[category_id]">
|
||||
<option value=""></option>
|
||||
<%= options_from_collection_for_select @project.issue_categories, "id", "name", @issue.category_id %></p>
|
||||
</select></p>
|
||||
</div>
|
||||
|
||||
<p><label for="issue_subject"><%=_('Subject')%> <span class="required">*</span></label><br/>
|
||||
<%= text_field 'issue', 'subject', :size => 80 %></p>
|
||||
|
||||
<p><label for="issue_descr"><%=_('Description')%> <span class="required">*</span></label><br/>
|
||||
<%= text_area 'issue', 'descr', :cols => 60, :rows => 10 %></p>
|
||||
|
||||
|
||||
<% for custom_value in @custom_values %>
|
||||
<div style="float:left;margin-right:10px;">
|
||||
<p><%= content_tag "label", custom_value.custom_field.name %>
|
||||
<% if custom_value.custom_field.is_required? %><span class="required">*</span><% end %>
|
||||
<br />
|
||||
<%= custom_field_tag custom_value %></p>
|
||||
</div>
|
||||
<% for @custom_value in @custom_values %>
|
||||
<p><%= custom_field_tag_with_label @custom_value %></p>
|
||||
<% end %>
|
||||
|
||||
<div style="clear: both;">
|
||||
<p><label for="attachment_file"><%=_('Attachment')%></label><br/>
|
||||
<p><label for="attachment_file"><%=l(:label_attachment)%></label>
|
||||
<%= file_field 'attachment', 'file' %></p>
|
||||
</div>
|
||||
|
||||
<!--[eoform:issue]-->
|
||||
</div>
|
||||
|
||||
<%= submit_tag _('Create') %>
|
||||
<%= end_form_tag %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<% end %>
|
||||
@@ -1,7 +1,6 @@
|
||||
<h2><%=('Add news')%></h2>
|
||||
|
||||
<%= start_form_tag :action => 'add_news', :id => @project %>
|
||||
<%= render :partial => 'news/form' %>
|
||||
<%= submit_tag _('Create') %>
|
||||
<%= end_form_tag %>
|
||||
<h2><%=l(:label_news_new)%></h2>
|
||||
|
||||
<% labelled_tabular_form_for :news, @news, :url => { :action => "add_news" } do |f| %>
|
||||
<%= render :partial => 'news/form', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<% end %>
|
||||
@@ -1,7 +1,6 @@
|
||||
<h2><%=_('New version')%></h2>
|
||||
|
||||
<%= start_form_tag :action => 'add_version', :id => @project %>
|
||||
<%= render :partial => 'versions/form' %>
|
||||
<%= submit_tag _('Create') %>
|
||||
<%= end_form_tag %>
|
||||
<h2><%=l(:label_version_new)%></h2>
|
||||
|
||||
<% labelled_tabular_form_for :version, @version, :url => { :action => 'add_version' } do |f| %>
|
||||
<%= render :partial => 'versions/form', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<% end %>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user