Revision 1297:0a574315af3e .svn/pristine/8e

View differences:

.svn/pristine/8e/8e0110723d5d1c708def7cce7300e8e639f394d6.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2012  Jean-Philippe Lang
3
#
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License
6
# as published by the Free Software Foundation; either version 2
7
# of the License, or (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17

  
18
class WikiRedirect < ActiveRecord::Base
19
  belongs_to :wiki
20

  
21
  validates_presence_of :title, :redirects_to
22
  validates_length_of :title, :redirects_to, :maximum => 255
23
end
.svn/pristine/8e/8e2b9fee089af39ba59ee64ccb9baee42d90cb0a.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2012  Jean-Philippe Lang
3
#
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License
6
# as published by the Free Software Foundation; either version 2
7
# of the License, or (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17

  
18
class ReportsController < ApplicationController
19
  menu_item :issues
20
  before_filter :find_project, :authorize, :find_issue_statuses
21

  
22
  def issue_report
23
    @trackers = @project.trackers
24
    @versions = @project.shared_versions.sort
25
    @priorities = IssuePriority.all.reverse
26
    @categories = @project.issue_categories
27
    @assignees = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort
28
    @authors = @project.users.sort
29
    @subprojects = @project.descendants.visible
30

  
31
    @issues_by_tracker = Issue.by_tracker(@project)
32
    @issues_by_version = Issue.by_version(@project)
33
    @issues_by_priority = Issue.by_priority(@project)
34
    @issues_by_category = Issue.by_category(@project)
35
    @issues_by_assigned_to = Issue.by_assigned_to(@project)
36
    @issues_by_author = Issue.by_author(@project)
37
    @issues_by_subproject = Issue.by_subproject(@project) || []
38

  
39
    render :template => "reports/issue_report"
40
  end
41

  
42
  def issue_report_details
43
    case params[:detail]
44
    when "tracker"
45
      @field = "tracker_id"
46
      @rows = @project.trackers
47
      @data = Issue.by_tracker(@project)
48
      @report_title = l(:field_tracker)
49
    when "version"
50
      @field = "fixed_version_id"
51
      @rows = @project.shared_versions.sort
52
      @data = Issue.by_version(@project)
53
      @report_title = l(:field_version)
54
    when "priority"
55
      @field = "priority_id"
56
      @rows = IssuePriority.all.reverse
57
      @data = Issue.by_priority(@project)
58
      @report_title = l(:field_priority)
59
    when "category"
60
      @field = "category_id"
61
      @rows = @project.issue_categories
62
      @data = Issue.by_category(@project)
63
      @report_title = l(:field_category)
64
    when "assigned_to"
65
      @field = "assigned_to_id"
66
      @rows = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort
67
      @data = Issue.by_assigned_to(@project)
68
      @report_title = l(:field_assigned_to)
69
    when "author"
70
      @field = "author_id"
71
      @rows = @project.users.sort
72
      @data = Issue.by_author(@project)
73
      @report_title = l(:field_author)
74
    when "subproject"
75
      @field = "project_id"
76
      @rows = @project.descendants.visible
77
      @data = Issue.by_subproject(@project) || []
78
      @report_title = l(:field_subproject)
79
    end
80

  
81
    respond_to do |format|
82
      if @field
83
        format.html {}
84
      else
85
        format.html { redirect_to :action => 'issue_report', :id => @project }
86
      end
87
    end
88
  end
89

  
90
  private
91

  
92
  def find_issue_statuses
93
    @statuses = IssueStatus.find(:all, :order => 'position')
94
  end
