Revision 1298:4f746d8966dd .svn/pristine/52

View differences:

.svn/pristine/52/52004253c47464e971de8985c2ff7d4abac9aadd.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2011  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 'net/imap'
19

  
20
module Redmine
21
  module IMAP
22
    class << self
23
      def check(imap_options={}, options={})
24
        host = imap_options[:host] || '127.0.0.1'
25
        port = imap_options[:port] || '143'
26
        ssl = !imap_options[:ssl].nil?
27
        folder = imap_options[:folder] || 'INBOX'
28

  
29
        imap = Net::IMAP.new(host, port, ssl)
30
        imap.login(imap_options[:username], imap_options[:password]) unless imap_options[:username].nil?
31
        imap.select(folder)
32
        imap.search(['NOT', 'SEEN']).each do |message_id|
33
          msg = imap.fetch(message_id,'RFC822')[0].attr['RFC822']
34
          logger.debug "Receiving message #{message_id}" if logger && logger.debug?
35
          if MailHandler.receive(msg, options)
36
            logger.debug "Message #{message_id} successfully received" if logger && logger.debug?
37
            if imap_options[:move_on_success]
38
              imap.copy(message_id, imap_options[:move_on_success])
39
            end
40
            imap.store(message_id, "+FLAGS", [:Seen, :Deleted])
41
          else
42
            logger.debug "Message #{message_id} can not be processed" if logger && logger.debug?
43
            imap.store(message_id, "+FLAGS", [:Seen])
44
            if imap_options[:move_on_failure]
45
              imap.copy(message_id, imap_options[:move_on_failure])
46
              imap.store(message_id, "+FLAGS", [:Deleted])
47
            end
48
          end
49
        end
50
        imap.expunge
51
      end
52

  
53
      private
54

  
55
      def logger
56
        RAILS_DEFAULT_LOGGER
57
      end
58
    end
59
  end
60
end
.svn/pristine/52/5207c75436c85ec591b380afe15450272eeedb94.svn-base
1
module CodeRay
2
  
3
  # = Duo
4
  #
5
  # A Duo is a convenient way to use CodeRay. You just create a Duo,
6
  # giving it a lang (language of the input code) and a format (desired
7
  # output format), and call Duo#highlight with the code.
8
  # 
9
  # Duo makes it easy to re-use both scanner and encoder for a repetitive
10
  # task. It also provides a very easy interface syntax:
11
  # 
12
  #   require 'coderay'
13
  #   CodeRay::Duo[:python, :div].highlight 'import this'
14
  # 
15
  # Until you want to do uncommon things with CodeRay, I recommend to use
16
  # this method, since it takes care of everything.
17
  class Duo
18

  
19
    attr_accessor :lang, :format, :options
20
    
21
    # Create a new Duo, holding a lang and a format to highlight code.
22
    # 
23
    # simple:
24
    #   CodeRay::Duo[:ruby, :html].highlight 'bla 42'
25
    # 
26
    # with options:
27
    #   CodeRay::Duo[:ruby, :html, :hint => :debug].highlight '????::??'
28
    # 
29
    # alternative syntax without options:
30
    #   CodeRay::Duo[:ruby => :statistic].encode 'class << self; end'
31
    # 
32
    # alternative syntax with options:
33
    #   CodeRay::Duo[{ :ruby => :statistic }, :do => :something].encode 'abc'
34
    # 
35
    # The options are forwarded to scanner and encoder
36
    # (see CodeRay.get_scanner_options).
37
    def initialize lang = nil, format = nil, options = {}
38
      if format.nil? && lang.is_a?(Hash) && lang.size == 1
39
        @lang = lang.keys.first
40
        @format = lang[@lang]
41
      else
42
        @lang = lang
43
        @format = format
44
      end
45
      @options = options
46
    end
47
    
48
    class << self
49
      # To allow calls like Duo[:ruby, :html].highlight.
50
      alias [] new
51
    end
52
    
53
    # The scanner of the duo. Only created once.
54
    def scanner
