##// END OF EJS Templates
notice messages translation...
Jean-Philippe Lang -
r15:18ee1fef4172
parent child
Show More
@@ -1,160 +1,165
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class AccountController < ApplicationController
19 19 layout 'base'
20 20 helper :custom_fields
21 21 include CustomFieldsHelper
22 22
23 23 # prevents login action to be filtered by check_if_login_required application scope filter
24 24 skip_before_filter :check_if_login_required, :only => [:login, :lost_password, :register]
25 25 before_filter :require_login, :except => [:show, :login, :lost_password, :register]
26 26
27 27 # Show user's account
28 28 def show
29 29 @user = User.find(params[:id])
30 30 end
31 31
32 32 # Login request and validation
33 33 def login
34 34 if request.get?
35 35 # Logout user
36 36 self.logged_in_user = nil
37 37 else
38 38 # Authenticate user
39 39 user = User.try_to_login(params[:login], params[:password])
40 40 if user
41 41 self.logged_in_user = user
42 42 redirect_back_or_default :controller => 'account', :action => 'my_page'
43 43 else
44 44 flash.now[:notice] = l(:notice_account_invalid_creditentials)
45 45 end
46 46 end
47 47 end
48 48
49 49 # Log out current user and redirect to welcome page
50 50 def logout
51 51 self.logged_in_user = nil
52 52 redirect_to :controller => ''
53 53 end
54 54
55 55 # Show logged in user's page
56 56 def my_page
57 57 @user = self.logged_in_user
58 58 @reported_issues = Issue.find(:all, :conditions => ["author_id=?", @user.id], :limit => 10, :include => [ :status, :project, :tracker ], :order => 'issues.updated_on DESC')
59 59 @assigned_issues = Issue.find(:all, :conditions => ["assigned_to_id=?", @user.id], :limit => 10, :include => [ :status, :project, :tracker ], :order => 'issues.updated_on DESC')
60 60 end
61 61
62 62 # Edit logged in user's account
63 63 def my_account
64 64 @user = self.logged_in_user
65 65 if request.post? and @user.update_attributes(@params[:user])
66 66 set_localization
67 67 flash.now[:notice] = l(:notice_account_updated)
68 68 self.logged_in_user.reload
69 69 end
70 70 end
71 71
72 72 # Change logged in user's password
73 73 def change_password
74 74 @user = self.logged_in_user
75 flash.now[:notice] = l(:notice_can_t_change_password) and render :action => 'my_account' and return if @user.auth_source_id
75 flash[:notice] = l(:notice_can_t_change_password) and redirect_to :action => 'my_account' and return if @user.auth_source_id
76 76 if @user.check_password?(@params[:password])
77 77 @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
78 flash.now[:notice] = l(:notice_account_password_updated) if @user.save
78 if @user.save
79 flash[:notice] = l(:notice_account_password_updated)
80 else
81 render :action => 'my_account'
82 return
83 end
79 84 else
80 flash.now[:notice] = l(:notice_account_wrong_password)
85 flash[:notice] = l(:notice_account_wrong_password)
81 86 end
82 render :action => 'my_account'
87 redirect_to :action => 'my_account'
83 88 end
84 89
85 90 # Enable user to choose a new password
86 91 def lost_password
87 92 if params[:token]
88 93 @token = Token.find_by_action_and_value("recovery", params[:token])
89 94 redirect_to :controller => '' and return unless @token and !@token.expired?
90 95 @user = @token.user
91 96 if request.post?
92 97 @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
93 98 if @user.save
94 99 @token.destroy
95 100 flash[:notice] = l(:notice_account_password_updated)
96 101 redirect_to :action => 'login'
97 102 return
98 103 end
99 104 end
100 105 render :template => "account/password_recovery"
101 106 return
102 107 else
103 108 if request.post?
104 109 user = User.find_by_mail(params[:mail])
105 110 # user not found in db
106 111 flash.now[:notice] = l(:notice_account_unknown_email) and return unless user
107 112 # user uses an external authentification
108 113 flash.now[:notice] = l(:notice_can_t_change_password) and return if user.auth_source_id
109 114 # create a new token for password recovery
110 115 token = Token.new(:user => user, :action => "recovery")
111 116 if token.save
112 117 # send token to user via email
113 118 Mailer.set_language_if_valid(user.language)
114 119 Mailer.deliver_lost_password(token)
115 120 flash[:notice] = l(:notice_account_lost_email_sent)
116 121 redirect_to :action => 'login'
117 122 return
118 123 end
119 124 end
120 125 end
121 126 end
122 127
123 128 # User self-registration
124 129 def register
125 130 redirect_to :controller => '' and return if $RDM_SELF_REGISTRATION == false
126 131 if params[:token]
127 132 token = Token.find_by_action_and_value("register", params[:token])
128 133 redirect_to :controller => '' and return unless token and !token.expired?
129 134 user = token.user
130 135 redirect_to :controller => '' and return unless user.status == User::STATUS_REGISTERED
131 136 user.status = User::STATUS_ACTIVE
132 137 if user.save
133 138 token.destroy
134 139 flash[:notice] = l(:notice_account_activated)
135 140 redirect_to :action => 'login'
136 141 return
137 142 end
138 143 else
139 144 if request.get?
140 145 @user = User.new(:language => $RDM_DEFAULT_LANG)
141 146 @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user) }
142 147 else
143 148 @user = User.new(params[:user])
144 149 @user.admin = false
145 150 @user.login = params[:user][:login]
146 151 @user.status = User::STATUS_REGISTERED
147 152 @user.password, @user.password_confirmation = params[:password], params[:password_confirmation]
148 153 @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) }
149 154 @user.custom_values = @custom_values
150 155 token = Token.new(:user => @user, :action => "register")
151 156 if @user.save and token.save
152 157 Mailer.set_language_if_valid(@user.language)
153 158 Mailer.deliver_register(token)
154 159 flash[:notice] = l(:notice_account_register_done)
155 160 redirect_to :controller => ''
156 161 end
157 162 end
158 163 end
159 164 end
160 165 end
@@ -1,54 +1,54
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class AdminController < ApplicationController
19 19 layout 'base'
20 20 before_filter :require_admin
21 21
22 22 helper :sort
23 23 include SortHelper
24 24
25 25 def index
26 26 end
27 27
28 28 def projects
29 29 sort_init 'name', 'asc'
30 30 sort_update
31 31 @project_count = Project.count
32 32 @project_pages = Paginator.new self, @project_count,
33 33 15,
34 34 @params['page']
35 35 @projects = Project.find :all, :order => sort_clause,
36 36 :limit => @project_pages.items_per_page,
37 37 :offset => @project_pages.current.offset
38 38 end
39 39
40 40 def mail_options
41 41 @actions = Permission.find(:all, :conditions => ["mail_option=?", true]) || []
42 42 if request.post?
43 43 @actions.each { |a|
44 44 a.mail_enabled = (params[:action_ids] || []).include? a.id.to_s
45 45 a.save
46 46 }
47 flash[:notice] = "Mail options were successfully updated."
47 flash.now[:notice] = l(:notice_successful_update)
48 48 end
49 49 end
50 50
51 51 def info
52 52 @adapter_name = ActiveRecord::Base.connection.adapter_name
53 53 end
54 54 end
@@ -1,109 +1,107
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class ApplicationController < ActionController::Base
19 19 before_filter :check_if_login_required, :set_localization
20 20
21 21 def logged_in_user=(user)
22 22 @logged_in_user = user
23 23 session[:user_id] = (user ? user.id : nil)
24 24 end
25 25
26 26 def logged_in_user
27 27 if session[:user_id]
28 28 @logged_in_user ||= User.find(session[:user_id], :include => :memberships)
29 29 else
30 30 nil
31 31 end
32 32 end
33 33
34 34 # check if login is globally required to access the application
35 35 def check_if_login_required
36 36 require_login if $RDM_LOGIN_REQUIRED
37 37 end
38 38
39 39 def set_localization
40 40 lang = begin
41 41 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
42 42 self.logged_in_user.language
43 43 elsif request.env['HTTP_ACCEPT_LANGUAGE']
44 44 accept_lang = HTTPUtils.parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first.split('-').first
45 45 if accept_lang and !accept_lang.empty? and GLoc.valid_languages.include? accept_lang.to_sym
46 46 accept_lang
47 47 end
48 48 end
49 49 rescue
50 50 nil
51 51 end || $RDM_DEFAULT_LANG
52 52 set_language_if_valid(lang)
53 53 end
54 54
55 55 def require_login
56 56 unless self.logged_in_user
57 57 store_location
58 redirect_to(:controller => "account", :action => "login")
58 redirect_to :controller => "account", :action => "login"
59 59 return false
60 60 end
61 61 true
62 62 end
63 63
64 64 def require_admin
65 65 return unless require_login
66 66 unless self.logged_in_user.admin?
67 flash[:notice] = "Acces denied"
68 redirect_to:controller => ''
67 render :nothing => true, :status => 403
69 68 return false
70 69 end
71 70 true
72 71 end
73 72
74 73 # authorizes the user for the requested action.
75 74 def authorize
76 75 # check if action is allowed on public projects
77 76 if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ @params[:controller], @params[:action] ]
78 77 return true
79 78 end
80 79 # if action is not public, force login
81 80 return unless require_login
82 81 # admin is always authorized
83 82 return true if self.logged_in_user.admin?
84 83 # if not admin, check membership permission
85 84 @user_membership ||= Member.find(:first, :conditions => ["user_id=? and project_id=?", self.logged_in_user.id, @project.id])
86 85 if @user_membership and Permission.allowed_to_role( "%s/%s" % [ @params[:controller], @params[:action] ], @user_membership.role_id )
87 86 return true
88 87 end
89 flash[:notice] = "Acces denied"
90 redirect_to :controller => ''
88 render :nothing => true, :status => 403
91 89 false
92 90 end
93 91
94 92 # store current uri in session.
95 93 # return to this location by calling redirect_back_or_default
96 94 def store_location
97 95 session[:return_to] = @request.request_uri
98 96 end
99 97
100 98 # move to the last store_location call or to the passed default one
101 99 def redirect_back_or_default(default)
102 100 if session[:return_to].nil?
103 101 redirect_to default
104 102 else
105 103 redirect_to_url session[:return_to]
106 104 session[:return_to] = nil
107 105 end
108 106 end
109 107 end No newline at end of file
@@ -1,69 +1,70
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class CustomFieldsController < ApplicationController
19 19 layout 'base'
20 20 before_filter :require_admin
21 21
22 22 def index
23 23 list
24 24 render :action => 'list'
25 25 end
26 26
27 27 def list
28 28 @custom_field_pages, @custom_fields = paginate :custom_fields, :per_page => 15
29 29 end
30 30
31 31 def new
32 32 case params[:type]
33 33 when "IssueCustomField"
34 34 @custom_field = IssueCustomField.new(params[:custom_field])
35 35 @custom_field.trackers = Tracker.find(params[:tracker_ids]) if params[:tracker_ids]
36 36 when "UserCustomField"
37 37 @custom_field = UserCustomField.new(params[:custom_field])
38 38 when "ProjectCustomField"
39 39 @custom_field = ProjectCustomField.new(params[:custom_field])
40 40 else
41 41 redirect_to :action => 'list'
42 42 return
43 43 end
44 44 if request.post? and @custom_field.save
45 flash[:notice] = l(:notice_successful_create)
45 46 redirect_to :action => 'list'
46 47 end
47 48 @trackers = Tracker.find(:all)
48 49 end
49 50
50 51 def edit
51 52 @custom_field = CustomField.find(params[:id])
52 53 if request.post? and @custom_field.update_attributes(params[:custom_field])
53 54 if @custom_field.is_a? IssueCustomField
54 55 @custom_field.trackers = params[:tracker_ids] ? Tracker.find(params[:tracker_ids]) : []
55 56 end
56 flash[:notice] = 'Custom field was successfully updated.'
57 flash[:notice] = l(:notice_successful_update)
57 58 redirect_to :action => 'list'
58 59 end
59 60 @trackers = Tracker.find(:all)
60 61 end
61 62
62 63 def destroy
63 64 CustomField.find(params[:id]).destroy
64 65 redirect_to :action => 'list'
65 66 rescue
66 67 flash[:notice] = "Unable to delete custom field"
67 68 redirect_to :action => 'list'
68 69 end
69 70 end
@@ -1,65 +1,65
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class DocumentsController < ApplicationController
19 19 layout 'base'
20 20 before_filter :find_project, :authorize
21 21
22 22 def show
23 23 end
24 24
25 25 def edit
26 26 @categories = Enumeration::get_values('DCAT')
27 27 if request.post? and @document.update_attributes(params[:document])
28 flash[:notice] = 'Document was successfully updated.'
28 flash[:notice] = l(:notice_successful_update)
29 29 redirect_to :action => 'show', :id => @document
30 30 end
31 31 end
32 32
33 33 def destroy
34 34 @document.destroy
35 35 redirect_to :controller => 'projects', :action => 'list_documents', :id => @project
36 36 end
37 37
38 38 def download
39 39 @attachment = @document.attachments.find(params[:attachment_id])
40 40 @attachment.increment_download
41 41 send_file @attachment.diskfile, :filename => @attachment.filename
42 42 end
43 43
44 44 def add_attachment
45 45 # Save the attachment
46 46 if params[:attachment][:file].size > 0
47 47 @attachment = @document.attachments.build(params[:attachment])
48 48 @attachment.author_id = self.logged_in_user.id if self.logged_in_user
49 49 @attachment.save
50 50 end
51 51 render :action => 'show'
52 52 end
53 53
54 54 def destroy_attachment
55 55 @document.attachments.find(params[:attachment_id]).destroy
56 56 render :action => 'show'
57 57 end
58 58
59 59 private
60 60 def find_project
61 61 @document = Document.find(params[:id])
62 62 @project = @document.project
63 63 end
64 64
65 65 end
@@ -1,42 +1,42
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class IssueCategoriesController < ApplicationController
19 19 layout 'base'
20 20 before_filter :find_project, :authorize
21 21
22 22 def edit
23 23 if request.post? and @category.update_attributes(params[:category])
24 flash[:notice] = 'Issue category was successfully updated.'
24 flash[:notice] = l(:notice_successful_update)
25 25 redirect_to :controller => 'projects', :action => 'settings', :id => @project
26 26 end
27 27 end
28 28
29 29 def destroy
30 30 @category.destroy
31 31 redirect_to :controller => 'projects', :action => 'settings', :id => @project
32 32 rescue
33 33 flash[:notice] = "Categorie can't be deleted"
34 34 redirect_to :controller => 'projects', :action => 'settings', :id => @project
35 35 end
36 36
37 37 private
38 38 def find_project
39 39 @category = IssueCategory.find(params[:id])
40 40 @project = @category.project
41 41 end
42 42 end
@@ -1,68 +1,68
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class IssueStatusesController < ApplicationController
19 19 layout 'base'
20 20 before_filter :require_admin
21 21
22 22 def index
23 23 list
24 24 render :action => 'list'
25 25 end
26 26
27 27 def list
28 28 @issue_status_pages, @issue_statuses = paginate :issue_statuses, :per_page => 10
29 29 end
30 30
31 31 def new
32 32 @issue_status = IssueStatus.new
33 33 end
34 34
35 35 def create
36 36 @issue_status = IssueStatus.new(params[:issue_status])
37 37 if @issue_status.save
38 flash[:notice] = 'IssueStatus was successfully created.'
38 flash[:notice] = l(:notice_successful_create)
39 39 redirect_to :action => 'list'
40 40 else
41 41 render :action => 'new'
42 42 end
43 43 end
44 44
45 45 def edit
46 46 @issue_status = IssueStatus.find(params[:id])
47 47 end
48 48
49 49 def update
50 50 @issue_status = IssueStatus.find(params[:id])
51 51 if @issue_status.update_attributes(params[:issue_status])
52 flash[:notice] = 'IssueStatus was successfully updated.'
52 flash[:notice] = l(:notice_successful_update)
53 53 redirect_to :action => 'list'
54 54 else
55 55 render :action => 'edit'
56 56 end
57 57 end
58 58
59 59 def destroy
60 60 IssueStatus.find(params[:id]).destroy
61 61 redirect_to :action => 'list'
62 62 rescue
63 63 flash[:notice] = "Unable to delete issue status"
64 64 redirect_to :action => 'list'
65 65 end
66 66
67 67
68 68 end
@@ -1,100 +1,100
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class IssuesController < ApplicationController
19 19 layout 'base'
20 20 before_filter :find_project, :authorize
21 21
22 22 helper :custom_fields
23 23 include CustomFieldsHelper
24 24
25 25 def show
26 26 @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
27 27 @custom_values = @issue.custom_values.find(:all, :include => :custom_field)
28 28 end
29 29
30 30 def edit
31 31 @priorities = Enumeration::get_values('IPRI')
32 32
33 33 if request.get?
34 34 @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) }
35 35 else
36 36 # Retrieve custom fields and values
37 37 @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]) }
38 38 @issue.custom_values = @custom_values
39 39 @issue.attributes = params[:issue]
40 40 if @issue.save
41 flash[:notice] = 'Issue was successfully updated.'
41 flash[:notice] = l(:notice_successful_update)
42 42 redirect_to :action => 'show', :id => @issue
43 43 end
44 44 end
45 45 end
46 46
47 47 def change_status
48 48 @history = @issue.histories.build(params[:history])
49 49 @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
50 50
51 51 if params[:confirm]
52 52 @history.author_id = self.logged_in_user.id if self.logged_in_user
53 53
54 54 if @history.save
55 55 @issue.status = @history.status
56 56 @issue.fixed_version_id = (params[:issue][:fixed_version_id])
57 57 @issue.assigned_to_id = (params[:issue][:assigned_to_id])
58 58 if @issue.save
59 flash[:notice] = 'Issue was successfully updated.'
59 flash[:notice] = l(:notice_successful_update)
60 60 Mailer.deliver_issue_change_status(@issue) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled?
61 61 redirect_to :action => 'show', :id => @issue
62 62 end
63 63 end
64 64 end
65 65 @assignable_to = @project.members.find(:all, :include => :user).collect{ |m| m.user }
66 66
67 67 end
68 68
69 69 def destroy
70 70 @issue.destroy
71 71 redirect_to :controller => 'projects', :action => 'list_issues', :id => @project
72 72 end
73 73
74 74 def add_attachment
75 75 # Save the attachment
76 76 if params[:attachment][:file].size > 0
77 77 @attachment = @issue.attachments.build(params[:attachment])
78 78 @attachment.author_id = self.logged_in_user.id if self.logged_in_user
79 79 @attachment.save
80 80 end
81 81 redirect_to :action => 'show', :id => @issue
82 82 end
83 83
84 84 def destroy_attachment
85 85 @issue.attachments.find(params[:attachment_id]).destroy
86 86 redirect_to :action => 'show', :id => @issue
87 87 end
88 88
89 89 # Send the file in stream mode
90 90 def download
91 91 @attachment = @issue.attachments.find(params[:attachment_id])
92 92 send_file @attachment.diskfile, :filename => @attachment.filename
93 93 end
94 94
95 95 private
96 96 def find_project
97 97 @issue = Issue.find(params[:id])
98 98 @project = @issue.project
99 99 end
100 100 end
@@ -1,41 +1,41
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class MembersController < ApplicationController
19 19 layout 'base'
20 20 before_filter :find_project, :authorize
21 21
22 22 def edit
23 23 if request.post? and @member.update_attributes(params[:member])
24 flash[:notice] = 'Member was successfully updated.'
24 flash[:notice] = l(:notice_successful_update)
25 25 redirect_to :controller => 'projects', :action => 'settings', :id => @project
26 26 end
27 27 end
28 28
29 29 def destroy
30 30 @member.destroy
31 flash[:notice] = 'Member was successfully removed.'
31 flash[:notice] = l(:notice_successful_delete)
32 32 redirect_to :controller => 'projects', :action => 'settings', :id => @project
33 33 end
34 34
35 35 private
36 36 def find_project
37 37 @member = Member.find(params[:id])
38 38 @project = @member.project
39 39 end
40 40
41 41 end
@@ -1,42 +1,42
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class NewsController < ApplicationController
19 19 layout 'base'
20 20 before_filter :find_project, :authorize
21 21
22 22 def show
23 23 end
24 24
25 25 def edit
26 26 if request.post? and @news.update_attributes(params[:news])
27 flash[:notice] = 'News was successfully updated.'
27 flash[:notice] = l(:notice_successful_update)
28 28 redirect_to :action => 'show', :id => @news
29 29 end
30 30 end
31 31
32 32 def destroy
33 33 @news.destroy
34 34 redirect_to :controller => 'projects', :action => 'list_news', :id => @project
35 35 end
36 36
37 37 private
38 38 def find_project
39 39 @news = News.find(params[:id])
40 40 @project = @news.project
41 41 end
42 42 end
@@ -1,292 +1,296
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class ProjectsController < ApplicationController
19 19 layout 'base'
20 20 before_filter :find_project, :authorize, :except => [ :index, :list, :add ]
21 21 before_filter :require_admin, :only => [ :add, :destroy ]
22 22
23 23 helper :sort
24 24 include SortHelper
25 25 helper :search_filter
26 26 include SearchFilterHelper
27 27 helper :custom_fields
28 28 include CustomFieldsHelper
29 29
30 30 def index
31 31 list
32 32 render :action => 'list'
33 33 end
34 34
35 35 # Lists public projects
36 36 def list
37 37 sort_init 'name', 'asc'
38 38 sort_update
39 39 @project_count = Project.count(["is_public=?", true])
40 40 @project_pages = Paginator.new self, @project_count,
41 41 15,
42 42 @params['page']
43 43 @projects = Project.find :all, :order => sort_clause,
44 44 :conditions => ["is_public=?", true],
45 45 :limit => @project_pages.items_per_page,
46 46 :offset => @project_pages.current.offset
47 47 end
48 48
49 49 # Add a new project
50 50 def add
51 51 @custom_fields = IssueCustomField.find(:all)
52 52 @root_projects = Project.find(:all, :conditions => "parent_id is null")
53 53 @project = Project.new(params[:project])
54 54 if request.get?
55 55 @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project) }
56 56 else
57 57 @project.custom_fields = CustomField.find(@params[:custom_field_ids]) if @params[:custom_field_ids]
58 58 @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }
59 59 @project.custom_values = @custom_values
60 60 if @project.save
61 flash[:notice] = 'Project was successfully created.'
61 flash[:notice] = l(:notice_successful_create)
62 62 redirect_to :controller => 'admin', :action => 'projects'
63 63 end
64 64 end
65 65 end
66 66
67 67 # Show @project
68 68 def show
69 69 @custom_values = @project.custom_values.find(:all, :include => :custom_field)
70 70 @members = @project.members.find(:all, :include => [:user, :role])
71 71 @subprojects = @project.children if @project.children_count > 0
72 72 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
73 73 @trackers = Tracker.find(:all)
74 74 end
75 75
76 76 def settings
77 77 @root_projects = Project::find(:all, :conditions => ["parent_id is null and id <> ?", @project.id])
78 78 @custom_fields = IssueCustomField::find_all
79 79 @issue_category ||= IssueCategory.new
80 80 @member ||= @project.members.new
81 81 @roles = Role.find_all
82 82 @users = User.find_all - @project.members.find(:all, :include => :user).collect{|m| m.user }
83 83 @custom_values = ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) }
84 84 end
85 85
86 86 # Edit @project
87 87 def edit
88 88 if request.post?
89 89 @project.custom_fields = IssueCustomField.find(@params[:custom_field_ids]) if @params[:custom_field_ids]
90 90 if params[:custom_fields]
91 91 @custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }
92 92 @project.custom_values = @custom_values
93 93 end
94 94 if @project.update_attributes(params[:project])
95 flash[:notice] = 'Project was successfully updated.'
95 flash[:notice] = l(:notice_successful_update)
96 96 redirect_to :action => 'settings', :id => @project
97 97 else
98 98 settings
99 99 render :action => 'settings'
100 100 end
101 101 end
102 102 end
103 103
104 104 # Delete @project
105 105 def destroy
106 106 if request.post? and params[:confirm]
107 107 @project.destroy
108 108 redirect_to :controller => 'admin', :action => 'projects'
109 109 end
110 110 end
111 111
112 112 # Add a new issue category to @project
113 113 def add_issue_category
114 114 if request.post?
115 115 @issue_category = @project.issue_categories.build(params[:issue_category])
116 116 if @issue_category.save
117 flash[:notice] = l(:notice_successful_create)
117 118 redirect_to :action => 'settings', :id => @project
118 119 else
119 120 settings
120 121 render :action => 'settings'
121 122 end
122 123 end
123 124 end
124 125
125 126 # Add a new version to @project
126 127 def add_version
127 128 @version = @project.versions.build(params[:version])
128 129 if request.post? and @version.save
130 flash[:notice] = l(:notice_successful_create)
129 131 redirect_to :action => 'settings', :id => @project
130 132 end
131 133 end
132 134
133 135 # Add a new member to @project
134 136 def add_member
135 137 @member = @project.members.build(params[:member])
136 138 if request.post?
137 139 if @member.save
138 flash[:notice] = 'Member was successfully added.'
140 flash[:notice] = l(:notice_successful_create)
139 141 redirect_to :action => 'settings', :id => @project
140 142 else
141 143 settings
142 144 render :action => 'settings'
143 145 end
144 146 end
145 147 end
146 148
147 149 # Show members list of @project
148 150 def list_members
149 151 @members = @project.members
150 152 end
151 153
152 154 # Add a new document to @project
153 155 def add_document
154 156 @categories = Enumeration::get_values('DCAT')
155 157 @document = @project.documents.build(params[:document])
156 158 if request.post?
157 159 # Save the attachment
158 160 if params[:attachment][:file].size > 0
159 161 @attachment = @document.attachments.build(params[:attachment])
160 162 @attachment.author_id = self.logged_in_user.id if self.logged_in_user
161 163 end
162 164 if @document.save
165 flash[:notice] = l(:notice_successful_create)
163 166 redirect_to :action => 'list_documents', :id => @project
164 167 end
165 168 end
166 169 end
167 170
168 171 # Show documents list of @project
169 172 def list_documents
170 173 @documents = @project.documents
171 174 end
172 175
173 176 # Add a new issue to @project
174 177 def add_issue
175 178 @tracker = Tracker.find(params[:tracker_id])
176 179 @priorities = Enumeration::get_values('IPRI')
177 180 @issue = Issue.new(:project => @project, :tracker => @tracker)
178 181 if request.get?
179 182 @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) }
180 183 else
181 184 @issue.attributes = params[:issue]
182 185 @issue.author_id = self.logged_in_user.id if self.logged_in_user
183 186 # Create the document if a file was sent
184 187 if params[:attachment][:file].size > 0
185 188 @attachment = @issue.attachments.build(params[:attachment])
186 189 @attachment.author_id = self.logged_in_user.id if self.logged_in_user
187 190 end
188 191 @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]) }
189 192 @issue.custom_values = @custom_values
190 193 if @issue.save
191 flash[:notice] = "Issue was successfully added."
194 flash[:notice] = l(:notice_successful_create)
192 195 Mailer.deliver_issue_add(@issue) if Permission.find_by_controller_and_action(@params[:controller], @params[:action]).mail_enabled?
193 196 redirect_to :action => 'list_issues', :id => @project
194 197 end
195 198 end
196 199 end
197 200
198 201 # Show filtered/sorted issues list of @project
199 202 def list_issues
200 203 sort_init 'issues.id', 'desc'
201 204 sort_update
202 205
203 206 search_filter_init_list_issues
204 207 search_filter_update if params[:set_filter] or request.post?
205 208
206 209 @issue_count = Issue.count(:include => [:status, :project], :conditions => search_filter_clause)
207 210 @issue_pages = Paginator.new self, @issue_count, 15, @params['page']
208 211 @issues = Issue.find :all, :order => sort_clause,
209 212 :include => [ :author, :status, :tracker, :project ],
210 213 :conditions => search_filter_clause,
211 214 :limit => @issue_pages.items_per_page,
212 215 :offset => @issue_pages.current.offset
213 216 end
214 217
215 218 # Export filtered/sorted issues list to CSV
216 219 def export_issues_csv
217 220 sort_init 'issues.id', 'desc'
218 221 sort_update
219 222
220 223 search_filter_init_list_issues
221 224
222 225 @issues = Issue.find :all, :order => sort_clause,
223 226 :include => [ :author, :status, :tracker, :project ],
224 227 :conditions => search_filter_clause
225 228
226 229 export = StringIO.new
227 230 CSV::Writer.generate(export, ',') do |csv|
228 231 csv << %w(Id Status Tracker Subject Author Created Updated)
229 232 @issues.each do |issue|
230 233 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)]
231 234 end
232 235 end
233 236 export.rewind
234 237 send_data(export.read,
235 238 :type => 'text/csv; charset=utf-8; header=present',
236 239 :filename => 'export.csv')
237 240 end
238 241
239 242 # Add a news to @project
240 243 def add_news
241 244 @news = News.new(:project => @project)
242 245 if request.post?
243 246 @news.attributes = params[:news]
244 247 @news.author_id = self.logged_in_user.id if self.logged_in_user
245 248 if @news.save
249 flash[:notice] = l(:notice_successful_create)
246 250 redirect_to :action => 'list_news', :id => @project
247 251 end
248 252 end
249 253 end
250 254
251 255 # Show news list of @project
252 256 def list_news
253 257 @news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "news.created_on DESC"
254 258 end
255 259
256 260 def add_file
257 261 if request.post?
258 262 # Save the attachment
259 263 if params[:attachment][:file].size > 0
260 264 @attachment = @project.versions.find(params[:version_id]).attachments.build(params[:attachment])
261 265 @attachment.author_id = self.logged_in_user.id if self.logged_in_user
262 266 if @attachment.save
267 flash[:notice] = l(:notice_successful_create)
263 268 redirect_to :controller => 'projects', :action => 'list_files', :id => @project
264 269 end
265 270 end
266 271 end
267 272 @versions = @project.versions
268 273 end
269 274
270 275 def list_files
271 276 @versions = @project.versions
272 277 end
273 278
274 279 # Show changelog of @project
275 280 def changelog
276 281 @fixed_issues = @project.issues.find(:all,
277 282 :include => [ :fixed_version, :status, :tracker ],
278 283 :conditions => [ "issue_statuses.is_closed=? and trackers.is_in_chlog=? and issues.fixed_version_id is not null", true, true]
279 284 )
280 285 end
281 286
282 287 private
283 288 # Find project of id params[:id]
284 289 # if not found, redirect to project list
285 290 # used as a before_filter
286 291 def find_project
287 292 @project = Project.find(params[:id])
288 rescue
289 flash[:notice] = 'Project not found.'
293 rescue
290 294 redirect_to :action => 'list'
291 295 end
292 296 end
@@ -1,83 +1,83
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class RolesController < ApplicationController
19 19 layout 'base'
20 20 before_filter :require_admin
21 21
22 22 def index
23 23 list
24 24 render :action => 'list'
25 25 end
26 26
27 27 def list
28 28 @role_pages, @roles = paginate :roles, :per_page => 10
29 29 end
30 30
31 31 def new
32 32 @role = Role.new(params[:role])
33 33 if request.post?
34 34 @role.permissions = Permission.find(@params[:permission_ids]) if @params[:permission_ids]
35 35 if @role.save
36 flash[:notice] = 'Role was successfully created.'
36 flash[:notice] = l(:notice_successful_create)
37 37 redirect_to :action => 'list'
38 38 end
39 39 end
40 40 @permissions = Permission.find(:all, :conditions => ["is_public=?", false], :order => 'sort ASC')
41 41 end
42 42
43 43 def edit
44 44 @role = Role.find(params[:id])
45 45 if request.post? and @role.update_attributes(params[:role])
46 46 @role.permissions = Permission.find(@params[:permission_ids] || [])
47 47 Permission.allowed_to_role_expired
48 flash[:notice] = 'Role was successfully updated.'
48 flash[:notice] = l(:notice_successful_update)
49 49 redirect_to :action => 'list'
50 50 end
51 51 @permissions = Permission.find(:all, :conditions => ["is_public=?", false], :order => 'sort ASC')
52 52 end
53 53
54 54 def destroy
55 55 @role = Role.find(params[:id])
56 56 unless @role.members.empty?
57 57 flash[:notice] = 'Some members have this role. Can\'t delete it.'
58 58 else
59 59 @role.destroy
60 60 end
61 61 redirect_to :action => 'list'
62 62 end
63 63
64 64 def workflow
65 65 @role = Role.find_by_id(params[:role_id])
66 66 @tracker = Tracker.find_by_id(params[:tracker_id])
67 67
68 68 if request.post?
69 69 Workflow.destroy_all( ["role_id=? and tracker_id=?", @role.id, @tracker.id])
70 70 (params[:issue_status] || []).each { |old, news|
71 71 news.each { |new|
72 72 @role.workflows.build(:tracker_id => @tracker.id, :old_status_id => old, :new_status_id => new)
73 73 }
74 74 }
75 75 if @role.save
76 flash[:notice] = 'Workflow was successfully updated.'
76 flash[:notice] = l(:notice_successful_update)
77 77 end
78 78 end
79 79 @roles = Role.find_all
80 80 @trackers = Tracker.find_all
81 81 @statuses = IssueStatus.find(:all, :include => :workflows)
82 82 end
83 83 end
@@ -1,60 +1,60
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class TrackersController < ApplicationController
19 layout 'base'
20 before_filter :require_admin
19 layout 'base'
20 before_filter :require_admin
21 21
22 22 def index
23 23 list
24 24 render :action => 'list'
25 25 end
26 26
27 27 # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
28 28 verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :list }
29 29
30 30 def list
31 31 @tracker_pages, @trackers = paginate :trackers, :per_page => 10
32 32 end
33 33
34 34 def new
35 35 @tracker = Tracker.new(params[:tracker])
36 36 if request.post? and @tracker.save
37 flash[:notice] = 'Tracker was successfully created.'
37 flash[:notice] = l(:notice_successful_create)
38 38 redirect_to :action => 'list'
39 39 end
40 40 end
41 41
42 42 def edit
43 43 @tracker = Tracker.find(params[:id])
44 44 if request.post? and @tracker.update_attributes(params[:tracker])
45 flash[:notice] = 'Tracker was successfully updated.'
45 flash[:notice] = l(:notice_successful_update)
46 46 redirect_to :action => 'list'
47 47 end
48 48 end
49 49
50 50 def destroy
51 51 @tracker = Tracker.find(params[:id])
52 52 unless @tracker.issues.empty?
53 53 flash[:notice] = "This tracker contains issues and can\'t be deleted."
54 54 else
55 55 @tracker.destroy
56 56 end
57 57 redirect_to :action => 'list'
58 58 end
59 59
60 60 end
@@ -1,88 +1,88
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class UsersController < ApplicationController
19 19 layout 'base'
20 20 before_filter :require_admin
21 21
22 22 helper :sort
23 23 include SortHelper
24 24 helper :custom_fields
25 25 include CustomFieldsHelper
26 26
27 27 def index
28 28 list
29 29 render :action => 'list'
30 30 end
31 31
32 32 def list
33 33 sort_init 'login', 'asc'
34 34 sort_update
35 35 @user_count = User.count
36 36 @user_pages = Paginator.new self, @user_count,
37 37 15,
38 38 @params['page']
39 39 @users = User.find :all,:order => sort_clause,
40 40 :limit => @user_pages.items_per_page,
41 41 :offset => @user_pages.current.offset
42 42 end
43 43
44 44 def add
45 45 if request.get?
46 46 @user = User.new(:language => $RDM_DEFAULT_LANG)
47 47 @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user) }
48 48 else
49 49 @user = User.new(params[:user])
50 50 @user.admin = params[:user][:admin] || false
51 51 @user.login = params[:user][:login]
52 52 @user.password, @user.password_confirmation = params[:password], params[:password_confirmation]
53 53 @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) }
54 54 @user.custom_values = @custom_values
55 55 if @user.save
56 flash[:notice] = 'User was successfully created.'
56 flash[:notice] = l(:notice_successful_create)
57 57 redirect_to :action => 'list'
58 58 end
59 59 end
60 60 end
61 61
62 62 def edit
63 63 @user = User.find(params[:id])
64 64 if request.get?
65 65 @custom_values = UserCustomField.find(:all).collect { |x| @user.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) }
66 66 else
67 67 @user.admin = params[:user][:admin] if params[:user][:admin]
68 68 @user.login = params[:user][:login] if params[:user][:login]
69 69 @user.password, @user.password_confirmation = params[:password], params[:password_confirmation] unless params[:password].nil? or params[:password].empty?
70 70 if params[:custom_fields]
71 71 @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) }
72 72 @user.custom_values = @custom_values
73 73 end
74 74 if @user.update_attributes(params[:user])
75 flash[:notice] = 'User was successfully updated.'
75 flash[:notice] = l(:notice_successful_update)
76 76 redirect_to :action => 'list'
77 77 end
78 78 end
79 79 end
80 80
81 81 def destroy
82 82 User.find(params[:id]).destroy
83 83 redirect_to :action => 'list'
84 84 rescue
85 85 flash[:notice] = "Unable to delete user"
86 86 redirect_to :action => 'list'
87 87 end
88 88 end
@@ -1,56 +1,57
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class VersionsController < ApplicationController
19 layout 'base'
20 before_filter :find_project, :authorize
21
22 def edit
23 if request.post? and @version.update_attributes(params[:version])
24 flash[:notice] = 'Version was successfully updated.'
19 layout 'base'
20 before_filter :find_project, :authorize
21
22 def edit
23 if request.post? and @version.update_attributes(params[:version])
24 flash[:notice] = l(:notice_successful_update)
25 25 redirect_to :controller => 'projects', :action => 'settings', :id => @project
26 end
27 end
28
29 def destroy
30 @version.destroy
31 redirect_to :controller => 'projects', :action => 'settings', :id => @project
26 end
27 end
28
29 def destroy
30 @version.destroy
31 redirect_to :controller => 'projects', :action => 'settings', :id => @project
32 32 rescue
33 33 flash[:notice] = "Unable to delete version"
34 redirect_to :controller => 'projects', :action => 'settings', :id => @project
35 end
36
34 redirect_to :controller => 'projects', :action => 'settings', :id => @project
35 end
36
37 37 def download
38 38 @attachment = @version.attachments.find(params[:attachment_id])
39 39 @attachment.increment_download
40 40 send_file @attachment.diskfile, :filename => @attachment.filename
41 41 rescue
42 flash[:notice]="Requested file doesn't exist or has been deleted."
42 flash[:notice] = l(:notice_file_not_found)
43 43 redirect_to :controller => 'projects', :action => 'list_files', :id => @project
44 44 end
45 45
46 46 def destroy_file
47 47 @version.attachments.find(params[:attachment_id]).destroy
48 flash[:notice] = l(:notice_successful_delete)
48 49 redirect_to :controller => 'projects', :action => 'list_files', :id => @project
49 50 end
50 51
51 52 private
52 def find_project
53 def find_project
53 54 @version = Version.find(params[:id])
54 @project = @version.project
55 end
55 @project = @version.project
56 end
56 57 end
@@ -1,97 +1,97
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 module ApplicationHelper
19 19
20 20 # return current logged in user or nil
21 21 def loggedin?
22 22 @logged_in_user
23 23 end
24 24
25 25 # return true if user is loggend in and is admin, otherwise false
26 26 def admin_loggedin?
27 27 @logged_in_user and @logged_in_user.admin?
28 28 end
29 29
30 30 def authorize_for(controller, action)
31 31 # check if action is allowed on public projects
32 32 if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ controller, action ]
33 33 return true
34 34 end
35 35 # check if user is authorized
36 36 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) ) )
37 37 return true
38 38 end
39 39 return false
40 40 end
41 41
42 42 # Display a link if user is authorized
43 43 def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference)
44 44 link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller], options[:action])
45 45 end
46 46
47 47 # Display a link to user's account page
48 48 def link_to_user(user)
49 49 link_to user.display_name, :controller => 'account', :action => 'show', :id => user
50 50 end
51 51
52 52 def format_date(date)
53 53 l_date(date) if date
54 54 end
55 55
56 56 def format_time(time)
57 57 l_datetime(time) if time
58 58 end
59 59
60 60 def pagination_links_full(paginator, options={}, html_options={})
61 61 html =''
62 62 html << link_to(('&#171; ' + l(:label_previous) ), { :page => paginator.current.previous }) + ' ' if paginator.current.previous
63 63 html << (pagination_links(paginator, options, html_options) || '')
64 64 html << ' ' + link_to((l(:label_next) + ' &#187;'), { :page => paginator.current.next }) if paginator.current.next
65 65 html
66 66 end
67 67
68 68 def error_messages_for(object_name, options = {})
69 69 options = options.symbolize_keys
70 70 object = instance_variable_get("@#{object_name}")
71 71 if object && !object.errors.empty?
72 72 # build full_messages here with controller current language
73 73 full_messages = []
74 74 object.errors.each do |attr, msg|
75 75 next if msg.nil?
76 76 if attr == "base"
77 77 full_messages << l(msg)
78 78 else
79 79 full_messages << "&#171; " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " &#187; " + l(msg)
80 80 end
81 81 end
82 82 content_tag("div",
83 83 content_tag(
84 84 options[:header_tag] || "h2", lwr(:gui_validation_error, object.errors.count) + " :"
85 85 ) +
86 86 content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }),
87 87 "id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation"
88 88 )
89 89 else
90 90 ""
91 91 end
92 92 end
93 93
94 94 def lang_options_for_select
95 GLoc.valid_languages.collect {|lang| [ l_lang_name(lang.to_s, lang), lang.to_s]}
95 (GLoc.valid_languages.sort {|x,y| x.to_s <=> y.to_s }).collect {|lang| [ l_lang_name(lang.to_s, lang), lang.to_s]}
96 96 end
97 97 end
@@ -1,64 +1,67
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 module CustomFieldsHelper
19 19
20 20 def custom_field_tag(custom_value)
21 21 custom_field = custom_value.custom_field
22 22 field_name = "custom_fields[#{custom_field.id}]"
23 field_id = "custom_fields_#{custom_field.id}"
24
23 25 case custom_field.field_format
24 26 when "string", "int", "date"
25 text_field_tag field_name, custom_value.value
27 text_field_tag field_name, custom_value.value, :id => field_id
26 28 when "text"
27 text_area_tag field_name, custom_value.value, :cols => 60, :rows => 3
29 text_area_tag field_name, custom_value.value, :id => field_id, :cols => 60, :rows => 3
28 30 when "bool"
29 check_box_tag(field_name, "1", custom_value.value == "1") +
31 check_box_tag(field_name, "1", custom_value.value == "1", :id => field_id) +
30 32 hidden_field_tag(field_name, "0")
31 33 when "list"
32 34 select_tag field_name,
33 35 "<option></option>" + options_for_select(custom_field.possible_values.split('|'),
34 custom_value.value)
36 custom_value.value), :id => field_id
35 37 end
36 38 end
37 39
38 40 def custom_field_label_tag(custom_value)
39 41 content_tag "label", custom_value.custom_field.name +
40 (custom_value.custom_field.is_required? ? " <span class=\"required\">*</span>" : "")
42 (custom_value.custom_field.is_required? ? " <span class=\"required\">*</span>" : ""),
43 :for => "custom_fields_#{custom_value.custom_field.id}"
41 44 end
42 45
43 46 def custom_field_tag_with_label(custom_value)
44 47 case custom_value.custom_field.field_format
45 48 when "bool"
46 49 custom_field_tag(custom_value) + " " + custom_field_label_tag(custom_value)
47 50 else
48 51 custom_field_label_tag(custom_value) + "<br />" + custom_field_tag(custom_value)
49 52 end
50 53 end
51 54
52 55 def show_value(custom_value)
53 56 case custom_value.custom_field.field_format
54 57 when "bool"
55 58 l_YesNo(custom_value.value == "1")
56 59 else
57 60 custom_value.value
58 61 end
59 62 end
60 63
61 64 def custom_field_formats_for_select
62 65 CustomField::FIELD_FORMATS.keys.collect { |k| [ l(CustomField::FIELD_FORMATS[k]), k ] }
63 66 end
64 67 end
@@ -1,57 +1,57
1 1 <h2><%=l(:label_my_account)%></h2>
2 2
3 3 <p><%=l(:field_login)%>: <strong><%= @user.login %></strong><br />
4 4 <%=l(:field_created_on)%>: <%= format_time(@user.created_on) %>,
5 5 <%=l(:field_updated_on)%>: <%= format_time(@user.updated_on) %></p>
6 6
7 7 <%= error_messages_for 'user' %>
8 8
9 9 <div class="splitcontentleft">
10 10 <div class="box">
11 11 <h3><%=l(:label_information_plural)%></h3>
12 &nbsp;
12
13 13 <%= start_form_tag :action => 'my_account' %>
14 14
15 15 <!--[form:user]-->
16 16 <p><label for="user_firstname"><%=l(:field_firstname)%> <span class="required">*</span></label><br/>
17 17 <%= text_field 'user', 'firstname' %></p>
18 18
19 19 <p><label for="user_lastname"><%=l(:field_lastname)%> <span class="required">*</span></label><br/>
20 20 <%= text_field 'user', 'lastname' %></p>
21 21
22 22 <p><label for="user_mail"><%=l(:field_mail)%> <span class="required">*</span></label><br/>
23 <%= text_field 'user', 'mail' %></p>
23 <%= text_field 'user', 'mail', :size => 40 %></p>
24 24
25 25 <p><label for="user_language"><%=l(:field_language)%></label><br/>
26 26 <%= select("user", "language", lang_options_for_select) %></p>
27 27 <!--[eoform:user]-->
28 28
29 29 <p><%= check_box 'user', 'mail_notification' %> <label for="user_mail_notification"><%=l(:field_mail_notification)%></label></p>
30 30
31 31 <center><%= submit_tag l(:button_save) %></center>
32 32 <%= end_form_tag %>
33 33 </div>
34 34 </div>
35 35
36 36
37 37 <div class="splitcontentright">
38 38 <% unless @user.auth_source_id %>
39 39 <div class="box">
40 40 <h3><%=l(:field_password)%></h3>
41 &nbsp;
41
42 42 <%= start_form_tag :action => 'change_password' %>
43 43
44 44 <p><label for="password"><%=l(:field_password)%> <span class="required">*</span></label><br/>
45 45 <%= password_field_tag 'password', nil, :size => 25 %></p>
46 46
47 47 <p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label><br/>
48 48 <%= password_field_tag 'new_password', nil, :size => 25 %></p>
49 49
50 50 <p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label><br/>
51 51 <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
52 52
53 53 <center><%= submit_tag l(:button_save) %></center>
54 54 <%= end_form_tag %>
55 55 </div>
56 56 <% end %>
57 57 </div> No newline at end of file
@@ -1,16 +1,25
1 1 <h2><%=l(:field_mail_notification)%></h2>
2 2
3 3 <p><%=l(:text_select_mail_notifications)%></p>
4 4
5 5 <%= start_form_tag ({}, :id => 'mail_options_form')%>
6 <% for action in @actions %>
7 <%= check_box_tag "action_ids[]", action.id, action.mail_enabled? %>
8 <%= action.description %><br />
6
7 <% actions = @actions.group_by {|p| p.group_id } %>
8 <% actions.keys.sort.each do |group_id| %>
9 <fieldset style="margin-top: 6px;"><legend><strong><%= l(Permission::GROUPS[group_id]) %></strong></legend>
10 <% actions[group_id].each do |p| %>
11 <div style="width:170px;float:left;"><%= check_box_tag "action_ids[]", p.id, p.mail_enabled? %>
12 <%= l(p.description.to_sym) %>
13 </div>
14 <% end %>
15 </fieldset>
9 16 <% end %>
17
18
10 19 <br />
11 20 <p>
12 21 <a href="javascript:checkAll('mail_options_form', true)"><%=l(:button_check_all)%></a> |
13 22 <a href="javascript:checkAll('mail_options_form', false)"><%=l(:button_uncheck_all)%></a>
14 23 </p>
15 24 <%= submit_tag l(:button_save) %>
16 25 <%= end_form_tag %> No newline at end of file
@@ -1,74 +1,72
1 1 <h2><%=l(:label_overview)%></h2>
2 2
3 3 <div class="splitcontentleft">
4 4 <%= @project.description %>
5 5 <ul>
6 6 <li><%=l(:field_homepage)%>: <%= link_to @project.homepage, @project.homepage %></li>
7 7 <li><%=l(:field_created_on)%>: <%= format_date(@project.created_on) %></li>
8 8 <% for custom_value in @custom_values %>
9 9 <% if !custom_value.value.empty? %>
10 10 <li><%= custom_value.custom_field.name%>: <%= custom_value.value%></li>
11 11 <% end %>
12 12 <% end %>
13 13 </ul>
14 14
15 15 <div class="box">
16 16 <h3><%= image_tag "tracker" %> <%=l(:label_tracker_plural)%></h3>
17 17 <ul>
18 18 <% for tracker in @trackers %>
19 19 <li><%= link_to tracker.name, :controller => 'projects', :action => 'list_issues', :id => @project,
20 20 :set_filter => 1,
21 21 "tracker_id" => tracker.id %>:
22 22 <%= issue_count = Issue.count(:conditions => ["project_id=? and tracker_id=? and issue_statuses.is_closed=?", @project.id, tracker.id, false], :include => :status) %>
23 23 <%= lwr(:label_open_issues, issue_count) %>
24 24 </li>
25 25 <% end %>
26 26 </ul>
27 27 <% if authorize_for 'projects', 'add_issue' %>
28 28 &#187; <%=l(:label_issue_new)%>:
29 29 <ul>
30 30 <% @trackers.each do |tracker| %>
31 31 <li><%= link_to tracker.name, :controller => 'projects', :action => 'add_issue', :id => @project, :tracker_id => tracker %></li>
32 32 <% end %>
33 33 </ul>
34 34 <% end %>
35 35 <center><small>[ <%= link_to l(:label_issue_view_all), :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 %> ]</small></center>
36 36 </div>
37 37 </div>
38 38
39 39 <div class="splitcontentright">
40 40 <div class="box">
41 41 <h3><%= image_tag "users" %> <%=l(:label_member_plural)%></h3>
42 42 <% for member in @members %>
43 43 <%= link_to_user member.user %> (<%= member.role.name %>)<br />
44 44 <% end %>
45 45 </div>
46 46
47 47 <% if @subprojects %>
48 48 <div class="box">
49 49 <h3><%= image_tag "projects" %> <%=l(:label_subproject_plural)%></h3>
50 50 <% for subproject in @subprojects %>
51 51 <%= link_to subproject.name, :action => 'show', :id => subproject %><br />
52 52 <% end %>
53 53 </div>
54 54 <% end %>
55 55
56 56 <div class="box">
57 57 <h3><%=l(:label_news_latest)%></h3>
58 58 <% for news in @news %>
59 <p>
60 <b><%= news.title %></b> <small>(<%= link_to_user news.author %> <%= format_time(news.created_on) %>)</small><br />
59 <p><b><%= news.title %></b> <small>(<%= link_to_user news.author %> <%= format_time(news.created_on) %>)</small><br />
61 60 <%= news.summary %>
62 <small>[<%= link_to l(:label_read), :controller => 'news', :action => 'show', :id => news %>]</small>
63 </p>
61 <small>[<%= link_to l(:label_read), :controller => 'news', :action => 'show', :id => news %>]</small></p>
64 62 <hr />
65 63 <% end %>
66 64 <center><small>[ <%= link_to l(:label_news_view_all), :controller => 'projects', :action => 'list_news', :id => @project %> ]</small></center>
67 65 </div>
68 66 </div>
69 67
70 68
71 69
72 70
73 71
74 72
@@ -1,289 +1,289
1 1 _gloc_rule_default: '|n| n==1 ? "" : "_plural" '
2 2
3 3 actionview_datehelper_select_day_prefix:
4 4 actionview_datehelper_select_month_names: Enero,Febrero,Marzo,Abril,Mayo,Junio,Julio,Agosto,Septiembre,Octubre,Noviembre,Diciembre
5 5 actionview_datehelper_select_month_names_abbr: Ene,Feb,Mar,Abr,Mayo,Jun,Jul,Ago,Sep,Oct,Nov,Dic
6 6 actionview_datehelper_select_month_prefix:
7 7 actionview_datehelper_select_year_prefix:
8 8 actionview_datehelper_time_in_words_day: 1 day
9 9 actionview_datehelper_time_in_words_day_plural: %d days
10 10 actionview_datehelper_time_in_words_hour_about: about an hour
11 11 actionview_datehelper_time_in_words_hour_about_plural: about %d hours
12 12 actionview_datehelper_time_in_words_hour_about_single: about an hour
13 13 actionview_datehelper_time_in_words_minute: 1 minute
14 14 actionview_datehelper_time_in_words_minute_half: half a minute
15 15 actionview_datehelper_time_in_words_minute_less_than: less than a minute
16 16 actionview_datehelper_time_in_words_minute_plural: %d minutes
17 17 actionview_datehelper_time_in_words_minute_single: 1 minute
18 18 actionview_datehelper_time_in_words_second_less_than: less than a second
19 19 actionview_datehelper_time_in_words_second_less_than_plural: less than %d seconds
20 20 actionview_instancetag_blank_option: Please select
21 21
22 22 activerecord_error_inclusion: is not included in the list
23 23 activerecord_error_exclusion: is reserved
24 24 activerecord_error_invalid: is invalid
25 25 activerecord_error_confirmation: doesn't match confirmation
26 26 activerecord_error_accepted: must be accepted
27 27 activerecord_error_empty: can't be empty
28 28 activerecord_error_blank: can't be blank
29 29 activerecord_error_too_long: is too long
30 30 activerecord_error_too_short: is too short
31 31 activerecord_error_wrong_length: is the wrong length
32 32 activerecord_error_taken: has already been taken
33 33 activerecord_error_not_a_number: is not a number
34 34
35 general_fmt_age: %d yr
36 general_fmt_age_plural: %d yrs
37 general_fmt_date: %%b %%d, %%Y (%%a)
38 general_fmt_datetime: %%b %%d, %%Y (%%a), %%I:%%M %%p
39 general_fmt_datetime_short: %%b %%d, %%I:%%M %%p
40 general_fmt_time: %%I:%%M %%p
35 general_fmt_age: %d aΓ±o
36 general_fmt_age_plural: %d aΓ±os
37 general_fmt_date: %%d/%%m/%%Y
38 general_fmt_datetime: %%d/%%m/%%Y %%H:%%M
39 general_fmt_datetime_short: %%d/%%m %%H:%%M
40 general_fmt_time: %%H:%%M
41 41 general_text_No: 'No'
42 general_text_Yes: 'Yes'
42 general_text_Yes: 'SΓ­'
43 43 general_text_no: 'no'
44 general_text_yes: 'yes'
44 general_text_yes: 'sΓ­'
45 45 general_lang_es: 'EspaΓ±ol'
46 46
47 47 notice_account_updated: Account was successfully updated.
48 48 notice_account_invalid_creditentials: Invalid user or password
49 49 notice_account_password_updated: Password was successfully updated.
50 50 notice_account_wrong_password: Wrong password
51 51 notice_account_register_done: Account was successfully created.
52 52 notice_account_unknown_email: Unknown user.
53 53 notice_can_t_change_password: This account uses an external authentication source. Impossible to change the password.
54 54 notice_account_lost_email_sent: An email with instructions to choose a new password has been sent to you.
55 55 notice_account_activated: Your account has been activated. You can now log in.
56 56 notice_successful_create: Successful creation.
57 57 notice_successful_update: Successful update.
58 58 notice_successful_delete: Successful deletion.
59 59 notice_successful_connection: Successful connection.
60 60 notice_file_not_found: Requested file doesn't exist or has been deleted.
61 61
62 62 gui_validation_error: 1 error
63 gui_validation_error_plural: %d errors
63 gui_validation_error_plural: %d errores
64 64
65 65 field_name: Nombre
66 66 field_description: DescripciΓ³n
67 67 field_summary: Resumen
68 68 field_is_required: Obligatorio
69 69 field_firstname: Nombre
70 70 field_lastname: Apellido
71 71 field_mail: Email
72 72 field_filename: Fichero
73 #field_filesize: Size
73 field_filesize: TamaΓ±o
74 74 field_downloads: Telecargas
75 75 field_author: Autor
76 76 field_created_on: Creado
77 77 field_updated_on: Actualizado
78 #field_field_format: Format
78 field_field_format: Formato
79 79 field_is_for_all: Para todos los proyectos
80 80 field_possible_values: Valores posibles
81 81 field_regexp: ExpresiΓ³n regular
82 82 #field_min_length: Minimum length
83 83 #field_max_length: Maximum length
84 84 field_value: Valor
85 85 field_category: CategorΓ­a
86 86 field_title: TΓ­tulo
87 87 field_project: Proyecto
88 88 field_issue: PeticiΓ³n
89 89 field_status: Estatuto
90 #field_notes: Notes
90 field_notes: Notas
91 91 field_is_closed: PeticiΓ³n resuelta
92 92 field_is_default: Estatuto por defecto
93 93 field_html_color: Color
94 94 field_tracker: Tracker
95 95 field_subject: Tema
96 96 #field_due_date: Due date
97 97 field_assigned_to: Asignado a
98 98 field_priority: Prioridad
99 99 field_fixed_version: VersiΓ³n corregida
100 100 field_user: Usuario
101 101 field_role: Papel
102 102 field_homepage: Sitio web
103 103 field_is_public: PΓΊblico
104 104 #field_parent: Subproject de
105 105 field_is_in_chlog: Consultar las peticiones en el histΓ³rico
106 106 field_login: Identificador
107 107 field_mail_notification: NotificaciΓ³n por mail
108 108 field_admin: Administrador
109 109 field_locked: Cerrado
110 110 field_last_login_on: Última conexión
111 111 field_language: Lengua
112 112 field_effective_date: Fecha
113 113 field_password: ContraseΓ±a
114 114 field_new_password: Nueva contraseΓ±a
115 115 field_password_confirmation: ConfirmaciΓ³n
116 116 field_version: VersiΓ³n
117 117 field_type: Tipo
118 118 #field_host: Host
119 119 #field_port: Port
120 120 #field_account: Account
121 121 #field_base_dn: Base DN
122 122 #field_attr_login: Login attribute
123 123 #field_attr_firstname: Firstname attribute
124 124 #field_attr_lastname: Lastname attribute
125 125 #field_attr_mail: Email attribute
126 126 #field_onthefly: On-the-fly user creation
127 127
128 128 label_user: Usuario
129 129 label_user_plural: Usuarios
130 130 label_user_new: Nuevo usuario
131 131 label_project: Proyecto
132 132 label_project_new: Nuevo proyecto
133 133 label_project_plural: Proyectos
134 134 #label_project_latest: Latest projects
135 135 label_issue: PeticiΓ³n
136 136 label_issue_new: Nueva peticiΓ³n
137 137 label_issue_plural: Peticiones
138 138 label_issue_view_all: Ver todas las peticiones
139 139 label_document: Documento
140 140 label_document_new: Nuevo documento
141 141 label_document_plural: Documentos
142 142 label_role: Papel
143 143 label_role_plural: Papeles
144 144 label_role_new: Nuevo papel
145 145 label_role_and_permissions: Papeles y permisos
146 146 label_member: Miembro
147 147 label_member_new: Nuevo miembro
148 148 label_member_plural: Miembros
149 149 label_tracker: Tracker
150 150 label_tracker_plural: Trackers
151 151 label_tracker_new: Nuevo tracker
152 152 label_workflow: Workflow
153 153 label_issue_status: Estatuto de peticiΓ³n
154 154 label_issue_status_plural: Estatutos de las peticiones
155 155 label_issue_status_new: Nuevo estatuto
156 156 label_issue_category: CategorΓ­a de las peticiones
157 157 label_issue_category_plural: CategorΓ­as de las peticiones
158 158 label_issue_category_new: Nueva categorΓ­a
159 159 label_custom_field: Campo personalizado
160 160 label_custom_field_plural: Campos personalizados
161 161 label_custom_field_new: Nuevo campo personalizado
162 162 label_enumerations: Listas de valores
163 163 label_enumeration_new: Nuevo valor
164 164 label_information: Informacion
165 165 label_information_plural: Informaciones
166 166 label_please_login: ConexiΓ³n
167 167 #label_register: Register
168 #label_password_lost: Lost password
168 label_password_lost: ΒΏOlvidaste la contraseΓ±a?
169 169 label_home: Acogida
170 170 label_my_page: Mi pΓ‘gina
171 171 label_my_account: Mi cuenta
172 172 label_my_projects: Mis proyectos
173 173 label_administration: AdministraciΓ³n
174 174 label_login: ConexiΓ³n
175 175 label_logout: DesconexiΓ³n
176 176 label_help: Ayuda
177 177 label_reported_issues: Peticiones registradas
178 178 label_assigned_to_me_issues: Peticiones que me estΓ‘n asignadas
179 179 label_last_login: Última conexión
180 180 label_last_updates: Actualizado
181 181 label_last_updates_plural: %d Actualizados
182 182 label_registered_on: Inscrito el
183 183 label_activity: Actividad
184 184 label_new: Nuevo
185 185 label_logged_as: Conectado como
186 186 #label_environment: Environment
187 187 #label_authentication: Authentication
188 188 #label_auth_source: Authentification mode
189 189 #label_auth_source_new: New authentication mode
190 190 #label_auth_source_plural: Authentification modes
191 191 #label_subproject: Subproject
192 192 #label_subproject_plural: Subprojects
193 193 #label_min_max_length: Min - Max length
194 194 #label_list: List
195 195 label_date: Fecha
196 196 #label_integer: Integer
197 197 #label_boolean: Boolean
198 198 #label_string: String
199 199 #label_text: Text
200 200 #label_attribute: Attribute
201 201 #label_attribute_plural: Attributes
202 202 label_download: %d Telecarga
203 203 label_download_plural: %d Telecargas
204 204 #label_no_data: No data to display
205 205 label_change_status: Cambiar el estatuto
206 206 label_history: HistΓ³rico
207 207 label_attachment: Fichero
208 208 label_attachment_new: Nuevo fichero
209 209 #label_attachment_delete: Delete file
210 210 label_attachment_plural: Ficheros
211 211 #label_report: Report
212 212 #label_report_plural: Reports
213 213 label_news: Noticia
214 214 label_news_new: Nueva noticia
215 215 label_news_plural: Noticias
216 216 label_news_latest: Últimas noticias
217 217 label_news_view_all: Ver todas las noticias
218 218 label_change_log: Cambios
219 219 label_settings: ConfiguraciΓ³n
220 220 label_overview: Vistazo
221 221 label_version: VersiΓ³n
222 222 label_version_new: Nueva versiΓ³n
223 223 label_version_plural: VersiΓ³nes
224 224 label_confirmation: ConfirmaciΓ³n
225 #label_export_csv: Export to CSV
225 label_export_csv: Exportar a CSV
226 226 label_read: Leer...
227 227 label_public_projects: Proyectos publicos
228 228 label_open_issues: Abierta
229 229 label_open_issues_plural: Abiertas
230 230 label_closed_issues: Cerrada
231 231 label_closed_issues_plural: Cerradas
232 232 label_total: Total
233 233 label_permissions: Permisos
234 234 #label_current_status: Current status
235 235 label_new_statuses_allowed: Nuevos estatutos autorizados
236 236 label_all: Todos
237 237 label_none: Ninguno
238 238 label_next: PrΓ³ximo
239 239 label_previous: Precedente
240 240 label_used_by: Utilizado por
241 241
242 242 button_login: ConexiΓ³n
243 243 button_submit: Someter
244 244 button_save: Validar
245 245 button_check_all: Seleccionar todo
246 246 button_uncheck_all: No seleccionar nada
247 247 button_delete: Suprimir
248 248 button_create: Crear
249 249 button_test: Testar
250 250 button_edit: Modificar
251 251 button_add: AΓ±adir
252 252 button_change: Cambiar
253 253 button_apply: Aplicar
254 254 button_clear: Anular
255 255 button_lock: Bloquear
256 256 button_unlock: Desbloquear
257 257 button_download: Telecargar
258 258 button_list: Listar
259 259 button_view: Ver
260 260
261 261 text_select_mail_notifications: Seleccionar las actividades que necesitan la activaciΓ³n de la notificaciΓ³n por mail.
262 262 text_regexp_info: eg. ^[A-Z0-9]+$
263 263 text_min_max_length_info: 0 para ninguna restricciΓ³n
264 264 #text_possible_values_info: values separated with |
265 265 text_project_destroy_confirmation: ΒΏ EstΓ‘s seguro de querer eliminar el proyecto ?
266 266 text_workflow_edit: Seleccionar un workflow para actualizar
267 267
268 #default_role_manager: Manager
269 #default_role_developper: Developer
270 #default_role_reporter: Reporter
268 default_role_manager: Manager
269 default_role_developper: Desarrollador
270 default_role_reporter: Informador
271 271 default_tracker_bug: AnomalΓ­a
272 272 default_tracker_feature: EvoluciΓ³n
273 273 default_tracker_support: Asistencia
274 274 default_issue_status_new: Nuevo
275 275 default_issue_status_assigned: Asignada
276 276 default_issue_status_resolved: Resuelta
277 277 default_issue_status_feedback: Comentario
278 278 default_issue_status_closed: Cerrada
279 279 default_issue_status_rejected: Rechazada
280 280 default_doc_category_user: DocumentaciΓ³n del usuario
281 281 default_doc_category_tech: DocumentaciΓ³n tecnica
282 282 default_priority_low: Bajo
283 283 default_priority_normal: Normal
284 284 default_priority_high: Alto
285 285 default_priority_urgent: Urgente
286 286 default_priority_immediate: Ahora
287 287
288 288 enumeration_issue_priorities: Prioridad de las peticiones
289 289 enumeration_doc_categories: CategorΓ­as del documento
@@ -1,354 +1,354
1 1 /* andreas08 - an open source xhtml/css website layout by Andreas Viklund - http://andreasviklund.com . Free to use in any way and for any purpose as long as the proper credits are given to the original designer. Version: 1.0, November 28, 2005 */
2 2 /* Edited by Jean-Philippe Lang *>
3 3 /**************** Body and tag styles ****************/
4 4
5 5
6 6 #header * {margin:0; padding:0;}
7 7 p, ul, ol, li {margin:0; padding:0;}
8 8
9 9
10 10 body{
11 11 font:76% Verdana,Tahoma,Arial,sans-serif;
12 12 line-height:1.4em;
13 13 text-align:center;
14 14 color:#303030;
15 15 background:#e8eaec;
16 16 }
17 17
18 18
19 19 a{
20 20 color:#467aa7;
21 21 font-weight:bold;
22 22 text-decoration:none;
23 23 background-color:inherit;
24 24 }
25 25
26 26 a:hover{color:#2a5a8a; text-decoration:none; background-color:inherit;}
27 27 a img{border:none;}
28 28
29 29 p{padding:0 0 1em 0;}
30 30 p form{margin-top:0; margin-bottom:20px;}
31 31
32 32 img.left,img.center,img.right{padding:4px; border:1px solid #a0a0a0;}
33 33 img.left{float:left; margin:0 12px 5px 0;}
34 34 img.center{display:block; margin:0 auto 5px auto;}
35 35 img.right{float:right; margin:0 0 5px 12px;}
36 36
37 37 /**************** Header and navigation styles ****************/
38 38
39 39 #container{
40 40 width:100%;
41 41 min-width: 800px;
42 42 margin:5px auto;
43 43 padding:1px 0;
44 44 text-align:left;
45 45 background:#ffffff;
46 46 color:#303030;
47 47 border:2px solid #a0a0a0;
48 48 }
49 49
50 50 #header{
51 51 height:5.5em;
52 52 /*width:758px;*/
53 53 margin:0 1px 1px 1px;
54 54 background:#467aa7;
55 55 color:#ffffff;
56 56 }
57 57
58 58 #header h1{
59 59 padding:14px 0 0 20px;
60 60 font-size:2.4em;
61 61 background-color:inherit;
62 62 color:#fff; /*rgb(152, 26, 33);*/
63 63 letter-spacing:-2px;
64 64 font-weight:normal;
65 65 }
66 66
67 67 #header h2{
68 68 margin:10px 0 0 40px;
69 69 font-size:1.4em;
70 70 background-color:inherit;
71 71 color:#f0f2f4;
72 72 letter-spacing:-1px;
73 73 font-weight:normal;
74 74 }
75 75
76 76 #navigation{
77 77 height:2.2em;
78 78 line-height:2.2em;
79 79 /*width:758px;*/
80 80 margin:0 1px;
81 81 background:#578bb8;
82 82 color:#ffffff;
83 83 }
84 84
85 85 #navigation li{
86 86 float:left;
87 87 list-style-type:none;
88 88 border-right:1px solid #ffffff;
89 89 white-space:nowrap;
90 90 }
91 91
92 92 #navigation li.right {
93 93 float:right;
94 94 list-style-type:none;
95 95 border-right:0;
96 96 border-left:1px solid #ffffff;
97 97 white-space:nowrap;
98 98 }
99 99
100 100 #navigation li a{
101 101 display:block;
102 102 padding:0px 10px 0px 22px;
103 103 font-size:0.8em;
104 104 font-weight:normal;
105 105 /*text-transform:uppercase;*/
106 106 text-decoration:none;
107 107 background-color:inherit;
108 108 color: #ffffff;
109 109 }
110 110
111 111 * html #navigation a {width:1%;}
112 112
113 113 #navigation .selected,#navigation a:hover{
114 114 color:#ffffff;
115 115 text-decoration:none;
116 116 background-color: #80b0da;
117 117 }
118 118
119 119 /**************** Icons links *******************/
120 120 .picHome { background: url(../images/home.png) no-repeat 4px 50%; }
121 121 .picUser { background: url(../images/user.png) no-repeat 4px 50%; }
122 122 .picUserPage { background: url(../images/user_page.png) no-repeat 4px 50%; }
123 123 .picAdmin { background: url(../images/admin.png) no-repeat 4px 50%; }
124 124 .picProject { background: url(../images/projects.png) no-repeat 4px 50%; }
125 125 .picLogout { background: url(../images/logout.png) no-repeat 4px 50%; }
126 126 .picHelp { background: url(../images/help.png) no-repeat 4px 50%; }
127 127
128 128 /**************** Content styles ****************/
129 129
130 130 #content{
131 131 /*float:right;*/
132 132 /*width:530px;*/
133 133 width: auto;
134 134 min-height: 500px;
135 135 font-size:0.9em;
136 136 padding:20px 10px 10px 20px;
137 137 /*position: absolute;*/
138 138 margin: 0 0 0 140px;
139 139 border-left: 1px dashed #c0c0c0;
140 140 }
141 141
142 142 #content h2{
143 143 display:block;
144 144 margin:0 0 16px 0;
145 145 font-size:1.7em;
146 146 font-weight:normal;
147 147 letter-spacing:-1px;
148 148 color:#505050;
149 149 background-color:inherit;
150 150 }
151 151
152 152 #content h2 a{font-weight:normal;}
153 #content h3{margin:0 0 5px 0; font-size:1.4em; letter-spacing:-1px;}
153 #content h3{margin:0 0 12px 0; font-size:1.4em; letter-spacing:-1px;}
154 154 #content a:hover,#subcontent a:hover{text-decoration:underline;}
155 155 #content ul,#content ol{margin:0 5px 16px 35px;}
156 156 #content dl{margin:0 5px 10px 25px;}
157 157 #content dt{font-weight:bold; margin-bottom:5px;}
158 158 #content dd{margin:0 0 10px 15px;}
159 159
160 160
161 161 /***********************************************/
162 162
163 163 /*
164 164 form{
165 165 padding:15px;
166 166 margin:0 0 20px 0;
167 167 border:1px solid #c0c0c0;
168 168 background-color:#CEE1ED;
169 169 width:600px;
170 170 }
171 171 */
172 172
173 173 form {
174 174 display: inline;
175 175 }
176 176
177 177 .noborder {
178 178 border:0px;
179 179 background-color:#fff;
180 180 width:100%;
181 181 }
182 182
183 183 textarea {
184 184 padding:0;
185 185 margin:0;
186 186 }
187 187
188 188 input {
189 189 vertical-align: top;
190 190 }
191 191
192 192 input.button-small
193 193 {
194 194 font-size: 0.8em;
195 195 }
196 196
197 197 select.select-small
198 198 {
199 199 border: 1px solid #7F9DB9;
200 200 padding: 1px;
201 201 font-size: 0.8em;
202 202 }
203 203
204 204 .active-filter
205 205 {
206 206 background-color: #F9FA9E;
207 207
208 208 }
209 209
210 210 label {
211 211 font-weight: bold;
212 212 font-size: 1em;
213 213 }
214 214
215 215 fieldset {
216 216 border:1px solid #7F9DB9;
217 217 padding: 6px;
218 218 }
219 219
220 220 legend {
221 221 color: #505050;
222 222
223 223 }
224 224
225 225 .required {
226 226 color: #bb0000;
227 227 }
228 228
229 229 table.listTableContent {
230 230 /*margin: 2em 2em 2em 0; */
231 231 border:1px solid #c0c0c0;
232 232 width:99%;
233 233 }
234 234
235 235 table.listTableContent td {
236 236 margin: 2px;
237 237
238 238 }
239 239
240 240 tr.ListHead {
241 241 background-color:#467aa7;
242 242 color:#FFFFFF;
243 243 text-align:center;
244 244 }
245 245
246 246 tr.ListHead a {
247 247 color:#FFFFFF;
248 248 text-decoration:underline;
249 249 }
250 250
251 251 tr.odd {
252 252 background-color: #C1E2F7;
253 253 }
254 254 tr.even {
255 255 background-color:#CEE1ED;
256 256 }
257 257
258 hr { border:0px; border-bottom:1px dashed #000000; }
258 hr { border:none; border-bottom: dotted 2px #c0c0c0; }
259 259
260 260
261 261 /**************** Sidebar styles ****************/
262 262
263 263 #subcontent{
264 264 float:left;
265 265 clear:both;
266 266 width:130px;
267 267 padding:20px 20px 10px 5px;
268 268 line-height:1.4em;
269 269 }
270 270
271 271 #subcontent h2{
272 272 display:block;
273 273 margin:0 0 15px 0;
274 274 font-size:1.6em;
275 275 font-weight:normal;
276 276 text-align:left;
277 277 letter-spacing:-1px;
278 278 color:#505050;
279 279 background-color:inherit;
280 280 }
281 281
282 282 #subcontent p{margin:0 0 16px 0; font-size:0.9em;}
283 283
284 284 /**************** Menublock styles ****************/
285 285
286 286 .menublock{margin:0 0 20px 8px; font-size:0.9em;}
287 287 .menublock li{list-style:none; display:block; padding:1px; margin-bottom:0px;}
288 288 .menublock li a{font-weight:bold; text-decoration:none;}
289 289 .menublock li a:hover{text-decoration:none;}
290 290 .menublock li ul{margin:3px 0 3px 15px; font-size:1em; font-weight:normal;}
291 291 .menublock li ul li{margin-bottom:0;}
292 292 .menublock li ul a{font-weight:normal;}
293 293
294 294 /**************** Searchbar styles ****************/
295 295
296 296 #searchbar{margin:0 0 20px 0;}
297 297 #searchbar form fieldset{margin-left:10px; border:0 solid;}
298 298
299 299 #searchbar #s{
300 300 height:1.2em;
301 301 width:110px;
302 302 margin:0 5px 0 0;
303 303 border:1px solid #a0a0a0;
304 304 }
305 305
306 306 #searchbar #searchbutton{
307 307 width:auto;
308 308 padding:0 1px;
309 309 border:1px solid #808080;
310 310 font-size:0.9em;
311 311 text-align:center;
312 312 }
313 313
314 314 /**************** Footer styles ****************/
315 315
316 316 #footer{
317 317 clear:both;
318 318 /*width:758px;*/
319 319 padding:5px 0;
320 320 margin:0 1px;
321 321 font-size:0.9em;
322 322 color:#f0f0f0;
323 323 background:#467aa7;
324 324 }
325 325
326 326 #footer p{padding:0; margin:0; text-align:center;}
327 327 #footer a{color:#f0f0f0; background-color:inherit; font-weight:bold;}
328 328 #footer a:hover{color:#ffffff; background-color:inherit; text-decoration: underline;}
329 329
330 330 /**************** Misc classes and styles ****************/
331 331
332 332 .splitcontentleft{float:left; width:49%;}
333 333 .splitcontentright{float:right; width:49%;}
334 334 .clear{clear:both;}
335 335 .small{font-size:0.8em;line-height:1.4em;padding:0 0 0 0;}
336 336 .hide{display:none;}
337 337 .textcenter{text-align:center;}
338 338 .textright{text-align:right;}
339 339 .important{color:#f02025; background-color:inherit; font-weight:bold;}
340 340
341 341 .box{
342 342 margin:0 0 20px 0;
343 343 padding:10px;
344 344 border:1px solid #c0c0c0;
345 345 background-color:#fafbfc;
346 346 color:#505050;
347 347 line-height:1.5em;
348 348 }
349 349
350 350 .login {
351 351 width: 50%;
352 352 text-align: left;
353 353 }
354 354
@@ -1,95 +1,100
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require "#{File.dirname(__FILE__)}/../test_helper"
19 19
20 20 class AccountTest < ActionController::IntegrationTest
21 21 fixtures :users
22 22
23 23 # Replace this with your real tests.
24 24 def test_login
25 25 get "account/my_page"
26 26 assert_redirected_to "account/login"
27 27 log_user('jsmith', 'jsmith')
28 28
29 29 get "account/my_account"
30 30 assert_response :success
31 31 assert_template "account/my_account"
32 32 end
33 33
34 34 def test_change_password
35 35 log_user('jsmith', 'jsmith')
36 36 get "account/my_account"
37 37 assert_response :success
38 38 assert_template "account/my_account"
39 39
40 40 post "account/change_password", :password => 'jsmith', :new_password => "hello", :new_password_confirmation => "hello2"
41 41 assert_response :success
42 assert_template "account/my_account"
42 43 assert_tag :tag => "div", :attributes => { :class => "errorExplanation" }
43
44
45 post "account/change_password", :password => 'jsmithZZ', :new_password => "hello", :new_password_confirmation => "hello"
46 assert_redirected_to "account/my_account"
47 assert_equal 'Wrong password', flash[:notice]
48
44 49 post "account/change_password", :password => 'jsmith', :new_password => "hello", :new_password_confirmation => "hello"
45 assert_response :success
50 assert_redirected_to "account/my_account"
46 51 log_user('jsmith', 'hello')
47 52 end
48 53
49 54 def test_my_account
50 55 log_user('jsmith', 'jsmith')
51 56 get "account/my_account"
52 57 assert_response :success
53 58 assert_template "account/my_account"
54 59
55 60 post "account/my_account", :user => {:firstname => "Joe", :login => "root", :admin => 1}
56 61 assert_response :success
57 62 assert_template "account/my_account"
58 63 user = User.find(2)
59 64 assert_equal "Joe", user.firstname
60 65 assert_equal "jsmith", user.login
61 66 assert_equal false, user.admin?
62 67 end
63 68
64 69 def test_my_page
65 70 log_user('jsmith', 'jsmith')
66 71 get "account/my_page"
67 72 assert_response :success
68 73 assert_template "account/my_page"
69 74 end
70 75
71 76 def test_lost_password
72 77 get "account/lost_password"
73 78 assert_response :success
74 79 assert_template "account/lost_password"
75 80
76 81 post "account/lost_password", :mail => 'jsmith@somenet.foo'
77 82 assert_redirected_to "account/login"
78 83
79 84 token = Token.find(:first)
80 85 assert_equal 'recovery', token.action
81 86 assert_equal 'jsmith@somenet.foo', token.user.mail
82 87 assert !token.expired?
83 88
84 89 get "account/lost_password", :token => token.value
85 90 assert_response :success
86 91 assert_template "account/password_recovery"
87 92
88 93 post "account/lost_password", :token => token.value, :new_password => 'newpass', :new_password_confirmation => 'newpass'
89 94 assert_redirected_to "account/login"
90 95 assert_equal 'Password was successfully updated.', flash[:notice]
91 96
92 97 log_user('jsmith', 'newpass')
93 98 assert_equal 0, Token.count
94 99 end
95 100 end
@@ -1,61 +1,61
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require "#{File.dirname(__FILE__)}/../test_helper"
19 19
20 20 class AdminTest < ActionController::IntegrationTest
21 21 fixtures :users
22 22
23 23 def test_add_user
24 24 log_user("admin", "admin")
25 25 get "/users/add"
26 26 assert_response :success
27 27 assert_template "users/add"
28 28 post "/users/add", :user => { :login => "psmith", :firstname => "Paul", :lastname => "Smith", :mail => "psmith@somenet.foo", :language => "en" }, :password => "psmith09", :password_confirmation => "psmith09"
29 29 assert_redirected_to "users/list"
30 30
31 31 user = User.find_by_login("psmith")
32 32 assert_kind_of User, user
33 33 logged_user = User.try_to_login("psmith", "psmith09")
34 34 assert_kind_of User, logged_user
35 35 assert_equal "Paul", logged_user.firstname
36 36
37 37 post "users/edit", :id => user.id, :user => { :status => User::STATUS_LOCKED }
38 38 assert_redirected_to "users/list"
39 39 locked_user = User.try_to_login("psmith", "psmith09")
40 40 assert_equal nil, locked_user
41 41 end
42 42
43 43 def test_add_project
44 44 log_user("admin", "admin")
45 45 get "projects/add"
46 46 assert_response :success
47 47 assert_template "projects/add"
48 48 post "projects/add", :project => { :name => "blog", :description => "weblog", :is_public => 1}
49 49 assert_redirected_to "admin/projects"
50 assert_equal 'Project was successfully created.', flash[:notice]
50 assert_equal 'Successful creation.', flash[:notice]
51 51
52 52 project = Project.find_by_name("blog")
53 53 assert_kind_of Project, project
54 54 assert_equal "weblog", project.description
55 55 assert_equal true, project.is_public?
56 56
57 57 get "admin/projects"
58 58 assert_response :success
59 59 assert_template "admin/projects"
60 60 end
61 61 end
General Comments 0
You need to be logged in to leave comments. Login now