95
end
.svn/pristine/8e/8e2c265f6b995f869135056dd7126111e7c6a0e6.svn-base
1
<%= form_tag({:action => 'edit'}) do %>
2

  
3
<div class="box tabular settings">
4
<p><%= setting_text_field :app_title, :size => 30 %></p>
5

  
6
<p><%= setting_text_area :welcome_text, :cols => 60, :rows => 5, :class => 'wiki-edit' %></p>
7
<%= wikitoolbar_for 'settings_welcome_text' %>
8

  
9
<p><%= setting_text_field :attachment_max_size, :size => 6 %> <%= l(:"number.human.storage_units.units.kb") %></p>
10

  
11
<p><%= setting_text_field :per_page_options, :size => 20 %>
12
<em class="info"><%= l(:text_comma_separated) %></em></p>
13

  
14
<p><%= setting_text_field :activity_days_default, :size => 6 %> <%= l(:label_day_plural) %></p>
15

  
16
<p><%= setting_text_field :host_name, :size => 60 %>
17
<em class="info"><%= l(:label_example) %>: <%= @guessed_host_and_path %></em></p>
18

  
19
<p><%= setting_select :protocol, [['HTTP', 'http'], ['HTTPS', 'https']] %></p>
20

  
21
<p><%= setting_select :text_formatting, Redmine::WikiFormatting.format_names.collect{|name| [name, name.to_s]}, :blank => :label_none %></p>
22

  
23
<p><%= setting_check_box :cache_formatted_text %></p>
24

  
25
<p><%= setting_select :wiki_compression, [['Gzip', 'gzip']], :blank => :label_none %></p>
26

  
27
<p><%= setting_text_field :feeds_limit, :size => 6 %></p>
28

  
29
<p><%= setting_text_field :file_max_size_displayed, :size => 6 %> <%= l(:"number.human.storage_units.units.kb") %></p>
30

  
31
<p><%= setting_text_field :diff_max_lines_displayed, :size => 6 %></p>
32

  
33
<p><%= setting_text_field :repositories_encodings, :size => 60 %>
34
<em class="info"><%= l(:text_comma_separated) %></em></p>
35

  
36
<%= call_hook(:view_settings_general_form) %>
37
</div>
38

  
39
<%= submit_tag l(:button_save) %>
40
<% end %>
.svn/pristine/8e/8e360828b7559a0bf382d3c9703cd8bcdd40469c.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2012  Jean-Philippe Lang
3
#
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License
6
# as published by the Free Software Foundation; either version 2
7
# of the License, or (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17

  
18
require File.expand_path('../../../test_helper', __FILE__)
19

  
20
class RoutingVersionsTest < ActionController::IntegrationTest
21
  def test_roadmap
22
    # /projects/foo/versions is /projects/foo/roadmap
23
    assert_routing(
24
        { :method => 'get', :path => "/projects/33/roadmap" },
25
        { :controller => 'versions', :action => 'index', :project_id => '33' }
26
      )
27
  end
28

  
29
  def test_versions_scoped_under_project
30
    assert_routing(
31
        { :method => 'put', :path => "/projects/foo/versions/close_completed" },
32
        { :controller => 'versions', :action => 'close_completed',
33
          :project_id => 'foo' }
34
      )
35
    assert_routing(
36
        { :method => 'get', :path => "/projects/foo/versions.xml" },
37
        { :controller => 'versions', :action => 'index',
38
          :project_id => 'foo', :format => 'xml' }
39
      )
40
    assert_routing(
41
        { :method => 'get', :path => "/projects/foo/versions.json" },
42
        { :controller => 'versions', :action => 'index',
43
          :project_id => 'foo', :format => 'json' }
44
      )
45
    assert_routing(
46
        { :method => 'get', :path => "/projects/foo/versions/new" },
47
        { :controller => 'versions', :action => 'new',
48
          :project_id => 'foo' }
49
      )
50
    assert_routing(
51
        { :method => 'post', :path => "/projects/foo/versions" },
52
        { :controller => 'versions', :action => 'create',
53
          :project_id => 'foo' }
54
      )
55
    assert_routing(
56
        { :method => 'post', :path => "/projects/foo/versions.xml" },
57
        { :controller => 'versions', :action => 'create',
58
          :project_id => 'foo', :format => 'xml' }
59
      )
60
    assert_routing(
61
        { :method => 'post', :path => "/projects/foo/versions.json" },
62
        { :controller => 'versions', :action => 'create',
63
          :project_id => 'foo', :format => 'json' }
64
      )
65
  end
66

  
67
  def test_versions
68
    assert_routing(
69
        { :method => 'get', :path => "/versions/1" },
70
        { :controller => 'versions', :action => 'show', :id => '1' }
71
      )
72
    assert_routing(
73
        { :method => 'get', :path => "/versions/1.xml" },
74
        { :controller => 'versions', :action => 'show', :id => '1',
75
          :format => 'xml' }
76
      )
