##// END OF EJS Templates
Fixed: empty lines when displaying repository files with Windows style eol....
Fixed: empty lines when displaying repository files with Windows style eol. git-svn-id: http://redmine.rubyforge.org/svn/trunk@993 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r663:603e11d7a5aa
r980:38b185f1dc4d
Show More
wiki_content.rb
65 lines | 2.1 KiB | text/x-ruby | RubyLexer
Jean-Philippe Lang
wiki branch merged into trunk...
r320 # redMine - project management software
# Copyright (C) 2006-2007 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.
require 'zlib'
class WikiContent < ActiveRecord::Base
Jean-Philippe Lang
Optimistic locking added for wiki edits....
r542 set_locking_column :version
Jean-Philippe Lang
wiki branch merged into trunk...
r320 belongs_to :page, :class_name => 'WikiPage', :foreign_key => 'page_id'
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
validates_presence_of :text
acts_as_versioned
class Version
Jean-Philippe Lang
Added page association on versioned WikiContent...
r562 belongs_to :page, :class_name => 'WikiPage', :foreign_key => 'page_id'
Jean-Philippe Lang
wiki branch merged into trunk...
r320 belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
attr_protected :data
Jean-Philippe Lang
Merged 0.6 branch into trunk....
r663
acts_as_event :title => Proc.new {|o| "#{l(:label_wiki_edit)}: #{o.page.title} (##{o.version})"},
:description => :comments,
:datetime => :updated_on,
:url => Proc.new {|o| {:controller => 'wiki', :id => o.page.wiki.project_id, :page => o.page.title, :version => o.version}}
Jean-Philippe Lang
wiki branch merged into trunk...
r320 def text=(plain)
case Setting.wiki_compression
when 'gzip'
begin
self.data = Zlib::Deflate.deflate(plain, Zlib::BEST_COMPRESSION)
self.compression = 'gzip'
rescue
self.data = plain
self.compression = ''
end
else
self.data = plain
self.compression = ''
end
plain
end
def text
@text ||= case compression
when 'gzip'
Zlib::Inflate.inflate(data)
else
# uncompressed data
data
end
end
end
end