55
      @scanner ||= CodeRay.scanner @lang, CodeRay.get_scanner_options(@options)
56
    end
57
    
58
    # The encoder of the duo. Only created once.
59
    def encoder
60
      @encoder ||= CodeRay.encoder @format, @options
61
    end
62
    
63
    # Tokenize and highlight the code using +scanner+ and +encoder+.
64
    def encode code, options = {}
65
      options = @options.merge options
66
      encoder.encode(code, @lang, options)
67
    end
68
    alias highlight encode
69
    
70
    # Allows to use Duo like a proc object:
71
    # 
72
    #  CodeRay::Duo[:python => :yaml].call(code)
73
    # 
74
    # or, in Ruby 1.9 and later:
75
    # 
76
    #  CodeRay::Duo[:python => :yaml].(code)
77
    alias call encode
78
    
79
  end
80
  
81
end
.svn/pristine/52/520b379788e40ebe77f4044b9785418c4b20c19c.svn-base
1
// ** I18N
2

  
3
// Calendar EN language
4
// Author: Mihai Bazon, <mihai_bazon@yahoo.com>
5
// Encoding: any
6
// Translater: Mads N. Vestergaard <mnv@coolsms.dk>
7
// Distributed under the same terms as the calendar itself.
8

  
9
// For translators: please use UTF-8 if possible.  We strongly believe that
10
// Unicode is the answer to a real internationalized world.  Also please
11
// include your contact information in the header, as can be seen above.
12

  
13
// full day names
14
Calendar._DN = new Array
15
("Søndag",
16
 "Mandag",
17
 "Tirsdag",
18
 "Onsdag",
19
 "Torsdag",
20
 "Fredag",
21
 "Lørdag",
22
 "Søndag");
23

  
24
// Please note that the following array of short day names (and the same goes
25
// for short month names, _SMN) isn't absolutely necessary.  We give it here
26
// for exemplification on how one can customize the short day names, but if
27
// they are simply the first N letters of the full name you can simply say:
28
//
29
//   Calendar._SDN_len = N; // short day name length
30
//   Calendar._SMN_len = N; // short month name length
31
//
32
// If N = 3 then this is not needed either since we assume a value of 3 if not
33
// present, to be compatible with translation files that were written before
34
// this feature.
35

  
36
// short day names
37
Calendar._SDN = new Array
38
("Søn",
39
 "Man",
40
 "Tir",
41
 "Ons",
42
 "Tor",
43
 "Fre",
44
 "Lør",
45
 "Søn");
46

  
47
// First day of the week. "0" means display Sunday first, "1" means display
48
// Monday first, etc.
49
Calendar._FD = 1;
50

  
51
// full month names
52
Calendar._MN = new Array
53
("Januar",
54
 "Februar",
55
 "Marts",
56
 "April",
57
 "Maj",
58
 "Juni",
59
 "Juli",
60
 "August",
61
 "September",
62
 "Oktober",
63
 "November",
64
 "December");
65

  
66
// short month names
67
Calendar._SMN = new Array
68
("Jan",
69
 "Feb",
70
 "Mar",
71
 "Apr",
72
 "Maj",
73
 "Jun",
74
 "Jul",
75
 "Aug",
76
 "Sep",
77
 "Okt",
78
 "Nov",
79
 "Dec");
80

  
81
// tooltips
82
Calendar._TT = {};
83
Calendar._TT["INFO"] = "Om denne kalender";
84

  
85
Calendar._TT["ABOUT"] =
86
"DHTML Date/Time Selector\n" +
87
"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
88
"For seneste version, besøg: http://www.dynarch.com/projects/calendar/\n" +
89
"Distribueret under GNU LGPL.  Se http://gnu.org/licenses/lgpl.html for detaljer." +
90
"\n\n" +
91
"Dato valg:\n" +
92
"- Benyt \xab, \xbb tasterne til at vælge år\n" +
93
"- Benyt " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " tasterne til at vælge måned\n" +
94
"- Hold musetasten inde på punkterne for at vælge hurtigere.";
95
Calendar._TT["ABOUT_TIME"] = "\n\n" +
96
"Tids valg:\n" +
97
"- Klik på en af tidsrammerne for at forhøje det\n" +
98
"- eller Shift-klik for at mindske det\n" +
99
"- eller klik og træk for hurtigere valg.";
100

  
101
Calendar._TT["PREV_YEAR"] = "Forrige år (hold for menu)";
102
Calendar._TT["PREV_MONTH"] = "Forrige måned (hold for menu)";
103
Calendar._TT["GO_TODAY"] = "Gå til dags dato";
104
Calendar._TT["NEXT_MONTH"] = "Næste måned (hold for menu)";
105
Calendar._TT["NEXT_YEAR"] = "Næste år (hold for menu)";
106
Calendar._TT["SEL_DATE"] = "Vælg dato";
107
Calendar._TT["DRAG_TO_MOVE"] = "Træk for at flytte";
108
Calendar._TT["PART_TODAY"] = " (dags dato)";
109

  
110
// the following is to inform that "%s" is to be the first day of week
111
// %s will be replaced with the day name.
112
Calendar._TT["DAY_FIRST"] = "Vis %s først";
113

  
114
// This may be locale-dependent.  It specifies the week-end days, as an array
115
// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
116
// means Monday, etc.
117
Calendar._TT["WEEKEND"] = "6,7";
118

  
119
Calendar._TT["CLOSE"] = "Luk";
120
Calendar._TT["TODAY"] = "I dag";
121
Calendar._TT["TIME_PART"] = "(Shift-)Klik eller træk for at ændre værdi";
122

  
123
// date formats
124
Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
125
Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
126

  
127
Calendar._TT["WK"] = "uge";
128
Calendar._TT["TIME"] = "Tid:";
.svn/pristine/52/5239875e2f66506ef4227a2d0ff1c43dcfbd22ad.svn-base
1
<ul>
2
  <%= call_hook(:view_issues_context_menu_start, {:issues => @issues, :can => @can, :back => @back }) %>
3

  
4
<% if !@issue.nil? -%>
5
  <li><%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue},
6
          :class => 'icon-edit', :disabled => !@can[:edit] %></li>
7
<% else %>
8
  <li><%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id)},
9
          :class => 'icon-edit', :disabled => !@can[:edit] %></li>
10
<% end %>
11

  
12
  <% if @allowed_statuses.present? %>
13
  <li class="folder">
14
    <a href="#" class="submenu" onclick="return false;"><%= l(:field_status) %></a>
15
    <ul>
16
    <% @statuses.each do |s| -%>
17
        <li><%= context_menu_link h(s.name), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {:status_id => s}, :back_url => @back}, :method => :post,
18
                                  :selected => (@issue && s == @issue.status), :disabled => !(@can[:update] && @allowed_statuses.include?(s)) %></li>
19
    <% end -%>
20
    </ul>
21
  </li>
22
  <% end %>
23

  
24
  <% unless @trackers.nil? %>
25
  <li class="folder">
26
    <a href="#" class="submenu"><%= l(:field_tracker) %></a>
27
    <ul>
28
    <% @trackers.each do |t| -%>
29
        <li><%= context_menu_link h(t.name), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'tracker_id' => t}, :back_url => @back}, :method => :post,
30
                                  :selected => (@issue && t == @issue.tracker), :disabled => !@can[:edit] %></li>
31
    <% end -%>
32
    </ul>
33
  </li>
34
  <% end %>
35

  
36
  <li class="folder">
37
    <a href="#" class="submenu"><%= l(:field_priority) %></a>
38
    <ul>
39
    <% @priorities.each do |p| -%>
40
        <li><%= context_menu_link h(p.name), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'priority_id' => p}, :back_url => @back}, :method => :post,
41
                                  :selected => (@issue && p == @issue.priority), :disabled => (!@can[:edit] || @issues.detect {|i| !i.leaf?}) %></li>
42
    <% end -%>
43
    </ul>
44
  </li>
45

  
46
  <% #TODO: allow editing versions when multiple projects %>