77
    assert_routing(
78
        { :method => 'get', :path => "/versions/1.json" },
79
        { :controller => 'versions', :action => 'show', :id => '1',
80
          :format => 'json' }
81
      )
82
    assert_routing(
83
        { :method => 'get', :path => "/versions/1/edit" },
84
        { :controller => 'versions', :action => 'edit', :id => '1' }
85
      )
86
    assert_routing(
87
        { :method => 'put', :path => "/versions/1" },
88
        { :controller => 'versions', :action => 'update', :id => '1' }
89
      )
90
    assert_routing(
91
        { :method => 'put', :path => "/versions/1.xml" },
92
        { :controller => 'versions', :action => 'update', :id => '1',
93
          :format => 'xml' }
94
      )
95
    assert_routing(
96
        { :method => 'put', :path => "/versions/1.json" },
97
        { :controller => 'versions', :action => 'update', :id => '1',
98
          :format => 'json' }
99
      )
100
    assert_routing(
101
        { :method => 'delete', :path => "/versions/1" },
102
        { :controller => 'versions', :action => 'destroy', :id => '1' }
103
      )
104
    assert_routing(
105
        { :method => 'delete', :path => "/versions/1.xml" },
106
        { :controller => 'versions', :action => 'destroy', :id => '1',
107
          :format => 'xml' }
108
      )
109
    assert_routing(
110
        { :method => 'delete', :path => "/versions/1.json" },
111
        { :controller => 'versions', :action => 'destroy', :id => '1',
112
          :format => 'json' }
113
      )
114
    assert_routing(
115
        { :method => 'post', :path => "/versions/1/status_by" },
116
        { :controller => 'versions', :action => 'status_by', :id => '1' }
117
      )
118
  end
119
end
.svn/pristine/8e/8e4c0c24e2e10f35f263c39915b03fd65f43917a.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2012  Jean-Philippe Lang
3
#
4
# This program is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU General Public License
6
# as published by the Free Software Foundation; either version 2
7
# of the License, or (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17

  
18
module Redmine
19
  module Acts
20
    module ActivityProvider
21
      def self.included(base)
22
        base.extend ClassMethods
23
      end
24

  
25
      module ClassMethods
26
        def acts_as_activity_provider(options = {})
27
          unless self.included_modules.include?(Redmine::Acts::ActivityProvider::InstanceMethods)
28
            cattr_accessor :activity_provider_options
29
            send :include, Redmine::Acts::ActivityProvider::InstanceMethods
30
          end
31

  
32
          options.assert_valid_keys(:type, :permission, :timestamp, :author_key, :find_options)
33
          self.activity_provider_options ||= {}
34

  
35
          # One model can provide different event types
36
          # We store these options in activity_provider_options hash
37
          event_type = options.delete(:type) || self.name.underscore.pluralize
38

  
39
          options[:timestamp] ||= "#{table_name}.created_on"
40
          options[:find_options] ||= {}
41
          options[:author_key] = "#{table_name}.#{options[:author_key]}" if options[:author_key].is_a?(Symbol)
42
          self.activity_provider_options[event_type] = options
43
        end
44
      end
45

  
46
      module InstanceMethods
47
        def self.included(base)
48
          base.extend ClassMethods
49
        end
50

  
51
        module ClassMethods
52
          # Returns events of type event_type visible by user that occured between from and to
53
          def find_events(event_type, user, from, to, options)
54
            provider_options = activity_provider_options[event_type]
55
            raise "#{self.name} can not provide #{event_type} events." if provider_options.nil?
56

  
57
            scope = self
58

  
59
            if from && to
60
              scope = scope.scoped(:conditions => ["#{provider_options[:timestamp]} BETWEEN ? AND ?", from, to])
61
            end
62

  
63
            if options[:author]
64
              return [] if provider_options[:author_key].nil?
65
              scope = scope.scoped(:conditions => ["#{provider_options[:author_key]} = ?", options[:author].id])
66
            end
67

  
68
            if options[:limit]
69
              # id and creation time should be in same order in most cases
70
              scope = scope.scoped(:order => "#{table_name}.id DESC", :limit => options[:limit])
