Commit c9fd7513 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Default configuration data can now be loaded from the administration screen.

A message is automatically displayed on this screen if roles, trackers,... have not been configured yet.
The rake task is still available and the data loading code is wrapped in a transaction.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1040 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 8d9b0486
......@@ -22,7 +22,8 @@ class AdminController < ApplicationController
helper :sort
include SortHelper
def index
def index
@no_configuration_data = Redmine::DefaultData::Loader::no_data?
end
def projects
......@@ -56,6 +57,20 @@ class AdminController < ApplicationController
end
end
# Loads the default configuration
# (roles, trackers, statuses, workflow, enumerations)
def default_configuration
if request.post?
begin
Redmine::DefaultData::Loader::load(params[:lang])
flash[:notice] = l(:notice_default_data_loaded)
rescue Exception => e
flash[:error] = l(:error_can_t_load_default_data, e.message)
end
end
redirect_to :action => 'index'
end
def test_email
raise_delivery_errors = ActionMailer::Base.raise_delivery_errors
# Force ActionMailer to raise delivery errors so we can catch it
......
<div class="nodata">
<% form_tag({:action => 'default_configuration'}) do %>
<%= simple_format(l(:text_no_configuration_data)) %>
<p><%= l(:field_language) %>:
<%= select_tag 'lang', options_for_select(lang_options_for_select(false), current_language.to_s) %>
<%= submit_tag l(:text_load_default_configuration) %></p>
<% end %>
</div>
<h2><%=l(:label_administration)%></h2>
<%= render :partial => 'no_data' if @no_configuration_data %>
<p class="icon22 icon22-projects">
<%= link_to l(:label_project_plural), :controller => 'admin', :action => 'projects' %> |
<%= link_to l(:label_new), :controller => 'projects', :action => 'add' %>
......
......@@ -33,24 +33,18 @@ Supported databases:
rake db:migrate RAILS_ENV="production"
It will create tables and an administrator account.
5. Insert default configuration data in the database:
rake redmine:load_default_data RAILS_ENV="production"
It will load default roles, trackers, statuses, workflows and enumerations.
This step is optional but *highly recommended*
6. Test the installation by running WEBrick web server:
5. Test the installation by running WEBrick web server:
ruby script/server -e production
Once WEBrick has started, point your browser to http://localhost:3000/
You should now see the application welcome page
7. Use default administrator account to log in:
6. Use default administrator account to log in:
login: admin
password: admin
8. You can go to "Admin -> Settings" to modify application settings.
9. Setup Apache or Lighttpd with fastcgi for best performance.
7. Go to "Administration" to load the default configuration data (roles,
trackers, statuses, workflow) and adjust application settings
== SMTP server Configuration
......
......@@ -553,3 +553,7 @@ field_searchable: Searchable
label_display_per_page: 'Per page: %s'
setting_per_page_options: Objects per page options
label_age: Age
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -553,3 +553,7 @@ field_searchable: Searchable
label_display_per_page: 'Per page: %s'
setting_per_page_options: Objects per page options
label_age: Age
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -553,3 +553,7 @@ field_searchable: Searchable
label_display_per_page: 'Per page: %s'
setting_per_page_options: Objects per page options
label_age: Age
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -76,6 +76,9 @@ notice_feeds_access_key_reseted: Your RSS access key was reseted.
notice_failed_to_save_issues: "Failed to save %d issue(s) on %d selected: %s."
notice_no_issue_selected: "No issue is selected! Please, check the issues you want to edit."
notice_account_pending: "Your account was created and is now pending administrator approval."
notice_default_data_loaded: Default configuration successfully loaded.
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
mail_subject_lost_password: Your Redmine password
mail_body_lost_password: 'To change your Redmine password, click on the following link:'
......@@ -527,6 +530,8 @@ text_issue_category_destroy_question: Some issues (%d) are assigned to this cate
text_issue_category_destroy_assignments: Remove category assignments
text_issue_category_reassign_to: Reassign issues to this category
text_user_mail_option: "For unselected projects, you will only receive notifications about things you watch or you're involved in (eg. issues you're the author or assignee)."
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
text_load_default_configuration: Load the default configuration
default_role_manager: Manager
default_role_developper: Developer
......
......@@ -556,3 +556,7 @@ field_searchable: Incluir en las búsquedas
label_display_per_page: 'Por página: %s'
setting_per_page_options: Objetos por página
label_age: Edad
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -72,10 +72,13 @@ notice_scm_error: "L'entrée et/ou la révision demandée n'existe pas dans le d
notice_not_authorized: "Vous n'êtes pas autorisés à accéder à cette page."
notice_email_sent: "Un email a été envoyé à %s"
notice_email_error: "Erreur lors de l'envoi de l'email (%s)"
notice_feeds_access_key_reseted: Votre clé d'accès aux flux RSS a été réinitialisée.
notice_feeds_access_key_reseted: "Votre clé d'accès aux flux RSS a été réinitialisée."
notice_failed_to_save_issues: "%d demande(s) sur les %d sélectionnées n'ont pas pu être mise(s) à jour: %s."
notice_no_issue_selected: "Aucune demande sélectionnée ! Cochez les demandes que vous voulez mettre à jour."
notice_account_pending: "Votre compte a été créé et attend l'approbation de l'administrateur."
notice_default_data_loaded: Paramétrage par défaut chargé avec succès.
error_can_t_load_default_data: "Une erreur s'est produite lors du chargement du paramétrage: %s"
mail_subject_lost_password: Votre mot de passe redMine
mail_body_lost_password: 'Pour changer votre mot de passe Redmine, cliquez sur le lien suivant:'
......@@ -527,6 +530,8 @@ text_issue_category_destroy_question: Des demandes (%d) sont affectées à cette
text_issue_category_destroy_assignments: N'affecter les demandes à aucune autre catégorie
text_issue_category_reassign_to: Réaffecter les demandes à cette catégorie
text_user_mail_option: "Pour les projets non sélectionnés, vous recevrez seulement des notifications pour ce que vous surveillez ou à quoi vous participez (exemple: demandes dont vous êtes l'auteur ou la personne assignée)."
text_no_configuration_data: "Les rôles, trackers, statuts et le workflow ne sont pas encore paramétrés.\nIl est vivement recommandé de charger le paramétrage par defaut. Vous pourrez le modifier une fois chargé."
text_load_default_configuration: Charger le paramétrage par défaut
default_role_manager: Manager
default_role_developper: Développeur
......
......@@ -553,3 +553,7 @@ field_searchable: Searchable
label_display_per_page: 'Per page: %s'
setting_per_page_options: Objects per page options
label_age: Age
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -553,3 +553,7 @@ field_searchable: Searchable
label_display_per_page: 'Per page: %s'
setting_per_page_options: Objects per page options
label_age: Age
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -554,3 +554,7 @@ field_searchable: Searchable
label_display_per_page: 'Per page: %s'
setting_per_page_options: Objects per page options
label_age: Age
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -553,3 +553,7 @@ field_searchable: Searchable
label_display_per_page: 'Per page: %s'
setting_per_page_options: Objects per page options
label_age: Age
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -554,3 +554,7 @@ field_searchable: Searchable
label_display_per_page: 'Per page: %s'
setting_per_page_options: Objects per page options
label_age: Age
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -553,3 +553,7 @@ field_searchable: Searchable
label_display_per_page: 'Per page: %s'
setting_per_page_options: Objects per page options
label_age: Age
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -553,3 +553,7 @@ field_searchable: Searchable
label_display_per_page: 'Per page: %s'
setting_per_page_options: Objects per page options
label_age: Age
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -553,3 +553,7 @@ field_searchable: Searchable
label_display_per_page: 'Per page: %s'
setting_per_page_options: Objects per page options
label_age: Age
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -553,3 +553,7 @@ field_searchable: Searchable
label_display_per_page: 'Per page: %s'
setting_per_page_options: Objects per page options
label_age: Age
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -553,3 +553,7 @@ field_searchable: Searchable
label_display_per_page: 'Per page: %s'
setting_per_page_options: Objects per page options
label_age: Age
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -554,3 +554,7 @@ field_searchable: Searchable
label_display_per_page: 'Po stranici: %s'
setting_per_page_options: Objekata po stranici opcija
label_age: Starost
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -554,3 +554,7 @@ field_searchable: Searchable
label_display_per_page: 'Per page: %s'
setting_per_page_options: Objects per page options
label_age: Age
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -553,3 +553,7 @@ field_searchable: Searchable
label_display_per_page: 'Per page: %s'
setting_per_page_options: Objects per page options
label_age: Age
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
......@@ -556,3 +556,7 @@ field_searchable: Searchable
label_display_per_page: 'Per page: %s'
setting_per_page_options: Objects per page options
label_age: Age
notice_default_data_loaded: Default configuration successfully loaded.
text_load_default_configuration: Load the default configuration
text_no_configuration_data: "Roles, trackers, issue statuses and workflow have not been configured yet.\nIt is highly recommended to load the default configuration. You will be able to modify it once loaded."
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
This diff is collapsed.
......@@ -22,7 +22,7 @@ require 'admin_controller'
class AdminController; def rescue_action(e) raise e end; end
class AdminControllerTest < Test::Unit::TestCase
fixtures :projects, :users
fixtures :projects, :users, :roles
def setup
@controller = AdminController.new
......@@ -32,6 +32,25 @@ class AdminControllerTest < Test::Unit::TestCase
@request.session[:user_id] = 1 # admin
end
def test_index
get :index
assert_no_tag :tag => 'div',
:attributes => { :class => /nodata/ }
end
def test_index_with_no_configuration_data
delete_configuration_data
get :index
assert_tag :tag => 'div',
:attributes => { :class => /nodata/ }
end
def test_load_default_configuration_data
delete_configuration_data
post :default_configuration, :lang => 'fr'
assert IssueStatus.find_by_name('Nouveau')
end
def test_get_mail_options
get :mail_options
assert_response :success
......@@ -58,4 +77,11 @@ class AdminControllerTest < Test::Unit::TestCase
assert_response :success
assert_template 'info'
end
def delete_configuration_data
Role.delete_all('builtin = 0')
Tracker.delete_all
IssueStatus.delete_all
Enumeration.delete_all
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment