Project

General

Profile

Feature #465 » 0001-Added-Version-sharing.-465.patch

Latest patch based on r3119 - Eric Davis, 2009-12-03 22:43

View differences:

app/controllers/issues_controller.rb
priority = params[:priority_id].blank? ? nil : IssuePriority.find_by_id(params[:priority_id])
assigned_to = (params[:assigned_to_id].blank? || params[:assigned_to_id] == 'none') ? nil : User.find_by_id(params[:assigned_to_id])
category = (params[:category_id].blank? || params[:category_id] == 'none') ? nil : @project.issue_categories.find_by_id(params[:category_id])
fixed_version = (params[:fixed_version_id].blank? || params[:fixed_version_id] == 'none') ? nil : @project.versions.find_by_id(params[:fixed_version_id])
fixed_version = (params[:fixed_version_id].blank? || params[:fixed_version_id] == 'none') ? nil : @project.shared_versions.find {|v| v.id.to_s == params[:fixed_version_id] }
custom_field_values = params[:custom_field_values] ? params[:custom_field_values].reject {|k,v| v.blank?} : nil
unsaved_issue_ids = []
app/controllers/projects_controller.rb
'downloads' => "#{Attachment.table_name}.downloads"
@containers = [ Project.find(@project.id, :include => :attachments, :order => sort_clause)]
@containers += @project.versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse
# Need get the ids separately in order to add the finder options
version_ids = @project.shared_versions_visible_to_user.collect(&:id)
@containers += Version.find_all_by_id(version_ids, :include => :attachments, :order => sort_clause).sort.reverse
render :layout => !request.xhr?
end
......
def changelog
@trackers = @project.trackers.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position')
retrieve_selected_tracker_ids(@trackers)
@versions = @project.versions.sort
if params[:shared_versions]
@versions = @project.shared_versions_visible_to_user.sort
else
@versions = @project.versions.sort
end
end
def roadmap
@trackers = @project.trackers.find(:all, :conditions => ["is_in_roadmap=?", true])
retrieve_selected_tracker_ids(@trackers)
@versions = @project.versions.sort
if params[:shared_versions]
@versions = @project.shared_versions_visible_to_user.sort
else
@versions = @project.versions.sort
end
@versions = @versions.select {|v| !v.completed? } unless params[:completed]
end
app/helpers/application_helper.rb
h(truncate(text.to_s, :length => 120).gsub(%r{[\r\n]*<(pre|code)>.*$}m, '...')).gsub(/[\r\n]+/, "<br />")
end
def format_version_name(version)
if User.current.allowed_to?(:view_issues, version.project) || version.systemwide?
"#{h(version.project.name)} - #{h(version.name)}"
else
"#{l(:text_not_authorized)}"
end
end
def format_version_sharing_name(version)
if version.shared && Version::SharedValues.key?(version.shared)
l(Version::SharedValues[version.shared])
else
l(:label_version_shared_none)
end
end
# Given an Array of emails (+recipients+), do they all have
# +permission+ on +project+ ?
def recipients_all_allowed_to?(recipients, permission, project)
recipients.uniq.all? do |recipient|
user = User.find_by_mail(recipient)
user && user.allowed_to?(permission, project)
end
end
# Given an Array of +versions+, are all the email addresses
# (+recipients+) allowed to view all of the versions?
def recipients_all_allowed_to_see_versions?(recipients, versions)
versions.uniq.all? do |version|
if version.nil?
true
else
recipients_all_allowed_to?(recipients, :view_issues, version.project)
end
end
end
def due_date_distance_in_words(date)
if date
l((date < Date.today ? :label_roadmap_overdue : :label_roadmap_due_in), distance_of_date_in_words(Date.today, date))
app/helpers/issues_helper.rb
@sidebar_queries
end
# Returns a set of options for a select field, grouped by project.
def shared_version_options(project, selected=nil)
grouped = {}
project.shared_versions.each do |version|
next unless version.open?
if User.current.allowed_to?(:view_issues, version.project) || version.systemwide?
grouped[version.project.name] ||= []
grouped[version.project.name] << [h(version.name), version.id]
else
grouped[l(:text_not_authorized)] ||=[]
grouped[l(:text_not_authorized)] << [l(:text_not_authorized), version.id]
end
end
# Add in the selected
selected_version = Version.find_by_id(selected)
if selected_version && !project.shared_versions.include?(selected_version)
if User.current.allowed_to?(:view_issues, selected_version.project) || selected_version.systemwide?
grouped[selected_version.project.name] ||= []
grouped[selected_version.project.name] << [h(selected_version.name), selected_version.id]
else
grouped[l(:text_not_authorized)] ||=[]
grouped[l(:text_not_authorized)] << [l(:text_not_authorized), selected_version.id]
end
end
grouped_options_for_select(grouped, selected)
end
def show_detail(detail, no_html=false)
case detail.property
when 'attr'
......
c = IssueCategory.find_by_id(detail.value) and value = c.name if detail.value
c = IssueCategory.find_by_id(detail.old_value) and old_value = c.name if detail.old_value
when 'fixed_version_id'
v = Version.find_by_id(detail.value) and value = v.name if detail.value
v = Version.find_by_id(detail.old_value) and old_value = v.name if detail.old_value
v = Version.find_by_id(detail.value) and value = format_version_name(v) if detail.value
v = Version.find_by_id(detail.old_value) and old_value = format_version_name(v) if detail.old_value
when 'estimated_hours'
value = "%0.02f" % detail.value.to_f unless detail.value.blank?
old_value = "%0.02f" % detail.old_value.to_f unless detail.old_value.blank?
app/helpers/mailer_helper.rb
# redMine - project management software
# Copyright (C) 2006-2009 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.
module MailerHelper
def unauthorized_version?(journal_detail, recipients)
return false unless journal_detail.prop_key == "fixed_version_id"
!recipients_all_allowed_to_see_versions?(recipients,
Version.find_all_by_id([journal_detail.value, journal_detail.old_value]))
end
end
app/helpers/projects_helper.rb
module ProjectsHelper
def link_to_version(version, options = {})
return '' unless version && version.is_a?(Version)
link_to h(version.name), { :controller => 'versions', :action => 'show', :id => version }, options
if User.current.allowed_to?(:view_issues, version.project)
link_to format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, options
else
format_version_name(version)
end
end
def project_settings_tabs
app/models/issue.rb
# reassign to the category with same name if any
new_category = issue.category.nil? ? nil : new_project.issue_categories.find_by_name(issue.category.name)
issue.category = new_category
issue.fixed_version = nil
# Keep the fixed_version if it's still valid in the new_project
unless new_project.shared_versions.include?(issue.fixed_version)
issue.fixed_version = nil
end
issue.project = new_project
end
if new_tracker
......
# Versions that the issue can be assigned to
def assignable_versions
@assignable_versions ||= (project.versions.open + [Version.find_by_id(fixed_version_id_was)]).compact.uniq.sort
@assignable_versions ||= (project.shared_versions_visible_to_user(User.current).select {|v| v.open?} +
[Version.find_by_id(fixed_version_id_was)]).
compact.uniq.sort
end
# Returns true if this issue is blocked by another issue that is still open
......
s << ' assigned-to-me' if User.current.logged? && assigned_to_id == User.current.id
s
end
# Update all issues so their versions are not pointing to a
# fixed_version that is outside of the issue's project hierarchy.
#
# OPTIMIZE: does a full table scan of Issues with a fixed_version.
def self.update_fixed_versions_from_project_hierarchy_change
Issue.all(:conditions => ['fixed_version_id IS NOT NULL'],
:include => [:project, :fixed_version]
).each do |issue|
next if issue.project.nil? || issue.fixed_version.nil?
unless issue.project.shared_versions.include?(issue.fixed_version)
issue.init_journal(User.current)
issue.fixed_version = nil
issue.save
end
end
end
private
app/models/mailer.rb
helper :application
helper :issues
helper :custom_fields
helper :mailer
include ActionController::UrlWriter
include Redmine::I18n
app/models/project.rb
# move_to_child_of adds the project in last (ie.right) position
move_to_child_of(p)
end
Issue.update_fixed_versions_from_project_hierarchy_change
true
else
# Can not move to the given target
......
end
end
# Returns an array of the Versions used by the project, its active
# sub projects, and its active parent projects
def shared_versions
unless @shared_versions
@shared_versions = Version.systemwide_versions
@shared_versions += Version.hierarchy_versions(active_projects_in_hierarchy.collect(&:id))
@shared_versions += versions
@shared_versions.uniq!
@shared_versions.sort!
end
yield @shared_versions if block_given?
@shared_versions
end
# Returns the shared_versions that are visible to +user+
def shared_versions_visible_to_user(user=User.current)
return shared_versions do |versions|
versions.delete_if {|v| !user.allowed_to?(:view_issues, v.project) }
end
end
# Returns a hash of project users grouped by role
def users_by_role
members.find(:all, :include => [:user, :roles]).inject({}) do |h, m|
......
self.time_entry_activities.active
end
end
def active_projects_in_hierarchy
self.root.self_and_descendants.delete_if {|p| !p.active? }
end
end
app/models/query.rb
unless @project.issue_categories.empty?
@available_filters["category_id"] = { :type => :list_optional, :order => 6, :values => @project.issue_categories.collect{|s| [s.name, s.id.to_s] } }
end
unless @project.versions.empty?
@available_filters["fixed_version_id"] = { :type => :list_optional, :order => 7, :values => @project.versions.sort.collect{|s| [s.name, s.id.to_s] } }
unless @project.shared_versions.empty?
@available_filters["fixed_version_id"] = { :type => :list_optional, :order => 7, :values => @project.shared_versions.sort.collect{|s| ["#{s.project.name} - #{s.name}", s.id.to_s] } }
end
unless @project.descendants.active.empty?
@available_filters["subproject_id"] = { :type => :list_subprojects, :order => 13, :values => @project.descendants.visible.collect{|s| [s.name, s.id.to_s] } }
app/models/version.rb
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class Version < ActiveRecord::Base
SharedValues = {
"none" => :label_version_shared_none,
"hierarchy" => :label_version_shared_hierarchy,
"system" => :label_version_shared_systemwide
}
before_destroy :check_integrity
after_save :update_issue_versions
belongs_to :project
has_many :fixed_issues, :class_name => 'Issue', :foreign_key => 'fixed_version_id'
acts_as_customizable
......
validates_length_of :name, :maximum => 60
validates_format_of :effective_date, :with => /^\d{4}-\d{2}-\d{2}$/, :message => :not_a_date, :allow_nil => true
validates_inclusion_of :status, :in => VERSION_STATUSES
validates_inclusion_of :shared, :in => SharedValues.keys
named_scope :open, :conditions => {:status => 'open'}
named_scope :systemwide_versions, :conditions => ["#{Version.table_name}.shared = ?", 'system' ]
named_scope :hierarchy_versions, lambda {|project_ids|
{
:conditions => ["#{Version.table_name}.shared = ? AND #{Version.table_name}.project_id IN (?)",
'hierarchy', project_ids]
}
}
def systemwide?
shared == 'system'
end
def start_date
effective_date
end
......
def closed?
status == 'closed'
end
def open?
status == 'open'
end
# Returns true if the version is completed: due date reached and no open issues
def completed?
......
def check_integrity
raise "Can't delete version" if self.fixed_issues.find(:first)
end
# Update the issue's fixed versions. Used if a version's sharing changes.
def update_issue_versions
Issue.update_fixed_versions_from_project_hierarchy_change
end
# Returns the average estimated time of assigned issues
# or 1 if no issue has an estimated time
app/views/issues/_attributes.rhtml
:title => l(:label_issue_category_new),
:tabindex => 199) if authorize_for('projects', 'add_issue_category') %></p>
<% end %>
<% unless @issue.assignable_versions.empty? %>
<p><%= f.select :fixed_version_id, (@issue.assignable_versions.collect {|v| [v.name, v.id]}), :include_blank => true %></p>
<% end %>
<p><%= f.select(:fixed_version_id,
(shared_version_options(@project, @issue.fixed_version_id)),
{ :include_blank => true }) unless @project.shared_versions.empty? %></p>
</div>
<div class="splitcontentright">
app/views/issues/bulk_edit.rhtml
<label><%= l(:field_fixed_version) %>:
<%= select_tag('fixed_version_id', content_tag('option', l(:label_no_change_option), :value => '') +
content_tag('option', l(:label_none), :value => 'none') +
options_from_collection_for_select(@project.versions.open.sort, :id, :name)) %></label>
options_for_select(shared_version_options(@project))) %></label>
</p>
<p>
app/views/issues/context_menu.rhtml
<% end -%>
</ul>
</li>
<% unless @project.nil? || @project.versions.open.empty? -%>
<% unless @project.nil? || @project.shared_versions.empty? -%>
<li class="folder">
<a href="#" class="submenu"><%= l(:field_fixed_version) %></a>
<ul>
<% @project.versions.open.sort.each do |v| -%>
<li><%= context_menu_link v.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'fixed_version_id' => v, :back_to => @back}, :method => :post,
<% @project.shared_versions.sort.each do |v| -%>
<li><%= context_menu_link format_version_name(v), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'fixed_version_id' => v, :back_to => @back}, :method => :post,
:selected => (@issue && v == @issue.fixed_version), :disabled => !@can[:update] %></li>
<% end -%>
<li><%= context_menu_link l(:label_none), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), 'fixed_version_id' => 'none', :back_to => @back}, :method => :post,
app/views/mailer/issue_edit.text.html.rhtml
<ul>
<% for detail in @journal.details %>
<% if unauthorized_version?(detail, @recipients + @cc) %>
<li><%= l(:text_journal_set_to, :label => l(:field_fixed_version), :value => l(:text_not_authorized)) %></li>
<% else %>
<li><%= show_detail(detail, true) %></li>
<% end %>
<% end %>
</ul>
app/views/mailer/issue_edit.text.plain.rhtml
<%= l(:text_issue_updated, :id => "##{@issue.id}", :author => @journal.user) %>
<% for detail in @journal.details -%>
<% if unauthorized_version?(detail, @recipients + @cc) %>
<%= l(:text_journal_set_to, :label => l(:field_fixed_version), :value => l(:text_not_authorized)) %>
<% else %>
<%= show_detail(detail, true) %>
<% end %>
<% end -%>
<%= @journal.notes if @journal.notes? %>
app/views/projects/changelog.rhtml
<label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %>
<%= tracker.name %></label><br />
<% end %>
<br />
<label for="shared_versions"><%= check_box_tag "shared_versions", 1, params[:shared_versions] %> <%= l(:label_show_shared_versions) %></label>
<p><%= submit_tag l(:button_apply), :class => 'button-small' %></p>
<% end %>
app/views/projects/list_files.rhtml
<% if container.is_a?(Version) -%>
<tr>
<th colspan="6" align="left">
<%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package") %>
<%= link_to(h(container.project.name) + ' - ' + h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package") %>
</th>
</tr>
<% end -%>
app/views/projects/roadmap.rhtml
<div id="roadmap">
<% @versions.each do |version| %>
<%= tag 'a', :name => version.name %>
<h3 class="icon22 icon22-package"><%= link_to h(version.name), :controller => 'versions', :action => 'show', :id => version %></h3>
<h3 class="icon22 icon22-package"><%= link_to h(version.project.name) + " - " + h(version.name), :controller => 'versions', :action => 'show', :id => version %></h3>
<%= render :partial => 'versions/overview', :locals => {:version => version} %>
<%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %>
......
<% end %>
<br />
<label for="completed"><%= check_box_tag "completed", 1, params[:completed] %> <%= l(:label_show_completed_versions) %></label>
<br />
<label for="shared_versions"><%= check_box_tag "shared_versions", 1, params[:shared_versions] %> <%= l(:label_show_shared_versions) %></label>
<p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
<% end %>
app/views/projects/settings/_versions.rhtml
<th><%= l(:field_effective_date) %></th>
<th><%= l(:field_description) %></th>
<th><%= l(:field_status) %></th>
<th><%= l(:field_shared) %></th>
<th><%= l(:label_wiki_page) unless @project.wiki.nil? %></th>
<th style="width:15%"></th>
</thead>
......
<td align="center"><%= format_date(version.effective_date) %></td>
<td><%=h version.description %></td>
<td><%= l("version_status_#{version.status}") %></td>
<td><%=h format_version_sharing_name(version) %></td>
<td><%= link_to(h(version.wiki_page_title), :controller => 'wiki', :page => Wiki.titleize(version.wiki_page_title)) unless version.wiki_page_title.blank? || @project.wiki.nil? %></td>
<td class="buttons">
<%= link_to_if_authorized l(:button_edit), {:controller => 'versions', :action => 'edit', :id => version }, :class => 'icon icon-edit' %>
app/views/versions/_form.rhtml
<p><%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %></p>
<p><%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %></p>
<p><%= f.text_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %></p>
<p><%= f.select :shared, Version::SharedValues.collect {|v| [l(v[1]),v[0]]} %></p>
<% @version.custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label :version, value %></p>
<% end %>
</div>
config/locales/bg.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/bs.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/ca.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/cs.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/da.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/de.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/el.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/en.yml
field_identity_url: OpenID URL
field_content: Content
field_group_by: Group results by
field_shared: Shared
setting_app_title: Application title
setting_app_subtitle: Application subtitle
......
label_stay_logged_in: Stay logged in
label_disabled: disabled
label_show_completed_versions: Show completed versions
label_show_shared_versions: Show shared versions
label_me: me
label_board: Forum
label_board_new: New forum
......
label_group_plural: Groups
label_group_new: New group
label_time_entry_plural: Spent time
label_version_shared_none: None
label_version_shared_hierarchy: "Parent and child projects"
label_version_shared_systemwide: "Systemwide"
button_login: Login
button_submit: Submit
......
text_wiki_page_nullify_children: "Keep child pages as root pages"
text_wiki_page_destroy_children: "Delete child pages and all their descendants"
text_wiki_page_reassign_children: "Reassign child pages to this parent page"
text_not_authorized: You are not authorized to view this.
default_role_manager: Manager
default_role_developper: Developer
config/locales/es.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/fi.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/fr.yml
field_active: Actif
enumeration_system_activity: Activité système
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/gl.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/he.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/hu.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/it.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/ja.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/ko.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/lt.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/nl.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/no.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/pl.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/pt-BR.yml
button_move_and_follow: Mover e seguir
setting_default_projects_modules: Módulos habilitados por padrão para novos projetos
setting_gravatar_default: Imagem Gravatar padrão
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/pt.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/ro.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/ru.yml
button_move_and_follow: Переместить и перейти
setting_default_projects_modules: Включенные по умолчанию модули для новых проектов
setting_gravatar_default: Изображение Gravatar по умолчанию
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/sk.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/sl.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/sr.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/sv.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/th.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/tr.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/uk.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/vi.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/zh-TW.yml
enumeration_doc_categories: 文件分類
enumeration_activities: 活動 (時間追蹤)
enumeration_system_activity: 系統活動
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
config/locales/zh.yml
button_move_and_follow: Move and follow
setting_default_projects_modules: Default enabled modules for new projects
setting_gravatar_default: Default Gravatar image
label_version_shared_none: None
text_not_authorized: You are not authorized to view this.
field_shared: Shared
label_version_shared_systemwide: Systemwide
label_show_shared_versions: Show shared versions
label_version_shared_hierarchy: Parent and child projects
db/migrate/20090907153556_add_shared_to_versions.rb
class AddSharedToVersions < ActiveRecord::Migration
def self.up
add_column :versions, :shared, :string, :default => 'none', :null => false
add_index :versions, :shared
end
def self.down
remove_column :versions, :shared
end
end
db/migrate/20090907170038_populate_version_shared.rb
class PopulateVersionShared < ActiveRecord::Migration
def self.up
Version.update_all('shared = \'none\'', ['shared IS NULL OR shared = ?',''])
end
def self.down
# No-op
end
end
lib/redmine.rb
menu.push :overview, { :controller => 'projects', :action => 'show' }
menu.push :activity, { :controller => 'projects', :action => 'activity' }
menu.push :roadmap, { :controller => 'projects', :action => 'roadmap' },
:if => Proc.new { |p| p.versions.any? }
:if => Proc.new { |p| p.shared_versions_visible_to_user.any? }
menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural
menu.push :new_issue, { :controller => 'issues', :action => 'new' }, :param => :project_id, :caption => :label_issue_new,
:html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }
test/exemplars/version_exemplar.rb
class Version < ActiveRecord::Base
generator_for :name, :method => :next_name
generator_for :status => 'open'
def self.next_name
@last_name ||= 'Version 1.0.0'
test/fixtures/attachments.yml
filename: picture.jpg
author_id: 2
content_type: image/jpeg
attachments_012:
created_on: 2006-07-19 21:07:27 +02:00
container_type: Version
container_id: 1
downloads: 0
disk_filename: 060719210727_version_file.zip
digest: b91e08d0cf966d5c6ff411bd8c4cc3a2
id: 12
filesize: 452
filename: version_file.zip
author_id: 2
content_type: application/octet-stream
test/fixtures/issues.yml
status_id: 5
start_date: <%= 1.day.ago.to_date.to_s(:db) %>
due_date:
issues_013:
created_on: <%= 5.days.ago.to_date.to_s(:db) %>
project_id: 3
updated_on: <%= 2.days.ago.to_date.to_s(:db) %>
priority_id: 4
subject: Subproject issue two
id: 13
fixed_version_id:
category_id:
description: This is a second issue on a cookbook subproject
tracker_id: 1
assigned_to_id:
author_id: 2
status_id: 1
test/fixtures/journal_details.yml
value: "30"
prop_key: done_ratio
journal_id: 1
journal_details_003:
old_value: nil
property: attr
id: 3
value: "6"
prop_key: fixed_version_id
journal_id: 4
test/fixtures/journals.yml
journalized_type: Issue
user_id: 2
journalized_id: 2
journals_004:
created_on: <%= 1.days.ago.to_date.to_s(:db) %>
notes: "A comment with a private version."
id: 4
journalized_type: Issue
user_id: 1
journalized_id: 6
test/fixtures/members.yml
project_id: 5
user_id: 8
mail_notification: false
members_008:
created_on: 2006-07-19 19:35:33 +02:00
project_id: 5
id: 8
user_id: 1
mail_notification: true
test/fixtures/versions.yml
---
versions_001:
created_on: 2006-07-19 21:00:07 +02:00
name: "0.1"
project_id: 1
updated_on: 2006-07-19 21:00:07 +02:00
id: 1
description: Beta
effective_date: 2006-07-01
status: closed
versions_002:
created_on: 2006-07-19 21:00:33 +02:00
name: "1.0"
project_id: 1
updated_on: 2006-07-19 21:00:33 +02:00
id: 2
description: Stable release
effective_date: <%= 20.day.from_now.to_date.to_s(:db) %>
status: locked
versions_003:
created_on: 2006-07-19 21:00:33 +02:00
name: "2.0"
project_id: 1
updated_on: 2006-07-19 21:00:33 +02:00
id: 3
description: Future version
effective_date:
status: open
---
versions_001:
created_on: 2006-07-19 21:00:07 +02:00
name: "0.1"
project_id: 1
updated_on: 2006-07-19 21:00:07 +02:00
id: 1
description: Beta
effective_date: 2006-07-01
status: closed
shared: 'none'
versions_002:
created_on: 2006-07-19 21:00:33 +02:00
name: "1.0"
project_id: 1
updated_on: 2006-07-19 21:00:33 +02:00
id: 2
description: Stable release
effective_date: <%= 20.day.from_now.to_date.to_s(:db) %>
status: locked
shared: 'none'
versions_003:
created_on: 2006-07-19 21:00:33 +02:00
name: "2.0"
project_id: 1
updated_on: 2006-07-19 21:00:33 +02:00
id: 3
description: Future version
effective_date:
status: open
shared: 'none'
versions_004:
created_on: 2006-07-19 21:00:33 +02:00
name: "2.0"
project_id: 3
updated_on: 2006-07-19 21:00:33 +02:00
id: 4
description: Future version on subproject
effective_date:
status: open
shared: 'hierarchy'
versions_005:
created_on: 2006-07-19 21:00:07 +02:00
name: "Alpha"
project_id: 2
updated_on: 2006-07-19 21:00:07 +02:00
id: 5
description: Private Alpha
effective_date: 2006-07-01
status: open
shared: 'none'
versions_006:
created_on: 2006-07-19 21:00:07 +02:00
name: "Private Version of public subproject"
project_id: 5
updated_on: 2006-07-19 21:00:07 +02:00
id: 6
description: "Should be done any day now..."
effective_date:
status: open
shared: 'hierarchy'
versions_007:
created_on: 2006-07-19 21:00:07 +02:00
name: "Systemwide visible version"
project_id: 2
updated_on: 2006-07-19 21:00:07 +02:00
id: 7
description:
effective_date:
status: open
shared: 'system'
test/functional/issues_controller_test.rb
assert_tag :input, :attributes => { :name => 'time_entry[hours]', :value => "2z" }
end
def test_post_edit_should_allow_fixed_version_to_be_set_to_a_subproject
issue = Issue.find(2)
@request.session[:user_id] = 2
post :edit,
:id => issue.id,
:issue => {
:fixed_version_id => 4
}
assert_response :redirect
issue.reload
assert_equal 4, issue.fixed_version_id
assert_not_equal issue.project_id, issue.fixed_version.project_id
end
def test_get_bulk_edit
@request.session[:user_id] = 2
get :bulk_edit, :ids => [1, 2]
......
assert_nil Issue.find(2).assigned_to
end
def test_post_bulk_edit_should_allow_fixed_version_to_be_set_to_a_subproject
@request.session[:user_id] = 2
post :bulk_edit,
:ids => [1,2],
:fixed_version_id => 4
assert_response :redirect
issues = Issue.find([1,2])
issues.each do |issue|
assert_equal 4, issue.fixed_version_id
assert_not_equal issue.project_id, issue.fixed_version.project_id
end
end
def test_move_routing
assert_routing(
{:method => :get, :path => '/issues/1/move'},
......
assert_tag :tag => 'a', :content => 'Immediate',
:attributes => { :href => '/issues/bulk_edit?ids%5B%5D=1&amp;priority_id=8',
:class => '' }
# Versions
assert_tag :tag => 'a', :content => 'eCookbook - 0.1',
:attributes => { :href => '/issues/bulk_edit?fixed_version_id=1&amp;ids%5B%5D=1',
:class => '' }
assert_tag :tag => 'a', :content => 'eCookbook - 1.0',
:attributes => { :href => '/issues/bulk_edit?fixed_version_id=2&amp;ids%5B%5D=1',
:class => '' }
assert_tag :tag => 'a', :content => 'eCookbook Subproject 1 - 2.0',
:attributes => { :href => '/issues/bulk_edit?fixed_version_id=4&amp;ids%5B%5D=1',
:class => '' }
assert_tag :tag => 'a', :content => 'Dave Lopper',
:attributes => { :href => '/issues/bulk_edit?assigned_to_id=3&amp;ids%5B%5D=1',
... This diff was truncated because it exceeds the maximum size that can be displayed.
(4-4/4)