71
            end
72

  
73
            if provider_options.has_key?(:permission)
74
              scope = scope.scoped(:conditions => Project.allowed_to_condition(user, provider_options[:permission] || :view_project, options))
75
            elsif respond_to?(:visible)
76
              scope = scope.visible(user, options)
77
            else
78
              ActiveSupport::Deprecation.warn "acts_as_activity_provider with implicit :permission option is deprecated. Add a visible scope to the #{self.name} model or use explicit :permission option."
79
              scope = scope.scoped(:conditions => Project.allowed_to_condition(user, "view_#{self.name.underscore.pluralize}".to_sym, options))
80
            end
81

  
82
            scope.all(provider_options[:find_options].dup)
83
          end
84
        end
85
      end
86
    end
87
  end
88
end
.svn/pristine/8e/8e83d829acf0d644776a59435b3e452af3ad4c89.svn-base
1
<% manage_allowed = User.current.allowed_to?(:manage_related_issues, @repository.project) %>
2

  
3
<div id="related-issues">
4
<% if manage_allowed %>
5
  <div class="contextual">
6
    <%= toggle_link l(:button_add), 'new-relation-form', {:focus => 'issue_id'} %>
7
  </div>
8
<% end %>
9

  
10
<h3><%= l(:label_related_issues) %></h3>
11
<ul>
12
<% @changeset.issues.visible.each do |issue| %>
13
  <li id="<%= "related-issue-#{issue.id}" %>"><%= link_to_issue issue %>
14
    <%= link_to(image_tag('link_break.png'),
15
                {:controller => 'repositories', :action => 'remove_related_issue',
16
                  :id => @project, :repository_id => @repository.identifier_param,
17
                  :rev => @changeset.identifier, :issue_id => issue},
18
                :remote => true,
19
                :method => :delete,
20
                :data => {:confirm => l(:text_are_you_sure)},
21
                :title => l(:label_relation_delete)) if manage_allowed %>
22
  </li>
23
<% end %>
24
</ul>
25

  
26
<% if manage_allowed %>
27
  <%= form_for(@issue, :as => :issue, :remote => true,
28
       :url => {:controller => 'repositories', :action => 'add_related_issue',
29
                :id => @project, :repository_id => @repository.identifier_param,
30
                :rev => @changeset.identifier},
31
       :method => :post,
32
       :html => {:id => 'new-relation-form', :style => (@issue ? '' : 'display: none;')}) do |f| %>
33
  <%= l(:label_issue) %> #<%= text_field_tag 'issue_id', '', :size => 10 %>
34
  <%= submit_tag l(:button_add) %>
35
  <%= toggle_link l(:button_cancel), 'new-relation-form'%>
36
  <% end %>
37
<% end %>
38
</div>
39

  
40
<%= javascript_tag "observeAutocompleteField('issue_id', '#{escape_javascript auto_complete_issues_path(:project_id => @project, :scope => 'all')}')" %>
.svn/pristine/8e/8eb597536121c47bd6dbb41ca2d2a9e203651155.svn-base
1
<h2><%=l(:label_issue_category)%>: <%=h @category.name %></h2>
2

  
3
<%= form_tag(issue_category_path(@category), :method => :delete) do %>
4
<div class="box">
5
<p><strong><%= l(:text_issue_category_destroy_question, @issue_count) %></strong></p>
6
<p><label><%= radio_button_tag 'todo', 'nullify', true %> <%= l(:text_issue_category_destroy_assignments) %></label><br />
7
<% if @categories.size > 0 %>
8
<label><%= radio_button_tag 'todo', 'reassign', false %> <%= l(:text_issue_category_reassign_to) %></label>:
9
<%= label_tag "reassign_to_id", l(:description_issue_category_reassign), :class => "hidden-for-sighted" %>
10
<%= select_tag 'reassign_to_id', options_from_collection_for_select(@categories, 'id', 'name') %></p>
11
<% end %>
12
</div>
13

  
14
<%= submit_tag l(:button_apply) %>
15
<%= link_to l(:button_cancel), :controller => 'projects', :action => 'settings', :id => @project, :tab => 'categories' %>
16
<% end %>

Also available in: Unified diff