Revision 1298:4f746d8966dd .svn/pristine/37

View differences:

.svn/pristine/37/3708cf8f04cafb1d769bb5ceca8ecd5dd9ef264d.svn-base
1
<% reply_links = authorize_for('issues', 'edit') -%>
2
<% for journal in journals %>
3
  <div id="change-<%= journal.id %>" class="<%= journal.css_classes %>">
4
    <h4><div class="journal-link"><%= link_to "##{journal.indice}", :anchor => "note-#{journal.indice}" %></div>
5
    <%= avatar(journal.user, :size => "24") %>
6
    <%= content_tag('a', '', :name => "note-#{journal.indice}")%>
7
    <%= authoring journal.created_on, journal.user, :label => :label_updated_time_by %></h4>
8

  
9
    <% if journal.details.any? %>
10
    <ul class="details">
11
      <% for detail in journal.details %>
12
       <li><%= show_detail(detail) %></li>
13
      <% end %>
14
    </ul>
15
    <% end %>
16
    <%= render_notes(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %>
17
  </div>
18
  <%= call_hook(:view_issues_history_journal_bottom, { :journal => journal }) %>
19
<% end %>
20

  
21
<% heads_for_wiki_formatter if User.current.allowed_to?(:edit_issue_notes, issue.project) || User.current.allowed_to?(:edit_own_issue_notes, issue.project) %>
.svn/pristine/37/3761b0e47a324667f29e56ceb9695ed94f68fe4d.svn-base
1
# Redmine - project management software
2
# Copyright (C) 2006-2013  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 AutoCompletesController < ApplicationController
19
  before_filter :find_project
20

  
21
  def issues
22
    @issues = []
23
    q = (params[:q] || params[:term]).to_s.strip
24
    if q.present?
25
      scope = (params[:scope] == "all" || @project.nil? ? Issue : @project.issues).visible
26
      if q.match(/\A#?(\d+)\z/)
27
        @issues << scope.find_by_id($1.to_i)
28
      end
29
      @issues += scope.where("LOWER(#{Issue.table_name}.subject) LIKE LOWER(?)", "%#{q}%").order("#{Issue.table_name}.id DESC").limit(10).all
30
      @issues.compact!
31
    end
32
    render :layout => false
33
  end
34

  
35
  private
36

  
37
  def find_project
38
    if params[:project_id].present?
39
      @project = Project.find(params[:project_id])
40
    end
41
  rescue ActiveRecord::RecordNotFound
42
    render_404
43
  end
44
end
.svn/pristine/37/376d8c99e588cd6ce8e1e869de342e76d55623d6.svn-base
1
class AppAndPluginModel < ActiveRecord::Base
2
  def self.report_location; TestHelper::report_location(__FILE__); end
3
end
.svn/pristine/37/379e1dce88d814d8a7bcf79ecfe42aa08a6ba5f8.svn-base
1
<%= error_messages_for 'enumeration' %>
2
<div class="box">
3
<!--[form:optvalue]-->
4
<%= hidden_field 'enumeration', 'type'  %>
5

  
6
<p><label for="enumeration_name"><%=l(:field_name)%></label>
7
<%= text_field 'enumeration', 'name'  %></p>
8

  
9
<p><label for="enumeration_active"><%=l(:field_active)%></label>
10
<%= check_box 'enumeration', 'active'  %></p>
11

  
12
<p><label for="enumeration_is_default"><%=l(:field_is_default)%></label>
13
<%= check_box 'enumeration', 'is_default'  %></p>
14
<!--[eoform:optvalue]-->
15

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

  
20
module AttachmentsHelper
21
  # Displays view/delete links to the attachments of the given object
22
  # Options:
23
  #   :author -- author names are not displayed if set to false
24
  def link_to_attachments(container, options = {})
25
    options.assert_valid_keys(:author)
26

  
27
    if container.attachments.any?
28
      options = {:deletable => container.attachments_deletable?, :author => true}.merge(options)
29
      render :partial => 'attachments/links', :locals => {:attachments => container.attachments, :options => options}
30
    end
31
  end
32

  
33
  def render_api_attachment(attachment, api)
34
    api.attachment do
35
      api.id attachment.id
36
      api.filename attachment.filename
37
      api.filesize attachment.filesize
38
      api.content_type attachment.content_type
39
      api.description attachment.description
40
      api.content_url url_for(:controller => 'attachments', :action => 'download', :id => attachment, :filename => attachment.filename, :only_path => false)
41
      api.author(:id => attachment.author.id, :name => attachment.author.name) if attachment.author
42
      api.created_on attachment.created_on
43
    end
44
  end
45
end
.svn/pristine/37/37b31d80a7477985b5820b70128b01d1053a8cec.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 AuthSourceLdapTest < ActiveSupport::TestCase
21
  fixtures :auth_sources
22

  
23
  def setup
24
  end
25

  
26
  def test_create
27
    a = AuthSourceLdap.new(:name => 'My LDAP', :host => 'ldap.example.net', :port => 389, :base_dn => 'dc=example,dc=net', :attr_login => 'sAMAccountName')
28
    assert a.save
29
  end
30

  
31
  def test_should_strip_ldap_attributes
32
    a = AuthSourceLdap.new(:name => 'My LDAP', :host => 'ldap.example.net', :port => 389, :base_dn => 'dc=example,dc=net', :attr_login => 'sAMAccountName',
33
                           :attr_firstname => 'givenName ')
34
    assert a.save
35
    assert_equal 'givenName', a.reload.attr_firstname
36
  end
37

  
38
  def test_replace_port_zero_to_389
39
    a = AuthSourceLdap.new(
40
           :name => 'My LDAP', :host => 'ldap.example.net', :port => 0,
41
           :base_dn => 'dc=example,dc=net', :attr_login => 'sAMAccountName',
42
           :attr_firstname => 'givenName ')
43
    assert a.save
44
    assert_equal 389, a.port
45
  end
46

  
47
  if ldap_configured?
48
    context '#authenticate' do
49
      setup do
50
        @auth = AuthSourceLdap.find(1)
51
      end
52

  
53
      context 'with a valid LDAP user' do
54
        should 'return the user attributes' do
55
          attributes =  @auth.authenticate('example1','123456')
56
          assert attributes.is_a?(Hash), "An hash was not returned"
57
          assert_equal 'Example', attributes[:firstname]
58
          assert_equal 'One', attributes[:lastname]
59
          assert_equal 'example1@redmine.org', attributes[:mail]
60
          assert_equal @auth.id, attributes[:auth_source_id]
61
          attributes.keys.each do |attribute|
62
            assert User.new.respond_to?("#{attribute}="), "Unexpected :#{attribute} attribute returned"
63
          end
64
        end
65
      end
66

  
67
      context 'with an invalid LDAP user' do
68
        should 'return nil' do
69
          assert_equal nil, @auth.authenticate('nouser','123456')
70
        end
71
      end
72

  
73
      context 'without a login' do
74
        should 'return nil' do
75
          assert_equal nil, @auth.authenticate('','123456')
76
        end
77
      end
78

  
79
      context 'without a password' do
80
        should 'return nil' do
81
          assert_equal nil, @auth.authenticate('edavis','')
82
        end
83
      end
84

  
85
    end
86
  else
87
    puts '(Test LDAP server not configured)'
88
  end
89
end
.svn/pristine/37/37c265b21c0c5ae4d4c2ec8cfe9dabe532a90dd1.svn-base
1
<div class="contextual">
2
<%= link_to_if_authorized l(:button_edit), {:controller => 'documents', :action => 'edit', :id => @document}, :class => 'icon icon-edit', :accesskey => accesskey(:edit) %>
3
<%= link_to_if_authorized l(:button_delete), {:controller => 'documents', :action => 'destroy', :id => @document}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
4
</div>
5

  
6
<h2><%=h @document.title %></h2>
7

  
8
<p><em><%=h @document.category.name %><br />
9
<%= format_date @document.created_on %></em></p>
10
<div class="wiki">
11
<%= textilizable @document.description, :attachments => @document.attachments %>
12
</div>
13

  
14
<h3><%= l(:label_attachment_plural) %></h3>
15
<%= link_to_attachments @document %>
16

  
17
<% if authorize_for('documents', 'add_attachment') %>
18
<p><%= link_to l(:label_attachment_new), {}, :onclick => "Element.show('add_attachment_form'); Element.hide(this); Element.scrollTo('add_attachment_form'); return false;",
19
                                             :id => 'attach_files_link' %></p>
20
  <% form_tag({ :controller => 'documents', :action => 'add_attachment', :id => @document }, :multipart => true, :id => "add_attachment_form", :style => "display:none;") do %>
21
  <div class="box">
22
  <p><%= render :partial => 'attachments/form' %></p>
23
  </div>
24
  <%= submit_tag l(:button_add) %>
25
  <% end %>
26
<% end %>
27

  
28
<% html_title @document.title -%>
29

  
30
<% content_for :header_tags do %>
31
    <%= stylesheet_link_tag 'scm' %>
32
<% end %>
.svn/pristine/37/37f5b9c7485d4f52f7798b9d54c2aab8e937964a.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 TokenTest < ActiveSupport::TestCase
21
  fixtures :tokens
22

  
23
  def test_create
24
    token = Token.new
25
    token.save
26
    assert_equal 40, token.value.length
27
    assert !token.expired?
28
  end
29

  
30
  def test_create_should_remove_existing_tokens
31
    user = User.find(1)
32
    t1 = Token.create(:user => user, :action => 'autologin')
33
    t2 = Token.create(:user => user, :action => 'autologin')
34
    assert_not_equal t1.value, t2.value
35
    assert !Token.exists?(t1.id)
36
    assert  Token.exists?(t2.id)
37
  end
38
end

Also available in: Unified diff