##// END OF EJS Templates
Adds an option to generate sequential project identifiers....
Jean-Philippe Lang -
r1776:dbad26c87db8
parent child
Show More
@@ -0,0 +1,12
1 <% form_tag({:action => 'edit', :tab => 'projects'}) do %>
2
3 <div class="box tabular settings">
4 <p><label><%= l(:setting_default_projects_public) %></label>
5 <%= check_box_tag 'settings[default_projects_public]', 1, Setting.default_projects_public? %><%= hidden_field_tag 'settings[default_projects_public]', 0 %></p>
6
7 <p><label><%= l(:setting_sequential_project_identifiers) %></label>
8 <%= check_box_tag 'settings[sequential_project_identifiers]', 1, Setting.sequential_project_identifiers? %><%= hidden_field_tag 'settings[sequential_project_identifiers]', 0 %></p>
9 </div>
10
11 <%= submit_tag l(:button_save) %>
12 <% end %>
@@ -69,6 +69,7 class ProjectsController < ApplicationController
69 69 :order => 'name')
70 70 @project = Project.new(params[:project])
71 71 if request.get?
72 @project.identifier = Project.next_identifier if Setting.sequential_project_identifiers?
72 73 @project.trackers = Tracker.all
73 74 @project.is_public = Setting.default_projects_public?
74 75 @project.enabled_module_names = Redmine::AccessControl.available_project_modules
@@ -19,6 +19,7 module SettingsHelper
19 19 def administration_settings_tabs
20 20 tabs = [{:name => 'general', :partial => 'settings/general', :label => :label_general},
21 21 {:name => 'authentication', :partial => 'settings/authentication', :label => :label_authentication},
22 {:name => 'projects', :partial => 'settings/projects', :label => :label_project_plural},
22 23 {:name => 'issues', :partial => 'settings/issues', :label => :label_issue_tracking},
23 24 {:name => 'notifications', :partial => 'settings/notifications', :label => l(:field_mail_notification)},
24 25 {:name => 'mail_handler', :partial => 'settings/mail_handler', :label => l(:label_incoming_emails)},
@@ -238,6 +238,12 class Project < ActiveRecord::Base
238 238 enabled_modules << EnabledModule.new(:name => name.to_s)
239 239 end
240 240 end
241
242 # Returns an auto-generated project identifier based on the last identifier used
243 def self.next_identifier
244 p = Project.find(:first, :order => 'created_on DESC')
245 p.nil? ? nil : p.identifier.to_s.succ
246 end
241 247
242 248 protected
243 249 def validate
@@ -46,9 +46,6
46 46
47 47 <p><label><%= l(:setting_feeds_limit) %></label>
48 48 <%= text_field_tag 'settings[feeds_limit]', Setting.feeds_limit, :size => 6 %></p>
49
50 <p><label><%= l(:setting_default_projects_public) %></label>
51 <%= check_box_tag 'settings[default_projects_public]', 1, Setting.default_projects_public? %><%= hidden_field_tag 'settings[default_projects_public]', 0 %></p>
52 49 </div>
53 50
54 51 <%= submit_tag l(:button_save) %>
@@ -118,6 +118,8 display_subprojects_issues:
118 118 default: 1
119 119 default_projects_public:
120 120 default: 1
121 sequential_project_identifiers:
122 default: 0
121 123 # encodings used to convert repository files content to UTF-8
122 124 # multiple values accepted, comma separated
123 125 repositories_encodings:
@@ -636,3 +636,4 field_parent_title: Parent page
636 636 label_issue_watchers: Watchers
637 637 setting_commit_logs_encoding: Commit messages encoding
638 638 button_quote: Quote
639 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -641,3 +641,4 field_parent_title: Parent page
641 641 label_issue_watchers: Watchers
642 642 setting_commit_logs_encoding: Commit messages encoding
643 643 button_quote: Quote
644 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -638,3 +638,4 field_parent_title: Parent page
638 638 label_issue_watchers: Watchers
639 639 setting_commit_logs_encoding: Commit messages encoding
640 640 button_quote: Quote
641 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -637,3 +637,4 field_parent_title: Parent page
637 637 label_issue_watchers: Watchers
638 638 setting_commit_logs_encoding: Commit messages encoding
639 639 button_quote: Quote
640 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -219,6 +219,7 setting_display_subprojects_issues: Display subprojects issues on main projects
219 219 setting_enabled_scm: Enabled SCM
220 220 setting_mail_handler_api_enabled: Enable WS for incoming emails
221 221 setting_mail_handler_api_key: API key
222 setting_sequential_project_identifiers: Generate sequential project identifiers
222 223
223 224 project_module_issue_tracking: Issue tracking
224 225 project_module_time_tracking: Time tracking
@@ -639,3 +639,4 field_parent_title: Parent page
639 639 label_issue_watchers: Watchers
640 640 setting_commit_logs_encoding: Commit messages encoding
641 641 button_quote: Quote
642 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -636,3 +636,4 field_parent_title: Parent page
636 636 label_issue_watchers: Watchers
637 637 setting_commit_logs_encoding: Commit messages encoding
638 638 button_quote: Quote
639 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -220,6 +220,7 setting_display_subprojects_issues: Afficher par défaut les demandes des sous-p
220 220 setting_enabled_scm: SCM activés
221 221 setting_mail_handler_api_enabled: "Activer le WS pour la réception d'emails"
222 222 setting_mail_handler_api_key: Clé de protection de l'API
223 setting_sequential_project_identifiers: Générer des identifiants de projet séquentiels
223 224
224 225 project_module_issue_tracking: Suivi des demandes
225 226 project_module_time_tracking: Suivi du temps passé
@@ -636,3 +636,4 field_parent_title: Parent page
636 636 label_issue_watchers: Watchers
637 637 setting_commit_logs_encoding: Commit messages encoding
638 638 button_quote: Quote
639 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -637,3 +637,4 field_parent_title: Parent page
637 637 label_issue_watchers: Watchers
638 638 setting_commit_logs_encoding: Commit messages encoding
639 639 button_quote: Quote
640 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -636,3 +636,4 field_parent_title: Parent page
636 636 label_issue_watchers: Watchers
637 637 setting_commit_logs_encoding: Commit messages encoding
638 638 button_quote: Quote
639 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -637,3 +637,4 field_parent_title: Parent page
637 637 label_issue_watchers: Watchers
638 638 setting_commit_logs_encoding: Commit messages encoding
639 639 button_quote: Quote
640 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -636,3 +636,4 field_parent_title: Parent page
636 636 label_issue_watchers: Watchers
637 637 setting_commit_logs_encoding: Commit messages encoding
638 638 button_quote: Quote
639 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -639,3 +639,4 field_parent_title: Parent page
639 639 label_issue_watchers: Watchers
640 640 setting_commit_logs_encoding: Commit messages encoding
641 641 button_quote: Quote
642 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -637,3 +637,4 field_parent_title: Parent page
637 637 label_issue_watchers: Watchers
638 638 setting_commit_logs_encoding: Commit messages encoding
639 639 button_quote: Quote
640 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -637,3 +637,4 field_parent_title: Parent page
637 637 label_issue_watchers: Watchers
638 638 setting_commit_logs_encoding: Commit messages encoding
639 639 button_quote: Quote
640 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -636,3 +636,4 field_parent_title: Parent page
636 636 label_issue_watchers: Watchers
637 637 setting_commit_logs_encoding: Commit messages encoding
638 638 button_quote: Quote
639 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -636,3 +636,4 field_parent_title: Parent page
636 636 label_issue_watchers: Watchers
637 637 setting_commit_logs_encoding: Commit messages encoding
638 638 button_quote: Quote
639 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -636,3 +636,4 field_parent_title: Parent page
636 636 label_issue_watchers: Watchers
637 637 setting_commit_logs_encoding: Commit messages encoding
638 638 button_quote: Quote
639 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -636,3 +636,4 field_parent_title: Parent page
636 636 label_issue_watchers: Watchers
637 637 setting_commit_logs_encoding: Commit messages encoding
638 638 button_quote: Quote
639 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -640,3 +640,4 field_parent_title: Parent page
640 640 label_issue_watchers: Watchers
641 641 setting_commit_logs_encoding: Commit messages encoding
642 642 button_quote: Quote
643 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -637,3 +637,4 field_parent_title: Parent page
637 637 label_issue_watchers: Watchers
638 638 setting_commit_logs_encoding: Commit messages encoding
639 639 button_quote: Quote
640 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -637,3 +637,4 field_parent_title: Parent page
637 637 label_issue_watchers: Watchers
638 638 setting_commit_logs_encoding: Commit messages encoding
639 639 button_quote: Quote
640 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -639,3 +639,4 field_parent_title: Parent page
639 639 label_issue_watchers: Watchers
640 640 setting_commit_logs_encoding: Commit messages encoding
641 641 button_quote: Quote
642 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -638,3 +638,4 field_parent_title: Parent page
638 638 label_issue_watchers: Watchers
639 639 setting_commit_logs_encoding: Commit messages encoding
640 640 button_quote: Quote
641 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -637,3 +637,4 field_parent_title: Parent page
637 637 label_issue_watchers: Watchers
638 638 setting_commit_logs_encoding: Commit messages encoding
639 639 button_quote: Quote
640 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -637,3 +637,4 enumeration_issue_priorities: 问题优先级
637 637 enumeration_doc_categories: 文档类别
638 638 enumeration_activities: 活动(时间跟踪)
639 639 button_quote: Quote
640 setting_sequential_project_identifiers: Generate sequential project identifiers
@@ -130,4 +130,15 class ProjectTest < Test::Unit::TestCase
130 130 assert_equal [1, 2, 3], parent.rolled_up_trackers.collect(&:id)
131 131 assert_equal [2, 3], child.rolled_up_trackers.collect(&:id)
132 132 end
133
134 def test_next_identifier
135 ProjectCustomField.delete_all
136 Project.create!(:name => 'last', :identifier => 'p2008040')
137 assert_equal 'p2008041', Project.next_identifier
138 end
139
140 def test_next_identifier_first_project
141 Project.delete_all
142 assert_nil Project.next_identifier
143 end
133 144 end
General Comments 0
You need to be logged in to leave comments. Login now