summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-09-14 11:34:08 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-09-14 11:34:08 +0000
commit21c97c6a1376a38a3951c57069317c17c81029f8 (patch)
tree8d38f129585767d4c1eb2c78d0b9b978aff14d70 /app
parent29348fafb7ca43cb00ef80f29e61167647df0cd8 (diff)
downloadredmine-21c97c6a1376a38a3951c57069317c17c81029f8.tar.gz
redmine-21c97c6a1376a38a3951c57069317c17c81029f8.zip
Added project module concept.
A project module (eg. issue tracking, news, wiki,...) is a set of permissions that can enabled/disabled at project level. For each project, modules can be enabled on the project settings view ('Modules' tab). This requires a specific permission: 'Select project modules' (if this permission is turned off, only Redmine administrators can choose which modules a project uses). When applying this migration, all modules are enabled for all existing projects. git-svn-id: http://redmine.rubyforge.org/svn/trunk@725 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/members_controller.rb22
-rw-r--r--app/controllers/projects_controller.rb55
-rw-r--r--app/controllers/repositories_controller.rb34
-rw-r--r--app/controllers/wikis_controller.rb44
-rw-r--r--app/helpers/projects_helper.rb13
-rw-r--r--app/helpers/repositories_helper.rb8
-rw-r--r--app/models/enabled_module.rb23
-rw-r--r--app/models/project.rb36
-rw-r--r--app/models/user.rb5
-rw-r--r--app/views/issue_categories/edit.rhtml2
-rw-r--r--app/views/layouts/base.rhtml2
-rw-r--r--app/views/projects/_edit.rhtml4
-rw-r--r--app/views/projects/_form.rhtml26
-rw-r--r--app/views/projects/_repository.rhtml3
-rw-r--r--app/views/projects/add.rhtml11
-rw-r--r--app/views/projects/settings.rhtml82
-rw-r--r--app/views/projects/settings/_boards.rhtml (renamed from app/views/projects/_boards.rhtml)0
-rw-r--r--app/views/projects/settings/_issue_categories.rhtml22
-rw-r--r--app/views/projects/settings/_members.rhtml (renamed from app/views/projects/_members.rhtml)4
-rw-r--r--app/views/projects/settings/_modules.rhtml14
-rw-r--r--app/views/projects/settings/_repository.rhtml20
-rw-r--r--app/views/projects/settings/_versions.rhtml25
-rw-r--r--app/views/projects/settings/_wiki.rhtml18
-rw-r--r--app/views/projects/show.rhtml2
-rw-r--r--app/views/roles/_form.rhtml28
-rw-r--r--app/views/roles/report.rhtml24
-rw-r--r--app/views/wikis/destroy.rhtml10
27 files changed, 346 insertions, 191 deletions
diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb
index dfaad7fa3..a1706e601 100644
--- a/app/controllers/members_controller.rb
+++ b/app/controllers/members_controller.rb
@@ -17,13 +17,23 @@
class MembersController < ApplicationController
layout 'base'
- before_filter :find_project, :authorize
+ before_filter :find_member, :except => :new
+ before_filter :find_project, :only => :new
+ before_filter :authorize
+ def new
+ @project.members << Member.new(params[:member]) if request.post?
+ respond_to do |format|
+ format.html { redirect_to :action => 'settings', :tab => 'members', :id => @project }
+ format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/settings/members'} }
+ end
+ end
+
def edit
if request.post? and @member.update_attributes(params[:member])
respond_to do |format|
format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project }
- format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/members'} }
+ format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/settings/members'} }
end
end
end
@@ -32,12 +42,18 @@ class MembersController < ApplicationController
@member.destroy
respond_to do |format|
format.html { redirect_to :controller => 'projects', :action => 'settings', :tab => 'members', :id => @project }
- format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/members'} }
+ format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'projects/settings/members'} }
end
end
private
def find_project
+ @project = Project.find(params[:id])
+ rescue ActiveRecord::RecordNotFound
+ render_404
+ end
+
+ def find_member
@member = Member.find(params[:id])
@project = @member.project
rescue ActiveRecord::RecordNotFound
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 0acd64009..148d54d48 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -73,16 +73,9 @@ class ProjectsController < ApplicationController
else
@project.custom_fields = CustomField.find(params[:custom_field_ids]) if params[:custom_field_ids]
@custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => (params[:custom_fields] ? params["custom_fields"][x.id.to_s] : nil)) }
- @project.custom_values = @custom_values
- if params[:repository_enabled] && params[:repository_enabled] == "1"
- @project.repository = Repository.factory(params[:repository_scm])
- @project.repository.attributes = params[:repository]
- end
- if "1" == params[:wiki_enabled]
- @project.wiki = Wiki.new
- @project.wiki.attributes = params[:wiki]
- end
+ @project.custom_values = @custom_values
if @project.save
+ @project.enabled_module_names = params[:enabled_modules]
flash[:notice] = l(:notice_successful_create)
redirect_to :controller => 'admin', :action => 'projects'
end
@@ -107,6 +100,8 @@ class ProjectsController < ApplicationController
@issue_category ||= IssueCategory.new
@member ||= @project.members.new
@custom_values ||= ProjectCustomField.find(:all).collect { |x| @project.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x) }
+ @repository ||= @project.repository
+ @wiki ||= @project.wiki
end
# Edit @project
@@ -117,24 +112,6 @@ class ProjectsController < ApplicationController
@custom_values = ProjectCustomField.find(:all).collect { |x| CustomValue.new(:custom_field => x, :customized => @project, :value => params["custom_fields"][x.id.to_s]) }
@project.custom_values = @custom_values
end
- if params[:repository_enabled]
- case params[:repository_enabled]
- when "0"
- @project.repository = nil
- when "1"
- @project.repository ||= Repository.factory(params[:repository_scm])
- @project.repository.update_attributes params[:repository] if @project.repository
- end
- end
- if params[:wiki_enabled]
- case params[:wiki_enabled]
- when "0"
- @project.wiki.destroy if @project.wiki
- when "1"
- @project.wiki ||= Wiki.new
- @project.wiki.update_attributes params[:wiki]
- end
- end
@project.attributes = params[:project]
if @project.save
flash[:notice] = l(:notice_successful_update)
@@ -145,6 +122,11 @@ class ProjectsController < ApplicationController
end
end
end
+
+ def modules
+ @project.enabled_module_names = params[:enabled_modules]
+ redirect_to :action => 'settings', :id => @project, :tab => 'modules'
+ end
def archive
@project.archive if request.post? && @project.active?
@@ -195,25 +177,6 @@ class ProjectsController < ApplicationController
end
end
- # Add a new member to @project
- def add_member
- @member = @project.members.build(params[:member])
- if request.post? && @member.save
- respond_to do |format|
- format.html { redirect_to :action => 'settings', :tab => 'members', :id => @project }
- format.js { render(:update) {|page| page.replace_html "tab-content-members", :partial => 'members'} }
- end
- else
- settings
- render :action => 'settings'
- end
- end
-
- # Show members list of @project
- def list_members
- @members = @project.members.find(:all)
- end
-
# Add a new document to @project
def add_document
@categories = Enumeration::get_values('DCAT')
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index f99ea0b35..12439cfab 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -21,10 +21,29 @@ require 'digest/sha1'
class RepositoriesController < ApplicationController
layout 'base'
- before_filter :find_project, :except => [:update_form]
- before_filter :authorize, :except => [:update_form]
+ before_filter :find_repository, :except => :edit
+ before_filter :find_project, :only => :edit
+ before_filter :authorize
accept_key_auth :revisions
+ def edit
+ @repository = @project.repository
+ if !@repository
+ @repository = Repository.factory(params[:repository_scm])
+ @repository.project = @project
+ end
+ if request.post?
+ @repository.attributes = params[:repository]
+ @repository.save
+ end
+ render(:update) {|page| page.replace_html "tab-content-repository", :partial => 'projects/settings/repository'}
+ end
+
+ def destroy
+ @repository.destroy
+ redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'repository'
+ end
+
def show
# check if new revisions have been committed in the repository
@repository.fetch_changesets if Setting.autofetch_changesets?
@@ -113,14 +132,15 @@ class RepositoriesController < ApplicationController
end
end
- def update_form
- @repository = Repository.factory(params[:repository_scm])
- render :partial => 'projects/repository', :locals => {:repository => @repository}
- end
-
private
def find_project
@project = Project.find(params[:id])
+ rescue ActiveRecord::RecordNotFound
+ render_404
+ end
+
+ def find_repository
+ @project = Project.find(params[:id])
@repository = @project.repository
render_404 and return false unless @repository
@path = params[:path].squeeze('/') if params[:path]
diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb
new file mode 100644
index 000000000..146aaac8a
--- /dev/null
+++ b/app/controllers/wikis_controller.rb
@@ -0,0 +1,44 @@
+# redMine - project management software
+# Copyright (C) 2006-2007 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class WikisController < ApplicationController
+ layout 'base'
+ before_filter :find_project, :authorize
+
+ # Create or update a project's wiki
+ def edit
+ @wiki = @project.wiki || Wiki.new(:project => @project)
+ @wiki.attributes = params[:wiki]
+ @wiki.save if @request.post?
+ render(:update) {|page| page.replace_html "tab-content-wiki", :partial => 'projects/settings/wiki'}
+ end
+
+ # Delete a project's wiki
+ def destroy
+ if request.post? && params[:confirm] && @project.wiki
+ @project.wiki.destroy
+ redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'wiki'
+ end
+ end
+
+private
+ def find_project
+ @project = Project.find(params[:id])
+ rescue ActiveRecord::RecordNotFound
+ render_404
+ end
+end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 2657c7e0a..5b78db71c 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -26,6 +26,19 @@ module ProjectsHelper
}, options
end
+ def project_settings_tabs
+ tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural},
+ {:name => 'modules', :action => :select_project_modules, :partial => 'projects/settings/modules', :label => :label_module_plural},
+ {:name => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural},
+ {:name => 'versions', :action => :manage_versions, :partial => 'projects/settings/versions', :label => :label_version_plural},
+ {:name => 'categories', :action => :manage_categories, :partial => 'projects/settings/issue_categories', :label => :label_issue_category_plural},
+ {:name => 'wiki', :action => :manage_wiki, :partial => 'projects/settings/wiki', :label => :label_wiki},
+ {:name => 'repository', :action => :manage_repository, :partial => 'projects/settings/repository', :label => :label_repository},
+ {:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural}
+ ]
+ tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
+ end
+
# Generates a gantt image
# Only defined if RMagick is avalaible
def gantt_image(events, date_from, months, zoom)
diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb
index 7db748abd..d82e16561 100644
--- a/app/helpers/repositories_helper.rb
+++ b/app/helpers/repositories_helper.rb
@@ -29,13 +29,13 @@ module RepositoriesHelper
send(method, form, repository) if repository.is_a?(Repository) && respond_to?(method)
end
- def scm_select_tag
+ def scm_select_tag(repository)
container = [[]]
REDMINE_SUPPORTED_SCM.each {|scm| container << ["Repository::#{scm}".constantize.scm_name, scm]}
select_tag('repository_scm',
- options_for_select(container, @project.repository.class.name.demodulize),
- :disabled => (@project.repository && !@project.repository.new_record?),
- :onchange => remote_function(:update => "repository_fields", :url => { :controller => 'repositories', :action => 'update_form', :id => @project }, :with => "Form.serialize(this.form)")
+ options_for_select(container, repository.class.name.demodulize),
+ :disabled => (repository && !repository.new_record?),
+ :onchange => remote_function(:url => { :controller => 'repositories', :action => 'edit', :id => @project }, :method => :get, :with => "Form.serialize(this.form)")
)
end
diff --git a/app/models/enabled_module.rb b/app/models/enabled_module.rb
new file mode 100644
index 000000000..3c05c76c1
--- /dev/null
+++ b/app/models/enabled_module.rb
@@ -0,0 +1,23 @@
+# redMine - project management software
+# Copyright (C) 2006-2007 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class EnabledModule < ActiveRecord::Base
+ belongs_to :project
+
+ validates_presence_of :name
+ validates_uniqueness_of :name, :scope => :project_id
+end
diff --git a/app/models/project.rb b/app/models/project.rb
index fa975c435..fb5c63fe2 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -23,6 +23,7 @@ class Project < ActiveRecord::Base
has_many :members, :dependent => :delete_all, :include => :user, :conditions => "#{User.table_name}.status=#{User::STATUS_ACTIVE}"
has_many :users, :through => :members
has_many :custom_values, :dependent => :delete_all, :as => :customized
+ has_many :enabled_modules, :dependent => :delete_all
has_many :issues, :dependent => :destroy, :order => "#{Issue.table_name}.created_on DESC", :include => [:status, :tracker]
has_many :issue_changes, :through => :issues, :source => :journals
has_many :versions, :dependent => :destroy, :order => "#{Version.table_name}.effective_date DESC, #{Version.table_name}.name DESC"
@@ -38,7 +39,7 @@ class Project < ActiveRecord::Base
has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}", :association_foreign_key => 'custom_field_id'
acts_as_tree :order => "name", :counter_cache => true
- attr_protected :status
+ attr_protected :status, :enabled_module_names
validates_presence_of :name, :description, :identifier
validates_uniqueness_of :name, :identifier
@@ -121,10 +122,43 @@ class Project < ActiveRecord::Base
def <=>(project)
name <=> project.name
end
+
+ def allows_to?(action)
+ if action.is_a? Hash
+ allowed_actions.include? "#{action[:controller]}/#{action[:action]}"
+ else
+ allowed_permissions.include? action
+ end
+ end
+
+ def module_enabled?(module_name)
+ module_name = module_name.to_s
+ enabled_modules.detect {|m| m.name == module_name}
+ end
+
+ def enabled_module_names=(module_names)
+ enabled_modules.clear
+ module_names = [] unless module_names && module_names.is_a?(Array)
+ module_names.each do |name|
+ enabled_modules << EnabledModule.new(:name => name.to_s)
+ end
+ end
protected
def validate
errors.add(parent_id, " must be a root project") if parent and parent.parent
errors.add_to_base("A project with subprojects can't be a subproject") if parent and children.size > 0
end
+
+private
+ def allowed_permissions
+ @allowed_permissions ||= begin
+ module_names = enabled_modules.collect {|m| m.name}
+ Redmine::AccessControl.modules_permissions(module_names).collect {|p| p.name}
+ end
+ end
+
+ def allowed_actions
+ @actions_allowed ||= allowed_permissions.inject([]) { |actions, permission| actions += Redmine::AccessControl.allowed_actions(permission) }.flatten
+ end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 4cb8da1f9..e4c397a51 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -178,8 +178,13 @@ class User < ActiveRecord::Base
# * a parameter-like Hash (eg. :controller => 'projects', :action => 'edit')
# * a permission Symbol (eg. :edit_project)
def allowed_to?(action, project)
+ # No action allowed on archived projects
return false unless project.active?
+ # No action allowed on disabled modules
+ return false unless project.allows_to?(action)
+ # Admin users are authorized for anything else
return true if admin?
+
role = role_for_project(project)
return false unless role
role.allowed_to?(action) && (project.is_public? || role.member?)
diff --git a/app/views/issue_categories/edit.rhtml b/app/views/issue_categories/edit.rhtml
index 54a1f0c66..bc627797b 100644
--- a/app/views/issue_categories/edit.rhtml
+++ b/app/views/issue_categories/edit.rhtml
@@ -2,5 +2,5 @@
<% labelled_tabular_form_for :category, @category, :url => { :action => 'edit', :id => @category } do |f| %>
<%= render :partial => 'issue_categories/form', :locals => { :f => f } %>
-<%= submit_tag l(:button_create) %>
+<%= submit_tag l(:button_save) %>
<% end %>
diff --git a/app/views/layouts/base.rhtml b/app/views/layouts/base.rhtml
index eae5cf570..1371d784d 100644
--- a/app/views/layouts/base.rhtml
+++ b/app/views/layouts/base.rhtml
@@ -71,7 +71,7 @@
<% if @project && !@project.new_record? %>
<h2><%= @project.name %></h2>
<ul class="menublock">
- <% Redmine::MenuManager.allowed_items(:project_menu, current_role).each do |item| %>
+ <% Redmine::MenuManager.allowed_items(:project_menu, User.current, @project).each do |item| %>
<% unless item.condition && !item.condition.call(@project) %>
<li><%= link_to l(item.name), {item.param => @project}.merge(item.url) %></li>
<% end %>
diff --git a/app/views/projects/_edit.rhtml b/app/views/projects/_edit.rhtml
new file mode 100644
index 000000000..b7c2987d2
--- /dev/null
+++ b/app/views/projects/_edit.rhtml
@@ -0,0 +1,4 @@
+<% labelled_tabular_form_for :project, @project, :url => { :action => "edit", :id => @project } do |f| %>
+<%= render :partial => 'form', :locals => { :f => f } %>
+<%= submit_tag l(:button_save) %>
+<% end %>
diff --git a/app/views/projects/_form.rhtml b/app/views/projects/_form.rhtml
index 7edf17e30..aa30f1eaa 100644
--- a/app/views/projects/_form.rhtml
+++ b/app/views/projects/_form.rhtml
@@ -28,32 +28,6 @@
<!--[eoform:project]-->
</div>
-<div class="box">
- <h3><%= check_box_tag "repository_enabled", 1, !@project.repository.nil?, :onclick => "Element.toggle('repository');" %> <%= l(:label_repository) %></h3>
- <%= hidden_field_tag "repository_enabled", 0 %>
- <div id="repository">
- <p class="tabular"><label>SCM</label><%= scm_select_tag %></p>
- <div id="repository_fields">
- <%= render :partial => 'projects/repository', :locals => {:repository => @project.repository} if @project.repository %>
- </div>
- </div>
-</div>
-<%= javascript_tag "Element.hide('repository');" if @project.repository.nil? %>
-
-<div class="box">
-<h3><%= check_box_tag "wiki_enabled", 1, !@project.wiki.nil?, :onclick => "Element.toggle('wiki');" %> <%= l(:label_wiki) %></h3>
-<%= hidden_field_tag "wiki_enabled", 0 %>
-<div id="wiki">
-<% fields_for :wiki, @project.wiki, { :builder => TabularFormBuilder, :lang => current_language} do |wiki| %>
-<p><%= wiki.text_field :start_page, :size => 60, :required => true %><br /><em><%= l(:text_unallowed_characters) %>: , . / ? ; : |</em></p>
-<% # content_tag("div", "", :id => "wiki_start_page_auto_complete", :class => "auto_complete") +
- # auto_complete_field("wiki_start_page", { :url => { :controller => 'wiki', :action => 'auto_complete_for_wiki_page', :id => @project } })
-%>
-<% end %>
-</div>
-<%= javascript_tag "Element.hide('wiki');" if @project.wiki.nil? %>
-</div>
-
<% content_for :header_tags do %>
<%= javascript_include_tag 'calendar/calendar' %>
<%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %>
diff --git a/app/views/projects/_repository.rhtml b/app/views/projects/_repository.rhtml
deleted file mode 100644
index 6f79c615f..000000000
--- a/app/views/projects/_repository.rhtml
+++ /dev/null
@@ -1,3 +0,0 @@
-<% fields_for :repository, repository, { :builder => TabularFormBuilder, :lang => current_language} do |f| %>
-<%= repository_field_tags(f, repository) %>
-<% end %>
diff --git a/app/views/projects/add.rhtml b/app/views/projects/add.rhtml
index bafbf9145..4818cae4a 100644
--- a/app/views/projects/add.rhtml
+++ b/app/views/projects/add.rhtml
@@ -2,5 +2,14 @@
<% labelled_tabular_form_for :project, @project, :url => { :action => "add" } do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
+
+<div class="box">
+<p><label><%= l(:label_module_plural) %></label>
+<% Redmine::AccessControl.available_project_modules.each do |m| %>
+<%= check_box_tag 'enabled_modules[]', m, @project.module_enabled?(m) %> <%= m.to_s.humanize %>
+<% end %></p>
+</div>
+
+
<%= submit_tag l(:button_save) %>
-<% end %> \ No newline at end of file
+<% end %>
diff --git a/app/views/projects/settings.rhtml b/app/views/projects/settings.rhtml
index 410b72e77..13359de61 100644
--- a/app/views/projects/settings.rhtml
+++ b/app/views/projects/settings.rhtml
@@ -2,83 +2,15 @@
<div class="tabs">
<ul>
-<li><%= link_to l(:label_information_plural), {}, :id=> "tab-info", :onclick => "showTab('info'); this.blur(); return false;" %></li>
-<li><%= link_to l(:label_member_plural), {}, :id=> "tab-members", :onclick => "showTab('members'); this.blur(); return false;" %></li>
-<li><%= link_to l(:label_version_plural), {}, :id=> "tab-versions", :onclick => "showTab('versions'); this.blur(); return false;" %></li>
-<li><%= link_to l(:label_issue_category_plural), {}, :id=> "tab-categories", :onclick => "showTab('categories'); this.blur(); return false;" %></li>
-<li><%= link_to l(:label_board_plural), {}, :id=> "tab-boards", :onclick => "showTab('boards'); this.blur(); return false;" %></li>
-</ul>
-</div>
-
-<div id="tab-content-info" class="tab-content">
-<% if authorize_for('projects', 'edit') %>
- <% labelled_tabular_form_for :project, @project, :url => { :action => "edit", :id => @project } do |f| %>
- <%= render :partial => 'form', :locals => { :f => f } %>
- <%= submit_tag l(:button_save) %>
- <% end %>
+<% project_settings_tabs.each do |tab| %>
+ <li><%= link_to l(tab[:label]), {}, :id => "tab-#{tab[:name]}", :onclick => "showTab('#{tab[:name]}'); this.blur(); return false;" %></li>
<% end %>
+</ul>
</div>
-<div id="tab-content-members" class="tab-content" style="display:none;">
- <%= render :partial => 'members' %>
-</div>
-
-<div id="tab-content-versions" class="tab-content" style="display:none;">
-<table class="list">
- <thead>
- <th><%= l(:label_version) %></th>
- <th><%= l(:field_effective_date) %></th>
- <th><%= l(:field_description) %></th>
- <th><%= l(:label_wiki_page) unless @project.wiki.nil? %></th>
- <th style="width:15%"></th>
- <th style="width:15%"></th>
- </thead>
- <tbody>
-<% for version in @project.versions.sort %>
- <tr class="<%= cycle 'odd', 'even' %>">
- <td><%=h version.name %></td>
- <td align="center"><%= format_date(version.effective_date) %></td>
- <td><%=h version.description %></td>
- <td><%= link_to(version.wiki_page_title, :controller => 'wiki', :page => Wiki.titleize(version.wiki_page_title)) unless version.wiki_page_title.blank? || @project.wiki.nil? %></td>
- <td align="center"><small><%= link_to_if_authorized l(:button_edit), { :controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %></small></td>
- <td align="center"><small><%= link_to_if_authorized l(:button_delete), {:controller => 'versions', :action => 'destroy', :id => version}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></small></td>
- </td>
- </tr>
-<% end; reset_cycle %>
- </tbody>
-</table>
-&nbsp;
-<p><%= link_to_if_authorized l(:label_version_new), :controller => 'projects', :action => 'add_version', :id => @project %></p>
-</div>
-
-<div id="tab-content-categories" class="tab-content" style="display:none;">
-<table class="list">
- <thead>
- <th><%= l(:label_issue_category) %></th>
- <th><%= l(:field_assigned_to) %></th>
- <th style="width:15%"></th>
- <th style="width:15%"></th>
- </thead>
- <tbody>
-<% for category in @project.issue_categories %>
- <% unless category.new_record? %>
- <tr class="<%= cycle 'odd', 'even' %>">
- <td><%=h(category.name) %></td>
- <td><%=h(category.assigned_to.name) if category.assigned_to %></td>
- <td align="center"><small><%= link_to_if_authorized l(:button_edit), { :controller => 'issue_categories', :action => 'edit', :id => category }, :class => 'icon icon-edit' %></small></td>
- <td align="center"><small><%= link_to_if_authorized l(:button_delete), {:controller => 'issue_categories', :action => 'destroy', :id => category}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></small></td>
- </tr>
- <% end %>
+<% project_settings_tabs.each do |tab| %>
+<%= content_tag('div', render(:partial => tab[:partial]), :id => "tab-content-#{tab[:name]}", :class => 'tab-content') %>
<% end %>
- </tbody>
-</table>
-&nbsp;
-<p><%= link_to_if_authorized l(:label_issue_category_new), :controller => 'projects', :action => 'add_issue_category', :id => @project %></p>
-</div>
-
-<div id="tab-content-boards" class="tab-content" style="display:none;">
- <%= render :partial => 'boards' %>
-</div>
-<%= tab = params[:tab] ? h(params[:tab]) : 'info'
-javascript_tag "showTab('#{tab}');" %> \ No newline at end of file
+<%= tab = params[:tab] ? h(params[:tab]) : project_settings_tabs.first[:name]
+javascript_tag "showTab('#{tab}');" %>
diff --git a/app/views/projects/_boards.rhtml b/app/views/projects/settings/_boards.rhtml
index e3f4629c1..e3f4629c1 100644
--- a/app/views/projects/_boards.rhtml
+++ b/app/views/projects/settings/_boards.rhtml
diff --git a/app/views/projects/settings/_issue_categories.rhtml b/app/views/projects/settings/_issue_categories.rhtml
new file mode 100644
index 000000000..bad330e20
--- /dev/null
+++ b/app/views/projects/settings/_issue_categories.rhtml
@@ -0,0 +1,22 @@
+<table class="list">
+ <thead>
+ <th><%= l(:label_issue_category) %></th>
+ <th><%= l(:field_assigned_to) %></th>
+ <th style="width:15%"></th>
+ <th style="width:15%"></th>
+ </thead>
+ <tbody>
+<% for category in @project.issue_categories %>
+ <% unless category.new_record? %>
+ <tr class="<%= cycle 'odd', 'even' %>">
+ <td><%=h(category.name) %></td>
+ <td><%=h(category.assigned_to.name) if category.assigned_to %></td>
+ <td align="center"><small><%= link_to_if_authorized l(:button_edit), { :controller => 'issue_categories', :action => 'edit', :id => category }, :class => 'icon icon-edit' %></small></td>
+ <td align="center"><small><%= link_to_if_authorized l(:button_delete), {:controller => 'issue_categories', :action => 'destroy', :id => category}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></small></td>
+ </tr>
+ <% end %>
+<% end %>
+ </tbody>
+</table>
+&nbsp;
+<p><%= link_to_if_authorized l(:label_issue_category_new), :controller => 'projects', :action => 'add_issue_category', :id => @project %></p>
diff --git a/app/views/projects/_members.rhtml b/app/views/projects/settings/_members.rhtml
index affaf7854..1cd69bdfe 100644
--- a/app/views/projects/_members.rhtml
+++ b/app/views/projects/settings/_members.rhtml
@@ -33,8 +33,8 @@
</table>
&nbsp;
-<% if authorize_for('projects', 'add_member') && !users.empty? %>
- <% remote_form_for(:member, @member, :url => {:controller => 'projects', :action => 'add_member', :tab => 'members', :id => @project}, :method => :post) do |f| %>
+<% if authorize_for('members', 'new') && !users.empty? %>
+ <% remote_form_for(:member, @member, :url => {:controller => 'members', :action => 'new', :id => @project}, :method => :post) do |f| %>
<p><label for="member_user_id"><%=l(:label_member_new)%></label><br />
<%= f.select :user_id, users.collect{|user| [user.name, user.id]} %>
<%= l(:label_role) %>: <%= f.select :role_id, roles.collect{|role| [role.name, role.id]}, :selected => nil %>
diff --git a/app/views/projects/settings/_modules.rhtml b/app/views/projects/settings/_modules.rhtml
new file mode 100644
index 000000000..9916225b0
--- /dev/null
+++ b/app/views/projects/settings/_modules.rhtml
@@ -0,0 +1,14 @@
+<% form_for :project, @project,
+ :url => { :action => 'modules', :id => @project },
+ :html => {:id => 'modules-form'} do |f| %>
+
+<div class=box>
+<% Redmine::AccessControl.available_project_modules.each do |m| %>
+<p><label><%= check_box_tag 'enabled_modules[]', m, @project.module_enabled?(m) %> <%= m.to_s.humanize %></label></p>
+<% end %>
+</div>
+
+<p><%= check_all_links 'modules-form' %></p>
+<p><%= submit_tag l(:button_save) %></p>
+
+<% end %>
diff --git a/app/views/projects/settings/_repository.rhtml b/app/views/projects/settings/_repository.rhtml
new file mode 100644
index 000000000..10530a296
--- /dev/null
+++ b/app/views/projects/settings/_repository.rhtml
@@ -0,0 +1,20 @@
+<% remote_form_for :repository, @repository,
+ :url => { :controller => 'repositories', :action => 'edit', :id => @project },
+ :builder => TabularFormBuilder do |f| %>
+
+<%= error_messages_for 'repository' %>
+
+<div class="box tabular">
+<p><label>SCM</label><%= scm_select_tag(@repository) %></p>
+<%= repository_field_tags(f, @repository) if @repository %>
+</div>
+
+<div class="contextual">
+<%= link_to(l(:button_delete), {:controller => 'repositories', :action => 'destroy', :id => @project},
+ :confirm => l(:text_are_you_sure),
+ :method => :post,
+ :class => 'icon icon-del') if @repository && !@repository.new_record? %>
+</div>
+
+<%= submit_tag((@repository.nil? || @repository.new_record?) ? l(:button_create) : l(:button_save)) %>
+<% end %>
diff --git a/app/views/projects/settings/_versions.rhtml b/app/views/projects/settings/_versions.rhtml
new file mode 100644
index 000000000..a710a847d
--- /dev/null
+++ b/app/views/projects/settings/_versions.rhtml
@@ -0,0 +1,25 @@
+<table class="list">
+ <thead>
+ <th><%= l(:label_version) %></th>
+ <th><%= l(:field_effective_date) %></th>
+ <th><%= l(:field_description) %></th>
+ <th><%= l(:label_wiki_page) unless @project.wiki.nil? %></th>
+ <th style="width:15%"></th>
+ <th style="width:15%"></th>
+ </thead>
+ <tbody>
+<% for version in @project.versions.sort %>
+ <tr class="<%= cycle 'odd', 'even' %>">
+ <td><%=h version.name %></td>
+ <td align="center"><%= format_date(version.effective_date) %></td>
+ <td><%=h version.description %></td>
+ <td><%= link_to(version.wiki_page_title, :controller => 'wiki', :page => Wiki.titleize(version.wiki_page_title)) unless version.wiki_page_title.blank? || @project.wiki.nil? %></td>
+ <td align="center"><small><%= link_to_if_authorized l(:button_edit), { :controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %></small></td>
+ <td align="center"><small><%= link_to_if_authorized l(:button_delete), {:controller => 'versions', :action => 'destroy', :id => version}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></small></td>
+ </td>
+ </tr>
+<% end; reset_cycle %>
+ </tbody>
+</table>
+&nbsp;
+<p><%= link_to_if_authorized l(:label_version_new), :controller => 'projects', :action => 'add_version', :id => @project %></p>
diff --git a/app/views/projects/settings/_wiki.rhtml b/app/views/projects/settings/_wiki.rhtml
new file mode 100644
index 000000000..267c077e1
--- /dev/null
+++ b/app/views/projects/settings/_wiki.rhtml
@@ -0,0 +1,18 @@
+<% remote_form_for :wiki, @wiki,
+ :url => { :controller => 'wikis', :action => 'edit', :id => @project },
+ :builder => TabularFormBuilder do |f| %>
+
+<%= error_messages_for 'wiki' %>
+
+<div class="box tabular">
+<p><%= f.text_field :start_page, :size => 60, :required => true %><br />
+<em><%= l(:text_unallowed_characters) %>: , . / ? ; : |</em></p>
+</div>
+
+<div class="contextual">
+<%= link_to(l(:button_delete), {:controller => 'wikis', :action => 'destroy', :id => @project},
+ :class => 'icon icon-del') if @wiki && !@wiki.new_record? %>
+</div>
+
+<%= submit_tag((@wiki.nil? || @wiki.new_record?) ? l(:button_create) : l(:button_save)) %>
+<% end %>
diff --git a/app/views/projects/show.rhtml b/app/views/projects/show.rhtml
index f0a09fc9a..e5234f2f7 100644
--- a/app/views/projects/show.rhtml
+++ b/app/views/projects/show.rhtml
@@ -19,6 +19,7 @@
<% end %>
</ul>
+ <% if User.current.allowed_to?(:view_issues, @project) %>
<div class="box">
<div class="contextual"><% if authorize_for('projects', 'add_issue') %><%= l(:label_issue_new) %>: <%= new_issue_selector %><% end %></div>
<h3 class="icon22 icon22-tracker"><%=l(:label_issue_tracking)%></h3>
@@ -33,6 +34,7 @@
</ul>
<p class="textcenter"><small><%= link_to l(:label_issue_view_all), :controller => 'projects', :action => 'list_issues', :id => @project, :set_filter => 1 %></small></p>
</div>
+ <% end %>
</div>
<div class="splitcontentright">
diff --git a/app/views/roles/_form.rhtml b/app/views/roles/_form.rhtml
index 62e25e337..6213aa2fb 100644
--- a/app/views/roles/_form.rhtml
+++ b/app/views/roles/_form.rhtml
@@ -2,19 +2,23 @@
<div class="box">
<p><%= f.text_field :name, :required => true, :disabled => @role.builtin? %></p>
-</div>
<p><%= f.check_box :assignable %></p>
-<div class="clear"></div>
+</div>
-<fieldset class="box"><legend><%=l(:label_permissions)%></legend>
-<% @permissions.each do |permission| %>
- <div style="width:220px;float:left;">
- <%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
- <%= permission.name.to_s.humanize %>
- </div>
+<div class="box">
+<h3><%= l(:label_permissions) %></h3>
+
+<% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %>
+<% perms_by_module.keys.sort.each do |mod| %>
+ <fieldset><legend><%= mod.blank? ? l(:label_project) : mod.humanize %></legend>
+ <% perms_by_module[mod].each do |permission| %>
+ <div style="width:220px;float:left;">
+ <%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
+ <%= permission.name.to_s.humanize %>
+ </div>
+ <% end %>
+ </fieldset>
<% end %>
+<br /><%= check_all_links 'role_form' %>
<%= hidden_field_tag 'role[permissions][]', '' %>
-<div class="clear"></div>
-<br />
-<%= check_all_links 'role_form' %>
-</fieldset>
+</div>
diff --git a/app/views/roles/report.rhtml b/app/views/roles/report.rhtml
index ca2f9d798..3d2ecc1e3 100644
--- a/app/views/roles/report.rhtml
+++ b/app/views/roles/report.rhtml
@@ -12,17 +12,23 @@
</tr>
</thead>
<tbody>
-<% @permissions.each do |permission| %>
- <tr class="<%= cycle('odd', 'even') %>">
- <td><%= permission.name.to_s.humanize %></td>
- <% @roles.each do |role| %>
- <td align="center">
- <% if role.setable_permissions.include? permission %>
- <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name) %>
+<% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %>
+<% perms_by_module.keys.sort.each do |mod| %>
+ <% unless mod.blank? %>
+ <tr><%= content_tag('th', mod.humanize, :colspan => (@roles.size + 1)) %></th></tr>
<% end %>
- </td>
+ <% perms_by_module[mod].each do |permission| %>
+ <tr class="<%= cycle('odd', 'even') %>">
+ <td><%= permission.name.to_s.humanize %></td>
+ <% @roles.each do |role| %>
+ <td align="center">
+ <% if role.setable_permissions.include? permission %>
+ <%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name) %>
+ <% end %>
+ </td>
+ <% end %>
+ </tr>
<% end %>
- </tr>
<% end %>
</tbody>
</table>
diff --git a/app/views/wikis/destroy.rhtml b/app/views/wikis/destroy.rhtml
new file mode 100644
index 000000000..b5b1de114
--- /dev/null
+++ b/app/views/wikis/destroy.rhtml
@@ -0,0 +1,10 @@
+<h2><%=l(:label_confirmation)%></h2>
+
+<div class="box"><center>
+<p><strong><%= @project.name %></strong><br /><%=l(:text_wiki_destroy_confirmation)%></p>
+
+<% form_tag({:controller => 'wikis', :action => 'destroy', :id => @project}) do %>
+<%= hidden_field_tag "confirm", 1 %>
+<%= submit_tag l(:button_delete) %>
+<% end %>
+</center></div>