47
  <% unless @project.nil? || @project.shared_versions.open.empty? -%>
48
  <li class="folder">
49
    <a href="#" class="submenu"><%= l(:field_fixed_version) %></a>
50
    <ul>
51
    <% @project.shared_versions.open.sort.each do |v| -%>
52
        <li><%= context_menu_link format_version_name(v), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'fixed_version_id' => v}, :back_url => @back}, :method => :post,
53
                                  :selected => (@issue && v == @issue.fixed_version), :disabled => !@can[:update] %></li>
54
    <% end -%>
55
        <li><%= context_menu_link l(:label_none), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'fixed_version_id' => 'none'}, :back_url => @back}, :method => :post,
56
                                  :selected => (@issue && @issue.fixed_version.nil?), :disabled => !@can[:update] %></li>
57
    </ul>
58
  </li>
59
  <% end %>
60
  <% if @assignables.present? -%>
61
  <li class="folder">
62
    <a href="#" class="submenu"><%= l(:field_assigned_to) %></a>
63
    <ul>
64
    <% @assignables.each do |u| -%>
65
        <li><%= context_menu_link h(u.name), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'assigned_to_id' => u}, :back_url => @back}, :method => :post,
66
                                  :selected => (@issue && u == @issue.assigned_to), :disabled => !@can[:update] %></li>
67
    <% end -%>
68
        <li><%= context_menu_link l(:label_nobody), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'assigned_to_id' => 'none'}, :back_url => @back}, :method => :post,
69
                                  :selected => (@issue && @issue.assigned_to.nil?), :disabled => !@can[:update] %></li>
70
    </ul>
71
  </li>
72
  <% end %>
73
  <% unless @project.nil? || @project.issue_categories.empty? -%>
74
  <li class="folder">
75
    <a href="#" class="submenu"><%= l(:field_category) %></a>
76
    <ul>
77
    <% @project.issue_categories.each do |u| -%>
78
        <li><%= context_menu_link h(u.name), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'category_id' => u}, :back_url => @back}, :method => :post,
79
                                  :selected => (@issue && u == @issue.category), :disabled => !@can[:update] %></li>
80
    <% end -%>
81
        <li><%= context_menu_link l(:label_none), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'category_id' => 'none'}, :back_url => @back}, :method => :post,
82
                                  :selected => (@issue && @issue.category.nil?), :disabled => !@can[:update] %></li>
83
    </ul>
84
  </li>
85
  <% end -%>
86

  
87
  <% if Issue.use_field_for_done_ratio? %>
88
  <li class="folder">
89
    <a href="#" class="submenu"><%= l(:field_done_ratio) %></a>
90
    <ul>
91
    <% (0..10).map{|x|x*10}.each do |p| -%>
92
        <li><%= context_menu_link "#{p}%", {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'done_ratio' => p}, :back_url => @back}, :method => :post,
93
                                      :selected => (@issue && p == @issue.done_ratio), :disabled => (!@can[:edit] || @issues.detect {|i| !i.leaf?}) %></li>
94
    <% end -%>
95
    </ul>
96
  </li>
97
  <% end %>
98

  
99
<% if !@issue.nil? %>
100
  <% if @can[:log_time] -%>
101
  <li><%= context_menu_link l(:button_log_time), {:controller => 'timelog', :action => 'new', :issue_id => @issue},
102
          :class => 'icon-time-add' %></li>
103
  <% end %>
104
  <% if User.current.logged? %>
105
  <li><%= watcher_link(@issue, User.current) %></li>
106
  <% end %>
107
<% end %>
108

  
109
<% if @issue.present? %>
110
  <li><%= context_menu_link l(:button_duplicate), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue},
111
          :class => 'icon-duplicate', :disabled => !@can[:copy] %></li>
112
<% end %>
113
  <li><%= context_menu_link l(:button_copy), new_issue_move_path(:ids => @issues.collect(&:id), :copy_options => {:copy => 't'}),
114
                          :class => 'icon-copy', :disabled => !@can[:move]  %></li>
