##// END OF EJS Templates
* replaced :controller => '' broken statements by :controller => 'welcome'...
Jean-Philippe Lang -
r172:4e03668eec2c
parent child
Show More
@@ -1,133 +1,133
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 class AccountController < ApplicationController
18 class AccountController < ApplicationController
19 layout 'base'
19 layout 'base'
20 helper :custom_fields
20 helper :custom_fields
21 include CustomFieldsHelper
21 include CustomFieldsHelper
22
22
23 # prevents login action to be filtered by check_if_login_required application scope filter
23 # prevents login action to be filtered by check_if_login_required application scope filter
24 skip_before_filter :check_if_login_required, :only => [:login, :lost_password, :register]
24 skip_before_filter :check_if_login_required, :only => [:login, :lost_password, :register]
25 before_filter :require_login, :except => [:show, :login, :lost_password, :register]
25 before_filter :require_login, :except => [:show, :login, :lost_password, :register]
26
26
27 # Show user's account
27 # Show user's account
28 def show
28 def show
29 @user = User.find(params[:id])
29 @user = User.find(params[:id])
30 @custom_values = @user.custom_values.find(:all, :include => :custom_field)
30 @custom_values = @user.custom_values.find(:all, :include => :custom_field)
31 rescue ActiveRecord::RecordNotFound
31 rescue ActiveRecord::RecordNotFound
32 render_404
32 render_404
33 end
33 end
34
34
35 # Login request and validation
35 # Login request and validation
36 def login
36 def login
37 if request.get?
37 if request.get?
38 # Logout user
38 # Logout user
39 self.logged_in_user = nil
39 self.logged_in_user = nil
40 else
40 else
41 # Authenticate user
41 # Authenticate user
42 user = User.try_to_login(params[:login], params[:password])
42 user = User.try_to_login(params[:login], params[:password])
43 if user
43 if user
44 self.logged_in_user = user
44 self.logged_in_user = user
45 redirect_back_or_default :controller => 'my', :action => 'page'
45 redirect_back_or_default :controller => 'my', :action => 'page'
46 else
46 else
47 flash.now[:notice] = l(:notice_account_invalid_creditentials)
47 flash.now[:notice] = l(:notice_account_invalid_creditentials)
48 end
48 end
49 end
49 end
50 end
50 end
51
51
52 # Log out current user and redirect to welcome page
52 # Log out current user and redirect to welcome page
53 def logout
53 def logout
54 self.logged_in_user = nil
54 self.logged_in_user = nil
55 redirect_to :controller => ''
55 redirect_to :controller => 'welcome'
56 end
56 end
57
57
58 # Enable user to choose a new password
58 # Enable user to choose a new password
59 def lost_password
59 def lost_password
60 if params[:token]
60 if params[:token]
61 @token = Token.find_by_action_and_value("recovery", params[:token])
61 @token = Token.find_by_action_and_value("recovery", params[:token])
62 redirect_to :controller => '' and return unless @token and !@token.expired?
62 redirect_to :controller => 'welcome' and return unless @token and !@token.expired?
63 @user = @token.user
63 @user = @token.user
64 if request.post?
64 if request.post?
65 @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
65 @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
66 if @user.save
66 if @user.save
67 @token.destroy
67 @token.destroy
68 flash[:notice] = l(:notice_account_password_updated)
68 flash[:notice] = l(:notice_account_password_updated)
69 redirect_to :action => 'login'
69 redirect_to :action => 'login'
70 return
70 return
71 end
71 end
72 end
72 end
73 render :template => "account/password_recovery"
73 render :template => "account/password_recovery"
74 return
74 return
75 else
75 else
76 if request.post?
76 if request.post?
77 user = User.find_by_mail(params[:mail])
77 user = User.find_by_mail(params[:mail])
78 # user not found in db
78 # user not found in db
79 flash.now[:notice] = l(:notice_account_unknown_email) and return unless user
79 flash.now[:notice] = l(:notice_account_unknown_email) and return unless user
80 # user uses an external authentification
80 # user uses an external authentification
81 flash.now[:notice] = l(:notice_can_t_change_password) and return if user.auth_source_id
81 flash.now[:notice] = l(:notice_can_t_change_password) and return if user.auth_source_id
82 # create a new token for password recovery
82 # create a new token for password recovery
83 token = Token.new(:user => user, :action => "recovery")
83 token = Token.new(:user => user, :action => "recovery")
84 if token.save
84 if token.save
85 # send token to user via email
85 # send token to user via email
86 Mailer.set_language_if_valid(user.language)
86 Mailer.set_language_if_valid(user.language)
87 Mailer.deliver_lost_password(token)
87 Mailer.deliver_lost_password(token)
88 flash[:notice] = l(:notice_account_lost_email_sent)
88 flash[:notice] = l(:notice_account_lost_email_sent)
89 redirect_to :action => 'login'
89 redirect_to :action => 'login'
90 return
90 return
91 end
91 end
92 end
92 end
93 end
93 end
94 end
94 end
95
95
96 # User self-registration
96 # User self-registration
97 def register
97 def register
98 redirect_to :controller => '' and return unless Setting.self_registration?
98 redirect_to :controller => 'welcome' and return unless Setting.self_registration?
99 if params[:token]
99 if params[:token]
100 token = Token.find_by_action_and_value("register", params[:token])
100 token = Token.find_by_action_and_value("register", params[:token])
101 redirect_to :controller => '' and return unless token and !token.expired?
101 redirect_to :controller => 'welcome' and return unless token and !token.expired?
102 user = token.user
102 user = token.user
103 redirect_to :controller => '' and return unless user.status == User::STATUS_REGISTERED
103 redirect_to :controller => 'welcome' and return unless user.status == User::STATUS_REGISTERED
104 user.status = User::STATUS_ACTIVE
104 user.status = User::STATUS_ACTIVE
105 if user.save
105 if user.save
106 token.destroy
106 token.destroy
107 flash[:notice] = l(:notice_account_activated)
107 flash[:notice] = l(:notice_account_activated)
108 redirect_to :action => 'login'
108 redirect_to :action => 'login'
109 return
109 return
110 end
110 end
111 else
111 else
112 if request.get?
112 if request.get?
113 @user = User.new(:language => Setting.default_language)
113 @user = User.new(:language => Setting.default_language)
114 @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user) }
114 @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user) }
115 else
115 else
116 @user = User.new(params[:user])
116 @user = User.new(params[:user])
117 @user.admin = false
117 @user.admin = false
118 @user.login = params[:user][:login]
118 @user.login = params[:user][:login]
119 @user.status = User::STATUS_REGISTERED
119 @user.status = User::STATUS_REGISTERED
120 @user.password, @user.password_confirmation = params[:password], params[:password_confirmation]
120 @user.password, @user.password_confirmation = params[:password], params[:password_confirmation]
121 @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) }
121 @custom_values = UserCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @user, :value => params["custom_fields"][x.id.to_s]) }
122 @user.custom_values = @custom_values
122 @user.custom_values = @custom_values
123 token = Token.new(:user => @user, :action => "register")
123 token = Token.new(:user => @user, :action => "register")
124 if @user.save and token.save
124 if @user.save and token.save
125 Mailer.set_language_if_valid(@user.language)
125 Mailer.set_language_if_valid(@user.language)
126 Mailer.deliver_register(token)
126 Mailer.deliver_register(token)
127 flash[:notice] = l(:notice_account_register_done)
127 flash[:notice] = l(:notice_account_register_done)
128 redirect_to :controller => ''
128 redirect_to :controller => 'welcome' and return
129 end
129 end
130 end
130 end
131 end
131 end
132 end
132 end
133 end
133 end
@@ -1,132 +1,132
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 class ApplicationController < ActionController::Base
18 class ApplicationController < ActionController::Base
19 before_filter :check_if_login_required, :set_localization
19 before_filter :check_if_login_required, :set_localization
20
20
21 def logged_in_user=(user)
21 def logged_in_user=(user)
22 @logged_in_user = user
22 @logged_in_user = user
23 session[:user_id] = (user ? user.id : nil)
23 session[:user_id] = (user ? user.id : nil)
24 end
24 end
25
25
26 def logged_in_user
26 def logged_in_user
27 if session[:user_id]
27 if session[:user_id]
28 @logged_in_user ||= User.find(session[:user_id])
28 @logged_in_user ||= User.find(session[:user_id])
29 else
29 else
30 nil
30 nil
31 end
31 end
32 end
32 end
33
33
34 # check if login is globally required to access the application
34 # check if login is globally required to access the application
35 def check_if_login_required
35 def check_if_login_required
36 require_login if Setting.login_required?
36 require_login if Setting.login_required?
37 end
37 end
38
38
39 def set_localization
39 def set_localization
40 lang = begin
40 lang = begin
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
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 self.logged_in_user.language
42 self.logged_in_user.language
43 elsif request.env['HTTP_ACCEPT_LANGUAGE']
43 elsif request.env['HTTP_ACCEPT_LANGUAGE']
44 accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first.split('-').first
44 accept_lang = parse_qvalues(request.env['HTTP_ACCEPT_LANGUAGE']).first.split('-').first
45 if accept_lang and !accept_lang.empty? and GLoc.valid_languages.include? accept_lang.to_sym
45 if accept_lang and !accept_lang.empty? and GLoc.valid_languages.include? accept_lang.to_sym
46 accept_lang
46 accept_lang
47 end
47 end
48 end
48 end
49 rescue
49 rescue
50 nil
50 nil
51 end || Setting.default_language
51 end || Setting.default_language
52 set_language_if_valid(lang)
52 set_language_if_valid(lang)
53 end
53 end
54
54
55 def require_login
55 def require_login
56 unless self.logged_in_user
56 unless self.logged_in_user
57 store_location
57 store_location
58 redirect_to :controller => "account", :action => "login"
58 redirect_to :controller => "account", :action => "login"
59 return false
59 return false
60 end
60 end
61 true
61 true
62 end
62 end
63
63
64 def require_admin
64 def require_admin
65 return unless require_login
65 return unless require_login
66 unless self.logged_in_user.admin?
66 unless self.logged_in_user.admin?
67 render :nothing => true, :status => 403
67 render :nothing => true, :status => 403
68 return false
68 return false
69 end
69 end
70 true
70 true
71 end
71 end
72
72
73 # authorizes the user for the requested action.
73 # authorizes the user for the requested action.
74 def authorize(ctrl = params[:controller], action = params[:action])
74 def authorize(ctrl = params[:controller], action = params[:action])
75 # check if action is allowed on public projects
75 # check if action is allowed on public projects
76 if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ ctrl, action ]
76 if @project.is_public? and Permission.allowed_to_public "%s/%s" % [ ctrl, action ]
77 return true
77 return true
78 end
78 end
79 # if action is not public, force login
79 # if action is not public, force login
80 return unless require_login
80 return unless require_login
81 # admin is always authorized
81 # admin is always authorized
82 return true if self.logged_in_user.admin?
82 return true if self.logged_in_user.admin?
83 # if not admin, check membership permission
83 # if not admin, check membership permission
84 @user_membership ||= Member.find(:first, :conditions => ["user_id=? and project_id=?", self.logged_in_user.id, @project.id])
84 @user_membership ||= Member.find(:first, :conditions => ["user_id=? and project_id=?", self.logged_in_user.id, @project.id])
85 if @user_membership and Permission.allowed_to_role( "%s/%s" % [ ctrl, action ], @user_membership.role_id )
85 if @user_membership and Permission.allowed_to_role( "%s/%s" % [ ctrl, action ], @user_membership.role_id )
86 return true
86 return true
87 end
87 end
88 render :nothing => true, :status => 403
88 render :nothing => true, :status => 403
89 false
89 false
90 end
90 end
91
91
92 # store current uri in session.
92 # store current uri in session.
93 # return to this location by calling redirect_back_or_default
93 # return to this location by calling redirect_back_or_default
94 def store_location
94 def store_location
95 session[:return_to] = request.request_uri
95 session[:return_to_params] = params
96 end
96 end
97
97
98 # move to the last store_location call or to the passed default one
98 # move to the last store_location call or to the passed default one
99 def redirect_back_or_default(default)
99 def redirect_back_or_default(default)
100 if session[:return_to].nil?
100 if session[:return_to_params].nil?
101 redirect_to default
101 redirect_to default
102 else
102 else
103 redirect_to_url session[:return_to]
103 redirect_to session[:return_to_params]
104 session[:return_to] = nil
104 session[:return_to_params] = nil
105 end
105 end
106 end
106 end
107
107
108 def render_404
108 def render_404
109 @html_title = "404"
109 @html_title = "404"
110 render :template => "common/404", :layout => true, :status => 404
110 render :template => "common/404", :layout => true, :status => 404
111 return false
111 return false
112 end
112 end
113
113
114 # qvalues http header parser
114 # qvalues http header parser
115 # code taken from webrick
115 # code taken from webrick
116 def parse_qvalues(value)
116 def parse_qvalues(value)
117 tmp = []
117 tmp = []
118 if value
118 if value
119 parts = value.split(/,\s*/)
119 parts = value.split(/,\s*/)
120 parts.each {|part|
120 parts.each {|part|
121 if m = %r{^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$}.match(part)
121 if m = %r{^([^\s,]+?)(?:;\s*q=(\d+(?:\.\d+)?))?$}.match(part)
122 val = m[1]
122 val = m[1]
123 q = (m[2] or 1).to_f
123 q = (m[2] or 1).to_f
124 tmp.push([val, q])
124 tmp.push([val, q])
125 end
125 end
126 }
126 }
127 tmp = tmp.sort_by{|val, q| -q}
127 tmp = tmp.sort_by{|val, q| -q}
128 tmp.collect!{|val, q| val}
128 tmp.collect!{|val, q| val}
129 end
129 end
130 return tmp
130 return tmp
131 end
131 end
132 end No newline at end of file
132 end
@@ -1,20 +1,20
1 xml.instruct!
1 xml.instruct!
2 xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/" do
2 xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/" do
3 xml.channel do
3 xml.channel do
4 xml.title "#{Setting.app_title}: #{l(:label_news_latest)}"
4 xml.title "#{Setting.app_title}: #{l(:label_news_latest)}"
5 xml.link url_for(:controller => '', :only_path => false)
5 xml.link url_for(:controller => 'welcome', :only_path => false)
6 xml.pubDate CGI.rfc1123_date(@news.first.created_on)
6 xml.pubDate CGI.rfc1123_date(@news.first.created_on)
7 xml.description l(:label_news_latest)
7 xml.description l(:label_news_latest)
8 @news.each do |news|
8 @news.each do |news|
9 xml.item do
9 xml.item do
10 xml.title "#{news.project.name}: #{news.title}"
10 xml.title "#{news.project.name}: #{news.title}"
11 news_url = url_for(:controller => 'news' , :action => 'show', :id => news, :only_path => false)
11 news_url = url_for(:controller => 'news' , :action => 'show', :id => news, :only_path => false)
12 xml.link news_url
12 xml.link news_url
13 xml.description h(news.summary)
13 xml.description h(news.summary)
14 xml.pubDate CGI.rfc1123_date(news.created_on)
14 xml.pubDate CGI.rfc1123_date(news.created_on)
15 xml.guid news_url
15 xml.guid news_url
16 xml.author h(news.author.name)
16 xml.author h(news.author.name)
17 end
17 end
18 end
18 end
19 end
19 end
20 end No newline at end of file
20 end
@@ -1,143 +1,143
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
3 <head>
3 <head>
4 <title><%= Setting.app_title + (@html_title ? ": #{@html_title}" : "") %></title>
4 <title><%= Setting.app_title + (@html_title ? ": #{@html_title}" : "") %></title>
5 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6 <meta name="description" content="redMine" />
6 <meta name="description" content="redMine" />
7 <meta name="keywords" content="issue,bug,tracker" />
7 <meta name="keywords" content="issue,bug,tracker" />
8 <!--[if IE]>
8 <!--[if IE]>
9 <style type="text/css">
9 <style type="text/css">
10 body {behavior: url(<%= stylesheet_path "csshover.htc" %>);}
10 body {behavior: url(<%= stylesheet_path "csshover.htc" %>);}
11 </style>
11 </style>
12 <![endif]-->
12 <![endif]-->
13 <%= stylesheet_link_tag "application" %>
13 <%= stylesheet_link_tag "application" %>
14 <%= stylesheet_link_tag "print", :media => "print" %>
14 <%= stylesheet_link_tag "print", :media => "print" %>
15 <%= javascript_include_tag :defaults %>
15 <%= javascript_include_tag :defaults %>
16 <%= javascript_include_tag 'menu' %>
16 <%= javascript_include_tag 'menu' %>
17 <%= stylesheet_link_tag 'jstoolbar' %>
17 <%= stylesheet_link_tag 'jstoolbar' %>
18 <!-- page specific tags --><%= yield :header_tags %>
18 <!-- page specific tags --><%= yield :header_tags %>
19 </head>
19 </head>
20
20
21 <body>
21 <body>
22 <div id="container" >
22 <div id="container" >
23
23
24 <div id="header">
24 <div id="header">
25 <div style="float: left;">
25 <div style="float: left;">
26 <h1><%= Setting.app_title %></h1>
26 <h1><%= Setting.app_title %></h1>
27 <h2><%= Setting.app_subtitle %></h2>
27 <h2><%= Setting.app_subtitle %></h2>
28 </div>
28 </div>
29 <div style="float: right; padding-right: 1em; padding-top: 0.2em;">
29 <div style="float: right; padding-right: 1em; padding-top: 0.2em;">
30 <% if loggedin? %><small><%=l(:label_logged_as)%> <b><%= @logged_in_user.login %></b></small><% end %>
30 <% if loggedin? %><small><%=l(:label_logged_as)%> <b><%= @logged_in_user.login %></b></small><% end %>
31 </div>
31 </div>
32 </div>
32 </div>
33
33
34 <div id="navigation">
34 <div id="navigation">
35 <ul>
35 <ul>
36 <li><%= link_to l(:label_home), { :controller => '' }, :class => "icon icon-home" %></li>
36 <li><%= link_to l(:label_home), { :controller => 'welcome' }, :class => "icon icon-home" %></li>
37 <li><%= link_to l(:label_my_page), { :controller => 'my', :action => 'page'}, :class => "icon icon-mypage" %></li>
37 <li><%= link_to l(:label_my_page), { :controller => 'my', :action => 'page'}, :class => "icon icon-mypage" %></li>
38 <li><%= link_to l(:label_project_plural), { :controller => 'projects' }, :class => "icon icon-projects" %></li>
38 <li><%= link_to l(:label_project_plural), { :controller => 'projects' }, :class => "icon icon-projects" %></li>
39
39
40 <% unless @project.nil? || @project.id.nil? %>
40 <% unless @project.nil? || @project.id.nil? %>
41 <li class="submenu"><%= link_to @project.name, { :controller => 'projects', :action => 'show', :id => @project }, :class => "icon icon-projects", :onmouseover => "buttonMouseover(event, 'menuProject');" %></li>
41 <li class="submenu"><%= link_to @project.name, { :controller => 'projects', :action => 'show', :id => @project }, :class => "icon icon-projects", :onmouseover => "buttonMouseover(event, 'menuProject');" %></li>
42 <% end %>
42 <% end %>
43
43
44 <% if loggedin? %>
44 <% if loggedin? %>
45 <li><%= link_to l(:label_my_account), { :controller => 'my', :action => 'account' }, :class => "icon icon-user" %></li>
45 <li><%= link_to l(:label_my_account), { :controller => 'my', :action => 'account' }, :class => "icon icon-user" %></li>
46 <% end %>
46 <% end %>
47
47
48 <% if admin_loggedin? %>
48 <% if admin_loggedin? %>
49 <li class="submenu"><%= link_to l(:label_administration), { :controller => 'admin' }, :class => "icon icon-admin", :onmouseover => "buttonMouseover(event, 'menuAdmin');" %></li>
49 <li class="submenu"><%= link_to l(:label_administration), { :controller => 'admin' }, :class => "icon icon-admin", :onmouseover => "buttonMouseover(event, 'menuAdmin');" %></li>
50 <% end %>
50 <% end %>
51
51
52 <li class="right"><%= link_to l(:label_help), { :controller => 'help', :ctrl => params[:controller], :page => params[:action] }, :onclick => "window.open(this.href); return false;", :class => "icon icon-help" %></li>
52 <li class="right"><%= link_to l(:label_help), { :controller => 'help', :ctrl => params[:controller], :page => params[:action] }, :onclick => "window.open(this.href); return false;", :class => "icon icon-help" %></li>
53
53
54 <% if loggedin? %>
54 <% if loggedin? %>
55 <li class="right"><%= link_to l(:label_logout), { :controller => 'account', :action => 'logout' }, :class => "icon icon-user" %></li>
55 <li class="right"><%= link_to l(:label_logout), { :controller => 'account', :action => 'logout' }, :class => "icon icon-user" %></li>
56 <% else %>
56 <% else %>
57 <li class="right"><%= link_to l(:label_login), { :controller => 'account', :action => 'login' }, :class => "icon icon-user" %></li>
57 <li class="right"><%= link_to l(:label_login), { :controller => 'account', :action => 'login' }, :class => "icon icon-user" %></li>
58 <% end %>
58 <% end %>
59 </ul>
59 </ul>
60 </div>
60 </div>
61
61
62 <% if admin_loggedin? %>
62 <% if admin_loggedin? %>
63 <div id="menuAdmin" class="menu" onmouseover="menuMouseover(event)">
63 <div id="menuAdmin" class="menu" onmouseover="menuMouseover(event)">
64 <a class="menuItem" href="/admin/projects" onmouseover="menuItemMouseover(event,'menuProjects');"><span class="menuItemText"><%=l(:label_project_plural)%></span><span class="menuItemArrow">&#9654;</span></a>
64 <a class="menuItem" href="/admin/projects" onmouseover="menuItemMouseover(event,'menuProjects');"><span class="menuItemText"><%=l(:label_project_plural)%></span><span class="menuItemArrow">&#9654;</span></a>
65 <a class="menuItem" href="/users" onmouseover="menuItemMouseover(event,'menuUsers');"><span class="menuItemText"><%=l(:label_user_plural)%></span><span class="menuItemArrow">&#9654;</span></a>
65 <a class="menuItem" href="/users" onmouseover="menuItemMouseover(event,'menuUsers');"><span class="menuItemText"><%=l(:label_user_plural)%></span><span class="menuItemArrow">&#9654;</span></a>
66 <a class="menuItem" href="/roles"><%=l(:label_role_and_permissions)%></a>
66 <a class="menuItem" href="/roles"><%=l(:label_role_and_permissions)%></a>
67 <a class="menuItem" href="/trackers" onmouseover="menuItemMouseover(event,'menuTrackers');"><span class="menuItemText"><%=l(:label_tracker_plural)%></span><span class="menuItemArrow">&#9654;</span></a>
67 <a class="menuItem" href="/trackers" onmouseover="menuItemMouseover(event,'menuTrackers');"><span class="menuItemText"><%=l(:label_tracker_plural)%></span><span class="menuItemArrow">&#9654;</span></a>
68 <a class="menuItem" href="/custom_fields"><%=l(:label_custom_field_plural)%></a>
68 <a class="menuItem" href="/custom_fields"><%=l(:label_custom_field_plural)%></a>
69 <a class="menuItem" href="/enumerations"><%=l(:label_enumerations)%></a>
69 <a class="menuItem" href="/enumerations"><%=l(:label_enumerations)%></a>
70 <a class="menuItem" href="/admin/mail_options"><%=l(:field_mail_notification)%></a>
70 <a class="menuItem" href="/admin/mail_options"><%=l(:field_mail_notification)%></a>
71 <a class="menuItem" href="/auth_sources"><%=l(:label_authentication)%></a>
71 <a class="menuItem" href="/auth_sources"><%=l(:label_authentication)%></a>
72 <a class="menuItem" href="/settings"><%=l(:label_settings)%></a>
72 <a class="menuItem" href="/settings"><%=l(:label_settings)%></a>
73 <a class="menuItem" href="/admin/info"><%=l(:label_information_plural)%></a>
73 <a class="menuItem" href="/admin/info"><%=l(:label_information_plural)%></a>
74 </div>
74 </div>
75 <div id="menuTrackers" class="menu">
75 <div id="menuTrackers" class="menu">
76 <a class="menuItem" href="/issue_statuses"><%=l(:label_issue_status_plural)%></a>
76 <a class="menuItem" href="/issue_statuses"><%=l(:label_issue_status_plural)%></a>
77 <a class="menuItem" href="/roles/workflow"><%=l(:label_workflow)%></a>
77 <a class="menuItem" href="/roles/workflow"><%=l(:label_workflow)%></a>
78 </div>
78 </div>
79 <div id="menuProjects" class="menu"><a class="menuItem" href="/projects/add"><%=l(:label_new)%></a></div>
79 <div id="menuProjects" class="menu"><a class="menuItem" href="/projects/add"><%=l(:label_new)%></a></div>
80 <div id="menuUsers" class="menu"><a class="menuItem" href="/users/add"><%=l(:label_new)%></a></div>
80 <div id="menuUsers" class="menu"><a class="menuItem" href="/users/add"><%=l(:label_new)%></a></div>
81 <% end %>
81 <% end %>
82
82
83 <% unless @project.nil? || @project.id.nil? %>
83 <% unless @project.nil? || @project.id.nil? %>
84 <div id="menuProject" class="menu" onmouseover="menuMouseover(event)">
84 <div id="menuProject" class="menu" onmouseover="menuMouseover(event)">
85 <%= link_to l(:label_calendar), {:controller => 'projects', :action => 'calendar', :id => @project }, :class => "menuItem" %>
85 <%= link_to l(:label_calendar), {:controller => 'projects', :action => 'calendar', :id => @project }, :class => "menuItem" %>
86 <%= link_to l(:label_gantt), {:controller => 'projects', :action => 'gantt', :id => @project }, :class => "menuItem" %>
86 <%= link_to l(:label_gantt), {:controller => 'projects', :action => 'gantt', :id => @project }, :class => "menuItem" %>
87 <%= link_to l(:label_issue_plural), {:controller => 'projects', :action => 'list_issues', :id => @project }, :class => "menuItem" %>
87 <%= link_to l(:label_issue_plural), {:controller => 'projects', :action => 'list_issues', :id => @project }, :class => "menuItem" %>
88 <%= link_to l(:label_report_plural), {:controller => 'reports', :action => 'issue_report', :id => @project }, :class => "menuItem" %>
88 <%= link_to l(:label_report_plural), {:controller => 'reports', :action => 'issue_report', :id => @project }, :class => "menuItem" %>
89 <%= link_to l(:label_activity), {:controller => 'projects', :action => 'activity', :id => @project }, :class => "menuItem" %>
89 <%= link_to l(:label_activity), {:controller => 'projects', :action => 'activity', :id => @project }, :class => "menuItem" %>
90 <%= link_to l(:label_news_plural), {:controller => 'projects', :action => 'list_news', :id => @project }, :class => "menuItem" %>
90 <%= link_to l(:label_news_plural), {:controller => 'projects', :action => 'list_news', :id => @project }, :class => "menuItem" %>
91 <%= link_to l(:label_change_log), {:controller => 'projects', :action => 'changelog', :id => @project }, :class => "menuItem" %>
91 <%= link_to l(:label_change_log), {:controller => 'projects', :action => 'changelog', :id => @project }, :class => "menuItem" %>
92 <%= link_to l(:label_document_plural), {:controller => 'projects', :action => 'list_documents', :id => @project }, :class => "menuItem" %>
92 <%= link_to l(:label_document_plural), {:controller => 'projects', :action => 'list_documents', :id => @project }, :class => "menuItem" %>
93 <%= link_to l(:label_member_plural), {:controller => 'projects', :action => 'list_members', :id => @project }, :class => "menuItem" %>
93 <%= link_to l(:label_member_plural), {:controller => 'projects', :action => 'list_members', :id => @project }, :class => "menuItem" %>
94 <%= link_to l(:label_attachment_plural), {:controller => 'projects', :action => 'list_files', :id => @project }, :class => "menuItem" %>
94 <%= link_to l(:label_attachment_plural), {:controller => 'projects', :action => 'list_files', :id => @project }, :class => "menuItem" %>
95 <%= link_to l(:label_repository), {:controller => 'repositories', :action => 'show', :id => @project}, :class => "menuItem" if @project.repository and !@project.repository.new_record? %>
95 <%= link_to l(:label_repository), {:controller => 'repositories', :action => 'show', :id => @project}, :class => "menuItem" if @project.repository and !@project.repository.new_record? %>
96 <%= link_to_if_authorized l(:label_settings), {:controller => 'projects', :action => 'settings', :id => @project }, :class => "menuItem" %>
96 <%= link_to_if_authorized l(:label_settings), {:controller => 'projects', :action => 'settings', :id => @project }, :class => "menuItem" %>
97 </div>
97 </div>
98 <% end %>
98 <% end %>
99
99
100
100
101 <div id="subcontent">
101 <div id="subcontent">
102
102
103 <% unless @project.nil? || @project.id.nil? %>
103 <% unless @project.nil? || @project.id.nil? %>
104 <h2><%= @project.name %></h2>
104 <h2><%= @project.name %></h2>
105 <ul class="menublock">
105 <ul class="menublock">
106 <li><%= link_to l(:label_overview), :controller => 'projects', :action => 'show', :id => @project %></li>
106 <li><%= link_to l(:label_overview), :controller => 'projects', :action => 'show', :id => @project %></li>
107 <li><%= link_to l(:label_calendar), :controller => 'projects', :action => 'calendar', :id => @project %></li>
107 <li><%= link_to l(:label_calendar), :controller => 'projects', :action => 'calendar', :id => @project %></li>
108 <li><%= link_to l(:label_gantt), :controller => 'projects', :action => 'gantt', :id => @project %></li>
108 <li><%= link_to l(:label_gantt), :controller => 'projects', :action => 'gantt', :id => @project %></li>
109 <li><%= link_to l(:label_issue_plural), :controller => 'projects', :action => 'list_issues', :id => @project %></li>
109 <li><%= link_to l(:label_issue_plural), :controller => 'projects', :action => 'list_issues', :id => @project %></li>
110 <li><%= link_to l(:label_report_plural), :controller => 'reports', :action => 'issue_report', :id => @project %></li>
110 <li><%= link_to l(:label_report_plural), :controller => 'reports', :action => 'issue_report', :id => @project %></li>
111 <li><%= link_to l(:label_activity), :controller => 'projects', :action => 'activity', :id => @project %></li>
111 <li><%= link_to l(:label_activity), :controller => 'projects', :action => 'activity', :id => @project %></li>
112 <li><%= link_to l(:label_news_plural), :controller => 'projects', :action => 'list_news', :id => @project %></li>
112 <li><%= link_to l(:label_news_plural), :controller => 'projects', :action => 'list_news', :id => @project %></li>
113 <li><%= link_to l(:label_change_log), :controller => 'projects', :action => 'changelog', :id => @project %></li>
113 <li><%= link_to l(:label_change_log), :controller => 'projects', :action => 'changelog', :id => @project %></li>
114 <li><%= link_to l(:label_document_plural), :controller => 'projects', :action => 'list_documents', :id => @project %></li>
114 <li><%= link_to l(:label_document_plural), :controller => 'projects', :action => 'list_documents', :id => @project %></li>
115 <li><%= link_to l(:label_member_plural), :controller => 'projects', :action => 'list_members', :id => @project %></li>
115 <li><%= link_to l(:label_member_plural), :controller => 'projects', :action => 'list_members', :id => @project %></li>
116 <li><%= link_to l(:label_attachment_plural), :controller => 'projects', :action => 'list_files', :id => @project %></li>
116 <li><%= link_to l(:label_attachment_plural), :controller => 'projects', :action => 'list_files', :id => @project %></li>
117 <li><%= link_to l(:label_repository), :controller => 'repositories', :action => 'show', :id => @project if @project.repository and !@project.repository.new_record? %></li>
117 <li><%= link_to l(:label_repository), :controller => 'repositories', :action => 'show', :id => @project if @project.repository and !@project.repository.new_record? %></li>
118 <li><%= link_to_if_authorized l(:label_settings), :controller => 'projects', :action => 'settings', :id => @project %></li>
118 <li><%= link_to_if_authorized l(:label_settings), :controller => 'projects', :action => 'settings', :id => @project %></li>
119 </ul>
119 </ul>
120 <% end %>
120 <% end %>
121
121
122 <% if loggedin? and @logged_in_user.memberships.length > 0 %>
122 <% if loggedin? and @logged_in_user.memberships.length > 0 %>
123 <h2><%=l(:label_my_projects) %></h2>
123 <h2><%=l(:label_my_projects) %></h2>
124 <ul class="menublock">
124 <ul class="menublock">
125 <% for membership in @logged_in_user.memberships %>
125 <% for membership in @logged_in_user.memberships %>
126 <li><%= link_to membership.project.name, :controller => 'projects', :action => 'show', :id => membership.project %></li>
126 <li><%= link_to membership.project.name, :controller => 'projects', :action => 'show', :id => membership.project %></li>
127 <% end %>
127 <% end %>
128 </ul>
128 </ul>
129 <% end %>
129 <% end %>
130 </div>
130 </div>
131
131
132 <div id="content">
132 <div id="content">
133 <% if flash[:notice] %><p style="color: green"><%= flash[:notice] %></p><% end %>
133 <% if flash[:notice] %><p style="color: green"><%= flash[:notice] %></p><% end %>
134 <%= @content_for_layout %>
134 <%= @content_for_layout %>
135 </div>
135 </div>
136
136
137 <div id="footer">
137 <div id="footer">
138 <p><a href="http://redmine.rubyforge.org/">redMine</a> <%= Redmine::VERSION %> &copy 2006-2007 Jean-Philippe Lang</p>
138 <p><a href="http://redmine.rubyforge.org/">redMine</a> <%= Redmine::VERSION %> &copy 2006-2007 Jean-Philippe Lang</p>
139 </div>
139 </div>
140
140
141 </div>
141 </div>
142 </body>
142 </body>
143 </html> No newline at end of file
143 </html>
General Comments 0
You need to be logged in to leave comments. Login now