helper :sort
include SortHelper
- def index
+ def index
+ @no_configuration_data = Redmine::DefaultData::Loader::no_data?
end
def projects
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
--- /dev/null
+<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' %>
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
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"
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"
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"
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:'
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
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"
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:'
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
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"
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"
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"
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"
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"
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"
label_display_per_page: 'Per page: %s'\r
setting_per_page_options: Objects per page options\r
label_age: Age\r
+notice_default_data_loaded: Default configuration successfully loaded.\r
+text_load_default_configuration: Load the default configuration\r
+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."\r
+error_can_t_load_default_data: "Default configuration could not be loaded: %s"\r
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"
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"
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"
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"
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"
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"
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"
raise DataAlreadyLoaded.new("Some configuration data is already loaded.") unless no_data?
set_language_if_valid(lang)
- # Roles
- manager = Role.create! :name => l(:default_role_manager),
- :position => 1
- manager.permissions = manager.setable_permissions.collect {|p| p.name}
- manager.save!
-
- developper = Role.create! :name => l(:default_role_developper),
- :position => 2,
- :permissions => [:manage_versions,
- :manage_categories,
- :add_issues,
- :edit_issues,
- :manage_issue_relations,
+ Role.transaction do
+ # Roles
+ manager = Role.create! :name => l(:default_role_manager),
+ :position => 1
+ manager.permissions = manager.setable_permissions.collect {|p| p.name}
+ manager.save!
+
+ developper = Role.create! :name => l(:default_role_developper),
+ :position => 2,
+ :permissions => [:manage_versions,
+ :manage_categories,
+ :add_issues,
+ :edit_issues,
+ :manage_issue_relations,
+ :add_issue_notes,
+ :change_issue_status,
+ :save_queries,
+ :view_gantt,
+ :view_calendar,
+ :log_time,
+ :view_time_entries,
+ :comment_news,
+ :view_documents,
+ :view_wiki_pages,
+ :edit_wiki_pages,
+ :delete_wiki_pages,
+ :add_messages,
+ :view_files,
+ :manage_files,
+ :browse_repository,
+ :view_changesets]
+
+ reporter = Role.create! :name => l(:default_role_reporter),
+ :position => 3,
+ :permissions => [:add_issues,
:add_issue_notes,
:change_issue_status,
:save_queries,
:comment_news,
:view_documents,
:view_wiki_pages,
- :edit_wiki_pages,
- :delete_wiki_pages,
:add_messages,
:view_files,
- :manage_files,
:browse_repository,
:view_changesets]
+
+ Role.non_member.update_attribute :permissions, [:add_issues,
+ :add_issue_notes,
+ :change_issue_status,
+ :save_queries,
+ :view_gantt,
+ :view_calendar,
+ :view_time_entries,
+ :comment_news,
+ :view_documents,
+ :view_wiki_pages,
+ :add_messages,
+ :view_files,
+ :browse_repository,
+ :view_changesets]
- reporter = Role.create! :name => l(:default_role_reporter),
- :position => 3,
- :permissions => [:add_issues,
- :add_issue_notes,
- :change_issue_status,
- :save_queries,
- :view_gantt,
- :view_calendar,
- :log_time,
- :view_time_entries,
- :comment_news,
- :view_documents,
- :view_wiki_pages,
- :add_messages,
- :view_files,
- :browse_repository,
- :view_changesets]
-
- Role.non_member.update_attribute :permissions, [:add_issues,
- :add_issue_notes,
- :change_issue_status,
- :save_queries,
- :view_gantt,
- :view_calendar,
- :view_time_entries,
- :comment_news,
- :view_documents,
- :view_wiki_pages,
- :add_messages,
- :view_files,
- :browse_repository,
- :view_changesets]
-
- Role.anonymous.update_attribute :permissions, [:view_gantt,
- :view_calendar,
- :view_time_entries,
- :view_documents,
- :view_wiki_pages,
- :view_files,
- :browse_repository,
- :view_changesets]
-
- # Trackers
- Tracker.create!(:name => l(:default_tracker_bug), :is_in_chlog => true, :is_in_roadmap => false, :position => 1)
- Tracker.create!(:name => l(:default_tracker_feature), :is_in_chlog => true, :is_in_roadmap => true, :position => 2)
- Tracker.create!(:name => l(:default_tracker_support), :is_in_chlog => false, :is_in_roadmap => false, :position => 3)
-
- # Issue statuses
- new = IssueStatus.create!(:name => l(:default_issue_status_new), :is_closed => false, :is_default => true, :position => 1)
- assigned = IssueStatus.create!(:name => l(:default_issue_status_assigned), :is_closed => false, :is_default => false, :position => 2)
- resolved = IssueStatus.create!(:name => l(:default_issue_status_resolved), :is_closed => false, :is_default => false, :position => 3)
- feedback = IssueStatus.create!(:name => l(:default_issue_status_feedback), :is_closed => false, :is_default => false, :position => 4)
- closed = IssueStatus.create!(:name => l(:default_issue_status_closed), :is_closed => true, :is_default => false, :position => 5)
- rejected = IssueStatus.create!(:name => l(:default_issue_status_rejected), :is_closed => true, :is_default => false, :position => 6)
-
- # Workflow
- Tracker.find(:all).each { |t|
- IssueStatus.find(:all).each { |os|
- IssueStatus.find(:all).each { |ns|
- Workflow.create!(:tracker_id => t.id, :role_id => manager.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
- }
- }
- }
+ Role.anonymous.update_attribute :permissions, [:view_gantt,
+ :view_calendar,
+ :view_time_entries,
+ :view_documents,
+ :view_wiki_pages,
+ :view_files,
+ :browse_repository,
+ :view_changesets]
+
+ # Trackers
+ Tracker.create!(:name => l(:default_tracker_bug), :is_in_chlog => true, :is_in_roadmap => false, :position => 1)
+ Tracker.create!(:name => l(:default_tracker_feature), :is_in_chlog => true, :is_in_roadmap => true, :position => 2)
+ Tracker.create!(:name => l(:default_tracker_support), :is_in_chlog => false, :is_in_roadmap => false, :position => 3)
+
+ # Issue statuses
+ new = IssueStatus.create!(:name => l(:default_issue_status_new), :is_closed => false, :is_default => true, :position => 1)
+ assigned = IssueStatus.create!(:name => l(:default_issue_status_assigned), :is_closed => false, :is_default => false, :position => 2)
+ resolved = IssueStatus.create!(:name => l(:default_issue_status_resolved), :is_closed => false, :is_default => false, :position => 3)
+ feedback = IssueStatus.create!(:name => l(:default_issue_status_feedback), :is_closed => false, :is_default => false, :position => 4)
+ closed = IssueStatus.create!(:name => l(:default_issue_status_closed), :is_closed => true, :is_default => false, :position => 5)
+ rejected = IssueStatus.create!(:name => l(:default_issue_status_rejected), :is_closed => true, :is_default => false, :position => 6)
+
+ # Workflow
+ Tracker.find(:all).each { |t|
+ IssueStatus.find(:all).each { |os|
+ IssueStatus.find(:all).each { |ns|
+ Workflow.create!(:tracker_id => t.id, :role_id => manager.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
+ }
+ }
+ }
+
+ Tracker.find(:all).each { |t|
+ [new, assigned, resolved, feedback].each { |os|
+ [assigned, resolved, feedback, closed].each { |ns|
+ Workflow.create!(:tracker_id => t.id, :role_id => developper.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
+ }
+ }
+ }
+
+ Tracker.find(:all).each { |t|
+ [new, assigned, resolved, feedback].each { |os|
+ [closed].each { |ns|
+ Workflow.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
+ }
+ }
+ Workflow.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => resolved.id, :new_status_id => feedback.id)
+ }
- Tracker.find(:all).each { |t|
- [new, assigned, resolved, feedback].each { |os|
- [assigned, resolved, feedback, closed].each { |ns|
- Workflow.create!(:tracker_id => t.id, :role_id => developper.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
- }
- }
- }
+ # Enumerations
+ Enumeration.create!(:opt => "DCAT", :name => l(:default_doc_category_user), :position => 1)
+ Enumeration.create!(:opt => "DCAT", :name => l(:default_doc_category_tech), :position => 2)
- Tracker.find(:all).each { |t|
- [new, assigned, resolved, feedback].each { |os|
- [closed].each { |ns|
- Workflow.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
- }
- }
- Workflow.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => resolved.id, :new_status_id => feedback.id)
- }
-
- # Enumerations
- Enumeration.create!(:opt => "DCAT", :name => l(:default_doc_category_user), :position => 1)
- Enumeration.create!(:opt => "DCAT", :name => l(:default_doc_category_tech), :position => 2)
-
- Enumeration.create!(:opt => "IPRI", :name => l(:default_priority_low), :position => 1)
- Enumeration.create!(:opt => "IPRI", :name => l(:default_priority_normal), :position => 2, :is_default => true)
- Enumeration.create!(:opt => "IPRI", :name => l(:default_priority_high), :position => 3)
- Enumeration.create!(:opt => "IPRI", :name => l(:default_priority_urgent), :position => 4)
- Enumeration.create!(:opt => "IPRI", :name => l(:default_priority_immediate), :position => 5)
-
- Enumeration.create!(:opt => "ACTI", :name => l(:default_activity_design), :position => 1)
- Enumeration.create!(:opt => "ACTI", :name => l(:default_activity_development), :position => 2)
+ Enumeration.create!(:opt => "IPRI", :name => l(:default_priority_low), :position => 1)
+ Enumeration.create!(:opt => "IPRI", :name => l(:default_priority_normal), :position => 2, :is_default => true)
+ Enumeration.create!(:opt => "IPRI", :name => l(:default_priority_high), :position => 3)
+ Enumeration.create!(:opt => "IPRI", :name => l(:default_priority_urgent), :position => 4)
+ Enumeration.create!(:opt => "IPRI", :name => l(:default_priority_immediate), :position => 5)
+ Enumeration.create!(:opt => "ACTI", :name => l(:default_activity_design), :position => 1)
+ Enumeration.create!(:opt => "ACTI", :name => l(:default_activity_development), :position => 2)
+ end
true
end
end
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
@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
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