115
  <li><%= context_menu_link l(:button_move), new_issue_move_path(:ids => @issues.collect(&:id)),
116
                          :class => 'icon-move', :disabled => !@can[:move]  %></li>
117
  <li><%= context_menu_link l(:button_delete), {:controller => 'issues', :action => 'destroy', :ids => @issues.collect(&:id), :back_url => @back},
118
                            :method => :post, :confirm => issues_destroy_confirmation_message(@issues), :class => 'icon-del', :disabled => !@can[:delete] %></li>
119

  
120
  <%= call_hook(:view_issues_context_menu_end, {:issues => @issues, :can => @can, :back => @back }) %>
121
</ul>
.svn/pristine/52/523c9c2d9c7b015aa1113d76af95f9049ad0813d.svn-base
1
# Only call Engines.init once, in the after_initialize block so that Rails
2
# plugin reloading works when turned on
3
config.after_initialize do
4
  Engines.init(initializer) if defined? :Engines
5
end
.svn/pristine/52/524c64f89f9b5171077500c8f6e0240696dfd698.svn-base
1
#!/usr/bin/env ruby
2
require File.expand_path('../../config/boot',  __FILE__)
3
require 'commands/generate'
.svn/pristine/52/52835e85663e2540d36b9bff7e6cf6a1403991c9.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2011  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 Redmine::CodesetUtilTest < ActiveSupport::TestCase
21

  
22
  def test_to_utf8_by_setting_from_latin1
23
    with_settings :repositories_encodings => 'UTF-8,ISO-8859-1' do
24
      s1 = "Texte encod\xc3\xa9"
25
      s2 = "Texte encod\xe9"
26
      s3 = s2.dup
27
      if s1.respond_to?(:force_encoding)
28
        s1.force_encoding("UTF-8")
29
        s2.force_encoding("ASCII-8BIT")
30
        s3.force_encoding("UTF-8")
31
      end
32
      assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s2)
33
      assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s3)
34
    end
35
  end
36

  
37
  def test_to_utf8_by_setting_from_euc_jp
38
    with_settings :repositories_encodings => 'UTF-8,EUC-JP' do
39
      s1 = "\xe3\x83\xac\xe3\x83\x83\xe3\x83\x89\xe3\x83\x9e\xe3\x82\xa4\xe3\x83\xb3"
40
      s2 = "\xa5\xec\xa5\xc3\xa5\xc9\xa5\xde\xa5\xa4\xa5\xf3"
41
      s3 = s2.dup
42
      if s1.respond_to?(:force_encoding)
43
        s1.force_encoding("UTF-8")
44
        s2.force_encoding("ASCII-8BIT")
45
        s3.force_encoding("UTF-8")
46
      end
47
      assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s2)
48
      assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s3)
49
    end
50
  end
51

  
52
  def test_to_utf8_by_setting_should_be_converted_all_latin1
53
    with_settings :repositories_encodings => 'ISO-8859-1' do
54
      s1 = "\xc3\x82\xc2\x80"
55
      s2 = "\xC2\x80"
56
      s3 = s2.dup
57
      if s1.respond_to?(:force_encoding)
58
        s1.force_encoding("UTF-8")
59
        s2.force_encoding("ASCII-8BIT")
60
        s3.force_encoding("UTF-8")
61
      end
62
      assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s2)
63
      assert_equal s1, Redmine::CodesetUtil.to_utf8_by_setting(s3)
64
    end
65
  end
66

  
67
  def test_to_utf8_by_setting_blank_string
68
    assert_equal "",  Redmine::CodesetUtil.to_utf8_by_setting("")
69
    assert_equal nil, Redmine::CodesetUtil.to_utf8_by_setting(nil)
70
  end
71

  
72
  def test_to_utf8_by_setting_returns_ascii_as_utf8
73
    s1 = "ASCII"
74
    s2 = s1.dup
75
    if s1.respond_to?(:force_encoding)
76
      s1.force_encoding("UTF-8")
77
      s2.force_encoding("ISO-8859-1")
78
    end
