Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79c85c8da0 |
@@ -23,7 +23,7 @@ class IssuesController < ApplicationController
|
||||
before_filter :find_project, :only => [:new, :update_form, :preview]
|
||||
before_filter :authorize, :except => [:index, :changes, :gantt, :calendar, :preview, :update_form, :context_menu]
|
||||
before_filter :find_optional_project, :only => [:index, :changes, :gantt, :calendar]
|
||||
accept_key_auth :index, :show, :changes
|
||||
accept_key_auth :index, :changes
|
||||
|
||||
helper :journals
|
||||
helper :projects
|
||||
@@ -343,12 +343,10 @@ class IssuesController < ApplicationController
|
||||
@gantt.events = events
|
||||
end
|
||||
|
||||
basename = (@project ? "#{@project.identifier}-" : '') + 'gantt'
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :template => "issues/gantt.rhtml", :layout => !request.xhr? }
|
||||
format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image')
|
||||
format.pdf { send_data(gantt_to_pdf(@gantt, @project), :type => 'application/pdf', :filename => "#{basename}.pdf") }
|
||||
format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{@project.identifier}-gantt.png") } if @gantt.respond_to?('to_image')
|
||||
format.pdf { send_data(gantt_to_pdf(@gantt, @project), :type => 'application/pdf', :filename => "#{@project.nil? ? '' : "#{@project.identifier}-" }gantt.pdf") }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -42,12 +42,6 @@ module QueriesHelper
|
||||
when :subject
|
||||
h((!@project.nil? && @project != issue.project) ? "#{issue.project.name} - " : '') +
|
||||
link_to(h(value), :controller => 'issues', :action => 'show', :id => issue)
|
||||
when :project
|
||||
link_to(h(value), :controller => 'projects', :action => 'show', :id => value)
|
||||
when :assigned_to
|
||||
link_to(h(value), :controller => 'account', :action => 'show', :id => value)
|
||||
when :author
|
||||
link_to(h(value), :controller => 'account', :action => 'show', :id => value)
|
||||
when :done_ratio
|
||||
progress_bar(value, :width => '80px')
|
||||
when :fixed_version
|
||||
|
||||
@@ -147,7 +147,7 @@ module RepositoriesHelper
|
||||
|
||||
def subversion_field_tags(form, repository)
|
||||
content_tag('p', form.text_field(:url, :size => 60, :required => true, :disabled => (repository && !repository.root_url.blank?)) +
|
||||
'<br />(file:///, http://, https://, svn://, svn+[tunnelscheme]://)') +
|
||||
'<br />(http://, https://, svn://, file:///)') +
|
||||
content_tag('p', form.text_field(:login, :size => 30)) +
|
||||
content_tag('p', form.password_field(:password, :size => 30, :name => 'ignore',
|
||||
:value => ((repository.new_record? || repository.password.blank?) ? '' : ('x'*15)),
|
||||
|
||||
@@ -65,20 +65,14 @@ class Attachment < ActiveRecord::Base
|
||||
nil
|
||||
end
|
||||
|
||||
# Copies the temporary file to its final location
|
||||
# and computes its MD5 hash
|
||||
# Copy temp file to its final location
|
||||
def before_save
|
||||
if @temp_file && (@temp_file.size > 0)
|
||||
logger.debug("saving '#{self.diskfile}'")
|
||||
md5 = Digest::MD5.new
|
||||
File.open(diskfile, "wb") do |f|
|
||||
buffer = ""
|
||||
while (buffer = @temp_file.read(8192))
|
||||
f.write(buffer)
|
||||
md5.update(buffer)
|
||||
end
|
||||
f.write(@temp_file.read)
|
||||
end
|
||||
self.digest = md5.hexdigest
|
||||
self.digest = self.class.digest(diskfile)
|
||||
end
|
||||
# Don't save the content type if it's longer than the authorized length
|
||||
if self.content_type && self.content_type.length > 255
|
||||
@@ -147,4 +141,11 @@ private
|
||||
end
|
||||
df
|
||||
end
|
||||
|
||||
# Returns the MD5 digest of the file at given path
|
||||
def self.digest(filename)
|
||||
File.open(filename, 'rb') do |f|
|
||||
Digest::MD5.hexdigest(f.read)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -20,7 +20,7 @@ require 'redmine/scm/adapters/subversion_adapter'
|
||||
class Repository::Subversion < Repository
|
||||
attr_protected :root_url
|
||||
validates_presence_of :url
|
||||
validates_format_of :url, :with => /^(http|https|svn(\+[^\s:\/\\]+)?|file):\/\/.+/i
|
||||
validates_format_of :url, :with => /^(http|https|svn|svn\+ssh|file):\/\/.+/i
|
||||
|
||||
def scm_adapter
|
||||
Redmine::Scm::Adapters::SubversionAdapter
|
||||
|
||||
@@ -15,11 +15,8 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require 'rails_generator/secret_key_generator'
|
||||
|
||||
class Token < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
validates_uniqueness_of :value
|
||||
|
||||
@@validity_time = 1.day
|
||||
|
||||
@@ -39,7 +36,9 @@ class Token < ActiveRecord::Base
|
||||
|
||||
private
|
||||
def self.generate_token_value
|
||||
s = Rails::SecretKeyGenerator.new(object_id).generate_secret
|
||||
s[0, 40]
|
||||
chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
|
||||
token_value = ''
|
||||
40.times { |i| token_value << chars[rand(chars.size-1)] }
|
||||
token_value
|
||||
end
|
||||
end
|
||||
|
||||
@@ -175,14 +175,8 @@ class User < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def self.find_by_autologin_key(key)
|
||||
tokens = Token.find_all_by_action_and_value('autologin', key)
|
||||
# Make sure there's only 1 token that matches the key
|
||||
if tokens.size == 1
|
||||
token = tokens.first
|
||||
if (token.created_on > Setting.autologin.to_i.day.ago) && token.user && token.user.active?
|
||||
token.user
|
||||
end
|
||||
end
|
||||
token = Token.find_by_action_and_value('autologin', key)
|
||||
token && (token.created_on > Setting.autologin.to_i.day.ago) && token.user.active? ? token.user : nil
|
||||
end
|
||||
|
||||
# Makes find_by_mail case-insensitive
|
||||
|
||||
@@ -22,7 +22,6 @@ class WikiContent < ActiveRecord::Base
|
||||
belongs_to :page, :class_name => 'WikiPage', :foreign_key => 'page_id'
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
validates_presence_of :text
|
||||
validates_length_of :comments, :maximum => 255, :allow_nil => true
|
||||
|
||||
acts_as_versioned
|
||||
class Version
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
xml.instruct!
|
||||
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
|
||||
xml.title truncate_single_line(@title, 100)
|
||||
xml.link "rel" => "self", "href" => url_for(params.merge(:only_path => false))
|
||||
xml.link "rel" => "alternate", "href" => url_for(params.merge(:only_path => false, :format => nil, :key => nil))
|
||||
xml.link "rel" => "self", "href" => url_for(params.merge({:format => nil, :only_path => false}))
|
||||
xml.link "rel" => "alternate", "href" => url_for(:controller => 'welcome', :only_path => false)
|
||||
xml.id url_for(:controller => 'welcome', :only_path => false)
|
||||
xml.updated((@items.first ? @items.first.event_datetime : Time.now).xmlschema)
|
||||
xml.author { xml.name "#{Setting.app_title}" }
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<% n = 0 -%>
|
||||
<% @issue.custom_field_values.each do |value| -%>
|
||||
<% @issue.custom_values.each do |value| -%>
|
||||
<td valign="top"><b><%=h value.custom_field.name %>:</b></td><td valign="top"><%= simple_format(h(show_value(value))) %></td>
|
||||
<% n = n + 1
|
||||
if (n > 1)
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<h2><%=l(:label_settings)%></h2>
|
||||
|
||||
<% tabs = project_settings_tabs %>
|
||||
|
||||
<% if tabs.any? %>
|
||||
<% selected_tab = params[:tab] ? params[:tab].to_s : tabs.first[:name] %>
|
||||
|
||||
<div class="tabs">
|
||||
@@ -22,8 +20,5 @@
|
||||
:style => (tab[:name] != selected_tab ? 'display:none' : nil),
|
||||
:class => 'tab-content') %>
|
||||
<% end -%>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
|
||||
<% html_title(l(:label_settings)) -%>
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
<p><%= link_to l(:label_issue_view_all), :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= call_hook(:view_projects_show_left, :project => @project) %>
|
||||
</div>
|
||||
|
||||
<div class="splitcontentright">
|
||||
@@ -54,7 +53,6 @@
|
||||
<p><%= link_to l(:label_news_view_all), :controller => 'news', :action => 'index', :project_id => @project %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= call_hook(:view_projects_show_right, :project => @project) %>
|
||||
</div>
|
||||
|
||||
<% content_for :sidebar do %>
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
<%= link_to l(:label_news_view_all), :controller => 'news' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= call_hook(:view_welcome_index_left, :projects => @projects) %>
|
||||
</div>
|
||||
|
||||
<div class="splitcontentright">
|
||||
@@ -26,7 +25,6 @@
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= call_hook(:view_welcome_index_right, :projects => @projects) %>
|
||||
</div>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
|
||||
@@ -5,22 +5,6 @@ Copyright (C) 2006-2009 Jean-Philippe Lang
|
||||
http://www.redmine.org/
|
||||
|
||||
|
||||
== 2009-05-17 v0.8.4
|
||||
|
||||
* Allow textile mailto links
|
||||
* Fixed: memory consumption when uploading file
|
||||
* Fixed: Mercurial integration doesn't work if Redmine is installed in folder path containing space
|
||||
* Fixed: an error is raised when no tab is available on project settings
|
||||
* Fixed: insert image macro corrupts urls with excalamation marks
|
||||
* Fixed: error on cross-project gantt PNG export
|
||||
* Fixed: self and alternate links in atom feeds do not respect Atom specs
|
||||
* Fixed: accept any svn tunnel scheme in repository URL
|
||||
* Fixed: issues/show should accept user's rss key
|
||||
* Fixed: consistency of custom fields display on the issue detail view
|
||||
* Fixed: wiki comments length validation is missing
|
||||
* Fixed: weak autologin token generation algorithm causes duplicate tokens
|
||||
|
||||
|
||||
== 2009-04-05 v0.8.3
|
||||
|
||||
* Separate project field and subject in cross-project issue view
|
||||
|
||||
@@ -792,7 +792,7 @@ class RedCloth3 < String
|
||||
(?:\(([^)]+?)\)(?="))? # $title
|
||||
":
|
||||
( # $url
|
||||
(\/|[a-zA-Z]+:\/\/|www\.|mailto:) # $proto
|
||||
(\/|[a-zA-Z]+:\/\/|www\.) # $proto
|
||||
[\w\/]\S+?
|
||||
)
|
||||
(\/)? # $slash
|
||||
@@ -907,7 +907,7 @@ class RedCloth3 < String
|
||||
end
|
||||
|
||||
IMAGE_RE = /
|
||||
(<p>|\s|^) # start of line?
|
||||
(<p>|.|^) # start of line?
|
||||
\! # opening
|
||||
(\<|\=|\>)? # optional alignment atts
|
||||
(#{C}) # optional style,class atts
|
||||
|
||||
@@ -105,7 +105,7 @@ module Redmine
|
||||
# makes Mercurial produce a xml output.
|
||||
def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
|
||||
revisions = Revisions.new
|
||||
cmd = "#{HG_BIN} --debug --encoding utf8 -R #{target('')} log -C --style #{shell_quote self.class.template_path}"
|
||||
cmd = "#{HG_BIN} --debug --encoding utf8 -R #{target('')} log -C --style #{self.class.template_path}"
|
||||
if identifier_from && identifier_to
|
||||
cmd << " -r #{identifier_from.to_i}:#{identifier_to.to_i}"
|
||||
elsif identifier_from
|
||||
|
||||
@@ -4,7 +4,7 @@ module Redmine
|
||||
module VERSION #:nodoc:
|
||||
MAJOR = 0
|
||||
MINOR = 8
|
||||
TINY = 4
|
||||
TINY = 3
|
||||
|
||||
# Branch values:
|
||||
# * official release: nil
|
||||
|
||||
@@ -195,13 +195,8 @@ task :migrate_from_mantis => :environment do
|
||||
file_type
|
||||
end
|
||||
|
||||
def read(*args)
|
||||
if @read_finished
|
||||
nil
|
||||
else
|
||||
@read_finished = true
|
||||
content
|
||||
end
|
||||
def read
|
||||
content
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -135,15 +135,8 @@ namespace :redmine do
|
||||
File.file? trac_fullpath
|
||||
end
|
||||
|
||||
def open
|
||||
File.open("#{trac_fullpath}", 'rb') {|f|
|
||||
@file = f
|
||||
yield self
|
||||
}
|
||||
end
|
||||
|
||||
def read(*args)
|
||||
@file.read(*args)
|
||||
def read
|
||||
File.open("#{trac_fullpath}", 'rb').read
|
||||
end
|
||||
|
||||
def description
|
||||
@@ -513,14 +506,12 @@ namespace :redmine do
|
||||
# Attachments
|
||||
ticket.attachments.each do |attachment|
|
||||
next unless attachment.exist?
|
||||
attachment.open {
|
||||
a = Attachment.new :created_on => attachment.time
|
||||
a.file = attachment
|
||||
a.author = find_or_create_user(attachment.author)
|
||||
a.container = i
|
||||
a.description = attachment.description
|
||||
migrated_ticket_attachments += 1 if a.save
|
||||
}
|
||||
a = Attachment.new :created_on => attachment.time
|
||||
a.file = attachment
|
||||
a.author = find_or_create_user(attachment.author)
|
||||
a.container = i
|
||||
a.description = attachment.description
|
||||
migrated_ticket_attachments += 1 if a.save
|
||||
end
|
||||
|
||||
# Custom fields
|
||||
@@ -565,14 +556,12 @@ namespace :redmine do
|
||||
page.attachments.each do |attachment|
|
||||
next unless attachment.exist?
|
||||
next if p.attachments.find_by_filename(attachment.filename.gsub(/^.*(\\|\/)/, '').gsub(/[^\w\.\-]/,'_')) #add only once per page
|
||||
attachment.open {
|
||||
a = Attachment.new :created_on => attachment.time
|
||||
a.file = attachment
|
||||
a.author = find_or_create_user(attachment.author)
|
||||
a.description = attachment.description
|
||||
a.container = p
|
||||
migrated_wiki_attachments += 1 if a.save
|
||||
}
|
||||
a = Attachment.new :created_on => attachment.time
|
||||
a.file = attachment
|
||||
a.author = find_or_create_user(attachment.author)
|
||||
a.description = attachment.description
|
||||
a.container = p
|
||||
migrated_wiki_attachments += 1 if a.save
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -22,19 +22,6 @@ class AttachmentTest < Test::Unit::TestCase
|
||||
|
||||
def setup
|
||||
end
|
||||
|
||||
def test_create
|
||||
a = Attachment.new(:container => Issue.find(1),
|
||||
:file => test_uploaded_file("testfile.txt", "text/plain"),
|
||||
:author => User.find(1))
|
||||
assert a.save
|
||||
assert_equal 'testfile.txt', a.filename
|
||||
assert_equal 59, a.filesize
|
||||
assert_equal 'text/plain', a.content_type
|
||||
assert_equal 0, a.downloads
|
||||
assert_equal Digest::MD5.hexdigest(test_uploaded_file("testfile.txt", "text/plain").read), a.digest
|
||||
assert File.exist?(a.diskfile)
|
||||
end
|
||||
|
||||
def test_diskfilename
|
||||
assert Attachment.disk_filename("test_file.txt") =~ /^\d{12}_test_file.txt$/
|
||||
@@ -43,4 +30,8 @@ class AttachmentTest < Test::Unit::TestCase
|
||||
assert_equal 'f8139524ebb8f32e51976982cd20a85d', Attachment.disk_filename("test_accentué")[13..-1]
|
||||
assert_equal 'cbb5b0f30978ba03731d61f9f6d10011', Attachment.disk_filename("test_accentué.ça")[13..-1]
|
||||
end
|
||||
|
||||
def test_digest
|
||||
assert_equal '1478adae0d4eb06d35897518540e25d6', Attachment.digest(Test::Unit::TestCase.fixture_path + "/files/testfile.txt")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -55,8 +55,6 @@ class ApplicationHelperTest < HelperTestCase
|
||||
'ftp://foo.bar' => '<a class="external" href="ftp://foo.bar">ftp://foo.bar</a>',
|
||||
'ftps://foo.bar' => '<a class="external" href="ftps://foo.bar">ftps://foo.bar</a>',
|
||||
'sftp://foo.bar' => '<a class="external" href="sftp://foo.bar">sftp://foo.bar</a>',
|
||||
# two exclamation marks
|
||||
'http://example.net/path!602815048C7B5C20!302.html' => '<a class="external" href="http://example.net/path!602815048C7B5C20!302.html">http://example.net/path!602815048C7B5C20!302.html</a>',
|
||||
}
|
||||
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
|
||||
end
|
||||
@@ -107,11 +105,7 @@ class ApplicationHelperTest < HelperTestCase
|
||||
'"link (Link title with "double-quotes")":http://foo.bar' => '<a href="http://foo.bar" title="Link title with "double-quotes"" class="external">link</a>',
|
||||
"This is not a \"Link\":\n\nAnother paragraph" => "This is not a \"Link\":</p>\n\n\n\t<p>Another paragraph",
|
||||
# no multiline link text
|
||||
"This is a double quote \"on the first line\nand another on a second line\":test" => "This is a double quote \"on the first line<br />\nand another on a second line\":test",
|
||||
# mailto link
|
||||
"\"system administrator\":mailto:sysadmin@example.com?subject=redmine%20permissions" => "<a href=\"mailto:sysadmin@example.com?subject=redmine%20permissions\">system administrator</a>",
|
||||
# two exclamation marks
|
||||
'"a link":http://example.net/path!602815048C7B5C20!302.html' => '<a href="http://example.net/path!602815048C7B5C20!302.html" class="external">a link</a>',
|
||||
"This is a double quote \"on the first line\nand another on a second line\":test" => "This is a double quote \"on the first line<br />\nand another on a second line\":test"
|
||||
}
|
||||
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user