79
    str1 = Redmine::CodesetUtil.to_utf8_by_setting(s1)
80
    str2 = Redmine::CodesetUtil.to_utf8_by_setting(s2)
81
    assert_equal s1, str1
82
    assert_equal s1, str2
83
    if s1.respond_to?(:force_encoding)
84
      assert_equal "UTF-8", str1.encoding.to_s
85
      assert_equal "UTF-8", str2.encoding.to_s
86
    end
87
  end
88

  
89
  def test_to_utf8_by_setting_invalid_utf8_sequences_should_be_stripped
90
    with_settings :repositories_encodings => '' do
91
      # s1 = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt")
92
      s1 = "Texte encod\xe9 en ISO-8859-1."
93
      s1.force_encoding("ASCII-8BIT") if s1.respond_to?(:force_encoding)
94
      str = Redmine::CodesetUtil.to_utf8_by_setting(s1)
95
      if str.respond_to?(:force_encoding)
96
        assert str.valid_encoding?
97
        assert_equal "UTF-8", str.encoding.to_s
98
      end
99
      assert_equal "Texte encod? en ISO-8859-1.", str
100
    end
101
  end
102

  
103
  def test_to_utf8_by_setting_invalid_utf8_sequences_should_be_stripped_ja_jis
104
    with_settings :repositories_encodings => 'ISO-2022-JP' do
105
      s1 = "test\xb5\xfetest\xb5\xfe"
106
      s1.force_encoding("ASCII-8BIT") if s1.respond_to?(:force_encoding)
107
      str = Redmine::CodesetUtil.to_utf8_by_setting(s1)
108
      if str.respond_to?(:force_encoding)
109
        assert str.valid_encoding?
110
        assert_equal "UTF-8", str.encoding.to_s
111
      end
112
      assert_equal "test??test??", str
113
    end
114
  end
115
end
.svn/pristine/52/52861ceb2f3a417977bfbcbe6c0ba816774849bd.svn-base
1
--- 
2
enabled_modules_001: 
3
  name: issue_tracking
4
  project_id: 1
5
  id: 1
6
enabled_modules_002: 
7
  name: time_tracking
8
  project_id: 1
9
  id: 2
10
enabled_modules_003: 
11
  name: news
12
  project_id: 1
13
  id: 3
14
enabled_modules_004: 
15
  name: documents
16
  project_id: 1
17
  id: 4
18
enabled_modules_005: 
19
  name: files
20
  project_id: 1
21
  id: 5
22
enabled_modules_006: 
23
  name: wiki
24
  project_id: 1
25
  id: 6
26
enabled_modules_007: 
27
  name: repository
28
  project_id: 1
29
  id: 7
30
enabled_modules_008: 
31
  name: boards
32
  project_id: 1
33
  id: 8
34
enabled_modules_009: 
35
  name: repository
36
  project_id: 3
37
  id: 9
38
enabled_modules_010: 
39
  name: wiki
40
  project_id: 3
41
  id: 10
42
enabled_modules_011: 
43
  name: issue_tracking
44
  project_id: 2
45
  id: 11
46
enabled_modules_012: 
47
  name: time_tracking
48
  project_id: 3
49
  id: 12
50
enabled_modules_013: 
51
  name: issue_tracking
52
  project_id: 3
53
  id: 13
54
enabled_modules_014: 
55
  name: issue_tracking
56
  project_id: 5
57
  id: 14
58
enabled_modules_015: 
59
  name: wiki
60
  project_id: 2
61
  id: 15
62
enabled_modules_016: 
63
  name: boards
64
  project_id: 2
65
  id: 16
66
enabled_modules_017: 
67
  name: calendar
68
  project_id: 1
69
  id: 17
70
enabled_modules_018: 
71
  name: gantt 
72
  project_id: 1
73
  id: 18
74
enabled_modules_019: 
75
  name: calendar
76
  project_id: 2
77
  id: 19
78
enabled_modules_020: 
79
  name: gantt 
80
  project_id: 2
81
  id: 20
82
enabled_modules_021: 
83
  name: calendar
84
  project_id: 3
85
  id: 21
86
enabled_modules_022: 
87
  name: gantt
88
  project_id: 3
89
  id: 22
90
enabled_modules_023: 
91
  name: calendar
92
  project_id: 5
93
  id: 23
94
enabled_modules_024: 
95
  name: gantt 
96
  project_id: 5
97
  id: 24
98
enabled_modules_025: 
99
  name: news 
100
  project_id: 2
101
  id: 25
.svn/pristine/52/52e141046a10068211408d55ec6484cccb3d452a.svn-base
1
class CreateEnabledModules < ActiveRecord::Migration
2
  def self.up
3
    create_table :enabled_modules do |t|
4
      t.column :project_id, :integer
5
      t.column :name, :string, :null => false
6
    end
7
    add_index :enabled_modules, [:project_id], :name => :enabled_modules_project_id
8

  
9
    # Enable all modules for existing projects
10
    Project.all.each do |project|
11
      project.enabled_module_names = Redmine::AccessControl.available_project_modules
12
    end
13
  end
14

  
15
  def self.down
16
    drop_table :enabled_modules
17
  end
18
end
.svn/pristine/52/52f0bf1c239cf648c203a8def6f59245b007d594.svn-base
1
#!/usr/bin/env ruby
2
require File.expand_path('../../config/boot',  __FILE__)
3
require 'commands/console'
.svn/pristine/52/52fb1ca187bdbea92b2ca21fb1a15fadb8ae488e.svn-base
1
# Tests in this file ensure that:
2
#
3
# * plugin controller actions are found
4
# * actions defined in application controllers take precedence over those in plugins
5
# * actions in controllers in subsequently loaded plugins take precendence over those in previously loaded plugins
6
# * this works for actions in namespaced controllers accordingly
7

  
8
require File.dirname(__FILE__) + '/../test_helper'
9

  
10
class ControllerLoadingTest < ActionController::TestCase
11
  def setup
12
    @request    = ActionController::TestRequest.new
13
    @response   = ActionController::TestResponse.new
14
  end
15

  
16
  # plugin controller actions should be found
17

  
18
	def test_WITH_an_action_defined_only_in_a_plugin_IT_should_use_this_action
19
	  get_action_on_controller :an_action, :alpha_plugin
20
    assert_response_body 'rendered in AlphaPluginController#an_action'
21
  end
22
  
23
	def test_WITH_an_action_defined_only_in_a_namespaced_plugin_controller_IT_should_use_this_action
24
	  get_action_on_controller :an_action, :alpha_plugin, :namespace
25
    assert_response_body 'rendered in Namespace::AlphaPluginController#an_action'
26
  end
27

  
28
  # app takes precedence over plugins
29

  
30
  def test_WITH_an_action_defined_in_both_app_and_plugin_IT_should_use_the_one_in_app
31
	  get_action_on_controller :an_action, :app_and_plugin
32
    assert_response_body 'rendered in AppAndPluginController#an_action (from app)'
33
  end
34
  
35
  def test_WITH_an_action_defined_in_namespaced_controllers_in_both_app_and_plugin_IT_should_use_the_one_in_app
36
	  get_action_on_controller :an_action, :app_and_plugin, :namespace
37
    assert_response_body 'rendered in Namespace::AppAndPluginController#an_action (from app)'
38
  end
39

  
40
  # subsequently loaded plugins take precendence over previously loaded plugins
41

  
42
  def test_WITH_an_action_defined_in_two_plugin_controllers_IT_should_use_the_latter_of_both
43
	  get_action_on_controller :an_action, :shared_plugin
44
    assert_response_body 'rendered in SharedPluginController#an_action (from beta_plugin)'
45
  end
46
  
47
  def test_WITH_an_action_defined_in_two_namespaced_plugin_controllers_IT_should_use_the_latter_of_both
48
	  get_action_on_controller :an_action, :shared_plugin, :namespace
49
    assert_response_body 'rendered in Namespace::SharedPluginController#an_action (from beta_plugin)'
50
  end
51
end

Also available in: Unified diff